README
Koban | Node API Library
API SDK for Koban CRM
Installation
with yarn
yarn add @koban-crm/api-library
with npm
npm install @koban-crm/api-library
Initialize
with import
import { KobanSDK } from '@koban-crm/api-library';
const optionsSDK = {
kobanInstance: 'http://instance.koban/',
token: 'TokenXXX',
user: 'UserKeyXXX',
};
const skdKoban = new KobanSDK(optionsSDK);
with require
const kobanApi = require('@koban-crm/api-library');
/**
* Can also be used wwith named export like
* const { KobanSDK } = require('@koban-crm/api-library');
*/
const optionsSDK = {
kobanInstance: 'http://instance.koban/',
token: 'TokenXXX',
user: 'UserKeyXXX',
};
const skdKoban = new kobanApi.KobanSDK(optionsSDK);
Usage
with async/await
// Get Koban Invoice
let invoice = await skdKoban.invoiceService.getOne('InvoiceIdXXX');
with callback
// Get Koban Invoice
let invoice = skdKoban.invoiceService.getOne('InvoiceIdXXX')
.then(function(data) {
return data;
}).catch(function(err) {
console.log(err);
});
Full Documentation here