@ideal-postcodes/core-interface
Advanced tools
Comparing version 1.3.0 to 1.4.0
@@ -0,1 +1,14 @@ | ||
# [1.4.0](https://github.com/ideal-postcodes/core-interface/compare/1.3.0...1.4.0) (2019-12-06) | ||
### Bug Fixes | ||
* **Browser Tests:** Migrate to SL ([2b96ae5](https://github.com/ideal-postcodes/core-interface/commit/2b96ae5)) | ||
* **README:** Check against Markdown lint rules and correct grammar ([b210165](https://github.com/ideal-postcodes/core-interface/commit/b210165)) | ||
### Features | ||
* **Autocomplete:** Expose autocomplete resource ([b386ce0](https://github.com/ideal-postcodes/core-interface/commit/b386ce0)) | ||
# [1.3.0](https://github.com/ideal-postcodes/core-interface/compare/1.2.0...1.3.0) (2019-06-09) | ||
@@ -2,0 +15,0 @@ |
@@ -50,2 +50,3 @@ import { Agent, HttpResponse, Header } from "./agent"; | ||
import { UmprnResource } from "./resources/umprn"; | ||
import { AutocompleteResource } from "./resources/autocomplete"; | ||
interface LookupIdOptions extends Authenticable, Filterable, Taggable, HttpOptions { | ||
@@ -104,2 +105,3 @@ } | ||
readonly keys: KeyResource; | ||
readonly autocomplete: AutocompleteResource; | ||
static errors: typeof errors; | ||
@@ -106,0 +108,0 @@ constructor(config: Config); |
@@ -29,2 +29,3 @@ "use strict"; | ||
var umprn_1 = require("./resources/umprn"); | ||
var autocomplete_1 = require("./resources/autocomplete"); | ||
var Client = /** @class */ (function () { | ||
@@ -39,3 +40,3 @@ function Client(config) { | ||
this.agent = config.agent; | ||
this.header = __assign({}, Client.defaults.header, config.header); | ||
this.header = __assign(__assign({}, Client.defaults.header), config.header); | ||
this.postcodes = postcodes_1.create(this); | ||
@@ -46,2 +47,3 @@ this.addresses = addresses_1.create(this); | ||
this.keys = keys_1.create(this); | ||
this.autocomplete = autocomplete_1.create(this); | ||
} | ||
@@ -48,0 +50,0 @@ /** |
@@ -71,2 +71,11 @@ import { Address } from "@ideal-postcodes/api-typings"; | ||
export interface Taggable { | ||
/** | ||
* Submit tags to annotate paid API requests for retrieve and aggregation later | ||
* | ||
* Restrictions: | ||
* - You may only specify up to 5 tags per API request | ||
* - Each tag must not be longer than 16 UTF-8 characters | ||
* | ||
* [Tagging & Metadata API Documentation](https://ideal-postcodes.co.uk/documentation/metadata) | ||
*/ | ||
tags?: string[]; | ||
@@ -73,0 +82,0 @@ } |
@@ -52,3 +52,3 @@ "use strict"; | ||
var _b = _a.header, header = _b === void 0 ? {} : _b; | ||
return __assign({}, client.header, exports.toStringMap(header)); | ||
return __assign(__assign({}, client.header), exports.toStringMap(header)); | ||
}; | ||
@@ -55,0 +55,0 @@ /** |
{ | ||
"name": "@ideal-postcodes/core-interface", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "Interface specification for javascript based API Clients to api.ideal-postcodes.co.uk", | ||
@@ -22,11 +22,13 @@ "author": { | ||
"scripts": { | ||
"semantic-release": "node_modules/.bin/semantic-release --no-ci", | ||
"test-watch": "NODE_ENV=test node_modules/.bin/mocha --watch", | ||
"test": "npm run lint && NODE_ENV=test node_modules/.bin/nyc node_modules/.bin/mocha", | ||
"karma": "./node_modules/.bin/karma start", | ||
"browserstack": "./node_modules/.bin/karma start .config/browserstack.karma.conf.ts", | ||
"lint": "node_modules/.bin/tslint -c tslint.json -p tsconfig.json lib/**/*.ts", | ||
"build": "npm run lint && node_modules/.bin/tsc", | ||
"coverage": "node_modules/.bin/nyc report --reporter=text-lcov | node_modules/.bin/coveralls || true", | ||
"docs": "./node_modules/.bin/typedoc --mode file --target ES3 --out docs/ --name 'Ideal Postcodes JS Client Interface' --theme minimal --excludePrivate --hideGenerator --excludeExternals lib/", | ||
"semantic-release": "semantic-release --no-ci", | ||
"test-watch": "NODE_ENV=test mocha --watch", | ||
"test": "npm run lint && NODE_ENV=test nyc mocha", | ||
"test:browsers:headless": "karma start", | ||
"test:browsers": "npm run test:browsers:latest && npm run test:browsers:legacy", | ||
"test:browsers:latest": "karma start .config/latest.conf.ts", | ||
"test:browsers:legacy": "karma start .config/legacy.conf.ts", | ||
"lint": "eslint lib/**/*.ts", | ||
"build": "npm run lint && tsc", | ||
"coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov", | ||
"docs": "typedoc --mode file --out docs/ --name 'Ideal Postcodes JS Client Interface' --theme minimal --excludePrivate --hideGenerator lib/", | ||
"prepublishOnly": "npm run test && npm run build" | ||
@@ -92,3 +94,4 @@ }, | ||
"devDependencies": { | ||
"@cablanchard/semantic-release": "~1.2.1", | ||
"@cablanchard/eslint-config": "~1.1.1", | ||
"@cablanchard/semantic-release": "~1.3.0", | ||
"@cablanchard/tsconfig": "1.0.0", | ||
@@ -98,14 +101,19 @@ "@cablanchard/tslint": "0.0.1", | ||
"@ideal-postcodes/api-typings": "~1.1.0", | ||
"@types/chai": "~4.1.7", | ||
"@ideal-postcodes/supported-browsers": "~1.2.0", | ||
"@types/chai": "~4.2.0", | ||
"@types/dotenv": "~8.2.0", | ||
"@types/karma": "~3.0.3", | ||
"@types/mocha": "~5.2.7", | ||
"@types/node": "~12.0.4", | ||
"@types/prettier": "~1.16.4", | ||
"@types/puppeteer": "~1.12.4", | ||
"@types/sinon": "~7.0.12", | ||
"@types/node": "~12.12.0", | ||
"@types/prettier": "~1.19.0", | ||
"@types/puppeteer": "~2.0.0", | ||
"@types/sinon": "~7.5.0", | ||
"babel-polyfill": "~6.26.0", | ||
"chai": "~4.2.0", | ||
"coveralls": "~3.0.2", | ||
"karma": "~4.1.0", | ||
"karma-browserstack-launcher": "~1.5.1", | ||
"karma-chrome-launcher": "~2.2.0", | ||
"codecov": "~3.6.1", | ||
"dotenv": "~8.2.0", | ||
"eslint": "~6.7.1", | ||
"karma": "~4.4.0", | ||
"karma-cbt-launcher": "~0.4.6", | ||
"karma-chrome-launcher": "~3.1.0", | ||
"karma-cli": "~2.0.0", | ||
@@ -115,15 +123,15 @@ "karma-mocha": "~1.3.0", | ||
"karma-typescript": "~4.1.0", | ||
"mocha": "~6.1.1", | ||
"mocha": "~6.2.0", | ||
"nyc": "~14.1.1", | ||
"prettier": "~1.18.0", | ||
"puppeteer": "~1.17.0", | ||
"prettier": "~1.19.1", | ||
"puppeteer": "~2.0.0", | ||
"semantic-release": "~15.13.12", | ||
"sinon": "~7.3.2", | ||
"sinon": "~7.5.0", | ||
"source-map-support": "~0.5.10", | ||
"ts-node": "~8.2.0", | ||
"tslint": "~5.17.0", | ||
"type-zoo": "~3.3.0", | ||
"typedoc": "~0.14.2", | ||
"typescript": "~3.5.1" | ||
"ts-node": "~8.5.0", | ||
"tslint": "~5.20.0", | ||
"type-zoo": "~3.4.0", | ||
"typedoc": "~0.15.0", | ||
"typescript": "~3.7.2" | ||
} | ||
} |
@@ -5,8 +5,7 @@ <h1 align="center"> | ||
> Javascript API for api.ideal-postcodes.co.uk | ||
> JavaScript API for api.ideal-postcodes.co.uk | ||
[![CircleCI](https://circleci.com/gh/ideal-postcodes/core-interface/tree/master.svg?style=svg)](https://circleci.com/gh/ideal-postcodes/core-interface/tree/master) | ||
[![Coverage Status](https://coveralls.io/repos/github/ideal-postcodes/core-interface/badge.svg?branch=master&t=nyUaqN)](https://coveralls.io/github/ideal-postcodes/core-interface?branch=master) | ||
![Dependency Status](https://david-dm.org/ideal-postcodes/core-interface.svg) | ||
[![BrowserStack Status](https://www.browserstack.com/automate/badge.svg?badge_key=RGl2bTU2Z3l4MGZNR1ZZREpyajlNaXZFMElZMkNCNENKRHNCMCtyVTBrbz0tLXdVODl3TlRJejA1MWpiTzYzaTBsZ1E9PQ==--8eb0b38bd782e0145dc4dc01e093c861828dbfa8)](https://www.browserstack.com/automate/public-build/RGl2bTU2Z3l4MGZNR1ZZREpyajlNaXZFMElZMkNCNENKRHNCMCtyVTBrbz0tLXdVODl3TlRJejA1MWpiTzYzaTBsZ1E9PQ==--8eb0b38bd782e0145dc4dc01e093c861828dbfa8) | ||
![Dependency Status](https://david-dm.org/ideal-postcodes/core-interface.svg) | ||
[![codecov](https://codecov.io/gh/ideal-postcodes/core-interface/branch/master/graph/badge.svg)](https://codecov.io/gh/ideal-postcodes/core-interface) | ||
[![npm version](https://badge.fury.io/js/%40ideal-postcodes%2Fcore-interface.svg)](https://badge.fury.io/js/%40ideal-postcodes%2Fcore-interface) | ||
@@ -17,5 +16,5 @@ ![npm bundle size (scoped)](https://img.shields.io/bundlephobia/min/@ideal-postcodes/core-interface.svg?color=%234c1&style=popout) | ||
`@ideal-postcodes/core-interface` is an environment agnostic implementation of the Ideal Postcodes javascript API client interface. | ||
`@ideal-postcodes/core-interface` is an environment agnostic implementation of the Ideal Postcodes JavaScript API client interface. | ||
If you are looking for the browser or node.js client which implements this interface, please check out the [downstream clients links](#downstream-clients). | ||
If you are looking for the browser or Node.js client which implements this interface, please check out the [downstream clients links](#downstream-clients). | ||
@@ -26,3 +25,3 @@ ## Links | ||
- [npm Module](https://www.npmjs.com/package/@ideal-postcodes/core-interface) | ||
- [Github Repository](https://github.com/ideal-postcodes/core-interface) | ||
- [GitHub Repository](https://github.com/ideal-postcodes/core-interface) | ||
- [Typings Repository](https://github.com/ideal-postcodes/api-typings) | ||
@@ -33,3 +32,3 @@ - [Fixtures Repository](https://github.com/ideal-postcodes/api-fixtures) | ||
- [Browser Client Repository](https://github.com/ideal-postcodes/core-browser) | ||
- [Browser Client Repository](https://github.com/ideal-postcodes/core-browser) | ||
- [Bundled Browser Client Repository](https://github.com/ideal-postcodes/core-browser-bundled) | ||
@@ -62,3 +61,3 @@ - [Node.js Client Repository](https://github.com/ideal-postcodes/core-node) | ||
Instantiate a client with, | ||
Instantiate a client with | ||
@@ -80,3 +79,3 @@ ```javascript | ||
The client exposes a number of simple methods to get at the most common tasks when interacting with the API. | ||
The client exposes a number of simple methods to get at the most common tasks when interacting with the API | ||
@@ -183,3 +182,3 @@ - [Lookup a Postcode](#lookup-a-postcode) | ||
#### Resource Methods | ||
#### Resources | ||
@@ -211,5 +210,6 @@ Resources defined in [the API documentation](https://ideal-postcodes.co.uk/documentation) are exposed on the client. Each resource exposes a method (`#retrieve`, `#list`, etc) which maps to a resource action. | ||
``` | ||
#### List | ||
Reqesting a resource endpoint (e.g. an address query to `/addresses`) maps to the `#list` method. | ||
Requesting a resource endpoint (e.g. an address query to `/addresses`) maps to the `#list` method. | ||
@@ -233,3 +233,3 @@ ```javascript | ||
Some endpoints are defined as custom actions. E.g. `/keys/:key/usage`. These can be invoked using the name of the custom action. | ||
Some endpoints are defined as custom actions, e.g. `/keys/:key/usage`. These can be invoked using the name of the custom action. | ||
@@ -277,8 +277,7 @@ E.g. for [key usage data extraction](https://ideal-postcodes.co.uk/documentation/keys#usage) | ||
[See Postcode resource API documentation](https://ideal-postcodes.co.uk/documentation/postcodes) | ||
[See postcode resource API documentation](https://ideal-postcodes.co.uk/documentation/postcodes) | ||
#### Addresses | ||
Search for an address. | ||
Search for an address | ||
@@ -302,3 +301,3 @@ ```javascript | ||
Autocomplete an address given an address partial. | ||
Autocomplete an address given an address partial | ||
@@ -338,3 +337,3 @@ ```javascript | ||
Retrieve a multiple residence premise given a UMPRN. | ||
Retrieve a multiple residence premise given a UMPRN | ||
@@ -355,3 +354,3 @@ ```javascript | ||
Find out if a key is available. | ||
Find out if a key is available | ||
@@ -365,3 +364,3 @@ ```javascript | ||
Get private information on key (requires user_token). | ||
Get private information on key (requires user_token) | ||
@@ -378,3 +377,3 @@ ```javascript | ||
Get key usage data. | ||
Get key usage data | ||
@@ -424,3 +423,3 @@ ```javascript | ||
if (error instanceof IdpcRequestFailedError) { | ||
// IdpcRequestFailedError indicates a 402 response code | ||
// IdpcRequestFailedError indicates a 402 response code | ||
// Possibly the key balance has been depleted | ||
@@ -468,11 +467,12 @@ } | ||
All errors inherit from Javascript's `Error` prototype. | ||
All errors inherit from JavaScript's `Error` prototype. | ||
Errors are grouped by HTTP status code classes. | ||
Specific errors may be supplied for the following reasons: | ||
Specific errors may be supplied for the following reasons: | ||
- Convenience: They are frequently tested for (e.g. invalid postcode, postcode not found) | ||
- Deverloper QoL. They are useful for debug purposes during the implementation stages | ||
- Developer QoL. They are useful for debug purposes during the implementation stages | ||
``` | ||
```javascript | ||
Prototype Chain | ||
@@ -498,3 +498,2 @@ | ||
|- IdpcServerError # 500 Errors | ||
``` | ||
@@ -518,3 +517,3 @@ | ||
// Handle the error | ||
if (error instanceof IdpcPostcodeNotFoundError) ... | ||
if (error instanceof IdpcPostcodeNotFoundError) {...} | ||
``` | ||
@@ -528,4 +527,4 @@ | ||
## License | ||
## Licence | ||
MIT |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
89566
1672
39
511