# telegram-api-schema-methods

> Methods for working with Telegram API

Latest version **1.3.0** (published 2024-06-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install telegram-api-schema-methods
pnpm add telegram-api-schema-methods
yarn add telegram-api-schema-methods
bun add telegram-api-schema-methods
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.0 |
| Published | 2024-06-18 |
| First published | 2022-07-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=12 |
| Dependencies | 0 |
| Unpacked size | 2 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Alexandr Alimov |
| Maintainers | a1im |
| Keywords | telegram, telegram-api, telegram-user-api, tdlib, schema, node, client, browser, nodejs, api |

## Links

- npm: https://www.npmjs.com/package/telegram-api-schema-methods
- Repository: https://github.com/a1im/telegram-api-schema-methods
- Issues: https://github.com/a1im/telegram-api-schema-methods/issues
- npm.io page: https://npm.io/package/telegram-api-schema-methods

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 1.3.0 (latest) — 2024-06-18
- 1.2.0 — 2024-02-09
- 1.1.2 — 2022-12-20
- 1.1.1 — 2022-12-20
- 1.1.0 — 2022-12-20
- 1.0.7 — 2022-12-16
- 1.0.6 — 2022-08-04
- 1.0.5 — 2022-08-04
- 1.0.3 — 2022-07-28

## README

# telegram-api-schema-methods

[![NPM](https://img.shields.io/npm/v/telegram-api-schema-methods.svg?style=flat-square)](https://www.npmjs.com/package/telegram-api-schema-methods)
[![Downloads](https://img.shields.io/npm/dm/telegram-api-schema-methods?style=flat-square)](https://www.npmjs.com/package/telegram-api-schema-methods)

The library helps to type all methods for the Telegram User API (https://core.telegram.org/methods)

- **Actual** 170 layer in the API scheme (https://core.telegram.org/schema)

## Install
```
yarn add telegram-api-schema-methods
# or
npm i telegram-api-schema-methods
```

## Example

Example using the @mtproto/core library, which is optional (https://github.com/alik0211/mtproto-core)

```ts
import { makeTgUserApiMethods } from 'telegram-api-schema-methods';
import MTProto from '@mtproto/core/envs/node';
import path from 'path';

// 1. Create instance
const mtproto = new MTProto({
    api_id: YOU_API_ID,
    api_hash: YOU_API_HASH,
    storageOptions: {
        path: path.resolve(__dirname, './1.json'),
    },
});

// 2. Create telegram user api methods (automatic typing of parameters and the result of methods)
const tgUserApiMethods = makeTgUserApiMethods({
    request: (...args: any[]) => mtproto.call(...args),
});

// 3. Print the user country code
tgUserApiMethods.helpGetNearestDc({}).then(({ success, data, error }) => {
    if (success) {
        // auto typing result for typescript
        console.log('country:', data.country);
    } else {
        console.error(error);
    }
});
```

## License
MIT

---
_Source: https://npm.io/package/telegram-api-schema-methods · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
