findMessageList
Function Introduction
Description
Search for local messages by message ID.
Note
Only supports messages that have been pulled to the local storage.
- iOS
- Android
- Flutter
- uni-app
- Browser/Electron/MiniProgram
- React-Native
- Unity
Function Prototype
Future<SearchResult> findMessageList({
required List<SearchParams> searchParams,
String? operationID,
})
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
SearchParams.conversationID | String | Yes | Conversation ID |
SearchParams.clientMsgIDList | List<String> | Yes | List of Message IDs |
Return Result
Name | Type | Description |
---|---|---|
~ | SearchResult | Success return |
SearchResult
Field Name | Field Type | Description |
---|---|---|
totalCount | int | Total number of messages retrieved |
findResultItems | List<SearchResultItems> | Search results returned by findXX methods |
Code Example
SearchResult result = await OpenIM.iMManager.messageManager.findMessageList(
searchParams: [
SearchParams(
clientMsgIDList: [],
conversationID: '',
)
],
);
// todo
Function Prototype
- (void)findMessageList:(NSArray<OIMFindMessageListParam *> *)param
onSuccess:(nullable OIMMessageSearchCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
OIMFindMessageListParam.conversationID | NSSting | Yes | Conversation ID. If not empty, retrieve by conversation ID, otherwise by userID and groupID |
OIMFindMessageListParam.clientMsgIDList | NSArray <NSString *> | Yes | Initial message clientMsgID, pull for the first time as "" |
Return Result
Name | Type | Description |
---|---|---|
onSuccess | OIMSearchResultInfo | Success return |
onFailure | OIMFailureCallback | Failure return |
OIMSearchResultInfo
Field Name | Field Type | Description |
---|---|---|
totalCount | NSInteger | Total number of messages retrieved |
searchResultItems | NSArray< OIMSearchResultItemInfo * > | Search results |
Code Example
OIMFindMessageListParam *param = [OIMFindMessageListParam new];
param.conversationID = @"";
param.clientMsgIDList = @[];
[OIMManager.manager findMessageList:@[param]
onSuccess:^(OIMSearchResultInfo * _Nullable result) {
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
}];
Function Prototype
public void findMessageList(OnBase<SearchResult> base, List<SearchParams> searchParams)
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
callBack | OnBase<TypeKeySetResult> | Yes | Callback interface |
SearchParams | List<SearchParams> | Yes | - |
Return Result
Name | Type | Description |
---|---|---|
~ | TypeKeySetResult | Success return |
Code Example
OpenIMClient.getInstance().messageManager. findMessageList(new OnBase<SearchResult>() {
public void onError(int code, String error) {
}
public void onSuccess(SearchResult data) {
}
},searchParams);
// todo
Function Prototype
type FindMessageResult = {
totalCount: number;
findResultItems: SearchMessageResultItem[];
};
IMSDK.findMessageList({
conversationID: string;
clientMsgIDList: string[];
}, operationID?: string): Promise<WsResponse<FindMessageResult>>
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
conversationID | string | Yes | Conversation ID |
clientMsgIDList | string[] | Yes | List of Message IDs |
Return Result
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<WsResponse<FindMessageResult>> | 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.findMessageList({
conversationID: '',
clientMsgIDList: ['msgid'],
})
.then(({ data }) => {
// Call successful
})
.catch(({ errCode, errMsg }) => {
// Call failed
});
Function Prototype
type FindMessageResult = {
totalCount: number;
findResultItems: SearchMessageResultItem[];
};
IMSDK.asyncApi('findMessageList', operationID: string, {
conversationID: string,
clientMsgIDList: string[]
}): Promise<FindMessageResult>
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
operationID | string | Yes | Operation ID, used for problem localization, should be unique, recommended to use current time and random number |
conversationID | string | Yes | Conversation ID |
clientMsgIDList | string[] | Yes | Message ID |
Return Result
The function is Promise-ified through the
openim-uniapp-polyfill
package, so usethen
andcatch
to check and handle success and failure callbacks.
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<FindMessageResult> | Success callback |
Promise.catch() | Promise<CatchResponse> | Failure callback |
Code Example
import IMSDK from 'openim-uniapp-polyfill';
IMSDK.asyncApi('findMessageList', IMSDK.uuid(), {
conversationID: '',
clientMsgIDList: ['msgid'],
})
.then((data) => {
// Call successful
})
.catch(({ errCode, errMsg }) => {
// Call failed
});
Function Prototype
OpenIMSDKRN.findMessageList({
conversationID: string,
clientMsgIDList: string[]
}, operationID: string): Promise<FindMessageResult>
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
conversationID | string | Yes | Conversation ID |
clientMsgIDList | string[] | Yes | message ID |
operationID | string | Yes | Operation ID, used for problem location, keep unique, suggest using current time and random number |
Return Result
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<FindMessageResult> | Callback on successful call |
Promise.catch() | Promise<CatchResponse> | Callback on failed call |
Code Example
import OpenIMSDKRN from "open-im-sdk-rn";
OpenIMSDKRN.findMessageList({
conversationID: '',
clientMsgIDList: ['msgid'],
}, 'operationID')
.then((data) => {
// Call successful
})
.catch(({ errCode, errMsg }) => {
// Call failed
});
Function Prototype
public static void FindMessageList(OnBase<FindMessageResult> cb, ConversationArgs[] findMessageOptions)
Input Parameter
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
cb | OnBase< FindMessageResult> | Yes | Callback |
findMessageOptions | ConversationArgs[] | Yes |
FindMessageResult
Field Name | Field Type | Description |
---|---|---|
TotalCount | int | Total number of messages retrieved |
FindResultItems | List<SearchResultItems> | Search results returned by findXX methods |
Code Example
IMSDK.FindMessageList((list,errCode,errMsg)=>{
},findMessageOptions);