1.0.8 • Published 7 years ago

bankson-js v1.0.8

Weekly downloads
7
License
MIT
Repository
github
Last release
7 years ago

Bankson.fi Node.JS client

API documentation: Official bankson.fi documentation

Installation

npm install --save bankson-js

Usage

import Client from 'bankson-js';
var client = new Client({
  bearerToken: bearerTokenObtainedWithOAuth2
});

client.me().then(resp => {
  console.log('Current user', resp.user);
});

Dynamic bearer token

Because of the expiring nature of bearer tokens you can validate and refresh them before every request by providing a beforeRequest function that returns a promise:

import Client from 'bankson-js';
var client = new Client({
  beforeRequest: () => {
    return refreshMyToken().then(token => {
      return {
        bearerToken: token
      };
    });
  }
});

Test mode

To support API requests in test mode, you can either specify test: true in the constructor options or return test: true in the promised value in beforeRequest.

License

MIT License

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago