moneyhub / moneyhub-api-client

Node.JS Client for the Moneyhub API
10 stars 7 forks source link

Allow for headers or token to be passed into methods #64

Closed gillyhl closed 1 year ago

gillyhl commented 1 year ago

This rather large looking PR adds an extra options argument to all authenticated methods in the library. The argument is an object with the following properties:

{
  token: "full.access.token" // if specified will be added to authorisation header of request
  headers: {
    Authorization: "Bearer full.access.token" // can be used to specify authorisation header or additional headers
  }
}

Tests are added to verify that the extra options behave as expected.

This could possibly be published as a minor semver update as the extra argument is optional, any install of this code will have no effect on existing users.