Package 

Interface UserList


  • 
    public interface UserList
    
                        

    A paginated list of users that supports filtering and sorting.

    UserList provides a convenient way to fetch, paginate, and observe users. It manages the state of users and provides methods for loading more users as needed.

    val query = UsersQuery(
        filter = UsersFilterField.role.equal("admin"),
        sort = listOf(UsersSort(UsersSortField.CreatedAt, SortDirection.REVERSE)),
        limit = 10,
    )
    val userList = feedsClient.userList(query)
    
    // Fetch initial users matching the query
    val users = userList.get()
    
    // Load more users if available
    if (userList.state.canLoadMore) {
        val moreUsers = userList.queryMoreUsers()
    }
    
    // Observe state changes
    userList.state.users.collect { users ->
        println("Updated users: ${users.size}")
    }
    • Method Summary

      Modifier and Type Method Description
      abstract Result<List<UserData>> get() Fetches the initial set of users based on the current query configuration.
      abstract Result<List<UserData>> queryMoreUsers(Integer limit) Fetches the next page of users if available.
      abstract UsersQuery getQuery() The query configuration used for fetching users.
      abstract UserListState getState() An observable object representing the current state of the user 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<UserData>> get()

        Fetches the initial set of users based on the current query configuration.

        This method retrieves the first page of users using the filtering and sorting parameters defined in the query. The results are automatically stored in the state and can be observed through the state.users property.

      • queryMoreUsers

         abstract Result<List<UserData>> queryMoreUsers(Integer limit)

        Fetches the next page of users if available.

        This method retrieves additional users by advancing the offset from the previous request. The new users are automatically merged with the existing users in the state, maintaining the proper sort order.

        Parameters:
        limit - Optional limit for the number of users to fetch.
      • getQuery

         abstract UsersQuery getQuery()

        The query configuration used for fetching users.

        This property contains the filtering, sorting, and pagination parameters that define how users should be fetched and displayed.

      • getState

         abstract UserListState getState()

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