-
Notifications
You must be signed in to change notification settings - Fork 3
/
tdlib.d.ts
51 lines (50 loc) · 1.88 KB
/
tdlib.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
declare export interface TDLibNativeInterface {
/**
* Create a TDLib Client
* @returns {number} Return a sequence number for client identifier
*/
td_client_create(): number;
/**
* Destroy a TDLib Client
* @param {number} client_id Client identifier
*/
td_client_destroy(client_id: number): void;
/**
* Sends request to TDLib.
* @param {number} client_id Client identifier
* @param {string} request JSON serialized request
*/
td_client_send(client_id: number, request: string): void;
/**
* Receives incoming updates and request responses from TDLib.
* @param {number} client_id Client identifier
* @param {number} timeout Maximum number of seconds allowed for this function to wait for new data.
*/
td_client_receive(client_id: number, timeout: number): string[];
/**
* Sends synchronized request to TDLib.
* @param client_id Client identifier
* @param request JSON serialized request
*/
td_client_execute(client_id: number, request: string): string;
/**
* Receives incoming updates and request responses from TDLib.
* @param {number} client_id Client identifier
* @param {number} timeout Maximum number of seconds allowed for this function to wait for new data.
* @param {Function} callback
*/
td_client_receive_async(client_id: number, timeout: number, callback: (err: Error, res: string) => void): void;
/**
* Create a pipe file descriptior pair
* @returns {number[]} A pair of reader/writer file descriptor
*/
create_pipe_fd(): number[];
/**
* Register a file descriptor as client event listener.
* @param {number} client_id
* @param {number} write_fd
*/
register_receiver_fd(client_id: number, write_fd: number): void;
}
declare export const TDLib: TDLibNativeInterface;
export as namespace TDLibNative;