deleteTopicFromCommunity method
Implementation
Future<V2TimValueCallback<List<V2TimTopicOperationResult>>>
deleteTopicFromCommunity({
required String groupID,
required List<String> topicIDList,
}) async {
try {
final res = await wrappedPromiseToFuture(timeweb!
.deleteTopicFromCommunity(
mapToJSObj({"groupID": groupID, "topicIDList": topicIDList})));
var code = res.code;
if (code == 0) {
final successTopicList = jsToMap(res.data)["successTopicList"] as List;
final failureTopicList = jsToMap(res.data)["failureTopicList"] as List;
final formatedSuccessList = successTopicList
.map((e) => {
"topicID": jsToMap(e)["topicID"],
})
.toList();
final formatedFailureList = failureTopicList
.map((e) => {
"errorCode": jsToMap(e)["code"],
"errorMessage": jsToMap(e)["message"],
"topicID": jsToMap(e)["topicID"],
})
.toList();
return CommonUtils.returnSuccess<List<V2TimTopicOperationResult>>(
[...formatedSuccessList, ...formatedFailureList]);
} else {
return CommonUtils.returnErrorForValueCb<
List<V2TimTopicOperationResult>>("deleteTopicFromCommunity Failed");
}
} catch (error) {
return CommonUtils.returnErrorForValueCb<List<V2TimTopicOperationResult>>(
error.toString());
}
}