increaseGroupCounter
Introduction
Increase the group counter value.
This method only works with Ultimate Edition, you can find the pricing plan here.
The key of a single group counter does not exceed 128 bytes, and the value must be an integer type (maximum support for 64-bit signed integer).
The setGroupCounters, increaseGroupCounter, and decreaseGroupCounter interfaces are merged and calculated. The SDK limits a maximum of 20 calls within 5 seconds for a single logged-in user. If the limit is exceeded, the interface will return error code 8516.
The "value" parameter in the interface parameter is the change amount. After calling the interface, the passed change amount will be added to the current value.
If the key of the counter you are about to set already exists, the incremental operation will be performed directly on the current value based on the passed "value" parameter. Otherwise, the key will be added, and the incremental operation will be performed based on the passed "value" parameter on the default value of 0.
Works since version 1.0.25
Parameter details
Parameter name | Parameter type | Required | Description |
---|---|---|---|
groupID | string | yes | The group ID. |
key | string | yes | The counter key to set. |
value | number | yes | The change amount of a group counter. |
Returned template
V2TimValueCallback<Map<String, number>>
{
code : number
desc : string
data : Map<String, number>
}
Return value details
name | type | description |
---|---|---|
code | number | Request result: Error codes. 0 means success. |
desc | string | The description of the error. It will be empty if success. |
data | Result list of increasing group counter value operation. |
Code example
import { TencentImSDKPlugin } from 'react-native-tim-js';
const IncreaseGroupCounterresponse = await TencentImSDKPlugin.v2TIMManager
.getGroupManager()
.increaseGroupCounter(
groupID,
key,
parseInt(value, 10)
);
if (IncreaseGroupCounterresponse.code === 0) {
IncreaseGroupCounterresponse.data;
}