4.1.2 • Published 6 months ago

@ideal-postcodes/core-axios v4.1.2

Weekly downloads
512
License
MIT
Repository
github
Last release
6 months ago

Axios backed JavaScript client for api.ideal-postcodes.co.uk

CI codecov Dependency Status npm version install size Release

@ideal-postcodes/core-axios is the Axios backed client for api.ideal-postcodes.co.uk. Axios is a promise based HTTP client for the browser and node.js and so is ideal for:

  • Frameworks that utilise server side rendering (Angular, Next.js, React, etc)
  • Isomorphic code (runs on browser and server)

Our JavaScript client implements a common interface defined at @ideal-postcodes/core-interface.

High level client documentation can be found at core-interface.

In depth client documentation can be found at core-interface.ideal-postcodes.dev.

Links

Other JavaScript Clients

Documentation

Configuration & Usage

Install

npm install @ideal-postcodes/core-axios

Instantiate

import { Client } from "@ideal-postcodes/core-axios"

const client = new Client({ api_key: "iddqd" });

Configuration options

Use

import { lookupPostcode } from "@ideal-postcodes/core-axios"

const addresses = await lookupPostcode({ client, postcode: "SW1A2AA" });

Catch Errors

import { errors, lookupAddress } from "@ideal-postcodes/core-axios"

try {
  await lookupAddress({ client, query: "10 downing street" });
} catch (error) {
  if (error instanceof errors.IdpcRequestFailedError) {
    // IdpcRequestFailedError indicates a 402 response code
    // Possibly the key balance has been depleted
  }
}

Test

npm test

Licence

MIT

4.1.2

6 months ago

4.1.1

6 months ago

4.1.0

2 years ago

4.0.1

2 years ago

3.0.7

2 years ago

4.0.0-beta.1

2 years ago

4.0.0

2 years ago

3.0.6

3 years ago

3.0.5

3 years ago

3.0.4

3 years ago

3.0.3

3 years ago

3.0.2

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.2.4

3 years ago

2.2.3

3 years ago

2.2.2

3 years ago

2.2.1

3 years ago

2.2.0

4 years ago

2.1.0

4 years ago

2.0.0

4 years ago

1.1.0

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago