mtcute/packages/client/src/methods
2022-06-21 21:07:54 +03:00
..
auth build: updated to layer 139 2022-04-01 22:17:10 +03:00
bots feat(client): support get/setBotMenuButton methods 2022-05-09 00:00:22 +03:00
chats fix(client): fixed kickChatMember 2022-06-07 19:40:42 +03:00
contacts some changes 2021-11-23 00:03:59 +03:00
dialogs feat(client): updated to layer 143 2022-06-18 22:47:31 +03:00
files feat(client): sticker choosing typing event 2022-05-06 17:53:44 +03:00
invite-links feat(client): updated to layer 143 2022-06-18 22:47:31 +03:00
messages fix(client): pass params for forward caption, also codegen-ed client 2022-06-21 21:07:54 +03:00
misc rename back to mtcute 2021-08-05 20:38:24 +03:00
parse-modes rename back to mtcute 2021-08-05 20:38:24 +03:00
pasword rename back to mtcute 2021-08-05 20:38:24 +03:00
stickers build: updated to layer 139 2022-04-01 22:17:10 +03:00
users some changes 2021-11-23 00:03:59 +03:00
.eslintrc.js build: fixed scripts, eslintignore, fixed linter warnings and re-formatted with prettier 2021-06-06 15:20:41 +03:00
_imports.ts feat(client): support reactions 2022-05-12 10:09:37 +03:00
README.md Initial commit 2021-04-08 12:19:38 +03:00
updates.ts feat(client): sticker choosing typing event 2022-05-06 17:53:44 +03:00

What is this?

Files in this directory are pre-processed by generate-client.js, and client.ts is generated from the functions that are exported in this directory.

Since we need to properly type the copied signatures, there are a few "magic" instructions for the preprocessor that are used to handle imports. Also, there are a few "magic" instructions to make private methods and extend client fields.

All instructions are used as a one-line comment, like this: // @copy

@copy

Can be placed before an import or any other code block.

When placed before import, this import will be copied to client.ts, and paths will be adjusted. When there are multiple copied imports from the same files, they are merged.

When placed before any other block, it will be directly copied before the TelegramClient class.

Note

all copied imports should be inside _imports.ts file.

Example:

// @copy
import { Something } from '../../somewhere'

// @copy
interface SomeGreatInterface { ... }

@extension

Used before an interface declaration. Fields from that interface will be added as protected to TelegramClient.

Example:

// @extension
interface AwesomeExtension {
    _field1: number
    _field2: string
}

@initialize

Often you'll want to initialize your @extension fields in a constructor. You can do this by using @initialize instruction before a function containing initialization code.

Note

If you are using some custom types, make sure their imports are copied!

Example:

// @initialize
function _initializeAwesomeExtension(this: TelegramClient) {
    this._field1 = 42
    this._field2 = 'uwu'
}

@returns-exported

Used as a first statement inside an exported function's body to indicate that this method returns an object of type which is exported from the same file.

Example:

export type FooOrBar = Foo | Bar

export function getFooOrBar(this: TelegramClient): FooOrBar {
    // @returns-exported
    return new Foo()
}