F.L.A.G.S. API Client
Cross-platform Typescript SDK for the Flags service.
Usage
Installation
yarn:
yarn add @indigov/flags-api
Instantiation
import Flags from '@indigov/flags-api'
const flags = new Flags('API_TOKEN', 'OFFICE_NAME', 'SOURCE_OF_REQUEST')
flags = new Flags('435234sdfgswdasdf', 'indigovstaging', 'northstar')
Making requests
The SDK exposes 3 endpoints - documentation is in source code:
- getFlag
- getFlagValue
- getFlags
flags.getFlag('bulkapi:flags:minifiedhtmlenabled').then(console.log)
flags.getFlag('bulkapi:flags:minifiedhtmlenabled', { cohort: 'tests' }).then(console.log)
flags.getFlagValue('bulkapi:flags:minifiedhtmlenabled').then(console.log)
Local Development
TODO
Testing
Tests are run using jest
backed by ts-jest
to avoid the need for transpilation.
yarn test
Publishing
Run:
yarn publish
And pick a sensible SemVer.
Note: You must be logged into npm
through the CLI and part of the Indigov org.