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
- Create a DeleteConversationsRequest object using the builder pattern.
- Call the
deleteConversations()
function using the instance ofLMChatClient
, passing therequest
object and an optional response handler. - 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
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
conversationIds | [String] | Array of conversation IDs to delete | |
userId | String | ID of the user whose conversations are to be deleted |
DeleteConversationsResponse
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
deletedConversations | [Conversation] | Array of conversations that were successfully deleted |