/** * Wechaty - https://github.com/chatie/wechaty * * @copyright 2016-2018 Huan LI * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ import { ContactGender, FriendshipType } from 'wechaty-puppet'; export declare enum PadchatContactRoomStatus { Get = 0, Sync = 1 } export declare enum PadchatRoomMemberStatus { Zero = 0, Todo = 1 } export declare enum PadchatMessageMsgType { Five = 5 } export declare enum PadchatMessageStatus { One = 1 } export declare enum PadchatStatus { One = 1 } export declare enum PadchatContactMsgType { Contact = 2, N11_2048 = 2048 } export declare enum PadchatMsgType { N11_2048 = 2048, N15_32768 = 32768 } export declare enum PadchatContinue { Done = 0, Go = 1 } export declare enum PadchatPayloadType { Logout = -1, InvalidPadchatToken = -1111, OnlinePadchatToken = -1112, ExpirePadchatToken = -1113 } export declare enum WechatAppMessageType { Text = 1, Img = 2, Audio = 3, Video = 4, Url = 5, Attach = 6, Open = 7, Emoji = 8, VoiceRemind = 9, ScanGood = 10, Good = 13, Emotion = 15, CardTicket = 16, RealtimeShareLocation = 17, ChatHistory = 19, MiniProgram = 33, Transfers = 2000, RedEnvelopes = 2001, ReaderType = 100001 } export interface PadchatPayload { msg_type?: PadchatMsgType; continue?: PadchatContinue; status?: PadchatStatus; type: PadchatPayloadType; msg?: string; apiName: string; data: string; msgId: string; userId: string; } /** * There are two functions to generate PadchatContactPayload * - WXSyncContact (only when msg_type = 2) * - WXGetContact * @interface PadchatContactPayload */ export interface PadchatContactPayload { /** * Sometimes, WXSyncContact can only get the following result: * { * "continue": 1, * "msg_type": 2048, * "status": 1, * "uin": 324216852 * }, * * The following 4 only exist in [WXSyncContact], see more: https://github.com/lijiarui/test-ipad-puppet/issues/39 * continue: number, // 1: Not Load Ready, 0: Load Ready. * msg_type: number, // 2: Contact Or Room whole content. * source: number, // 14, // 0, 14, don't know why * uin: number, // 324216852, */ /** * The following 2 only exsit in [WXGetContact], see more: https://github.com/lijiarui/test-ipad-puppet/issues/40 * message: string, // '', * ticket: string, // '', */ msg_type?: PadchatContactMsgType; continue?: PadchatContinue; uin?: number; big_head: string; city: string; country: string; intro: string; label: string; nick_name: string; provincia: string; py_initial: string; remark: string; remark_py_initial: string; remark_quan_pin: string; sex: ContactGender; signature: string; small_head: string; status: PadchatContactRoomStatus; stranger?: string; ticket?: string; user_name: string; message?: string; quan_pin?: string; } export interface PadchatMessagePayload { content: string; data?: string; continue: PadchatContinue; description: string; from_user: string; msg_id: string; msg_source: string; msg_type: PadchatMessageMsgType; status: PadchatMessageStatus; sub_type: PadchatMessageType; timestamp: number; to_user: string; uin: number; } /** * * Enum for MsgType values. * @enum {number} * @property {number} TEXT - MsgType.TEXT (1) for TEXT * @property {number} IMAGE - MsgType.IMAGE (3) for IMAGE * @property {number} VOICE - MsgType.VOICE (34) for VOICE * @property {number} VERIFYMSG - MsgType.VERIFYMSG (37) for VERIFYMSG * @property {number} POSSIBLEFRIEND_MSG - MsgType.POSSIBLEFRIEND_MSG (40) for POSSIBLEFRIEND_MSG * @property {number} SHARECARD - MsgType.SHARECARD (42) for SHARECARD * @property {number} VIDEO - MsgType.VIDEO (43) for VIDEO * @property {number} EMOTICON - MsgType.EMOTICON (47) for EMOTICON * @property {number} LOCATION - MsgType.LOCATION (48) for LOCATION * @property {number} APP - MsgType.APP (49) for APP | File, Media Link * @property {number} VOIPMSG - MsgType.VOIPMSG (50) for VOIPMSG * @property {number} STATUSNOTIFY - MsgType.STATUSNOTIFY (51) for STATUSNOTIFY * @property {number} VOIPNOTIFY - MsgType.VOIPNOTIFY (52) for VOIPNOTIFY * @property {number} VOIPINVITE - MsgType.VOIPINVITE (53) for VOIPINVITE * @property {number} MICROVIDEO - MsgType.MICROVIDEO (62) for MICROVIDEO * @property {number} SYSNOTICE - MsgType.SYSNOTICE (9999) for SYSNOTICE * @property {number} SYS - MsgType.SYS (10000) for SYS | Change Room Topic, Invite into Room, Kick Off from the room * @property {number} RECALLED - MsgType.RECALLED (10002) for RECALLED */ export declare enum PadchatMessageType { Text = 1, Image = 3, Voice = 34, VerifyMsg = 37, PossibleFriendMsg = 40, ShareCard = 42, Video = 43, Emoticon = 47, Location = 48, App = 49, VoipMsg = 50, StatusNotify = 51, VoipNotify = 52, VoipInvite = 53, MicroVideo = 62, SysNotice = 9999, Sys = 10000, Recalled = 10002 } export declare enum PadchatEmojiType { Unknown = 0, Static = 1, Dynamic = 2 } /** * from Message */ export interface PadchatRoomMemberPayload { big_head: string; chatroom_nick_name: string; invited_by: string; nick_name: string; small_head: string; user_name: string; } /** * There are two functions to generate PadchatContactPayload * - WXSyncContact (only when msg_type = 2) * - WXGetContact * @interface PadchatRoomPayload */ export interface PadchatRoomPayload { /** * Sometimes, WXSyncContact can only get the following result: * { * "continue": 1, * "msg_type": 2048, * "status": 1, * "uin": 324216852 * }, * * The following 4 only exist in [WXSyncContact], see more: https://github.com/lijiarui/test-ipad-puppet/issues/39 * continue: number, // 1: Not Load Ready, 0: Load Ready. * msg_type: number, // 2: Contact Or Room whole content. * source: number, // 14, // 0, 14, don't know why * uin: number, // 324216852, */ /** * The following 2 only exsit in [WXGetContact], see more: https://github.com/lijiarui/test-ipad-puppet/issues/40 * message: string, // '', * ticket: string, // '', */ msg_type?: number; big_head: string; chatroom_id: number; chatroom_owner: string; continue?: PadchatContinue; max_member_count: number; member?: string[]; member_count: number; nick_name: string; py_initial: string; quan_pin: string; small_head: string; status: PadchatContactRoomStatus; uin: number; user_name: string; } export interface PadchatRoomMemberListPayload { chatroom_id: number; count: number; member: PadchatRoomMemberPayload[]; message: string; status: PadchatRoomMemberStatus; user_name: string; } export interface PadchatRoomInvitationPayload { id: string; fromUser: string; roomName: string; timestamp: number; url: string; } export interface PadchatAppMessagePayload { des?: string; thumburl?: string; title: string; url: string; appattach?: PadchatAppAttachPayload; type: WechatAppMessageType; md5?: string; } export interface PadchatAppAttachPayload { totallen?: number; attachid?: string; emoticonmd5?: string; fileext?: string; cdnattachurl?: string; aeskey?: string; cdnthumbaeskey?: string; encryver?: number; } export interface PadchatEmojiMessagePayload { cdnurl: string; type: PadchatEmojiType; len: number; width: number; height: number; } export interface PadchatFriendshipPayload { fromusername: string; encryptusername: string; content: string; ticket: string; } export interface PadchatRequestTokenPayload { full_url: string; info: string; message: string; share_url: string; status: number; } export interface PadchatRoomInviteEvent { fromUser: string; msgId: string; roomName: string; timestamp: number; url: string; } export interface FriendshipPayloadBase { id: string; contactId: string; hello?: string; } export declare type FriendshipPayloadConfirm = FriendshipPayloadBase & { type: FriendshipType.Confirm; }; export declare type FriendshipPayloadReceive = FriendshipPayloadBase & { stranger?: string; ticket: string; type: FriendshipType.Receive; }; export declare type FriendshipPayloadVerify = FriendshipPayloadBase & { type: FriendshipType.Verify; }; export declare type FriendshipPayload = FriendshipPayloadConfirm | FriendshipPayloadReceive | FriendshipPayloadVerify;