@advayta108/uplati-sdk 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.RU.md +118 -0
- package/README.md +49 -23
- package/package.json +7 -5
package/README.RU.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<h1 align="center">@advayta108/uplati-sdk</h1>
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="https://lk.uplati.ru/images/logo.png" alt="Система Город Logo" width="220" />
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-3178C6?style=for-the-badge&logo=typescript&logoColor=white" alt="TypeScript" /></a>
|
|
9
|
+
<a href="https://nodejs.org/"><img src="https://img.shields.io/badge/Node.js-339933?style=for-the-badge&logo=nodedotjs&logoColor=white" alt="Node.js" /></a>
|
|
10
|
+
<a href="https://axios-http.com/"><img src="https://img.shields.io/badge/Axios-5A29E4?style=for-the-badge&logo=axios&logoColor=white" alt="Axios" /></a>
|
|
11
|
+
<a href="https://github.com/form-data/form-data"><img src="https://img.shields.io/badge/Form--data-000000?style=for-the-badge&logo=npm&logoColor=white" alt="Form-data" /></a>
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
<a href="https://github.com/advayta108/uplati-bot/blob/main/lib/uplati-sdk/README.md"><img src="https://img.shields.io/badge/English-0052CC?style=for-the-badge&logo=github&logoColor=white" alt="English" /></a>
|
|
16
|
+
<a href="https://github.com/advayta108/uplati-bot/blob/main/lib/uplati-sdk/README.RU.md"><img src="https://img.shields.io/badge/Русский-0052CC?style=for-the-badge&logo=github&logoColor=white" alt="Русский" /></a>
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
<p align="center">
|
|
20
|
+
<a href="https://www.npmjs.com/package/@advayta108/uplati-sdk"><img src="https://img.shields.io/npm/v/@advayta108/uplati-sdk?style=flat-square&label=npm" alt="npm version" /></a>
|
|
21
|
+
<a href="https://uplati.ru"><img src="https://img.shields.io/badge/API_Version-3.25.10-orange.svg" alt="API Version" /></a>
|
|
22
|
+
<a href="https://github.com/advayta108/uplati-bot/actions/workflows/publish-sdk.yml"><img src="https://github.com/advayta108/uplati-bot/actions/workflows/publish-sdk.yml/badge.svg" alt="Publish SDK" /></a>
|
|
23
|
+
</p>
|
|
24
|
+
|
|
25
|
+
**TypeScript SDK** для работы с API сервиса [«Система город»](https://uplati.ru) (Uplati). Авторизация, счётчики, показания, квитанции, транзакции и автоплатежи.
|
|
26
|
+
|
|
27
|
+
## Установка
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install @advayta108/uplati-sdk
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Быстрый старт
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
import { UplatiClient } from '@advayta108/uplati-sdk';
|
|
37
|
+
|
|
38
|
+
const client = new UplatiClient({
|
|
39
|
+
sendDataEnabled: true,
|
|
40
|
+
logger: (message) => console.log('[uplati-sdk]', message),
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
await client.authenticate('email@example.com', 'password');
|
|
44
|
+
|
|
45
|
+
const meters = await client.getMeters();
|
|
46
|
+
await client.sendMeterValue(meters[0].id, 123.45);
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Возможности
|
|
50
|
+
|
|
51
|
+
- Авторизация и управление токеном сессии
|
|
52
|
+
- Получение списка счётчиков
|
|
53
|
+
- Отправка показаний
|
|
54
|
+
- Получение квитанций
|
|
55
|
+
- История транзакций
|
|
56
|
+
- Получение / настройка / удаление автоплатежей
|
|
57
|
+
|
|
58
|
+
## API клиента `UplatiClient`
|
|
59
|
+
|
|
60
|
+
- `authenticate(email: string, password: string): Promise<string>`
|
|
61
|
+
- `setToken(token: string): void`
|
|
62
|
+
- `getToken(): string | null`
|
|
63
|
+
- `getMeters(): Promise<Sensor[]>`
|
|
64
|
+
- `sendMeterValue(sensorId: number, sensorValue: number | string): Promise<boolean>`
|
|
65
|
+
- `getReceipts(): Promise<Receipt[]>`
|
|
66
|
+
- `getTransactions(limit?: number): Promise<Transaction[]>`
|
|
67
|
+
- `getAutopayments(): Promise<Autopayment[]>`
|
|
68
|
+
- `setAutopayment(settings: AutopaymentSettings): Promise<boolean>`
|
|
69
|
+
- `deleteAutopayment(autopaymentId: number): Promise<boolean>`
|
|
70
|
+
|
|
71
|
+
## Экспортируемые типы
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
import {
|
|
75
|
+
Sensor,
|
|
76
|
+
Receipt,
|
|
77
|
+
Transaction,
|
|
78
|
+
Autopayment,
|
|
79
|
+
AutopaymentSettings,
|
|
80
|
+
} from '@advayta108/uplati-sdk';
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Настройки клиента
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
new UplatiClient({
|
|
87
|
+
sendDataEnabled: true, // false -> тестовый режим без отправки
|
|
88
|
+
baseUrl: 'https://gw3-online.uplati.ru/api',
|
|
89
|
+
logger: console.log,
|
|
90
|
+
});
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Разработка в монорепозитории
|
|
94
|
+
|
|
95
|
+
Если вы работаете внутри **UPLATI-BOT-SDK-MONOREPO**:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
npm install
|
|
99
|
+
npm run build:lib
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Публикация из монорепозитория:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
npm run publish:lib
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Документация
|
|
109
|
+
|
|
110
|
+
- Монорепозиторий (EN): [README.md](https://github.com/advayta108/uplati-bot/blob/main/README.md)
|
|
111
|
+
- Монорепозиторий (RU): [README.RU.md](https://github.com/advayta108/uplati-bot/blob/main/README.RU.md)
|
|
112
|
+
- Деплой: [docs/DEPLOY.md](https://github.com/advayta108/uplati-bot/blob/main/docs/DEPLOY.md)
|
|
113
|
+
- Публикация: [docs/PUBLISHING_GUIDE.md](https://github.com/advayta108/uplati-bot/blob/main/docs/PUBLISHING_GUIDE.md)
|
|
114
|
+
- Монорепо: [docs/MONOREPO_SETUP.md](https://github.com/advayta108/uplati-bot/blob/main/docs/MONOREPO_SETUP.md)
|
|
115
|
+
|
|
116
|
+
## Лицензия
|
|
117
|
+
|
|
118
|
+
MIT. См. [LICENSE](https://github.com/advayta108/uplati-bot/blob/main/lib/uplati-sdk/LICENSE).
|
package/README.md
CHANGED
|
@@ -1,14 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
<h1 align="center">@advayta108/uplati-sdk</h1>
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="https://lk.uplati.ru/images/logo.png" alt="Система Город Logo" width="220" />
|
|
5
|
+
</p>
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-3178C6?style=for-the-badge&logo=typescript&logoColor=white" alt="TypeScript" /></a>
|
|
9
|
+
<a href="https://nodejs.org/"><img src="https://img.shields.io/badge/Node.js-339933?style=for-the-badge&logo=nodedotjs&logoColor=white" alt="Node.js" /></a>
|
|
10
|
+
<a href="https://axios-http.com/"><img src="https://img.shields.io/badge/Axios-5A29E4?style=for-the-badge&logo=axios&logoColor=white" alt="Axios" /></a>
|
|
11
|
+
<a href="https://github.com/form-data/form-data"><img src="https://img.shields.io/badge/Form--data-000000?style=for-the-badge&logo=npm&logoColor=white" alt="Form-data" /></a>
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
<a href="https://github.com/advayta108/uplati-bot/blob/main/lib/uplati-sdk/README.md"><img src="https://img.shields.io/badge/English-0052CC?style=for-the-badge&logo=github&logoColor=white" alt="English" /></a>
|
|
16
|
+
<a href="https://github.com/advayta108/uplati-bot/blob/main/lib/uplati-sdk/README.RU.md"><img src="https://img.shields.io/badge/Русский-0052CC?style=for-the-badge&logo=github&logoColor=white" alt="Русский" /></a>
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
<p align="center">
|
|
20
|
+
<a href="https://www.npmjs.com/package/@advayta108/uplati-sdk"><img src="https://img.shields.io/npm/v/@advayta108/uplati-sdk?style=flat-square&label=npm" alt="npm version" /></a>
|
|
21
|
+
<a href="https://uplati.ru"><img src="https://img.shields.io/badge/API_Version-3.25.10-orange.svg" alt="API Version" /></a>
|
|
22
|
+
<a href="https://github.com/advayta108/uplati-bot/actions/workflows/publish-sdk.yml"><img src="https://github.com/advayta108/uplati-bot/actions/workflows/publish-sdk.yml/badge.svg" alt="Publish SDK" /></a>
|
|
23
|
+
</p>
|
|
24
|
+
|
|
25
|
+
**TypeScript SDK** for the [«Система город»](https://uplati.ru) (Uplati) service API. Use it to authenticate, read meters, submit readings, fetch receipts, transactions, and manage autopayments.
|
|
26
|
+
|
|
27
|
+
## Install
|
|
6
28
|
|
|
7
29
|
```bash
|
|
8
30
|
npm install @advayta108/uplati-sdk
|
|
9
31
|
```
|
|
10
32
|
|
|
11
|
-
##
|
|
33
|
+
## Quick start
|
|
12
34
|
|
|
13
35
|
```typescript
|
|
14
36
|
import { UplatiClient } from '@advayta108/uplati-sdk';
|
|
@@ -24,18 +46,16 @@ const meters = await client.getMeters();
|
|
|
24
46
|
await client.sendMeterValue(meters[0].id, 123.45);
|
|
25
47
|
```
|
|
26
48
|
|
|
27
|
-
##
|
|
28
|
-
|
|
29
|
-
- Авторизация и управление токеном сессии
|
|
30
|
-
- Получение списка счетчиков
|
|
31
|
-
- Отправка показаний счетчиков
|
|
32
|
-
- Получение квитанций
|
|
33
|
-
- Получение истории транзакций
|
|
34
|
-
- Получение/настройка/удаление автоплатежей
|
|
49
|
+
## Features
|
|
35
50
|
|
|
36
|
-
|
|
51
|
+
- Session authentication and token handling
|
|
52
|
+
- List meters (sensors)
|
|
53
|
+
- Submit meter readings
|
|
54
|
+
- Fetch receipts
|
|
55
|
+
- Transaction history
|
|
56
|
+
- Get / set / delete autopayments
|
|
37
57
|
|
|
38
|
-
`UplatiClient
|
|
58
|
+
## `UplatiClient` API
|
|
39
59
|
|
|
40
60
|
- `authenticate(email: string, password: string): Promise<string>`
|
|
41
61
|
- `setToken(token: string): void`
|
|
@@ -48,7 +68,7 @@ await client.sendMeterValue(meters[0].id, 123.45);
|
|
|
48
68
|
- `setAutopayment(settings: AutopaymentSettings): Promise<boolean>`
|
|
49
69
|
- `deleteAutopayment(autopaymentId: number): Promise<boolean>`
|
|
50
70
|
|
|
51
|
-
##
|
|
71
|
+
## Exported types
|
|
52
72
|
|
|
53
73
|
```typescript
|
|
54
74
|
import {
|
|
@@ -60,33 +80,39 @@ import {
|
|
|
60
80
|
} from '@advayta108/uplati-sdk';
|
|
61
81
|
```
|
|
62
82
|
|
|
63
|
-
##
|
|
83
|
+
## Client options
|
|
64
84
|
|
|
65
85
|
```typescript
|
|
66
86
|
new UplatiClient({
|
|
67
|
-
sendDataEnabled: true, // false ->
|
|
87
|
+
sendDataEnabled: true, // false -> dry run without sending
|
|
68
88
|
baseUrl: 'https://gw3-online.uplati.ru/api',
|
|
69
89
|
logger: console.log,
|
|
70
90
|
});
|
|
71
91
|
```
|
|
72
92
|
|
|
73
|
-
##
|
|
93
|
+
## Development in the monorepo
|
|
74
94
|
|
|
75
|
-
|
|
95
|
+
If you work inside **UPLATI-BOT-SDK-MONOREPO**:
|
|
76
96
|
|
|
77
97
|
```bash
|
|
78
98
|
npm install
|
|
79
99
|
npm run build:lib
|
|
80
100
|
```
|
|
81
101
|
|
|
82
|
-
|
|
102
|
+
Publish from the monorepo:
|
|
83
103
|
|
|
84
104
|
```bash
|
|
85
105
|
npm run publish:lib
|
|
86
106
|
```
|
|
87
107
|
|
|
88
|
-
##
|
|
108
|
+
## Documentation
|
|
109
|
+
|
|
110
|
+
- Monorepo (EN): [README.md](https://github.com/advayta108/uplati-bot/blob/main/README.md)
|
|
111
|
+
- Monorepo (RU): [README.RU.md](https://github.com/advayta108/uplati-bot/blob/main/README.RU.md)
|
|
112
|
+
- Deployment: [docs/DEPLOY.md](https://github.com/advayta108/uplati-bot/blob/main/docs/DEPLOY.md)
|
|
113
|
+
- Publishing: [docs/PUBLISHING_GUIDE.md](https://github.com/advayta108/uplati-bot/blob/main/docs/PUBLISHING_GUIDE.md)
|
|
114
|
+
- Monorepo setup: [docs/MONOREPO_SETUP.md](https://github.com/advayta108/uplati-bot/blob/main/docs/MONOREPO_SETUP.md)
|
|
89
115
|
|
|
90
|
-
|
|
91
|
-
- Основной репозиторий (RU): `../../README.RU.md`
|
|
116
|
+
## License
|
|
92
117
|
|
|
118
|
+
MIT. See [LICENSE](https://github.com/advayta108/uplati-bot/blob/main/lib/uplati-sdk/LICENSE).
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@advayta108/uplati-sdk",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "SDK
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "TypeScript SDK for the Uplati «Система город» (city services) API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"exports": {
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"files": [
|
|
17
17
|
"dist",
|
|
18
18
|
"README.md",
|
|
19
|
+
"README.RU.md",
|
|
19
20
|
"LICENSE"
|
|
20
21
|
],
|
|
21
22
|
"scripts": {
|
|
@@ -35,12 +36,13 @@
|
|
|
35
36
|
"license": "MIT",
|
|
36
37
|
"repository": {
|
|
37
38
|
"type": "git",
|
|
38
|
-
"url": "https://github.com/advayta108/
|
|
39
|
+
"url": "https://github.com/advayta108/uplati-bot.git",
|
|
40
|
+
"directory": "lib/uplati-sdk"
|
|
39
41
|
},
|
|
40
42
|
"bugs": {
|
|
41
|
-
"url": "https://github.com/advayta108/
|
|
43
|
+
"url": "https://github.com/advayta108/uplati-bot/issues"
|
|
42
44
|
},
|
|
43
|
-
"homepage": "https://github.com/advayta108/
|
|
45
|
+
"homepage": "https://github.com/advayta108/uplati-bot/tree/main/lib/uplati-sdk#readme",
|
|
44
46
|
"engines": {
|
|
45
47
|
"node": ">=18.0.0"
|
|
46
48
|
},
|