Skip to content

Commit 153f41f

Browse files
Add personal API
1 parent a5a4ff7 commit 153f41f

5 files changed

Lines changed: 716 additions & 8 deletions

File tree

examples/personal.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { createClientMonoPersonal } from '../lib';
2+
3+
const client = createClientMonoPersonal();
4+
5+
const { data, response } = await client.GET('/bank/currency');
6+
console.log(data, response.status, response.statusText);

generated/personal.d.ts

Lines changed: 346 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,346 @@
1+
/**
2+
* This file was auto-generated by openapi-typescript.
3+
* Do not make direct changes to the file.
4+
*/
5+
6+
7+
export interface paths {
8+
"/bank/currency": {
9+
/**
10+
* Отримання курсів валют
11+
* @description Отримати базовий перелік курсів валют monobank. Інформація кешується та оновлюється не частіше 1 разу на 5 хвилин.
12+
*/
13+
get: {
14+
responses: {
15+
/** @description Інформація про курс валют */
16+
200: {
17+
content: {
18+
"application/json": components["schemas"]["CurrencyInfo"];
19+
};
20+
};
21+
};
22+
};
23+
};
24+
"/personal/client-info": {
25+
/**
26+
* Інформація про клієнта
27+
* @description Отримання інформації про клієнта та переліку його рахунків. Обмеження на використання функції не частіше ніж 1 раз у 60 секунд.
28+
*/
29+
get: {
30+
parameters: {
31+
header: {
32+
/**
33+
* @description Token для особистого доступу до API
34+
* @example u3AulkpZFI1lIuGsik6vuPsVWqN7GoWs6o_MO2sdf301
35+
*/
36+
"X-Token": string;
37+
};
38+
};
39+
responses: {
40+
/** @description Statement list */
41+
200: {
42+
content: {
43+
"application/json": components["schemas"]["UserInfo"];
44+
};
45+
};
46+
};
47+
};
48+
};
49+
"/personal/webhook": {
50+
/**
51+
* Встановлення WebHook
52+
* @description Встановлення URL користувача:
53+
* - Для підтвердження коректності наданої адреси, на неї надсилається GET-запит. Сервер має відповісти строго HTTP статус-кодом 200, і ніяким іншим. Якщо валідацію пройдено, на задану адресу починають надсилатися POST запити з подіями.
54+
* - Події надсилаються у наступному вигляді: POST запит на задану адресу у форматі `{type:"StatementItem", data:{account:"...", statementItem:{#StatementItem}}}`. Якщо сервіс користувача не відповість протягом 5с на команду, сервіс повторить спробу ще через 60 та 600 секунд. Якщо на третью спробу відповідь отримана не буде, функція буде вимкнута. Відповідь сервера має строго містити HTTP статус-код 200.
55+
*/
56+
post: {
57+
parameters: {
58+
header: {
59+
/** @description Token для особистого доступу до API */
60+
"X-Token": string;
61+
};
62+
};
63+
/** @description Optional description in *Markdown* */
64+
requestBody: {
65+
content: {
66+
"application/json": components["schemas"]["SetWebHook"];
67+
};
68+
};
69+
responses: {
70+
/** @description ok */
71+
200: {
72+
content: never;
73+
};
74+
};
75+
};
76+
};
77+
"/personal/statement/{account}/{from}/{to}": {
78+
/**
79+
* Виписка
80+
* @description Отримання виписки за час від {from} до {to} часу в секундах в форматі Unix time Максимальний час за який можливо отримувати виписку 31 доба + 1 година (2682000 секунд) Обмеження на використання функції не частіше ніж 1 раз у 60 секунд.
81+
*/
82+
get: {
83+
parameters: {
84+
header: {
85+
/** @description Token для особистого доступу до API */
86+
"X-Token": string;
87+
};
88+
path: {
89+
/** @description Ідентифікатор рахунку з переліку Statement list або 0 - дефолтний рахунок. */
90+
account: string;
91+
/**
92+
* @description Початок часу виписки.
93+
* @example 1546304461
94+
*/
95+
from: string;
96+
/**
97+
* @description Останній час виписки (якщо відсутній, буде використовуватись поточний час).
98+
* @example 1546306461
99+
*/
100+
to: string;
101+
};
102+
};
103+
responses: {
104+
/** @description Statement list */
105+
200: {
106+
content: {
107+
"application/json": components["schemas"]["StatementItems"];
108+
};
109+
};
110+
};
111+
};
112+
};
113+
}
114+
115+
export type webhooks = Record<string, never>;
116+
117+
export interface components {
118+
schemas: {
119+
/** @description URL для надсиляння подій по зміні балансу рахунку */
120+
SetWebHook: {
121+
/** @example https://mysomesite.copm/some_random_data_for_security */
122+
webHookUrl?: string;
123+
};
124+
/** @description Опис клієнта та його рахунків. */
125+
UserInfo: {
126+
/**
127+
* @description Ідентифікатор клієнта (зівпадає з id для send.monobank.ua)
128+
* @example 3MSaMMtczs
129+
*/
130+
clientId?: string;
131+
/**
132+
* @description Ім'я клієнта
133+
* @example Мазепа Іван
134+
*/
135+
name?: string;
136+
/**
137+
* @description URL для надсиляння подій по зміні балансу рахунку
138+
* @example https://mysomesite.copm/some_random_data_for_security
139+
*/
140+
webHookUrl?: string;
141+
/**
142+
* @description Перелік прав, які які надає сервіс (1 літера на 1 permission).
143+
* @example psf
144+
*/
145+
permissions?: string;
146+
/** @description Перелік доступних рахунків */
147+
accounts?: ({
148+
/**
149+
* @description Ідентифікатор рахунку
150+
* @example kKGVoZuHWzqVoZuH
151+
*/
152+
id?: string;
153+
/**
154+
* @description Ідентифікатор для сервісу https://send.monobank.ua/{sendId}
155+
* @example uHWzqVoZuH
156+
*/
157+
sendId?: string;
158+
/**
159+
* Format: int64
160+
* @description Баланс рахунку в мінімальних одиницях валюти (копійках, центах)
161+
* @example 10000000
162+
*/
163+
balance?: number;
164+
/**
165+
* Format: int64
166+
* @description Кредитний ліміт
167+
* @example 10000000
168+
*/
169+
creditLimit?: number;
170+
/**
171+
* @description Тип рахунку
172+
* @example black
173+
* @enum {string}
174+
*/
175+
type?: "black" | "white" | "platinum" | "iron" | "fop" | "yellow" | "eAid";
176+
/**
177+
* Format: int32
178+
* @description Код валюти рахунку відповідно ISO 4217
179+
* @example 980
180+
*/
181+
currencyCode?: number;
182+
/**
183+
* @description Тип кешбеку який нараховується на рахунок
184+
* @example UAH
185+
* @enum {string}
186+
*/
187+
cashbackType?: "None" | "UAH" | "Miles";
188+
/**
189+
* @description Перелік замаскованних номерів карт (більше одного може бути у преміальних карт)
190+
* @example [
191+
* "537541******1234"
192+
* ]
193+
*/
194+
maskedPan?: unknown[];
195+
/**
196+
* @description IBAN рахунку
197+
* @example UA733220010000026201234567890
198+
*/
199+
iban?: string;
200+
})[];
201+
};
202+
/** @description Перелік транзакцій за вказанний час */
203+
StatementItems: {
204+
/**
205+
* @description Унікальний id транзакції
206+
* @example ZuHWzqkKGVo=
207+
*/
208+
id?: string;
209+
/**
210+
* Format: int64
211+
* @description Час транзакції в секундах в форматі Unix time
212+
* @example 1554466347
213+
*/
214+
time?: number;
215+
/**
216+
* @description Опис транзакцій
217+
* @example Покупка щастя
218+
*/
219+
description?: string;
220+
/**
221+
* Format: int32
222+
* @description Код типу транзакції (Merchant Category Code), відповідно ISO 18245
223+
* @example 7997
224+
*/
225+
mcc?: number;
226+
/**
227+
* Format: int32
228+
* @description Оригінальний код типу транзакції (Merchant Category Code), відповідно ISO 18245
229+
* @example 7997
230+
*/
231+
originalMcc?: number;
232+
/**
233+
* @description Статус блокування суми (детальніше у [wiki](https://en.wikipedia.org/wiki/Authorization_hold))
234+
* @example false
235+
*/
236+
hold?: boolean;
237+
/**
238+
* Format: int64
239+
* @description Сума у валюті рахунку в мінімальних одиницях валюти (копійках, центах)
240+
* @example -95000
241+
*/
242+
amount?: number;
243+
/**
244+
* Format: int64
245+
* @description Сума у валюті транзакції в мінімальних одиницях валюти (копійках, центах)
246+
* @example -95000
247+
*/
248+
operationAmount?: number;
249+
/**
250+
* Format: int32
251+
* @description Код валюти рахунку відповідно ISO 4217
252+
* @example 980
253+
*/
254+
currencyCode?: number;
255+
/**
256+
* Format: int64
257+
* @description Розмір комісії в мінімальних одиницях валюти (копійках, центах)
258+
* @example 0
259+
*/
260+
commissionRate?: number;
261+
/**
262+
* Format: int64
263+
* @description Розмір кешбеку в мінімальних одиницях валюти (копійках, центах)
264+
* @example 19000
265+
*/
266+
cashbackAmount?: number;
267+
/**
268+
* Format: int64
269+
* @description Баланс рахунку в мінімальних одиницях валюти (копійках, центах)
270+
* @example 10050000
271+
*/
272+
balance?: number;
273+
/**
274+
* @description Коментар до переказу, уведений користувачем. Якщо не вказаний, поле буде відсутнім
275+
* @example За каву
276+
*/
277+
comment?: string;
278+
/**
279+
* @description Номер квитанции для check.gov.ua. Поле може бути відсутнім
280+
* @example XXXX-XXXX-XXXX-XXXX
281+
*/
282+
receiptId?: string;
283+
/**
284+
* @description ЄДРПОУ контрагента, присутній лише для елементів виписки рахунків ФОП
285+
* @example 3096889974
286+
*/
287+
counterEdrpou?: string;
288+
/**
289+
* @description IBAN контрагента, присутній лише для елементів виписки рахунків ФОП
290+
* @example UA898999980000355639201001404
291+
*/
292+
counterIban?: string;
293+
}[];
294+
/** @description Перелік курсів. Кожна валютна пара може мати одне і більше полів з rateSell, rateBuy, rateCross. */
295+
CurrencyInfo: {
296+
/**
297+
* Format: int32
298+
* @description Код валюти рахунку відповідно ISO 4217
299+
* @example 840
300+
*/
301+
currencyCodeA?: number;
302+
/**
303+
* Format: int32
304+
* @description Код валюти рахунку відповідно ISO 4217
305+
* @example 980
306+
*/
307+
currencyCodeB?: number;
308+
/**
309+
* Format: int64
310+
* @description Час курсу в секундах в форматі Unix time
311+
* @example 1552392228
312+
*/
313+
date?: number;
314+
/**
315+
* Format: float
316+
* @example 27
317+
*/
318+
rateSell?: number;
319+
/**
320+
* Format: float
321+
* @example 27.2
322+
*/
323+
rateBuy?: number;
324+
/**
325+
* Format: float
326+
* @example 27.1
327+
*/
328+
rateCross?: number;
329+
}[];
330+
Error: {
331+
/** @description Текст помилки для кінцевого користувача, для автоматичного оброблення потрібно аналізувати HTTP код відповіді (200, 404, 429 та інші) */
332+
errorDescription?: string;
333+
};
334+
};
335+
responses: never;
336+
parameters: never;
337+
requestBodies: never;
338+
headers: never;
339+
pathItems: never;
340+
}
341+
342+
export type $defs = Record<string, never>;
343+
344+
export type external = Record<string, never>;
345+
346+
export type operations = Record<string, never>;

0 commit comments

Comments
 (0)