1 |
|
2 | import Session from './types/Session';
|
3 | import Thread from './types/Thread';
|
4 | import User from './types/User';
|
5 | import { Readable } from 'stream';
|
6 | import Message, { MessageOptions } from './types/Message';
|
7 | import EventEmitter from 'events';
|
8 | import StrictEventEmitter from 'strict-event-emitter-types';
|
9 | import ClientEvents from './ClientEvents';
|
10 | import DeviceId from './types/DeviceId';
|
11 | export interface ClientOptions {
|
12 | selfListen?: boolean;
|
13 | session?: Session;
|
14 | deviceId?: DeviceId;
|
15 | }
|
16 | declare const Client_base: new () => StrictEventEmitter<EventEmitter, ClientEvents, ClientEvents, "addEventListener" | "removeEventListener", "removeListener" | "on" | "addListener" | "once" | "emit">;
|
17 |
|
18 |
|
19 |
|
20 | export default class Client extends Client_base {
|
21 | private mqttApi;
|
22 | private httpApi;
|
23 | private readonly session;
|
24 | private seqId;
|
25 | loggedIn: boolean;
|
26 | private options;
|
27 | constructor(options?: ClientOptions);
|
28 | login(email: string, password: string): Promise<void>;
|
29 | private doLogin;
|
30 | getSession(): Session;
|
31 | sendMessage(threadId: string, message: string, options?: MessageOptions): Promise<{
|
32 | succeeded: boolean;
|
33 | errStr?: string; |
34 |
|
35 |
|
36 |
|
37 | }>;
|
38 | |
39 |
|
40 |
|
41 |
|
42 | sendPresenceState(recipientUserId: string, present: boolean): Promise<void>;
|
43 | |
44 |
|
45 |
|
46 |
|
47 | sendTypingState(threadOrRecipientUserId: string, present: boolean): Promise<void>;
|
48 | |
49 |
|
50 |
|
51 | sendReadReceipt(message: Message): Promise<void>;
|
52 | getThreadList(count: number): Promise<Thread[]>;
|
53 | sendAttachmentFile(threadId: string, attachmentPath: string, extension?: string): Promise<any>;
|
54 | sendAttachmentStream(threadId: string, extension: string, attachment: Readable): Promise<any>;
|
55 | getAttachmentURL(messageId: string, attachmentId: string): Promise<string>;
|
56 | getAttachmentInfo(messageId: string, attachmentId: string): Promise<any>;
|
57 | getStickerURL(stickerId: number): Promise<string>;
|
58 | getThreadInfo(threadId: string): Promise<Thread>;
|
59 | getUserInfo(userId: string): Promise<User>;
|
60 | getMessages(threadId: string, count: number): Promise<Message>;
|
61 | private createQueue;
|
62 | private connectQueue;
|
63 | private handleMS;
|
64 | private handleMessage;
|
65 | }
|
66 | export {};
|