updateFriends
Description
info
Update friend information, including pinned, remark, and ex fields.
Note
Related callbacks:
onFriendInfoChanged
onConversationChanged
- iOS
- Android
- Flutter
- uni-app
- Browser/Electron/MiniProgram
- React-Native
- Unity
Function Prototype
Future updateFriends(
UpdateFriendsReq req, {
String? operationID,
})
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| updateFriendsReq | UpdateFriendsReq | Yes | Structure of changes |
Return Result
| Name | Type | Description |
|---|---|---|
| ~ | ~ | Operation successful if no exception thrown |
Code Example
await OpenIM.iMManager.conversationManager.updateFriends(req);
//todo
Function Prototype
- (void)updateFriends:(OIMUpdateFriendsReq *)req
onSuccess:(nullable OIMSuccessCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| req | UpdateFriendsReq | Yes | Structure of changes |
Return Result
| Name | Type | Description |
|---|---|---|
| onSuccess | OIMSuccessCallback | Success |
| onFailure | OIMFailureCallback | Failure |
Code Example
[OIMManager.manager updateFriends:req
onSuccess:^(NSString * _Nullable data) {
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
}];
public void updateFriendsReq(OnBase<String> base, UpdateFriendsReq updateFriendsReq)
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| updateFriendsReq | UpdateFriendsReq | Yes | Structure of changes |
Return Result
Code Example
OpenIMClient.getInstance().friendshipManager.updateFriendsReq(new OnBase<String>() {
@Override
public void onError(int code, String error) {
// todo: handle error information
}
@Override
public void onSuccess(String data) {
// todo: request successful
}
}, updateFriendsReq);
Function Prototype
IMSDK.updateFriends({
friendUserIDs: string[];
isPinned?: boolean;
remark?: boolean;
ex?: boolean;
},operationID?: string): Promise<WsResponse>
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| friendUserIDs | string[] | Yes | List of friend IDs |
| isPinned | boolean | No | Whether it is a starred friend |
| remark | string | No | Friend's remark |
| ex | string | No | ex field |
Return Result
| Parameter Name | Parameter Type | Description |
|---|---|---|
| Promise.then() | Promise<WsResponse> | Success callback |
| 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();
IMSDK.updateFriends({
friendUserIDs: ['userID'],
remark: "new remark"
})
.then(({ data }) => {
// Success
})
.catch(({ errCode, errMsg }) => {
// Failure
});
Function Prototype
IMSDK.asyncApi('updateFriends', operationID: string, {
friendUserIDs: string[];
isPinned?: boolean;
remark?: boolean;
ex?: boolean;
}): Promise<FullUserItem[]>
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| operationID | string | Yes | Operation ID, used to pinpoint issues, keep unique, prefer time+random |
| friendUserIDs | string[] | Yes | List of friend IDs |
| isPinned | boolean | No | Whether it is a starred friend |
| remark | string | No | Friend's remark |
| ex | string | No | ex field |
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<WsResponse> | Success callback |
| Promise.catch() | Promise<CatchResponse> | Failure callback |
Code Example
import IMSDK from 'openim-uniapp-polyfill';
IMSDK.asyncApi('updateFriends', IMSDK.uuid(), {
friendUserIDs: ['userID'],
remark: "new remark"
})
.then((data) => {
// Success
})
.catch(({ errCode, errMsg }) => {
// Failure
});
Function Prototype
OpenIMSDK.updateFriends({
friendUserIDs: string[];
isPinned?: boolean;
remark?: boolean;
ex?: boolean;
}, operationID?: string): Promise<FullUserItem[]>
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| operationID | string | No | Operation ID, used to pinpoint issues, keep unique, prefer time+random |
| friendUserIDs | string[] | Yes | List of friend IDs |
| isPinned | boolean | No | Whether it is a starred friend |
| remark | string | No | Friend's remark |
| ex | string | No | ex field |
Return Result
| Parameter Name | Parameter Type | Description |
|---|---|---|
| Promise.then() | Promise<WsResponse> | Success callback |
| Promise.catch() | Promise<OpenIMApiError> | Failure callback |
Code Example
import OpenIMSDK from '@openim/rn-client-sdk';
OpenIMSDK.updateFriends({
friendUserIDs: ['userID'],
remark: "new remark"
})
.then((data) => {
// Success
})
.catch((error) => {
// Failure
});
public static void UpdateFriends(OnBase<bool> cb, UpdateFriendsReq req);
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| cb | OnBase | Yes | Callback |
| updateFriendsReq | UpdateFriendsReq | Yes | Structure of changes |
Return Result
Code Example
IMSDK.UpdateFriends((suc,errCode,errMsg)=>{
}
, updateFriendsReq);