Skip to main content

Delete Conversations

Deletes conversations for a user based on the specified request. This function handles the deletion process and provides a response with the result of the operation.

Steps to delete conversations

  1. Create a DeleteConversationsRequest object using the builder pattern.
  2. Call the deleteConversations() function using the instance of LMChatClient, passing the request object and an optional response handler.
  3. Process the response LMResponse<DeleteConversationsResponse> to handle success or error cases.
let request = DeleteConversationsRequest.builder()
.conversationIds(["ENTER_CONVERSATION_ID_1", "ENTER_CONVERSATION_ID_2"])
.userId("ENTER_USER_ID")
.build()

LMChatClient.shared.deleteConversations(request: request) { response in
if let result = response?.data {
// Handle success
print("Conversations deleted successfully.")
} else if let error = response?.error {
// Handle error
print("Error deleting conversations: \(error.localizedDescription)")
}
}

Models

DeleteConversationsRequest

VARIABLETYPEDESCRIPTIONOPTIONAL
conversationIds[String]Array of conversation IDs to delete
userIdStringID of the user whose conversations are to be deleted

DeleteConversationsResponse

VARIABLETYPEDESCRIPTIONOPTIONAL
deletedConversations[Conversation]Array of conversations that were successfully deleted