clearConversationAndDeleteAllMsg
Feature Introduction
Description
Deletes messages from a specified conversation both locally and on the server, but retains the conversation.
Note
Related Callback: onConversationChanged
- iOS
- Android
- Flutter
- uni-app
- Browser/Electron/MiniProgram
- React-Native
- Unity
Function Prototype
Future clearConversationAndDeleteAllMsg({
required String conversationID,
String? operationID,
})
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
conversationID | String | Yes | Conversation ID |
Return Result
Name | Type | Description |
---|---|---|
~ | ~ | Operation successful if no exception is thrown |
Code Example
await OpenIM.iMManager.conversationManager.clearConversationAndDeleteAllMsg(conversationID: conversationID);
//todo
Function Prototype
- (void)clearConversationAndDeleteAllMsg:(NSString *)conversationID
onSuccess:(nullable OIMSuccessCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
conversationID | NSString | Yes | Conversation ID |
Return Result
Name | Type | Description |
---|---|---|
onSuccess | OIMSuccessCallback | Success return |
onFailure | OIMFailureCallback | Failure return |
Code Example
[OIMManager.manager clearConversationAndDeleteAllMsg:@""
onSuccess:^(NSString * _Nullable data) {
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
}];
Function Prototype
public void clearConversationAndDeleteAllMsg(String conversationID, OnBase<String> callBack)
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
conversationID | String | Yes | Conversation ID |
callBack | OnBase | Yes | Callback interface |
Code Example
OpenIMClient.getInstance().messageManager.clearConversationAndDeleteAllMsg(conversationID,new OnBase<String>() {
@Override
public void onError(int code, String error) {
}
@Override
public void onSuccess(String data) {
}
})
Function Prototype
IMSDK.clearConversationAndDeleteAllMsg(conversationID: string, operationID?: string): Promise<WsResponse>
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
conversationID | string | Yes | Conversation ID |
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 { OpenIMSDK } from 'open-im-sdk';
// const IMSDK = new OpenIMSDK();
IMSDK.clearConversationAndDeleteAllMsg('conversationID')
.then(({ data }) => {
// Call succeeded
})
.catch(({ errCode, errMsg }) => {
// Call failed
});
Function Prototype
IMSDK.asyncApi('clearConversationAndDeleteAllMsg', operationID: string, conversationID: string): Promise<void>
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
operationID | string | Yes | Operation ID for issue tracking, suggested to use current time and random number |
conversationID | string | Yes | Conversation ID |
Return Result
Through the
openim-uniapp-polyfill
package, the function is made Promise-compatible, requiring the use ofthen
andcatch
to determine and handle the success and failure callbacks respectively.
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(
'clearConversationAndDeleteAllMsg',
IMSDK.uuid(),
'conversationID'
)
.then(() => {
// Call succeeded
})
.catch(({ errCode, errMsg }) => {
// Call failed
});
Function Prototype
OpenIMSDKRN.clearConversationAndDeleteAllMsg(operationID: string, conversationID: string): Promise<void>
Input Parameter
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
operationID | string | Yes | Operation ID for issue tracking, suggested to use current time and random number |
conversationID | string | Yes | conversation ID |
Return Result
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<void> | Success callback |
Promise.catch() | Promise<Response> | Faliure callback |
Code Example
import OpenIMSDKRN from "open-im-sdk-rn";
OpenIMSDKRN.clearConversationAndDeleteAllMsg("conversationID", 'operationID')
.then(() => {
// Call succeeded
})
.catch(({ errCode, errMsg }) => {
// Call failed
});
### Function Prototype
public static void ClearConversationAndDeleteAllMsg(OnBase<bool> cb, string conversationId);
Input Parameter
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
cb | OnBase | Yes | Callback |
conversationId | string | Yes | Conversation ID |
Code Example
IMSDK.ClearConversationAndDeleteAllMsg((suc,errCode,errMsg)=>{
},conversationId);