- Android
- iOS
- JavaScript
- Flutter
- ReactNative
- HarmonyOS
Get all chatroom attributes.
API Definition
/**
* get all chatroom attributes
*
* @param chatroomId chatroom ID
* @param callback completion callback
*/
void getAllAttributes(String chatroomId, IChatroomAttributesCallback callback);
interface IChatroomAttributesCallback {
/**
* completion callback
*
* @param errorCode JErrorCode.NONE indicates success
* @param attributes retrieved attribute list
*/
void onComplete(int errorCode, Map<String, String> attributes);
}
Example
JIM.getInstance().getChatroomManager().getAllAttributes("chatroomId1", new IChatroomManager.IChatroomAttributesCallback() {
@Override
public void onComplete(int errorCode, Map<String, String> attributes) {
}
});
Get all chatroom attributes.
API Definition
/// get all chatroom attributes
/// - Parameters:
/// - chatroomId: chatroom ID
/// - completeBlock: Completion callback. JErrorCodeNone indicates success.
- (void)getAllAttributesFromChatroom:(NSString *)chatroomId
complete:(void (^)(JErrorCode code, NSDictionary <NSString *, NSString *> *attributes))completeBlock;
Example
[JIM.shared.chatroomManager getAllAttributesFromChatroom:@"chatroomId1" complete:^(JErrorCode code, NSDictionary<NSString *,NSString *> * _Nonnull attributes) {
}];
Not supported.
Get all chatroom attributes. Call this after joining the chatroom successfully; the SDK returns empty data if the chatroom has not been joined.
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 |
Callback
| Property | Type | Description | Version |
|---|---|---|---|
| chatroom | Object | Conversation object. | 1.6.0 |
| chatroom.id | String | Chatroom ID. | 1.6.0 |
| chatroom.attributes | Array | All chatroom attributes. See the example for the data structure. | 1.6.0 |
Example
let chatroom = {
id: 'chatroom1001'
};
jim.getAllChatRoomAttributes(chatroom).then((chatroom) => {
let { id, attributes } = chatroom;
/*
attributes =>
[
{ key: 'name', value: 'xiaoshan' },
{ key: 'age', value: 18 },
]
*/
}, (error) => {
console.log('error', error)
});
Get all chatroom attributes.
Example
import JuggleIM from 'juggleim-rnsdk';
const attributes = await JuggleIM.getChatroomAttributes("chatroomId1");
Get all chatroom attributes.
Example
const attributes = await JuggleIm.instance.getChatroomManager().getAllAttributes("chatroomId1");