# nimbu-client

> A thin wrapper for the Nimbu API

Latest version **3.1.1** (published 2022-04-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install nimbu-client
pnpm add nimbu-client
yarn add nimbu-client
bun add nimbu-client
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.1.1 |
| Published | 2022-04-26 |
| First published | 2019-02-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >= 12.22 |
| Dependencies | 3 |
| Unpacked size | 21.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Peter Dedene |
| Maintainers | dedene |
| Keywords | nimbu |

## Links

- npm: https://www.npmjs.com/package/nimbu-client
- Repository: https://github.com/nimbu/node-nimbu-client
- Issues: https://github.com/nimbu/node-nimbu-client/issues
- npm.io page: https://npm.io/package/nimbu-client

## Dependencies (3)

- [tslib](https://npm.io/package/tslib.md) ^2.4.0
- [tunnel-agent](https://npm.io/package/tunnel-agent.md) ^0.6.0
- [is-retry-allowed](https://npm.io/package/is-retry-allowed.md) ^1.1.0

## Recent versions

- 3.1.1 (latest) — 2022-04-26
- 3.0.5 — 2021-10-12
- 3.0.4 — 2021-10-11
- 3.0.3 — 2021-10-11
- 3.0.2 — 2021-10-11
- 3.0.1 — 2021-10-11
- 3.0.0 — 2021-10-11
- 2.0.0 — 2020-10-23
- 1.0.7 — 2020-10-22
- 1.0.6 — 2020-09-21
- 1.0.5 — 2019-07-29
- 1.0.4 — 2019-07-24
- 1.0.3 — 2019-07-24
- 1.0.2 — 2019-07-12
- 1.0.1 — 2019-03-01
- … 1 more at https://npm.io/package/nimbu-client/versions

## README

# nimbu-client

![Build Status](https://github.com/nimbu/node-nimbu-client/actions/workflows/ci.yaml/badge.svg)
[![codecov](https://codecov.io/gh/nimbu/node-nimbu-client/branch/master/graph/badge.svg)](https://codecov.io/gh/nimbu/node-nimbu-client)
  
A thin wrapper around the [Nimbu](https://www.nimbu.io) API.

- [nimbu-client](#nimbu-client)
  - [Install](#install)
  - [Usage](#usage)
    - [HTTP Proxies](#http-proxies)
    - [Running tests](#running-tests)

## Install

```sh
$ npm install nimbu-client --save
```

## Usage

To begin, require the Nimbu module and create the client, passing in an API
token:

```javascript
const Nimbu = require('nimbu-client').default;
const nimbu = new Nimbu({ token: apiToken });
```

Or in Typescript:

```typescript
import Nimbu from 'nimbu-client';
const nimbu = new Nimbu({ token: apiToken });
```

If a customer session token is needed, you can pass this too:

```javascript
const nimbu = new Nimbu({ token: apiToken, sessionToken: sessionToken });
```

nimbu-client has `get`, `post`, `patch`, and `delete` functions which can make
requests with the specified HTTP method to any endpoint:

```javascript
// GET requests
nimbu.get('/channels').then(channels => {
  // do something with channel info
});

// POST requests with body
nimbu.post('/channels', { body: { name: 'foo' } }).then(channel => {});

// PATCH requests with body
nimbu.patch('/channels/foo', { body: { name: 'bar' } }).then(channel => {});

// DELETE requests
nimbu.delete('/channels/bar').then(channel => {});
```

There is also an even more generic `request` function that can accept many more
options:

```javascript
nimbu
  .request({
    method: 'GET',
    path: '/channels',
    parseJSON: false,
  })
  .then(response => {});
```

### HTTP Proxies

If you'd like to make requests through an HTTP proxy, set the
`NIMBU_HTTP_PROXY_HOST` environment variable with your proxy host, and
`NIMBU_HTTP_PROXY_PORT` with the desired port (defaults to 8080). nimbu-client
will then make requests through this proxy instead of directly to
api.nimbu.io.

### Running tests

nimbu-client uses [ava](https://github.com/avajs/ava) for tests:

```bash
$ npm test
```

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