Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update params and types for geocoding and search API #184

Merged
merged 5 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Radar.initialize('prj_test_pk_...', { /* options */ });

Add the following script in your `html` file
```html
<script src="https://js.radar.com/v4.4.3/radar.min.js"></script>
<script src="https://js.radar.com/v4.4.4/radar.min.js"></script>
```

Then initialize the Radar SDK
Expand All @@ -73,8 +73,8 @@ To create a map, first initialize the Radar SDK with your publishable key. Then
```html
<html>
<head>
<link href="https://js.radar.com/v4.4.3/radar.css" rel="stylesheet">
<script src="https://js.radar.com/v4.4.3/radar.min.js"></script>
<link href="https://js.radar.com/v4.4.4/radar.css" rel="stylesheet">
<script src="https://js.radar.com/v4.4.4/radar.min.js"></script>
</head>

<body>
Expand All @@ -98,8 +98,8 @@ To create an autocomplete input, first initialize the Radar SDK with your publis
```html
<html>
<head>
<link href="https://js.radar.com/v4.4.3/radar.css" rel="stylesheet">
<script src="https://js.radar.com/v4.4.3/radar.min.js"></script>
<link href="https://js.radar.com/v4.4.4/radar.css" rel="stylesheet">
<script src="https://js.radar.com/v4.4.4/radar.min.js"></script>
</head>

<body>
Expand Down Expand Up @@ -130,8 +130,8 @@ To power [geofencing](https://radar.com/documentation/geofencing/overview) exper
```html
<html>
<head>
<link href="https://js.radar.com/v4.4.3/radar.css" rel="stylesheet">
<script src="https://js.radar.com/v4.4.3/radar.min.js"></script>
<link href="https://js.radar.com/v4.4.4/radar.css" rel="stylesheet">
<script src="https://js.radar.com/v4.4.4/radar.min.js"></script>
</head>

<body>
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "radar-sdk-js",
"version": "4.4.3",
"version": "4.4.4",
"description": "Web Javascript SDK for Radar, location infrastructure for mobile and web apps.",
"homepage": "https://radar.com",
"type": "module",
Expand Down
3 changes: 2 additions & 1 deletion src/api/geocoding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Geocoding {
static async forwardGeocode(params: RadarForwardGeocodeParams): Promise<RadarGeocodeResponse> {
const options = Config.get();

const { query, layers, country } = params;
const { query, layers, country, lang } = params;

const response: any = await Http.request({
method: 'GET',
Expand All @@ -22,6 +22,7 @@ class Geocoding {
query,
layers,
country,
lang,
},
});

Expand Down
2 changes: 2 additions & 0 deletions src/api/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class SearchAPI {
countryCode,
expandUnits,
mailable,
lang,
} = params;

// near can be provided as a string or Location object
Expand All @@ -44,6 +45,7 @@ class SearchAPI {
countryCode,
expandUnits,
mailable,
lang,
},
requestId,
});
Expand Down
35 changes: 23 additions & 12 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ export type RadarGeocodeLayer =
| 'address'
| 'postalCode'
| 'locality'
| 'neighborhood'
| 'county'
| 'state'
| 'country'
Expand Down Expand Up @@ -302,10 +303,24 @@ export interface RadarAddress {
street?: string;
}

export interface RadarTimeZone {
id: string;
name: string;
code: string;
currentTime: string;
utcOffset: number;
dstOffset: number;
}

export interface RadarAutocompleteAddress extends RadarAddress {
unit?: string;
}

export interface RadarGeocodeAddress extends RadarAddress {
unit?: string;
timeZone?: RadarTimeZone;
}

export type RadarValidationRecordType = 'S' | 'R' | 'P' | 'M' | 'H' | 'G' | 'F' | undefined;

export type RadarValidationPropertyType = 'commercial' | 'residential' | undefined;
Expand All @@ -325,6 +340,7 @@ export interface RadarForwardGeocodeParams {
query: string;
layers?: RadarGeocodeLayer[];
country?: string;
lang?: string;
}

export interface RadarReverseGeocodeParams {
Expand All @@ -333,13 +349,13 @@ export interface RadarReverseGeocodeParams {
layers?: RadarGeocodeLayer[];
}

export interface RadarGeocodeResponse extends RadarResponse {
addresses: RadarAddress[];
export interface RadarGeocodeResponse extends RadarResponse {
addresses: RadarGeocodeAddress[];
}

export interface RadarIPGeocodeResponse extends RadarResponse {
ip: string;
address?: RadarAddress;
address?: RadarGeocodeAddress;
proxy?: boolean;
}

Expand All @@ -352,6 +368,7 @@ export interface RadarAutocompleteParams {
/** @deprecated this is always true, regardless of the value passed here */
expandUnits?: boolean;
mailable?: boolean;
lang?: string;
}

export interface RadarAutocompleteResponse extends RadarResponse {
Expand Down Expand Up @@ -531,17 +548,12 @@ export interface RadarPolygonOptions {
'border-opacity'?: number;
},
}
export interface RadarAutocompleteUIOptions {
export interface RadarAutocompleteUIOptions extends Omit<RadarAutocompleteParams, 'query'> {
container: string | HTMLElement;
near?: string | Location; // bias for location results
debounceMS?: number, // Debounce time in milliseconds
threshold?: number, // DEPRECATED(use minCharacters instead)
/** @deprecated use minCharacters instead */
threshold?: number,
minCharacters?: number, // Minimum number of characters to trigger autocomplete
limit?: number, // Maximum number of autocomplete results
layers?: RadarGeocodeLayer[];
countryCode?: string;
expandUnits?: boolean;
mailable?: boolean;
placeholder?: string, // Placeholder text for the input field
onSelection?: (selection: any) => void,
onRequest?: (params: RadarAutocompleteParams) => void,
Expand All @@ -557,7 +569,6 @@ export interface RadarAutocompleteUIOptions {
}

export interface RadarAutocompleteConfig extends RadarAutocompleteUIOptions {
container: string | HTMLElement;
debounceMS: number, // Debounce time in milliseconds
threshold: number, // DEPRECATED(use minCharacters instead)
minCharacters: number, // Minimum number of characters to trigger autocomplete
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export default '4.4.3';
export default '4.4.4';
Loading