Skip to main content

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

  1. Create a SubmitPollRequest object using the builder pattern.
  2. Call the submitPoll() function using the instance of LMChatClient, passing the request object and an optional response handler.
  3. 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

VARIABLETYPEDESCRIPTIONOPTIONAL
conversationIdStringID of the conversation the poll belongs to
chatroomIdStringID of the chatroom where the poll is located
polls[Poll]Array of poll options selected by the user