Skip to main content

Search Conversation

Searches for conversations based on the provided search term, follow status, and pagination parameters. This function retrieves conversations that match the given criteria and returns a response containing the search results.

Steps to search for conversations

  1. Create a SearchConversationRequest object using the builder pattern.
  2. Call the searchConversation() function using the instance of LMChatClient, passing the request object and an optional response handler.
  3. Process the response LMResponse<SearchConversationResponse> to handle the list of matching conversations or any errors.
let request = SearchConversationRequest.builder()
.search("ENTER_SEARCH_TERM")
.followStatus(true) // Filter by followed conversations
.page(1)
.pageSize(20)
.build()

LMChatClient.shared.searchConversation(with: request) { response in
if let result = response?.data {
// Handle success
print("Conversations found: \(result.conversations)")
} else if let error = response?.error {
// Handle error
print("Error searching conversations: \(error.localizedDescription)")
}
}

Models

SearchConversationRequest

VARIABLETYPEDESCRIPTIONOPTIONAL
searchStringSearch term to query conversations
followStatusBoolWhether to filter by followed conversations
pageIntPage number for pagination
pageSizeIntNumber of results per page

SearchConversationResponse

VARIABLETYPEDESCRIPTIONOPTIONAL
conversations[SearchConversation]Array of conversations matching the search criteria

SearchConversation

VARIABLETYPEDESCRIPTIONOPTIONAL
answerStringThe answer or text content of the conversation
attachmentCountIntNumber of attachments in the conversation
attachments[Attachment]List of attachments associated with the conversation
attachmentsUploadedBoolWhether the attachments are fully uploaded
chatroomChatroomThe chatroom the conversation belongs to
communityCommunityCommunity where the conversation took place
createdAtTimeIntervalTimestamp when the conversation was created
idIntUnique identifier of the conversation
isDeletedBoolIndicates if the conversation was deleted
isEditedBoolIndicates if the conversation was edited
lastUpdatedTimeIntervalTimestamp when the conversation was last updated
memberMemberThe member who posted the conversation
stateIntState of the conversation (e.g., active, archived)