@advayta108/uplati-sdk
v1.0.4
Published
TypeScript SDK for the Uplati «Система город» (city services) API
Maintainers
Readme
TypeScript SDK for the «Система город» service API. Use it to authenticate, read meters, submit readings, fetch receipts, transactions, and manage autopayments.
Install
npm install @advayta108/uplati-sdkQuick start
import { UplatiClient } from '@advayta108/uplati-sdk';
const client = new UplatiClient({
sendDataEnabled: true,
logger: (message) => console.log('[uplati-sdk]', message),
});
await client.authenticate('[email protected]', 'password');
const meters = await client.getMeters();
await client.sendMeterValue(meters[0].id, 123.45);Features
- Session authentication and token handling
- List meters (sensors)
- Submit meter readings
- Fetch receipts
- Transaction history
- Get / set / delete autopayments
UplatiClient API
authenticate(email: string, password: string): Promise<string>setToken(token: string): voidgetToken(): string | nullgetMeters(): Promise<Sensor[]>sendMeterValue(sensorId: number, sensorValue: number | string): Promise<boolean>getReceipts(): Promise<Receipt[]>getTransactions(limit?: number): Promise<Transaction[]>getAutopayments(): Promise<Autopayment[]>setAutopayment(settings: AutopaymentSettings): Promise<boolean>deleteAutopayment(autopaymentId: number): Promise<boolean>
Exported types
import {
Sensor,
Receipt,
Transaction,
Autopayment,
AutopaymentSettings,
} from '@advayta108/uplati-sdk';Client options
new UplatiClient({
sendDataEnabled: true, // false -> dry run without sending
baseUrl: 'https://gw3-online.uplati.ru/api',
logger: console.log,
});Development in the monorepo
If you work inside UPLATI-BOT-SDK-MONOREPO:
npm install
npm run build:libPublish from the monorepo:
npm run publish:libDocumentation
- Monorepo (EN): README.md
- Monorepo (RU): README.RU.md
- Deployment: docs/DEPLOY.md
- Publishing: docs/PUBLISHING_GUIDE.md
- Monorepo setup: docs/MONOREPO_SETUP.md
License
MIT. See LICENSE.
