@financial-times/n-lists-client
TypeScript icon, indicating that this package has built-in type declarations

8.0.0 • Public • Published

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"],
});

Readme

Keywords

none

Package Sidebar

Install

npm i @financial-times/n-lists-client

Weekly Downloads

7

Version

8.0.0

License

none

Unpacked Size

520 kB

Total Files

17

Last publish

Collaborators

  • robertboulton
  • seraph2000
  • hamza.samih
  • notlee
  • emmalewis
  • aendra
  • the-ft
  • rowanmanning
  • chee
  • alexwilson