refuseFriendApplication
Description
info
Refuse the other party's friend request.
Note
Related callbacks:
onFriendApplicationRejected
- iOS
- Android
- Flutter
- uni-app
- Browser/Electron/MiniProgram
- React-Native
- Unity
Function Prototype
Future<dynamic> refuseFriendApplication({
required String userID,
String? handleMsg,
String? operationID,
})
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| userID | String | Yes | Applicant User ID |
| handleMsg | String | No | Operation message |
Return Result
| Parameter Name | Parameter Type | Description |
|---|---|---|
| ~ | ~ | Refused successfully if no exception thrown |
Code Example
await OpenIM.iMManager.friendshipManager.refuseFriendApplication(
userID: 'userID',
handleMsg: 'no!',
);
// todo
Function Prototype
- (void)refuseFriendApplication:(NSString *)userID
handleMsg:(NSString *)msg
onSuccess:(nullable OIMSuccessCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| userID | NSString | Yes | Applicant User ID |
| msg | NSString | Yes | Operation message |
Return Result
| Parameter Name | Parameter Type | Description |
|---|---|---|
| onSuccess | OIMSuccessCallback | Success |
| onFailure | OIMFailureCallback | Failure |
Code Example
[OIMManager.manager refuseFriendApplication:@""
handleMsg:@""
onSuccess:^(NSString * _Nullable data) {
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
}];
Function Prototype
public void refuseFriendApplication(OnBase<String> callBack, String uid, String handleMsg)
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| callBack | OnBase | Yes | Callback interface |
| uid | String | Yes | User ID |
| handleMsg | String | Yes | Sent message |
Return Result
Code Example
OpenIMClient.getInstance().friendshipManager.refuseFriendApplication(new OnBase<String>(){…},uid,handleMsg)
Function Prototype
IMSDK.refuseFriendApplication({
toUserID: string;
handleMsg: string;
}, operationID?: string): Promise<WsResponse>
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| toUserID | string | Yes | Applicant User ID |
| handleMsg | string | Yes | Operation message, for example, can carry the reason for refusal |
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.refuseFriendApplication({
toUserID: '',
handleMsg: '',
})
.then(() => {
// Success
})
.catch(({ errCode, errMsg }) => {
// Failure
});
Function Prototype
IMSDK.asyncApi('refuseFriendApplication', operationID: string, {
toUserID: string;
handleMsg: string;
}): Promise<void>
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| operationID | string | Yes | Operation ID, used to pinpoint issues, keep unique, prefer time+random |
| toUserID | string | Yes | Applicant User ID |
| handleMsg | string | Yes | Operation message |
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<void> | Success callback |
| Promise.catch() | Promise<CatchResponse> | Failure callback |
Code Example
import IMSDK from 'openim-uniapp-polyfill';
IMSDK.asyncApi('refuseFriendApplication', IMSDK.uuid(), {
toUserID: '',
handleMsg: '',
})
.then(() => {
// Success
})
.catch(({ errCode, errMsg }) => {
// Failure
});
Function Prototype
OpenIMSDK.refuseFriendApplication({
toUserID: string;
handleMsg: string;
}, operationID?: string): Promise<void>
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| toUserID | string | Yes | Applicant User ID |
| handleMsg | string | Yes | Operation message |
| operationID | string | No | Operation ID, used to pinpoint issues, keep unique, prefer time+random |
Return Result
| Parameter Name | Parameter Type | Description |
|---|---|---|
| Promise.then() | Promise<void> | Success callback |
| Promise.catch() | Promise<OpenIMApiError> | Failure callback |
Code Example
import OpenIMSDK from "@openim/rn-client-sdk";
OpenIMSDK.refuseFriendApplication({
toUserID: '',
handleMsg: '',
})
.then(() => {
// Success
})
.catch((error) => {
// Failure
});
Function Prototype
public static void RefuseFriendApplication(OnBase<bool> cb, ProcessFriendApplicationParams userIdHandleMsg)
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| cb | OnBase | Yes | Callback interface |
| userIdHandleMsg | ProcessFriendApplicationParams | Yes | Refuse friend parameters |
Return Result
Code Example
IMSDK.RefuseFriendApplication((suc,errCode,errMsg)=>{
},new ProcessFriendApplicationParams(){
ToUserID = "userid",
HandleMsg = "",
});