getUsersInfo
Description
info
Get the personal information of specified users. This API is used for retrieving public information between non-friends, such as nickname, avatar, etc.
- iOS
- Android
- Flutter
- uni-app
- Browser/Electron/MiniProgram
- React-Native
- Unity
Function Prototype
Future<List<PublicUserInfo>> getUsersInfo({
required List<String> userIDList,
String? operationID,
})
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| userIDList | List< String> | Yes | User ID list |
| groupID | String | No | Group ID |
Return Result
| Parameter Name | Parameter Type | Description |
|---|---|---|
| then | List< PublicUserInfo > | Success callback |
| onError | Function | Failure callback |
Code Example
await OpenIM.iMManager.userManager.getUsersInfo(userIDList: []);
// todo
Function Prototype
- (void)getUsersInfo:(NSArray<NSString *> *)userIDs
onSuccess:(nullable OIMPublicUsersInfoCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| userIDs | NSArray<NSString *> | Yes | User ID list |
| groupID | NSString | No | Group ID |
Return Result
| Parameter Name | Parameter Type | Description |
|---|---|---|
| onSuccess | OIMPublicUserInfo | Success return |
| onFailure | OIMFailureCallback | Failure return |
Code Example
[OIMManager.manager getUsersInfo:@[]
groupID:@""
onSuccess:^(NSArray<OIMPublicUserInfo *> * _Nullable usersInfo) {
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
}];
Function Prototype
public void getUsersInfo(OnBase<List<PublicUserInfo>> callBack, List<String> uidList)
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| callBack | OnBase<List<PublicUserInfo>> | Yes | Callback interface |
| uidList | List<String> | Yes | User ID collection |
Code Example
OpenIMClient.getInstance().userInfoManager.getUsersInfo(new OnBase<List<PublicUserInfo>>() {
@Override
public void onError(int code, String error) {
// todo: Handle error message
}
@Override
public void onSuccess(List<PublicUserInfo> data) {
// todo: Request successful, return PublicUser
}
},uidList);
Function Prototype
IMSDK.getUsersInfo(userIDList: string[], operationID?: string): Promise<WsResponse<PublicUserItem[]>>
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| userIDList | string[] | Yes | User ID list |
| operationID | string | No | Operation ID, used to pinpoint issues, keep unique, prefer time+random |
Return Result
| Parameter Name | Parameter Type | Description |
|---|---|---|
| Promise.then() | Promise<WsResponse<PublicUserItem[]>> | Queried user info list |
| Promise.catch() | Promise<WsResponse> | Failure callback |
Code Example
import { getSDK } from '@openim/wasm-client-sdk';
const IMSDK = getSDK();
// use in electron with ffi
// import { getWithRenderProcess } from '@openim/electron-client-sdk/lib/render';
// const { instance: IMSDK } = getWithRenderProcess();
// use in mini program
// import { getSDK } from '@openim/client-sdk';
// const IMSDK = getSDK();
const userIDList = ['userID1', 'userID2'];
IMSDK.getUsersInfo(userIDList)
.then(({ data }) => {
// data: Queried user info list
})
.catch(({ errCode, errMsg }) => {
// Call failed
});
Function Prototype
IMSDK.asyncApi('getUsersInfo', operationID: string, userIDList: string[]): Promise<PublicUserItem[]>
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| userIDList | string[] | Yes | User userID list |
| operationID | string | Yes | Operation ID, used to pinpoint issues, keep unique, prefer time+random |
Return Result
Use the
openim-uniapp-polyfillpackage to make the function Promise. When calling, you need to usethenandcatchto determine and handle success and failure callbacks.
| Parameter Name | Parameter Type | Description |
|---|---|---|
| Promise.then() | Promise<PublicUserItem[]> | Queried user info list |
| Promise.catch() | Promise<CatchResponse> | Failure callback |
Code Example
import IMSDK from 'openim-uniapp-polyfill';
const userIDList = ['userID1', 'userID2'];
IMSDK.asyncApi('getUsersInfo', IMSDK.uuid(), userIDList)
.then((data) => {
// data: Queried user info list
})
.catch(({ errCode, errMsg }) => {
// Call failed
});
Function Prototype
OpenIMSDK.getUsersInfo(userIDList: string[], operationID?: string): Promise<PublicUserItem[]>
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| userIDList | string[] | Yes | User userID list |
| operationID | string | No | Operation ID, used to pinpoint issues, keep unique, prefer time+random |
Return Result
| Parameter Name | Parameter Type | Description |
|---|---|---|
| Promise.then() | Promise<PublicUserItem[]> | Queried user info list |
| Promise.catch() | Promise<OpenIMApiError> | Failure callback |
Code Example
import OpenIMSDK from "@openim/rn-client-sdk";
const userIDList = ['userID1', 'userID2'];
OpenIMSDK.getUsersInfo(userIDList)
.then((data) => {
// data: Queried user info list
})
.catch((error) => {
// Call failed
});
Function Prototype
public static void GetUsersInfo(OnBase<List<PublicUserInfo>> cb, string[] userIds, string groupId)
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| cb | OnBase<List<PublicUserInfo>> | Yes | Callback |
| userIds | string[] | Yes | User ID collection |
| groupId | String | No | Group ID |
Code Example
IMSDK.GetUsersInfo((list,errCode,errMsg)=>{
if(list!= null){
}else{
}
}, userIds, groupId);