https://github.com/oknehsorod/mono-api
https://github.com/oknehsorod/mono-api
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/oknehsorod/mono-api
- Owner: Oknehsorod
- Created: 2024-05-19T11:54:51.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-20T03:52:10.000Z (over 1 year ago)
- Last Synced: 2025-03-06T05:37:57.472Z (7 months ago)
- Language: TypeScript
- Size: 42 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MonoAPI
![]()
This is typed and tested wrapper for MonoAPI by Monobank
## Token Creation
To create MonoAPI token you need to visit Official [MonoAPI](https://api.monobank.ua/index.html '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:**
```javascript
const monoAPI = new MonoAPI('');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**
```typescript
import { MonoAPI, MonobankClientInfo } from 'mono-api';const monoAPI = new MonoAPI('');
const clientInfo: MonobankClientInfo = await monoAPI.fetchClientInfo();
console.log('ClientInfo: ', clientInfo);
```**Fetch Statements**
```typescript
import { MonoAPI, MonobankStatements } from 'mono-api';const monoAPI = new MonoAPI('');
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**
```typescript
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.