Koibanx Budget Manager SDK
Budget Manager SDK based in module Budget Manager
This module allows to create budgets and trace its usage with a ledger. Each budget can be incremented by using the master account´s balance, wich is provided by an external supplier. In order to make use of a budget, a budget allowance is needed.
SDK Documentation
Feast yourself
Installation
npm install @koibanx/budgetmanager-sdk
NOTE: you must have the npm token in your .npmrc file
Initialization
Node
Using ES6 import
import BudgetManagerSdk from '@koibanx/budgetmanager-sdk';
const budgetManager = BudgetManagerSdk({
baseURL: 'http://your-url',
});
With require
exports.__esModule = true;
const BudgetManagerSdk = require('@koibanx/budgetmanager-sdk')["default"];
const budgetManager = BudgetManagerSdk({
baseURL: 'http://your-url',
});
Types
- Typescript (
@koibanx/budgetmanager-sdk/dist/index.d.ts
)
Examples
Using ES6 import
import budgetManagerSdk from "@koibanx/budgetmanager-sdk";
const budgetManager = BudgetManagerSdk({
baseURL: 'http://your-url',
})
const catchError = (err, modulo) => {
console.log('Modulo: ', modulo);
console.log('details: ', err.details);
console.log('shortMessage: ', err.message);
console.log('errorCode: ', err.code);
}
budgetManager.createBudget({
description: 'Test',
}).then((data) => {
console.log(data);
});
budgetManager.updateBudget({
id: '62e308939a17bf22cf8a42f1',
description: 'Test2',
}).then((data) => {
console.log(data);
});
budgetManager.allowance.listAllowances({
limit: 2,
budget: '62e2c2339a17bf22cf8a42ea',
deleted: true,
description: 'Testing3',
page: 1,
search: 'Testing',
sort: '-description',
}).then((data) => console.log(data.results[0]._id));
budgetManager.transaction.getTransaction({
id: '62e9c4ce370cfe3b812201a6',
}).then((res) => {
console.log(res.amount);
}).catch((e) => catchError(e, 'getTransaction'));