-
-
Notifications
You must be signed in to change notification settings - Fork 318
Monetization support #1998
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
Merged
Merged
Monetization support #1998
Changes from 11 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
64ea122
Create SKU types
Plerx2493 5c9e97b
Add ListStockKeepingUnits endpoint
Plerx2493 4ed454b
Add entitlements
Plerx2493 80b8c54
Add entitlement endponts
Plerx2493 c72fd47
Add entitlement events
Plerx2493 fa6292d
Let user use those events
Plerx2493 36b1e5b
Add XMLDocs to EntitlementType
Plerx2493 9197be5
Add docs and finish listentitlement endpoint
Plerx2493 d897a84
Add entitlement pagination
Plerx2493 d40507c
Fix entitlement event registration
Plerx2493 275b0cb
Add missing documentation
Plerx2493 a4a601f
Apply feedback
Plerx2493 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
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
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,59 @@ | ||
| using System; | ||
|
|
||
| namespace DSharpPlus.Entities; | ||
|
|
||
| /// <summary> | ||
| /// Entitlement owned by a user or guild | ||
| /// </summary> | ||
| public class DiscordEntitlement | ||
|
Plerx2493 marked this conversation as resolved.
Outdated
|
||
| { | ||
| /// <summary> | ||
| /// ID of the entitlement | ||
| /// </summary> | ||
| public ulong Id { get; internal set; } | ||
|
|
||
| /// <summary> | ||
| /// ID of the SKU | ||
| /// </summary> | ||
| public ulong StockKeepingUnitId { get; internal set; } | ||
|
|
||
| /// <summary> | ||
| /// ID of the parent application | ||
| /// </summary> | ||
| public ulong ApplicationId { get; internal set; } | ||
|
|
||
| /// <summary> | ||
| /// ID of the user that is granted access to the entitlement's sku | ||
| /// </summary> | ||
| public ulong? UserId { get; internal set; } | ||
|
|
||
| /// <summary> | ||
| /// Type of entitlement | ||
| /// </summary> | ||
| public DiscordEntitlementType Type { get; internal set; } | ||
|
|
||
| /// <summary> | ||
| /// Entitlement was deleted | ||
| /// </summary> | ||
| public bool Deleted { get; internal set; } | ||
|
|
||
| /// <summary> | ||
| /// Start date at which the entitlement is valid. Not present when using test entitlements. | ||
| /// </summary> | ||
| public DateTimeOffset? StartsAt { get; internal set; } | ||
|
|
||
| /// <summary> | ||
| /// Date at which the entitlement is no longer valid. Not present when using test entitlements. | ||
| /// </summary> | ||
| public DateTimeOffset? EndsAt { get; internal set; } | ||
|
|
||
| /// <summary> | ||
| /// ID of the guild that is granted access to the entitlement's sku | ||
| /// </summary> | ||
| public ulong? GuildId { get; internal set; } | ||
|
|
||
| /// <summary> | ||
| /// For consumable items, whether or not the entitlement has been consumed | ||
| /// </summary> | ||
| public bool? Consumed { get; internal set; } | ||
| } | ||
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,47 @@ | ||
| namespace DSharpPlus.Entities; | ||
|
|
||
| /// <summary> | ||
| /// Type of Entitlement | ||
| /// </summary> | ||
| public enum DiscordEntitlementType | ||
| { | ||
| /// <summary> | ||
| /// Entitlement was purchased by user | ||
| /// </summary> | ||
| Purchase, | ||
|
|
||
| /// <summary> | ||
| /// Entitlement for Discord Nitro subscription | ||
| /// </summary> | ||
| PremiumSubscription, | ||
|
|
||
| /// <summary> | ||
| /// Entitlement was gifted by developer | ||
| /// </summary> | ||
| DeveloperGift, | ||
|
|
||
| /// <summary> | ||
| /// Entitlement was purchased by a dev in application test mode | ||
| /// </summary> | ||
| TestModePurchase, | ||
|
|
||
| /// <summary> | ||
| /// Entitlement was granted when the SKU was free | ||
| /// </summary> | ||
| FreePurchase, | ||
|
|
||
| /// <summary> | ||
| /// Entitlement was gifted by another user | ||
| /// </summary> | ||
| UserGift, | ||
|
|
||
| /// <summary> | ||
| /// Entitlement was claimed by user for free as a Nitro Subscriber | ||
| /// </summary> | ||
| PremiumPurchase, | ||
|
|
||
| /// <summary> | ||
| /// Entitlement was purchased as an app subscription | ||
| /// </summary> | ||
| ApplicationSubscription | ||
| } |
37 changes: 37 additions & 0 deletions
37
DSharpPlus/Entities/Application/DiscordStockKeepingUnit.cs
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,37 @@ | ||
| namespace DSharpPlus.Entities; | ||
|
|
||
| /// <summary> | ||
| /// SKUs (stock-keeping units) in Discord represent premium offerings that can be made available to your application's users or guilds. | ||
| /// </summary> | ||
| public class DiscordStockKeepingUnit | ||
|
Plerx2493 marked this conversation as resolved.
Outdated
|
||
| { | ||
| /// <summary> | ||
| /// Id of this entity | ||
| /// </summary> | ||
| public ulong Id { get; internal set; } | ||
|
|
||
| /// <summary> | ||
| /// Type of stock keeping unit | ||
| /// </summary> | ||
| public DiscordStockKeepingUnitType Type { get; internal set; } | ||
|
|
||
| /// <summary> | ||
| /// ID of the parent application | ||
| /// </summary> | ||
| public ulong ApplicationId { get; internal set; } | ||
|
|
||
| /// <summary> | ||
| /// Customer-facing name of your premium offering | ||
| /// </summary> | ||
| public string Name { get; internal set; } | ||
|
|
||
| /// <summary> | ||
| /// System-generated URL slug based on the SKU's name | ||
| /// </summary> | ||
| public string Slug { get; internal set; } | ||
|
|
||
| /// <summary> | ||
| /// Stock keeping unit flags | ||
| /// </summary> | ||
| public DiscordStockKeepingUnitFlags Flags { get; internal set; } | ||
| } | ||
25 changes: 25 additions & 0 deletions
25
DSharpPlus/Entities/Application/DiscordStockKeepingUnitFlags.cs
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,25 @@ | ||
| using System; | ||
|
|
||
| namespace DSharpPlus.Entities; | ||
|
|
||
| /// <summary> | ||
| /// Represent additional information about the SKU | ||
| /// </summary> | ||
| [Flags] | ||
| public enum DiscordStockKeepingUnitFlags | ||
| { | ||
| /// <summary> | ||
| /// SKU is available for purchase | ||
| /// </summary> | ||
| Available = 1 << 2, | ||
|
|
||
| /// <summary> | ||
| /// Recurring SKU that can be purchased by a user and applied to a single server. Grants access to every user in that server. | ||
| /// </summary> | ||
| GuildSubscription = 1 << 7, | ||
|
|
||
| /// <summary> | ||
| /// Recurring SKU purchased by a user for themselves. Grants access to the purchasing user in every server. | ||
| /// </summary> | ||
| UserSubscription = 1 << 8 | ||
| } |
30 changes: 30 additions & 0 deletions
30
DSharpPlus/Entities/Application/DiscordStockKeepingUnitType.cs
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,30 @@ | ||
| namespace DSharpPlus.Entities; | ||
|
|
||
| /// <summary> | ||
| /// For subscriptions, SKUs will have a type of either SUBSCRIPTION represented by type: 5 or | ||
| /// SUBSCRIPTION_GROUP represented by type:6. For any current implementations, you will want to use the SKU | ||
| /// defined by type: 5. A SUBSCRIPTION_GROUP is automatically created for each SUBSCRIPTION SKU | ||
| /// and are not used at this time. | ||
| /// </summary> | ||
|
Plerx2493 marked this conversation as resolved.
|
||
| public enum DiscordStockKeepingUnitType | ||
| { | ||
| /// <summary> | ||
| /// Durable one-time purchase | ||
| /// </summary> | ||
| Durable = 2, | ||
|
|
||
| /// <summary> | ||
| /// Consumable one-time purchase | ||
| /// </summary> | ||
| Consumable = 3, | ||
|
|
||
| /// <summary> | ||
| /// Represents a recurring subscription | ||
| /// </summary> | ||
| Subscription = 5, | ||
|
|
||
| /// <summary> | ||
| /// System-generated group for each SUBSCRIPTION SKU created | ||
| /// </summary> | ||
| SubscriptionGroup = 6 | ||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.