refuseFriendApplication
Function Introduction
Description
Decline the other party's request to add you as a friend.
Note
Related Callback: 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 | User ID of the applicant |
handleMsg | String | No | Operation message |
Return Result
Parameter Name | Parameter Type | Description |
---|---|---|
~ | ~ | Successful 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 | User ID of the applicant |
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 | User ID of the applicant |
handleMsg | string | Yes | Operation message |
Return Result
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<WsResponse> | Successful callback |
Promise.catch() | Promise<WsResponse> | Failed 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(() => {
// Successful call
})
.catch(({ errCode, errMsg }) => {
// Failed call
});
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 locate the problem, suggested to use current time and random number |
toUserID | string | Yes | User ID of the applicant |
handleMsg | string | Yes | Operation message |
Return Result
Through the
openim-uniapp-polyfill
package, the function is promisified. When calling, you need to usethen
andcatch
to judge and handle successful and failed callbacks.
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<void> | Successful callback |
Promise.catch() | Promise<CatchResponse> | Failed callback |
Code Example
import IMSDK from 'openim-uniapp-polyfill';
IMSDK.asyncApi('refuseFriendApplication', IMSDK.uuid(), {
toUserID: '',
handleMsg: '',
})
.then(() => {
// Successful call
})
.catch(({ errCode, errMsg }) => {
// Failed call
});
Function Prototype
OpenIMSDKRN.refuseFriendApplication({
toUserID: string;
handleMsg: string;
}, operationID: string): Promise<void>
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
toUserID | string | Yes | User ID of the requester |
handleMsg | string | Yes | Operation message |
operationID | string | Yes | Operation ID, used to locate the problem, suggested to use current time and random number |
Return Result
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<void> | Callback on successful call |
Promise.catch() | Promise<CatchResponse> | Callback on failed call |
Code Example
import OpenIMSDKRN from "open-im-sdk-rn";
OpenIMSDKRN.refuseFriendApplication({
toUserID: '',
handleMsg: '',
}, 'operationID')
.then(() => {
// Successful call
})
.catch(({ errCode, errMsg }) => {
// Failed call
});
Function Prototype
public static void RefuseFriendApplication(OnBase<bool> cb, ProcessFriendApplicationParams userIdHandleMsg)
Input Parameter
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
cb | OnBase | Yes | Callback |
userIdHandleMsg | ProcessFriendApplicationParams | Yes | Fefuse Friend Request Parameter |
Return Result
Code Example
IMSDK.RefuseFriendApplication((suc,errCode,errMsg)=>{
},new ProcessFriendApplicationParams(){
ToUserID = "userid",
HandleMsg = "",
});