@parseapi/sdk 0.3.2 → 1.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 +139 -3
- package/dist/index.cjs +75 -26
- package/dist/index.d.cts +597 -241
- package/dist/index.d.ts +597 -241
- package/dist/index.js +75 -26
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -15,6 +15,53 @@ const country = await parse.country('US');
|
|
|
15
15
|
|
|
16
16
|
Get a key at [parseapi.com](https://parseapi.com). The client also reads `PARSEAPI_KEY` from the environment.
|
|
17
17
|
|
|
18
|
+
## API versions
|
|
19
|
+
|
|
20
|
+
Version 1.0.0 explicitly selects the API contract supported by this SDK. It sends `Parse-Version: 2.0.0` on every lookup so responses match the API contract supported by the package. Your key and the team's saved default stay the same.
|
|
21
|
+
|
|
22
|
+
Upgrade the dependency in staging, review the [release notes](https://parseapi.com/docs/releases), and test the application before deploying the same code and dependency version to production. Commit your dependency lockfile so the tested package travels with your deployment. Future major SDK upgrades can select a newer API contract.
|
|
23
|
+
|
|
24
|
+
Previously published SDKs keep their existing behavior and use the team's default. Requests without `Parse-Version` also use that default, managed in [Dashboard API version](https://parseapi.com/dashboard/versions). Keep it unchanged while older applications depend on it. Rolling back to an SDK without a version header restores the team default, so rollback only restores the old contract when that default has stayed unchanged.
|
|
25
|
+
|
|
26
|
+
The package owns its supported API version. For direct HTTP integrations, an explicit `Parse-Version` header selects a supported contract. See [API versions and migration](https://parseapi.com/docs/versioning).
|
|
27
|
+
|
|
28
|
+
## Weather from a postal code
|
|
29
|
+
|
|
30
|
+
Start with the postal code, then pass its coordinates to weather. Reuse the client from the example above.
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
const place = await parse.postal('28202', { country: 'US' });
|
|
34
|
+
if (place.latitude != null && place.longitude != null) {
|
|
35
|
+
const weather = await parse.weather(place.latitude, place.longitude);
|
|
36
|
+
console.log(weather);
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The coordinates represent the postal area. Weather is for that point. Missing coordinates skip the weather lookup. This composition performs two ordinary lookups when coordinates are available, with the retry policy below.
|
|
41
|
+
|
|
42
|
+
## Supply the context you know
|
|
43
|
+
|
|
44
|
+
Pass `country` when a postal code or national phone number needs disambiguation. A complete international phone number already carries its country context. For a numeric date such as `03/04/2026`, supply the intended `format`. Defaults resolve what the input establishes. Ambiguous input needs your context.
|
|
45
|
+
|
|
46
|
+
Results are plain data. Pass a returned code or coordinate to another operation when the task needs it. Check nullable values before composing the next call.
|
|
47
|
+
|
|
48
|
+
Name paid deep includes flat `short`, `directory`, and `initials` fields beside `gender` and `salutation`. `name_locale` selects CLDR formatting rules and defaults to `en`. It changes formatting only. Country remains gender context, and unavailable formatting is null. Older responses may omit these fields.
|
|
49
|
+
|
|
50
|
+
## Display language
|
|
51
|
+
|
|
52
|
+
This source candidate accepts an optional per-request `lang` on supported
|
|
53
|
+
operations. It requires the matching API localization release and data.
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
const country = await parse.country('DE', { lang: 'fr' });
|
|
57
|
+
// country: 'DE', name: 'Allemagne', name_local: 'Deutschland'
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Only supported display fields change. Missing translations keep their source
|
|
61
|
+
names. IDs, native-name fields, numeric facts, Date input `format`, and Measure
|
|
62
|
+
input `locale` retain their meaning. Omitting `lang` preserves the existing
|
|
63
|
+
behavior and does not inherit a previous request's choice.
|
|
64
|
+
|
|
18
65
|
## Calls
|
|
19
66
|
|
|
20
67
|
One method per endpoint, named after the route.
|
|
@@ -25,6 +72,7 @@ await parse.ip.self();
|
|
|
25
72
|
await parse.email('hello@gmail.com');
|
|
26
73
|
await parse.vat('DE136695976');
|
|
27
74
|
await parse.iban('DE89370400440532013000');
|
|
75
|
+
await parse.bin('424242');
|
|
28
76
|
await parse.npi('1881018208');
|
|
29
77
|
await parse.phone('+14155552671');
|
|
30
78
|
await parse.carrier('+14155552671');
|
|
@@ -57,8 +105,12 @@ await parse.currency('USD');
|
|
|
57
105
|
await parse.currency.rate('USD', 'EUR');
|
|
58
106
|
await parse.language('en');
|
|
59
107
|
await parse.name('BILLY OSHALL');
|
|
60
|
-
await parse.
|
|
61
|
-
await parse.
|
|
108
|
+
await parse.name('Andrea', { country: 'IT', deep: true });
|
|
109
|
+
await parse.name('Robert James Smith', { deep: true, name_locale: 'en' });
|
|
110
|
+
await parse.time(); // UTC now
|
|
111
|
+
await parse.time('America/New_York');
|
|
112
|
+
await parse.time('America/New_York', { at: '2026-09-05T15:00:00', to: 'Asia/Tokyo' });
|
|
113
|
+
await parse.time.at(40.7128, -74.006);
|
|
62
114
|
await parse.date('03/04/2026', { format: 'mdy' });
|
|
63
115
|
await parse.date.today();
|
|
64
116
|
await parse.holiday('US', { year: 2026 });
|
|
@@ -70,19 +122,90 @@ await parse.domain('example.com');
|
|
|
70
122
|
await parse.asn('AS13335');
|
|
71
123
|
await parse.mac('00:1B:63:84:45:E6');
|
|
72
124
|
await parse.mx('example.com');
|
|
125
|
+
await parse.dns('example.com');
|
|
126
|
+
await parse.dns('_dmarc.example.com', { type: 'TXT' });
|
|
73
127
|
await parse.useragent(uaString);
|
|
74
128
|
await parse.vin('1HGCM82633A004352');
|
|
129
|
+
await parse.naics('541511');
|
|
130
|
+
await parse.naics.search('coffee shop', { limit: 5 });
|
|
75
131
|
await parse.tariff('8471.30.01.00');
|
|
76
132
|
await parse.tariff.search('sunglasses');
|
|
77
133
|
await parse.emoji('rocket');
|
|
78
134
|
await parse.emoji.search('fire');
|
|
79
135
|
```
|
|
80
136
|
|
|
137
|
+
NAICS paid deep records include classification `deep.exclusions`, each with a description and linked codes. Generic exclusions can have no linked codes. Omitted or null exclusions in older responses remain unknown. Search results also include `match`: the matched `field` (`name`, `term` or `naics`) and `text`, plus `corrections` with `from` and `to` tokens for typo fallback. Corrections are empty for exact, plural and prefix matches. Direct code lookups omit `match`. Older responses may omit it.
|
|
138
|
+
|
|
81
139
|
Responses are typed, plain JSON data. `country.states('US')` requests the states directly; it does not fetch a country first. Optional arguments go in the final options object, so new options can be added without changing your existing calls.
|
|
82
140
|
|
|
141
|
+
DNS uses pooled requests on every plan. Omit `type` to check A, AAAA, CNAME, MX, NS, TXT, SOA, CAA, SRV and PTR. Records contain `name`, `type`, `ttl` in seconds and a DNS presentation `value`. TXT values retain quoting and chunk boundaries. A selected question can include its CNAME chain. Empty records mean no records. Lookup failures remain errors.
|
|
142
|
+
|
|
143
|
+
## Time
|
|
144
|
+
|
|
145
|
+
`time` returns local ISO `at` with its UTC offset and integer Unix seconds in `unix`. The core `offset` preserves exact precision. Optional `deep.offset_seconds` gives the numeric offset, while `deep.offset_minutes` gives whole minutes. Historical offsets and ISO times can include offset seconds. Omitted `at` means now. With `to`, an offsetless `at` is source wall time. Otherwise it is UTC. Include an offset for repeated local times around a clock change. Current time and conversion use pooled requests on every plan. Coordinate clock fields can be null when the timezone is unknown. Existing `timezone` methods remain supported.
|
|
146
|
+
|
|
147
|
+
## Measurements
|
|
148
|
+
|
|
149
|
+
```ts
|
|
150
|
+
const result = await parse.measure('5 ft 11 in', { to: 'cm' });
|
|
151
|
+
const units = await parse.measure.units({ unit: 'm' });
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
`amount` is a decimal string, such as `"180.34"`. Without `to`, the API returns the canonical unit for the measurement type. Pass `locale` for number formatting and `system` (`us` or `imperial`) when a customary unit needs context. Ambiguous input returns `valid: false`, a `reason`, and available `choices`. Invalid or incompatible target units use the normal API error.
|
|
155
|
+
|
|
156
|
+
Unit discovery accepts optional `query`, `type`, and `unit` filters. `unit` selects compatible targets. Omit the filters for the reviewed catalog. Both operations use pooled requests.
|
|
157
|
+
|
|
158
|
+
## Place statistics and optional detail
|
|
159
|
+
|
|
160
|
+
Postal and District paid profiles include `deep.property_tax` where supported. It contains `annual_median`, `currency` and `period`: median annual property tax payable on owner-occupied homes in the statistical area. The amount is adjusted to the final year of the reporting period (`YYYY-YYYY`). This is an area statistic, not a rate or an individual property bill. Unsupported, missing and censored estimates are null.
|
|
161
|
+
|
|
162
|
+
```ts
|
|
163
|
+
const place = await parse.postal('28202', { country: 'US', deep: true });
|
|
164
|
+
const propertyTax = place.deep?.property_tax;
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Read `population_period` alongside `population`: a reporting year (`YYYY`) or period (`YYYY-YYYY`), null when unknown or unverifiable. Keep missing or null values unknown and preserve a known zero. These fields belong to full place profiles. State district lists include each district's population and period. Postal nearby and distance detail remains metropolitan associations only. Continent population stays in core; Continent has no `population_period` field.
|
|
168
|
+
|
|
169
|
+
Point returns the timezone ID with the core location. Its optional deep detail adds terrain and compact nearest-city context on every plan. A nearest city is null when none is within 200 km.
|
|
170
|
+
|
|
171
|
+
Weather returns current conditions by default. Paid deep adds specialist current measurements, forecasts and related detail. A past `date` is a UTC day and requires deep: it adds `deep.history` alongside current conditions. Date alone does not request history.
|
|
172
|
+
|
|
173
|
+
```ts
|
|
174
|
+
await parse.weather(40.7128, -74.006, { deep: true, date: '2026-08-15' });
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Tariff starts with the general schedule line. Paid deep adds units and the special and other schedule columns. An optional origin then resolves country-specific measures. The three calls below show those successive choices. Without origin, schedule detail is still returned and origin-dependent fields are null. A null effective rate is not a zero rate.
|
|
178
|
+
|
|
179
|
+
```ts
|
|
180
|
+
await parse.tariff('8471.30.01.00');
|
|
181
|
+
await parse.tariff('8471.30.01.00', { deep: true });
|
|
182
|
+
await parse.tariff('8471.30.01.00', { deep: true, origin: 'CN' });
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
Address search uses context from the form: prefer postal, or city and state. An optional end-user `ip` is a locality hint for server-side calls. An empty result explains itself with `reason`: `more_input`, `missing_context` or `no_matches`. With suggestions, reason is null. Older responses may omit it, and future reasons remain strings. Catalog and lookup failures use the existing API errors.
|
|
186
|
+
|
|
187
|
+
HLR reports status at the last check. `live` means assigned and `connected` means reachable at that check. Cached results may be returned. Null means unconfirmed. Deep diagnostics stay within the same metered lookup.
|
|
188
|
+
|
|
83
189
|
## Deep
|
|
84
190
|
|
|
85
|
-
|
|
191
|
+
Choose enrichment for the question you need answered.
|
|
192
|
+
|
|
193
|
+
| Operation | What `deep` requests |
|
|
194
|
+
|---|---|
|
|
195
|
+
| IP | Richer IP fields included with a paid plan. No separate check meter. |
|
|
196
|
+
| Domain | Registration dates, registrar, status and DNSSEC, included with a paid plan. Use `dns` for DNS records and `mx` for mail routing. |
|
|
197
|
+
| Email | A metered deliverability check, using included email checks or enabled on-demand usage. |
|
|
198
|
+
| VAT | A metered registry check where supported, using included VAT checks or enabled on-demand usage. |
|
|
199
|
+
| Phone, Time, Date, Currency, Language, Emoji, IBAN, Point | Optional detail in the same pooled request on every plan. |
|
|
200
|
+
| Country, State, District, City, Postal | The place profile on paid plans, including demographic and tax facts where held. |
|
|
201
|
+
| Name, NAICS | Name evidence or the industry definition profile on paid plans. |
|
|
202
|
+
| VIN, NPI, Tariff, Company | The complete product detail bag on paid plans. |
|
|
203
|
+
| Weather | Specialist current measurements and the existing forecast, alert, air and history bag on paid plans. |
|
|
204
|
+
| Carrier, HLR | Optional diagnostic detail within the same metered core unit, including Free allowance units. No second gate or additional check. |
|
|
205
|
+
|
|
206
|
+
Carrier, caller, and HLR are separate metered operations. Choose them explicitly when you need their answers. Ordinary lookups retry twice by default. Metered checks use one attempt by default. Setting retries explicitly can repeat paid usage.
|
|
207
|
+
|
|
208
|
+
Without `deep`, the response omits that key. When requested, it is an empty object if access is locked or the operation has no deep fields. Otherwise it contains the available fields. A missing or null field means unknown.
|
|
86
209
|
|
|
87
210
|
```ts
|
|
88
211
|
const ip = await parse.ip('52.94.76.10', { deep: true });
|
|
@@ -131,3 +254,16 @@ An explicit `retries` setting on the client or call overrides those defaults. An
|
|
|
131
254
|
## Docs
|
|
132
255
|
|
|
133
256
|
Full field reference for every endpoint: [parseapi.com/docs](https://parseapi.com/docs)
|
|
257
|
+
|
|
258
|
+
BIN lookup accepts 6-11 digits as a string, including leading zeros. Spaces and hyphens are accepted. `prefix` is the actual longest match and can be shorter than the input. Unknown reference fields are null. `deep` adds an empty object on every plan.
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
## Optional detail
|
|
262
|
+
|
|
263
|
+
The default response answers the common task. Ask for `deep` when you need more detail about that same result. Core fields stay equal. City, NAICS and Emoji searches put detail inside each result. Postal nearby and distance put metropolitan detail beside the entity it describes. Time conversion keeps target detail in `to.deep`; only the source has `deep.next_dst`.
|
|
264
|
+
|
|
265
|
+
```ts
|
|
266
|
+
const basic = await parse.time('America/New_York');
|
|
267
|
+
const detail = await parse.time('America/New_York', { deep: true });
|
|
268
|
+
console.log(basic.at, detail.deep?.next_dst);
|
|
269
|
+
```
|
package/dist/index.cjs
CHANGED
|
@@ -24,7 +24,8 @@ __export(index_exports, {
|
|
|
24
24
|
parseAPI: () => parseAPI
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(index_exports);
|
|
27
|
-
var VERSION = "0.
|
|
27
|
+
var VERSION = "1.0.0";
|
|
28
|
+
var API_VERSION = "2.0.0";
|
|
28
29
|
var DEFAULT_BASE_URL = "https://api.parseapi.com";
|
|
29
30
|
var DEFAULT_TIMEOUT_MS = 1e4;
|
|
30
31
|
var DEFAULT_RETRIES = 2;
|
|
@@ -114,6 +115,7 @@ function parseAPI(apiKey, options = {}) {
|
|
|
114
115
|
validateTimeout(attemptTimeout);
|
|
115
116
|
validateRetries(retries);
|
|
116
117
|
const url = new URL(baseUrl + path);
|
|
118
|
+
if (controls.lang !== void 0) url.searchParams.set("lang", controls.lang);
|
|
117
119
|
for (const [name, value] of Object.entries(query ?? {})) {
|
|
118
120
|
if (value !== void 0) url.searchParams.set(name, String(value));
|
|
119
121
|
}
|
|
@@ -129,7 +131,7 @@ function parseAPI(apiKey, options = {}) {
|
|
|
129
131
|
try {
|
|
130
132
|
res = await doFetch(url, {
|
|
131
133
|
redirect: "manual",
|
|
132
|
-
headers: { "X-API-Key": key, "User-Agent": `parseapi-node/${VERSION}`, ...headers },
|
|
134
|
+
headers: { "X-API-Key": key, "User-Agent": `parseapi-node/${VERSION}`, ...headers, "Parse-Version": API_VERSION },
|
|
133
135
|
signal: controller.signal
|
|
134
136
|
});
|
|
135
137
|
} catch (error) {
|
|
@@ -179,9 +181,11 @@ function parseAPI(apiKey, options = {}) {
|
|
|
179
181
|
const enc = encodeURIComponent;
|
|
180
182
|
const deepQuery = (opts) => opts?.deep ? { deep: true } : {};
|
|
181
183
|
return {
|
|
184
|
+
/** Look up an IP. `deep: true` adds enrichment included with a paid plan, without a separate check meter. */
|
|
182
185
|
ip: Object.assign(
|
|
183
186
|
(ip, opts) => request(`/ip/${enc(ip)}`, deepQuery(opts), void 0, opts),
|
|
184
187
|
{
|
|
188
|
+
/** Look up the public IP making this request. On a server, this is the server's IP. */
|
|
185
189
|
self: (opts) => request("/ip", deepQuery(opts), void 0, opts)
|
|
186
190
|
}
|
|
187
191
|
),
|
|
@@ -198,69 +202,104 @@ function parseAPI(apiKey, options = {}) {
|
|
|
198
202
|
}
|
|
199
203
|
),
|
|
200
204
|
country: Object.assign(
|
|
201
|
-
(code, opts) => request(`/country/${enc(code)}`,
|
|
205
|
+
(code, opts) => request(`/country/${enc(code)}`, deepQuery(opts), void 0, opts),
|
|
202
206
|
{
|
|
203
207
|
states: (code, opts) => request(`/country/${enc(code)}/states`, void 0, void 0, opts)
|
|
204
208
|
}
|
|
205
209
|
),
|
|
206
210
|
state: Object.assign(
|
|
207
|
-
(code, opts) => request(`/state/${enc(code)}`, { country: opts?.country }, void 0, opts),
|
|
211
|
+
(code, opts) => request(`/state/${enc(code)}`, { country: opts?.country, ...deepQuery(opts) }, void 0, opts),
|
|
208
212
|
{
|
|
209
|
-
districts: (code, opts) => request(`/state/${enc(code)}/districts`, { country: opts?.country }, void 0, opts)
|
|
213
|
+
districts: (code, opts) => request(`/state/${enc(code)}/districts`, { country: opts?.country, ...deepQuery(opts) }, void 0, opts)
|
|
210
214
|
}
|
|
211
215
|
),
|
|
212
|
-
district: (code, opts) => request(`/district/${enc(code)}`, { country: opts?.country, state: opts?.state }, void 0, opts),
|
|
216
|
+
district: (code, opts) => request(`/district/${enc(code)}`, { country: opts?.country, state: opts?.state, ...deepQuery(opts) }, void 0, opts),
|
|
213
217
|
city: Object.assign(
|
|
214
|
-
(name, opts) => request(`/city/${enc(name)}`, { country: opts?.country, state: opts?.state }, void 0, opts),
|
|
218
|
+
(name, opts) => request(`/city/${enc(name)}`, { country: opts?.country, state: opts?.state, ...deepQuery(opts) }, void 0, opts),
|
|
215
219
|
{
|
|
216
|
-
id: (id, opts) => request(`/city/id/${enc(id)}`,
|
|
217
|
-
search: (query, opts) => request("/city", { q: query, country: opts?.country, state: opts?.state, limit: opts?.limit }, void 0, opts),
|
|
218
|
-
nearest: (lat, lon, opts) => request("/city", { lat, lon }, void 0, opts),
|
|
220
|
+
id: (id, opts) => request(`/city/id/${enc(id)}`, deepQuery(opts), void 0, opts),
|
|
221
|
+
search: (query, opts) => request("/city", { q: query, country: opts?.country, state: opts?.state, limit: opts?.limit, ...deepQuery(opts) }, void 0, opts),
|
|
222
|
+
nearest: (lat, lon, opts) => request("/city", { lat, lon, ...deepQuery(opts) }, void 0, opts),
|
|
219
223
|
nearby: (name, opts) => request(`/city/${enc(name)}/nearby`, {
|
|
220
224
|
radius: opts?.radius,
|
|
221
225
|
unit: opts?.unit,
|
|
222
226
|
country: opts?.country,
|
|
223
227
|
state: opts?.state,
|
|
224
|
-
limit: opts?.limit
|
|
228
|
+
limit: opts?.limit,
|
|
229
|
+
...deepQuery(opts)
|
|
225
230
|
}, void 0, opts)
|
|
226
231
|
}
|
|
227
232
|
),
|
|
233
|
+
/** Look up a postal area. Pass country when known. Check nullable latitude/longitude before another location lookup. */
|
|
228
234
|
postal: Object.assign(
|
|
229
|
-
(code, opts) => request(`/postal/${enc(code)}`, { country: opts?.country }, void 0, opts),
|
|
235
|
+
(code, opts) => request(`/postal/${enc(code)}`, { country: opts?.country, ...deepQuery(opts) }, void 0, opts),
|
|
230
236
|
{
|
|
231
237
|
nearby: (code, opts) => request(`/postal/${enc(code)}/nearby`, {
|
|
232
238
|
country: opts?.country,
|
|
233
239
|
radius: opts?.radius,
|
|
234
|
-
unit: opts?.unit
|
|
240
|
+
unit: opts?.unit,
|
|
241
|
+
...deepQuery(opts)
|
|
235
242
|
}, void 0, opts),
|
|
236
|
-
distance: (from, to, opts) => request(`/postal/${enc(from)}/distance/${enc(to)}`, { country: opts?.country }, void 0, opts)
|
|
243
|
+
distance: (from, to, opts) => request(`/postal/${enc(from)}/distance/${enc(to)}`, { country: opts?.country, ...deepQuery(opts) }, void 0, opts)
|
|
237
244
|
}
|
|
238
245
|
),
|
|
239
246
|
address: Object.assign(
|
|
240
247
|
(address, opts) => request(`/address/${enc(address)}`, { country: opts?.country, ...deepQuery(opts) }, void 0, opts),
|
|
241
248
|
{
|
|
249
|
+
/** Find address suggestions using the context supplied. Prefer postal, or city and state, from the form. ip is an optional end-user locality hint for server-side calls. An empty result has reason more_input, missing_context or no_matches. Suggestions have reason null. Operational failures are errors. */
|
|
242
250
|
search: (query, opts) => request("/address", { q: query, country: opts?.country, postal: opts?.postal, city: opts?.city, state: opts?.state, ip: opts?.ip }, void 0, opts)
|
|
243
251
|
}
|
|
244
252
|
),
|
|
245
253
|
company: (number, opts) => request(`/company/${enc(number)}`, { country: opts?.country, ...deepQuery(opts) }, void 0, opts),
|
|
254
|
+
/**
|
|
255
|
+
* Parse an email and check its format and domain.
|
|
256
|
+
* `deep: true` explicitly requests a metered deliverability check using included checks or enabled on-demand usage.
|
|
257
|
+
* Deep checks default to one attempt. An explicit retry count can repeat paid usage.
|
|
258
|
+
*/
|
|
246
259
|
email: (email, opts) => request(`/email/${enc(email)}`, deepQuery(opts), void 0, opts),
|
|
260
|
+
/** Check VAT format and checksum. `deep: true` requests a metered registry check where supported, with no automatic retries by default. */
|
|
247
261
|
vat: (number, opts) => request(`/vat/${enc(number)}`, {
|
|
248
262
|
country: opts?.country,
|
|
249
263
|
from: opts?.from,
|
|
250
264
|
...deepQuery(opts)
|
|
251
265
|
}, void 0, opts),
|
|
252
|
-
iban: (iban, opts) => request(`/iban/${enc(iban)}`, { country: opts?.country }, void 0, opts),
|
|
266
|
+
iban: (iban, opts) => request(`/iban/${enc(iban)}`, { country: opts?.country, ...deepQuery(opts) }, void 0, opts),
|
|
253
267
|
npi: (npi, opts) => request(`/npi/${enc(npi)}`, deepQuery(opts), void 0, opts),
|
|
268
|
+
/** Parse a phone number and its formats. Pass country for national numbers when needed. Deep adds numbering-plan geography. */
|
|
254
269
|
phone: (number, opts) => request(`/phone/${enc(number)}`, { country: opts?.country, ...deepQuery(opts) }, void 0, opts),
|
|
255
|
-
|
|
270
|
+
/** Request a metered carrier lookup. No automatic retries by default. */
|
|
271
|
+
carrier: (number, opts) => request(`/carrier/${enc(number)}`, { country: opts?.country, ...deepQuery(opts) }, void 0, opts),
|
|
272
|
+
/** Request a metered caller-name lookup for a NANP number. No automatic retries by default. */
|
|
256
273
|
caller: (number, opts) => request(`/caller/${enc(number)}`, { country: opts?.country }, void 0, opts),
|
|
257
|
-
|
|
274
|
+
/** Look up phone status at the last check. Live means assigned and connected means reachable at that check. Cached results may be returned. Null means unconfirmed. Deep adds network diagnostics within the same metered lookup. No automatic retries by default. */
|
|
275
|
+
hlr: (number, opts) => request(`/hlr/${enc(number)}`, { country: opts?.country, ...deepQuery(opts) }, void 0, opts),
|
|
276
|
+
/** Check whether a domain is registered. Deep adds registration dates, registrar, status and DNSSEC on paid plans. */
|
|
258
277
|
domain: (domain, opts) => request(`/domain/${enc(domain)}`, deepQuery(opts), void 0, opts),
|
|
259
278
|
asn: (asn, opts) => request(`/asn/${enc(asn)}`, void 0, void 0, opts),
|
|
260
279
|
mac: (mac, opts) => request(`/mac/${enc(mac)}`, void 0, void 0, opts),
|
|
280
|
+
/** Look up a 6-11 digit card prefix. Keep leading zeros in the input string. */
|
|
281
|
+
bin: (bin, opts) => request(`/bin/${enc(bin)}`, { deep: opts?.deep }, void 0, opts),
|
|
282
|
+
/** Parse a measurement or convert it to `to`. Without `to`, use its type's canonical unit. Invalid input is plain data with `valid: false`. */
|
|
283
|
+
measure: Object.assign(
|
|
284
|
+
(measure, opts) => request(`/measure/${enc(measure)}`, { to: opts?.to, locale: opts?.locale, system: opts?.system }, void 0, opts),
|
|
285
|
+
{
|
|
286
|
+
/** Discover reviewed units. Pass `unit` to find compatible conversion targets. */
|
|
287
|
+
units: (opts) => request("/measure/units", { q: opts?.query, type: opts?.type, unit: opts?.unit }, void 0, opts)
|
|
288
|
+
}
|
|
289
|
+
),
|
|
290
|
+
/** Look up DNS records with TTLs. Type selects the question and may include its CNAME chain. Pooled on every plan. */
|
|
291
|
+
dns: (domain, opts) => request(`/dns/${enc(domain)}`, { type: opts?.type }, void 0, opts),
|
|
261
292
|
mx: (domain, opts) => request(`/mx/${enc(domain)}`, void 0, void 0, opts),
|
|
262
293
|
useragent: (ua, opts) => request("/useragent", deepQuery(opts), { "User-Agent": ua }, opts),
|
|
263
294
|
vin: (vin, opts) => request(`/vin/${enc(vin)}`, deepQuery(opts), void 0, opts),
|
|
295
|
+
/** US NAICS 2022 definitions and hierarchy. */
|
|
296
|
+
naics: Object.assign(
|
|
297
|
+
(code, opts) => request(`/naics/${enc(code)}`, deepQuery(opts), void 0, opts),
|
|
298
|
+
{
|
|
299
|
+
search: (query, opts) => request("/naics", { q: query, limit: opts?.limit, ...deepQuery(opts) }, void 0, opts)
|
|
300
|
+
}
|
|
301
|
+
),
|
|
302
|
+
/** Look up the general US duty schedule line. Paid deep adds units and the special and other schedule columns. Add origin with deep to resolve country-specific measures. Without origin, schedule detail remains available and origin-dependent fields are null. A null effective rate is not a zero rate. */
|
|
264
303
|
tariff: Object.assign(
|
|
265
304
|
(code, opts) => request(`/tariff/${enc(code)}`, { origin: opts?.origin, ...deepQuery(opts) }, void 0, opts),
|
|
266
305
|
{
|
|
@@ -268,7 +307,7 @@ function parseAPI(apiKey, options = {}) {
|
|
|
268
307
|
}
|
|
269
308
|
),
|
|
270
309
|
currency: Object.assign(
|
|
271
|
-
(code, opts) => request(`/currency/${enc(code)}`,
|
|
310
|
+
(code, opts) => request(`/currency/${enc(code)}`, deepQuery(opts), void 0, opts),
|
|
272
311
|
{
|
|
273
312
|
rate: (base, quote, opts) => request(`/currency/${enc(base)}/${enc(quote)}`, {
|
|
274
313
|
date: opts?.date,
|
|
@@ -276,18 +315,25 @@ function parseAPI(apiKey, options = {}) {
|
|
|
276
315
|
}, void 0, opts)
|
|
277
316
|
}
|
|
278
317
|
),
|
|
279
|
-
language: (code, opts) => request(`/language/${enc(code)}`,
|
|
280
|
-
name: (name, opts) => request(`/name/${enc(name)}`,
|
|
318
|
+
language: (code, opts) => request(`/language/${enc(code)}`, deepQuery(opts), void 0, opts),
|
|
319
|
+
name: (name, opts) => request(`/name/${enc(name)}`, { country: opts?.country, ...deepQuery(opts), name_locale: opts?.name_locale }, void 0, opts),
|
|
320
|
+
/** Current local time, UTC by default. With to, offsetless at is source wall time. */
|
|
321
|
+
time: Object.assign(
|
|
322
|
+
(timezone, opts) => request(timezone === void 0 ? "/time" : `/time/${enc(timezone)}`, { at: opts?.at, to: opts?.to, ...deepQuery(opts) }, void 0, opts),
|
|
323
|
+
{
|
|
324
|
+
at: (lat, lon, opts) => request("/time", { lat, lon, at: opts?.at, to: opts?.to, ...deepQuery(opts) }, void 0, opts)
|
|
325
|
+
}
|
|
326
|
+
),
|
|
281
327
|
timezone: Object.assign(
|
|
282
|
-
(id, opts) => request(`/timezone/${enc(id)}`, { at: opts?.at, to: opts?.to }, void 0, opts),
|
|
328
|
+
(id, opts) => request(`/timezone/${enc(id)}`, { at: opts?.at, to: opts?.to, ...deepQuery(opts) }, void 0, opts),
|
|
283
329
|
{
|
|
284
|
-
at: (lat, lon, opts) => request("/timezone", { lat, lon, at: opts?.at }, void 0, opts)
|
|
330
|
+
at: (lat, lon, opts) => request("/timezone", { lat, lon, at: opts?.at, ...deepQuery(opts) }, void 0, opts)
|
|
285
331
|
}
|
|
286
332
|
),
|
|
287
333
|
date: Object.assign(
|
|
288
|
-
(date, opts) => request(`/date/${enc(date)}`, { format: opts?.format, to: opts?.to }, void 0, opts),
|
|
334
|
+
(date, opts) => request(`/date/${enc(date)}`, { format: opts?.format, to: opts?.to, ...deepQuery(opts) }, void 0, opts),
|
|
289
335
|
{
|
|
290
|
-
today: (opts) => request("/date", { to: opts?.to }, void 0, opts)
|
|
336
|
+
today: (opts) => request("/date", { to: opts?.to, ...deepQuery(opts) }, void 0, opts)
|
|
291
337
|
}
|
|
292
338
|
),
|
|
293
339
|
holiday: Object.assign(
|
|
@@ -297,12 +343,14 @@ function parseAPI(apiKey, options = {}) {
|
|
|
297
343
|
}
|
|
298
344
|
),
|
|
299
345
|
elevation: (lat, lon, opts) => request("/elevation", { lat, lon }, void 0, opts),
|
|
346
|
+
/** Resolve the country, state, district and timezone at coordinates. Deep adds terrain and compact nearest-city context on every plan. The timezone ID stays in core. The nearest city is null when none is within 200 km. */
|
|
300
347
|
point: (lat, lon, opts) => request("/point", { lat, lon, ...deepQuery(opts) }, void 0, opts),
|
|
348
|
+
/** Get current conditions in metric and imperial units. Paid deep adds specialist current measurements, forecasts and related detail. With deep, date selects a past UTC day (YYYY-MM-DD) in deep.history alongside current conditions. Date alone does not request history. */
|
|
301
349
|
weather: (lat, lon, opts) => request("/weather", { lat, lon, date: opts?.date, ...deepQuery(opts) }, void 0, opts),
|
|
302
350
|
emoji: Object.assign(
|
|
303
|
-
(emoji, opts) => request(`/emoji/${enc(emoji)}`,
|
|
351
|
+
(emoji, opts) => request(`/emoji/${enc(emoji)}`, deepQuery(opts), void 0, opts),
|
|
304
352
|
{
|
|
305
|
-
search: (query, opts) => request("/emoji", { q: query, limit: opts?.limit }, void 0, opts)
|
|
353
|
+
search: (query, opts) => request("/emoji", { q: query, limit: opts?.limit, ...deepQuery(opts) }, void 0, opts)
|
|
306
354
|
}
|
|
307
355
|
)
|
|
308
356
|
};
|
|
@@ -312,3 +360,4 @@ function parseAPI(apiKey, options = {}) {
|
|
|
312
360
|
ParseAPIError,
|
|
313
361
|
parseAPI
|
|
314
362
|
});
|
|
363
|
+
/*! You found Dev. https://parseapi.com/dev */
|