import { Agent, HttpResponse, Header } from "./agent"; import { Authenticable, Filterable, Taggable, HttpOptions, Paginateable } from "./types"; import * as errors from "./error"; import { Address, KeyStatus } from "@ideal-postcodes/api-typings"; declare type Protocol = "http" | "https"; export interface Config { /** * Use TLS. Defaults to `true` */ tls: boolean; /** * API Key. Used in API helper methods */ api_key: string; /** * Target API hostname. Defaults to `'api.ideal-postcodes.co.uk'` */ baseUrl: string; /** * API version. Defaults to `'v1'` */ version: string; /** * Force autocomplete authorisation via HTTP headers only. Defaults to `false` */ strictAuthorisation: boolean; /** * Default time in ms before HTTP request timeout. Defaults to 10s (`10000`) */ timeout: number; /** * HTTP Agent * * For downstream clients like core-node and core-browser, this will default to the native platform HTTP client */ agent: Agent; /** * String map specifying default headers */ header: Header; } interface Defaults { header: Header; } import { AddressResource } from "./resources/addresses"; import { PostcodeResource } from "./resources/postcodes"; import { KeyResource } from "./resources/keys"; import { UdprnResource } from "./resources/udprn"; import { UmprnResource } from "./resources/umprn"; import { AutocompleteResource } from "./resources/autocomplete"; interface LookupIdOptions extends Authenticable, Filterable, Taggable, HttpOptions { } interface LookupAddressOptions extends Authenticable, Filterable, Taggable, Paginateable, HttpOptions { /** * Query for address */ query: string; } interface LookupPostcodeOptions extends LookupIdOptions { /** * Postcode to query for. Space and case insensitive */ postcode: string; /** * With multiple residence datasets, a very small number of postcodes will * yield more than 100 results. In this instance, you would need to paginate * through them with `page` */ page?: number; } interface LookupUdprnOptions extends LookupIdOptions { /** * UDPRN to query for */ udprn: number; } interface LookupUmprnOptions extends LookupIdOptions { /** * UMPRN to query for */ umprn: number; } interface CheckKeyUsabilityOptions extends HttpOptions { /** * If api_key is supplied, this will overwrite the key defined during client instantiation */ api_key?: string; /** * Checks API Key and licensee combination. This checks whether a particular * licensee can use the API */ licensee?: string; } export declare class Client { static defaults: Defaults; readonly tls: boolean; readonly api_key: string; readonly baseUrl: string; readonly version: string; readonly strictAuthorisation: boolean; readonly timeout: number; readonly agent: Agent; readonly header: Header; readonly postcodes: PostcodeResource; readonly addresses: AddressResource; readonly udprn: UdprnResource; readonly umprn: UmprnResource; readonly keys: KeyResource; readonly autocomplete: AutocompleteResource; static errors: typeof errors; constructor(config: Config); /** * Return base URL for API requests */ url(): string; protocol(): Protocol; /** * Ping API base (`/`) * * Dispatches HTTP request to root endpoint "`/`" */ ping(): Promise; /** * Lookup Postcode * * Search for addresses given a postcode. Postcode queries are case and space insensitive * * Invalid postcodes return an empty array address result `[]` * * [API Documentation for /postcodes](https://ideal-postcodes.co.uk/documentation/postcodes#postcode) */ lookupPostcode(options: LookupPostcodeOptions): Promise; /** * Lookup Address * * Search for an address given a query * * [API Documentation for /addresses](https://ideal-postcodes.co.uk/documentation/addresses#query) */ lookupAddress(options: LookupAddressOptions): Promise; /** * Generates a request object. Bundles together commonly used header/query extractions: * - Authorization (api_key, licensee, user_token) * - Source IP forwarding * - Result filtering * - Tagging */ private toAddressIdQuery; /** * Lookup UDPRN * * Search for an address given a UDPRN * * Invalid UDPRN returns `null` * * [API Documentation for /udprn](https://ideal-postcodes.co.uk/documentation/udprn) */ lookupUdprn(options: LookupUdprnOptions): Promise
; /** * Lookup UMPRN * * Search for an address given a UDPRN * * Invalid UDPRN returns `null` * * [API Documentation for /udprn](https://ideal-postcodes.co.uk/documentation/udprn) */ lookupUmprn(options: LookupUmprnOptions): Promise
; /** * Check Key Availability * * Checks if a key can bey used * * [API Documentation for /keys]()https://ideal-postcodes.co.uk/documentation/keys#key) */ checkKeyUsability(options: CheckKeyUsabilityOptions): Promise; } export {};