0.0.3 • Published 3 years ago

@gustavoedny/matchbook-js v0.0.3

Weekly downloads
1
License
MIT
Repository
github
Last release
3 years ago

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))

This package is under development. If you want to help pull requests are welcome :)

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago