publishPoll

abstract suspend fun publishPoll(pollId: String): RainbowResult<Unit>

Publish a poll, opening the possibility for members to vote.

This API allows an organizer to move a poll from the draft state to the published state. Once published, a poll cannot be modified anymore (for that it needs to be unpublished, see Polls.unPublishPoll). Once published, any member of the room has now access to the poll and the ability to vote for his or her favorite answer(s).

Return

A RainbowResult indicating success or failure. In case of failure, the RainbowResult will contain error details.

Parameters

pollId

The unique identifier of the poll.

Samples

import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope
import com.ale.infra.manager.poll.Poll
import com.ale.infra.manager.poll.PollAnswer
import com.ale.infra.manager.poll.PollQuestion
import com.ale.infra.manager.poll.PollVote
import com.ale.infra.rest.listeners.onFailure
import com.ale.infra.rest.listeners.onSuccess
import com.ale.rainbowsdk.RainbowSdk
import kotlinx.coroutines.launch

fun main() { 
   //sampleStart 
   viewLifecycleOwner.lifecycleScope.launch {
    RainbowSdk().polls().publishPoll(pollId).onSuccess {
        // Handle success
    }.onFailure {
        // Handle failure
    }
} 
   //sampleEnd
}