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 Entitlement
s which have ended, that is, Entitlement
s which
have gone past their timeEnding
. You may use excludeEnded(true)
to only return Entitlement
s 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) FiltersEntitlement
s by a guild iddefault EntitlementPaginationAction
FiltersEntitlement
s by a guild iddefault EntitlementPaginationAction
FiltersEntitlement
s by aGuild
skuIds
(long... skuIds) FiltersEntitlement
s by their SKU idFiltersEntitlement
s by their SKU idskuIds
(Collection<String> skuIds) FiltersEntitlement
s by their SKU iduser
(UserSnowflake user) FilterEntitlement
s 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, timeout
Methods 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
FilterEntitlement
s to retrieve by the given user ID- Parameters:
user
- TheUserSnowflake
used to filter ornull
to remove user filtering. This can be a member or user instance ofUser.fromId(long)
- Returns:
- The current
EntitlementPaginationAction
for chaining convenience
-
skuIds
FiltersEntitlement
s by their SKU id- Parameters:
skuIds
- The SKU ids to filter by- Returns:
- The current
EntitlementPaginationAction
for chaining convenience
-
skuIds
FiltersEntitlement
s by their SKU id- Parameters:
skuIds
- The SKU ids to filter by- Returns:
- The current
EntitlementPaginationAction
for chaining convenience - Throws:
IllegalArgumentException
- If any of the providedskuIds
arenull
, empty or are not a valid snowflake
-
skuIds
FiltersEntitlement
s by their SKU id- Parameters:
skuIds
- The SKU ids to filter by- Returns:
- The current
EntitlementPaginationAction
for chaining convenience - Throws:
IllegalArgumentException
- If any of the providedskuIds
arenull
, empty or invalid snowflakes
-
guild
FiltersEntitlement
s by a guild id- Parameters:
guildId
- The guild id to filter by- Returns:
- The current
EntitlementPaginationAction
for chaining convenience
-
guild
FiltersEntitlement
s by a guild id- Parameters:
guildId
- The guild id to filter by- Returns:
- The current
EntitlementPaginationAction
for chaining convenience - Throws:
IllegalArgumentException
- If the providedguildId
isnull
, empty or is not a valid snowflake
-
guild
FiltersEntitlement
s by aGuild
- Parameters:
guild
- TheGuild
to filter by- Returns:
- The current
EntitlementPaginationAction
for chaining convenience - Throws:
IllegalArgumentException
- If the providedguild
isnull
-
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 returnedEntitlement
s- Returns:
- The current
EntitlementPaginationAction
for chaining convenience
-