acceptGroupApplication
功能介绍
同意某一条加群申请
参数详解
参数名称 | 参数类型 | 是否必填 | 描述 |
---|---|---|---|
groupID | string | 是 | 加入的群组id |
reason | string | 否 | 同意原因 |
reason | string | 否 | 请求者id |
toUser | string | 是 | 判决者id |
addTime | number | 否 | 申请时间 |
type | GroupApplicationTypeEnum | 否 | 申请类型 |
返回模板
V2TimCallback
{
code : number
desc : string
}
返回值详解
名称 | 数值类型 | 描述 |
---|---|---|
code | number | 请求结果错误码 |
desc | string | 请求结果描述符 |
代码示例
import { TencentImSDKPlugin } from 'react-native-tim-js';
// 获取加群列表
const getGroupApplicationListRes = await TencentImSDKPlugin.v2TIMManager
.getGroupManager()
.getGroupApplicationList();
if (getGroupApplicationListRes.code === 0) {
// 获取成功
getGroupApplicationListRes.data?.groupApplicationList?.forEach(
async (element) => {
if (element != null) {
const acceptGroupApplicationRes =
await TencentImSDKPlugin.v2TIMManager
.getGroupManager()
.acceptGroupApplication(
element.groupID, // 加入的群组id
element.fromUser!, // 请求者id
element.toUser!, // 判决者id
'reason', // 同意原因
element.addTime, // 申请时间
element.type // 申请类型
);
if (acceptGroupApplicationRes.code === 0) {
// 同意成功
}
}
}
);
}