Skip to main content

Manage Tag Information Data

SDK supports tag creation starting from version 5.6.11.

This article describes how an app can use the interfaces under RCIMIWEngine to create and manage tag information data. The client SDK supports users in creating tag information (RCIMIWTagInfo) for marking and grouping conversations. Each user can create up to 20 tags. The tag information data created by app users will be synchronized to the RC server.

The definition of tag information (RCIMIWTagInfo) is as follows:

ParameterTypeDescription
tagIdNSStringThe unique identifier of the tag, a string type, with a length of no more than 10 characters.
tagNameNSStringThe tag name, with a length of no more than 15 characters. Tag names can be duplicated.
timestamplong longThe timestamp is provided by the SDK's internal protocol stack.

Note

This article only describes how to manage tag information data. For information on how to set tags for conversations and how to retrieve conversation data by tags, please refer to Set and Use Conversation Tags.

Create Tag Information​

Create a tag. Each user can create up to 20 tags.

Method​

Future<int> createTag(String tagId, String tagName, {IRCIMIWCreateTagCallback? callback});

Parameter Description​

ParameterTypeDescription
tagIdStringThe unique identifier of the tag, a string type, with a length of no more than 10 characters.
tagNameStringThe tag name, with a length of no more than 15 characters. Tag names can be duplicated.
callbackIRCIMIWCreateTagCallbackEvent callback.

Return Value​

Return ValueDescription
Future<int>The status code of the current interface operation. 0 indicates a successful call, and the specific result needs to be implemented in the interface callback; non-0 indicates that the current interface call operation failed, and the interface callback will not be triggered. For detailed errors, refer to the error codes.

Code Example​

IRCIMIWCreateTagCallback? callback = IRCIMIWCreateTagCallback(onTagCreated: (int? code) {
//...
});

int? ret = await engine?.createTag(tagId, tagName, callback:callback);

Remove Tag Information​

Remove a tag. Only the tagId from RCIMIWTagInfo is required to remove tag information.

Method​

Future<int> removeTag(String tagId, {IRCIMIWRemoveTagCallback? callback});

Parameter Description​

ParameterTypeDescription
tagIdStringThe unique identifier of the tag, a string type, with a length of no more than 10 characters.
callbackIRCIMIWRemoveTagCallbackEvent callback.

Return Value​

Return ValueDescription
Future<int>The status code of the current interface operation. 0 indicates a successful call, and the specific result needs to be implemented in the interface callback; non-0 indicates that the current interface call operation failed, and the interface callback will not be triggered. For detailed errors, refer to the error codes.

Code Example​

IRCIMIWRemoveTagCallback? callback = IRCIMIWRemoveTagCallback(onTagRemoved: (int? code) {
//...
});

int? ret = await engine?.removeTag(tagId, callback:callback);

Edit Tag Information​

Update tag information. Only the tag name (tagName) field in RCIMIWTagInfo can be modified. The length should not exceed 15 characters, and tag names can be duplicated.

Method​

Future<int> updateTagNameById(String tagId, String newName, {IRCIMIWUpdateTagNameByIdCallback? callback});

Parameter Description​

ParameterTypeDescription
tagIdStringThe unique identifier of the tag, a string type, with a length of no more than 10 characters.
newNameStringThe new tag name, with a length of no more than 15 characters. Tag names can be duplicated.
callbackIRCIMIWUpdateTagNameByIdCallbackEvent callback.

Return Value​

Return ValueDescription
Future<int>The status code of the current interface operation. 0 indicates a successful call, and the specific result needs to be implemented in the interface callback; non-0 indicates that the current interface call operation failed, and the interface callback will not be triggered. For detailed errors, refer to the error codes.

Code Example​

IRCIMIWUpdateTagNameByIdCallback? callback = IRCIMIWUpdateTagNameByIdCallback(onTagNameByIdUpdated: (int? code) {
//...
});

int? ret = await engine?.updateTagNameById(tagId, newName, callback:callback);

Get Tag Information List​

Retrieve the list of tag information created by the current user. The success callback will return a list of RCIMIWTagInfo.

Method​

Future<int> getTags({IRCIMIWGetTagsCallback? callback});

Parameter Description​

ParameterTypeDescription
callbackIRCIMIWGetTagsCallbackEvent callback.

Return Value​

Return ValueDescription
Future<int>The status code of the current interface operation. 0 indicates a successful call, and the specific result needs to be implemented in the interface callback; non-0 indicates that the current interface call operation failed, and the interface callback will not be triggered. For detailed errors, refer to the error codes.

Code Example​

IRCIMIWGetTagsCallback? callback = IRCIMIWGetTagsCallback(onSuccess: (List<RCIMIWTagInfo>? t) {
//...
}, onError: (int? code) {
//...
});

int? ret = await engine?.getTags(callback:callback);