getSpecifiedFriendsInfo
Feature Introduction
Note
(1) Retrieve specific friend's nickname, avatar, and remarks. (2) This function fetches data from the APP locally. A maximum of 10,000 entries is recommended per fetch.
- iOS
- Android
- Flutter
- uni-app
- Browser/Electron/MiniProgram
- React-Native
- Unity
Function Prototype
Future<List<FriendInfo>> getFriendsInfo({
required List<String> userIDList,
String? operationID,
})
Input Parameters
Parameter Name | Data Type | Required | Description |
---|---|---|---|
userIDList | List<String> | Yes | List of user IDs |
Return Value
Parameter Name | Data Type | Description |
---|---|---|
~ | List< FriendInfo > | Successful return |
Code Example
List<FriendInfo> list = await OpenIM.iMManager.friendshipManager.getFriendsInfo(userIDList: []);
// todo
Function Prototype
- (void)getSpecifiedFriendsInfo:(NSArray <NSString *> *)usersID
onSuccess:(nullable OIMFriendsInfoCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;
Input Parameters
Parameter Name | Data Type | Required | Description |
---|---|---|---|
usersID | NSArray <NSString *> | Yes | List of user IDs |
Return Value
Parameter Name | Data Type | Description |
---|---|---|
onSuccess | NSArray< OIMFriendInfo * > | Successful return |
onFailure | OIMFailureCallback | Failure return |
Code Example
[OIMManager.manager getSpecifiedFriendsInfo:@[]
onSuccess:^(NSArray<OIMFriendInfo *> * _Nullable userInfos) {
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
}];
Function Prototype
public void getFriendsInfo(OnBase<List<UserInfo>> base, List<String> uidList)
Input Parameters
Parameter Name | Data Type | Required | Description |
---|---|---|---|
callBack | OnBase<List<UserInfo>> | Yes | Callback method |
uidList | List<String> | Yes | List of user IDs |
Code Example
OpenIMClient.getInstance().friendshipManager.getFriendsInfo(new OnBase<List<UserInfo>>() {
@Override
public void onError(int code, String error) {
}
@Override
public void onSuccess(List<UserInfo> data) {
}
},uidList);
Function Prototype
IMSDK.getDesignatedFriendsInfo(userIDList: string[], operationID?: string): Promise<WsResponse<FullUserItem[]>>
Input Parameters
Parameter Name | Data Type | Required | Description |
---|---|---|---|
userIDList | string[] | Yes | List of user IDs |
Return Value
Parameter Name | Data Type | Description |
---|---|---|
Promise.then() | Promise<WsResponse<FullUserItem[]>> | List of friend information |
Promise.catch() | Promise<WsResponse> | Failure callback |
Code Example
import { getSDK } from 'open-im-sdk-wasm';
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 { OpenIMSDK } from 'open-im-sdk';
// const IMSDK = new OpenIMSDK();
const userIDList = ['userID1', 'userID2'];
IMSDK.getDesignatedFriendsInfo(userIDList)
.then(({ data }) => {
// Successful call
})
.catch(({ errCode, errMsg }) => {
// Failed call
});
Function Prototype
IMSDK.asyncApi('getDesignatedFriendsInfo', operationID: string, userIDList: string[]): Promise<FullUserItem[]>
Input Parameters
Parameter Name | Data Type | Required | Description |
---|---|---|---|
operationID | string | Yes | Operation ID for problem tracking; unique ID recommended using current time and random number |
userIDList | string[] | Yes | List of user IDs |
Return Value
The function is Promise-wrapped through the
openim-uniapp-polyfill
package. Usethen
andcatch
to handle successful and failed callbacks.
Parameter Name | Data Type | Description |
---|---|---|
Promise.then() | Promise<FullUserItem[]> | List of friend information |
Promise.catch() | Promise<CatchResponse> | Failure callback |
Code Example
import IMSDK from 'openim-uniapp-polyfill';
const userIDList = ['userID1', 'userID2'];
IMSDK.asyncApi('getDesignatedFriendsInfo', IMSDK.uuid(), userIDList)
.then((data) => {
// Successful call
})
.catch(({ errCode, errMsg }) => {
// Failed call
});
Function Prototype
OpenIMSDKRN.getSpecifiedFriendsInfo(userIDList: string[], operationID: string): Promise<FriendUserItem[]>
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
userIDList | string[] | Yes | User ID list |
operationID | string | Yes | Operation ID, used for problem location, keep unique, suggest using current time and random number |
Return Result
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<FriendUserItem[]> | List of friend information |
Promise.catch() | Promise<CatchResponse> | Callback on failed call |
Code Example
import OpenIMSDKRN from "open-im-sdk-rn";
const userIDList = ['userID1', 'userID2'];
OpenIMSDKRN.getSpecifiedFriendsInfo(userIDList, 'operationID')
.then((data) => {
// Successful call
})
.catch(({ errCode, errMsg }) => {
// Failed call
});
Function Prototype
public static void GetSpecifiedFriendsInfo(OnFullUserInfoList cb, string[] userIDList)
Input Parameter
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
cb | OnFullUserInfoList | Yes | Callback |
userIDList | string[] | Yes | User ID Array |
Code Example
IMSDK.GetSpecifiedFriendsInfo((list,errCode,errMsg)=>{
},{"userid"});