Package 

Interface PollList


  • 
    public interface PollList
    
                        

    A list of polls that can be queried and paginated.

    This class provides a way to fetch and manage a collection of polls with support for filtering, sorting, and pagination. It maintains an observable state that can be used in UI components.

    // Create a poll list with a specific query
    val query = PollsQuery()
    val pollList = feedsClient.pollList(query)
    
    // Fetch initial polls matching the query
    val polls = pollList.get()
    
    // Load more polls if available
    if (pollList.state.canLoadMore) {
       val morePolls = pollList.queryMorePolls()
    }
    
    // Observe state changes
    pollList.state.polls.collect { polls ->
       println("Updated polls: ${polls.size}")
    }
    • Method Summary

      Modifier and Type Method Description
      abstract Result<List<PollData>> get() Fetches the initial list of polls based on the current query.
      abstract Result<List<PollData>> queryMorePolls(Integer limit) Loads more polls using the next page token from the previous query.
      abstract PollsQuery getQuery() The query used to fetch the polls.
      abstract PollListState getState() An observable object representing the current state of the poll list.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • get

         abstract Result<List<PollData>> get()

        Fetches the initial list of polls based on the current query.

        This method retrieves the first page of polls matching the query criteria. The results are automatically stored in the state and can be accessed via the state.polls property.

      • queryMorePolls

         abstract Result<List<PollData>> queryMorePolls(Integer limit)

        Loads more polls using the next page token from the previous query.

        This method fetches additional polls if there are more available based on the current query. The new polls are automatically merged with the existing ones in the state.

        Parameters:
        limit - Optional limit for the number of polls to fetch.
      • getState

         abstract PollListState getState()

        An observable object representing the current state of the poll list.