Interface ThreadMemberPaginationAction

All Superinterfaces:
Iterable<ThreadMember>, PaginationAction<ThreadMember,ThreadMemberPaginationAction>, RestAction<List<ThreadMember>>

public interface ThreadMemberPaginationAction extends PaginationAction<ThreadMember,ThreadMemberPaginationAction>
PaginationAction that paginates the thread members endpoint.
Note that this implementation is not considered thread-safe as modifications to the cache are not done with a lock. Calling methods on this class from multiple threads is not recommended.

Must provide not-null ThreadChannel to compile a valid pagination route.

Limits:
Minimum - 1
Maximum - 100

Example


 // Count all thread members who are bots
 public static CompletableFuture<AtomicInteger> countBotMembers(ThreadChannel thread) {
     AtomicInteger count = new AtomicInteger();
     ThreadMemberPaginationAction members = thread.retrieveThreadMembers();
     return members.forEachAsync((threadMember) -> {
         if (threadMember.getUser().isBot())
             count.incrementAndGet();
         return true; // continues iterating if this returns true
     }).thenApply((v) -> count);
 }
 
See Also: