Submit Poll
Submits a user's poll response in a poll conversation. This function allows the submission of selected poll options for a given conversation and chatroom.
Steps to submit a poll
- Create a SubmitPollRequest object using the builder pattern.
- Call the
submitPoll()
function using the instance ofLMChatClient
, passing therequest
object and an optional response handler. - Process the response LMResponse<NoData> to handle the submission or any errors.
let request = SubmitPollRequest.builder()
.conversationId("ENTER_CONVERSATION_ID")
.chatroomId("ENTER_CHATROOM_ID")
.polls([Poll(id: "pollOption1"), Poll(id: "pollOption2")])
.build()
PollClient.shared.submitPoll(request: request) { response in
if response.success {
// Handle success
print("Poll submitted successfully.")
} else {
print("Error submitting poll")
}
}
Models
SubmitPollRequest
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
conversationId | String | ID of the conversation the poll belongs to | |
chatroomId | String | ID of the chatroom where the poll is located | |
polls | [Poll] | Array of poll options selected by the user |