GroupSetGroupCounters, GroupIncreaseGroupCounter, and GroupDecreaseGroupCounter APIs together can be called by a logged-in user up to 20 times every five seconds in the SDK, and the 8516 error code will be called back if the limit is exceeded.GroupGetGroupCounters API can be called by a logged-in user up to 20 times every five seconds in the SDK, and the 8516 error code will be called back if the limit is exceeded.GroupSetGroupCounters (details) API to set group counters. After group counters are set, the GroupCounterChangedCallback (details) callback will be triggered. For the usage of the GroupCounterChangedCallback callback, see Group Counter Change Notification.key of the group counter to be set already exists, the value of key is updated directly. Otherwise, a key-value pair will be added.GroupSetGroupCounters API to set the values of counters key1 and key2 to 0// Set a group counterList<GroupCounter> list = new List<GroupCounter>{new GroupCounter{group_counter_key = "key",group_counter_value = 1}};TIMResult res = TencentIMSDK.GroupSetGroupCounters("groupID", list, (int code, string desc, List<GroupCounter> results, string user_data)=>{// Async result of the group counter setting});
GroupIncreaseGroupCounter (details) API to increment the value of a group counter. After the value of the group counter is incremented, the GroupCounterChangedCallback (details) callback will be triggered. For the usage of the GroupCounterChangedCallback callback, see Group Counter Change Notification.value is the change value. Each time when the API is called, the current value is incremented by the value passed in.key of the group counter to be set already exists, the current value is directly incremented by the value passed in. Otherwise, a key will be added, and the default value (0) is incremented by the value passed in.key1 is 8. After you call the GroupIncreaseGroupCounter API to pass in an increment value 2, the final value of key1 becomes 10.// Increment the value of a group counterTIMResult res = TencentIMSDK.GroupIncreaseGroupCounter("groupID", "key1", 2, (int code, string desc, List<GroupCounter> results, string user_data)=>{// Async result of the group counter increment});
GroupDecreaseGroupCounter (details) API to decrement the value of a group counter. After the value of the group counter is decremented, the GroupCounterChangedCallback (details) callback will be triggered. For the usage of the GroupCounterChangedCallback callback, see Group Counter Change Notification.value is the change value. Each time when the API is called, the current value is decreased by the value passed in.key of the group counter to be set already exists, the current value is directly decremented by the value passed in. Otherwise, a key will be added, and the default value (0) is decreased by the value passed in.key1 is 8. After you call the GroupDecreaseGroupCounter API to pass in a decrement value 2, the final value of key1 becomes 6.// Decrement the value of a group counterTIMResult res = TencentIMSDK.GroupDecreaseGroupCounter("groupID", "key1", 2, (int code, string desc, List<GroupCounter> results, string user_data)=>{// Async result of the group counter decrement});
GroupGetGroupCounters (details) API to pass in a set of keys to get the information of the corresponding group counters. The API will return all key-value pairs matching the keys passed in.GroupGetGroupCounters`` API to get the values of counters key1 and key2`// Get group countersTIMResult res = TencentIMSDK.GroupGetGroupCounters("groupID", new List<string> {"key1", "key2"}, (int code, string desc, List<GroupCounter> results, string user_data)=>{// Async result of the group counter getting});
GroupSetGroupCounters, GroupIncreaseGroupCounter, or GroupDecreaseGroupCounter API to modify group counters, the SDK will trigger the GroupCounterChangedCallback callback and return the updated values of value.SetGroupCounterChangedCallback (details) API to add a group listener.// Set the group counter change callbackTencentIMSDK.SetGroupCounterChangedCallback((string group_id, string group_counter_key, ulong group_counter_new_value, string user_data) => {});
masukan