更新
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
export * from './tui-conversation';
|
||||
export * from './tui-chat';
|
||||
export * from './message-handler';
|
||||
export * from './tui-group';
|
||||
export * from './tui-user';
|
||||
export * from './tui-report';
|
||||
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
import type { Message } from '@tencentcloud/lite-chat/basic';
|
||||
|
||||
// message handler 因为需要在 MessageModel 中调用,需要保留声明文件
|
||||
export interface IMessageHandler {
|
||||
/**
|
||||
* 处理文本消息
|
||||
* @param {Message} message 文本消息
|
||||
*/
|
||||
handleTextMessage(message: Message): object;
|
||||
|
||||
/**
|
||||
* 处理图片消息
|
||||
* @param {Message} message 图片消息
|
||||
*/
|
||||
handleImageMessage(message: Message): object;
|
||||
|
||||
/**
|
||||
* 处理视频消息
|
||||
* @param {Message} message 视频消息
|
||||
*/
|
||||
handleVideoMessage(message: Message): object;
|
||||
|
||||
/**
|
||||
* 处理自定义消息
|
||||
* @param {Message} message 自定义消息
|
||||
*/
|
||||
handleCustomMessage(message: Message): object;
|
||||
|
||||
/**
|
||||
* 处理群提示消息
|
||||
* @param {Message} message 群 tips 消息
|
||||
*/
|
||||
handleGroupTipsMessage(message: Message): object;
|
||||
|
||||
/**
|
||||
* 处理群系统消息
|
||||
* @param {Message} message 群系统消息
|
||||
*/
|
||||
handleGroupSystemMessage(message: Message): object;
|
||||
|
||||
/**
|
||||
* 处理音视频通话信令
|
||||
* @param {any} message 会话最后一条消息或漫游消息
|
||||
*/
|
||||
handleCallKitSignaling(message: any): string | undefined;
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
import type { Message } from '@tencentcloud/lite-chat/basic';
|
||||
import type TUIBase from '../../tui-base';
|
||||
import type {
|
||||
SendMessageParams,
|
||||
GetMessageListParams,
|
||||
SendMessageOptions,
|
||||
GetMessageListHoppingParams,
|
||||
} from '../../type';
|
||||
import type { IMessageHandler } from './message-handler';
|
||||
|
||||
/**
|
||||
* @interface TUIChatService
|
||||
*/
|
||||
export interface ITUIChatService extends TUIBase {
|
||||
messageHandler: IMessageHandler;
|
||||
|
||||
/**
|
||||
* 初始化 Service
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
init: () => void;
|
||||
|
||||
/**
|
||||
* 更新 store 里的 messageList
|
||||
* @param messageList 要进行更新的 messageList
|
||||
* @param type 更新类型
|
||||
* @private
|
||||
*/
|
||||
updateMessageList(messageList: Message[], type: string): void;
|
||||
|
||||
/**
|
||||
* 发送文本消息
|
||||
* @function
|
||||
* @param {SendMessageParams} options 文本消息相关参数
|
||||
* @param {SendMessageOptions}[sendMessageOptions] 消息发送选项
|
||||
* @example
|
||||
* // 发送普通文本消息
|
||||
* let promise = TUIChatService.sendTextMessage({
|
||||
* payload: {
|
||||
* text: 'Hello world!'
|
||||
* },
|
||||
* });
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
* @example
|
||||
* // 发送普通文本消息并携带消息自定义数据
|
||||
* let promise = TUIChatService.sendTextMessage({
|
||||
* payload: {
|
||||
* text: 'Hello world!'
|
||||
* },
|
||||
* cloudCustomData: 'your cloud custom data'
|
||||
* });
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
sendTextMessage(
|
||||
options: SendMessageParams,
|
||||
sendMessageOptions?: SendMessageOptions,
|
||||
): Promise<any>;
|
||||
|
||||
/**
|
||||
* 发送附带 @ 提醒功能的文本消息
|
||||
* @function
|
||||
* @param {SendMessageParams} options 附带 @ 提醒功能的文本消息相关参数
|
||||
* @param {SendMessageOptions}[sendMessageOptions] 消息发送选项
|
||||
* @example
|
||||
* // 发送 @ 消息
|
||||
* let promise = TUIChatService.sendTextAtMessage({
|
||||
* payload: {
|
||||
* text: '@denny @lucy @所有人 今晚聚餐,收到的请回复1',
|
||||
* atUserList: ['denny', 'lucy', TUIChatEngine.TYPES.MSG_AT_ALL] // 'denny' 'lucy' 都是 userID,而非昵称
|
||||
* },
|
||||
* });
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
sendTextAtMessage(
|
||||
options: SendMessageParams,
|
||||
sendMessageOptions?: SendMessageOptions,
|
||||
): Promise<any>;
|
||||
|
||||
/**
|
||||
* 发送图片消息
|
||||
* @function
|
||||
* @param {SendMessageParams} options 图片消息相关参数
|
||||
* @param {SendMessageOptions}[sendMessageOptions] 消息发送选项
|
||||
* @example
|
||||
* // 发送图片消息
|
||||
* let promise = TUIChatService.sendImageMessage({
|
||||
* payload: {
|
||||
* file: file
|
||||
* },
|
||||
* });
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
sendImageMessage(
|
||||
options: SendMessageParams,
|
||||
sendMessageOptions?: SendMessageOptions,
|
||||
): Promise<any>;
|
||||
|
||||
/**
|
||||
* 发送音频消息
|
||||
* @function
|
||||
* @param {SendMessageParams} options 音频消息相关参数
|
||||
* @param {SendMessageOptions}[sendMessageOptions] 消息发送选项
|
||||
* @example
|
||||
* // 发送音频消息
|
||||
* let promise = TUIChatService.sendAudioMessage({
|
||||
* payload: {
|
||||
* file: file
|
||||
* },
|
||||
* });
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
sendAudioMessage(
|
||||
options: SendMessageParams,
|
||||
sendMessageOptions?: SendMessageOptions,
|
||||
): Promise<any>;
|
||||
|
||||
/**
|
||||
* 发送视频消息
|
||||
* @function
|
||||
* @param {SendMessageParams} options 视频消息相关参数
|
||||
* @param {SendMessageOptions}[sendMessageOptions] 消息发送选项
|
||||
* @example
|
||||
* // 发送视频消息
|
||||
* let promise = TUIChatService.sendVideoMessage({
|
||||
* payload: {
|
||||
* file: file
|
||||
* },
|
||||
* });
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
sendVideoMessage(
|
||||
options: SendMessageParams,
|
||||
sendMessageOptions?: SendMessageOptions,
|
||||
): Promise<any>;
|
||||
|
||||
/**
|
||||
* 发送自定义消息
|
||||
* @function
|
||||
* @param {SendMessageParams} options 自定义消息相关参数
|
||||
* @param {SendMessageOptions}[sendMessageOptions] 消息发送选项
|
||||
* @example
|
||||
* // 发送自定义消息
|
||||
* let promise = TUIChatService.sendCustomMessage({
|
||||
* payload: {
|
||||
* data: 'dice', // 用于标识该消息是骰子类型消息
|
||||
* description: String(random(1,6)), // 获取骰子点数
|
||||
* extension: ''
|
||||
* },
|
||||
* });
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
sendCustomMessage(
|
||||
options: SendMessageParams,
|
||||
sendMessageOptions?: SendMessageOptions,
|
||||
): Promise<any>;
|
||||
|
||||
/**
|
||||
* 重发消息的接口,当消息发送失败时,可调用该接口进行重发
|
||||
* @function
|
||||
* @param {Message} message 需要重发的消息对象
|
||||
* @private
|
||||
*/
|
||||
resendMessage(message: Message): Promise<any>;
|
||||
|
||||
/**
|
||||
* 分页拉取指定会话的消息列表的接口,当用户进入会话首次渲染消息列表或者用户“下拉查看更多消息”时,需调用该接口。
|
||||
* @function
|
||||
* @param {GetMessageListParams} [options] 获取漫游消息参数
|
||||
* @example
|
||||
* let promise = TUIChatService.getMessageList();
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
getMessageList(options?: GetMessageListParams): Promise<any>;
|
||||
|
||||
/**
|
||||
* 根据指定的消息 sequence 或 消息时间拉取会话的消息列表
|
||||
* @function
|
||||
* @param {GetMessageListHoppingParams} options 消息实例
|
||||
* @private
|
||||
*/
|
||||
getMessageListHopping(options?: GetMessageListHoppingParams): Promise<any>;
|
||||
|
||||
/**
|
||||
* 清空单聊或群聊本地及云端的消息(不删除会话)
|
||||
* @function
|
||||
* @param {conversationID} string 会话 ID
|
||||
* @example
|
||||
* // 清空群聊 groupID 为 test 的历史消息
|
||||
* let promise = TUIChatService.clearHistoryMessage('GROUPtest');
|
||||
* promise.then((chatResponse) => {
|
||||
* const { result } = chatResponse.data;
|
||||
* });
|
||||
*/
|
||||
clearHistoryMessage(conversationID: string): Promise<any>;
|
||||
}
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
import type { PinConversationParams, MuteConversationParams, SetConversationDraftParams, MarkConversationParams, DeleteConversationParams } from '../../type';
|
||||
|
||||
/**
|
||||
* @interface TUIConversationService
|
||||
*/
|
||||
export interface ITUIConversationService {
|
||||
|
||||
/**
|
||||
* 初始化 Service
|
||||
* @private
|
||||
*/
|
||||
init(): void;
|
||||
|
||||
/**
|
||||
* 切换会话
|
||||
* @function
|
||||
* @param {String} conversationID 会话 ID,conversationID 生成规则:单聊(`C2C${userID}`),群聊(`GROUP${groupID}`)。
|
||||
* @example
|
||||
* // 切换到 public001 群会话
|
||||
* let promise = TUIConversationService.switchConversation('GROUPpublic001');
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
switchConversation(conversationID: string): Promise<any>;
|
||||
|
||||
/**
|
||||
* 获取会话列表
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
getConversationList(): Promise<any>;
|
||||
|
||||
/**
|
||||
* 获取会话资料
|
||||
* 注意:Service API 主要用于跨组件时调用
|
||||
* @function
|
||||
* @param {String} conversationID 会话 ID
|
||||
* @example
|
||||
* // 获取 public001 群会话资料
|
||||
* let promise = TUIConversationService.getConversationProfile('GROUPpublic001');
|
||||
* promise.then((chatResponse) => {
|
||||
* console.log(chatResponse.data.conversation); // 会话资料
|
||||
* });
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
getConversationProfile(conversationID: string): Promise<any>;
|
||||
|
||||
/**
|
||||
* 设置会话已读上报
|
||||
* @function
|
||||
* @param {String} conversationID 会话 ID
|
||||
* @example
|
||||
* let promise = TUIConversationService.setMessageRead('GROUPpublic001');
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
setMessageRead(conversationID: string): Promise<any>;
|
||||
|
||||
/**
|
||||
* 一键清空历史消息
|
||||
* @function
|
||||
* @param {String} conversationID 会话 ID
|
||||
* @example
|
||||
* @private
|
||||
*/
|
||||
clearHistoryMessage(conversationID: string): Promise<any>;
|
||||
}
|
||||
@@ -0,0 +1,528 @@
|
||||
import type {
|
||||
AddMemberParams,
|
||||
ChangGroupOwnerParams,
|
||||
CountersParams,
|
||||
CreateGroupParams,
|
||||
DeleteMemberParams,
|
||||
GetGroupProfileParams,
|
||||
GetMemberListParams,
|
||||
GetMemberProfileParams,
|
||||
GroupAttrParams,
|
||||
JoinGroupParams,
|
||||
KeyListParams,
|
||||
MarkMemberParams,
|
||||
SetCountersParams,
|
||||
SetMemberCustomFiledParams,
|
||||
SetMemberMuteParams,
|
||||
SetMemberNameCardParams,
|
||||
SetMemberRoleParams,
|
||||
UpdateGroupParams,
|
||||
handleGroupApplicationParams,
|
||||
} from '../../type';
|
||||
|
||||
/**
|
||||
* @interface TUIGroupService
|
||||
*/
|
||||
export interface ITUIGroupService {
|
||||
/**
|
||||
* 初始化 Service
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
init(): void;
|
||||
|
||||
/**
|
||||
* 切换群组
|
||||
* @function
|
||||
* @param {String} groupID 群组ID
|
||||
* @example
|
||||
* // 切换到 group1 群
|
||||
* let promise = TUIGroupService.switchGroup('group1');
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
switchGroup(groupID: string): void;
|
||||
|
||||
/**
|
||||
* 获取群详细资料
|
||||
* @function
|
||||
* @param {GetGroupProfileParams} options 获取群详细资料参数
|
||||
* @example
|
||||
* let promise = TUIGroupService.getGroupProfile({
|
||||
* groupID: 'group1',
|
||||
* groupCustomFieldFilter: ['key1','key2']
|
||||
* });
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
getGroupProfile(options: GetGroupProfileParams): Promise<any>;
|
||||
|
||||
/**
|
||||
* 更新群详细资料
|
||||
* @function
|
||||
* @param {UpdateGroupParams} options 更新群详细资料参数
|
||||
* @example
|
||||
* let promise = TUIGroupService.updateGroupProfile({
|
||||
* groupID: 'group1',
|
||||
* name: 'new name', // 修改群名称
|
||||
* introduction: 'this is introduction.', // 修改群简介
|
||||
* groupCustomField: [{ key: 'group_level', value: 'high'}] // 修改群组维度自定义字段
|
||||
* });
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
* @example
|
||||
* let promise = TUIGroupService.updateGroupProfile({
|
||||
* groupID: 'group1',
|
||||
* muteAllMembers: true, // true 表示全体禁言,false表示取消全体禁言
|
||||
* });
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
updateGroupProfile(options: UpdateGroupParams): Promise<any>;
|
||||
|
||||
/**
|
||||
* 创建群组
|
||||
* @function
|
||||
* @param {CreateGroupParams} options 创建群组参数
|
||||
* @example
|
||||
* let promise = TUIGroupService.createGroup({
|
||||
* type: TUIChatEngine.TYPES.GRP_WORK,
|
||||
* name: 'newGroup',
|
||||
* memberList: [{
|
||||
* userID: 'user1',
|
||||
* // 群成员维度的自定义字段,默认情况是没有的,需要开通,详情请参阅自定义字段
|
||||
* memberCustomField: [{key: 'group_member_test', value: 'test'}]
|
||||
* }, {
|
||||
* userID: 'user2'
|
||||
* }] // 如果填写了 memberList,则必须填写 userID
|
||||
* });
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
createGroup(options: CreateGroupParams): Promise<any>;
|
||||
|
||||
/**
|
||||
* 解散群组
|
||||
* @function
|
||||
* @param {string} groupID 群组ID
|
||||
* @example
|
||||
* let promise = TUIGroupService.dismissGroup('group1');
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
dismissGroup(groupID: string): Promise<any>;
|
||||
|
||||
/**
|
||||
* 通过 groupID 搜索群组
|
||||
* @function
|
||||
* @param {string} groupID 群组ID
|
||||
* @example
|
||||
* let promise = TUIGroupService.searchGroupByID('group1');
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
searchGroupByID(groupID: string): Promise<any>;
|
||||
|
||||
/**
|
||||
* 申请加群
|
||||
* @function
|
||||
* @param {JoinGroupParams} options 加群参数
|
||||
* @example
|
||||
* let promise = TUIGroupService.joinGroup({
|
||||
* groupID: 'group1',
|
||||
* applyMessage: 'xxxx'
|
||||
* });
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
joinGroup(options: JoinGroupParams): Promise<any>;
|
||||
|
||||
/**
|
||||
* 退出群组
|
||||
* @function
|
||||
* @param {string} groupID 群组ID
|
||||
* @example
|
||||
* let promise = TUIGroupService.quitGroup('group1');
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
quitGroup(groupID: string): Promise<any>;
|
||||
|
||||
/**
|
||||
* 获取加群申请和邀请进群申请列表
|
||||
* @function
|
||||
* @example
|
||||
* let promise = TUIGroupService.getGroupApplicationList();
|
||||
* promise.then(function(chatResponse) {
|
||||
* const { applicationList } = chatResponse.data;
|
||||
* applicationList.forEach((item) => {
|
||||
* // item.applicant - 申请者 userID
|
||||
* // item.applicantNick - 申请者昵称
|
||||
* // item.groupID - 群 ID
|
||||
* // item.groupName - 群名称
|
||||
* // item.applicationType - 申请类型:0 加群申请,2 邀请进群申请
|
||||
* // item.userID - applicationType = 2 时,是被邀请人的 userID
|
||||
* // 接入侧可调用 handleGroupApplication 接口同意或拒绝加群申请
|
||||
* TUIGroupService.handleGroupApplication({
|
||||
* handleAction: 'Agree',
|
||||
* application: {...item},
|
||||
* });
|
||||
* });
|
||||
* }).catch(function(imError) {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
getGroupApplicationList(): Promise<any>;
|
||||
|
||||
/**
|
||||
* 处理加群申请和邀请进群申请
|
||||
* @function
|
||||
* @param {handleGroupApplicationParams} options 处理申请加群参数
|
||||
* @example
|
||||
* // 通过获取未决列表处理加群申请
|
||||
* let promise = TUIGroupService.getGroupApplicationList();
|
||||
* promise.then(function(chatResponse) {
|
||||
* const { applicationList } = chatResponse.data;
|
||||
* applicationList.forEach((item) => {
|
||||
* if (item.applicationType === 0) {
|
||||
* TUIGroupService.handleGroupApplication({
|
||||
* handleAction: 'Agree',
|
||||
* application: {...item},
|
||||
* });
|
||||
* }
|
||||
* });
|
||||
* }).catch(function(imError) {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
* @example
|
||||
* // 通过获取未决列表处理邀请进群申请
|
||||
* let promise = TUIGroupService.getGroupApplicationList();
|
||||
* promise.then(function(chatResponse) {
|
||||
* const { applicationList } = chatResponse.data;
|
||||
* applicationList.forEach((item) => {
|
||||
* if (item.applicationType === 2) {
|
||||
* TUIGroupService.handleGroupApplication({
|
||||
* handleAction: 'Agree',
|
||||
* application: {...item},
|
||||
* });
|
||||
* }
|
||||
* });
|
||||
* }).catch(function(imError) {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
handleGroupApplication(options: handleGroupApplicationParams): Promise<any>;
|
||||
|
||||
/**
|
||||
* 获取群在线人数
|
||||
* - 注意:仅支持获取直播群在线人数
|
||||
* @function
|
||||
* @param {string} groupID 群组ID
|
||||
* @example
|
||||
* let promise = TUIGroupService.getGroupOnlineMemberCount('group1');
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
getGroupOnlineMemberCount(groupID: string): Promise<any>;
|
||||
|
||||
/**
|
||||
* 转让群组
|
||||
* @function
|
||||
* @param {ChangGroupOwnerParams} options 群资料信息
|
||||
* @example
|
||||
* let promise = TUIGroupService.changeGroupOwner({
|
||||
* groupID: 'group1',
|
||||
* newOwnerID: 'user2'
|
||||
* });
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
changeGroupOwner(options: ChangGroupOwnerParams): Promise<any>;
|
||||
|
||||
/**
|
||||
* 初始化群属性
|
||||
* @function
|
||||
* @param {GroupAttrParams} groupAttributes 群属性信息
|
||||
* @example
|
||||
* let promise = TUIGroupService.initGroupAttributes({
|
||||
* groupID: 'group1',
|
||||
* groupAttributes: { key1: 'value1', key2: 'value2' }
|
||||
* });
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
initGroupAttributes(groupAttributes: GroupAttrParams): Promise<any>;
|
||||
|
||||
/**
|
||||
* 设置群属性
|
||||
* @function
|
||||
* @param {GroupAttrParams} groupAttributes 群属性信息
|
||||
* @example
|
||||
* let promise = TUIGroupService.setGroupAttributes({
|
||||
* groupID: 'group1',
|
||||
* groupAttributes: { key1: 'value1', key2: 'value2' }
|
||||
* });
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
setGroupAttributes(groupAttributes: GroupAttrParams): Promise<any>;
|
||||
|
||||
/**
|
||||
* 删除群属性
|
||||
* @function
|
||||
* @param {KeyListParams} options 群属性参数
|
||||
* @example
|
||||
* let promise = TUIGroupService.deleteGroupAttributes({
|
||||
* groupID: 'group1',
|
||||
* keyList: ['key1', 'key2']
|
||||
* });
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
deleteGroupAttributes(options: KeyListParams): Promise<any>;
|
||||
|
||||
/**
|
||||
* 获取群属性
|
||||
* @function
|
||||
* @param {KeyListParams} options 群属性参数
|
||||
* @example
|
||||
* let promise = TUIGroupService.getGroupAttributes({
|
||||
* groupID: 'group1',
|
||||
* keyList: ['key1', 'key2']
|
||||
* });
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
getGroupAttributes(options: KeyListParams): Promise<any>;
|
||||
|
||||
/**
|
||||
* 设置计数器
|
||||
* @function
|
||||
* @param {SetCountersParams} counters 计数器信息
|
||||
* @example
|
||||
* let promise = TUIGroupService.setGroupCounters({
|
||||
* groupID: 'group1',
|
||||
* counters: { key1: 1, key2: 2 }
|
||||
* });
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
setGroupCounters(counters: SetCountersParams): Promise<any>;
|
||||
|
||||
/**
|
||||
* 递增计数器
|
||||
* @function
|
||||
* @param {CountersParams} options 计数器信息
|
||||
* @example
|
||||
* let promise = TUIGroupService.increaseGroupCounter({
|
||||
* groupID: 'group1',
|
||||
* key: 'key1',
|
||||
* value: 1,
|
||||
* });
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
increaseGroupCounter(options: CountersParams): Promise<any>;
|
||||
|
||||
/**
|
||||
* 递减计数器
|
||||
* @function
|
||||
* @param {CountersParams} options 计数器信息
|
||||
* @example
|
||||
* let promise = TUIGroupService.decreaseGroupCounter({
|
||||
* groupID: 'group1',
|
||||
* key: 'key1',
|
||||
* value: 2,
|
||||
* });
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
decreaseGroupCounter(options: CountersParams): Promise<any>;
|
||||
|
||||
/**
|
||||
* 获取计数器
|
||||
* @function
|
||||
* @param {KeyListParams} options 计数器参数
|
||||
* @example
|
||||
* let promise = TUIGroupService.getGroupCounters({
|
||||
* groupID: 'group1',
|
||||
* keyList: ['key1', 'key2']
|
||||
* });
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
getGroupCounters(options: KeyListParams): Promise<any>;
|
||||
|
||||
// group member
|
||||
/**
|
||||
* 获取群成员列表
|
||||
* @function
|
||||
* @param {GetMemberListParams} options 参数选项
|
||||
* @example
|
||||
* let promise = TUIGroupService.getGroupMemberList({
|
||||
* groupID: 'group1',
|
||||
* count: 15,
|
||||
* offset: 0
|
||||
* });
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
getGroupMemberList(options: GetMemberListParams): Promise<any>;
|
||||
|
||||
/**
|
||||
* 获取群成员资料
|
||||
* @function
|
||||
* @param {GetMemberProfileParams} options 参数选项
|
||||
* @example
|
||||
* let promise = TUIGroupService.getGroupMemberProfile({
|
||||
* groupID: 'group1',
|
||||
* userIDList: ['user1', 'user2'], // 请注意:即使只拉取一个群成员的资料,也需要用数组类型,例如:userIDList: ['user1']
|
||||
* memberCustomFieldFilter: ['group_member_custom'], // 筛选群成员自定义字段:group_member_custom
|
||||
* });
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
getGroupMemberProfile(options: GetMemberProfileParams): Promise<any>;
|
||||
|
||||
/**
|
||||
* 邀请群成员
|
||||
* @function
|
||||
* @param {AddMemberParams} options 参数选项
|
||||
* @example
|
||||
* let promise = TUIGroupService.addGroupMember({
|
||||
* groupID: 'group1',
|
||||
* userIDList: ['user1','user2','user3']
|
||||
* });
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
addGroupMember(options: AddMemberParams): Promise<any>;
|
||||
|
||||
/**
|
||||
* 删除群成员,群主可移除群成员。
|
||||
* - 注意1:旗舰版套餐包支持删除直播群群成员。您可以通过调用此接口实现直播群【封禁群成员】的效果。
|
||||
* - 注意2:踢出时长字段仅直播群(AVChatRoom)支持。
|
||||
* - 注意3:群成员被移除出直播群后,在【踢出时长内】如果用户想再次进群,需要 APP 管理员调用 restapi 解封。过了【踢出时长】,用户可再次主动加入直播群。
|
||||
* @function
|
||||
* @param {DeleteMemberParams} options 参数选项
|
||||
* @example
|
||||
* let promise = TUIGroupService.deleteGroupMember({
|
||||
* groupID: 'group1',
|
||||
* userIDList: ['user1'],
|
||||
* reason: '你违规了,我要踢你!',
|
||||
* duration: 60
|
||||
* });
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
deleteGroupMember(options: DeleteMemberParams): Promise<any>;
|
||||
|
||||
/**
|
||||
* 设置群成员禁言
|
||||
* @function
|
||||
* @param {SetMemberMuteParams} options 参数选项
|
||||
* @example
|
||||
* let promise = TUIGroupService.setGroupMemberMuteTime({
|
||||
* groupID: 'group1',
|
||||
* userID: 'user1',
|
||||
* muteTime: 600 // 禁言10分钟;设为0,则表示取消禁言
|
||||
* });
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
setGroupMemberMuteTime(options: SetMemberMuteParams): Promise<any>;
|
||||
|
||||
/**
|
||||
* 设置群成员角色
|
||||
* @function
|
||||
* @param {SetMemberRoleParams} options 参数选项
|
||||
* @example
|
||||
* let promise = TUIGroupService.setGroupMemberRole({
|
||||
* groupID: 'group1',
|
||||
* userID: 'user1',
|
||||
* role: TUIChatEngine.TYPES.GRP_MBR_ROLE_ADMIN
|
||||
* });
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
setGroupMemberRole(options: SetMemberRoleParams): Promise<any>;
|
||||
|
||||
/**
|
||||
* 设置群成员名片
|
||||
* - 注意1:群主可设置所有群成员的名片。
|
||||
* - 注意2: 群管理员可设置自身和其他普通群成员的群名片。
|
||||
* - 注意3:普通群成员只能设置自身群名片。
|
||||
* @function
|
||||
* @param {SetMemberNameCardParams} options 参数选项
|
||||
* @example
|
||||
* let promise = TUIGroupService.setGroupMemberNameCard({
|
||||
* groupID: 'group1',
|
||||
* userID: 'user1',
|
||||
* nameCard: '用户名片'
|
||||
* });
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
setGroupMemberNameCard(options: SetMemberNameCardParams): Promise<any>;
|
||||
|
||||
/**
|
||||
* 设置群成员自定义字段
|
||||
* @function
|
||||
* @param {SetMemberCustomFiledParams} options 参数选项
|
||||
* @example
|
||||
* let promise = TUIGroupService.setGroupMemberCustomField({
|
||||
* groupID: 'group1',
|
||||
* memberCustomField: [{key: 'group_member_test', value: 'test'}]
|
||||
* });
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
setGroupMemberCustomField(options: SetMemberCustomFiledParams): Promise<any>;
|
||||
|
||||
/**
|
||||
* 标记群成员
|
||||
* - 注意1:仅支持直播群。
|
||||
* - 注意2:只有群主才有权限标记群组中其他成员。
|
||||
* - 注意3:使用该接口需要您购买旗舰版套餐。
|
||||
* @function
|
||||
* @param {MarkMemberParams} options 参数选项
|
||||
* @example
|
||||
* let promise = TUIGroupService.markGroupMemberList({
|
||||
* groupID: 'group1',
|
||||
* userIDList: ['user1', 'user2'],
|
||||
* markType: 1000,
|
||||
* enableMark: true,
|
||||
* });
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
markGroupMemberList(options: MarkMemberParams): Promise<any>;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @interface TUITranslateService
|
||||
*/
|
||||
export interface ITUIReportService {
|
||||
/**
|
||||
* Report key feature usage for analytics
|
||||
* @param code - Event code for analytics
|
||||
* @param feature - Feature name or identifier
|
||||
*/
|
||||
reportFeature(code: number, feature?: string): void;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
import type TUIBase from '../../tui-base';
|
||||
import type { SwitchUserStatusParams, UserIDListParams, UpdateMyProfileParams } from '../../type';
|
||||
|
||||
/**
|
||||
* @interface TUIUserService
|
||||
*/
|
||||
export interface ITUIUserService extends TUIBase {
|
||||
|
||||
/**
|
||||
* 初始化 Service
|
||||
* @function
|
||||
* @private
|
||||
*/
|
||||
init(): void;
|
||||
|
||||
/**
|
||||
* 获取用户资料
|
||||
* @function
|
||||
* @param {UserIDListParams} options [options = undefined] 用户 ID 列表,不传 options 默认查询自己的资料
|
||||
* @example
|
||||
* // 查询自己的资料
|
||||
* let promise = TUIUserService.getUserProfile();
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
* @example
|
||||
* // 查询其他用户的资料
|
||||
* let promise = TUIUserService.getUserProfile({ userIDList: ['user1', 'user2'] });
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
getUserProfile(options?: UserIDListParams): Promise<any>;
|
||||
|
||||
/**
|
||||
* 更新自己的资料信息
|
||||
* @function
|
||||
* @param {UpdateMyProfileParams} options 参数选项
|
||||
* @example
|
||||
* // 更新自己的昵称
|
||||
* let promise = TUIUserService.updateMyProfile({
|
||||
* nick: 'newNick'
|
||||
* });
|
||||
* promise.catch((error) => {
|
||||
* // 调用异常时业务侧可以通过 promise.catch 捕获异常进行错误处理
|
||||
* });
|
||||
*/
|
||||
updateMyProfile(options: UpdateMyProfileParams): Promise<any>;
|
||||
}
|
||||
Reference in New Issue
Block a user