UNPKG

@stylusapparel/stylusop-api-node-wrapper

Version:

This is the official NodeJs wrapper for connecting to the StylusOP API

22 lines (19 loc) 555 B
'use strict'; const __auth = require('./lib/auth'); const __order = require('./order'); const __products = require('./products'); module.exports.createClient = (_token, _config = {}) => { const _auth = __auth(_token, _config); const __this = { /** * Check if the provided token is expired * @returns Promise */ isTokenValid: () => _auth._verify().then(() => _auth._isTokenValid()), orders: __order(_auth, _token, _config), products: __products(_auth, _token, _config), _config, _token, }; return __this; };