import { NEResult, Controller, NIMChatroomUpdateMemberInfoOptions, NIMChatroomMessage } from './commonTypes'; export declare enum NEChatroomType { /** 主聊天室 */ COMMON = 0, /** 等候室聊天室 */ WAITING_ROOM = 1 } export declare enum NEChatRoomMemberQueryType { /** 固定成员(包括创建者,管理员,普通等级用户,受限用户(禁言+黑名单),即使非在线也可以在列表中看到,有数量限制 ) */ NORMAL = 0, /** 仅在线的固定成员 */ ONLINE_NORMAL = 1, /** 非固定成员 (又称临时成员,只有在线时才能在列表中看到,数量无上限) 按照进入聊天室时间倒序排序,进入时间越晚的越靠前 */ GUEST_DESC = 2, /** 非固定成员 (又称临时成员,只有在线时才能在列表中看到,数量无上限) 按照进入聊天室时间顺序排序,进入时间越早的越靠前 */ GUEST_ASC = 3 } export type NEChatRoomMember = { avatar?: string; nick: string; }; export declare enum NERoomChatMessageType { TEXT = "text", IMAGE = "image", AUDIO = "audio", VIDEO = "video", FILE = "file", GEO = "geo", CUSTOM = "custom", TIP = "tip", NOTIFICATION = "notification", ATTACHSTR = "attachStr" } export interface NERoomMessage { messageType: NERoomChatMessageType; fromUserUuid: string; fromNick: string; fromAvatar: string; time: number; chatroomType: NEChatroomType; toUserUuidList?: string[]; } export type NERoomTextMessage = NERoomMessage & { messageType: NERoomChatMessageType.TEXT; text: string; }; export type NERoomFileMessage = NERoomMessage & { messageType: NERoomChatMessageType.FILE; displayName: string; extension: string; md5: string; url: string; path: string; size: number; }; export type NERoomImageMessage = NERoomFileMessage & { messageType: NERoomChatMessageType.IMAGE; width: number; height: number; }; export type NERoomCustomMessage = NERoomMessage & { messageType: NERoomChatMessageType.CUSTOM; attachStr: string; }; export type NERoomNotificationMessage = NERoomMessage & { messageType: NERoomChatMessageType.NOTIFICATION; attachStr: string; }; /** * 更新本端成员信息 */ export type UpdateMyChatroomMemberInfoOptions = { member: { nick?: string; avatar?: string; custom?: string; }; needNotify: boolean; custom?: string; antiSpamBusinessId?: string; needSave?: boolean; }; export interface NERoomChatController extends Controller { /** * 进入聊天室 * @param chatroomType 聊天室类型 */ joinChatroom: (chatroomType?: NEChatroomType) => Promise>; /** * 离开聊天室 * @param chatroomType 聊天室类型 */ leaveChatroom: (chatroomType?: NEChatroomType) => Promise>; /** *@ignore */ destroy: () => Promise>; /** *@ignore */ updateMyChatroomMemberInfo: (options: UpdateMyChatroomMemberInfoOptions) => Promise; /** * 发送自定义广播消息 * @param chatroomType 聊天室类型 */ sendBroadcastCustomMessage: (message: string, chatroomType?: NEChatroomType) => Promise>; /** * 发送广播消息 * @param chatroomType 聊天室类型 */ sendBroadcastTextMessage: (message: string, chatroomType?: NEChatroomType, custom?: string) => Promise>; /** * 获取聊天室成员信息 * @param type 成员查询类型 * @param limit 人数限制 * @param chatroomType 聊天室类型 */ fetchChatRoomMembers: (type: NEChatRoomMemberQueryType, limit: number, chatroomType?: NEChatroomType) => Promise; /** * 定向发送消息(私聊) * @param message 文本消息 * @param userUuid 对方用户id * @param chatroomType 聊天室类型 */ sendDirectTextMessage: (userUuid: string, message: string, chatroomType?: NEChatroomType, custom?: string) => Promise>; /** * 定向群发文本消息 * @param userUuids * @param message 文本消息 * @param chatroomType 聊天室类型 * @returns */ sendGroupTextMessage: (userUuids: string[], message: string, chatroomType?: NEChatroomType, custom?: string) => Promise>; /** * 发送文本消息 * @param messageUuid 消息唯一ID * @param fileBlob Blob文件 * @param userUuids 用户id列表,为空表示全员消息 * @param chatroomType 聊天室类型 */ sendTextMessage: (messageUuid: string, message: string, userUuids?: string[], chatroomType?: NEChatroomType, custom?: string) => Promise>; /** * 发送文件消息 * @param messageUuid 消息唯一ID * @param fileBlob 文件Blob * @param userUuids 用户id列表,为空表示全员消息 * @param chatroomType 聊天室类型 */ sendFileMessage: (messageUuid: string, fileBlob: Blob | string, userUuids?: string[], chatroomType?: NEChatroomType) => Promise>; /** * 发送图片消息 * @param messageUuid 消息唯一ID * @param imageBlob Blob文件 或 File * @param userUuids 用户id列表,为空表示全员消息 * @param chatroomType 聊天室类型 */ sendImageMessage: (messageUuid: string, imageBlob: Blob | string, width: number, height: number, userUuids?: string[], chatroomType?: NEChatroomType) => Promise>; /** * 取消发送文件消息 * @param messageUuid 消息唯一ID * @param chatroomType 聊天室类型 */ cancelSendFileMessage: (messageUuid: string, chatroomType?: NEChatroomType) => Promise>; /** * 获取历史消息 * @param option.startTime 开始时间 * @param option.limit 消息数量 * @param option.order 顺序 0 正序 1 倒序 * @param chatroomType 聊天室类型 */ fetchChatroomHistoryMessages(option: { startTime?: number; limit?: number; order?: number; msgTypes?: string[]; }, chatroomType: NEChatroomType): Promise>; /** * 撤回聊天室消息 * @param messageUuid 消息唯一ID * @param messageTime 消息时间 * @param chatroomType 聊天室类型 */ recallChatroomMessage(messageUUID: string, messageTime: number, chatroomType?: NEChatroomType): Promise>; /** * 下载附件 Electron * @param messageUuid 消息唯一ID * @param url 附件地址 * @param path 保存路径 * @param chatroomType 聊天室类型 */ downloadAttachment?(messageUUID: string, url: string, path: string, chatroomType?: NEChatroomType): Promise>; /** * 下载附件 Electron * @param messageUuid 消息唯一ID * @param url 附件地址 * @param path 保存路径 * @param chatroomType 聊天室类型 */ cancelDownloadAttachment?(messageUUID: string, chatroomType?: NEChatroomType): Promise>; /** * 禁言成员 * @param userUuid 成员id * @param duration 禁言时长 * @param notifyExt 扩展信息 */ banMemberChat(userUuid: string, duration: number, notifyExt?: string): Promise>; /** * 取消禁言成员 * @param userUuid 成员id * @param notifyExt 扩展信息 */ unbanMemberChat(userUuid: string, notifyExt?: string): Promise>; }