-
-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: premium app subscriptions (#833)
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com> Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> Co-authored-by: Almeida <almeidx@pm.me>
- Loading branch information
1 parent
f51c2d9
commit ba08061
Showing
28 changed files
with
1,176 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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,115 @@ | ||
import type { Snowflake } from '../../globals.ts'; | ||
|
||
/** | ||
* https://discord.com/developers/docs/monetization/entitlements#entitlement-object-entitlement-structure | ||
*/ | ||
export interface APIEntitlement { | ||
/** | ||
* ID of the entitlement | ||
*/ | ||
id: Snowflake; | ||
/** | ||
* ID of the SKU | ||
*/ | ||
sku_id: Snowflake; | ||
/** | ||
* ID of the user that is granted access to the entitlement's sku | ||
*/ | ||
user_id?: Snowflake; | ||
/** | ||
* ID of the guild that is granted access to the entitlement's sku | ||
*/ | ||
guild_id?: Snowflake; | ||
/** | ||
* ID of the parent application | ||
*/ | ||
application_id: Snowflake; | ||
/** | ||
* Type of entitlement | ||
*/ | ||
type: EntitlementType; | ||
/** | ||
* Whether the entitlement was deleted | ||
*/ | ||
deleted: boolean; | ||
/** | ||
* Start date at which the entitlement is valid. Not present when using test entitlements. | ||
*/ | ||
starts_at?: string; | ||
/** | ||
* Date at which the entitlement is no longer valid. Not present when using test entitlements. | ||
*/ | ||
ends_at?: string; | ||
} | ||
|
||
/** | ||
* https://discord.com/developers/docs/monetization/entitlements#entitlement-object-entitlement-types | ||
*/ | ||
export enum EntitlementType { | ||
/** | ||
* Entitlement was purchased as an app subscription | ||
*/ | ||
ApplicationSubscription = 8, | ||
} | ||
|
||
/** | ||
* https://discord.com/developers/docs/monetization/skus#sku-object-sku-structure | ||
*/ | ||
export interface APISKU { | ||
/** | ||
* ID of SKU | ||
*/ | ||
id: Snowflake; | ||
/** | ||
* Type of SKU | ||
*/ | ||
type: SKUType; | ||
/** | ||
* ID of the parent application | ||
*/ | ||
application_id: Snowflake; | ||
/** | ||
* Customer-facing name of your premium offering | ||
*/ | ||
name: string; | ||
/** | ||
* System-generated URL slug based on the SKU's name | ||
*/ | ||
slug: string; | ||
/** | ||
* SKU flags combined as a bitfield | ||
* | ||
* See https://en.wikipedia.org/wiki/Bit_field | ||
*/ | ||
flags: SKUFlags; | ||
} | ||
|
||
/** | ||
* https://discord.com/developers/docs/monetization/skus#sku-object-sku-flags | ||
*/ | ||
export enum SKUFlags { | ||
/** | ||
* SKU is available for purchase | ||
*/ | ||
Available = 1 << 2, | ||
/** | ||
* Recurring SKU that can be purchased by a user and applied to a single server. | ||
* Grants access to every user in that server. | ||
*/ | ||
GuildSubscription = 1 << 7, | ||
/** | ||
* Recurring SKU purchased by a user for themselves. Grants access to the purchasing user in every server. | ||
*/ | ||
UserSubscription = 1 << 8, | ||
} | ||
|
||
export enum SKUType { | ||
/** | ||
* Represents a recurring subscription | ||
*/ | ||
Subscription = 5, | ||
/** | ||
* System-generated group for each Subscription SKU created | ||
*/ | ||
SubscriptionGroup = 6, | ||
} |
This file contains 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 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 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.
ba08061
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.
Successfully deployed to the following URLs:
discord-api-types – ./
discord-api-types-git-main-discordjs.vercel.app
discord-api-types.vercel.app
www.discord-api-types.dev
discord-api-types-discordjs.vercel.app
discord-api-types.dev