deleteAllMsgFromLocalAndSvr
Feature Introduction
Description
Delete messages from all sessions locally and on the server. The sessions will still be retained.
Note
Related Callback: onConversationChanged
- iOS
- Android
- Flutter
- uni-app
- Browser/Electron/MiniProgram
- React-Native
- Unity
Function Prototype
Future<dynamic> deleteAllMsgFromLocalAndSvr({
String? operationID,
})
Input Parameters
None
Return Results
Name | Type | Description |
---|---|---|
~ | ~ | Operation successful if no exception thrown |
Code Example
await OpenIM.iMManager.messageManager.deleteAllMsgFromLocalAndSvr();
// todo
Function Prototype
- (void)deleteAllMsgFromLocalAndSvrWithOnSuccess:(nullable OIMSuccessCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;
Input Parameters
None
Return Results
Name | Type | Description |
---|---|---|
onSuccess | OIMSuccessCallback | Success return |
onFailure | OIMFailureCallback | Failure return |
Code Example
[OIMManager.manager deleteAllMsgFromLocalAndSvrWithOnSuccess:^(NSString * _Nullable data) {
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
}];
Function Prototype
public void deleteAllMsgFromLocalAndSvr(OnBase<String> base)
Input Parameters
Name | Type | Description | |
---|---|---|---|
callBack | OnBase<String> | Yes | Callback interface |
Code Example
OpenIMClient.getInstance().messageManager. deleteAllMsgFromLocalAndSvr(new OnBase<String>() {
public void onError(int code, String error) {
}
public void onSuccess(String data) {
}
})
Function Prototype
IMSDK.deleteAllMsgFromLocalAndSvr(operationID?: string): Promise<WsResponse>
Input Parameters
None
Return Results
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.deleteAllMsgFromLocalAndSvr()
.then(({ data }) => {
// Successful call
})
.catch(({ errCode, errMsg }) => {
// Failed call
});
Function Prototype
IMSDK.asyncApi('deleteAllMsgFromLocalAndSvr', operationID: string): Promise<void>
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
operationID | string | Yes | Operation ID, used for troubleshooting, ensure it's unique, suggest using current time and random number |
Return Results
Using
openim-uniapp-polyfill
package to Promise the function. When calling, usethen
andcatch
to 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('deleteAllMsgFromLocalAndSvr', IMSDK.uuid())
.then(() => {
// Successful call
})
.catch(({ errCode, errMsg }) => {
// Failed call
});
Function Prototype
OpenIMSDKRN.deleteAllMsgFromLocalAndSvr(operationID: string): Promise<void>
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
operationID | string | Yes | Operation ID, used for troubleshooting, ensure it's unique, suggest using 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.deleteAllMsgFromLocalAndSvr('operationID')
.then(() => {
// Successful call
})
.catch(({ errCode, errMsg }) => {
// Failed call
});