@gustavoedny/matchbook-js
v0.0.3
Published
A API wrapper for the matchbook.com RESTful API service written in Javascript
Downloads
7
Readme
matchbook-js
An API wrapper for the matchbook.com RESTful API service written in Javascript
How to install
npm i @gustavoedny/matchbook-js
or using yarn
yarn add @gustavoedny/matchbook-js
Usage
How to Login
const { Auth } = require('@gustavoedny/matchbook-js')
const AuthService = Auth.factory()
let token = null
AuthService.login('username', 'password')
.then(({ data }) => token = data['session-token'])
How to define the token to be used at all requests
const { Auth } = require('@gustavoedny/matchbook-js')
// You can pass the token to the constructor
const AuthService = Auth.factory('a_valid_token')
// Or always when you want using the setToken method available
// at all the modules: Auth, Account, Events, etc...
AuthService.setToken('another valid token')
// You can also call the endpoint you need after set the token
AuthService.setToken('another valid token')
.getSession()
.then(res => console.log(res))