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
- Create a GetConversationRequest object using the builder pattern or by directly passing the required parameters.
- Call the
getConversation()
function using the instance ofLMChatClient
, passing therequest
object. - 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
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
conversationId | String | ID of the conversation to fetch |
GetConversationResponse
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
conversation | Conversation | The fetched conversation object |