Put Reaction
Adds a reaction to a message or conversation based on the specified request. This function handles the process of adding a user’s reaction and provides a response indicating success or failure.
Steps to put a reaction
- Create a PutReactionRequest object by using the builder pattern.
- Call the
putReaction()
function using the instance ofLMChatClient
, passing therequest
object and an optional response handler. - Process the response LMResponse<NoData> to handle the result of the reaction addition.
let request = PutReactionRequest.builder()
.conversationId("ENTER_CONVERSATION_ID")
.messageId("ENTER_MESSAGE_ID")
.reaction("ENTER_REACTION")
.build()
LMChatClient.shared.putReaction(request: request) { response in
if response?.error == nil {
// Handle success
print("Reaction added successfully.")
} else {
// Handle error
print("Error adding reaction: \(response?.error?.localizedDescription ?? "Unknown error")")
}
}
Models
PutReactionRequest
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
conversationId | String | ID of the conversation where the reaction is to be added | |
messageId | String | ID of the message to which the reaction is to be added | |
reactionId | String | ID of the reaction to be added |