@ideal-postcodes/sdk 0.1.0 → 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/LICENSE +1 -23
- package/README.md +16 -18
- package/dist/autocomplete.cjs +1 -146
- package/dist/autocomplete.d.cts +26 -14
- package/dist/autocomplete.d.ts +26 -14
- package/dist/autocomplete.mjs +1 -146
- package/dist/chunk-BNT2VR2B.mjs +6 -0
- package/dist/chunk-HQKXKJXR.cjs +6 -0
- package/dist/chunk-OHO6PZYM.mjs +1 -0
- package/dist/chunk-UO7BIPJH.cjs +1 -0
- package/dist/index.cjs +1 -76
- package/dist/index.d-BuZcXRMe.d.cts +45 -0
- package/dist/index.d-BuZcXRMe.d.ts +45 -0
- package/dist/index.d.cts +6 -12
- package/dist/index.d.ts +6 -12
- package/dist/index.mjs +1 -76
- package/dist/preact-query.cjs +1 -497
- package/dist/preact-query.d.cts +379 -123
- package/dist/preact-query.d.ts +379 -123
- package/dist/preact-query.mjs +1 -497
- package/dist/react-query.cjs +1 -497
- package/dist/react-query.d.cts +378 -122
- package/dist/react-query.d.ts +378 -122
- package/dist/react-query.mjs +1 -497
- package/dist/sdk.gen-C6G6f1JU.d.ts +420 -0
- package/dist/sdk.gen-CMX5dsNg.d.cts +420 -0
- package/dist/{types.gen-l7tYP1ZJ.d.cts → types.gen-Dmx_l_fj.d.cts} +4612 -2685
- package/dist/{types.gen-l7tYP1ZJ.d.ts → types.gen-Dmx_l_fj.d.ts} +4612 -2685
- package/package.json +71 -38
- package/dist/autocomplete.cjs.map +0 -1
- package/dist/autocomplete.mjs.map +0 -1
- package/dist/chunk-AVMJGCHZ.mjs +0 -913
- package/dist/chunk-AVMJGCHZ.mjs.map +0 -1
- package/dist/chunk-ZZUZHG5D.cjs +0 -913
- package/dist/chunk-ZZUZHG5D.cjs.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/preact-query.cjs.map +0 -1
- package/dist/preact-query.mjs.map +0 -1
- package/dist/react-query.cjs.map +0 -1
- package/dist/react-query.mjs.map +0 -1
- package/dist/sdk.gen-C45EbTVQ.d.cts +0 -302
- package/dist/sdk.gen-_z1PNdoT.d.ts +0 -302
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
import { dn as TDataShape, dp as Options$1, C as Client, d as AddressCleanseData, dq as RequestResult, h as AddressCleanseResponses, f as AddressCleanseErrors, n as AddressesData, r as AddressesResponses, p as AddressesErrors, am as CreateConfigData, aq as CreateConfigResponses, ao as CreateConfigErrors, ar as CreateLicenseeData, av as CreateLicenseeResponses, at as CreateLicenseeErrors, ay as DeleteConfigData, aC as DeleteConfigResponses, aA as DeleteConfigErrors, aD as DeleteLicenseeData, aH as DeleteLicenseeResponses, aF as DeleteLicenseeErrors, aO as EmailValidationData, aS as EmailValidationResponses, aQ as EmailValidationErrors, F as FindAddressData, aY as FindAddressResponses, aX as FindAddressErrors, aZ as FindPlaceData, b1 as FindPlaceResponses, a$ as FindPlaceErrors, bf as KeyAvailabilityData, bj as KeyAvailabilityResponses, bh as KeyAvailabilityErrors, bk as KeyDetailsData, bo as KeyDetailsResponses, bm as KeyDetailsErrors, bp as KeyLogsData, bt as KeyLogsResponses, br as KeyLogsErrors, bu as KeyUsageData, by as KeyUsageResponses, bw as KeyUsageErrors, bJ as ListConfigsData, bN as ListConfigsResponses, bL as ListConfigsErrors, bO as ListLicenseesData, bS as ListLicenseesResponses, bQ as ListLicenseesErrors, c6 as PhoneNumberValidationData, ca as PhoneNumberValidationResponses, c8 as PhoneNumberValidationErrors, ct as PostcodesData, cx as PostcodesResponses, cv as PostcodesErrors, cy as RegenerateLicenseeKeyData, cC as RegenerateLicenseeKeyResponses, cA as RegenerateLicenseeKeyErrors, cD as ResolveAddressData, cG as ResolveAddressResponses, cF as ResolveAddressErrors, cH as ResolvePlaceData, cM as ResolvePlaceResponses, cJ as ResolvePlaceErrors, cN as RetrieveConfigData, cR as RetrieveConfigResponses, cP as RetrieveConfigErrors, cS as RetrieveLicenseeData, cW as RetrieveLicenseeResponses, cU as RetrieveLicenseeErrors, d4 as UpdateConfigData, d8 as UpdateConfigResponses, d6 as UpdateConfigErrors, d9 as UpdateKeyDetailsData, dd as UpdateKeyDetailsResponses, db as UpdateKeyDetailsErrors, de as UpdateLicenseeData, di as UpdateLicenseeResponses, dg as UpdateLicenseeErrors } from './types.gen-Dmx_l_fj.cjs';
|
|
2
|
+
|
|
3
|
+
type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options$1<TData, ThrowOnError, TResponse> & {
|
|
4
|
+
/**
|
|
5
|
+
* You can provide a client instance returned by `createClient()` instead of
|
|
6
|
+
* individual options. This might be also useful if you want to implement a
|
|
7
|
+
* custom client.
|
|
8
|
+
*/
|
|
9
|
+
client?: Client;
|
|
10
|
+
/**
|
|
11
|
+
* You can pass arbitrary values through the `meta` object. This can be
|
|
12
|
+
* used to access values that aren't defined as part of the SDK function.
|
|
13
|
+
*/
|
|
14
|
+
meta?: Record<string, unknown>;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Lookup Postcode
|
|
18
|
+
*
|
|
19
|
+
* Returns the complete list of addresses for a postcode. Postcode searches are space and case insensitive.
|
|
20
|
+
*
|
|
21
|
+
* Each request looks up one postcode. To extract the addresses for several postcodes, send one request per postcode.
|
|
22
|
+
*
|
|
23
|
+
* Use it to power postcode driven address searches, like [Postcode Lookup](/docs/postcode-lookup/).
|
|
24
|
+
*
|
|
25
|
+
* Postcode lookup covers the United Kingdom, the Republic of Ireland, the Netherlands and Singapore. The API detects the format of the postcode you submit. UK and Irish postcodes are searched by default. For a Dutch or Singapore postcode, set `context` to `NLD` or `SGP`, or to `GLOBAL` to accept any supported format.
|
|
26
|
+
*
|
|
27
|
+
* UK postcodes need PAF, Multiple Residence, Not Yet Built, PAF Alias, PAF Welsh, AddressBase or AddressBase Premium on your key. Eircodes need ECAD or ECAF. Dutch postcodes need Kadaster. Singapore postcodes need HERE Asia Pacific. Without a matching licence the request is rejected.
|
|
28
|
+
*
|
|
29
|
+
* An unfound postcode costs no lookup. A postcode that returns addresses costs one.
|
|
30
|
+
*
|
|
31
|
+
* ## Postcode Not Found
|
|
32
|
+
*
|
|
33
|
+
* Invalid postcodes do not affect your lookup balance. The API returns a `404` response with this body:
|
|
34
|
+
*
|
|
35
|
+
* ```json
|
|
36
|
+
* {
|
|
37
|
+
* "code": 4040,
|
|
38
|
+
* "message": "Postcode not found",
|
|
39
|
+
* "suggestions": ["SW1A 0AA"]
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* ### Suggestions
|
|
44
|
+
*
|
|
45
|
+
* If a postcode cannot be found, the API returns up to 5 of the closest matching postcodes. It corrects common errors first (e.g. mixing up `O` and `0` or `I` and `1`).
|
|
46
|
+
*
|
|
47
|
+
* If the suggestion list is small (fewer than 3), the correct postcode is likely to be among them. Notify the user or trigger new searches immediately.
|
|
48
|
+
*
|
|
49
|
+
* The suggestion list is empty if the postcode has deviated too far from a valid postcode format.
|
|
50
|
+
*
|
|
51
|
+
* ## Multiple Residence
|
|
52
|
+
*
|
|
53
|
+
* A small number of postcodes return more than 100 premises. The API returns 100 addresses per page, so use `page` to paginate the result set.
|
|
54
|
+
*
|
|
55
|
+
* ## Testing
|
|
56
|
+
*
|
|
57
|
+
* - **ID1 1QD** Returns a successful postcode lookup response `2000`
|
|
58
|
+
* - **ID1 KFA** Returns "postcode not found" error `4040`
|
|
59
|
+
* - **ID1 CLIP** Returns "no lookups remaining" error `4020`
|
|
60
|
+
* - **ID1 CHOP** Returns "daily (or individual) lookup limit breached" error `4021`
|
|
61
|
+
*
|
|
62
|
+
* Test requests undergo the usual authentication and restriction rules. They surface any issues during implementation and do not cost you a lookup.
|
|
63
|
+
*
|
|
64
|
+
*/
|
|
65
|
+
declare const postcodes: <ThrowOnError extends boolean = true>(options: Options<PostcodesData, ThrowOnError>) => RequestResult<PostcodesResponses, PostcodesErrors, ThrowOnError, "fields">;
|
|
66
|
+
/**
|
|
67
|
+
* Availability
|
|
68
|
+
*
|
|
69
|
+
* Returns public information on an API Key: whether it can be used right now (`available`), the search contexts the key is licensed for (`contexts`) and the context that best matches the caller's IP address (`context`).
|
|
70
|
+
*
|
|
71
|
+
* The endpoint accepts API Keys (beginning `ak_`) and sub-licensed keys (beginning `sl_`), and needs no `user_token`.
|
|
72
|
+
*
|
|
73
|
+
* A key that exists but cannot be used, because it has no lookups left or has breached a limit, returns `200` with `"available": false`. An unknown or malformed key returns an error.
|
|
74
|
+
*
|
|
75
|
+
* Supply a valid `user_token` and the endpoint returns the key's private details instead, as `GET /keys/{key}/details` does. A `user_token` that does not own the key is rejected.
|
|
76
|
+
*
|
|
77
|
+
*/
|
|
78
|
+
declare const keyAvailability: <ThrowOnError extends boolean = true>(options: Options<KeyAvailabilityData, ThrowOnError>) => RequestResult<KeyAvailabilityResponses, KeyAvailabilityErrors, ThrowOnError, "fields">;
|
|
79
|
+
/**
|
|
80
|
+
* Details
|
|
81
|
+
*
|
|
82
|
+
* Returns private data on a key: remaining lookups, licensed datasets, usage limits, notification settings and the search contexts the key can serve.
|
|
83
|
+
*/
|
|
84
|
+
declare const keyDetails: <ThrowOnError extends boolean = true>(options: Options<KeyDetailsData, ThrowOnError>) => RequestResult<KeyDetailsResponses, KeyDetailsErrors, ThrowOnError, "fields">;
|
|
85
|
+
/**
|
|
86
|
+
* Update Details
|
|
87
|
+
*
|
|
88
|
+
* Updates a key's settings and returns its private details. Only the fields you send change. A key on an unlimited plan ignores changes to `datasets`, `daily_limit` and `monthly_limit`.
|
|
89
|
+
*/
|
|
90
|
+
declare const updateKeyDetails: <ThrowOnError extends boolean = true>(options: Options<UpdateKeyDetailsData, ThrowOnError>) => RequestResult<UpdateKeyDetailsResponses, UpdateKeyDetailsErrors, ThrowOnError, "fields">;
|
|
91
|
+
/**
|
|
92
|
+
* Usage Stats
|
|
93
|
+
*
|
|
94
|
+
* Reports the number of lookups a key consumed over a date range, as a total and a daily breakdown.
|
|
95
|
+
*
|
|
96
|
+
* The range defaults to the last 21 days. `start` and `end` take UNIX timestamps in milliseconds, and `end` defaults to the current time. The maximum range is 90 days.
|
|
97
|
+
*
|
|
98
|
+
* Query at most three tags at once.
|
|
99
|
+
*
|
|
100
|
+
*/
|
|
101
|
+
declare const keyUsage: <ThrowOnError extends boolean = true>(options: Options<KeyUsageData, ThrowOnError>) => RequestResult<KeyUsageResponses, KeyUsageErrors, ThrowOnError, "fields">;
|
|
102
|
+
/**
|
|
103
|
+
* Logs (CSV)
|
|
104
|
+
*
|
|
105
|
+
* Returns a CSV of the paid lookups made on a key, with the information recorded against each one.
|
|
106
|
+
*
|
|
107
|
+
* This method requires a `user_token`, which can be found on your [accounts page](https://account.ideal-postcodes.co.uk/account).
|
|
108
|
+
*
|
|
109
|
+
* You can request a maximum interval of 90 days. Without a start or end date, the interval defaults to the last 21 days.
|
|
110
|
+
*
|
|
111
|
+
* The `Content-Type` returned is CSV (text/csv). For a non-200 response it reverts to JSON, with the error code and message in the body.
|
|
112
|
+
*
|
|
113
|
+
* ## CSV Format
|
|
114
|
+
*
|
|
115
|
+
* The CSV has no header row. Columns, in order:
|
|
116
|
+
*
|
|
117
|
+
* 1. Timestamp (ISO 8601)
|
|
118
|
+
* 2. IP address the request was received from
|
|
119
|
+
* 3. Search term
|
|
120
|
+
* 4. URL the request originated from
|
|
121
|
+
* 5. Lookup type
|
|
122
|
+
* 6. Tags
|
|
123
|
+
* 7. Lookups consumed
|
|
124
|
+
* 8. Licensee name (sublicensing keys only)
|
|
125
|
+
* 9. Source IP address
|
|
126
|
+
*
|
|
127
|
+
* The source IP column carries the address forwarded in the `IDPC-Source-IP` header. It is only recorded for keys with IP address forwarding enabled, and only when the header holds a valid IP address. It is empty otherwise.
|
|
128
|
+
*
|
|
129
|
+
* ## Data Redaction
|
|
130
|
+
*
|
|
131
|
+
* We redact Personally Identifiable Data (PII) in your usage log (including IP, source IP, search term and URL data) weekly.
|
|
132
|
+
*
|
|
133
|
+
* By default we redact PII older than 28 days. You can change this period from your dashboard.
|
|
134
|
+
*
|
|
135
|
+
* Set the interval to `0` days to prevent PII collection altogether.
|
|
136
|
+
*
|
|
137
|
+
*/
|
|
138
|
+
declare const keyLogs: <ThrowOnError extends boolean = true>(options: Options<KeyLogsData, ThrowOnError>) => RequestResult<KeyLogsResponses, KeyLogsErrors, ThrowOnError, "fields">;
|
|
139
|
+
/**
|
|
140
|
+
* Cleanse Address
|
|
141
|
+
*
|
|
142
|
+
* Returns the closest matching address for a freeform address input, with Match Level indicators describing how closely each element of the suggested address matches the input. The more impaired the input address, the harder it is to cleanse.
|
|
143
|
+
*
|
|
144
|
+
* A cleanse that returns a match costs a lookup. A no-match response is free.
|
|
145
|
+
*
|
|
146
|
+
* ## Confidence Score
|
|
147
|
+
*
|
|
148
|
+
* Each incorrect, missing or misspelled element subtracts from the overall confidence score.
|
|
149
|
+
*
|
|
150
|
+
* ### Deciding on an Acceptable Confidence Score Threshold
|
|
151
|
+
*
|
|
152
|
+
* Inputs differ widely between address cleanse projects. Within a project, though, they tend to repeat the same errors. Some datasets are keyed in by hand and prone to typos. Others have a persistently missing datapoint such as organisation name or postcode. There is no absolute Confidence Score threshold. Set the acceptable score project by project, based on the systematic errors in the data and your business goals.
|
|
153
|
+
*
|
|
154
|
+
* To set a threshold, load a subset of the dataset into a spreadsheet application like Excel and sort on the score. Scrolling from top to bottom shows matches from best to worst. As you reach the lower quality searches you can judge roughly:
|
|
155
|
+
*
|
|
156
|
+
* - Which confidence scores indicate ambiguous matches (i.e. up to building level only)
|
|
157
|
+
* - Which confidence scores indicate a poor or no match (i.e. the nearest matching address is too far from the input address)
|
|
158
|
+
*
|
|
159
|
+
* Depending on your business goals, you can also use the Match Levels to determine an acceptable match. You may need to match only up to the thoroughfare or building name, or accurate organisation names may matter.
|
|
160
|
+
*
|
|
161
|
+
*/
|
|
162
|
+
declare const addressCleanse: <ThrowOnError extends boolean = true>(options: Options<AddressCleanseData, ThrowOnError>) => RequestResult<AddressCleanseResponses, AddressCleanseErrors, ThrowOnError, "fields">;
|
|
163
|
+
/**
|
|
164
|
+
* Find Address
|
|
165
|
+
*
|
|
166
|
+
* Returns address suggestions for a partial address, ordered by relevance. Use it to power real-time address autofill.
|
|
167
|
+
*
|
|
168
|
+
* Consider our address autocomplete JavaScript libraries, which add address lookup to a form without calling this API directly.
|
|
169
|
+
*
|
|
170
|
+
* ## API Usage
|
|
171
|
+
*
|
|
172
|
+
* Implementing our Address Autocomplete API involves:
|
|
173
|
+
*
|
|
174
|
+
* 1. Fetch address suggestions with `/autocomplete/addresses`
|
|
175
|
+
* 2. Acquire the complete address using the ID from the suggestion
|
|
176
|
+
*
|
|
177
|
+
* Step 2 decrements your lookup balance.
|
|
178
|
+
*
|
|
179
|
+
* Step 1 is not a free standalone resource. We rate limit and then suspend integrations that repeatedly make autocomplete requests without a paid Step 2 request.
|
|
180
|
+
*
|
|
181
|
+
* ## Context
|
|
182
|
+
*
|
|
183
|
+
* `context` limits the search, usually to a single country. It defaults to `GBR`, and an unrecognised context falls back to that default. If your key is not licensed for the datasets covering the context, the request is rejected.
|
|
184
|
+
*
|
|
185
|
+
* Querying a full postcode within a supported context returns the entire address list for that postcode.
|
|
186
|
+
*
|
|
187
|
+
* ## Query Filters
|
|
188
|
+
*
|
|
189
|
+
* Refine results by appending filters to your querystring, e.g. `postcode=sw1a2aa` for postcode `SW1A 2AA`. Invalid filters return an empty set without affecting your lookup count.
|
|
190
|
+
*
|
|
191
|
+
* To apply multiple filter terms, use a comma-separated list, e.g. `postcode_outward=e1,e2,e3` combines result sets for E1, E2 and E3. Unless otherwise specified, all filters support multiple terms.
|
|
192
|
+
*
|
|
193
|
+
* Filters combine with `AND` logic, for instance `su_organisation_indicator=Y&postcode_area=n`. The maximum is **8** filter terms.
|
|
194
|
+
*
|
|
195
|
+
* ## Address Bias
|
|
196
|
+
*
|
|
197
|
+
* Preface bias searches with `bias_` to boost certain address results. Unlike filters, biasing allows unmatched addresses to appear with lower priority.
|
|
198
|
+
*
|
|
199
|
+
* For example, use `bias_postcode_area=SW,SE` to favour addresses in the `SW` and `SE` postcode areas. Invalid bias terms have no effect.
|
|
200
|
+
*
|
|
201
|
+
* Multiple bias terms are allowed unless stated otherwise, with a combined maximum of **5**.
|
|
202
|
+
*
|
|
203
|
+
* ## Suggestion Format
|
|
204
|
+
*
|
|
205
|
+
* The suggestion format is subject to change. We recommend using the suggestion as-is to avoid integration issues.
|
|
206
|
+
*
|
|
207
|
+
* ## Rate Limiting and Cost
|
|
208
|
+
*
|
|
209
|
+
* The default rate limit is 3,000 requests per 5 minutes, counted per key and IP address. The `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset` headers report where you stand.
|
|
210
|
+
*
|
|
211
|
+
* Autocomplete API usage does not impact your balance, but resolving a suggestion to a full address requires a paid request. Autocomplete requests without subsequent paid requests may lead to rate limiting or suspension.
|
|
212
|
+
*
|
|
213
|
+
*/
|
|
214
|
+
declare const findAddress: <ThrowOnError extends boolean = true>(options?: Options<FindAddressData, ThrowOnError>) => RequestResult<FindAddressResponses, FindAddressErrors, ThrowOnError, "fields">;
|
|
215
|
+
/**
|
|
216
|
+
* Resolve Address
|
|
217
|
+
*
|
|
218
|
+
* Returns the complete address for an autocomplete suggestion, identified by its address ID.
|
|
219
|
+
*
|
|
220
|
+
* This is the step of the autocomplete flow that costs a lookup. Fetching suggestions is free.
|
|
221
|
+
*
|
|
222
|
+
* The API returns resolved addresses, including addresses outside the UK, in a UK format (up to 3 address lines) using UK nomenclature such as postcode and county.
|
|
223
|
+
*
|
|
224
|
+
* An ID that matches no address returns `404`.
|
|
225
|
+
*
|
|
226
|
+
*/
|
|
227
|
+
declare const resolveAddress: <ThrowOnError extends boolean = true>(options: Options<ResolveAddressData, ThrowOnError>) => RequestResult<ResolveAddressResponses, ResolveAddressErrors, ThrowOnError, "fields">;
|
|
228
|
+
/**
|
|
229
|
+
* Extract Addresses
|
|
230
|
+
*
|
|
231
|
+
* Returns a list of UK addresses matching the query, ordered by relevance score. `limit` defaults to 10 and caps at 100. `page` defaults to 0.
|
|
232
|
+
*
|
|
233
|
+
* You may only extract a single address from each request. To extract multiple addresses, you must perform an individual request for each address.
|
|
234
|
+
*
|
|
235
|
+
* If the query is a valid postcode, the API returns the whole address list for that postcode and raises the limit to 100. Use `page` to reach the rest of a postcode holding more than 100 premises. You cannot page beyond 10,000 results.
|
|
236
|
+
*
|
|
237
|
+
* Your key needs at least one of PAF, Multiple Residence, Not Yet Built, PAF Alias, PAF Welsh, AddressBase or AddressBase Premium. Without one the request is rejected.
|
|
238
|
+
*
|
|
239
|
+
* A request that returns at least one address costs a lookup. Empty result sets are free.
|
|
240
|
+
*
|
|
241
|
+
* ## Reverse Geocoding
|
|
242
|
+
*
|
|
243
|
+
* Return the addresses around a point with the `lon=` and `lat=` querystring arguments. The search radius is 100m and the API sorts addresses by distance from the point.
|
|
244
|
+
*
|
|
245
|
+
* ## Filters
|
|
246
|
+
*
|
|
247
|
+
* Narrow your results by adding filters to your query string that correspond with an address attribute.
|
|
248
|
+
*
|
|
249
|
+
* For instance, you can restrict to postcode `SW1A 2AA` by appending `postcode=sw1a2aa`.
|
|
250
|
+
*
|
|
251
|
+
* If a filter term is invalid, e.g. `postcode=SW1A2AAA`, the API returns an empty result set and charges no lookup.
|
|
252
|
+
*
|
|
253
|
+
* You can also scope using multiple terms for the same filter with a comma separated list of terms. E.g. Restrict results to E1, E2 and E3 outward codes: `postcode_outward=e1,e2,e3`. Multiple terms are `OR`'ed, i.e. the matching result sets are combined.
|
|
254
|
+
*
|
|
255
|
+
* All filters can accept multiple terms unless stated otherwise below.
|
|
256
|
+
*
|
|
257
|
+
* Multiple filters can also be combined. E.g. Restrict results to small user organisations in the N postcode area: `su_organisation_indicator=Y&postcode_area=n`. Multiple filters are `AND`'ed, i.e. each additional filter narrows the result set.
|
|
258
|
+
*
|
|
259
|
+
* A combined maximum of 8 terms is allowed across all filters.
|
|
260
|
+
*
|
|
261
|
+
* ## Biases
|
|
262
|
+
*
|
|
263
|
+
* You can boost address results that correspond with a given address attribute. All bias searches are prefixed with `bias_`.
|
|
264
|
+
*
|
|
265
|
+
* Biased searches, unlike filtered searches, still allow unmatched addresses to appear. They rank lower.
|
|
266
|
+
*
|
|
267
|
+
* For instance, you can boost addresses with postcode areas `SW` and `SE` by appending `bias_postcode_area=SW,SE`.
|
|
268
|
+
*
|
|
269
|
+
* If a bias term is invalid, e.g. `bias_postcode=SW1A2AAA`, no bias is applied.
|
|
270
|
+
*
|
|
271
|
+
* You may scope using multiple terms for the same bias with a comma separated list of terms. E.g. Prefer results in the `E1`, `E2` and `E3` outward codes: `bias_postcode_outward=e1,e2,e3`.
|
|
272
|
+
*
|
|
273
|
+
* All biases can accept multiple terms unless stated otherwise below.
|
|
274
|
+
*
|
|
275
|
+
* A combined maximum of 5 terms is allowed across all biases.
|
|
276
|
+
*
|
|
277
|
+
* ## Search by Postcode and Building Name or Number
|
|
278
|
+
*
|
|
279
|
+
* Search by postcode and building attribute with the postcode filter and query argument. E.g. For "SW1A 2AA Prime Minister" `/v1/addresses?postcode=sw1a2aa&q=prime minister`.
|
|
280
|
+
*
|
|
281
|
+
* Using a filter means a postcode mismatch returns no results and costs no lookup.
|
|
282
|
+
*
|
|
283
|
+
* ### Search by UPRN
|
|
284
|
+
*
|
|
285
|
+
* Search by UPRN using the `uprn` filter and excluding the query argument. E.g. `/v1/addresses?uprn=100`.
|
|
286
|
+
*
|
|
287
|
+
* ## Testing
|
|
288
|
+
*
|
|
289
|
+
* - **ID1 1QD** Returns a successful query response `2000`
|
|
290
|
+
* - **ID1 KFA** Returns an empty query response `2000`
|
|
291
|
+
* - **ID1 CLIP** Returns "no lookups remaining" error `4020`
|
|
292
|
+
* - **ID1 CHOP** Returns "daily (or individual) lookup limit breached" error `4021`
|
|
293
|
+
*
|
|
294
|
+
* Test requests undergo the usual authentication and restriction rules. They surface any issues during implementation and do not cost you a lookup.
|
|
295
|
+
*
|
|
296
|
+
*/
|
|
297
|
+
declare const addresses: <ThrowOnError extends boolean = true>(options?: Options<AddressesData, ThrowOnError>) => RequestResult<AddressesResponses, AddressesErrors, ThrowOnError, "fields">;
|
|
298
|
+
/**
|
|
299
|
+
* Find Place
|
|
300
|
+
*
|
|
301
|
+
* Returns place suggestions for a query, ranked by relevance. Places cover countries, administrative areas, capitals and other administrative seats.
|
|
302
|
+
*
|
|
303
|
+
* ## Implementing Place Autocomplete
|
|
304
|
+
*
|
|
305
|
+
* Retrieving a full place takes two requests:
|
|
306
|
+
*
|
|
307
|
+
* 1. Fetch suggestions from `/places`
|
|
308
|
+
* 2. Fetch the place using the `id` on a suggestion
|
|
309
|
+
*
|
|
310
|
+
* A query returns at most 10 suggestions. An empty query returns an empty result set. Show users the `descriptive_name`. The API drops suggestions that share one, so each name in a response identifies a single place.
|
|
311
|
+
*
|
|
312
|
+
* ## Rate Limiting and Cost
|
|
313
|
+
*
|
|
314
|
+
* The rate limit is 3,000 requests per 5 minutes.
|
|
315
|
+
*
|
|
316
|
+
* `/places` does not decrement your lookup balance, but resolving a suggestion to a full place does. We rate limit and then suspend integrations that repeatedly call `/places` without resolving.
|
|
317
|
+
*
|
|
318
|
+
*/
|
|
319
|
+
declare const findPlace: <ThrowOnError extends boolean = true>(options?: Options<FindPlaceData, ThrowOnError>) => RequestResult<FindPlaceResponses, FindPlaceErrors, ThrowOnError, "fields">;
|
|
320
|
+
/**
|
|
321
|
+
* Resolve Place
|
|
322
|
+
*
|
|
323
|
+
* Returns the full place for a place ID taken from a `/places` suggestion.
|
|
324
|
+
*
|
|
325
|
+
* On top of the fields carried by the suggestion, the response adds coordinates, language and the underlying dataset record.
|
|
326
|
+
*
|
|
327
|
+
* Each request decrements your lookup balance. An unknown ID returns `404`.
|
|
328
|
+
*
|
|
329
|
+
*/
|
|
330
|
+
declare const resolvePlace: <ThrowOnError extends boolean = true>(options: Options<ResolvePlaceData, ThrowOnError>) => RequestResult<ResolvePlaceResponses, ResolvePlaceErrors, ThrowOnError, "fields">;
|
|
331
|
+
/**
|
|
332
|
+
* List
|
|
333
|
+
*
|
|
334
|
+
* Returns a key's licensees, oldest first, up to 100 per request. The list omits cancelled licensees. The key must be enabled for sub-licensing.
|
|
335
|
+
*/
|
|
336
|
+
declare const listLicensees: <ThrowOnError extends boolean = true>(options: Options<ListLicenseesData, ThrowOnError>) => RequestResult<ListLicenseesResponses, ListLicenseesErrors, ThrowOnError, "fields">;
|
|
337
|
+
/**
|
|
338
|
+
* Create
|
|
339
|
+
*
|
|
340
|
+
* Creates a licensee on a key and returns it with its generated `sl_` key. The key must be enabled for sub-licensing.
|
|
341
|
+
*/
|
|
342
|
+
declare const createLicensee: <ThrowOnError extends boolean = true>(options: Options<CreateLicenseeData, ThrowOnError>) => RequestResult<CreateLicenseeResponses, CreateLicenseeErrors, ThrowOnError, "fields">;
|
|
343
|
+
/**
|
|
344
|
+
* Cancel
|
|
345
|
+
*
|
|
346
|
+
* Cancels a licensee. Its key stops working and it drops out of the licensee list. Contact us to reverse it.
|
|
347
|
+
*/
|
|
348
|
+
declare const deleteLicensee: <ThrowOnError extends boolean = true>(options: Options<DeleteLicenseeData, ThrowOnError>) => RequestResult<DeleteLicenseeResponses, DeleteLicenseeErrors, ThrowOnError, "fields">;
|
|
349
|
+
/**
|
|
350
|
+
* Retrieve
|
|
351
|
+
*
|
|
352
|
+
* Returns a licensee by its `sl_` key. A cancelled or unknown licensee returns `404`.
|
|
353
|
+
*/
|
|
354
|
+
declare const retrieveLicensee: <ThrowOnError extends boolean = true>(options: Options<RetrieveLicenseeData, ThrowOnError>) => RequestResult<RetrieveLicenseeResponses, RetrieveLicenseeErrors, ThrowOnError, "fields">;
|
|
355
|
+
/**
|
|
356
|
+
* Update
|
|
357
|
+
*
|
|
358
|
+
* Updates a licensee's address, postcode, allowed URLs and daily limit. Returns the updated licensee. The name is fixed at creation.
|
|
359
|
+
*/
|
|
360
|
+
declare const updateLicensee: <ThrowOnError extends boolean = true>(options: Options<UpdateLicenseeData, ThrowOnError>) => RequestResult<UpdateLicenseeResponses, UpdateLicenseeErrors, ThrowOnError, "fields">;
|
|
361
|
+
/**
|
|
362
|
+
* Regenerate Key
|
|
363
|
+
*
|
|
364
|
+
* Regenerates a licensee's key and returns the licensee with the new key. The previous key stops working immediately, so update any integration that uses it.
|
|
365
|
+
*/
|
|
366
|
+
declare const regenerateLicenseeKey: <ThrowOnError extends boolean = true>(options: Options<RegenerateLicenseeKeyData, ThrowOnError>) => RequestResult<RegenerateLicenseeKeyResponses, RegenerateLicenseeKeyErrors, ThrowOnError, "fields">;
|
|
367
|
+
/**
|
|
368
|
+
* List
|
|
369
|
+
*
|
|
370
|
+
* Returns every configuration stored against a key, oldest first.
|
|
371
|
+
*/
|
|
372
|
+
declare const listConfigs: <ThrowOnError extends boolean = true>(options: Options<ListConfigsData, ThrowOnError>) => RequestResult<ListConfigsResponses, ListConfigsErrors, ThrowOnError, "fields">;
|
|
373
|
+
/**
|
|
374
|
+
* Create
|
|
375
|
+
*
|
|
376
|
+
* Creates a named configuration on a key and returns it.
|
|
377
|
+
*/
|
|
378
|
+
declare const createConfig: <ThrowOnError extends boolean = true>(options: Options<CreateConfigData, ThrowOnError>) => RequestResult<CreateConfigResponses, CreateConfigErrors, ThrowOnError, "fields">;
|
|
379
|
+
/**
|
|
380
|
+
* Delete
|
|
381
|
+
*
|
|
382
|
+
* Permanently deletes a configuration object.
|
|
383
|
+
*/
|
|
384
|
+
declare const deleteConfig: <ThrowOnError extends boolean = true>(options: Options<DeleteConfigData, ThrowOnError>) => RequestResult<DeleteConfigResponses, DeleteConfigErrors, ThrowOnError, "fields">;
|
|
385
|
+
/**
|
|
386
|
+
* Retrieve
|
|
387
|
+
*
|
|
388
|
+
* Returns a configuration by name. This request needs no `user_token`, so a browser integration can read its own configuration at runtime.
|
|
389
|
+
*/
|
|
390
|
+
declare const retrieveConfig: <ThrowOnError extends boolean = true>(options: Options<RetrieveConfigData, ThrowOnError>) => RequestResult<RetrieveConfigResponses, RetrieveConfigErrors, ThrowOnError, "fields">;
|
|
391
|
+
/**
|
|
392
|
+
* Update
|
|
393
|
+
*
|
|
394
|
+
* Replaces a configuration's payload and returns the updated configuration. The name is fixed at creation.
|
|
395
|
+
*/
|
|
396
|
+
declare const updateConfig: <ThrowOnError extends boolean = true>(options: Options<UpdateConfigData, ThrowOnError>) => RequestResult<UpdateConfigResponses, UpdateConfigErrors, ThrowOnError, "fields">;
|
|
397
|
+
/**
|
|
398
|
+
* Email Validation
|
|
399
|
+
*
|
|
400
|
+
* Validates an email address and reports whether it is deliverable.
|
|
401
|
+
*
|
|
402
|
+
* Requires an API Key licensed for email validation. A query over 320 characters is rejected.
|
|
403
|
+
*
|
|
404
|
+
* A validated address decrements your lookup balance. An address the API cannot check returns `unknown` and costs no lookup. An address whose domain does not resolve, or publishes no MX records, returns `not_deliverable` and also costs no lookup. Only those two domain failures populate `suggestions`. Every other response returns an empty list.
|
|
405
|
+
*
|
|
406
|
+
*/
|
|
407
|
+
declare const emailValidation: <ThrowOnError extends boolean = true>(options: Options<EmailValidationData, ThrowOnError>) => RequestResult<EmailValidationResponses, EmailValidationErrors, ThrowOnError, "fields">;
|
|
408
|
+
/**
|
|
409
|
+
* Phone Number Validation
|
|
410
|
+
*
|
|
411
|
+
* Validates a phone number and returns its country, its national and international formats, and the network it was originally assigned to.
|
|
412
|
+
*
|
|
413
|
+
* Requires an API Key licensed for phone validation.
|
|
414
|
+
*
|
|
415
|
+
* Every query decrements your lookup balance, including a number that fails to parse and a number reported as invalid.
|
|
416
|
+
*
|
|
417
|
+
*/
|
|
418
|
+
declare const phoneNumberValidation: <ThrowOnError extends boolean = true>(options: Options<PhoneNumberValidationData, ThrowOnError>) => RequestResult<PhoneNumberValidationResponses, PhoneNumberValidationErrors, ThrowOnError, "fields">;
|
|
419
|
+
|
|
420
|
+
export { type Options as O, addressCleanse as a, addresses as b, createConfig as c, createLicensee as d, deleteConfig as e, deleteLicensee as f, emailValidation as g, findAddress as h, findPlace as i, keyDetails as j, keyAvailability as k, keyLogs as l, keyUsage as m, listConfigs as n, listLicensees as o, phoneNumberValidation as p, postcodes as q, regenerateLicenseeKey as r, resolveAddress as s, resolvePlace as t, retrieveConfig as u, retrieveLicensee as v, updateConfig as w, updateKeyDetails as x, updateLicensee as y };
|