- Android
- iOS
- JavaScript
- Flutter
- ReactNative
- HarmonyOS
Remove chatroom attributes in batches. Removals synchronize automatically to all chatroom members and are returned through the chatroom attribute-change event.
API Definition
/**
* remove chatroom attributes
*
* @param chatroomId chatroom ID
* @param keys List of attribute keys to remove. A key not set by the current user cannot be removed.
* @param callback Completion callback.
* JErrorCode.NONE indicates that all attributes were removed successfully.
* Other codes indicate that one or more keys could not be removed. Every failed key is returned with its error code; see JErrorCode for the corresponding definition.
*/
void removeAttributes(String chatroomId, List<String> keys, IChatroomAttributesUpdateCallback callback);
Example
List<String> keys = new ArrayList<>();
keys.add("Key1");
JIM.getInstance().getChatroomManager().removeAttributes("chatroomId1", keys, new IChatroomManager.IChatroomAttributesUpdateCallback() {
@Override
public void onComplete(int errorCode, Map<String, Integer> failedKeys) {
}
});
Remove chatroom attributes in batches. Removals synchronize automatically to all chatroom members and are returned through the chatroom attribute-change event.
API Definition
/// remove chatroom attributes
/// - Parameters:
/// - keys: List of attribute keys to remove. A key not set by the current user cannot be removed.
/// - chatroomId: chatroom ID
/// - completeBlock: Completion callback.
/// JErrorCodeNone indicates that all attributes were removed successfully.
/// Other codes indicate that one or more keys could not be removed. Every failed key is returned with its error code; see JErrorCode for the corresponding definition.
- (void)removeAttributes:(NSArray <NSString *> *)keys
forChatroom:(NSString *)chatroomId
complete:(void (^)(JErrorCode code, NSDictionary<NSString *, NSNumber *> *failedKeys))completeBlock;
Example
NSArray <NSString *> *keys = @[@"key1"];
[JIM.shared.chatroomManager removeAttributes:keys
forChatroom:@"chatroomId1"
complete:^(JErrorCode code, NSDictionary<NSString *,NSNumber *> *failedKeys) {
}];
Remove chatroom attributes in batches. Removals synchronize automatically to all chatroom members and are returned through the chatroom attribute-removal event.
Batch attribute removals can fail. For example, a removal fails when a key was set by another member and isForce is not true.
Parameters
| Name | Type | Required | Default | Description | Version |
|---|---|---|---|---|---|
| chatroom | Object | Yes | None | Chatroom object. | 1.6.0 |
| chatroom.id | String | Yes | None | Chatroom ID. | 1.6.0 |
| chatroom.attributes | Array | Yes | None | Attribute list to remove. | 1.6.0 |
chatroom.attributes item
| Name | Type | Required | Default | Description | Version |
|---|---|---|---|---|---|
| key | String | Yes | None | Attribute key to remove. | 1.6.0 |
| isForce | Boolean | No | false | Whether to force the removal. | 1.6.0 |
Example
let chatroom = {
id: 'chatroom1001',
attributes: [
{ key: 'name', isForce: true },
{ key: 'age' }
]
};
jim.removeChatroomAttributes(chatroom).then((result) => {
console.log('remove chatroom attributes successfully');
/*
result => { success: [{ key: 'name' }], fail:[{ key: 'age', code: 14006 }] }
*/
}, (error) => {
console.log('error', error);
});
Remove chatroom attributes in batches. Removals synchronize automatically to all chatroom members and are returned through the chatroom attribute-change event.
Example
List<String> keys = ["key1"];
await JuggleIm.instance.getChatroomManager().removeAttributes("chatroomId1", keys);
Remove chatroom attributes in batches. Removals synchronize automatically to all chatroom members and are returned through the chatroom attribute-change event.
Example
import JuggleIM from 'juggleim-rnsdk';
const keys = ["key1"];
await JuggleIM.removeChatroomAttributes("chatroomId1", keys);
Remove chatroom attributes in batches. Removals synchronize automatically to all chatroom members and are returned through the chatroom attribute-change event.
Example
let keys = ["key1"];
JuggleIm.instance.getChatroomManager().removeAttributes("chatroomId1", keys);