getGroupAttributes static method
Implementation
static Future<V2TimValueCallback<Map<String, String>>> getGroupAttributes({
required String groupID,
List<String>? keys,
}) async {
String userData = Tools.generateUserData();
Pointer<Uint8> user_data = Tools.string2PointerInt8(userData);
Pointer<Uint8> json_keys = Tools.string2PointerInt8(json.encode(keys ?? List.empty(growable: true)));
Pointer<Uint8> group_id = Tools.string2PointerInt8(groupID);
int res = desktopSDK.D_TIMGroupGetGroupAttributes(group_id, json_keys, user_data);
if (res != TIMResult.TIM_SUCC) {
return V2TimValueCallback<Map<String, String>>.fromJson({
"code": res,
"desc": "",
});
} else {
Map<String, dynamic> data = await getAsyncData(apiKey: userData);
List<Map<String, dynamic>> dataList = List<Map<String, dynamic>>.from(json.decode(data["json_param"].isEmpty ? json.encode([]) : data["json_param"]));
List<Map<String, String>> list = List<Map<String, String>>.empty(growable: true);
for (Map<String, dynamic> element in dataList) {
list.add({element["group_attribute_key"].toString(): element["group_attribute_value"].toString()});
}
return V2TimValueCallback<Map<String, String>>.fromJson({"code": data["code"], "desc": data["desc"], "data": list});
}
}