From 5eda23f21ec4f069bbd85ab240d4c1d70006b430 Mon Sep 17 00:00:00 2001 From: Vitor Date: Fri, 15 Jul 2022 15:24:15 +0100 Subject: [PATCH] refactor: applu some requested changes --- deno/payloads/v10/achievement.ts | 45 ++++ deno/payloads/v10/lobby.ts | 86 +++++++ deno/payloads/v10/mod.ts | 4 +- deno/payloads/{v9/gamesdk.ts => v10/store.ts} | 124 +--------- deno/payloads/v9/achievement.ts | 45 ++++ deno/payloads/v9/lobby.ts | 86 +++++++ deno/payloads/v9/mod.ts | 4 +- deno/payloads/{v10/gamesdk.ts => v9/store.ts} | 128 +--------- deno/rest/v10/achievement.ts | 36 +++ deno/rest/v10/gamesdk.ts | 224 ------------------ deno/rest/v10/lobby.ts | 106 +++++++++ deno/rest/v10/mod.ts | 4 +- deno/rest/v10/store.ts | 85 +++++++ deno/rest/v9/achievement.ts | 36 +++ deno/rest/v9/gamesdk.ts | 224 ------------------ deno/rest/v9/lobby.ts | 106 +++++++++ deno/rest/v9/mod.ts | 4 +- deno/rest/v9/store.ts | 85 +++++++ payloads/v10/achievement.ts | 45 ++++ payloads/v10/index.ts | 4 +- payloads/v10/lobby.ts | 86 +++++++ payloads/{v9/gamesdk.ts => v10/store.ts} | 124 +--------- payloads/v9/achievement.ts | 45 ++++ payloads/v9/index.ts | 4 +- payloads/v9/lobby.ts | 86 +++++++ payloads/{v10/gamesdk.ts => v9/store.ts} | 128 +--------- rest/v10/achievement.ts | 36 +++ rest/v10/gamesdk.ts | 224 ------------------ rest/v10/index.ts | 4 +- rest/v10/lobby.ts | 106 +++++++++ rest/v10/store.ts | 85 +++++++ rest/v9/achievement.ts | 36 +++ rest/v9/gamesdk.ts | 224 ------------------ rest/v9/index.ts | 4 +- rest/v9/lobby.ts | 106 +++++++++ rest/v9/store.ts | 85 +++++++ 36 files changed, 1472 insertions(+), 1392 deletions(-) create mode 100644 deno/payloads/v10/achievement.ts create mode 100644 deno/payloads/v10/lobby.ts rename deno/payloads/{v9/gamesdk.ts => v10/store.ts} (58%) create mode 100644 deno/payloads/v9/achievement.ts create mode 100644 deno/payloads/v9/lobby.ts rename deno/payloads/{v10/gamesdk.ts => v9/store.ts} (58%) create mode 100644 deno/rest/v10/achievement.ts delete mode 100644 deno/rest/v10/gamesdk.ts create mode 100644 deno/rest/v10/lobby.ts create mode 100644 deno/rest/v10/store.ts create mode 100644 deno/rest/v9/achievement.ts delete mode 100644 deno/rest/v9/gamesdk.ts create mode 100644 deno/rest/v9/lobby.ts create mode 100644 deno/rest/v9/store.ts create mode 100644 payloads/v10/achievement.ts create mode 100644 payloads/v10/lobby.ts rename payloads/{v9/gamesdk.ts => v10/store.ts} (58%) create mode 100644 payloads/v9/achievement.ts create mode 100644 payloads/v9/lobby.ts rename payloads/{v10/gamesdk.ts => v9/store.ts} (58%) create mode 100644 rest/v10/achievement.ts delete mode 100644 rest/v10/gamesdk.ts create mode 100644 rest/v10/lobby.ts create mode 100644 rest/v10/store.ts create mode 100644 rest/v9/achievement.ts delete mode 100644 rest/v9/gamesdk.ts create mode 100644 rest/v9/lobby.ts create mode 100644 rest/v9/store.ts diff --git a/deno/payloads/v10/achievement.ts b/deno/payloads/v10/achievement.ts new file mode 100644 index 000000000..7a6e5cc6b --- /dev/null +++ b/deno/payloads/v10/achievement.ts @@ -0,0 +1,45 @@ +/** + * Types extracted from https://discord.com/developers/docs/game-sdk/achievements + */ + +import type { Snowflake } from '../../globals.ts'; +import type { LocalizationMap } from '../common.ts'; + +export interface APIAchievement { + /** + * Unique id of the application + */ + application_id: Snowflake; + /** + * Name of this achievement + */ + name: string; + /** + * Localization dictionary for the `name` field + */ + name_localizations: LocalizationMap | null; + /** + * The description of this achievement + */ + description: string; + /** + * Localization dictionary for the `description` field + */ + description_localizations: LocalizationMap | null; + /** + * Whether this achievement is secret + */ + secret: boolean; + /** + * Whether this achievement is secure + */ + secure: boolean; + /** + * Unique id of this achievement + */ + id: Snowflake; + /** + * The achievement icon hash + */ + icon_hash: string; +} diff --git a/deno/payloads/v10/lobby.ts b/deno/payloads/v10/lobby.ts new file mode 100644 index 000000000..68021c93c --- /dev/null +++ b/deno/payloads/v10/lobby.ts @@ -0,0 +1,86 @@ +/** + * Types extracted from https://discord.com/developers/docs/game-sdk/lobbies + */ + +import type { Snowflake } from '../../globals.ts'; + +export interface APILobby { + /** + * Unique id of this lobby + */ + id: Snowflake; + /** + * The type of this lobby (whether it is private or public) + * + * @default Private + */ + type: LobbyType; + /** + * The user id of the lobby owner + */ + owner_id: Snowflake; + /** + * The password of this lobby + */ + secret: string; + /** + * The maximum capacity of this lobby + * + * @default 16 + */ + capacity: number; + /** + * Whether this lobby can be joined + */ + locked: boolean; + /** + * Unique id of the application + */ + application_id: Snowflake; + /** + * Metadata for this lobby. key/value pairs with type `string` + * + * @default {} + */ + metadata: Record; + /** + * The region of this lobby. Defaults the region of the requesting server's IP address + */ + region: LobbyRegion; +} + +export enum LobbyRegion { + Atlanta = 'atlanta', + Brazil = 'brazil', + Bucharest = 'bucharest', + BuenosAires = 'buenos-aires', + Dubai = 'dubai', + Finland = 'finland', + Hongkong = 'hongkong', + India = 'india', + Japan = 'japan', + Madrid = 'madrid', + Milan = 'milan', + Montreal = 'montreal', + Newark = 'newark', + Rotterdam = 'rotterdam', + Russia = 'russia', + SantaClara = 'santa-clara', + Santiago = 'santiago', + Seattle = 'seattle', + Singapore = 'singapore', + SouthKorea = 'south-korea', + SouthAfrica = 'southafrica', + StPete = 'st-pete', + Stockholm = 'stockholm', + Sydney = 'sydney', + UsCentral = 'us-central', + UsEast = 'us-east', + UsSouth = 'us-south', + UsWest = 'us-west', +} + +export enum LobbyType { + Private = 1, + Public, +} diff --git a/deno/payloads/v10/mod.ts b/deno/payloads/v10/mod.ts index 1f9e6fca9..7aa519490 100644 --- a/deno/payloads/v10/mod.ts +++ b/deno/payloads/v10/mod.ts @@ -1,18 +1,20 @@ export * from '../common.ts'; +export * from './achievement.ts'; export * from './application.ts'; export * from './auditLog.ts'; export * from './channel.ts'; export * from './emoji.ts'; -export * from './gamesdk.ts'; export * from './gateway.ts'; export * from './guild.ts'; export * from './guildScheduledEvent.ts'; export * from './interactions.ts'; export * from './invite.ts'; +export * from './lobby.ts'; export * from './oauth2.ts'; export * from './permissions.ts'; export * from './stageInstance.ts'; export * from './sticker.ts'; +export * from './store.ts'; export * from './teams.ts'; export * from './template.ts'; export * from './user.ts'; diff --git a/deno/payloads/v9/gamesdk.ts b/deno/payloads/v10/store.ts similarity index 58% rename from deno/payloads/v9/gamesdk.ts rename to deno/payloads/v10/store.ts index 126e19639..d1b6ddfb9 100644 --- a/deno/payloads/v9/gamesdk.ts +++ b/deno/payloads/v10/store.ts @@ -1,126 +1,10 @@ /** - * Types extracted from https://discord.com/developers/docs/game-sdk/sdk-starter-guide + * Types extracted from https://discord.com/developers/docs/game-sdk/store */ import type { Snowflake } from '../../globals.ts'; import type { LocalizationMap } from '../common.ts'; -export interface APIAchievement { - /** - * Unique id of the application - */ - application_id: Snowflake; - /** - * Name of this achievement - */ - name: string; - /** - * Localization dictionary for the `name` field - */ - name_localizations: LocalizationMap | null; - /** - * The description of this achievement - */ - description: string; - /** - * Localization dictionary for the `description` field - */ - description_localizations: keyof LocalizationMap | null; - /** - * Whether this achievement is secret - */ - secret: boolean; - /** - * Whether this achievement is secure - */ - secure: boolean; - /** - * Unique id of this achievement - */ - id: Snowflake; - /** - * The achievement icon hash - */ - icon_hash: string; -} - -export interface APILobby { - /** - * Unique id of this lobby - */ - id: Snowflake; - /** - * The type of this lobby (whether it is private or public) - */ - type: LobbyType; - /** - * The user id of the lobby owner - */ - owner_id: Snowflake; - /** - * The password of this lobby - */ - secret: string; - /** - * The maximum capacity of this lobby - * - * @default 16 - */ - capacity: number; - /** - * Whether this lobby can be joined - */ - locked: boolean; - /** - * Unique id of the application - */ - application_id: Snowflake; - /** - * Metadata for this lobby. key/value pairs with type `string` - */ - metadata: Record; - /** - * The region of this lobby. Defaults the region of the requesting server's IP address - */ - region: LobbyRegion; -} - -export enum LobbyRegion { - Atlanta = 'atlanta', - Brazil = 'brazil', - Bucharest = 'bucharest', - BuenosAires = 'buenos-aires', - Dubai = 'dubai', - Finland = 'finland', - Hongkong = 'hongkong', - India = 'india', - Japan = 'japan', - Madrid = 'madrid', - Milan = 'milan', - Montreal = 'montreal', - Newark = 'newark', - Rotterdam = 'rotterdam', - Russia = 'russia', - SantaClara = 'santa-clara', - Santiago = 'santiago', - Seattle = 'seattle', - Singapore = 'singapore', - SouthKorea = 'south-korea', - SouthAfrica = 'southafrica', - StPete = 'st-pete', - Stockholm = 'stockholm', - Sydney = 'sydney', - UsCentral = 'us-central', - UsEast = 'us-east', - UsSouth = 'us-south', - UsWest = 'us-west', -} - -export enum LobbyType { - Private = 1, - Public, -} - export interface APISKU { /** * Unique id of this SKU @@ -185,7 +69,7 @@ export interface APISKU { /** * @unstable This field is missing documentation */ - locales: LocalizationMap[]; + locales: keyof LocalizationMap[]; /** * @unstable This field is missing documentation */ @@ -200,13 +84,13 @@ export enum SKUType { /** * The SKU is a DLC */ - Dlc, + DLC, /** * The SKU is consumable (in-app purchase) */ Consumable, /** - * The SKU is a bundle (comprising by `Application`, `Dlc` and `Consumable` all together) + * The SKU is a bundle (comprising by `Application`, `DLC` and `Consumable` all together) */ Bundle, } diff --git a/deno/payloads/v9/achievement.ts b/deno/payloads/v9/achievement.ts new file mode 100644 index 000000000..7a6e5cc6b --- /dev/null +++ b/deno/payloads/v9/achievement.ts @@ -0,0 +1,45 @@ +/** + * Types extracted from https://discord.com/developers/docs/game-sdk/achievements + */ + +import type { Snowflake } from '../../globals.ts'; +import type { LocalizationMap } from '../common.ts'; + +export interface APIAchievement { + /** + * Unique id of the application + */ + application_id: Snowflake; + /** + * Name of this achievement + */ + name: string; + /** + * Localization dictionary for the `name` field + */ + name_localizations: LocalizationMap | null; + /** + * The description of this achievement + */ + description: string; + /** + * Localization dictionary for the `description` field + */ + description_localizations: LocalizationMap | null; + /** + * Whether this achievement is secret + */ + secret: boolean; + /** + * Whether this achievement is secure + */ + secure: boolean; + /** + * Unique id of this achievement + */ + id: Snowflake; + /** + * The achievement icon hash + */ + icon_hash: string; +} diff --git a/deno/payloads/v9/lobby.ts b/deno/payloads/v9/lobby.ts new file mode 100644 index 000000000..68021c93c --- /dev/null +++ b/deno/payloads/v9/lobby.ts @@ -0,0 +1,86 @@ +/** + * Types extracted from https://discord.com/developers/docs/game-sdk/lobbies + */ + +import type { Snowflake } from '../../globals.ts'; + +export interface APILobby { + /** + * Unique id of this lobby + */ + id: Snowflake; + /** + * The type of this lobby (whether it is private or public) + * + * @default Private + */ + type: LobbyType; + /** + * The user id of the lobby owner + */ + owner_id: Snowflake; + /** + * The password of this lobby + */ + secret: string; + /** + * The maximum capacity of this lobby + * + * @default 16 + */ + capacity: number; + /** + * Whether this lobby can be joined + */ + locked: boolean; + /** + * Unique id of the application + */ + application_id: Snowflake; + /** + * Metadata for this lobby. key/value pairs with type `string` + * + * @default {} + */ + metadata: Record; + /** + * The region of this lobby. Defaults the region of the requesting server's IP address + */ + region: LobbyRegion; +} + +export enum LobbyRegion { + Atlanta = 'atlanta', + Brazil = 'brazil', + Bucharest = 'bucharest', + BuenosAires = 'buenos-aires', + Dubai = 'dubai', + Finland = 'finland', + Hongkong = 'hongkong', + India = 'india', + Japan = 'japan', + Madrid = 'madrid', + Milan = 'milan', + Montreal = 'montreal', + Newark = 'newark', + Rotterdam = 'rotterdam', + Russia = 'russia', + SantaClara = 'santa-clara', + Santiago = 'santiago', + Seattle = 'seattle', + Singapore = 'singapore', + SouthKorea = 'south-korea', + SouthAfrica = 'southafrica', + StPete = 'st-pete', + Stockholm = 'stockholm', + Sydney = 'sydney', + UsCentral = 'us-central', + UsEast = 'us-east', + UsSouth = 'us-south', + UsWest = 'us-west', +} + +export enum LobbyType { + Private = 1, + Public, +} diff --git a/deno/payloads/v9/mod.ts b/deno/payloads/v9/mod.ts index 1f9e6fca9..7aa519490 100644 --- a/deno/payloads/v9/mod.ts +++ b/deno/payloads/v9/mod.ts @@ -1,18 +1,20 @@ export * from '../common.ts'; +export * from './achievement.ts'; export * from './application.ts'; export * from './auditLog.ts'; export * from './channel.ts'; export * from './emoji.ts'; -export * from './gamesdk.ts'; export * from './gateway.ts'; export * from './guild.ts'; export * from './guildScheduledEvent.ts'; export * from './interactions.ts'; export * from './invite.ts'; +export * from './lobby.ts'; export * from './oauth2.ts'; export * from './permissions.ts'; export * from './stageInstance.ts'; export * from './sticker.ts'; +export * from './store.ts'; export * from './teams.ts'; export * from './template.ts'; export * from './user.ts'; diff --git a/deno/payloads/v10/gamesdk.ts b/deno/payloads/v9/store.ts similarity index 58% rename from deno/payloads/v10/gamesdk.ts rename to deno/payloads/v9/store.ts index 47cd5a026..d1b6ddfb9 100644 --- a/deno/payloads/v10/gamesdk.ts +++ b/deno/payloads/v9/store.ts @@ -1,130 +1,10 @@ /** - * Types extracted from https://discord.com/developers/docs/game-sdk/sdk-starter-guide + * Types extracted from https://discord.com/developers/docs/game-sdk/store */ import type { Snowflake } from '../../globals.ts'; import type { LocalizationMap } from '../common.ts'; -export interface APIAchievement { - /** - * Unique id of the application - */ - application_id: Snowflake; - /** - * Name of this achievement - */ - name: string; - /** - * Localization dictionary for the `name` field - */ - name_localizations: LocalizationMap | null; - /** - * The description of this achievement - */ - description: string; - /** - * Localization dictionary for the `description` field - */ - description_localizations: keyof LocalizationMap | null; - /** - * Whether this achievement is secret - */ - secret: boolean; - /** - * Whether this achievement is secure - */ - secure: boolean; - /** - * Unique id of this achievement - */ - id: Snowflake; - /** - * The achievement icon hash - */ - icon_hash: string; -} - -export interface APILobby { - /** - * Unique id of this lobby - */ - id: Snowflake; - /** - * The type of this lobby (whether it is private or public) - * - * @default Private - */ - type: LobbyType; - /** - * The user id of the lobby owner - */ - owner_id: Snowflake; - /** - * The password of this lobby - */ - secret: string; - /** - * The maximum capacity of this lobby - * - * @default 16 - */ - capacity: number; - /** - * Whether this lobby can be joined - */ - locked: boolean; - /** - * Unique id of the application - */ - application_id: Snowflake; - /** - * Metadata for this lobby. key/value pairs with type `string` - * - * @default {} - */ - metadata: Record; - /** - * The region of this lobby. Defaults the region of the requesting server's IP address - */ - region: LobbyRegion; -} - -export enum LobbyRegion { - Atlanta = 'atlanta', - Brazil = 'brazil', - Bucharest = 'bucharest', - BuenosAires = 'buenos-aires', - Dubai = 'dubai', - Finland = 'finland', - Hongkong = 'hongkong', - India = 'india', - Japan = 'japan', - Madrid = 'madrid', - Milan = 'milan', - Montreal = 'montreal', - Newark = 'newark', - Rotterdam = 'rotterdam', - Russia = 'russia', - SantaClara = 'santa-clara', - Santiago = 'santiago', - Seattle = 'seattle', - Singapore = 'singapore', - SouthKorea = 'south-korea', - SouthAfrica = 'southafrica', - StPete = 'st-pete', - Stockholm = 'stockholm', - Sydney = 'sydney', - UsCentral = 'us-central', - UsEast = 'us-east', - UsSouth = 'us-south', - UsWest = 'us-west', -} - -export enum LobbyType { - Private = 1, - Public, -} - export interface APISKU { /** * Unique id of this SKU @@ -189,7 +69,7 @@ export interface APISKU { /** * @unstable This field is missing documentation */ - locales: LocalizationMap[]; + locales: keyof LocalizationMap[]; /** * @unstable This field is missing documentation */ @@ -204,13 +84,13 @@ export enum SKUType { /** * The SKU is a DLC */ - Dlc, + DLC, /** * The SKU is consumable (in-app purchase) */ Consumable, /** - * The SKU is a bundle (comprising by `Application`, `Dlc` and `Consumable` all together) + * The SKU is a bundle (comprising by `Application`, `DLC` and `Consumable` all together) */ Bundle, } diff --git a/deno/rest/v10/achievement.ts b/deno/rest/v10/achievement.ts new file mode 100644 index 000000000..01b780c7b --- /dev/null +++ b/deno/rest/v10/achievement.ts @@ -0,0 +1,36 @@ +import type { APIAchievement } from '../../payloads/v10/achievement.ts'; + +/** + * https://discord.com/developers/docs/game-sdk/achievements#get-achievements + */ +export type RESTGetAPIAchievementsResult = APIAchievement[]; + +/** + * https://discord.com/developers/docs/game-sdk/achievements#get-achievement + */ +export type RESTGetAPIAchievementResult = APIAchievement; + +/** + * https://discord.com/developers/docs/game-sdk/achievements#create-achievement + */ +export type RESTPostAPIAchievementJSONBody = Omit; + +/** + * https://discord.com/developers/docs/game-sdk/achievements#create-achievement + */ +export type RESTPostAPIAchievementResult = APIAchievement; + +/** + * https://discord.com/developers/docs/game-sdk/achievements#update-achievement + */ +export type RESTPatchAPIAchievementJSONBody = Omit, 'application_id' | 'id'>; + +/** + * https://discord.com/developers/docs/game-sdk/achievements#update-achievement + */ +export type RESTPatchAPIAchievementResult = APIAchievement; + +/** + * https://discord.com/developers/docs/game-sdk/achievements#delete-achievement + */ +export type RESTDeleteAPIAchievementResult = never; diff --git a/deno/rest/v10/gamesdk.ts b/deno/rest/v10/gamesdk.ts deleted file mode 100644 index 018af545e..000000000 --- a/deno/rest/v10/gamesdk.ts +++ /dev/null @@ -1,224 +0,0 @@ -import type { Snowflake } from '../../globals.ts'; -import type { APIAchievement, APIEntitlement, APILobby, APISKU } from '../../payloads/v10/gamesdk.ts'; - -/** - * https://discord.com/developers/docs/game-sdk/achievements#get-achievements - */ -export type RESTGetAPIAchievementsResult = APIAchievement[]; - -/** - * https://discord.com/developers/docs/game-sdk/achievements#get-achievement - */ -export type RESTGetAPIAchievementResult = APIAchievement; - -/** - * https://discord.com/developers/docs/game-sdk/achievements#create-achievement - */ -export type RESTPostAPIAchievementJSONBody = Omit; - -/** - * https://discord.com/developers/docs/game-sdk/achievements#create-achievement - */ -export type RESTPostAPIAchievementResult = APIAchievement; - -/** - * https://discord.com/developers/docs/game-sdk/achievements#update-achievement - */ -export type RESTPatchAPIAchievementJSONBody = Omit; - -/** - * https://discord.com/developers/docs/game-sdk/achievements#update-achievement - */ -export type RESTPatchAPIAchievementResult = APIAchievement; - -/** - * https://discord.com/developers/docs/game-sdk/achievements#delete-achievement - */ -export type RESTDeleteAPIAchievementResult = never; - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby - */ -export type RESTPostAPILobbyJSONBody = Pick & - Omit, 'id' | 'owner_id' | 'secret'>; - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby - */ -export type RESTPostAPILobbyResult = APILobby; - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#update-lobby - */ -export type RESTPatchAPILobbyJSONBody = Pick, 'type' | 'metadata' | 'capacity'>; - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#update-lobby - */ -export type RESTPatchAPILobbyResult = APILobby; - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#delete-lobby - */ -export type RESTDeleteAPILobbyResult = never; - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#update-lobby-member - */ -export type RESTPatchAPILobbyMemberJSONBody = Pick; - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search - */ -export interface RESTPostAPILobbySearchJSONBody { - /** - * The application id - */ - application_id: Snowflake; - /** - * The filter to check against - */ - filter: SearchFilter[]; - /** - * How to sort the results - */ - sort: SearchSort[]; - /** - * Limit of lobbies returned - * - * @default 25 - */ - limit: number; -} - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search-searchfilter-object - */ -export interface SearchFilter { - key: string; - value: string; - cast: SearchCast; - comparison: SearchComparison; -} - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search-searchcast-types - */ -export enum SearchCast { - String = 1, - Number, -} - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search-searchcomparison-types - */ -export enum SearchComparison { - EqualToOrLessThan = -2, - LessThan = -1, - Equal = 0, - EqualToOrGreaterThan = 1, - GreaterThan = 2, - NotEqual = 3, -} - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search-searchsort-object - */ -export interface SearchSort { - key: string; - cast: SearchCast; - near_value: string; -} - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#send-lobby-data - */ -export interface RESTPostAPILobbyDataJSONBody { - /** - * Message content to be sent to other lobby members - */ - data: string; -} - -/** - * https://discord.com/developers/docs/game-sdk/store#get-entitlements - */ -export interface RESTGetAPIEntitlementsQuery { - /** - * The user id to look up entitlements for - */ - user_id?: Snowflake; - /** - * Comma-delimited set of SKU ids (snowflakes) to check entitlements for - */ - sku_ids?: string; - /** - * Whether to include the payment data in the entitlement - */ - with_payments?: boolean; - /** - * Retrieve entitlements before this date - */ - before?: Snowflake; - /** - * Retrieve entitlements after this date - */ - after?: Snowflake; - /** - * Entitlements to return (minimum 1, maximum 100) - * - * @default 100 - */ - limit?: number; -} - -/** - * https://discord.com/developers/docs/game-sdk/store#get-entitlements - */ -export type RESTGetAPIEntitlementsResult = APIEntitlement[]; - -/** - * https://discord.com/developers/docs/game-sdk/store#get-entitlement - */ -export type RESTGetAPIEntitlementQuery = Pick; - -/** - * https://discord.com/developers/docs/game-sdk/store#get-entitlement - */ -export type RESTGetAPIEntitlementResult = APIEntitlement; - -/** - * https://discord.com/developers/docs/game-sdk/store#get-skus - */ -export type RESTGetAPISKUsResult = APISKU[]; - -/** - * https://discord.com/developers/docs/game-sdk/store#consume-sku - */ -export type RESTPostAPISKUConsumeResult = never; - -/** - * https://discord.com/developers/docs/game-sdk/store#delete-test-entitlement - */ -export type RESTDeleteAPITestEntitlementResult = never; - -/** - * https://discord.com/developers/docs/game-sdk/store#create-purchase-discount - */ -export interface RESTPutAPISKUDiscountJSONBody { - /** - * The percentage of the discount (minimum of 1, maximum of 100) - */ - percent_off: number; - /** - * The time to live for the discount, in seconds (minimum of 60, maximum of 3600) - * - * @default 600 - */ - ttl?: number; -} - -/** - * https://discord.com/developers/docs/game-sdk/store#delete-purchase-discount - */ -export type RESTDeleteAPISKUDiscountResult = never; diff --git a/deno/rest/v10/lobby.ts b/deno/rest/v10/lobby.ts new file mode 100644 index 000000000..105963b49 --- /dev/null +++ b/deno/rest/v10/lobby.ts @@ -0,0 +1,106 @@ +import type { Snowflake } from '../../globals.ts'; +import type { APILobby } from '../../payloads/v10/lobby.ts'; + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby + */ +export type RESTPostAPILobbyJSONBody = Pick & + Omit, 'id' | 'owner_id' | 'secret'>; + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby + */ +export type RESTPostAPILobbyResult = APILobby; + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#update-lobby + */ +export type RESTPatchAPILobbyJSONBody = Pick, 'type' | 'metadata' | 'capacity'>; + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#update-lobby + */ +export type RESTPatchAPILobbyResult = APILobby; + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#delete-lobby + */ +export type RESTDeleteAPILobbyResult = never; + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#update-lobby-member + */ +export type RESTPatchAPILobbyMemberJSONBody = Pick, 'metadata'>; + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search + */ +export interface RESTPostAPILobbySearchJSONBody { + /** + * The application id + */ + application_id: Snowflake; + /** + * The filter to check against + */ + filter: SearchFilter[]; + /** + * How to sort the results + */ + sort: SearchSort[]; + /** + * Limit of lobbies returned + * + * @default 25 + */ + limit: number; +} + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search-searchfilter-object + */ +export interface SearchFilter { + key: string; + value: string; + cast: SearchCast; + comparison: SearchComparison; +} + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search-searchcast-types + */ +export enum SearchCast { + String = 1, + Number, +} + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search-searchcomparison-types + */ +export enum SearchComparison { + EqualToOrLessThan = -2, + LessThan = -1, + Equal = 0, + EqualToOrGreaterThan = 1, + GreaterThan = 2, + NotEqual = 3, +} + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search-searchsort-object + */ +export interface SearchSort { + key: string; + cast: SearchCast; + near_value: string; +} + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#send-lobby-data + */ +export interface RESTPostAPILobbyDataJSONBody { + /** + * Message content to be sent to other lobby members + */ + data: string; +} diff --git a/deno/rest/v10/mod.ts b/deno/rest/v10/mod.ts index a1e24ea72..bc9c83f8b 100644 --- a/deno/rest/v10/mod.ts +++ b/deno/rest/v10/mod.ts @@ -1,18 +1,20 @@ import type { Snowflake } from '../../globals.ts'; export * from '../common.ts'; +export * from './achievement.ts'; export * from './auditLog.ts'; export * from './channel.ts'; export * from './emoji.ts'; -export * from './gamesdk.ts'; export * from './gateway.ts'; export * from './guild.ts'; export * from './guildScheduledEvent.ts'; export * from './interactions.ts'; export * from './invite.ts'; +export * from './lobby.ts'; export * from './oauth2.ts'; export * from './stageInstance.ts'; export * from './sticker.ts'; +export * from './store.ts'; export * from './template.ts'; export * from './user.ts'; export * from './voice.ts'; diff --git a/deno/rest/v10/store.ts b/deno/rest/v10/store.ts new file mode 100644 index 000000000..1c6cf8bd1 --- /dev/null +++ b/deno/rest/v10/store.ts @@ -0,0 +1,85 @@ +import type { Snowflake } from '../../globals.ts'; +import type { APIEntitlement, APISKU } from '../../payloads/v10/store.ts'; + +/** + * https://discord.com/developers/docs/game-sdk/store#get-entitlements + */ +export interface RESTGetAPIEntitlementsQuery { + /** + * The user id to look up entitlements for + */ + user_id?: Snowflake; + /** + * Comma-delimited set of SKU ids (snowflakes) to check entitlements for + */ + sku_ids?: string; + /** + * Whether to include the payment data in the entitlement + */ + with_payments?: boolean; + /** + * Retrieve entitlements before this date + */ + before?: Snowflake; + /** + * Retrieve entitlements after this date + */ + after?: Snowflake; + /** + * Entitlements to return (minimum 1, maximum 100) + * + * @default 100 + */ + limit?: number; +} + +/** + * https://discord.com/developers/docs/game-sdk/store#get-entitlements + */ +export type RESTGetAPIEntitlementsResult = APIEntitlement[]; + +/** + * https://discord.com/developers/docs/game-sdk/store#get-entitlement + */ +export type RESTGetAPIEntitlementQuery = Pick; + +/** + * https://discord.com/developers/docs/game-sdk/store#get-entitlement + */ +export type RESTGetAPIEntitlementResult = APIEntitlement; + +/** + * https://discord.com/developers/docs/game-sdk/store#get-skus + */ +export type RESTGetAPISKUsResult = APISKU[]; + +/** + * https://discord.com/developers/docs/game-sdk/store#consume-sku + */ +export type RESTPostAPISKUConsumeResult = never; + +/** + * https://discord.com/developers/docs/game-sdk/store#delete-test-entitlement + */ +export type RESTDeleteAPITestEntitlementResult = never; + +/** + * https://discord.com/developers/docs/game-sdk/store#create-purchase-discount + */ +export interface RESTPutAPISKUDiscountJSONBody { + /** + * The percentage of the discount (minimum of 1, maximum of 100) + */ + percent_off: number; + /** + * The time to live for the discount, in seconds (minimum of 60, maximum of 3600) + * + * @default 600 + */ + ttl?: number; +} + +/** + * https://discord.com/developers/docs/game-sdk/store#delete-purchase-discount + */ +export type RESTDeleteAPISKUDiscountResult = never; diff --git a/deno/rest/v9/achievement.ts b/deno/rest/v9/achievement.ts new file mode 100644 index 000000000..01b780c7b --- /dev/null +++ b/deno/rest/v9/achievement.ts @@ -0,0 +1,36 @@ +import type { APIAchievement } from '../../payloads/v10/achievement.ts'; + +/** + * https://discord.com/developers/docs/game-sdk/achievements#get-achievements + */ +export type RESTGetAPIAchievementsResult = APIAchievement[]; + +/** + * https://discord.com/developers/docs/game-sdk/achievements#get-achievement + */ +export type RESTGetAPIAchievementResult = APIAchievement; + +/** + * https://discord.com/developers/docs/game-sdk/achievements#create-achievement + */ +export type RESTPostAPIAchievementJSONBody = Omit; + +/** + * https://discord.com/developers/docs/game-sdk/achievements#create-achievement + */ +export type RESTPostAPIAchievementResult = APIAchievement; + +/** + * https://discord.com/developers/docs/game-sdk/achievements#update-achievement + */ +export type RESTPatchAPIAchievementJSONBody = Omit, 'application_id' | 'id'>; + +/** + * https://discord.com/developers/docs/game-sdk/achievements#update-achievement + */ +export type RESTPatchAPIAchievementResult = APIAchievement; + +/** + * https://discord.com/developers/docs/game-sdk/achievements#delete-achievement + */ +export type RESTDeleteAPIAchievementResult = never; diff --git a/deno/rest/v9/gamesdk.ts b/deno/rest/v9/gamesdk.ts deleted file mode 100644 index cc6350a04..000000000 --- a/deno/rest/v9/gamesdk.ts +++ /dev/null @@ -1,224 +0,0 @@ -import type { Snowflake } from '../../globals.ts'; -import type { APIAchievement, APIEntitlement, APILobby, APISKU } from '../../payloads/v9/gamesdk.ts'; - -/** - * https://discord.com/developers/docs/game-sdk/achievements#get-achievements - */ -export type RESTGetAPIAchievementsResult = APIAchievement[]; - -/** - * https://discord.com/developers/docs/game-sdk/achievements#get-achievement - */ -export type RESTGetAPIAchievementResult = APIAchievement; - -/** - * https://discord.com/developers/docs/game-sdk/achievements#create-achievement - */ -export type RESTPostAPIAchievementJSONBody = Omit; - -/** - * https://discord.com/developers/docs/game-sdk/achievements#create-achievement - */ -export type RESTPostAPIAchievementResult = APIAchievement; - -/** - * https://discord.com/developers/docs/game-sdk/achievements#update-achievement - */ -export type RESTPatchAPIAchievementJSONBody = Omit; - -/** - * https://discord.com/developers/docs/game-sdk/achievements#update-achievement - */ -export type RESTPatchAPIAchievementResult = APIAchievement; - -/** - * https://discord.com/developers/docs/game-sdk/achievements#delete-achievement - */ -export type RESTDeleteAPIAchievementResult = never; - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby - */ -export type RESTPostAPILobbyJSONBody = Pick & - Omit, 'id' | 'owner_id' | 'secret'>; - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby - */ -export type RESTPostAPILobbyResult = APILobby; - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#update-lobby - */ -export type RESTPatchAPILobbyJSONBody = Pick, 'type' | 'metadata' | 'capacity'>; - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#update-lobby - */ -export type RESTPatchAPILobbyResult = APILobby; - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#delete-lobby - */ -export type RESTDeleteAPILobbyResult = never; - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#update-lobby-member - */ -export type RESTPatchAPILobbyMemberJSONBody = Pick; - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search - */ -export interface RESTPostAPILobbySearchJSONBody { - /** - * The application id - */ - application_id: Snowflake; - /** - * The filter to check against - */ - filter: SearchFilter[]; - /** - * How to sort the results - */ - sort: SearchSort[]; - /** - * Limit of lobbies returned - * - * @default 25 - */ - limit: number; -} - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search-searchfilter-object - */ -export interface SearchFilter { - key: string; - value: string; - cast: SearchCast; - comparison: SearchComparison; -} - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search-searchcast-types - */ -export enum SearchCast { - String = 1, - Number, -} - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search-searchcomparison-types - */ -export enum SearchComparison { - EqualToOrLessThan = -2, - LessThan = -1, - Equal = 0, - EqualToOrGreaterThan = 1, - GreaterThan = 2, - NotEqual = 3, -} - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search-searchsort-object - */ -export interface SearchSort { - key: string; - cast: SearchCast; - near_value: string; -} - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#send-lobby-data - */ -export interface RESTPostAPILobbyDataJSONBody { - /** - * Message content to be sent to other lobby members - */ - data: string; -} - -/** - * https://discord.com/developers/docs/game-sdk/store#get-entitlements - */ -export interface RESTGetAPIEntitlementsQuery { - /** - * The user id to look up entitlements for - */ - user_id?: Snowflake; - /** - * Comma-delimited set of SKU ids (snowflakes) to check entitlements for - */ - sku_ids?: string; - /** - * Whether to include the payment data in the entitlement - */ - with_payments?: boolean; - /** - * Retrieve entitlements before this date - */ - before?: Snowflake; - /** - * Retrieve entitlements after this date - */ - after?: Snowflake; - /** - * Entitlements to return (minimum 1, maximum 100) - * - * @default 100 - */ - limit?: number; -} - -/** - * https://discord.com/developers/docs/game-sdk/store#get-entitlements - */ -export type RESTGetAPIEntitlementsResult = APIEntitlement[]; - -/** - * https://discord.com/developers/docs/game-sdk/store#get-entitlement - */ -export type RESTGetAPIEntitlementQuery = Pick; - -/** - * https://discord.com/developers/docs/game-sdk/store#get-entitlement - */ -export type RESTGetAPIEntitlementResult = APIEntitlement; - -/** - * https://discord.com/developers/docs/game-sdk/store#get-skus - */ -export type RESTGetAPISKUsResult = APISKU[]; - -/** - * https://discord.com/developers/docs/game-sdk/store#consume-sku - */ -export type RESTPostAPISKUConsumeResult = never; - -/** - * https://discord.com/developers/docs/game-sdk/store#delete-test-entitlement - */ -export type RESTDeleteAPITestEntitlementResult = never; - -/** - * https://discord.com/developers/docs/game-sdk/store#create-purchase-discount - */ -export interface RESTPutAPISKUDiscountJSONBody { - /** - * The percentage of the discount (minimum of 1, maximum of 100) - */ - percent_off: number; - /** - * The time to live for the discount, in seconds (minimum of 60, maximum of 3600) - * - * @default 600 - */ - ttl?: number; -} - -/** - * https://discord.com/developers/docs/game-sdk/store#delete-purchase-discount - */ -export type RESTDeleteAPISKUDiscountResult = never; diff --git a/deno/rest/v9/lobby.ts b/deno/rest/v9/lobby.ts new file mode 100644 index 000000000..105963b49 --- /dev/null +++ b/deno/rest/v9/lobby.ts @@ -0,0 +1,106 @@ +import type { Snowflake } from '../../globals.ts'; +import type { APILobby } from '../../payloads/v10/lobby.ts'; + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby + */ +export type RESTPostAPILobbyJSONBody = Pick & + Omit, 'id' | 'owner_id' | 'secret'>; + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby + */ +export type RESTPostAPILobbyResult = APILobby; + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#update-lobby + */ +export type RESTPatchAPILobbyJSONBody = Pick, 'type' | 'metadata' | 'capacity'>; + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#update-lobby + */ +export type RESTPatchAPILobbyResult = APILobby; + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#delete-lobby + */ +export type RESTDeleteAPILobbyResult = never; + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#update-lobby-member + */ +export type RESTPatchAPILobbyMemberJSONBody = Pick, 'metadata'>; + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search + */ +export interface RESTPostAPILobbySearchJSONBody { + /** + * The application id + */ + application_id: Snowflake; + /** + * The filter to check against + */ + filter: SearchFilter[]; + /** + * How to sort the results + */ + sort: SearchSort[]; + /** + * Limit of lobbies returned + * + * @default 25 + */ + limit: number; +} + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search-searchfilter-object + */ +export interface SearchFilter { + key: string; + value: string; + cast: SearchCast; + comparison: SearchComparison; +} + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search-searchcast-types + */ +export enum SearchCast { + String = 1, + Number, +} + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search-searchcomparison-types + */ +export enum SearchComparison { + EqualToOrLessThan = -2, + LessThan = -1, + Equal = 0, + EqualToOrGreaterThan = 1, + GreaterThan = 2, + NotEqual = 3, +} + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search-searchsort-object + */ +export interface SearchSort { + key: string; + cast: SearchCast; + near_value: string; +} + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#send-lobby-data + */ +export interface RESTPostAPILobbyDataJSONBody { + /** + * Message content to be sent to other lobby members + */ + data: string; +} diff --git a/deno/rest/v9/mod.ts b/deno/rest/v9/mod.ts index e738d1e9f..71256d4a8 100644 --- a/deno/rest/v9/mod.ts +++ b/deno/rest/v9/mod.ts @@ -1,18 +1,20 @@ import type { Snowflake } from '../../globals.ts'; export * from '../common.ts'; +export * from './achievement.ts'; export * from './auditLog.ts'; export * from './channel.ts'; export * from './emoji.ts'; -export * from './gamesdk.ts'; export * from './gateway.ts'; export * from './guild.ts'; export * from './guildScheduledEvent.ts'; export * from './interactions.ts'; export * from './invite.ts'; +export * from './lobby.ts'; export * from './oauth2.ts'; export * from './stageInstance.ts'; export * from './sticker.ts'; +export * from './store.ts'; export * from './template.ts'; export * from './user.ts'; export * from './voice.ts'; diff --git a/deno/rest/v9/store.ts b/deno/rest/v9/store.ts new file mode 100644 index 000000000..1c6cf8bd1 --- /dev/null +++ b/deno/rest/v9/store.ts @@ -0,0 +1,85 @@ +import type { Snowflake } from '../../globals.ts'; +import type { APIEntitlement, APISKU } from '../../payloads/v10/store.ts'; + +/** + * https://discord.com/developers/docs/game-sdk/store#get-entitlements + */ +export interface RESTGetAPIEntitlementsQuery { + /** + * The user id to look up entitlements for + */ + user_id?: Snowflake; + /** + * Comma-delimited set of SKU ids (snowflakes) to check entitlements for + */ + sku_ids?: string; + /** + * Whether to include the payment data in the entitlement + */ + with_payments?: boolean; + /** + * Retrieve entitlements before this date + */ + before?: Snowflake; + /** + * Retrieve entitlements after this date + */ + after?: Snowflake; + /** + * Entitlements to return (minimum 1, maximum 100) + * + * @default 100 + */ + limit?: number; +} + +/** + * https://discord.com/developers/docs/game-sdk/store#get-entitlements + */ +export type RESTGetAPIEntitlementsResult = APIEntitlement[]; + +/** + * https://discord.com/developers/docs/game-sdk/store#get-entitlement + */ +export type RESTGetAPIEntitlementQuery = Pick; + +/** + * https://discord.com/developers/docs/game-sdk/store#get-entitlement + */ +export type RESTGetAPIEntitlementResult = APIEntitlement; + +/** + * https://discord.com/developers/docs/game-sdk/store#get-skus + */ +export type RESTGetAPISKUsResult = APISKU[]; + +/** + * https://discord.com/developers/docs/game-sdk/store#consume-sku + */ +export type RESTPostAPISKUConsumeResult = never; + +/** + * https://discord.com/developers/docs/game-sdk/store#delete-test-entitlement + */ +export type RESTDeleteAPITestEntitlementResult = never; + +/** + * https://discord.com/developers/docs/game-sdk/store#create-purchase-discount + */ +export interface RESTPutAPISKUDiscountJSONBody { + /** + * The percentage of the discount (minimum of 1, maximum of 100) + */ + percent_off: number; + /** + * The time to live for the discount, in seconds (minimum of 60, maximum of 3600) + * + * @default 600 + */ + ttl?: number; +} + +/** + * https://discord.com/developers/docs/game-sdk/store#delete-purchase-discount + */ +export type RESTDeleteAPISKUDiscountResult = never; diff --git a/payloads/v10/achievement.ts b/payloads/v10/achievement.ts new file mode 100644 index 000000000..50f59b4ac --- /dev/null +++ b/payloads/v10/achievement.ts @@ -0,0 +1,45 @@ +/** + * Types extracted from https://discord.com/developers/docs/game-sdk/achievements + */ + +import type { Snowflake } from '../../globals'; +import type { LocalizationMap } from '../common'; + +export interface APIAchievement { + /** + * Unique id of the application + */ + application_id: Snowflake; + /** + * Name of this achievement + */ + name: string; + /** + * Localization dictionary for the `name` field + */ + name_localizations: LocalizationMap | null; + /** + * The description of this achievement + */ + description: string; + /** + * Localization dictionary for the `description` field + */ + description_localizations: LocalizationMap | null; + /** + * Whether this achievement is secret + */ + secret: boolean; + /** + * Whether this achievement is secure + */ + secure: boolean; + /** + * Unique id of this achievement + */ + id: Snowflake; + /** + * The achievement icon hash + */ + icon_hash: string; +} diff --git a/payloads/v10/index.ts b/payloads/v10/index.ts index b7069f2c0..8c2f98b9f 100644 --- a/payloads/v10/index.ts +++ b/payloads/v10/index.ts @@ -1,18 +1,20 @@ export * from '../common'; +export * from './achievement'; export * from './application'; export * from './auditLog'; export * from './channel'; export * from './emoji'; -export * from './gamesdk'; export * from './gateway'; export * from './guild'; export * from './guildScheduledEvent'; export * from './interactions'; export * from './invite'; +export * from './lobby'; export * from './oauth2'; export * from './permissions'; export * from './stageInstance'; export * from './sticker'; +export * from './store'; export * from './teams'; export * from './template'; export * from './user'; diff --git a/payloads/v10/lobby.ts b/payloads/v10/lobby.ts new file mode 100644 index 000000000..a5b7a2e97 --- /dev/null +++ b/payloads/v10/lobby.ts @@ -0,0 +1,86 @@ +/** + * Types extracted from https://discord.com/developers/docs/game-sdk/lobbies + */ + +import type { Snowflake } from '../../globals'; + +export interface APILobby { + /** + * Unique id of this lobby + */ + id: Snowflake; + /** + * The type of this lobby (whether it is private or public) + * + * @default Private + */ + type: LobbyType; + /** + * The user id of the lobby owner + */ + owner_id: Snowflake; + /** + * The password of this lobby + */ + secret: string; + /** + * The maximum capacity of this lobby + * + * @default 16 + */ + capacity: number; + /** + * Whether this lobby can be joined + */ + locked: boolean; + /** + * Unique id of the application + */ + application_id: Snowflake; + /** + * Metadata for this lobby. key/value pairs with type `string` + * + * @default {} + */ + metadata: Record; + /** + * The region of this lobby. Defaults the region of the requesting server's IP address + */ + region: LobbyRegion; +} + +export enum LobbyRegion { + Atlanta = 'atlanta', + Brazil = 'brazil', + Bucharest = 'bucharest', + BuenosAires = 'buenos-aires', + Dubai = 'dubai', + Finland = 'finland', + Hongkong = 'hongkong', + India = 'india', + Japan = 'japan', + Madrid = 'madrid', + Milan = 'milan', + Montreal = 'montreal', + Newark = 'newark', + Rotterdam = 'rotterdam', + Russia = 'russia', + SantaClara = 'santa-clara', + Santiago = 'santiago', + Seattle = 'seattle', + Singapore = 'singapore', + SouthKorea = 'south-korea', + SouthAfrica = 'southafrica', + StPete = 'st-pete', + Stockholm = 'stockholm', + Sydney = 'sydney', + UsCentral = 'us-central', + UsEast = 'us-east', + UsSouth = 'us-south', + UsWest = 'us-west', +} + +export enum LobbyType { + Private = 1, + Public, +} diff --git a/payloads/v9/gamesdk.ts b/payloads/v10/store.ts similarity index 58% rename from payloads/v9/gamesdk.ts rename to payloads/v10/store.ts index dd0244846..ab68c694a 100644 --- a/payloads/v9/gamesdk.ts +++ b/payloads/v10/store.ts @@ -1,126 +1,10 @@ /** - * Types extracted from https://discord.com/developers/docs/game-sdk/sdk-starter-guide + * Types extracted from https://discord.com/developers/docs/game-sdk/store */ import type { Snowflake } from '../../globals'; import type { LocalizationMap } from '../common'; -export interface APIAchievement { - /** - * Unique id of the application - */ - application_id: Snowflake; - /** - * Name of this achievement - */ - name: string; - /** - * Localization dictionary for the `name` field - */ - name_localizations: LocalizationMap | null; - /** - * The description of this achievement - */ - description: string; - /** - * Localization dictionary for the `description` field - */ - description_localizations: keyof LocalizationMap | null; - /** - * Whether this achievement is secret - */ - secret: boolean; - /** - * Whether this achievement is secure - */ - secure: boolean; - /** - * Unique id of this achievement - */ - id: Snowflake; - /** - * The achievement icon hash - */ - icon_hash: string; -} - -export interface APILobby { - /** - * Unique id of this lobby - */ - id: Snowflake; - /** - * The type of this lobby (whether it is private or public) - */ - type: LobbyType; - /** - * The user id of the lobby owner - */ - owner_id: Snowflake; - /** - * The password of this lobby - */ - secret: string; - /** - * The maximum capacity of this lobby - * - * @default 16 - */ - capacity: number; - /** - * Whether this lobby can be joined - */ - locked: boolean; - /** - * Unique id of the application - */ - application_id: Snowflake; - /** - * Metadata for this lobby. key/value pairs with type `string` - */ - metadata: Record; - /** - * The region of this lobby. Defaults the region of the requesting server's IP address - */ - region: LobbyRegion; -} - -export enum LobbyRegion { - Atlanta = 'atlanta', - Brazil = 'brazil', - Bucharest = 'bucharest', - BuenosAires = 'buenos-aires', - Dubai = 'dubai', - Finland = 'finland', - Hongkong = 'hongkong', - India = 'india', - Japan = 'japan', - Madrid = 'madrid', - Milan = 'milan', - Montreal = 'montreal', - Newark = 'newark', - Rotterdam = 'rotterdam', - Russia = 'russia', - SantaClara = 'santa-clara', - Santiago = 'santiago', - Seattle = 'seattle', - Singapore = 'singapore', - SouthKorea = 'south-korea', - SouthAfrica = 'southafrica', - StPete = 'st-pete', - Stockholm = 'stockholm', - Sydney = 'sydney', - UsCentral = 'us-central', - UsEast = 'us-east', - UsSouth = 'us-south', - UsWest = 'us-west', -} - -export enum LobbyType { - Private = 1, - Public, -} - export interface APISKU { /** * Unique id of this SKU @@ -185,7 +69,7 @@ export interface APISKU { /** * @unstable This field is missing documentation */ - locales: LocalizationMap[]; + locales: keyof LocalizationMap[]; /** * @unstable This field is missing documentation */ @@ -200,13 +84,13 @@ export enum SKUType { /** * The SKU is a DLC */ - Dlc, + DLC, /** * The SKU is consumable (in-app purchase) */ Consumable, /** - * The SKU is a bundle (comprising by `Application`, `Dlc` and `Consumable` all together) + * The SKU is a bundle (comprising by `Application`, `DLC` and `Consumable` all together) */ Bundle, } diff --git a/payloads/v9/achievement.ts b/payloads/v9/achievement.ts new file mode 100644 index 000000000..50f59b4ac --- /dev/null +++ b/payloads/v9/achievement.ts @@ -0,0 +1,45 @@ +/** + * Types extracted from https://discord.com/developers/docs/game-sdk/achievements + */ + +import type { Snowflake } from '../../globals'; +import type { LocalizationMap } from '../common'; + +export interface APIAchievement { + /** + * Unique id of the application + */ + application_id: Snowflake; + /** + * Name of this achievement + */ + name: string; + /** + * Localization dictionary for the `name` field + */ + name_localizations: LocalizationMap | null; + /** + * The description of this achievement + */ + description: string; + /** + * Localization dictionary for the `description` field + */ + description_localizations: LocalizationMap | null; + /** + * Whether this achievement is secret + */ + secret: boolean; + /** + * Whether this achievement is secure + */ + secure: boolean; + /** + * Unique id of this achievement + */ + id: Snowflake; + /** + * The achievement icon hash + */ + icon_hash: string; +} diff --git a/payloads/v9/index.ts b/payloads/v9/index.ts index b7069f2c0..8c2f98b9f 100644 --- a/payloads/v9/index.ts +++ b/payloads/v9/index.ts @@ -1,18 +1,20 @@ export * from '../common'; +export * from './achievement'; export * from './application'; export * from './auditLog'; export * from './channel'; export * from './emoji'; -export * from './gamesdk'; export * from './gateway'; export * from './guild'; export * from './guildScheduledEvent'; export * from './interactions'; export * from './invite'; +export * from './lobby'; export * from './oauth2'; export * from './permissions'; export * from './stageInstance'; export * from './sticker'; +export * from './store'; export * from './teams'; export * from './template'; export * from './user'; diff --git a/payloads/v9/lobby.ts b/payloads/v9/lobby.ts new file mode 100644 index 000000000..a5b7a2e97 --- /dev/null +++ b/payloads/v9/lobby.ts @@ -0,0 +1,86 @@ +/** + * Types extracted from https://discord.com/developers/docs/game-sdk/lobbies + */ + +import type { Snowflake } from '../../globals'; + +export interface APILobby { + /** + * Unique id of this lobby + */ + id: Snowflake; + /** + * The type of this lobby (whether it is private or public) + * + * @default Private + */ + type: LobbyType; + /** + * The user id of the lobby owner + */ + owner_id: Snowflake; + /** + * The password of this lobby + */ + secret: string; + /** + * The maximum capacity of this lobby + * + * @default 16 + */ + capacity: number; + /** + * Whether this lobby can be joined + */ + locked: boolean; + /** + * Unique id of the application + */ + application_id: Snowflake; + /** + * Metadata for this lobby. key/value pairs with type `string` + * + * @default {} + */ + metadata: Record; + /** + * The region of this lobby. Defaults the region of the requesting server's IP address + */ + region: LobbyRegion; +} + +export enum LobbyRegion { + Atlanta = 'atlanta', + Brazil = 'brazil', + Bucharest = 'bucharest', + BuenosAires = 'buenos-aires', + Dubai = 'dubai', + Finland = 'finland', + Hongkong = 'hongkong', + India = 'india', + Japan = 'japan', + Madrid = 'madrid', + Milan = 'milan', + Montreal = 'montreal', + Newark = 'newark', + Rotterdam = 'rotterdam', + Russia = 'russia', + SantaClara = 'santa-clara', + Santiago = 'santiago', + Seattle = 'seattle', + Singapore = 'singapore', + SouthKorea = 'south-korea', + SouthAfrica = 'southafrica', + StPete = 'st-pete', + Stockholm = 'stockholm', + Sydney = 'sydney', + UsCentral = 'us-central', + UsEast = 'us-east', + UsSouth = 'us-south', + UsWest = 'us-west', +} + +export enum LobbyType { + Private = 1, + Public, +} diff --git a/payloads/v10/gamesdk.ts b/payloads/v9/store.ts similarity index 58% rename from payloads/v10/gamesdk.ts rename to payloads/v9/store.ts index d3729a058..ab68c694a 100644 --- a/payloads/v10/gamesdk.ts +++ b/payloads/v9/store.ts @@ -1,130 +1,10 @@ /** - * Types extracted from https://discord.com/developers/docs/game-sdk/sdk-starter-guide + * Types extracted from https://discord.com/developers/docs/game-sdk/store */ import type { Snowflake } from '../../globals'; import type { LocalizationMap } from '../common'; -export interface APIAchievement { - /** - * Unique id of the application - */ - application_id: Snowflake; - /** - * Name of this achievement - */ - name: string; - /** - * Localization dictionary for the `name` field - */ - name_localizations: LocalizationMap | null; - /** - * The description of this achievement - */ - description: string; - /** - * Localization dictionary for the `description` field - */ - description_localizations: keyof LocalizationMap | null; - /** - * Whether this achievement is secret - */ - secret: boolean; - /** - * Whether this achievement is secure - */ - secure: boolean; - /** - * Unique id of this achievement - */ - id: Snowflake; - /** - * The achievement icon hash - */ - icon_hash: string; -} - -export interface APILobby { - /** - * Unique id of this lobby - */ - id: Snowflake; - /** - * The type of this lobby (whether it is private or public) - * - * @default Private - */ - type: LobbyType; - /** - * The user id of the lobby owner - */ - owner_id: Snowflake; - /** - * The password of this lobby - */ - secret: string; - /** - * The maximum capacity of this lobby - * - * @default 16 - */ - capacity: number; - /** - * Whether this lobby can be joined - */ - locked: boolean; - /** - * Unique id of the application - */ - application_id: Snowflake; - /** - * Metadata for this lobby. key/value pairs with type `string` - * - * @default {} - */ - metadata: Record; - /** - * The region of this lobby. Defaults the region of the requesting server's IP address - */ - region: LobbyRegion; -} - -export enum LobbyRegion { - Atlanta = 'atlanta', - Brazil = 'brazil', - Bucharest = 'bucharest', - BuenosAires = 'buenos-aires', - Dubai = 'dubai', - Finland = 'finland', - Hongkong = 'hongkong', - India = 'india', - Japan = 'japan', - Madrid = 'madrid', - Milan = 'milan', - Montreal = 'montreal', - Newark = 'newark', - Rotterdam = 'rotterdam', - Russia = 'russia', - SantaClara = 'santa-clara', - Santiago = 'santiago', - Seattle = 'seattle', - Singapore = 'singapore', - SouthKorea = 'south-korea', - SouthAfrica = 'southafrica', - StPete = 'st-pete', - Stockholm = 'stockholm', - Sydney = 'sydney', - UsCentral = 'us-central', - UsEast = 'us-east', - UsSouth = 'us-south', - UsWest = 'us-west', -} - -export enum LobbyType { - Private = 1, - Public, -} - export interface APISKU { /** * Unique id of this SKU @@ -189,7 +69,7 @@ export interface APISKU { /** * @unstable This field is missing documentation */ - locales: LocalizationMap[]; + locales: keyof LocalizationMap[]; /** * @unstable This field is missing documentation */ @@ -204,13 +84,13 @@ export enum SKUType { /** * The SKU is a DLC */ - Dlc, + DLC, /** * The SKU is consumable (in-app purchase) */ Consumable, /** - * The SKU is a bundle (comprising by `Application`, `Dlc` and `Consumable` all together) + * The SKU is a bundle (comprising by `Application`, `DLC` and `Consumable` all together) */ Bundle, } diff --git a/rest/v10/achievement.ts b/rest/v10/achievement.ts new file mode 100644 index 000000000..8a32203a3 --- /dev/null +++ b/rest/v10/achievement.ts @@ -0,0 +1,36 @@ +import type { APIAchievement } from '../../payloads/v10/achievement'; + +/** + * https://discord.com/developers/docs/game-sdk/achievements#get-achievements + */ +export type RESTGetAPIAchievementsResult = APIAchievement[]; + +/** + * https://discord.com/developers/docs/game-sdk/achievements#get-achievement + */ +export type RESTGetAPIAchievementResult = APIAchievement; + +/** + * https://discord.com/developers/docs/game-sdk/achievements#create-achievement + */ +export type RESTPostAPIAchievementJSONBody = Omit; + +/** + * https://discord.com/developers/docs/game-sdk/achievements#create-achievement + */ +export type RESTPostAPIAchievementResult = APIAchievement; + +/** + * https://discord.com/developers/docs/game-sdk/achievements#update-achievement + */ +export type RESTPatchAPIAchievementJSONBody = Omit, 'application_id' | 'id'>; + +/** + * https://discord.com/developers/docs/game-sdk/achievements#update-achievement + */ +export type RESTPatchAPIAchievementResult = APIAchievement; + +/** + * https://discord.com/developers/docs/game-sdk/achievements#delete-achievement + */ +export type RESTDeleteAPIAchievementResult = never; diff --git a/rest/v10/gamesdk.ts b/rest/v10/gamesdk.ts deleted file mode 100644 index 2deeaea3b..000000000 --- a/rest/v10/gamesdk.ts +++ /dev/null @@ -1,224 +0,0 @@ -import type { Snowflake } from '../../globals'; -import type { APIAchievement, APIEntitlement, APILobby, APISKU } from '../../payloads/v10/gamesdk'; - -/** - * https://discord.com/developers/docs/game-sdk/achievements#get-achievements - */ -export type RESTGetAPIAchievementsResult = APIAchievement[]; - -/** - * https://discord.com/developers/docs/game-sdk/achievements#get-achievement - */ -export type RESTGetAPIAchievementResult = APIAchievement; - -/** - * https://discord.com/developers/docs/game-sdk/achievements#create-achievement - */ -export type RESTPostAPIAchievementJSONBody = Omit; - -/** - * https://discord.com/developers/docs/game-sdk/achievements#create-achievement - */ -export type RESTPostAPIAchievementResult = APIAchievement; - -/** - * https://discord.com/developers/docs/game-sdk/achievements#update-achievement - */ -export type RESTPatchAPIAchievementJSONBody = Omit; - -/** - * https://discord.com/developers/docs/game-sdk/achievements#update-achievement - */ -export type RESTPatchAPIAchievementResult = APIAchievement; - -/** - * https://discord.com/developers/docs/game-sdk/achievements#delete-achievement - */ -export type RESTDeleteAPIAchievementResult = never; - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby - */ -export type RESTPostAPILobbyJSONBody = Pick & - Omit, 'id' | 'owner_id' | 'secret'>; - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby - */ -export type RESTPostAPILobbyResult = APILobby; - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#update-lobby - */ -export type RESTPatchAPILobbyJSONBody = Pick, 'type' | 'metadata' | 'capacity'>; - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#update-lobby - */ -export type RESTPatchAPILobbyResult = APILobby; - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#delete-lobby - */ -export type RESTDeleteAPILobbyResult = never; - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#update-lobby-member - */ -export type RESTPatchAPILobbyMemberJSONBody = Pick; - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search - */ -export interface RESTPostAPILobbySearchJSONBody { - /** - * The application id - */ - application_id: Snowflake; - /** - * The filter to check against - */ - filter: SearchFilter[]; - /** - * How to sort the results - */ - sort: SearchSort[]; - /** - * Limit of lobbies returned - * - * @default 25 - */ - limit: number; -} - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search-searchfilter-object - */ -export interface SearchFilter { - key: string; - value: string; - cast: SearchCast; - comparison: SearchComparison; -} - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search-searchcast-types - */ -export enum SearchCast { - String = 1, - Number, -} - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search-searchcomparison-types - */ -export enum SearchComparison { - EqualToOrLessThan = -2, - LessThan = -1, - Equal = 0, - EqualToOrGreaterThan = 1, - GreaterThan = 2, - NotEqual = 3, -} - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search-searchsort-object - */ -export interface SearchSort { - key: string; - cast: SearchCast; - near_value: string; -} - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#send-lobby-data - */ -export interface RESTPostAPILobbyDataJSONBody { - /** - * Message content to be sent to other lobby members - */ - data: string; -} - -/** - * https://discord.com/developers/docs/game-sdk/store#get-entitlements - */ -export interface RESTGetAPIEntitlementsQuery { - /** - * The user id to look up entitlements for - */ - user_id?: Snowflake; - /** - * Comma-delimited set of SKU ids (snowflakes) to check entitlements for - */ - sku_ids?: string; - /** - * Whether to include the payment data in the entitlement - */ - with_payments?: boolean; - /** - * Retrieve entitlements before this date - */ - before?: Snowflake; - /** - * Retrieve entitlements after this date - */ - after?: Snowflake; - /** - * Entitlements to return (minimum 1, maximum 100) - * - * @default 100 - */ - limit?: number; -} - -/** - * https://discord.com/developers/docs/game-sdk/store#get-entitlements - */ -export type RESTGetAPIEntitlementsResult = APIEntitlement[]; - -/** - * https://discord.com/developers/docs/game-sdk/store#get-entitlement - */ -export type RESTGetAPIEntitlementQuery = Pick; - -/** - * https://discord.com/developers/docs/game-sdk/store#get-entitlement - */ -export type RESTGetAPIEntitlementResult = APIEntitlement; - -/** - * https://discord.com/developers/docs/game-sdk/store#get-skus - */ -export type RESTGetAPISKUsResult = APISKU[]; - -/** - * https://discord.com/developers/docs/game-sdk/store#consume-sku - */ -export type RESTPostAPISKUConsumeResult = never; - -/** - * https://discord.com/developers/docs/game-sdk/store#delete-test-entitlement - */ -export type RESTDeleteAPITestEntitlementResult = never; - -/** - * https://discord.com/developers/docs/game-sdk/store#create-purchase-discount - */ -export interface RESTPutAPISKUDiscountJSONBody { - /** - * The percentage of the discount (minimum of 1, maximum of 100) - */ - percent_off: number; - /** - * The time to live for the discount, in seconds (minimum of 60, maximum of 3600) - * - * @default 600 - */ - ttl?: number; -} - -/** - * https://discord.com/developers/docs/game-sdk/store#delete-purchase-discount - */ -export type RESTDeleteAPISKUDiscountResult = never; diff --git a/rest/v10/index.ts b/rest/v10/index.ts index 7014b6546..1f42dc5a2 100644 --- a/rest/v10/index.ts +++ b/rest/v10/index.ts @@ -1,18 +1,20 @@ import type { Snowflake } from '../../globals'; export * from '../common'; +export * from './achievement'; export * from './auditLog'; export * from './channel'; export * from './emoji'; -export * from './gamesdk'; export * from './gateway'; export * from './guild'; export * from './guildScheduledEvent'; export * from './interactions'; export * from './invite'; +export * from './lobby'; export * from './oauth2'; export * from './stageInstance'; export * from './sticker'; +export * from './store'; export * from './template'; export * from './user'; export * from './voice'; diff --git a/rest/v10/lobby.ts b/rest/v10/lobby.ts new file mode 100644 index 000000000..473fda15c --- /dev/null +++ b/rest/v10/lobby.ts @@ -0,0 +1,106 @@ +import type { Snowflake } from '../../globals'; +import type { APILobby } from '../../payloads/v10/lobby'; + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby + */ +export type RESTPostAPILobbyJSONBody = Pick & + Omit, 'id' | 'owner_id' | 'secret'>; + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby + */ +export type RESTPostAPILobbyResult = APILobby; + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#update-lobby + */ +export type RESTPatchAPILobbyJSONBody = Pick, 'type' | 'metadata' | 'capacity'>; + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#update-lobby + */ +export type RESTPatchAPILobbyResult = APILobby; + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#delete-lobby + */ +export type RESTDeleteAPILobbyResult = never; + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#update-lobby-member + */ +export type RESTPatchAPILobbyMemberJSONBody = Pick, 'metadata'>; + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search + */ +export interface RESTPostAPILobbySearchJSONBody { + /** + * The application id + */ + application_id: Snowflake; + /** + * The filter to check against + */ + filter: SearchFilter[]; + /** + * How to sort the results + */ + sort: SearchSort[]; + /** + * Limit of lobbies returned + * + * @default 25 + */ + limit: number; +} + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search-searchfilter-object + */ +export interface SearchFilter { + key: string; + value: string; + cast: SearchCast; + comparison: SearchComparison; +} + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search-searchcast-types + */ +export enum SearchCast { + String = 1, + Number, +} + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search-searchcomparison-types + */ +export enum SearchComparison { + EqualToOrLessThan = -2, + LessThan = -1, + Equal = 0, + EqualToOrGreaterThan = 1, + GreaterThan = 2, + NotEqual = 3, +} + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search-searchsort-object + */ +export interface SearchSort { + key: string; + cast: SearchCast; + near_value: string; +} + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#send-lobby-data + */ +export interface RESTPostAPILobbyDataJSONBody { + /** + * Message content to be sent to other lobby members + */ + data: string; +} diff --git a/rest/v10/store.ts b/rest/v10/store.ts new file mode 100644 index 000000000..cacfac430 --- /dev/null +++ b/rest/v10/store.ts @@ -0,0 +1,85 @@ +import type { Snowflake } from '../../globals'; +import type { APIEntitlement, APISKU } from '../../payloads/v10/store'; + +/** + * https://discord.com/developers/docs/game-sdk/store#get-entitlements + */ +export interface RESTGetAPIEntitlementsQuery { + /** + * The user id to look up entitlements for + */ + user_id?: Snowflake; + /** + * Comma-delimited set of SKU ids (snowflakes) to check entitlements for + */ + sku_ids?: string; + /** + * Whether to include the payment data in the entitlement + */ + with_payments?: boolean; + /** + * Retrieve entitlements before this date + */ + before?: Snowflake; + /** + * Retrieve entitlements after this date + */ + after?: Snowflake; + /** + * Entitlements to return (minimum 1, maximum 100) + * + * @default 100 + */ + limit?: number; +} + +/** + * https://discord.com/developers/docs/game-sdk/store#get-entitlements + */ +export type RESTGetAPIEntitlementsResult = APIEntitlement[]; + +/** + * https://discord.com/developers/docs/game-sdk/store#get-entitlement + */ +export type RESTGetAPIEntitlementQuery = Pick; + +/** + * https://discord.com/developers/docs/game-sdk/store#get-entitlement + */ +export type RESTGetAPIEntitlementResult = APIEntitlement; + +/** + * https://discord.com/developers/docs/game-sdk/store#get-skus + */ +export type RESTGetAPISKUsResult = APISKU[]; + +/** + * https://discord.com/developers/docs/game-sdk/store#consume-sku + */ +export type RESTPostAPISKUConsumeResult = never; + +/** + * https://discord.com/developers/docs/game-sdk/store#delete-test-entitlement + */ +export type RESTDeleteAPITestEntitlementResult = never; + +/** + * https://discord.com/developers/docs/game-sdk/store#create-purchase-discount + */ +export interface RESTPutAPISKUDiscountJSONBody { + /** + * The percentage of the discount (minimum of 1, maximum of 100) + */ + percent_off: number; + /** + * The time to live for the discount, in seconds (minimum of 60, maximum of 3600) + * + * @default 600 + */ + ttl?: number; +} + +/** + * https://discord.com/developers/docs/game-sdk/store#delete-purchase-discount + */ +export type RESTDeleteAPISKUDiscountResult = never; diff --git a/rest/v9/achievement.ts b/rest/v9/achievement.ts new file mode 100644 index 000000000..8a32203a3 --- /dev/null +++ b/rest/v9/achievement.ts @@ -0,0 +1,36 @@ +import type { APIAchievement } from '../../payloads/v10/achievement'; + +/** + * https://discord.com/developers/docs/game-sdk/achievements#get-achievements + */ +export type RESTGetAPIAchievementsResult = APIAchievement[]; + +/** + * https://discord.com/developers/docs/game-sdk/achievements#get-achievement + */ +export type RESTGetAPIAchievementResult = APIAchievement; + +/** + * https://discord.com/developers/docs/game-sdk/achievements#create-achievement + */ +export type RESTPostAPIAchievementJSONBody = Omit; + +/** + * https://discord.com/developers/docs/game-sdk/achievements#create-achievement + */ +export type RESTPostAPIAchievementResult = APIAchievement; + +/** + * https://discord.com/developers/docs/game-sdk/achievements#update-achievement + */ +export type RESTPatchAPIAchievementJSONBody = Omit, 'application_id' | 'id'>; + +/** + * https://discord.com/developers/docs/game-sdk/achievements#update-achievement + */ +export type RESTPatchAPIAchievementResult = APIAchievement; + +/** + * https://discord.com/developers/docs/game-sdk/achievements#delete-achievement + */ +export type RESTDeleteAPIAchievementResult = never; diff --git a/rest/v9/gamesdk.ts b/rest/v9/gamesdk.ts deleted file mode 100644 index f925342fb..000000000 --- a/rest/v9/gamesdk.ts +++ /dev/null @@ -1,224 +0,0 @@ -import type { Snowflake } from '../../globals'; -import type { APIAchievement, APIEntitlement, APILobby, APISKU } from '../../payloads/v9/gamesdk'; - -/** - * https://discord.com/developers/docs/game-sdk/achievements#get-achievements - */ -export type RESTGetAPIAchievementsResult = APIAchievement[]; - -/** - * https://discord.com/developers/docs/game-sdk/achievements#get-achievement - */ -export type RESTGetAPIAchievementResult = APIAchievement; - -/** - * https://discord.com/developers/docs/game-sdk/achievements#create-achievement - */ -export type RESTPostAPIAchievementJSONBody = Omit; - -/** - * https://discord.com/developers/docs/game-sdk/achievements#create-achievement - */ -export type RESTPostAPIAchievementResult = APIAchievement; - -/** - * https://discord.com/developers/docs/game-sdk/achievements#update-achievement - */ -export type RESTPatchAPIAchievementJSONBody = Omit; - -/** - * https://discord.com/developers/docs/game-sdk/achievements#update-achievement - */ -export type RESTPatchAPIAchievementResult = APIAchievement; - -/** - * https://discord.com/developers/docs/game-sdk/achievements#delete-achievement - */ -export type RESTDeleteAPIAchievementResult = never; - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby - */ -export type RESTPostAPILobbyJSONBody = Pick & - Omit, 'id' | 'owner_id' | 'secret'>; - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby - */ -export type RESTPostAPILobbyResult = APILobby; - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#update-lobby - */ -export type RESTPatchAPILobbyJSONBody = Pick, 'type' | 'metadata' | 'capacity'>; - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#update-lobby - */ -export type RESTPatchAPILobbyResult = APILobby; - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#delete-lobby - */ -export type RESTDeleteAPILobbyResult = never; - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#update-lobby-member - */ -export type RESTPatchAPILobbyMemberJSONBody = Pick; - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search - */ -export interface RESTPostAPILobbySearchJSONBody { - /** - * The application id - */ - application_id: Snowflake; - /** - * The filter to check against - */ - filter: SearchFilter[]; - /** - * How to sort the results - */ - sort: SearchSort[]; - /** - * Limit of lobbies returned - * - * @default 25 - */ - limit: number; -} - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search-searchfilter-object - */ -export interface SearchFilter { - key: string; - value: string; - cast: SearchCast; - comparison: SearchComparison; -} - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search-searchcast-types - */ -export enum SearchCast { - String = 1, - Number, -} - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search-searchcomparison-types - */ -export enum SearchComparison { - EqualToOrLessThan = -2, - LessThan = -1, - Equal = 0, - EqualToOrGreaterThan = 1, - GreaterThan = 2, - NotEqual = 3, -} - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search-searchsort-object - */ -export interface SearchSort { - key: string; - cast: SearchCast; - near_value: string; -} - -/** - * https://discord.com/developers/docs/game-sdk/lobbies#send-lobby-data - */ -export interface RESTPostAPILobbyDataJSONBody { - /** - * Message content to be sent to other lobby members - */ - data: string; -} - -/** - * https://discord.com/developers/docs/game-sdk/store#get-entitlements - */ -export interface RESTGetAPIEntitlementsQuery { - /** - * The user id to look up entitlements for - */ - user_id?: Snowflake; - /** - * Comma-delimited set of SKU ids (snowflakes) to check entitlements for - */ - sku_ids?: string; - /** - * Whether to include the payment data in the entitlement - */ - with_payments?: boolean; - /** - * Retrieve entitlements before this date - */ - before?: Snowflake; - /** - * Retrieve entitlements after this date - */ - after?: Snowflake; - /** - * Entitlements to return (minimum 1, maximum 100) - * - * @default 100 - */ - limit?: number; -} - -/** - * https://discord.com/developers/docs/game-sdk/store#get-entitlements - */ -export type RESTGetAPIEntitlementsResult = APIEntitlement[]; - -/** - * https://discord.com/developers/docs/game-sdk/store#get-entitlement - */ -export type RESTGetAPIEntitlementQuery = Pick; - -/** - * https://discord.com/developers/docs/game-sdk/store#get-entitlement - */ -export type RESTGetAPIEntitlementResult = APIEntitlement; - -/** - * https://discord.com/developers/docs/game-sdk/store#get-skus - */ -export type RESTGetAPISKUsResult = APISKU[]; - -/** - * https://discord.com/developers/docs/game-sdk/store#consume-sku - */ -export type RESTPostAPISKUConsumeResult = never; - -/** - * https://discord.com/developers/docs/game-sdk/store#delete-test-entitlement - */ -export type RESTDeleteAPITestEntitlementResult = never; - -/** - * https://discord.com/developers/docs/game-sdk/store#create-purchase-discount - */ -export interface RESTPutAPISKUDiscountJSONBody { - /** - * The percentage of the discount (minimum of 1, maximum of 100) - */ - percent_off: number; - /** - * The time to live for the discount, in seconds (minimum of 60, maximum of 3600) - * - * @default 600 - */ - ttl?: number; -} - -/** - * https://discord.com/developers/docs/game-sdk/store#delete-purchase-discount - */ -export type RESTDeleteAPISKUDiscountResult = never; diff --git a/rest/v9/index.ts b/rest/v9/index.ts index fcf4cf408..93bf1cf3d 100644 --- a/rest/v9/index.ts +++ b/rest/v9/index.ts @@ -1,18 +1,20 @@ import type { Snowflake } from '../../globals'; export * from '../common'; +export * from './achievement'; export * from './auditLog'; export * from './channel'; export * from './emoji'; -export * from './gamesdk'; export * from './gateway'; export * from './guild'; export * from './guildScheduledEvent'; export * from './interactions'; export * from './invite'; +export * from './lobby'; export * from './oauth2'; export * from './stageInstance'; export * from './sticker'; +export * from './store'; export * from './template'; export * from './user'; export * from './voice'; diff --git a/rest/v9/lobby.ts b/rest/v9/lobby.ts new file mode 100644 index 000000000..473fda15c --- /dev/null +++ b/rest/v9/lobby.ts @@ -0,0 +1,106 @@ +import type { Snowflake } from '../../globals'; +import type { APILobby } from '../../payloads/v10/lobby'; + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby + */ +export type RESTPostAPILobbyJSONBody = Pick & + Omit, 'id' | 'owner_id' | 'secret'>; + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby + */ +export type RESTPostAPILobbyResult = APILobby; + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#update-lobby + */ +export type RESTPatchAPILobbyJSONBody = Pick, 'type' | 'metadata' | 'capacity'>; + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#update-lobby + */ +export type RESTPatchAPILobbyResult = APILobby; + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#delete-lobby + */ +export type RESTDeleteAPILobbyResult = never; + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#update-lobby-member + */ +export type RESTPatchAPILobbyMemberJSONBody = Pick, 'metadata'>; + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search + */ +export interface RESTPostAPILobbySearchJSONBody { + /** + * The application id + */ + application_id: Snowflake; + /** + * The filter to check against + */ + filter: SearchFilter[]; + /** + * How to sort the results + */ + sort: SearchSort[]; + /** + * Limit of lobbies returned + * + * @default 25 + */ + limit: number; +} + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search-searchfilter-object + */ +export interface SearchFilter { + key: string; + value: string; + cast: SearchCast; + comparison: SearchComparison; +} + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search-searchcast-types + */ +export enum SearchCast { + String = 1, + Number, +} + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search-searchcomparison-types + */ +export enum SearchComparison { + EqualToOrLessThan = -2, + LessThan = -1, + Equal = 0, + EqualToOrGreaterThan = 1, + GreaterThan = 2, + NotEqual = 3, +} + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#create-lobby-search-searchsort-object + */ +export interface SearchSort { + key: string; + cast: SearchCast; + near_value: string; +} + +/** + * https://discord.com/developers/docs/game-sdk/lobbies#send-lobby-data + */ +export interface RESTPostAPILobbyDataJSONBody { + /** + * Message content to be sent to other lobby members + */ + data: string; +} diff --git a/rest/v9/store.ts b/rest/v9/store.ts new file mode 100644 index 000000000..cacfac430 --- /dev/null +++ b/rest/v9/store.ts @@ -0,0 +1,85 @@ +import type { Snowflake } from '../../globals'; +import type { APIEntitlement, APISKU } from '../../payloads/v10/store'; + +/** + * https://discord.com/developers/docs/game-sdk/store#get-entitlements + */ +export interface RESTGetAPIEntitlementsQuery { + /** + * The user id to look up entitlements for + */ + user_id?: Snowflake; + /** + * Comma-delimited set of SKU ids (snowflakes) to check entitlements for + */ + sku_ids?: string; + /** + * Whether to include the payment data in the entitlement + */ + with_payments?: boolean; + /** + * Retrieve entitlements before this date + */ + before?: Snowflake; + /** + * Retrieve entitlements after this date + */ + after?: Snowflake; + /** + * Entitlements to return (minimum 1, maximum 100) + * + * @default 100 + */ + limit?: number; +} + +/** + * https://discord.com/developers/docs/game-sdk/store#get-entitlements + */ +export type RESTGetAPIEntitlementsResult = APIEntitlement[]; + +/** + * https://discord.com/developers/docs/game-sdk/store#get-entitlement + */ +export type RESTGetAPIEntitlementQuery = Pick; + +/** + * https://discord.com/developers/docs/game-sdk/store#get-entitlement + */ +export type RESTGetAPIEntitlementResult = APIEntitlement; + +/** + * https://discord.com/developers/docs/game-sdk/store#get-skus + */ +export type RESTGetAPISKUsResult = APISKU[]; + +/** + * https://discord.com/developers/docs/game-sdk/store#consume-sku + */ +export type RESTPostAPISKUConsumeResult = never; + +/** + * https://discord.com/developers/docs/game-sdk/store#delete-test-entitlement + */ +export type RESTDeleteAPITestEntitlementResult = never; + +/** + * https://discord.com/developers/docs/game-sdk/store#create-purchase-discount + */ +export interface RESTPutAPISKUDiscountJSONBody { + /** + * The percentage of the discount (minimum of 1, maximum of 100) + */ + percent_off: number; + /** + * The time to live for the discount, in seconds (minimum of 60, maximum of 3600) + * + * @default 600 + */ + ttl?: number; +} + +/** + * https://discord.com/developers/docs/game-sdk/store#delete-purchase-discount + */ +export type RESTDeleteAPISKUDiscountResult = never;