Interface EntitlementPaginationAction
- All Superinterfaces:
Iterable<Entitlement>,PaginationAction<Entitlement,,EntitlementPaginationAction> RestAction<@Unmodifiable List<Entitlement>>
public interface EntitlementPaginationAction
extends PaginationAction<Entitlement,EntitlementPaginationAction>
PaginationAction that paginates the application entitlements endpoint.
By default, JDA will include Entitlements which have ended, that is, Entitlements which
have gone past their timeEnding. You may use excludeEnded(true)
to only return Entitlements which are still active
Limits
Minimum - 1
Maximum - 100
Default - 100
Example
//Fetch all entitlements for a given SKU id
public static void fetchEntitlements(JDA api, String skuId, Consumer<List<Entitlement>> callback) {
List<Entitlement> entitlements = new ArrayList<>()
EntitlementPaginationAction action = api.retrieveEntitlements().skuIds(skuId).excludeEnded(true)
action.forEachAsync((entitlement) -> {
entitlements.add(entitlement)
return true; //continues to retrieve all entitlements until there are none left to retrieve
}.thenRun(() -> callback.accept(entitlements));
}
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.dv8tion.jda.api.requests.restaction.pagination.PaginationAction
PaginationAction.PaginationIterator<E>, PaginationAction.PaginationOrder -
Method Summary
Modifier and TypeMethodDescriptionexcludeEnded(boolean excludeEnded) Whether to exclude subscriptions which have gone past their end date.guild(long guildId) FiltersEntitlements by a guild iddefault EntitlementPaginationActionFiltersEntitlements by a guild iddefault EntitlementPaginationActionFiltersEntitlements by aGuildskuIds(long... skuIds) FiltersEntitlements by their SKU idFiltersEntitlements by their SKU idskuIds(Collection<String> skuIds) FiltersEntitlements by their SKU iduser(UserSnowflake user) FilterEntitlements to retrieve by the given user IDMethods inherited from interface net.dv8tion.jda.api.requests.restaction.pagination.PaginationAction
cache, cacheSize, deadline, forEachAsync, forEachAsync, forEachRemaining, forEachRemainingAsync, forEachRemainingAsync, getCached, getFirst, getLast, getLastKey, getLimit, getMaxLimit, getMinLimit, getOrder, getSupportedOrders, isCacheEnabled, isEmpty, iterator, limit, order, parallelStream, reverse, setCheck, skipTo, spliterator, stream, takeAsync, takeRemainingAsync, takeUntilAsync, takeUntilAsync, takeWhileAsync, takeWhileAsync, timeoutMethods inherited from interface net.dv8tion.jda.api.requests.RestAction
addCheck, and, and, complete, complete, completeAfter, delay, delay, delay, delay, flatMap, flatMap, getCheck, getJDA, map, mapToResult, onErrorFlatMap, onErrorFlatMap, onErrorMap, onErrorMap, onSuccess, queue, queue, queue, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, submit, submit, submitAfter, submitAfter, zip
-
Method Details
-
user
FilterEntitlements to retrieve by the given user ID- Parameters:
user- TheUserSnowflakeused to filter ornullto remove user filtering. This can be a member or user instance ofUser.fromId(long)- Returns:
- The current
EntitlementPaginationActionfor chaining convenience
-
skuIds
FiltersEntitlements by their SKU id- Parameters:
skuIds- The SKU ids to filter by- Returns:
- The current
EntitlementPaginationActionfor chaining convenience
-
skuIds
FiltersEntitlements by their SKU id- Parameters:
skuIds- The SKU ids to filter by- Returns:
- The current
EntitlementPaginationActionfor chaining convenience - Throws:
IllegalArgumentException- If any of the providedskuIdsarenull, empty or are not a valid snowflake
-
skuIds
FiltersEntitlements by their SKU id- Parameters:
skuIds- The SKU ids to filter by- Returns:
- The current
EntitlementPaginationActionfor chaining convenience - Throws:
IllegalArgumentException- If any of the providedskuIdsarenull, empty or invalid snowflakes
-
guild
FiltersEntitlements by a guild id- Parameters:
guildId- The guild id to filter by- Returns:
- The current
EntitlementPaginationActionfor chaining convenience
-
guild
FiltersEntitlements by a guild id- Parameters:
guildId- The guild id to filter by- Returns:
- The current
EntitlementPaginationActionfor chaining convenience - Throws:
IllegalArgumentException- If the providedguildIdisnull, empty or is not a valid snowflake
-
guild
FiltersEntitlements by aGuild- Parameters:
guild- TheGuildto filter by- Returns:
- The current
EntitlementPaginationActionfor chaining convenience - Throws:
IllegalArgumentException- If the providedguildisnull
-
excludeEnded
Whether to exclude subscriptions which have gone past their end date.Test entitlements which are created through the API do not have an end date.
- Parameters:
excludeEnded- Whether to exclude ended subscriptions from returnedEntitlements- Returns:
- The current
EntitlementPaginationActionfor chaining convenience
-