geocodio-library-node 1.6.1 → 1.7.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/README.md CHANGED
@@ -41,7 +41,7 @@ $ yarn add geocodio-library-node
41
41
  ```javascript
42
42
  const Geocodio = require('geocodio-library-node');
43
43
  const geocoder = new Geocodio('YOUR_API_KEY');
44
- // const geocoder = new Geocodio('YOUR_API_KEY', 'api-hipaa.geocod.io'); // optionally overwrite the API hostname
44
+ // const geocoder = new Geocodio('YOUR_API_KEY', 'api.enterprise.geocod.io'); // optionally overwrite the API hostname
45
45
 
46
46
  geocoder
47
47
  .geocode('1109 N Highland St, Arlington, VA')
@@ -311,5 +311,5 @@ If you discover any security related issues, please email security@geocod.io ins
311
311
 
312
312
  The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
313
313
 
314
- [npm-image]: https://badge.fury.io/js/geocodio-library-node.svg
314
+ [npm-image]: https://img.shields.io/npm/v/geocodio-library-node
315
315
  [npm-url]: https://npmjs.org/package/geocodio-library-node
package/lib/index.d.ts ADDED
@@ -0,0 +1,87 @@
1
+ declare module 'geocodio-library-node' {
2
+ export interface AddressComponents {
3
+ number?: string;
4
+ predirectional?: string;
5
+ street?: string;
6
+ suffix?: string;
7
+ formatted_street?: string;
8
+ city?: string;
9
+ county?: string;
10
+ state?: string;
11
+ zip?: string;
12
+ country?: string;
13
+ postal_code?: string; // Alternative to zip used in some API calls
14
+ }
15
+
16
+ export type GeocodeAccuracyType =
17
+ | 'rooftop'
18
+ | 'street'
19
+ | 'intersection'
20
+ | 'city'
21
+ | 'state'
22
+ | 'county';
23
+
24
+ export interface GeocodedAddress {
25
+ address_components: AddressComponents;
26
+ formatted_address: string;
27
+ location: {
28
+ lat: number;
29
+ lng: number;
30
+ };
31
+ accuracy: number;
32
+ accuracy_type: GeocodeAccuracyType;
33
+ source?: string;
34
+ fields?: Fields;
35
+ }
36
+
37
+ export interface Fields {
38
+ timezone?: {
39
+ abbreviation: string;
40
+ [key: string]: unknown;
41
+ };
42
+ [key: string]: unknown;
43
+ }
44
+
45
+ export interface SingleGeocodeResponse {
46
+ input: {
47
+ address_components: AddressComponents;
48
+ formatted_address: string;
49
+ };
50
+ results: GeocodedAddress[];
51
+ }
52
+
53
+ export interface BatchGeocodeResponse {
54
+ results: {
55
+ [key: string]: {
56
+ response: SingleGeocodeResponse;
57
+ };
58
+ };
59
+ }
60
+
61
+ // List API types
62
+ export interface ListResponse {
63
+ id: number;
64
+ file: {
65
+ filename: string;
66
+ };
67
+ }
68
+
69
+ export default class Geocodio {
70
+ constructor(apiKey?: string, hostname?: string, apiVersion?: string);
71
+
72
+ geocode(query: string | AddressComponents, fields?: string[], limit?: number): Promise<SingleGeocodeResponse>;
73
+ geocode(query: (string | AddressComponents)[] | Record<string, string | AddressComponents>, fields?: string[], limit?: number): Promise<BatchGeocodeResponse>;
74
+
75
+ reverse(query: string | [number, number], fields?: string[], limit?: number): Promise<SingleGeocodeResponse>;
76
+ reverse(query: (string | [number, number])[], fields?: string[], limit?: number): Promise<BatchGeocodeResponse>;
77
+
78
+ list: {
79
+ create(filename: string, direction: string, format: string, callback: string): Promise<ListResponse>;
80
+ status(listId: number): Promise<unknown>;
81
+ all(): Promise<unknown>;
82
+ download(listId: number, output: string): Promise<unknown>;
83
+ delete(listId: number): Promise<unknown>;
84
+ deleteList(listId: number): Promise<unknown>; // Alias for delete
85
+ };
86
+ }
87
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geocodio-library-node",
3
- "version": "1.6.1",
3
+ "version": "1.7.0",
4
4
  "description": "geocod.io geocoding API library",
5
5
  "homepage": "https://github.com/Geocodio/geocodio-library-node",
6
6
  "author": {
@@ -12,6 +12,7 @@
12
12
  "lib"
13
13
  ],
14
14
  "main": "lib/index.js",
15
+ "types": "lib/index.d.ts",
15
16
  "keywords": [
16
17
  "geocoding",
17
18
  "geocode",