# @followprice/api-client

> The javascript API client for the Followprice API

Latest version **2.0.6** (published 2017-06-17) · ISC license · 0 weekly downloads

## Install

```sh
npm install @followprice/api-client
pnpm add @followprice/api-client
yarn add @followprice/api-client
bun add @followprice/api-client
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.6 |
| Published | 2017-06-17 |
| First published | 2017-06-17 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | 8.0.0 |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Joao Andrade |
| Maintainers | joaosa, followprice-dev |

## Links

- npm: https://www.npmjs.com/package/@followprice/api-client
- Repository: https://github.com/Followprice/api-client
- Homepage: https://github.com/Followprice/api-client#readme
- Issues: https://github.com/Followprice/api-client/issues
- npm.io page: https://npm.io/package/@followprice/api-client

## Dependencies (3)

- [node-uuid](https://npm.io/package/node-uuid.md) ^1.4.7
- [localforage](https://npm.io/package/localforage.md) ^1.4.2
- [fingerprintjs2](https://npm.io/package/fingerprintjs2.md) ^1.4.1

## Recent versions

- 2.0.6 (latest) — 2017-06-17
- 2.0.5 — 2017-06-17

## README

# API client

## Requirements

1. It should authenticate a user through an OAuth2 password grant type and receive an `access_token`.

2. Store the `access_token` internally.

3. It should let that user request data to API endpoints with that `access_token`.

## How to develop?

1. Install [git-flow][git-flow]

2. Code according to it

    * Commit bug fixes to the development branch

    * `git flow feature start <name>` to start a new feature

## Run the project

1. `npm start`

    * code changes will be automatically reloaded on the browser

## Authenticate

* on your browser console

    ```
    var API = require('followprice-api-client');
    var api = new API('scope', 'hostname', 'port');

    // only if using a private client
    api.setClient('client_id', 'client_secret');

    api.authenticate('user', 'password', err => {
      if (err) { /* handle error */ }

      // you're authenticated here
    })
    ```

    * `client_id` should be the client's id

        * e.g. test

    * `client_secret` should be the client's secret

        * it has no authentication value, as the client runs on the user-agent and is, as such, public

        * e.g. test

    * `scope` should be scope the user wants to request

    * `hostname` is optional, as it defaults to `api.followprice.co`

    * `port` is optional, as it defaults to `443`

    * `user` should be the user's `username`

    * `password` should the user's `password`

## Make API calls

* on your browser console

    ```
    // your callback should follow the format (err, statusCode, data) => { ... }
    api.get('/users', null, callback);
    ```

[git-flow]: https://github.com/nvie/gitflow

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