geocodio-library-node 1.10.0 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +15 -12
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ declare module 'geocodio-library-node' {
|
|
|
17
17
|
postal_code?: string; // Alternative to zip used in some API calls
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
export type AddressInputComponents = Pick<AddressComponents, "street" | "city" | "county" | "state" | "postal_code" | "country">
|
|
21
|
+
|
|
20
22
|
export type GeocodeAccuracyType =
|
|
21
23
|
| 'rooftop'
|
|
22
24
|
| 'point'
|
|
@@ -224,26 +226,28 @@ declare module 'geocodio-library-node' {
|
|
|
224
226
|
formatted_address: string;
|
|
225
227
|
};
|
|
226
228
|
results: GeocodedAddress[];
|
|
229
|
+
_warnings?: string[];
|
|
227
230
|
}
|
|
228
231
|
|
|
229
|
-
export interface BatchGeocodeResponse {
|
|
230
|
-
results: Array<{
|
|
231
|
-
query:
|
|
232
|
+
export interface BatchGeocodeResponse<Q extends string | AddressInputComponents, T extends Array<Q> | Record<string, Q>> {
|
|
233
|
+
results: T extends Array<Q> ? Array<{
|
|
234
|
+
query: Q;
|
|
232
235
|
response: SingleGeocodeResponse;
|
|
233
|
-
}>
|
|
236
|
+
}> : Record<keyof T, {
|
|
234
237
|
response: SingleGeocodeResponse;
|
|
235
238
|
}>;
|
|
236
239
|
}
|
|
237
240
|
|
|
238
241
|
export interface ReverseGeocodeResponse {
|
|
239
242
|
results: GeocodedAddress[];
|
|
243
|
+
_warnings?: string[];
|
|
240
244
|
}
|
|
241
245
|
|
|
242
|
-
export interface BatchReverseGeocodeResponse {
|
|
243
|
-
results: Array<{
|
|
244
|
-
query:
|
|
246
|
+
export interface BatchReverseGeocodeResponse<Q extends string | [number, number], T extends Array<Q> | Record<string, Q>> {
|
|
247
|
+
results: T extends Array<Q> ? Array<{
|
|
248
|
+
query: Q;
|
|
245
249
|
response: ReverseGeocodeResponse;
|
|
246
|
-
}>
|
|
250
|
+
}> : Record<keyof T, {
|
|
247
251
|
response: ReverseGeocodeResponse;
|
|
248
252
|
}>;
|
|
249
253
|
}
|
|
@@ -259,11 +263,10 @@ declare module 'geocodio-library-node' {
|
|
|
259
263
|
export default class Geocodio {
|
|
260
264
|
constructor(apiKey?: string, hostname?: string, apiVersion?: string);
|
|
261
265
|
|
|
262
|
-
geocode(query: string |
|
|
263
|
-
geocode
|
|
264
|
-
|
|
266
|
+
geocode(query: string | AddressInputComponents, fields?: FieldOption[], limit?: number): Promise<SingleGeocodeResponse>;
|
|
267
|
+
geocode<Q extends string | AddressInputComponents, T extends Array<Q> | Record<string, Q>>(query: T, fields?: FieldOption[], limit?: number): Promise<BatchGeocodeResponse<Q, T>>;
|
|
265
268
|
reverse(query: string | [number, number], fields?: FieldOption[], limit?: number): Promise<ReverseGeocodeResponse>;
|
|
266
|
-
reverse
|
|
269
|
+
reverse<Q extends string | [number, number], T extends Array<Q> | Record<string, Q>>(query: T, fields?: FieldOption[], limit?: number): Promise<BatchReverseGeocodeResponse<Q, T>>;
|
|
267
270
|
|
|
268
271
|
list: {
|
|
269
272
|
create(filename: string, direction: string, format: string, callback: string): Promise<ListResponse>;
|