mono-api
v1.0.2
Published
Mono API? Mono
Downloads
37
Maintainers
Readme
MonoAPI
Token Creation
To create MonoAPI token you need to visit Official MonoAPI page and create your token.
Install
| Package Manager | Script | | :-------------: | :---------------------: | | NPM | npm i mono-api | | YARN | yarn add npm i mono-api | | PNPM | pnpm add mono-api |
Examples
JavaScript/TypeScript:
const monoAPI = new MonoAPI('<your-token>');
const clientInfo = await monoAPI.fetchClientInfo();
const today = new Date();
const oneWeekAgo = new Date(today);
oneWeekAgo.setDate(oneWeekAgo.getDate() - 7);
const statements = await monoAPI.fetchStatements({
from: oneWeekAgo,
to: today,
});
Documentation
Fetch Client Information
import { MonoAPI, MonobankClientInfo } from 'mono-api';
const monoAPI = new MonoAPI('<your-token>');
const clientInfo: MonobankClientInfo = await monoAPI.fetchClientInfo();
console.log('ClientInfo: ', clientInfo);
Fetch Statements
import { MonoAPI, MonobankStatements } from 'mono-api';
const monoAPI = new MonoAPI('<your-token>');
const today = new Date();
const oneWeekAgo = new Date(today);
oneWeekAgo.setDate(oneWeekAgo.getDate() - 7);
const statements: MonobankStatements = await monoAPI.fetchStatements({
account: '0' // Or id of acccount
from: oneWeekAgo,
to: today
});
console.log('Statements: ', statements);
Fetch Currencies
import { MonoAPI, MonobankCurrencies } from 'mono-api';
const monoAPI = new MonoAPI(''); // For this method API Token can be omitted
const currencies: MonobankCurrencies = await monoAPI.fetchCurrencies();
console.log('Currencies: ', currencies);
Suggestion
If you want to offer me to add new methods to this API, feel free to create an issue.