/// import { EventEmitter } from 'events'; import { PadchatContactPayload, PadchatMessagePayload, PadchatPayload, PadchatRequestTokenPayload, PadchatRoomMemberListPayload, PadchatRoomPayload } from './padchat-schemas'; import { InitType, StandardType, WXAutoLoginType, WXCheckQRCodePayload, WXGetQRCodeType, WXHeartBeatType, WXInitializeType, WXLoadWxDatType, WXLoginRequestType, WXLogoutType, WXQRCodeLoginType, WXSearchContactType, WXSearchContactTypeStatus, WXSendMsgType } from './padchat-rpc.type'; export declare const DISCONNECTED = "DISCONNECTED"; export declare const CONNECTING = "CONNECTING"; export declare const CONNECTED = "CONNECTED"; export interface ConnectionStatus { status: string; reconnectLeft: number; interval: number; } export interface PendingAPICall { apiName: string; params: Array; timestamp: number; resolve: (value?: any | PromiseLike) => void; reject: (reason?: any) => void; } export declare class PadchatRpc extends EventEmitter { protected endpoint: string; protected token: string; private socket?; private readonly jsonRpc; private throttleQueue?; private debounceQueue?; private reconnectThrottleQueue?; private resetThrottleQueue?; private throttleSubscription?; private debounceSubscription?; private reconnectThrottleSubscription?; private resetThrottleSubscription?; private pendingApiCalls; protected connectionStatus: ConnectionStatus; protected userId?: string; constructor(endpoint: string, token: string); start(): Promise; protected reconnect(): Promise; protected updateConnectionStatus(status: string): void; protected cleanConnection(): void; private executeBufferedApiCalls; protected initJsonRpc(): Promise; protected initWebSocket(): Promise; private initHeartbeat; protected reset(reason?: string): void; stop(): void; private startQueues; private stopQueues; private rpcCall; protected onSocket(payload: PadchatPayload): void; protected onSocketPadchat(padchatPayload: PadchatPayload): void; protected onSocketTencent(messagePayloadList: PadchatMessagePayload[]): void; private replayTextMsg; private replayImageMsg; private replayAppMsg; private generateBaseMsg; /** * Init with WebSocket Server */ protected init(): Promise; /** * Get WX block memory */ protected WXInitialize(): Promise; protected WXGetQRCode(): Promise; WXCheckQRCode(): Promise; WXHeartBeat(): Promise; /** * Load all Contact and Room * see issue https://github.com/lijiarui/wechaty-puppet-padchat/issues/39 * @returns {Promise<(PadchatRoomPayload | PadchatContactPayload)[]>} */ WXSyncContact(): Promise>; /** * Generate 62 data * * 1. Call multiple times in the same session, will return the same data * 2. Call multiple times between sessions with the same token, will return the same data */ WXGenerateWxDat(): Promise; /** * Load 62 data * @param {string} wxData autoData.wxData */ WXLoadWxDat(wxData: string): Promise; WXGetLoginToken(): Promise; /** * Login with token automatically * @param {string} token autoData.token * @returns {string} user_name | '' */ WXAutoLogin(token: string): Promise; /** * Login with QRcode * @param {string} token autoData.token */ WXLoginRequest(token: string): Promise; /** * Send Text Message * @param {string} to user_name * @param {string} content text */ WXSendMsg(to: string, content: string, at?: string[]): Promise; /** * Send Image Message * @param {string} to user_name * @param {string} data image_data */ WXSendImage(to: string, data: string): Promise; /** * Get contact by contact id * @param {any} id user_name */ WXGetContact(id: string): Promise; /** * Get contact by contact id * @param {any} id user_name */ WXGetContactPayload(id: string): Promise; /** * Get contact by contact id * @param {any} id user_name */ WXGetRoomPayload(id: string): Promise; /** * Get all member of a room by room id * @param {any} roomId chatroom_id */ WXGetChatRoomMember(roomId: string): Promise; /** * Login successfully by qrcode * @param {any} username user_name * @param {any} password password */ WXQRCodeLogin(username: string, password: string): Promise; WXSetUserRemark(id: string, remark: string): Promise; WXDeleteChatRoomMember(roomId: string, contactId: string): Promise; WXAddChatRoomMember(roomId: string, contactId: string): Promise; /** * When member more than 40, use WXInviteChatRoomMember * When member less than 40, use WXAddChatRoomMember * * @param {string} roomId * @param {string} contactId * @returns {Promise} */ WXInviteChatRoomMember(roomId: string, contactId: string): Promise; WXSetChatroomName(roomId: string, topic: string): Promise; WXQuitChatRoom(roomId: string): Promise; WXAddUser(strangerV1: string, strangerV2: string, type: WXSearchContactTypeStatus, verify: string): Promise; WXAcceptUser(stranger: string, ticket: string): Promise; WXLogout(): Promise; WXSendMoments(text: string): Promise; WXSyncMessage(): Promise; WXSearchContact(id: string): Promise; WXSayHello(stranger: string, text: string): Promise; WXDeleteUser(id: string): Promise; WXCreateChatRoom(userList: string[]): Promise; WXReceiveRedPacket(redPacket: string): Promise; WXQueryRedPacket(redPacket: string): Promise; WXOpenRedPacket(redPacket: string): Promise; WXSetHeadImage(image: string): Promise; WXSetUserInfo(nickeName: string, signature: string, sex: string, country: string, provincia: string, city: string): Promise; WXGetPeopleNearby(longitude: string, latitude: string): Promise; WXGetSubscriptionInfo(id: string): Promise; WXSubscriptionCommand(id: string, orderId: string, orderKey: string): Promise; WXGetRequestToken(id: string, url: string): Promise; WXRequestUrl(url: string, key: string, uin: string): Promise; WXSetWeChatID(id: string): Promise; WXTransferQuery(transfer: string): Promise; WXTransferOperation(transfer: string): Promise; WXGetMsgImage(msg: string): Promise; WXGetMsgVideo(msg: string): Promise; WXGetMsgVoice(msg: string): Promise; WXWebSearch(id: string): Promise; WXShareCard(user: string, id: string, caption: string): Promise; WXSyncReset(): Promise; WXQRCodeDecode(path: string): Promise; WXSnsUpload(image: string): Promise; WXSnsObjectDetail(id: string): Promise; WXSnsObjectOp(id: string, type: string, comment: string, commentType: string): Promise; WXSnsComment(user: string, id: string, content: string, replyId: string): Promise; WXSnsUserPage(user: string, id: string): Promise; WXSnsTimeline(id: string): Promise; WXSendAppMsg(user: string, content: string): Promise; WXFavSync(key: string): Promise; WXFavAddItem(favObject: string): Promise; WXFavGetItem(id: string): Promise; WXFavDeleteItem(id: string): Promise; WXGetContactLabelList(): Promise; WXAddContactLabel(label: string): Promise; WXDeleteContactLabel(id: string): Promise; WXSetContactLabel(user: string, id: string): Promise; WXGetUserQRCode(user: string, style: number): Promise; WXUploadAppAttach(data: string): Promise; WXSendVoice(user: string, data: string, time: number): Promise; WXSnsSync(key: string): Promise; WXMassMessage(userList: string[], content: string): Promise; WXSetChatroomAnnouncement(chatroom: string, content: string): Promise; }