From 17f42e0b38d431505ee56cdeb0bb85bff94e97c6 Mon Sep 17 00:00:00 2001 From: Jiralite <33201955+Jiralite@users.noreply.github.com> Date: Tue, 3 Oct 2023 20:34:06 +0200 Subject: [PATCH] feat: Application patch and new properties (#810) * feat: application patch and properties * docs(APIApplication): update tag documentation * fix(RESTPatchCurrentApplicationJSONBody): add `flags` * docs(APIApplication): update `approximate_guild_count` --- deno/payloads/v10/application.ts | 42 ++++++++++++++++++++----------- deno/payloads/v9/application.ts | 43 ++++++++++++++++++++------------ deno/rest/v10/application.ts | 23 +++++++++++++++++ deno/rest/v10/mod.ts | 1 + deno/rest/v9/application.ts | 23 +++++++++++++++++ deno/rest/v9/mod.ts | 1 + payloads/v10/application.ts | 42 ++++++++++++++++++++----------- payloads/v9/application.ts | 43 ++++++++++++++++++++------------ rest/v10/application.ts | 23 +++++++++++++++++ rest/v10/index.ts | 1 + rest/v9/application.ts | 23 +++++++++++++++++ rest/v9/index.ts | 1 + 12 files changed, 204 insertions(+), 62 deletions(-) diff --git a/deno/payloads/v10/application.ts b/deno/payloads/v10/application.ts index 2ef940a8..e90bb8a3 100644 --- a/deno/payloads/v10/application.ts +++ b/deno/payloads/v10/application.ts @@ -41,6 +41,10 @@ export interface APIApplication { * When `true` the app's bot will only join upon completion of the full oauth2 code grant flow */ bot_require_code_grant: boolean; + /** + * Partial user object for the bot user associated with the application + */ + bot?: APIUser; /** * The url of the application's terms of service */ @@ -60,7 +64,7 @@ export interface APIApplication { * * @deprecated This field will be removed in v11 */ - summary: string; + summary: ''; /** * The hexadecimal encoded key for verification in interactions and the GameSDK's GetTicket function * @@ -77,6 +81,10 @@ export interface APIApplication { * If this application is a game sold on Discord, this field will be the guild to which it has been linked */ guild_id?: Snowflake; + /** + * A partial object of the associated guild + */ + guild?: APIPartialGuild; /** * If this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists */ @@ -96,7 +104,24 @@ export interface APIApplication { */ flags: ApplicationFlags; /** - * Up to 5 tags describing the content and functionality of the application + * Approximate count of guilds the application has been added to + */ + approximate_guild_count?: number; + /** + * Array of redirect URIs for the application + */ + redirect_uris?: string[]; + /** + * The interactions endpoint URL for the application + */ + interactions_endpoint_url?: string; + /** + * The application's role connection verification entry point, + * which when configured will render the app as a verification method in the guild role verification configuration + */ + role_connections_verification_url?: string; + /** + * Up to 5 tags of max 20 characters each describing the content and functionality of the application */ tags?: [string, string?, string?, string?, string?]; /** @@ -107,19 +132,6 @@ export interface APIApplication { * The application's default custom authorization link, if enabled */ custom_install_url?: string; - /** - * The application's role connection verification entry point, - * which when configured will render the app as a verification method in the guild role verification configuration - */ - role_connections_verification_url?: string; - /** - * An approximate count of the app's guild membership - */ - approximate_guild_count?: number; - /** - * A partial object of the associated guild - */ - guild?: APIPartialGuild; } export interface APIApplicationInstallParams { diff --git a/deno/payloads/v9/application.ts b/deno/payloads/v9/application.ts index 28dd55dc..e90bb8a3 100644 --- a/deno/payloads/v9/application.ts +++ b/deno/payloads/v9/application.ts @@ -41,6 +41,10 @@ export interface APIApplication { * When `true` the app's bot will only join upon completion of the full oauth2 code grant flow */ bot_require_code_grant: boolean; + /** + * Partial user object for the bot user associated with the application + */ + bot?: APIUser; /** * The url of the application's terms of service */ @@ -60,7 +64,7 @@ export interface APIApplication { * * @deprecated This field will be removed in v11 */ - summary: string; + summary: ''; /** * The hexadecimal encoded key for verification in interactions and the GameSDK's GetTicket function * @@ -77,6 +81,10 @@ export interface APIApplication { * If this application is a game sold on Discord, this field will be the guild to which it has been linked */ guild_id?: Snowflake; + /** + * A partial object of the associated guild + */ + guild?: APIPartialGuild; /** * If this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists */ @@ -96,7 +104,24 @@ export interface APIApplication { */ flags: ApplicationFlags; /** - * Up to 5 tags describing the content and functionality of the application + * Approximate count of guilds the application has been added to + */ + approximate_guild_count?: number; + /** + * Array of redirect URIs for the application + */ + redirect_uris?: string[]; + /** + * The interactions endpoint URL for the application + */ + interactions_endpoint_url?: string; + /** + * The application's role connection verification entry point, + * which when configured will render the app as a verification method in the guild role verification configuration + */ + role_connections_verification_url?: string; + /** + * Up to 5 tags of max 20 characters each describing the content and functionality of the application */ tags?: [string, string?, string?, string?, string?]; /** @@ -107,20 +132,6 @@ export interface APIApplication { * The application's default custom authorization link, if enabled */ custom_install_url?: string; - /** - * The application's role connection verification entry point, - * which when configured will render the app as a verification method in the guild role verification configuration - */ - role_connections_verification_url?: string; - /** - * An approximate count of the app's guild membership - * s - */ - approximate_guild_count?: number; - /** - * A partial object of the associated guild - */ - guild?: APIPartialGuild; } export interface APIApplicationInstallParams { diff --git a/deno/rest/v10/application.ts b/deno/rest/v10/application.ts index 5f4c0597..e20aecd1 100644 --- a/deno/rest/v10/application.ts +++ b/deno/rest/v10/application.ts @@ -1,4 +1,5 @@ import type { APIApplication, APIApplicationRoleConnectionMetadata } from '../../payloads/v10/application.ts'; +import type { Nullable, StrictPartial } from '../../utils/internals.ts'; /** * https://discord.com/developers/docs/resources/application-role-connection-metadata#get-application-role-connection-metadata-records @@ -19,3 +20,25 @@ export type RESTPutAPIApplicationRoleConnectionMetadataResult = APIApplicationRo * https://discord.com/developers/docs/resources/application#get-current-application */ export type RESTGetCurrentApplicationResult = APIApplication; + +/** + * https://discord.com/developers/docs/resources/application#edit-current-application + */ +export type RESTPatchCurrentApplicationJSONBody = StrictPartial< + Pick< + APIApplication, + | 'custom_install_url' + | 'description' + | 'flags' + | 'role_connections_verification_url' + | 'install_params' + | 'interactions_endpoint_url' + | 'tags' + > & + Nullable> +>; + +/** + * https://discord.com/developers/docs/resources/application#edit-current-application + */ +export type RESTPatchCurrentApplicationResult = APIApplication; diff --git a/deno/rest/v10/mod.ts b/deno/rest/v10/mod.ts index 6c7bfe8d..95f75fae 100644 --- a/deno/rest/v10/mod.ts +++ b/deno/rest/v10/mod.ts @@ -902,6 +902,7 @@ export const Routes = { /** * Route for: * - GET `/applications/@me` + * - PATCH `/applications/@me` */ currentApplication() { return '/applications/@me' as const; diff --git a/deno/rest/v9/application.ts b/deno/rest/v9/application.ts index 3e2d53fc..cf29fd02 100644 --- a/deno/rest/v9/application.ts +++ b/deno/rest/v9/application.ts @@ -1,4 +1,5 @@ import type { APIApplication, APIApplicationRoleConnectionMetadata } from '../../payloads/v9/application.ts'; +import type { StrictPartial, Nullable } from '../../utils/internals.ts'; /** * https://discord.com/developers/docs/resources/application-role-connection-metadata#get-application-role-connection-metadata-records @@ -19,3 +20,25 @@ export type RESTPutAPIApplicationRoleConnectionMetadataResult = APIApplicationRo * https://discord.com/developers/docs/resources/application#get-current-application */ export type RESTGetCurrentApplicationResult = APIApplication; + +/** + * https://discord.com/developers/docs/resources/application#edit-current-application + */ +export type RESTPatchCurrentApplicationJSONBody = StrictPartial< + Pick< + APIApplication, + | 'custom_install_url' + | 'description' + | 'flags' + | 'role_connections_verification_url' + | 'install_params' + | 'interactions_endpoint_url' + | 'tags' + > & + Nullable> +>; + +/** + * https://discord.com/developers/docs/resources/application#edit-current-application + */ +export type RESTPatchCurrentApplicationResult = APIApplication; diff --git a/deno/rest/v9/mod.ts b/deno/rest/v9/mod.ts index e4465fc5..944cc456 100644 --- a/deno/rest/v9/mod.ts +++ b/deno/rest/v9/mod.ts @@ -911,6 +911,7 @@ export const Routes = { /** * Route for: * - GET `/applications/@me` + * - PATCH `/applications/@me` */ currentApplication() { return '/applications/@me' as const; diff --git a/payloads/v10/application.ts b/payloads/v10/application.ts index 8467fe88..c5e510c9 100644 --- a/payloads/v10/application.ts +++ b/payloads/v10/application.ts @@ -41,6 +41,10 @@ export interface APIApplication { * When `true` the app's bot will only join upon completion of the full oauth2 code grant flow */ bot_require_code_grant: boolean; + /** + * Partial user object for the bot user associated with the application + */ + bot?: APIUser; /** * The url of the application's terms of service */ @@ -60,7 +64,7 @@ export interface APIApplication { * * @deprecated This field will be removed in v11 */ - summary: string; + summary: ''; /** * The hexadecimal encoded key for verification in interactions and the GameSDK's GetTicket function * @@ -77,6 +81,10 @@ export interface APIApplication { * If this application is a game sold on Discord, this field will be the guild to which it has been linked */ guild_id?: Snowflake; + /** + * A partial object of the associated guild + */ + guild?: APIPartialGuild; /** * If this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists */ @@ -96,7 +104,24 @@ export interface APIApplication { */ flags: ApplicationFlags; /** - * Up to 5 tags describing the content and functionality of the application + * Approximate count of guilds the application has been added to + */ + approximate_guild_count?: number; + /** + * Array of redirect URIs for the application + */ + redirect_uris?: string[]; + /** + * The interactions endpoint URL for the application + */ + interactions_endpoint_url?: string; + /** + * The application's role connection verification entry point, + * which when configured will render the app as a verification method in the guild role verification configuration + */ + role_connections_verification_url?: string; + /** + * Up to 5 tags of max 20 characters each describing the content and functionality of the application */ tags?: [string, string?, string?, string?, string?]; /** @@ -107,19 +132,6 @@ export interface APIApplication { * The application's default custom authorization link, if enabled */ custom_install_url?: string; - /** - * The application's role connection verification entry point, - * which when configured will render the app as a verification method in the guild role verification configuration - */ - role_connections_verification_url?: string; - /** - * An approximate count of the app's guild membership - */ - approximate_guild_count?: number; - /** - * A partial object of the associated guild - */ - guild?: APIPartialGuild; } export interface APIApplicationInstallParams { diff --git a/payloads/v9/application.ts b/payloads/v9/application.ts index c4fde92f..c5e510c9 100644 --- a/payloads/v9/application.ts +++ b/payloads/v9/application.ts @@ -41,6 +41,10 @@ export interface APIApplication { * When `true` the app's bot will only join upon completion of the full oauth2 code grant flow */ bot_require_code_grant: boolean; + /** + * Partial user object for the bot user associated with the application + */ + bot?: APIUser; /** * The url of the application's terms of service */ @@ -60,7 +64,7 @@ export interface APIApplication { * * @deprecated This field will be removed in v11 */ - summary: string; + summary: ''; /** * The hexadecimal encoded key for verification in interactions and the GameSDK's GetTicket function * @@ -77,6 +81,10 @@ export interface APIApplication { * If this application is a game sold on Discord, this field will be the guild to which it has been linked */ guild_id?: Snowflake; + /** + * A partial object of the associated guild + */ + guild?: APIPartialGuild; /** * If this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists */ @@ -96,7 +104,24 @@ export interface APIApplication { */ flags: ApplicationFlags; /** - * Up to 5 tags describing the content and functionality of the application + * Approximate count of guilds the application has been added to + */ + approximate_guild_count?: number; + /** + * Array of redirect URIs for the application + */ + redirect_uris?: string[]; + /** + * The interactions endpoint URL for the application + */ + interactions_endpoint_url?: string; + /** + * The application's role connection verification entry point, + * which when configured will render the app as a verification method in the guild role verification configuration + */ + role_connections_verification_url?: string; + /** + * Up to 5 tags of max 20 characters each describing the content and functionality of the application */ tags?: [string, string?, string?, string?, string?]; /** @@ -107,20 +132,6 @@ export interface APIApplication { * The application's default custom authorization link, if enabled */ custom_install_url?: string; - /** - * The application's role connection verification entry point, - * which when configured will render the app as a verification method in the guild role verification configuration - */ - role_connections_verification_url?: string; - /** - * An approximate count of the app's guild membership - * s - */ - approximate_guild_count?: number; - /** - * A partial object of the associated guild - */ - guild?: APIPartialGuild; } export interface APIApplicationInstallParams { diff --git a/rest/v10/application.ts b/rest/v10/application.ts index 48078caa..a4879fda 100644 --- a/rest/v10/application.ts +++ b/rest/v10/application.ts @@ -1,4 +1,5 @@ import type { APIApplication, APIApplicationRoleConnectionMetadata } from '../../payloads/v10/application'; +import type { Nullable, StrictPartial } from '../../utils/internals'; /** * https://discord.com/developers/docs/resources/application-role-connection-metadata#get-application-role-connection-metadata-records @@ -19,3 +20,25 @@ export type RESTPutAPIApplicationRoleConnectionMetadataResult = APIApplicationRo * https://discord.com/developers/docs/resources/application#get-current-application */ export type RESTGetCurrentApplicationResult = APIApplication; + +/** + * https://discord.com/developers/docs/resources/application#edit-current-application + */ +export type RESTPatchCurrentApplicationJSONBody = StrictPartial< + Pick< + APIApplication, + | 'custom_install_url' + | 'description' + | 'flags' + | 'role_connections_verification_url' + | 'install_params' + | 'interactions_endpoint_url' + | 'tags' + > & + Nullable> +>; + +/** + * https://discord.com/developers/docs/resources/application#edit-current-application + */ +export type RESTPatchCurrentApplicationResult = APIApplication; diff --git a/rest/v10/index.ts b/rest/v10/index.ts index 674fb346..ea3b7dd2 100644 --- a/rest/v10/index.ts +++ b/rest/v10/index.ts @@ -902,6 +902,7 @@ export const Routes = { /** * Route for: * - GET `/applications/@me` + * - PATCH `/applications/@me` */ currentApplication() { return '/applications/@me' as const; diff --git a/rest/v9/application.ts b/rest/v9/application.ts index 67b3f539..6e50d0d3 100644 --- a/rest/v9/application.ts +++ b/rest/v9/application.ts @@ -1,4 +1,5 @@ import type { APIApplication, APIApplicationRoleConnectionMetadata } from '../../payloads/v9/application'; +import type { StrictPartial, Nullable } from '../../utils/internals'; /** * https://discord.com/developers/docs/resources/application-role-connection-metadata#get-application-role-connection-metadata-records @@ -19,3 +20,25 @@ export type RESTPutAPIApplicationRoleConnectionMetadataResult = APIApplicationRo * https://discord.com/developers/docs/resources/application#get-current-application */ export type RESTGetCurrentApplicationResult = APIApplication; + +/** + * https://discord.com/developers/docs/resources/application#edit-current-application + */ +export type RESTPatchCurrentApplicationJSONBody = StrictPartial< + Pick< + APIApplication, + | 'custom_install_url' + | 'description' + | 'flags' + | 'role_connections_verification_url' + | 'install_params' + | 'interactions_endpoint_url' + | 'tags' + > & + Nullable> +>; + +/** + * https://discord.com/developers/docs/resources/application#edit-current-application + */ +export type RESTPatchCurrentApplicationResult = APIApplication; diff --git a/rest/v9/index.ts b/rest/v9/index.ts index bd663d5f..b31ed87e 100644 --- a/rest/v9/index.ts +++ b/rest/v9/index.ts @@ -911,6 +911,7 @@ export const Routes = { /** * Route for: * - GET `/applications/@me` + * - PATCH `/applications/@me` */ currentApplication() { return '/applications/@me' as const;