@onyx-p/imlib-web 1.2.2 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/README.md +14 -0
- package/dist/index.esm.js +30737 -0
- package/dist/index.umd.js +30811 -0
- package/dist/types/index.d.ts +243 -0
- package/dist/types/model/baseMessage.d.ts +47 -0
- package/dist/types/model/iReceivedConversation.d.ts +70 -0
- package/dist/types/model/iReceivedMessage.d.ts +91 -0
- package/dist/types/model/mentionedInfo.d.ts +9 -0
- package/dist/types/model/messages/fileMessage.d.ts +24 -0
- package/dist/types/model/messages/gifMessage.d.ts +27 -0
- package/dist/types/model/messages/imageMessage.d.ts +32 -0
- package/dist/types/model/messages/index.d.ts +12 -0
- package/dist/types/model/messages/notificationMessages.d.ts +20 -0
- package/dist/types/model/messages/otherMediaMessages.d.ts +99 -0
- package/dist/types/model/messages/recallCommandMessage.d.ts +9 -0
- package/dist/types/model/messages/textMessage.d.ts +12 -0
- package/dist/types/model/messages/videoMessage.d.ts +30 -0
- package/dist/types/model/messages/voiceMessage.d.ts +18 -0
- package/dist/types/model/statusTypes.d.ts +409 -0
- package/dist/types/types.d.ts +297 -0
- package/package.json +57 -5
@@ -0,0 +1,243 @@
|
|
1
|
+
import { ConnectionStatus, ConversationType, NotificationLevel, NotificationStatus } from './model/statusTypes';
|
2
|
+
import { EventListeners, Events, GetHistoryMessageOption, GetHistoryMessageResult, IBaseConversationInfo, IConversationOption, IConversationState, IDeleteMessageOptions, IGetConversationListOptions, IImageMessageOption, IInitOption, IPromiseResult, IRecallMessageOptions, ISendBody, ISendMessageOptions, IUploadHooks, IUploadMessageOption, ProfileInfo } from './types';
|
3
|
+
import { BaseMessage, IBaseMessageBody } from './model/baseMessage';
|
4
|
+
import { ITextMessageBody } from './model/messages/textMessage';
|
5
|
+
import IReceivedMessage from './model/iReceivedMessage';
|
6
|
+
import IReceivedConversation from './model/iReceivedConversation';
|
7
|
+
import { CommonReqResult, PBCodec } from './net/connection/webSocketServer';
|
8
|
+
import { BaseResp } from './net/pbs/rpc.base';
|
9
|
+
import { IChatRecordMsgDetail } from './model/messages/otherMediaMessages';
|
10
|
+
export { TextMessage, ImageMessage, HQVoiceMessage, GIFMessage, FileMessage, VideoMessage, RecallCommandMessage, LocationMessage, ChatRecordMessage, ContactMessage, InvitationMessage, RedEnvelopeMessage, TransferMessage, PrivateOpenBurnAfterReadingMessage, PrivateCloseBurnAfterReadingMessage, GroupOpenBurnAfterReadingMessage, GroupCloseBurnAfterReadingMessage } from './model/messages';
|
11
|
+
export type { ITextMessageBody, IImageMessageBody, IGIFMessageBody, IFileMessageBody, IHQVoiceMessageBody, IRecallCommandMessageBody, IVideoMessageBody, ILocationMessageBody, IChatRecordMessageBody, IContactMessageBody, IInvitationMessageBody, IRedEnvelopeMessageBody, ITransferMessageBody, IBurnAfterReadingMessageBody } from './model/messages';
|
12
|
+
export { MessageTypes, NotiMessageTypes } from './constants/messageTypes';
|
13
|
+
export type { IBaseMessageBody, IReceivedMessage, IReceivedConversation };
|
14
|
+
export * from './types';
|
15
|
+
export * from './model/statusTypes';
|
16
|
+
/**
|
17
|
+
* 初始化
|
18
|
+
* @param initOption
|
19
|
+
*/
|
20
|
+
export declare const init: (initOption: IInitOption) => void;
|
21
|
+
/**
|
22
|
+
* 建立 IM 连接
|
23
|
+
* @param token
|
24
|
+
*/
|
25
|
+
export declare const connect: () => IPromiseResult<void>;
|
26
|
+
/**
|
27
|
+
* 断开当前用户的连接
|
28
|
+
* @description 调用后将不再接收消息,不可发送消息,不可获取历史消息,不可获取会话列表
|
29
|
+
*/
|
30
|
+
export declare const disconnect: () => Promise<void>;
|
31
|
+
export declare const setUserLogged: (info: ProfileInfo) => void;
|
32
|
+
export declare const logOut: () => void;
|
33
|
+
/**
|
34
|
+
* 获取 IM 连接状态
|
35
|
+
*/
|
36
|
+
export declare const getConnectionStatus: () => ConnectionStatus;
|
37
|
+
/**
|
38
|
+
* 发送 WebSocket 请求
|
39
|
+
* @param cmdId 命令ID,用于标识请求类型
|
40
|
+
* @param body 请求体数据
|
41
|
+
* @param codec 编解码器,用于序列化请求数据和反序列化响应数据
|
42
|
+
* @param timeout 超时时间(秒),默认30秒
|
43
|
+
* @typeParam R 请求体类型
|
44
|
+
* @typeParam P 响应体类型,必须继承自 BaseResp
|
45
|
+
* @returns 返回 Promise,包含响应结果
|
46
|
+
*/
|
47
|
+
export declare const request: <R, P extends BaseResp>(cmdId: number, body: R, codec: PBCodec<R, P>, timeout?: number) => CommonReqResult<P>;
|
48
|
+
/**
|
49
|
+
* 当前服务器时间
|
50
|
+
* 校准时间,可能存在误差
|
51
|
+
*/
|
52
|
+
export declare const getServerTime: () => number;
|
53
|
+
/**
|
54
|
+
* 绑定事件
|
55
|
+
*/
|
56
|
+
export declare const addEventListener: <T extends Events>(eventType: T, listener: EventListeners[T], target?: any) => void;
|
57
|
+
export declare function onceEventListener<T extends Events>(eventType: T, listener: EventListeners[T], target?: any): void;
|
58
|
+
/**
|
59
|
+
* 移除事件
|
60
|
+
*/
|
61
|
+
export declare const removeEventListener: <T extends Events>(eventType: T, listener: EventListeners[T], target?: any) => void;
|
62
|
+
/**
|
63
|
+
* 获取会话列表
|
64
|
+
* @param options
|
65
|
+
*/
|
66
|
+
export declare const getConversationList: (options?: IGetConversationListOptions) => IPromiseResult<IReceivedConversation[]>;
|
67
|
+
/**
|
68
|
+
* 获取指定会话数据
|
69
|
+
* @description 通过该方法获取的会话可能并不存在于当前的会话列表中,此处只作为功能性封装语法糖
|
70
|
+
* @param options
|
71
|
+
*/
|
72
|
+
export declare const getConversation: (options: IConversationOption) => IPromiseResult<IReceivedConversation | null | undefined>;
|
73
|
+
/**
|
74
|
+
* 移除指定的会话实例
|
75
|
+
*/
|
76
|
+
export declare const removeConversation: (options: IConversationOption) => IPromiseResult<void>;
|
77
|
+
/**
|
78
|
+
* 获取会话文本草稿
|
79
|
+
* @params options 会话
|
80
|
+
*/
|
81
|
+
export declare const getTextMessageDraft: (options: IConversationOption) => IPromiseResult<string>;
|
82
|
+
/**
|
83
|
+
* 设置会话文本草稿
|
84
|
+
* @params options 会话
|
85
|
+
* @params draft 草稿内容
|
86
|
+
*/
|
87
|
+
export declare const saveTextMessageDraft: (options: IConversationOption, draft: string) => IPromiseResult<void>;
|
88
|
+
/**
|
89
|
+
* 删除会话文本草稿
|
90
|
+
* @params options 会话
|
91
|
+
*/
|
92
|
+
export declare const clearTextMessageDraft: (options: IConversationOption) => IPromiseResult<void>;
|
93
|
+
/**
|
94
|
+
* 获取单个群会话 @ 消息未读数
|
95
|
+
*/
|
96
|
+
export declare const getUnreadMentionedCount: (options: IConversationOption) => IPromiseResult<number>;
|
97
|
+
/**
|
98
|
+
* 获取所有群会话 @ 消息未读数
|
99
|
+
*/
|
100
|
+
export declare const getAllUnreadMentionedCount: () => IPromiseResult<number>;
|
101
|
+
/**
|
102
|
+
* 获取本地单个会话的状态
|
103
|
+
*/
|
104
|
+
export declare const getConversationState: (options: IConversationOption) => IConversationState | null;
|
105
|
+
/**
|
106
|
+
* 获取本地全部会话的状态
|
107
|
+
* @description
|
108
|
+
* 返回的本地会话满足以下任一条件:
|
109
|
+
* 1. unreadCount > 0
|
110
|
+
* 2. unreadMentionedCount > 0
|
111
|
+
* 3. notificationLevel !== NotificationLevel.NOT_SET
|
112
|
+
* 4. notificationStatus !== NotificationStatus.CLOSE
|
113
|
+
* 5. isTop === true
|
114
|
+
*/
|
115
|
+
export declare const getAllConversationState: () => IPromiseResult<IConversationState[]>;
|
116
|
+
/**
|
117
|
+
* 获取当前所有会话的消息未读数
|
118
|
+
* @description
|
119
|
+
* 1. 清除浏览器缓存会导致会话未读数不准确
|
120
|
+
* 2. 会话消息未读数存储在 WebStorage 中, 若浏览器不支持或禁用 WebStorage,未读消息数将不会保存,浏览器页面刷新未读消息数将不会存在
|
121
|
+
* 3. 其他端删除会话可能会导致会话未读数不准确
|
122
|
+
* @param includeMuted 是否包含免打扰会话
|
123
|
+
* @param conversationTypes 要获取未读数的会话类型,若为空,则默认获取单聊、群聊及系统消息未读数
|
124
|
+
*/
|
125
|
+
export declare const getTotalUnreadCount: (includeMuted?: boolean, conversationTypes?: ConversationType[]) => IPromiseResult<number>;
|
126
|
+
/**
|
127
|
+
* 获取单个会话的未读数
|
128
|
+
*
|
129
|
+
*/
|
130
|
+
export declare const getUnreadCount: (options: IConversationOption) => IPromiseResult<number>;
|
131
|
+
/**
|
132
|
+
* 清除会话未读数
|
133
|
+
*/
|
134
|
+
export declare const clearMessagesUnreadStatus: (options: IConversationOption) => IPromiseResult<void>;
|
135
|
+
/**
|
136
|
+
* 清理全部未读数
|
137
|
+
* @returns
|
138
|
+
*/
|
139
|
+
export declare const clearAllMessagesUnreadStatus: () => IPromiseResult<void>;
|
140
|
+
/**
|
141
|
+
* 获取会话免打扰等级
|
142
|
+
*/
|
143
|
+
export declare const getConversationNotificationLevel: (options: IConversationOption) => IPromiseResult<NotificationLevel>;
|
144
|
+
/**
|
145
|
+
* 设置会话免打扰
|
146
|
+
* 是否免打扰
|
147
|
+
* * 1: 开启免打扰
|
148
|
+
* * 2: 关闭免打扰
|
149
|
+
*/
|
150
|
+
export declare const setConversationNotificationStatus: (options: IConversationOption, notificationStatus: NotificationStatus) => IPromiseResult<void>;
|
151
|
+
/**
|
152
|
+
* 获取免打扰状态
|
153
|
+
* getConversationNotificationStatus
|
154
|
+
*/
|
155
|
+
export declare const getConversationNotificationStatus: (options: IConversationOption) => IPromiseResult<NotificationStatus>;
|
156
|
+
/**
|
157
|
+
* 获取免打扰状态列表
|
158
|
+
* getBlockedConversationList
|
159
|
+
*/
|
160
|
+
export declare const getBlockedConversationList: () => IPromiseResult<IBaseConversationInfo[]>;
|
161
|
+
/**
|
162
|
+
* 设置会话是否置顶
|
163
|
+
*/
|
164
|
+
export declare const setConversationToTop: (options: IConversationOption, isTop?: boolean) => IPromiseResult<void>;
|
165
|
+
/**
|
166
|
+
* 获取置顶会话
|
167
|
+
*/
|
168
|
+
export declare const getTopConversationList: () => IPromiseResult<IBaseConversationInfo[]>;
|
169
|
+
/**
|
170
|
+
* 注册自定义消息
|
171
|
+
* @param messageType 消息类型
|
172
|
+
* @param isPersited 是否存储
|
173
|
+
* @param isCounted 是否计数
|
174
|
+
* @param prototypes 消息属性名称
|
175
|
+
* @param isStatusMessage 是否是状态消息
|
176
|
+
*/
|
177
|
+
export declare const registerMessageType: <T extends IBaseMessageBody>(messageType: number, isPersited: boolean, isCounted: boolean, isStatusMessage?: boolean) => new (content: T) => BaseMessage<T>;
|
178
|
+
/**
|
179
|
+
* 发送消息
|
180
|
+
* @param options
|
181
|
+
*/
|
182
|
+
export declare const sendMessage: (conversation: IConversationOption, message: BaseMessage, options?: ISendMessageOptions) => IPromiseResult<IReceivedMessage>;
|
183
|
+
/**
|
184
|
+
* 发送文本消息
|
185
|
+
*/
|
186
|
+
export declare const sendTextMessage: (conversation: IConversationOption, messageBody: ITextMessageBody, options?: ISendMessageOptions) => IPromiseResult<IReceivedMessage>;
|
187
|
+
/**
|
188
|
+
* 发送图片消息
|
189
|
+
*/
|
190
|
+
export declare const sendImageMessage: (conversation: IConversationOption, msgBody: ISendBody, hooks?: IUploadHooks, sendOptions?: IImageMessageOption) => IPromiseResult<IReceivedMessage>;
|
191
|
+
/**
|
192
|
+
* 发送GIF消息
|
193
|
+
*/
|
194
|
+
export declare const sendGIFMessage: (conversation: IConversationOption, msgBody: ISendBody, hooks?: IUploadHooks, sendOptions?: IUploadMessageOption) => IPromiseResult<IReceivedMessage>;
|
195
|
+
/**
|
196
|
+
* 发送高清语音消息
|
197
|
+
*/
|
198
|
+
export declare const sendHQVoiceMessage: (conversation: IConversationOption, msgBody: ISendBody, hooks?: IUploadHooks | undefined, sendOptions?: IUploadMessageOption | undefined) => IPromiseResult<IReceivedMessage>;
|
199
|
+
/**
|
200
|
+
* 发送文件消息
|
201
|
+
*/
|
202
|
+
export declare const sendFileMessage: (conversation: IConversationOption, msgBody: ISendBody, hooks?: IUploadHooks, sendOptions?: IUploadMessageOption) => IPromiseResult<IReceivedMessage>;
|
203
|
+
/**
|
204
|
+
* 发送短视频消息
|
205
|
+
*/
|
206
|
+
export declare const sendSightMessage: (conversation: IConversationOption, msgBody: ISendBody, hooks?: IUploadHooks, sendOptions?: IUploadMessageOption) => IPromiseResult<IReceivedMessage>;
|
207
|
+
/**
|
208
|
+
* 撤回消息
|
209
|
+
* @param options
|
210
|
+
*/
|
211
|
+
export declare const recallMessage: (conversation: IConversationOption, options: IRecallMessageOptions) => IPromiseResult<IReceivedMessage>;
|
212
|
+
/**
|
213
|
+
* 获取远程历史消息
|
214
|
+
*/
|
215
|
+
export declare const getRemoteHistoryMessages: (conversation: IConversationOption, options: GetHistoryMessageOption) => IPromiseResult<GetHistoryMessageResult>;
|
216
|
+
/**
|
217
|
+
* 按消息 id 删除消息
|
218
|
+
*/
|
219
|
+
export declare const deleteMessages: (conversation: IConversationOption, messages: IDeleteMessageOptions[]) => IPromiseResult<void>;
|
220
|
+
/**
|
221
|
+
* 按时间戳删除消息
|
222
|
+
* @param conversation 会话
|
223
|
+
* @param timestamp 清除时间点, 该时间之前的消息将被清除
|
224
|
+
*/
|
225
|
+
export declare const clearHistoryMessages: (conversation: IConversationOption) => IPromiseResult<void>;
|
226
|
+
export declare const parseChatRecordMsgDetails: (conversation: IConversationOption, detailItems: IChatRecordMsgDetail[]) => IReceivedMessage[];
|
227
|
+
/**
|
228
|
+
* 发送已读回执
|
229
|
+
* @param messages 消息列表
|
230
|
+
* @returns
|
231
|
+
*/
|
232
|
+
export declare const sendReadReceipts: (messages: IReceivedMessage[]) => IPromiseResult<void>;
|
233
|
+
export declare const mockLogin: (config: {
|
234
|
+
langCode: string;
|
235
|
+
phone: string;
|
236
|
+
password: string;
|
237
|
+
}) => CommonReqResult<import("./net/pbs/rpc.login").AuthSignIn2Resp>;
|
238
|
+
/**
|
239
|
+
* 清除指定会话中阅后即焚过期的消息
|
240
|
+
* @param conversation 会话信息
|
241
|
+
* @returns 被清除的消息ID列表
|
242
|
+
*/
|
243
|
+
export declare const clearBurnAfterReadingExpiredMessages: (conversation: IConversationOption) => IPromiseResult<string[]>;
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import MentionedInfo from './mentionedInfo';
|
2
|
+
export interface IMentionedInfo {
|
3
|
+
/**
|
4
|
+
* 群组消息中的 @ 信息
|
5
|
+
*/
|
6
|
+
mentionedInfo?: MentionedInfo;
|
7
|
+
}
|
8
|
+
export interface IExtraData {
|
9
|
+
/**
|
10
|
+
* 消息中的附加信息
|
11
|
+
*/
|
12
|
+
extra?: string;
|
13
|
+
}
|
14
|
+
export interface IUserInfo {
|
15
|
+
user?: {
|
16
|
+
/**
|
17
|
+
* 用户 ID
|
18
|
+
*/
|
19
|
+
userId?: string;
|
20
|
+
/**
|
21
|
+
* 用户名
|
22
|
+
*/
|
23
|
+
name?: string;
|
24
|
+
/**
|
25
|
+
* user info 中附加信息
|
26
|
+
*/
|
27
|
+
extra?: string;
|
28
|
+
/**
|
29
|
+
* 用户头像地址
|
30
|
+
*/
|
31
|
+
portraitUri?: string;
|
32
|
+
};
|
33
|
+
}
|
34
|
+
/**
|
35
|
+
* 消息基本结构
|
36
|
+
*/
|
37
|
+
export type IBaseMessageBody = Record<string, any>;
|
38
|
+
export type MessageCodingData = Record<string, any>;
|
39
|
+
export declare class BaseMessage<T extends IBaseMessageBody = any> {
|
40
|
+
messageType: number;
|
41
|
+
content: T;
|
42
|
+
readonly isPersited: boolean;
|
43
|
+
readonly isCounted: boolean;
|
44
|
+
readonly isStatusMessage: boolean;
|
45
|
+
constructor(messageType: number, content: T, isPersited?: boolean, isCounted?: boolean, isStatusMessage?: boolean);
|
46
|
+
}
|
47
|
+
export declare const registerMessageType: <T extends IBaseMessageBody>(messageType: number, isPersited: boolean, isCounted: boolean, isStatusMessage?: boolean) => new (content: T) => BaseMessage<T>;
|
@@ -0,0 +1,70 @@
|
|
1
|
+
import { ConversationType, NotificationLevel, NotificationStatus } from './statusTypes';
|
2
|
+
import IReceivedMessage from './iReceivedMessage';
|
3
|
+
/**
|
4
|
+
* 从服务器拉取到的会话数据结构
|
5
|
+
*/
|
6
|
+
export default interface IReceivedConversation {
|
7
|
+
/**
|
8
|
+
* 会话类型
|
9
|
+
*/
|
10
|
+
conversationType: ConversationType;
|
11
|
+
/**
|
12
|
+
* 会话 Id
|
13
|
+
* @description
|
14
|
+
* 1. 当 `conversationType` 为 `ConversationType.GROUP` 时,该值为群组 Id
|
15
|
+
* 1. 当 `conversationType` 为 `ConversationType.PRIVATE` 时,该值为对方用户 Id
|
16
|
+
*/
|
17
|
+
targetId: string;
|
18
|
+
/**
|
19
|
+
* 当前会话的未读消息数
|
20
|
+
*/
|
21
|
+
unreadMessageCount: number;
|
22
|
+
/**
|
23
|
+
* 会话中的最后一条消息
|
24
|
+
*/
|
25
|
+
latestMessage?: IReceivedMessage | null;
|
26
|
+
/**
|
27
|
+
* 是否包含 @ 自己的消息,此数据仅在 `conversationType` 为 `ConversationType.GROUP` 时有效
|
28
|
+
*/
|
29
|
+
hasMentioned?: boolean;
|
30
|
+
/**
|
31
|
+
* 会话免打扰状态
|
32
|
+
* @description
|
33
|
+
* 1. 已开启免打扰
|
34
|
+
* 2. 未开启免打扰
|
35
|
+
*/
|
36
|
+
notificationStatus: NotificationStatus;
|
37
|
+
notificationLevel: NotificationLevel;
|
38
|
+
/**
|
39
|
+
* 会话是否已置顶
|
40
|
+
*/
|
41
|
+
isTop: boolean;
|
42
|
+
/**
|
43
|
+
* 会话中消息的最后未读时间
|
44
|
+
*/
|
45
|
+
lastUnreadTime: string;
|
46
|
+
/**
|
47
|
+
* @ 消息未读数
|
48
|
+
*/
|
49
|
+
unreadMentionedCount?: number;
|
50
|
+
/**
|
51
|
+
* 会话名称
|
52
|
+
*/
|
53
|
+
dialogTitle?: string | null;
|
54
|
+
/**
|
55
|
+
* 会话头像
|
56
|
+
*/
|
57
|
+
smallAvatarUrl?: string | null;
|
58
|
+
/**
|
59
|
+
* 是否开启了阅后即焚
|
60
|
+
*/
|
61
|
+
burnAfterReadingFlag: boolean;
|
62
|
+
/**
|
63
|
+
* 阅后即焚的时长
|
64
|
+
*/
|
65
|
+
burnAfterReadingTime?: number | null;
|
66
|
+
/**
|
67
|
+
* 会话更新时间,根据这个排序
|
68
|
+
*/
|
69
|
+
updateTime?: number | null;
|
70
|
+
}
|
@@ -0,0 +1,91 @@
|
|
1
|
+
import { ConversationType, MessageDirection, ReceivedStatus, SentStatus } from './statusTypes';
|
2
|
+
/**
|
3
|
+
* 消息数据
|
4
|
+
*/
|
5
|
+
export default interface IReceivedMessage {
|
6
|
+
/**
|
7
|
+
* 会话类型
|
8
|
+
*/
|
9
|
+
conversationType: ConversationType;
|
10
|
+
/**
|
11
|
+
* 会话 targetId
|
12
|
+
*/
|
13
|
+
targetId: string;
|
14
|
+
/**
|
15
|
+
* 消息发送者的用户 Id
|
16
|
+
*/
|
17
|
+
senderUserId: string;
|
18
|
+
/**
|
19
|
+
* 消息内容
|
20
|
+
*/
|
21
|
+
content: any;
|
22
|
+
/**
|
23
|
+
* 消息结构名称,即消息类型
|
24
|
+
* @example RC:TxtMsg
|
25
|
+
*/
|
26
|
+
messageType: number;
|
27
|
+
/**
|
28
|
+
* 服务端存储的消息 Id
|
29
|
+
*/
|
30
|
+
messageUId: string;
|
31
|
+
/**
|
32
|
+
* 消息方向是发出 or 收取
|
33
|
+
*/
|
34
|
+
messageDirection: MessageDirection;
|
35
|
+
/**
|
36
|
+
* 是否为离线消息
|
37
|
+
*/
|
38
|
+
isOffLineMessage: boolean;
|
39
|
+
/**
|
40
|
+
* 消息在服务器端的发送时间
|
41
|
+
*/
|
42
|
+
sentTime: string;
|
43
|
+
/**
|
44
|
+
* 消息接收时间,该时间通过消息的 `sentTime` 值在本地进行计算得出,不推荐使用
|
45
|
+
* @description 当 isOffLineMessage 为 true 时,该值无效
|
46
|
+
*/
|
47
|
+
receivedTime: string;
|
48
|
+
/**
|
49
|
+
* 是否存储
|
50
|
+
* @default true
|
51
|
+
*/
|
52
|
+
isPersited: boolean;
|
53
|
+
/**
|
54
|
+
* 是否计数
|
55
|
+
* @default true
|
56
|
+
*/
|
57
|
+
isCounted: boolean;
|
58
|
+
/**
|
59
|
+
* 是否为 @ 消息
|
60
|
+
*/
|
61
|
+
isMentioned: boolean;
|
62
|
+
/**
|
63
|
+
* 消息是否静默
|
64
|
+
* @description 静默消息不会发送 Push 信息和本地通知提醒
|
65
|
+
*/
|
66
|
+
disableNotification: boolean;
|
67
|
+
/**
|
68
|
+
* 是否是状态消息
|
69
|
+
*/
|
70
|
+
isStatusMessage: boolean;
|
71
|
+
/**
|
72
|
+
* 消息接收状态
|
73
|
+
*/
|
74
|
+
receivedStatus: ReceivedStatus;
|
75
|
+
/**
|
76
|
+
* CPP 独有字段 消息本地 ID
|
77
|
+
*/
|
78
|
+
messageId?: string;
|
79
|
+
/**
|
80
|
+
* 消息发送状态
|
81
|
+
*/
|
82
|
+
sentStatus: SentStatus;
|
83
|
+
/**
|
84
|
+
* 是否为阅后即焚消息
|
85
|
+
*/
|
86
|
+
burnAfterReadingFlag: boolean;
|
87
|
+
/**
|
88
|
+
* 阅后即焚消息的时长
|
89
|
+
*/
|
90
|
+
burnAfterReadingTime?: number;
|
91
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
export interface IFileMessageBody {
|
2
|
+
/**
|
3
|
+
* 文件名称
|
4
|
+
*/
|
5
|
+
title: string;
|
6
|
+
/**
|
7
|
+
* 文件类型
|
8
|
+
*/
|
9
|
+
extension: string;
|
10
|
+
/**
|
11
|
+
* 文件尺寸,单位: Byte
|
12
|
+
*/
|
13
|
+
size: number;
|
14
|
+
/**
|
15
|
+
* 远程文件资源地址
|
16
|
+
*/
|
17
|
+
fileKey: string;
|
18
|
+
/**
|
19
|
+
* 文件的加密密钥
|
20
|
+
*/
|
21
|
+
encryptKey?: string;
|
22
|
+
}
|
23
|
+
declare const FileMessage: new (content: IFileMessageBody) => import("../baseMessage").BaseMessage<IFileMessageBody>;
|
24
|
+
export default FileMessage;
|
@@ -0,0 +1,27 @@
|
|
1
|
+
/**
|
2
|
+
* GIF 消息
|
3
|
+
*/
|
4
|
+
export interface IGIFMessageBody {
|
5
|
+
/**
|
6
|
+
* GIF 图片资源 url 地址
|
7
|
+
*/
|
8
|
+
originalObjectKey: string;
|
9
|
+
/**
|
10
|
+
* 图片扩展名
|
11
|
+
*/
|
12
|
+
extension: string;
|
13
|
+
/**
|
14
|
+
* 图片宽度
|
15
|
+
*/
|
16
|
+
width: number;
|
17
|
+
/**
|
18
|
+
* 图片高度
|
19
|
+
*/
|
20
|
+
height: number;
|
21
|
+
/**
|
22
|
+
* 图片的加密密钥
|
23
|
+
*/
|
24
|
+
encryptKey?: string;
|
25
|
+
}
|
26
|
+
declare const GIFMessage: new (content: IGIFMessageBody) => import("../baseMessage").BaseMessage<IGIFMessageBody>;
|
27
|
+
export default GIFMessage;
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import { IUserInfo, IExtraData, IMentionedInfo } from '../baseMessage';
|
2
|
+
/**
|
3
|
+
* 图片消息
|
4
|
+
*/
|
5
|
+
export interface IImageMessageBody extends IExtraData, IMentionedInfo, IUserInfo {
|
6
|
+
/**
|
7
|
+
* 图片的扩展名
|
8
|
+
*/
|
9
|
+
extension?: string;
|
10
|
+
/**
|
11
|
+
* 缩略图远程地址
|
12
|
+
*/
|
13
|
+
thumbnailObjectKey: string;
|
14
|
+
/**
|
15
|
+
* 原图远程地址
|
16
|
+
*/
|
17
|
+
originalObjectKey: string;
|
18
|
+
/**
|
19
|
+
* 图片的加密密钥
|
20
|
+
*/
|
21
|
+
encryptKey?: string;
|
22
|
+
/**
|
23
|
+
* 图片的宽
|
24
|
+
*/
|
25
|
+
width: number;
|
26
|
+
/**
|
27
|
+
* 图片的高
|
28
|
+
*/
|
29
|
+
height: number;
|
30
|
+
}
|
31
|
+
declare const ImageMessage: new (content: IImageMessageBody) => import("../baseMessage").BaseMessage<IImageMessageBody>;
|
32
|
+
export default ImageMessage;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import TextMessage, { ITextMessageBody } from './textMessage';
|
2
|
+
import ImageMessage, { IImageMessageBody } from './imageMessage';
|
3
|
+
import GIFMessage, { IGIFMessageBody } from './gifMessage';
|
4
|
+
import HQVoiceMessage, { IHQVoiceMessageBody } from './voiceMessage';
|
5
|
+
import FileMessage, { IFileMessageBody } from './fileMessage';
|
6
|
+
import VideoMessage, { IVideoMessageBody } from './videoMessage';
|
7
|
+
import { ILocationMessageBody, LocationMessage, IChatRecordMessageBody, ChatRecordMessage, IContactMessageBody, ContactMessage, IInvitationMessageBody, InvitationMessage, IRedEnvelopeMessageBody, RedEnvelopeMessage, ITransferMessageBody, TransferMessage } from './otherMediaMessages';
|
8
|
+
import { IBurnAfterReadingMessageBody } from './notificationMessages';
|
9
|
+
import { PrivateOpenBurnAfterReadingMessage, PrivateCloseBurnAfterReadingMessage, GroupOpenBurnAfterReadingMessage, GroupCloseBurnAfterReadingMessage } from './notificationMessages';
|
10
|
+
import RecallCommandMessage, { IRecallCommandMessageBody } from './recallCommandMessage';
|
11
|
+
export { TextMessage, ImageMessage, GIFMessage, HQVoiceMessage, FileMessage, RecallCommandMessage, VideoMessage, LocationMessage, ChatRecordMessage, ContactMessage, InvitationMessage, RedEnvelopeMessage, TransferMessage, PrivateOpenBurnAfterReadingMessage, PrivateCloseBurnAfterReadingMessage, GroupOpenBurnAfterReadingMessage, GroupCloseBurnAfterReadingMessage };
|
12
|
+
export type { ITextMessageBody, IImageMessageBody, IGIFMessageBody, IHQVoiceMessageBody, IFileMessageBody, IRecallCommandMessageBody, IVideoMessageBody, ILocationMessageBody, IChatRecordMessageBody, IContactMessageBody, IInvitationMessageBody, IRedEnvelopeMessageBody, ITransferMessageBody, IBurnAfterReadingMessageBody };
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { IBaseMessageBody } from "../baseMessage";
|
2
|
+
export interface IReceiptMessageBody extends IBaseMessageBody {
|
3
|
+
groupId?: string;
|
4
|
+
destId?: string;
|
5
|
+
msgIdList: string[];
|
6
|
+
}
|
7
|
+
export interface IBurnAfterReadingMessageBody extends IBaseMessageBody {
|
8
|
+
burnAfterReadingTime: number;
|
9
|
+
params?: string[];
|
10
|
+
templateId: number;
|
11
|
+
}
|
12
|
+
declare const GroupArrivalReceiptMessage: new (content: IReceiptMessageBody) => import("../baseMessage").BaseMessage<IReceiptMessageBody>;
|
13
|
+
declare const GroupReadReceiptMessage: new (content: IReceiptMessageBody) => import("../baseMessage").BaseMessage<IReceiptMessageBody>;
|
14
|
+
declare const PrivateArrivalReceiptMessage: new (content: IReceiptMessageBody) => import("../baseMessage").BaseMessage<IReceiptMessageBody>;
|
15
|
+
declare const PrivateReadReceiptMessage: new (content: IReceiptMessageBody) => import("../baseMessage").BaseMessage<IReceiptMessageBody>;
|
16
|
+
declare const PrivateOpenBurnAfterReadingMessage: new (content: IBurnAfterReadingMessageBody) => import("../baseMessage").BaseMessage<IBurnAfterReadingMessageBody>;
|
17
|
+
declare const PrivateCloseBurnAfterReadingMessage: new (content: IBurnAfterReadingMessageBody) => import("../baseMessage").BaseMessage<IBurnAfterReadingMessageBody>;
|
18
|
+
declare const GroupOpenBurnAfterReadingMessage: new (content: IBurnAfterReadingMessageBody) => import("../baseMessage").BaseMessage<IBurnAfterReadingMessageBody>;
|
19
|
+
declare const GroupCloseBurnAfterReadingMessage: new (content: IBurnAfterReadingMessageBody) => import("../baseMessage").BaseMessage<IBurnAfterReadingMessageBody>;
|
20
|
+
export { GroupArrivalReceiptMessage, GroupReadReceiptMessage, PrivateArrivalReceiptMessage, PrivateReadReceiptMessage, PrivateOpenBurnAfterReadingMessage, PrivateCloseBurnAfterReadingMessage, GroupOpenBurnAfterReadingMessage, GroupCloseBurnAfterReadingMessage };
|
@@ -0,0 +1,99 @@
|
|
1
|
+
export interface ILocationMessageBody {
|
2
|
+
thumbnailObjectKey: string;
|
3
|
+
title: string;
|
4
|
+
desc: string;
|
5
|
+
locationType: number;
|
6
|
+
encryptKey?: string;
|
7
|
+
lat: number;
|
8
|
+
lon: number;
|
9
|
+
}
|
10
|
+
export interface IChatRecordMessageBody {
|
11
|
+
chatTitle: string;
|
12
|
+
msgDataFileKey: string;
|
13
|
+
msgList: Array<{
|
14
|
+
srcId: string;
|
15
|
+
senderNickname: string;
|
16
|
+
mediaConstructor: number;
|
17
|
+
msgPostContent: string;
|
18
|
+
}>;
|
19
|
+
encryptKey?: string;
|
20
|
+
}
|
21
|
+
export interface IChatRecordMsgDetail {
|
22
|
+
senderNickname: string;
|
23
|
+
senderAvatar?: string;
|
24
|
+
msgId: string;
|
25
|
+
srcId: string;
|
26
|
+
destId: string;
|
27
|
+
msgPreContent?: string;
|
28
|
+
msgPostContent?: string;
|
29
|
+
mediaConstructor: number;
|
30
|
+
mediaAttribute?: string;
|
31
|
+
msgSendTime: string;
|
32
|
+
}
|
33
|
+
export interface IContactMessageBody {
|
34
|
+
uid: string;
|
35
|
+
nickname: string;
|
36
|
+
phoneNumber: string;
|
37
|
+
langcode: string;
|
38
|
+
smallAvatarUrl?: string;
|
39
|
+
gender: number;
|
40
|
+
}
|
41
|
+
export interface IInvitationMessageBody {
|
42
|
+
groupUin: string;
|
43
|
+
groupTitle: string;
|
44
|
+
inviteFromUin: string;
|
45
|
+
inviteFromNickName: string;
|
46
|
+
totalMemberCount: number;
|
47
|
+
createTime: number;
|
48
|
+
smallAvatarUrl?: string;
|
49
|
+
groupMemberSmallAvatarUrlArr?: string[];
|
50
|
+
}
|
51
|
+
export interface IRedEnvelopeMessageBody {
|
52
|
+
id: number;
|
53
|
+
createTime: string;
|
54
|
+
updateTime: string;
|
55
|
+
amount: string;
|
56
|
+
count: number;
|
57
|
+
uid: string;
|
58
|
+
nativeNumber: string;
|
59
|
+
nativeType: number;
|
60
|
+
sendSign: string;
|
61
|
+
title: string;
|
62
|
+
symbol: string;
|
63
|
+
receivedStatus: number;
|
64
|
+
status: number;
|
65
|
+
expireTime: number;
|
66
|
+
currency: string;
|
67
|
+
currencyLogo: string;
|
68
|
+
refundAmount: string;
|
69
|
+
receivedAmount?: string;
|
70
|
+
}
|
71
|
+
export interface ITransferMessageBody {
|
72
|
+
id: number;
|
73
|
+
createTime: string;
|
74
|
+
updateTime: string;
|
75
|
+
uid: string;
|
76
|
+
orderId: string;
|
77
|
+
src: string;
|
78
|
+
symbol: string;
|
79
|
+
type: number;
|
80
|
+
toUid: string;
|
81
|
+
nativeType: number;
|
82
|
+
money: number;
|
83
|
+
refName: string;
|
84
|
+
transNo: string;
|
85
|
+
status: number;
|
86
|
+
pushStatus: number;
|
87
|
+
currency: string;
|
88
|
+
currencyLogo: string;
|
89
|
+
network: string;
|
90
|
+
networkLogo: string;
|
91
|
+
refId: string;
|
92
|
+
}
|
93
|
+
declare let LocationMessage: new (content: ILocationMessageBody) => import("../baseMessage").BaseMessage<ILocationMessageBody>;
|
94
|
+
declare let ChatRecordMessage: new (content: IChatRecordMessageBody) => import("../baseMessage").BaseMessage<IChatRecordMessageBody>;
|
95
|
+
declare let ContactMessage: new (content: IContactMessageBody) => import("../baseMessage").BaseMessage<IContactMessageBody>;
|
96
|
+
declare let InvitationMessage: new (content: IInvitationMessageBody) => import("../baseMessage").BaseMessage<IInvitationMessageBody>;
|
97
|
+
declare let RedEnvelopeMessage: new (content: IRedEnvelopeMessageBody) => import("../baseMessage").BaseMessage<IRedEnvelopeMessageBody>;
|
98
|
+
declare let TransferMessage: new (content: ITransferMessageBody) => import("../baseMessage").BaseMessage<ITransferMessageBody>;
|
99
|
+
export { LocationMessage, ChatRecordMessage, ContactMessage, InvitationMessage, RedEnvelopeMessage, TransferMessage };
|