setGroupMemberRole static method
Future<V2TimCallback>
setGroupMemberRole(
{ - required String groupID,
- required String userID,
- required int role,
})
Implementation
static Future<V2TimCallback> setGroupMemberRole({
required String groupID,
required String userID,
required int role,
}) async {
int flag = 0x00;
flag = flag | 0x01 << 1;
String param = json.encode({
"group_modify_member_info_group_id": groupID,
"group_modify_member_info_identifier": userID,
"group_modify_member_info_member_role": role,
"group_modify_member_info_modify_flag": flag,
});
String userData = Tools.generateUserData();
Pointer<Uint8> user_data = Tools.string2PointerInt8(userData);
Pointer<Uint8> json_group_modifymeminfo_param = Tools.string2PointerInt8(param);
int res = desktopSDK.D_TIMGroupModifyMemberInfo(json_group_modifymeminfo_param, user_data);
if (res != TIMResult.TIM_SUCC) {
return V2TimCallback.fromJson({
"code": res,
"desc": "",
});
} else {
Map<String, dynamic> data = await getAsyncData(apiKey: userData);
return V2TimCallback.fromJson({
"code": data["code"],
"desc": data["desc"],
});
}
}