5.0.0 • Published 2 years ago

@airgram/web v5.0.0

Weekly downloads
33
License
-
Repository
github
Last release
2 years ago

Airgram for tdweb

Use tdweb on steroids.

Features

  • Strictly typed;
  • Documentation out of the box;
  • Supports models;
  • Built on middleware;

All TDLib classes and methods are described and have suitable wrappers in Airgram. There are only two differences:

  • All parameter names are represent in "camelCase".
  • Parameter @type renamed to _.

Documentation


Check out airgram documentation:


TDLib API reference:

Installation

npm install tdweb-airgram

Usage

Configuration

This section describes the options you can pass to Airgram constructor:

import { Airgram } from 'tdweb-airgram'

const airgram = new Airgram({
  // options
})

TDLib options

KeyTypeNote
useTestDcbooleanIf set to true, the Telegram test environment will be used instead of the production environment
databaseDirectorystringThe path to the directory for the persistent database
filesDirectorystringThe path to the directory for storing files
useFileDatabasebooleanIf set to true, information about downloaded and uploaded files will be saved between application restarts
useChatInfoDatabasebooleanIf set to true, the library will maintain a cache of users, basic groups, supergroups, channels and secret chats. Implies useFileDatabase
useMessageDatabasebooleanIf set to true, the library will maintain a cache of chats and messages. Implies useChatInfoDatabase
useSecretChatsbooleanIf set to true, support for secret chats will be enabled
apiIdnumberApplication identifier for Telegram API access, which can be obtained at https://my.telegram.org
apiHashstringApplication identifier hash for Telegram API access, which can be obtained at https://my.telegram.org
systemLanguageCodestringIETF language tag of the user's operating system language
deviceModelstringModel of the device the application is being run on
systemVersionstringVersion of the operating system the application is being run on
applicationVersionstringApplication version
enableStorageOptimizerbooleanIf set to true, old files will automatically be deleted
ignoreFileNamesbooleanIf set to true, original file names will be ignored. Otherwise, downloaded files will be saved under names as close as possible to the original name
databaseEncryptionKeystringEncryption key

tdweb options:

KeyTypeNote
instanceNamestringName of the TDLib instance. Currently only one instance of TdClient with a given name is allowed. All but one instances with the same name will be automatically closed. Usually, the newest non-background instance is kept alive. Files will be stored in an IndexedDb table with the same name.
isBackgroundbooleanPass true, if the instance is opened from the background. Default: false
jsLogVerbosityLevelstringThe initial verbosity level of the JavaScript part of the code (one of 'error', 'warning', 'info', 'log', 'debug'). Default: info
logVerbosityLevelnumberThe initial verbosity level for the TDLib internal logging (0-1023). Default: 2
useDatabasebooleanPass false to use TDLib without database and secret chats. It will significantly improve loading time, but some functionality will be unavailable. Default: true
readOnlybooleanFor debug only. Pass true to open TDLib database in read-only mode. Default: false
modestringFor debug only. The type of the TDLib build to use. 'asmjs' for asm.js and 'wasm' for WebAssembly. If mode == 'auto' WebAbassembly will be used if supported by browser, asm.js otherwise. Default: auto

Other options

KeyTypeNote
modelsFunctionContains function, which converts plain JSON objects to models. Details.
contextFactoryFunctionFunction that returns custom middleware context. Details.

API reference

This section describes public API of an Airgram instance:

KeyTypeNote
apiObjectContains wrappers for all TDLib methods.
configObjectAirgram configuration. Readonly.
catch(handler) => voidOverrides default error handler. Argument handler takes a function: (error: Error, ctx?: Record<string, any>) => void

License

The source code is licensed under GPL v3. License is available here.

5.1.1

2 years ago

5.0.0

2 years ago

4.1.0

3 years ago

4.0.1

3 years ago

4.0.0

3 years ago

3.3.0

3 years ago

3.2.2

4 years ago

3.2.1

4 years ago

3.1.1

4 years ago

3.1.0

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago

2.3.0-next.16

4 years ago

2.3.0-next.15

4 years ago

2.3.0-next.13

4 years ago

2.3.0-next.11

4 years ago

2.3.0

4 years ago

2.3.0-next.9

4 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.1.0-next.1

5 years ago

2.1.0-next.0

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

2.0.0-next.2

5 years ago