8.0.0 • Published 3 months ago

@financial-times/n-lists-client v8.0.0

Weekly downloads
115
License
-
Repository
github
Last release
3 months ago

n-lists-client

CircleCI Coveralls Coverage NPM version

A very thin wrapper around the Content API and n-es-client to search and retrieve content from lists in a simple, DRY manner.

const lists = require('@financial-times/n-lists-client');

lists.get('520ddb76-e43d-11e4-9e89-00144feab7de').then((data) => { … });

Installation

# install from NPM
$ npm i -S @financial-times/n-lists-client

# add Content API key
export API_KEY=123

# add Elasticsearch read AWS access key
export ES_AWS_ACCESS_KEY=456

# add Elasticsearch read AWS secret access key
export ES_AWS_SECRET_ACCESS_KEY=789

Usage

All methods return a promise. If a request errors then it will be rejected with an appropriate HTTP error.

All methods have an optional options argument that accepts a hash of option properties. Current options are:

  • fields - an array of fields to fetch from Elasticsearch.

All methods have an optional final timeout argument that defaults to 3 seconds.

.get(listID[, options][, timeout])

Get a list by list ID (which must be a valid UUID.)

Example

lists.get("520ddb76-e43d-11e4-9e89-00144feab7de", {
  fields: ["id", "title"],
});

.for(listType, conceptID[, options][, timeout])

Get a curated list for a concept. Must be a known list type.

lists.for("TopStories", "c91b1fad-1097-468b-be82-9a8ff717d54c", {
  fields: ["id", "title"],
});
8.0.1-alpha.0

3 months ago

8.0.0

10 months ago

7.0.0

10 months ago

6.0.0

11 months ago

5.1.0

2 years ago

5.0.0

2 years ago

4.1.0

3 years ago

4.0.0

3 years ago

3.0.0

3 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

1.0.0-beta.1

6 years ago