geocodio-library-node 1.15.1 → 2.0.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 +7 -20
- package/lib/index.d.ts +11 -10
- package/lib/index.js +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -54,19 +54,6 @@ geocoder
|
|
|
54
54
|
})
|
|
55
55
|
/*
|
|
56
56
|
response => {
|
|
57
|
-
"input": {
|
|
58
|
-
"address_components": {
|
|
59
|
-
"number": "1109",
|
|
60
|
-
"predirectional": "N",
|
|
61
|
-
"street": "Highland",
|
|
62
|
-
"suffix": "St",
|
|
63
|
-
"formatted_street": "N Highland St",
|
|
64
|
-
"city": "Arlington",
|
|
65
|
-
"state": "VA",
|
|
66
|
-
"country": "US"
|
|
67
|
-
},
|
|
68
|
-
"formatted_address": "1109 N Highland St, Arlington, VA"
|
|
69
|
-
},
|
|
70
57
|
"results": [
|
|
71
58
|
{
|
|
72
59
|
"address_components": {
|
|
@@ -77,8 +64,8 @@ geocoder
|
|
|
77
64
|
"formatted_street": "N Highland St",
|
|
78
65
|
"city": "Arlington",
|
|
79
66
|
"county": "Arlington County",
|
|
80
|
-
"
|
|
81
|
-
"
|
|
67
|
+
"state_province": "VA",
|
|
68
|
+
"postal_code": "22201",
|
|
82
69
|
"country": "US"
|
|
83
70
|
},
|
|
84
71
|
"formatted_address": "1109 N Highland St, Arlington, VA 22201",
|
|
@@ -99,8 +86,8 @@ geocoder
|
|
|
99
86
|
"formatted_street": "N Highland St",
|
|
100
87
|
"city": "Arlington",
|
|
101
88
|
"county": "Arlington County",
|
|
102
|
-
"
|
|
103
|
-
"
|
|
89
|
+
"state_province": "VA",
|
|
90
|
+
"postal_code": "22201",
|
|
104
91
|
"country": "US"
|
|
105
92
|
},
|
|
106
93
|
"formatted_address": "1109 N Highland St, Arlington, VA 22201",
|
|
@@ -196,7 +183,7 @@ For forward geocoding requests it is possible to supply [individual address comp
|
|
|
196
183
|
geocoder.geocode({
|
|
197
184
|
street: '1109 N Highland St',
|
|
198
185
|
city: 'Arlington',
|
|
199
|
-
|
|
186
|
+
state_province: 'VA',
|
|
200
187
|
postal_code: '22201'
|
|
201
188
|
})
|
|
202
189
|
.then(response => { ... })
|
|
@@ -206,12 +193,12 @@ geocoder.geocode([
|
|
|
206
193
|
{
|
|
207
194
|
street: '1109 N Highland St',
|
|
208
195
|
city: 'Arlington',
|
|
209
|
-
|
|
196
|
+
state_province: 'VA'
|
|
210
197
|
},
|
|
211
198
|
{
|
|
212
199
|
street: '525 University Ave',
|
|
213
200
|
city: 'Toronto',
|
|
214
|
-
|
|
201
|
+
state_province: 'ON',
|
|
215
202
|
country: 'Canada',
|
|
216
203
|
},
|
|
217
204
|
])
|
package/lib/index.d.ts
CHANGED
|
@@ -178,18 +178,23 @@ declare module 'geocodio-library-node' {
|
|
|
178
178
|
street?: string;
|
|
179
179
|
suffix?: string;
|
|
180
180
|
postdirectional?: string;
|
|
181
|
-
|
|
182
|
-
|
|
181
|
+
unit_type?: string;
|
|
182
|
+
unit_number?: string;
|
|
183
183
|
formatted_street?: string;
|
|
184
184
|
city?: string;
|
|
185
185
|
county?: string;
|
|
186
|
-
|
|
187
|
-
|
|
186
|
+
state_province?: string;
|
|
187
|
+
postal_code?: string;
|
|
188
188
|
country?: string;
|
|
189
|
-
postal_code?: string; // Alternative to zip used in some API calls
|
|
190
189
|
}
|
|
191
190
|
|
|
192
|
-
|
|
191
|
+
// Address input components accepted by the geocode endpoint.
|
|
192
|
+
// `state` is still accepted by the API for backwards compatibility,
|
|
193
|
+
// but `state_province` is the v2 field name.
|
|
194
|
+
export type AddressInputComponents =
|
|
195
|
+
Pick<AddressComponents, "street" | "city" | "county" | "state_province" | "postal_code" | "country"> & {
|
|
196
|
+
state?: string;
|
|
197
|
+
}
|
|
193
198
|
|
|
194
199
|
export type GeocodeAccuracyType =
|
|
195
200
|
| 'rooftop'
|
|
@@ -393,10 +398,6 @@ declare module 'geocodio-library-node' {
|
|
|
393
398
|
| 'acs-social';
|
|
394
399
|
|
|
395
400
|
export interface SingleGeocodeResponse {
|
|
396
|
-
input: {
|
|
397
|
-
address_components: AddressComponents;
|
|
398
|
-
formatted_address: string;
|
|
399
|
-
};
|
|
400
401
|
results: GeocodedAddress[];
|
|
401
402
|
_warnings?: string[];
|
|
402
403
|
}
|
package/lib/index.js
CHANGED
|
@@ -129,13 +129,13 @@ class Geocodio {
|
|
|
129
129
|
this.apiKey = apiKey || process.env.GEOCODIO_API_KEY || null;
|
|
130
130
|
this.hostname =
|
|
131
131
|
hostname || process.env.GEOCODIO_HOSTNAME || "api.geocod.io";
|
|
132
|
-
this.apiVersion = apiVersion || process.env.GEOCODIO_API_VERSION || "
|
|
132
|
+
this.apiVersion = apiVersion || process.env.GEOCODIO_API_VERSION || "v2";
|
|
133
133
|
|
|
134
134
|
this.SINGLE_TIMEOUT_MS = 5000;
|
|
135
135
|
this.BATCH_TIMEOUT_MS = 30 * 60 * 1000;
|
|
136
136
|
|
|
137
137
|
this.HTTP_HEADERS = {
|
|
138
|
-
"User-Agent": "geocodio-library-node/
|
|
138
|
+
"User-Agent": "geocodio-library-node/2.0.0",
|
|
139
139
|
Authorization: `Bearer ${this.apiKey}`
|
|
140
140
|
};
|
|
141
141
|
|
|
@@ -143,6 +143,7 @@ class Geocodio {
|
|
|
143
143
|
"street",
|
|
144
144
|
"city",
|
|
145
145
|
"state",
|
|
146
|
+
"state_province",
|
|
146
147
|
"postal_code",
|
|
147
148
|
"country"
|
|
148
149
|
];
|