Skip to main content

Get Conversation

Fetches a conversation based on the specified request. This function retrieves a conversation object if found and returns an appropriate response.

Steps to get a conversation

  1. Create a GetConversationRequest object using the builder pattern or by directly passing the required parameters.
  2. Call the getConversation() function using the instance of LMChatClient, passing the request object.
  3. Process the response LMResponse<GetConversationResponse> to handle the fetched conversation or failure.
let request = GetConversationRequest.builder()
.conversationId("ENTER_CONVERSATION_ID")
.build()

if let response = LMChatClient.shared.getConversation(request: request) {
if response.isSuccess {
// Handle success
print("Conversation fetched: \(response.data?.conversation)")
} else {
// Handle failure
print("Failed to fetch conversation: \(response.errorMessage)")
}
}

Models

GetConversationRequest

VARIABLETYPEDESCRIPTIONOPTIONAL
conversationIdStringID of the conversation to fetch

GetConversationResponse

VARIABLETYPEDESCRIPTIONOPTIONAL
conversationConversationThe fetched conversation object