# @indigov/flags-api

> Strongly typed React/Node client for the Flags service

Latest version **0.0.22** (published 2022-05-20) · ISC license · 0 weekly downloads

## Install

```sh
npm install @indigov/flags-api
pnpm add @indigov/flags-api
yarn add @indigov/flags-api
bun add @indigov/flags-api
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.22 |
| Published | 2022-05-20 |
| First published | 2022-04-06 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=16.13.1 |
| Dependencies | 1 |
| Unpacked size | 13.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | faizan@indigov.com |
| Maintainers | indigovadmin, emberrandall, derjacques, youngkwangk, e10jc, faizan-ali, iandigov, bjacobso-indigov, u373, rmbh4211995, toddglover, roilan, josephemswiler, ishwaryav |

## Links

- npm: https://www.npmjs.com/package/@indigov/flags-api
- npm.io page: https://npm.io/package/@indigov/flags-api

## Dependencies (1)

- [cross-fetch](https://npm.io/package/cross-fetch.md) ^3.1.5

## Recent versions

- 0.0.22 (latest) — 2022-05-20
- 0.0.21 — 2022-05-20
- 0.0.20 — 2022-05-20
- 0.0.18 — 2022-05-20
- 0.0.17 — 2022-05-20
- 0.0.16 — 2022-05-20
- 0.0.15 — 2022-05-19
- 0.0.13 — 2022-04-15
- 0.0.12 — 2022-04-15
- 0.0.11 — 2022-04-15
- 0.0.10 — 2022-04-06
- 0.0.9 — 2022-04-06
- 0.0.8 — 2022-04-06
- 0.0.7 — 2022-04-06
- 0.0.6 — 2022-04-06
- … 5 more at https://npm.io/package/@indigov/flags-api/versions

## README

# F.L.A.G.S. API Client

Cross-platform Typescript SDK for the [Flags](https://github.com/indigov-us/flags) service.

## Usage

### Installation
yarn:
```shell
yarn add @indigov/flags-api
```

### Instantiation
```ts
import Flags from '@indigov/flags-api'

const flags = new Flags('API_TOKEN', 'OFFICE_NAME', 'SOURCE_OF_REQUEST')
// e.g. 
flags = new Flags('435234sdfgswdasdf', 'indigovstaging', 'northstar')
```

### Making requests
The SDK exposes 3 endpoints - documentation is in source code:
1. getFlag
2. getFlagValue
3. getFlags

```ts
// Uses office supplied in instanttiation
flags.getFlag('bulkapi:flags:minifiedhtmlenabled').then(console.log)
// Uses supplied office AND cohort
flags.getFlag('bulkapi:flags:minifiedhtmlenabled', { cohort: 'tests' }).then(console.log)
// Fetching raw flag value
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.

```sh
yarn test
```

## Publishing
Run:
```shell
yarn publish
```
And pick a sensible SemVer.

Note: You must be logged into `npm` through the CLI and part of the Indigov org.

---
_Source: https://npm.io/package/@indigov/flags-api · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
