@parseapi/sdk 0.1.2 → 0.2.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 +11 -0
- package/dist/index.cjs +54 -13
- package/dist/index.d.cts +472 -30
- package/dist/index.d.ts +472 -30
- package/dist/index.js +54 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,7 +23,14 @@ One method per endpoint, named after the route.
|
|
|
23
23
|
await parse.ip('8.8.8.8');
|
|
24
24
|
await parse.ip.self();
|
|
25
25
|
await parse.email('hello@gmail.com');
|
|
26
|
+
await parse.vat('DE136695976');
|
|
27
|
+
await parse.iban('DE89370400440532013000');
|
|
28
|
+
await parse.npi('1881018208');
|
|
26
29
|
await parse.phone('+14155552671');
|
|
30
|
+
await parse.carrier('+14155552671');
|
|
31
|
+
await parse.caller('+14155552671');
|
|
32
|
+
await parse.hlr('+14155552671');
|
|
33
|
+
await parse.postal('SW1A 1AA');
|
|
27
34
|
await parse.postal('28202', { country: 'US' });
|
|
28
35
|
await parse.postal.nearby('28202', { country: 'US', radius: 40 });
|
|
29
36
|
await parse.postal.distance('28202', '10001', { country: 'US' });
|
|
@@ -31,11 +38,14 @@ await parse.city('charlotte', { country: 'US' });
|
|
|
31
38
|
await parse.city.id('city_mb8mbqrkz8zb');
|
|
32
39
|
await parse.city.search('char', { country: 'US', limit: 10 });
|
|
33
40
|
await parse.city.nearest(35.2271, -80.8431);
|
|
41
|
+
await parse.city.nearby('denver', { radius: 8, unit: 'mi' });
|
|
34
42
|
await parse.country('US');
|
|
35
43
|
await parse.country.states('US');
|
|
44
|
+
await parse.state('colorado');
|
|
36
45
|
await parse.state('NC', { country: 'US' });
|
|
37
46
|
await parse.state.districts('NC', { country: 'US' });
|
|
38
47
|
await parse.district('37081');
|
|
48
|
+
await parse.district('guilford county');
|
|
39
49
|
await parse.continent('NA');
|
|
40
50
|
await parse.continent.countries('NA');
|
|
41
51
|
await parse.currency('USD');
|
|
@@ -52,6 +62,7 @@ await parse.weather(40.7128, -74.006);
|
|
|
52
62
|
await parse.domain('example.com');
|
|
53
63
|
await parse.mx('example.com');
|
|
54
64
|
await parse.useragent(uaString);
|
|
65
|
+
await parse.vin('1HGCM82633A004352');
|
|
55
66
|
await parse.emoji('rocket');
|
|
56
67
|
await parse.emoji.search('fire');
|
|
57
68
|
```
|
package/dist/index.cjs
CHANGED
|
@@ -24,7 +24,7 @@ __export(index_exports, {
|
|
|
24
24
|
parseAPI: () => parseAPI
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(index_exports);
|
|
27
|
-
var VERSION = "0.
|
|
27
|
+
var VERSION = "0.2.0";
|
|
28
28
|
var DEFAULT_BASE_URL = "https://api.parseapi.com";
|
|
29
29
|
var DEFAULT_TIMEOUT_MS = 1e4;
|
|
30
30
|
var DEFAULT_RETRIES = 2;
|
|
@@ -126,8 +126,10 @@ function parseAPI(apiKey, options = {}) {
|
|
|
126
126
|
at: opts?.at
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
|
+
const idOpts = lonOrOpts && typeof lonOrOpts === "object" ? lonOrOpts : void 0;
|
|
129
130
|
return request(`/timezone/${enc(idOrLat)}`, {
|
|
130
|
-
at:
|
|
131
|
+
at: idOpts?.at,
|
|
132
|
+
to: idOpts?.to
|
|
131
133
|
});
|
|
132
134
|
}
|
|
133
135
|
return {
|
|
@@ -143,6 +145,12 @@ function parseAPI(apiKey, options = {}) {
|
|
|
143
145
|
countries: (code) => request(`/continent/${enc(code)}/countries`)
|
|
144
146
|
}
|
|
145
147
|
),
|
|
148
|
+
bloc: Object.assign(
|
|
149
|
+
(code) => request(`/bloc/${enc(code)}`),
|
|
150
|
+
{
|
|
151
|
+
countries: (code) => request(`/bloc/${enc(code)}/countries`)
|
|
152
|
+
}
|
|
153
|
+
),
|
|
146
154
|
country: Object.assign(
|
|
147
155
|
(code) => request(`/country/${enc(code)}`),
|
|
148
156
|
{
|
|
@@ -150,45 +158,78 @@ function parseAPI(apiKey, options = {}) {
|
|
|
150
158
|
}
|
|
151
159
|
),
|
|
152
160
|
state: Object.assign(
|
|
153
|
-
(code, opts) => request(`/state/${enc(code)}`, { country: opts
|
|
161
|
+
(code, opts) => request(`/state/${enc(code)}`, { country: opts?.country }),
|
|
154
162
|
{
|
|
155
|
-
districts: (code, opts) => request(`/state/${enc(code)}/districts`, { country: opts
|
|
163
|
+
districts: (code, opts) => request(`/state/${enc(code)}/districts`, { country: opts?.country })
|
|
156
164
|
}
|
|
157
165
|
),
|
|
158
|
-
district: (code, opts) => request(`/district/${enc(code)}`, { country: opts?.country }),
|
|
166
|
+
district: (code, opts) => request(`/district/${enc(code)}`, { country: opts?.country, state: opts?.state }),
|
|
159
167
|
city: Object.assign(
|
|
160
168
|
(name, opts) => request(`/city/${enc(name)}`, { country: opts?.country, state: opts?.state }),
|
|
161
169
|
{
|
|
162
170
|
id: (id) => request(`/city/id/${enc(id)}`),
|
|
163
171
|
search: (q, opts) => request("/city", { q, country: opts?.country, state: opts?.state, limit: opts?.limit }),
|
|
164
|
-
nearest: (lat, lon) => request("/city", { lat, lon })
|
|
172
|
+
nearest: (lat, lon) => request("/city", { lat, lon }),
|
|
173
|
+
nearby: (name, opts) => request(`/city/${enc(name)}/nearby`, {
|
|
174
|
+
radius: opts?.radius,
|
|
175
|
+
unit: opts?.unit,
|
|
176
|
+
country: opts?.country,
|
|
177
|
+
state: opts?.state,
|
|
178
|
+
limit: opts?.limit
|
|
179
|
+
})
|
|
165
180
|
}
|
|
166
181
|
),
|
|
167
182
|
postal: Object.assign(
|
|
168
|
-
(code, opts) => request(`/postal/${enc(code)}`, { country: opts
|
|
183
|
+
(code, opts) => request(`/postal/${enc(code)}`, { country: opts?.country }),
|
|
169
184
|
{
|
|
170
185
|
nearby: (code, opts) => request(`/postal/${enc(code)}/nearby`, {
|
|
171
|
-
country: opts
|
|
172
|
-
radius: opts
|
|
173
|
-
unit: opts
|
|
186
|
+
country: opts?.country,
|
|
187
|
+
radius: opts?.radius,
|
|
188
|
+
unit: opts?.unit
|
|
174
189
|
}),
|
|
175
|
-
distance: (from, to, opts) => request(`/postal/${enc(from)}/distance/${enc(to)}`, { country: opts
|
|
190
|
+
distance: (from, to, opts) => request(`/postal/${enc(from)}/distance/${enc(to)}`, { country: opts?.country })
|
|
176
191
|
}
|
|
177
192
|
),
|
|
178
193
|
email: (email, opts) => request(`/email/${enc(email)}`, deepQuery(opts)),
|
|
194
|
+
vat: (number, opts) => request(`/vat/${enc(number)}`, {
|
|
195
|
+
country: opts?.country,
|
|
196
|
+
from: opts?.from,
|
|
197
|
+
...deepQuery(opts)
|
|
198
|
+
}),
|
|
199
|
+
iban: (iban, opts) => request(`/iban/${enc(iban)}`, { country: opts?.country }),
|
|
200
|
+
npi: (npi, opts) => request(`/npi/${enc(npi)}`, deepQuery(opts)),
|
|
179
201
|
phone: (number, opts) => request(`/phone/${enc(number)}`, { country: opts?.country, ...deepQuery(opts) }),
|
|
202
|
+
carrier: (number, opts) => request(`/carrier/${enc(number)}`, { country: opts?.country }),
|
|
203
|
+
caller: (number, opts) => request(`/caller/${enc(number)}`, { country: opts?.country }),
|
|
204
|
+
hlr: (number, opts) => request(`/hlr/${enc(number)}`, { country: opts?.country }),
|
|
180
205
|
domain: (domain, opts) => request(`/domain/${enc(domain)}`, deepQuery(opts)),
|
|
181
206
|
mx: (domain) => request(`/mx/${enc(domain)}`),
|
|
182
207
|
useragent: (ua, opts) => request("/useragent", deepQuery(opts), { "User-Agent": ua }),
|
|
208
|
+
vin: (vin, opts) => request(`/vin/${enc(vin)}`, deepQuery(opts)),
|
|
209
|
+
hts: Object.assign(
|
|
210
|
+
(code, opts) => request(`/hts/${enc(code)}`, { origin: opts?.origin, ...deepQuery(opts) }),
|
|
211
|
+
{
|
|
212
|
+
search: (q) => request("/hts", { q })
|
|
213
|
+
}
|
|
214
|
+
),
|
|
183
215
|
currency: Object.assign(
|
|
184
216
|
(code) => request(`/currency/${enc(code)}`),
|
|
185
217
|
{
|
|
186
|
-
rate: (base, quote) => request(`/currency/${enc(base)}/${enc(quote)}
|
|
218
|
+
rate: (base, quote, opts) => request(`/currency/${enc(base)}/${enc(quote)}`, {
|
|
219
|
+
date: opts?.date,
|
|
220
|
+
amount: opts?.amount
|
|
221
|
+
})
|
|
187
222
|
}
|
|
188
223
|
),
|
|
189
224
|
language: (code) => request(`/language/${enc(code)}`),
|
|
190
225
|
name: (name) => request(`/name/${enc(name)}`),
|
|
191
226
|
timezone,
|
|
227
|
+
date: Object.assign(
|
|
228
|
+
(date, opts) => request(`/date/${enc(date)}`, { format: opts?.format, to: opts?.to }),
|
|
229
|
+
{
|
|
230
|
+
today: (opts) => request("/date", { to: opts?.to })
|
|
231
|
+
}
|
|
232
|
+
),
|
|
192
233
|
holiday: Object.assign(
|
|
193
234
|
(country, opts) => request(`/holiday/${enc(country)}`, { year: opts?.year }),
|
|
194
235
|
{
|
|
@@ -197,7 +238,7 @@ function parseAPI(apiKey, options = {}) {
|
|
|
197
238
|
),
|
|
198
239
|
elevation: (lat, lon) => request("/elevation", { lat, lon }),
|
|
199
240
|
point: (lat, lon, opts) => request("/point", { lat, lon, ...deepQuery(opts) }),
|
|
200
|
-
weather: (lat, lon, opts) => request("/weather", { lat, lon, ...deepQuery(opts) }),
|
|
241
|
+
weather: (lat, lon, opts) => request("/weather", { lat, lon, date: opts?.date, ...deepQuery(opts) }),
|
|
201
242
|
emoji: Object.assign(
|
|
202
243
|
(emoji) => request(`/emoji/${enc(emoji)}`),
|
|
203
244
|
{
|