# nandos

> Server-side JS library for the Nando's API

Latest version **0.1.0** (published 2016-07-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install nandos
pnpm add nandos
yarn add nandos
bun add nandos
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2016-07-31 |
| First published | 2016-07-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | James Billingham |
| Maintainers | cuvva-old |
| Keywords | nando, nando's, nandos, cheeky, chicken, peri, food, library, sdk, client, api |

## Links

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

## Dependencies (3)

- [request](https://npm.io/package/request.md) ^2.74.0
- [babel-runtime](https://npm.io/package/babel-runtime.md) ^6.11.6
- [request-promise-any](https://npm.io/package/request-promise-any.md) ^1.0.2

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2016-07-31

## README

# nandos-node

Server-side JS library for the Nando's API. It is not publicly documented, so
may break at any time.

```js
import * as Nandos from 'nandos';

const client = new Nandos.Loyalty({
	clientKeyId: 'some_key_here', // ~30 characters
	clientKeySecret: 'some_key_here', // ~10 characters
	userEmail: 'foobar@example.com',
	userPassword: 'SoSecure0mg!',
});

const account = await client.getAccount();
const rewards = await client.getRewards(account.cardNumber);
const transactions = await client.getTransactions(account.cardNumber);

console.log(account.phoneNumber); // => 07123456789
console.log(account.card_lost); // => false
console.log(rewards.wheel_position); // => 3
console.log(rewards.lifetime_chillies); // => 13
console.log(transactions[0].store); // => Whitechapel
console.log(transactions[0].credit); // => 1
```

## Installation

```bash
$ npm install --save nandos
```

## API

All async methods return promises. Traditional Node callbacks are not supported.

Currently, only the Nando's loyalty program is supported (the reward card).

### `Loyalty`

#### `Loyalty#constructor(options)`

First, set up a client by creating an instance of `Loyalty`.

Options:

- `clientKeyId` - the key which is sent to the API as-is
- `clientKeySecret` - the key used to create the HMAC digest sent to the API
- `userEmail` - the user's email address for login
- `userPassword` - the user's password for login

```js
const client = new Loyalty({
	clientKeyId: 'some_key_here', // ~30 characters
	clientKeySecret: 'some_key_here', // ~10 characters
	userEmail: 'foobar@example.com',
	userPassword: 'SoSecure0mg!',
});
```

#### `Loyalty#getAccount()`

Verify the user's login details and retrieve their account details (including
card number).

```js
await client.getAccount();
```

#### `Loyalty#getRewards(cardNumber)`

Retrieve the card's rewards status - the number of 'chillies' they have, and the
number of green/mild, orange/med and red/hot rewards they have.

```js
await client.getRewards('12341234123412');
```

#### `Loyalty#getTransactions(cardNumber)`

Retrieve the card's historical transactions, including rewards provided from
each visit.

```js
await client.getTransactions('12341234123412');
```

## Notes

- data is provided back from the Nando's API exactly as-is - as such, many keys/values are quite inconsistent and unpredictable

## Support

Please open an issue on this repository.

## Authors

- James Billingham <james@jamesbillingham.com>

## License

MIT licensed - see [LICENSE](LICENSE) file

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