-
-
Notifications
You must be signed in to change notification settings - Fork 757
Created a Discord Subscription representation as well as a method for… #2885
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
larffxx
wants to merge
7
commits into
discord-jda:master
Choose a base branch
from
larffxx:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0fc98c5
Created a Discord Subscription representation as well as a method for…
larffxx 3e19266
Revert EntityBuilder and adds fromKey method to SubscriptionStatus
larffxx f4ef5a7
Add events with subscriptions
larffxx 598add1
Add deserialization
larffxx cca4c55
Took into account PR's comments
larffxx 2888722
Merge branch 'discord-jda:master' into master
larffxx 670824b
Add javadoc for SubscriptionPaginationAction
larffxx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/main/java/net/dv8tion/jda/api/events/subscription/GenericSubscriptionEvent.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| package net.dv8tion.jda.api.events.subscription; | ||
|
|
||
| import net.dv8tion.jda.api.JDA; | ||
| import net.dv8tion.jda.internal.entities.subscription.Subscription; | ||
| import net.dv8tion.jda.api.events.Event; | ||
|
|
||
| import javax.annotation.Nonnull; | ||
|
|
||
| /** | ||
| * Indicates that an {@link Subscription Subscription} was either created, updated, or deleted | ||
| * | ||
| * @see SubscriptionCreateEvent | ||
| * @see SubscriptionUpdateEvent | ||
| * @see SubscriptionDeleteEvent | ||
| */ | ||
| public abstract class GenericSubscriptionEvent extends Event | ||
| { | ||
| protected final Subscription subscription; | ||
|
|
||
| protected GenericSubscriptionEvent(@Nonnull JDA api, long responseNumber, @Nonnull Subscription subscription) | ||
| { | ||
| super(api, responseNumber); | ||
| this.subscription = subscription; | ||
| } | ||
|
|
||
| /** | ||
| * The {@link Subscription} | ||
| * | ||
| * @return The {@link Subscription} | ||
| */ | ||
| @Nonnull | ||
| public Subscription getSubscription() | ||
| { | ||
| return subscription; | ||
| } | ||
| } |
15 changes: 15 additions & 0 deletions
15
src/main/java/net/dv8tion/jda/api/events/subscription/SubscriptionCreateEvent.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package net.dv8tion.jda.api.events.subscription; | ||
|
|
||
| import net.dv8tion.jda.api.JDA; | ||
| import net.dv8tion.jda.internal.entities.subscription.Subscription; | ||
|
|
||
| /** | ||
| * Indicate that a Subscription for Premium app was created | ||
| */ | ||
| public class SubscriptionCreateEvent extends GenericSubscriptionEvent | ||
| { | ||
| public SubscriptionCreateEvent(JDA api, long responseNumber, Subscription subscription) | ||
| { | ||
| super(api, responseNumber, subscription); | ||
| } | ||
| } |
16 changes: 16 additions & 0 deletions
16
src/main/java/net/dv8tion/jda/api/events/subscription/SubscriptionDeleteEvent.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| package net.dv8tion.jda.api.events.subscription; | ||
|
|
||
| import net.dv8tion.jda.api.JDA; | ||
| import net.dv8tion.jda.internal.entities.subscription.Subscription; | ||
| import org.jetbrains.annotations.NotNull; | ||
|
|
||
| /** | ||
| * Indicate that a Subscription for Premium app was deleted | ||
| */ | ||
| public class SubscriptionDeleteEvent extends GenericSubscriptionEvent | ||
| { | ||
| public SubscriptionDeleteEvent(@NotNull JDA api, long responseNumber, @NotNull Subscription subscription) | ||
| { | ||
| super(api, responseNumber, subscription); | ||
| } | ||
| } |
16 changes: 16 additions & 0 deletions
16
src/main/java/net/dv8tion/jda/api/events/subscription/SubscriptionUpdateEvent.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| package net.dv8tion.jda.api.events.subscription; | ||
|
|
||
| import net.dv8tion.jda.api.JDA; | ||
| import net.dv8tion.jda.internal.entities.subscription.Subscription; | ||
| import org.jetbrains.annotations.NotNull; | ||
|
|
||
| /** | ||
| * Indicates that a Subscription for Premium app was updated | ||
| */ | ||
| public class SubscriptionUpdateEvent extends GenericSubscriptionEvent | ||
| { | ||
| public SubscriptionUpdateEvent(@NotNull JDA api, long responseNumber, @NotNull Subscription subscription) | ||
| { | ||
| super(api, responseNumber, subscription); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...java/net/dv8tion/jda/api/requests/restaction/pagination/SubscriptionPaginationAction.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| package net.dv8tion.jda.api.requests.restaction.pagination; | ||
|
|
||
| import net.dv8tion.jda.api.entities.User; | ||
| import net.dv8tion.jda.api.entities.UserSnowflake; | ||
| import net.dv8tion.jda.internal.entities.subscription.Subscription; | ||
|
|
||
| import javax.annotation.CheckReturnValue; | ||
| import javax.annotation.Nonnull; | ||
| import javax.annotation.Nullable; | ||
|
|
||
| /** | ||
| * {@link PaginationAction PaginationAction} that paginates over | ||
| * {@link Subscription Subscriptions} returned from the | ||
| * <a href="https://discord.com/developers/docs/resources/subscription#list-sku-subscriptions" | ||
| * target="_blank">List SKU Subscriptions</a> endpoint. | ||
| * <br>This action allows retrieval of subscriptions for a specific SKU, optionally filtered by a user. | ||
| * | ||
| * <p>Use {@link #user(UserSnowflake)} to limit results to a specific user, or {@code null} to remove the filter. | ||
| * <br>Results are ordered according to {@link PaginationOrder} and support typical pagination | ||
| * parameters such as {@link #limit(int)} and {@link #cache(boolean)}. | ||
| * | ||
| * @see PaginationAction | ||
| * @see Subscription | ||
| */ | ||
| public interface SubscriptionPaginationAction extends PaginationAction<Subscription, SubscriptionPaginationAction> | ||
| { | ||
|
|
||
| /** | ||
| * Filter {@link Subscription Subscription}s to retrieve by the given user ID | ||
| * | ||
| * @param user | ||
| * The {@link UserSnowflake UserSnowflake} used to filter or {@code null} to remove user filtering. | ||
| * This can be a member or user instance of {@link User#fromId(long)} | ||
| * | ||
| * @return The current {@link SubscriptionPaginationAction SubscriptionPaginationAction} for chaining convenience | ||
| */ | ||
| @Nonnull | ||
| @CheckReturnValue | ||
| SubscriptionPaginationAction user(@Nullable UserSnowflake user); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an extra newline between
@paramand@return