diff --git a/deno/gateway/v10.ts b/deno/gateway/v10.ts index 0122ad341..07c60fb18 100644 --- a/deno/gateway/v10.ts +++ b/deno/gateway/v10.ts @@ -278,6 +278,9 @@ export enum GatewayDispatchEvents { EntitlementCreate = 'ENTITLEMENT_CREATE', EntitlementUpdate = 'ENTITLEMENT_UPDATE', EntitlementDelete = 'ENTITLEMENT_DELETE', + SubscriptionCreate = 'SUBSCRIPTION_CREATE', + SubscriptionUpdate = 'SUBSCRIPTION_UPDATE', + SubscriptionDelete = 'SUBSCRIPTION_DELETE', } export type GatewaySendPayload = @@ -709,7 +712,9 @@ export type GatewayEntitlementModifyDispatch = DataPayload< /** * https://discord.com/developers/docs/topics/gateway-events#entitlement-create */ -export type GatewayEntitlementCreateDispatchData = GatewayEntitlementModifyDispatchData; +export type GatewayEntitlementCreateDispatchData = Omit & { + ends_at: GatewayEntitlementModifyDispatchData['ends_at'] | null; +}; /** * https://discord.com/developers/docs/topics/gateway-events#entitlement-create diff --git a/deno/gateway/v9.ts b/deno/gateway/v9.ts index 10a2f25de..d8892769c 100644 --- a/deno/gateway/v9.ts +++ b/deno/gateway/v9.ts @@ -277,6 +277,9 @@ export enum GatewayDispatchEvents { EntitlementCreate = 'ENTITLEMENT_CREATE', EntitlementUpdate = 'ENTITLEMENT_UPDATE', EntitlementDelete = 'ENTITLEMENT_DELETE', + SubscriptionCreate = 'SUBSCRIPTION_CREATE', + SubscriptionUpdate = 'SUBSCRIPTION_UPDATE', + SubscriptionDelete = 'SUBSCRIPTION_DELETE', } export type GatewaySendPayload = @@ -708,7 +711,9 @@ export type GatewayEntitlementModifyDispatch = DataPayload< /** * https://discord.com/developers/docs/topics/gateway-events#entitlement-create */ -export type GatewayEntitlementCreateDispatchData = GatewayEntitlementModifyDispatchData; +export type GatewayEntitlementCreateDispatchData = Omit & { + ends_at: GatewayEntitlementModifyDispatchData['ends_at'] | null; +}; /** * https://discord.com/developers/docs/topics/gateway-events#entitlement-create diff --git a/deno/payloads/v10/monetization.ts b/deno/payloads/v10/monetization.ts index a3948b6ce..01c66e5dc 100644 --- a/deno/payloads/v10/monetization.ts +++ b/deno/payloads/v10/monetization.ts @@ -135,6 +135,9 @@ export enum SKUFlags { UserSubscription = 1 << 8, } +/** + * https://discord.com/developers/docs/resources/sku#sku-object-sku-types + */ export enum SKUType { /** * Durable one-time purchase @@ -153,3 +156,63 @@ export enum SKUType { */ SubscriptionGroup = 6, } + +/** + * https://discord.com/developers/docs/resources/subscription#subscription-object + */ +export interface APISubscription { + /** + * ID of the subscription + */ + id: Snowflake; + /** + * ID of the user who is subscribed + */ + user_id: Snowflake; + /** + * List of SKUs subscribed to + */ + sku_ids: Snowflake[]; + /** + * List of entitlements granted for this subscription + */ + entitlement_ids: Snowflake[]; + /** + * Start of the current subscription period + */ + current_period_start: string; + /** + * End of the current subscription period + */ + current_period_end: string; + /** + * Current status of the subscription + */ + status: SubscriptionStatus; + /** + * When the subscription was canceled + */ + canceled_at: string | null; + /** + * ISO3166-1 alpha-2 country code of the payment source used to purchase the subscription. Missing unless queried with a private OAuth scope. + */ + country?: string; +} + +/** + * https://discord.com/developers/docs/resources/subscription#subscription-statuses + */ +export enum SubscriptionStatus { + /** + * Subscription is active and scheduled to renew. + */ + Active, + /** + * Subscription is active but will not renew. + */ + Ending, + /** + * Subscription is inactive and not being charged. + */ + Inactive, +} diff --git a/deno/payloads/v9/monetization.ts b/deno/payloads/v9/monetization.ts index a3948b6ce..01c66e5dc 100644 --- a/deno/payloads/v9/monetization.ts +++ b/deno/payloads/v9/monetization.ts @@ -135,6 +135,9 @@ export enum SKUFlags { UserSubscription = 1 << 8, } +/** + * https://discord.com/developers/docs/resources/sku#sku-object-sku-types + */ export enum SKUType { /** * Durable one-time purchase @@ -153,3 +156,63 @@ export enum SKUType { */ SubscriptionGroup = 6, } + +/** + * https://discord.com/developers/docs/resources/subscription#subscription-object + */ +export interface APISubscription { + /** + * ID of the subscription + */ + id: Snowflake; + /** + * ID of the user who is subscribed + */ + user_id: Snowflake; + /** + * List of SKUs subscribed to + */ + sku_ids: Snowflake[]; + /** + * List of entitlements granted for this subscription + */ + entitlement_ids: Snowflake[]; + /** + * Start of the current subscription period + */ + current_period_start: string; + /** + * End of the current subscription period + */ + current_period_end: string; + /** + * Current status of the subscription + */ + status: SubscriptionStatus; + /** + * When the subscription was canceled + */ + canceled_at: string | null; + /** + * ISO3166-1 alpha-2 country code of the payment source used to purchase the subscription. Missing unless queried with a private OAuth scope. + */ + country?: string; +} + +/** + * https://discord.com/developers/docs/resources/subscription#subscription-statuses + */ +export enum SubscriptionStatus { + /** + * Subscription is active and scheduled to renew. + */ + Active, + /** + * Subscription is active but will not renew. + */ + Ending, + /** + * Subscription is inactive and not being charged. + */ + Inactive, +} diff --git a/deno/rest/v10/mod.ts b/deno/rest/v10/mod.ts index 9c04ee85d..0c0d5b592 100644 --- a/deno/rest/v10/mod.ts +++ b/deno/rest/v10/mod.ts @@ -999,6 +999,22 @@ export const Routes = { applicationEmoji(applicationId: Snowflake, emojiId: Snowflake) { return `/applications/${applicationId}/emojis/${emojiId}` as const; }, + + /** + * Route for: + * - GET `/skus/{sku.id}/subscriptions` + */ + skuSubscriptions(skuId: Snowflake) { + return `/skus/${skuId}/subscriptions` as const; + }, + + /** + * Route for: + * - GET `/skus/{sku.id}/subscriptions/${subscription.id}` + */ + skuSubscription(skuId: Snowflake, subscriptionId: Snowflake) { + return `/skus/${skuId}/subscriptions/${subscriptionId}` as const; + }, }; export const StickerPackApplicationId = '710982414301790216'; diff --git a/deno/rest/v10/monetization.ts b/deno/rest/v10/monetization.ts index 2a92f44fc..7f8e0284e 100644 --- a/deno/rest/v10/monetization.ts +++ b/deno/rest/v10/monetization.ts @@ -1,8 +1,8 @@ import type { Snowflake } from '../../globals.ts'; -import type { APIEntitlement, APISKU } from '../../v10.ts'; +import type { APIEntitlement, APISKU, APISubscription } from '../../v10.ts'; /** - * https://discord.com/developers/docs/monetization/entitlements#list-entitlements + * https://discord.com/developers/docs/resources/entitlement#list-entitlements */ export interface RESTGetAPIEntitlementsQuery { /** @@ -39,12 +39,12 @@ export interface RESTGetAPIEntitlementsQuery { } /** - * https://discord.com/developers/docs/monetization/entitlements#list-entitlements + * https://discord.com/developers/docs/resources/entitlement#list-entitlements */ export type RESTGetAPIEntitlementsResult = APIEntitlement[]; /** - * https://discord.com/developers/docs/monetization/entitlements#create-test-entitlement + * https://discord.com/developers/docs/resources/entitlement#create-test-entitlement */ export interface RESTPostAPIEntitlementJSONBody { /** @@ -67,12 +67,12 @@ export interface RESTPostAPIEntitlementJSONBody { export type RESTPostAPIEntitlementBody = RESTPostAPIEntitlementJSONBody; /** - * https://discord.com/developers/docs/monetization/entitlements#create-test-entitlement + * https://discord.com/developers/docs/resources/entitlement#create-test-entitlement */ export type RESTPostAPIEntitlementResult = Partial>; /** - * https://discord.com/developers/docs/monetization/entitlements#create-test-entitlement + * https://discord.com/developers/docs/resources/entitlement#create-test-entitlement */ export enum EntitlementOwnerType { Guild = 1, @@ -80,16 +80,50 @@ export enum EntitlementOwnerType { } /** - * https://discord.com/developers/docs/monetization/entitlements#delete-test-entitlement + * https://discord.com/developers/docs/resources/entitlement#delete-test-entitlement */ export type RESTDeleteAPIEntitlementResult = never; /** - * https://discord.com/developers/docs/monetization/skus#list-skus + * https://discord.com/developers/docs/resources/sku#list-skus */ export type RESTGetAPISKUsResult = APISKU[]; /** - * https://discord.com/developers/docs/monetization/entitlements#consume-an-entitlement + * https://discord.com/developers/docs/resources/entitlement#consume-an-entitlement */ export type RESTPostAPIEntitlementConsumeResult = never; + +/** + * https://discord.com/developers/docs/resources/subscription#query-string-params + */ +export interface RESTGetAPISKUSubscriptionsQuery { + /** + * List subscriptions before this ID + */ + before?: Snowflake | undefined; + /** + * List subscriptions after this ID + */ + after?: Snowflake | undefined; + /** + * Number of subscriptions to return (1-100) + * + * @default 50 + */ + limit?: number | undefined; + /** + * User ID for which to return subscriptions. Required except for OAuth queries. + */ + user_id?: Snowflake | undefined; +} + +/** + * https://discord.com/developers/docs/resources/subscription#list-sku-subscriptions + */ +export type RESTGetAPISKUSubscriptionsResult = APISubscription[]; + +/** + * https://discord.com/developers/docs/resources/subscription#get-sku-subscription + */ +export type RESTGetAPISKUSubscriptionResult = APISubscription; diff --git a/deno/rest/v9/mod.ts b/deno/rest/v9/mod.ts index a4a2aa65c..f36896214 100644 --- a/deno/rest/v9/mod.ts +++ b/deno/rest/v9/mod.ts @@ -1008,6 +1008,22 @@ export const Routes = { applicationEmoji(applicationId: Snowflake, emojiId: Snowflake) { return `/applications/${applicationId}/emojis/${emojiId}` as const; }, + + /** + * Route for: + * - GET `/skus/{sku.id}/subscriptions` + */ + skuSubscriptions(skuId: Snowflake) { + return `/skus/${skuId}/subscriptions` as const; + }, + + /** + * Route for: + * - GET `/skus/{sku.id}/subscriptions/${subscription.id}` + */ + skuSubscription(skuId: Snowflake, subscriptionId: Snowflake) { + return `/skus/${skuId}/subscriptions/${subscriptionId}` as const; + }, }; export const StickerPackApplicationId = '710982414301790216'; diff --git a/deno/rest/v9/monetization.ts b/deno/rest/v9/monetization.ts index 2a92f44fc..0d08bee65 100644 --- a/deno/rest/v9/monetization.ts +++ b/deno/rest/v9/monetization.ts @@ -1,8 +1,8 @@ import type { Snowflake } from '../../globals.ts'; -import type { APIEntitlement, APISKU } from '../../v10.ts'; +import type { APIEntitlement, APISKU, APISubscription } from '../../v9.ts'; /** - * https://discord.com/developers/docs/monetization/entitlements#list-entitlements + * https://discord.com/developers/docs/resources/entitlement#list-entitlements */ export interface RESTGetAPIEntitlementsQuery { /** @@ -39,12 +39,12 @@ export interface RESTGetAPIEntitlementsQuery { } /** - * https://discord.com/developers/docs/monetization/entitlements#list-entitlements + * https://discord.com/developers/docs/resources/entitlement#list-entitlements */ export type RESTGetAPIEntitlementsResult = APIEntitlement[]; /** - * https://discord.com/developers/docs/monetization/entitlements#create-test-entitlement + * https://discord.com/developers/docs/resources/entitlement#create-test-entitlement */ export interface RESTPostAPIEntitlementJSONBody { /** @@ -67,12 +67,12 @@ export interface RESTPostAPIEntitlementJSONBody { export type RESTPostAPIEntitlementBody = RESTPostAPIEntitlementJSONBody; /** - * https://discord.com/developers/docs/monetization/entitlements#create-test-entitlement + * https://discord.com/developers/docs/resources/entitlement#create-test-entitlement */ export type RESTPostAPIEntitlementResult = Partial>; /** - * https://discord.com/developers/docs/monetization/entitlements#create-test-entitlement + * https://discord.com/developers/docs/resources/entitlement#create-test-entitlement */ export enum EntitlementOwnerType { Guild = 1, @@ -80,16 +80,50 @@ export enum EntitlementOwnerType { } /** - * https://discord.com/developers/docs/monetization/entitlements#delete-test-entitlement + * https://discord.com/developers/docs/resources/entitlement#delete-test-entitlement */ export type RESTDeleteAPIEntitlementResult = never; /** - * https://discord.com/developers/docs/monetization/skus#list-skus + * https://discord.com/developers/docs/resources/sku#list-skus */ export type RESTGetAPISKUsResult = APISKU[]; /** - * https://discord.com/developers/docs/monetization/entitlements#consume-an-entitlement + * https://discord.com/developers/docs/resources/entitlement#consume-an-entitlement */ export type RESTPostAPIEntitlementConsumeResult = never; + +/** + * https://discord.com/developers/docs/resources/subscription#query-string-params + */ +export interface RESTGetAPISKUSubscriptionsQuery { + /** + * List subscriptions before this ID + */ + before?: Snowflake | undefined; + /** + * List subscriptions after this ID + */ + after?: Snowflake | undefined; + /** + * Number of subscriptions to return (1-100) + * + * @default 50 + */ + limit?: number | undefined; + /** + * User ID for which to return subscriptions. Required except for OAuth queries. + */ + user_id?: Snowflake | undefined; +} + +/** + * https://discord.com/developers/docs/resources/subscription#list-sku-subscriptions + */ +export type RESTGetAPISKUSubscriptionsResult = APISubscription[]; + +/** + * https://discord.com/developers/docs/resources/subscription#get-sku-subscription + */ +export type RESTGetAPISKUSubscriptionResult = APISubscription; diff --git a/gateway/v10.ts b/gateway/v10.ts index 7512ab82c..130775d64 100644 --- a/gateway/v10.ts +++ b/gateway/v10.ts @@ -278,6 +278,9 @@ export enum GatewayDispatchEvents { EntitlementCreate = 'ENTITLEMENT_CREATE', EntitlementUpdate = 'ENTITLEMENT_UPDATE', EntitlementDelete = 'ENTITLEMENT_DELETE', + SubscriptionCreate = 'SUBSCRIPTION_CREATE', + SubscriptionUpdate = 'SUBSCRIPTION_UPDATE', + SubscriptionDelete = 'SUBSCRIPTION_DELETE', } export type GatewaySendPayload = @@ -709,7 +712,9 @@ export type GatewayEntitlementModifyDispatch = DataPayload< /** * https://discord.com/developers/docs/topics/gateway-events#entitlement-create */ -export type GatewayEntitlementCreateDispatchData = GatewayEntitlementModifyDispatchData; +export type GatewayEntitlementCreateDispatchData = Omit & { + ends_at: GatewayEntitlementModifyDispatchData['ends_at'] | null; +}; /** * https://discord.com/developers/docs/topics/gateway-events#entitlement-create diff --git a/gateway/v9.ts b/gateway/v9.ts index 105e8a2ac..b276157fe 100644 --- a/gateway/v9.ts +++ b/gateway/v9.ts @@ -277,6 +277,9 @@ export enum GatewayDispatchEvents { EntitlementCreate = 'ENTITLEMENT_CREATE', EntitlementUpdate = 'ENTITLEMENT_UPDATE', EntitlementDelete = 'ENTITLEMENT_DELETE', + SubscriptionCreate = 'SUBSCRIPTION_CREATE', + SubscriptionUpdate = 'SUBSCRIPTION_UPDATE', + SubscriptionDelete = 'SUBSCRIPTION_DELETE', } export type GatewaySendPayload = @@ -708,7 +711,9 @@ export type GatewayEntitlementModifyDispatch = DataPayload< /** * https://discord.com/developers/docs/topics/gateway-events#entitlement-create */ -export type GatewayEntitlementCreateDispatchData = GatewayEntitlementModifyDispatchData; +export type GatewayEntitlementCreateDispatchData = Omit & { + ends_at: GatewayEntitlementModifyDispatchData['ends_at'] | null; +}; /** * https://discord.com/developers/docs/topics/gateway-events#entitlement-create diff --git a/payloads/v10/monetization.ts b/payloads/v10/monetization.ts index a2d50b466..47d6e4cd9 100644 --- a/payloads/v10/monetization.ts +++ b/payloads/v10/monetization.ts @@ -135,6 +135,9 @@ export enum SKUFlags { UserSubscription = 1 << 8, } +/** + * https://discord.com/developers/docs/resources/sku#sku-object-sku-types + */ export enum SKUType { /** * Durable one-time purchase @@ -153,3 +156,63 @@ export enum SKUType { */ SubscriptionGroup = 6, } + +/** + * https://discord.com/developers/docs/resources/subscription#subscription-object + */ +export interface APISubscription { + /** + * ID of the subscription + */ + id: Snowflake; + /** + * ID of the user who is subscribed + */ + user_id: Snowflake; + /** + * List of SKUs subscribed to + */ + sku_ids: Snowflake[]; + /** + * List of entitlements granted for this subscription + */ + entitlement_ids: Snowflake[]; + /** + * Start of the current subscription period + */ + current_period_start: string; + /** + * End of the current subscription period + */ + current_period_end: string; + /** + * Current status of the subscription + */ + status: SubscriptionStatus; + /** + * When the subscription was canceled + */ + canceled_at: string | null; + /** + * ISO3166-1 alpha-2 country code of the payment source used to purchase the subscription. Missing unless queried with a private OAuth scope. + */ + country?: string; +} + +/** + * https://discord.com/developers/docs/resources/subscription#subscription-statuses + */ +export enum SubscriptionStatus { + /** + * Subscription is active and scheduled to renew. + */ + Active, + /** + * Subscription is active but will not renew. + */ + Ending, + /** + * Subscription is inactive and not being charged. + */ + Inactive, +} diff --git a/payloads/v9/monetization.ts b/payloads/v9/monetization.ts index a2d50b466..47d6e4cd9 100644 --- a/payloads/v9/monetization.ts +++ b/payloads/v9/monetization.ts @@ -135,6 +135,9 @@ export enum SKUFlags { UserSubscription = 1 << 8, } +/** + * https://discord.com/developers/docs/resources/sku#sku-object-sku-types + */ export enum SKUType { /** * Durable one-time purchase @@ -153,3 +156,63 @@ export enum SKUType { */ SubscriptionGroup = 6, } + +/** + * https://discord.com/developers/docs/resources/subscription#subscription-object + */ +export interface APISubscription { + /** + * ID of the subscription + */ + id: Snowflake; + /** + * ID of the user who is subscribed + */ + user_id: Snowflake; + /** + * List of SKUs subscribed to + */ + sku_ids: Snowflake[]; + /** + * List of entitlements granted for this subscription + */ + entitlement_ids: Snowflake[]; + /** + * Start of the current subscription period + */ + current_period_start: string; + /** + * End of the current subscription period + */ + current_period_end: string; + /** + * Current status of the subscription + */ + status: SubscriptionStatus; + /** + * When the subscription was canceled + */ + canceled_at: string | null; + /** + * ISO3166-1 alpha-2 country code of the payment source used to purchase the subscription. Missing unless queried with a private OAuth scope. + */ + country?: string; +} + +/** + * https://discord.com/developers/docs/resources/subscription#subscription-statuses + */ +export enum SubscriptionStatus { + /** + * Subscription is active and scheduled to renew. + */ + Active, + /** + * Subscription is active but will not renew. + */ + Ending, + /** + * Subscription is inactive and not being charged. + */ + Inactive, +} diff --git a/rest/v10/index.ts b/rest/v10/index.ts index b0754288c..7d3804bf3 100644 --- a/rest/v10/index.ts +++ b/rest/v10/index.ts @@ -999,6 +999,22 @@ export const Routes = { applicationEmoji(applicationId: Snowflake, emojiId: Snowflake) { return `/applications/${applicationId}/emojis/${emojiId}` as const; }, + + /** + * Route for: + * - GET `/skus/{sku.id}/subscriptions` + */ + skuSubscriptions(skuId: Snowflake) { + return `/skus/${skuId}/subscriptions` as const; + }, + + /** + * Route for: + * - GET `/skus/{sku.id}/subscriptions/${subscription.id}` + */ + skuSubscription(skuId: Snowflake, subscriptionId: Snowflake) { + return `/skus/${skuId}/subscriptions/${subscriptionId}` as const; + }, }; export const StickerPackApplicationId = '710982414301790216'; diff --git a/rest/v10/monetization.ts b/rest/v10/monetization.ts index 2c65638ed..67a87b9a2 100644 --- a/rest/v10/monetization.ts +++ b/rest/v10/monetization.ts @@ -1,8 +1,8 @@ import type { Snowflake } from '../../globals'; -import type { APIEntitlement, APISKU } from '../../v10'; +import type { APIEntitlement, APISKU, APISubscription } from '../../v10'; /** - * https://discord.com/developers/docs/monetization/entitlements#list-entitlements + * https://discord.com/developers/docs/resources/entitlement#list-entitlements */ export interface RESTGetAPIEntitlementsQuery { /** @@ -39,12 +39,12 @@ export interface RESTGetAPIEntitlementsQuery { } /** - * https://discord.com/developers/docs/monetization/entitlements#list-entitlements + * https://discord.com/developers/docs/resources/entitlement#list-entitlements */ export type RESTGetAPIEntitlementsResult = APIEntitlement[]; /** - * https://discord.com/developers/docs/monetization/entitlements#create-test-entitlement + * https://discord.com/developers/docs/resources/entitlement#create-test-entitlement */ export interface RESTPostAPIEntitlementJSONBody { /** @@ -67,12 +67,12 @@ export interface RESTPostAPIEntitlementJSONBody { export type RESTPostAPIEntitlementBody = RESTPostAPIEntitlementJSONBody; /** - * https://discord.com/developers/docs/monetization/entitlements#create-test-entitlement + * https://discord.com/developers/docs/resources/entitlement#create-test-entitlement */ export type RESTPostAPIEntitlementResult = Partial>; /** - * https://discord.com/developers/docs/monetization/entitlements#create-test-entitlement + * https://discord.com/developers/docs/resources/entitlement#create-test-entitlement */ export enum EntitlementOwnerType { Guild = 1, @@ -80,16 +80,50 @@ export enum EntitlementOwnerType { } /** - * https://discord.com/developers/docs/monetization/entitlements#delete-test-entitlement + * https://discord.com/developers/docs/resources/entitlement#delete-test-entitlement */ export type RESTDeleteAPIEntitlementResult = never; /** - * https://discord.com/developers/docs/monetization/skus#list-skus + * https://discord.com/developers/docs/resources/sku#list-skus */ export type RESTGetAPISKUsResult = APISKU[]; /** - * https://discord.com/developers/docs/monetization/entitlements#consume-an-entitlement + * https://discord.com/developers/docs/resources/entitlement#consume-an-entitlement */ export type RESTPostAPIEntitlementConsumeResult = never; + +/** + * https://discord.com/developers/docs/resources/subscription#query-string-params + */ +export interface RESTGetAPISKUSubscriptionsQuery { + /** + * List subscriptions before this ID + */ + before?: Snowflake | undefined; + /** + * List subscriptions after this ID + */ + after?: Snowflake | undefined; + /** + * Number of subscriptions to return (1-100) + * + * @default 50 + */ + limit?: number | undefined; + /** + * User ID for which to return subscriptions. Required except for OAuth queries. + */ + user_id?: Snowflake | undefined; +} + +/** + * https://discord.com/developers/docs/resources/subscription#list-sku-subscriptions + */ +export type RESTGetAPISKUSubscriptionsResult = APISubscription[]; + +/** + * https://discord.com/developers/docs/resources/subscription#get-sku-subscription + */ +export type RESTGetAPISKUSubscriptionResult = APISubscription; diff --git a/rest/v9/index.ts b/rest/v9/index.ts index 5ad2f3fc3..648f1ace2 100644 --- a/rest/v9/index.ts +++ b/rest/v9/index.ts @@ -1008,6 +1008,22 @@ export const Routes = { applicationEmoji(applicationId: Snowflake, emojiId: Snowflake) { return `/applications/${applicationId}/emojis/${emojiId}` as const; }, + + /** + * Route for: + * - GET `/skus/{sku.id}/subscriptions` + */ + skuSubscriptions(skuId: Snowflake) { + return `/skus/${skuId}/subscriptions` as const; + }, + + /** + * Route for: + * - GET `/skus/{sku.id}/subscriptions/${subscription.id}` + */ + skuSubscription(skuId: Snowflake, subscriptionId: Snowflake) { + return `/skus/${skuId}/subscriptions/${subscriptionId}` as const; + }, }; export const StickerPackApplicationId = '710982414301790216'; diff --git a/rest/v9/monetization.ts b/rest/v9/monetization.ts index 2c65638ed..aa88151d2 100644 --- a/rest/v9/monetization.ts +++ b/rest/v9/monetization.ts @@ -1,8 +1,8 @@ import type { Snowflake } from '../../globals'; -import type { APIEntitlement, APISKU } from '../../v10'; +import type { APIEntitlement, APISKU, APISubscription } from '../../v9'; /** - * https://discord.com/developers/docs/monetization/entitlements#list-entitlements + * https://discord.com/developers/docs/resources/entitlement#list-entitlements */ export interface RESTGetAPIEntitlementsQuery { /** @@ -39,12 +39,12 @@ export interface RESTGetAPIEntitlementsQuery { } /** - * https://discord.com/developers/docs/monetization/entitlements#list-entitlements + * https://discord.com/developers/docs/resources/entitlement#list-entitlements */ export type RESTGetAPIEntitlementsResult = APIEntitlement[]; /** - * https://discord.com/developers/docs/monetization/entitlements#create-test-entitlement + * https://discord.com/developers/docs/resources/entitlement#create-test-entitlement */ export interface RESTPostAPIEntitlementJSONBody { /** @@ -67,12 +67,12 @@ export interface RESTPostAPIEntitlementJSONBody { export type RESTPostAPIEntitlementBody = RESTPostAPIEntitlementJSONBody; /** - * https://discord.com/developers/docs/monetization/entitlements#create-test-entitlement + * https://discord.com/developers/docs/resources/entitlement#create-test-entitlement */ export type RESTPostAPIEntitlementResult = Partial>; /** - * https://discord.com/developers/docs/monetization/entitlements#create-test-entitlement + * https://discord.com/developers/docs/resources/entitlement#create-test-entitlement */ export enum EntitlementOwnerType { Guild = 1, @@ -80,16 +80,50 @@ export enum EntitlementOwnerType { } /** - * https://discord.com/developers/docs/monetization/entitlements#delete-test-entitlement + * https://discord.com/developers/docs/resources/entitlement#delete-test-entitlement */ export type RESTDeleteAPIEntitlementResult = never; /** - * https://discord.com/developers/docs/monetization/skus#list-skus + * https://discord.com/developers/docs/resources/sku#list-skus */ export type RESTGetAPISKUsResult = APISKU[]; /** - * https://discord.com/developers/docs/monetization/entitlements#consume-an-entitlement + * https://discord.com/developers/docs/resources/entitlement#consume-an-entitlement */ export type RESTPostAPIEntitlementConsumeResult = never; + +/** + * https://discord.com/developers/docs/resources/subscription#query-string-params + */ +export interface RESTGetAPISKUSubscriptionsQuery { + /** + * List subscriptions before this ID + */ + before?: Snowflake | undefined; + /** + * List subscriptions after this ID + */ + after?: Snowflake | undefined; + /** + * Number of subscriptions to return (1-100) + * + * @default 50 + */ + limit?: number | undefined; + /** + * User ID for which to return subscriptions. Required except for OAuth queries. + */ + user_id?: Snowflake | undefined; +} + +/** + * https://discord.com/developers/docs/resources/subscription#list-sku-subscriptions + */ +export type RESTGetAPISKUSubscriptionsResult = APISubscription[]; + +/** + * https://discord.com/developers/docs/resources/subscription#get-sku-subscription + */ +export type RESTGetAPISKUSubscriptionResult = APISubscription;