- Android
- iOS
- JavaScript
- Flutter
- ReactNative
User Information Model
UserInfo is the user information object provided by the SDK.
| Property | Type | Description | Version |
|---|---|---|---|
| userId | String | User ID. | 1.0.0 |
| userName | String | User name. | 1.0.0 |
| portrait | String | User avatar URL. | 1.0.0 |
| extra | Map<String, String> | Extension fields. | 1.0.0 |
| updatedTime | long | Update timestamp. | 1.0.0 |
Get User Information
//API definition
/**
* get user information
* @param userId user ID
* @return user information
*/
UserInfo getUserInfo(String userId);
//Example code
UserInfo userInfo = JIM.getInstance().getUserInfoManager().getUserInfo("userId");
Get User Information in Batches
//API definition
/**
* get user information in batches
* @param userIdList user ID list
* @return user information list
*/
List<UserInfo> getUserInfoList(List<String> userIdList);
//Example code
List<String> userIdList = new ArrayList<>();
userIdList.add("userId1");
userIdList.add("userId2");
List<UserInfo> userInfoList = JIM.getInstance().getUserInfoManager().getUserInfoList(userIdList);
Fetch the Latest User Information from the Server
//API definition
/**
* get the latest user information from the server
* @param userId user ID
* @param callback result callback
*/
void fetchUserInfo(String userId, JIMConst.IResultCallback<UserInfo> callback);
//Example code
JIM.getInstance().getUserInfoManager().fetchUserInfo("userId", new JIMConst.IResultCallback<UserInfo>() {
@Override
public void onSuccess(UserInfo userInfo) {
}
@Override
public void onError(int errorCode) {
}
});
User Information Model
JUserInfo is the user information object provided by the SDK.
| Property | Type | Description | Version |
|---|---|---|---|
| userId | NSString | User ID. | 1.0.0 |
| userName | NSString | User name. | 1.0.0 |
| portrait | NSString | User avatar URL. | 1.0.0 |
| extraDic | NSDictionary <NSString , NSString > | Extension fields. | 1.0.0 |
| updatedTime | long long | Update timestamp. | 1.0.0 |
Get User Information
//API definition
/// get user information
/// - Parameter userId: user ID
- (JUserInfo *)getUserInfo:(NSString *)userId;
//Example code
JUserInfo *userInfo = [JIM.shared.userInfoManager getUserInfo:@"userId1"];
Get User Information in Batches
//API definition
/// get user information in batches
/// - Parameter userIdList: user ID list
- (NSArray <JUserInfo *> *)getUserInfoList:(NSArray <NSString *> *)userIdList;
//Example code
NSArray <JUserInfo *> *userInfoList = [JIM.shared.userInfoManager getUserInfoList:@[@"userId1", @"userId2"]];
Fetch the Latest User Information from the Server
//API definition
/// get the latest user information from the server
/// - Parameters:
/// - userId: user ID
/// - successBlock: success callback
/// - errorBlock: failure callback
- (void)fetchUserInfo:(NSString *)userId
success:(void (^)(JUserInfo *userInfo))successBlock
error:(void (^)(JErrorCode code))errorBlock;
//Example code
[JIM.shared.userInfoManager fetchUserInfo:@"userId"
success:^(JUserInfo *userInfo) {
} error:^(JErrorCode code) {
}];
User Information Model
UserInfo is the user information object provided by the SDK.
| Property | Type | Description | Version |
|---|---|---|---|
| userId | String | User ID. | 1.0.0 |
| userName | String | User name. | 1.0.0 |
| portrait | String | User avatar URL. | 1.0.0 |
| extraMap | Map<String, String>? | Extension fields. | 1.0.0 |
Get User Information
//API definition
/**
* get user information
* @param userId user ID
* @return user information
*/
Future<UserInfo?> getUserInfo(String userId) async
//Example code
UserInfo? userInfo = await JuggleIm.instance.getUserInfo("userId");