From 874f13573b35fe1e5e40549d007aebe5ec3bbcc0 Mon Sep 17 00:00:00 2001 From: Almeida Date: Mon, 17 Jul 2023 13:26:47 +0100 Subject: [PATCH] feat(APIApplication): approx guild count and get self application endpoint (#728) Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> --- deno/payloads/v10/application.ts | 9 +++++++++ deno/payloads/v9/application.ts | 10 ++++++++++ deno/rest/v10/application.ts | 7 ++++++- deno/rest/v10/mod.ts | 10 +++++++++- deno/rest/v9/application.ts | 7 ++++++- deno/rest/v9/mod.ts | 10 +++++++++- payloads/v10/application.ts | 9 +++++++++ payloads/v9/application.ts | 10 ++++++++++ rest/v10/application.ts | 7 ++++++- rest/v10/index.ts | 10 +++++++++- rest/v9/application.ts | 7 ++++++- rest/v9/index.ts | 10 +++++++++- 12 files changed, 98 insertions(+), 8 deletions(-) diff --git a/deno/payloads/v10/application.ts b/deno/payloads/v10/application.ts index a175a901..2ef940a8 100644 --- a/deno/payloads/v10/application.ts +++ b/deno/payloads/v10/application.ts @@ -4,6 +4,7 @@ import type { Permissions, Snowflake } from '../../globals.ts'; import type { LocalizationMap } from '../common.ts'; +import type { APIPartialGuild } from './guild.ts'; import type { OAuth2Scopes } from './oauth2.ts'; import type { APITeam } from './teams.ts'; import type { APIUser } from './user.ts'; @@ -111,6 +112,14 @@ export interface APIApplication { * 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 a175a901..28dd55dc 100644 --- a/deno/payloads/v9/application.ts +++ b/deno/payloads/v9/application.ts @@ -4,6 +4,7 @@ import type { Permissions, Snowflake } from '../../globals.ts'; import type { LocalizationMap } from '../common.ts'; +import type { APIPartialGuild } from './guild.ts'; import type { OAuth2Scopes } from './oauth2.ts'; import type { APITeam } from './teams.ts'; import type { APIUser } from './user.ts'; @@ -111,6 +112,15 @@ export interface APIApplication { * 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 4ccfea4b..5f4c0597 100644 --- a/deno/rest/v10/application.ts +++ b/deno/rest/v10/application.ts @@ -1,4 +1,4 @@ -import type { APIApplicationRoleConnectionMetadata } from '../../payloads/v10/application.ts'; +import type { APIApplication, APIApplicationRoleConnectionMetadata } from '../../payloads/v10/application.ts'; /** * https://discord.com/developers/docs/resources/application-role-connection-metadata#get-application-role-connection-metadata-records @@ -14,3 +14,8 @@ export type RESTPutAPIApplicationRoleConnectionMetadataJSONBody = APIApplication * https://discord.com/developers/docs/resources/application-role-connection-metadata#update-application-role-connection-metadata-records */ export type RESTPutAPIApplicationRoleConnectionMetadataResult = APIApplicationRoleConnectionMetadata[]; + +/** + * https://discord.com/developers/docs/resources/application#get-current-application + */ +export type RESTGetCurrentApplicationResult = APIApplication; diff --git a/deno/rest/v10/mod.ts b/deno/rest/v10/mod.ts index 49c9e57a..9e8652b5 100644 --- a/deno/rest/v10/mod.ts +++ b/deno/rest/v10/mod.ts @@ -494,7 +494,7 @@ export const Routes = { /** * Route for: - * - GET `/channels/{channel.id}/users/@me/threads/archived/prviate` + * - GET `/channels/{channel.id}/users/@me/threads/archived/private` */ channelJoinedArchivedThreads(channelId: Snowflake) { return `/channels/${channelId}/users/@me/threads/archived/private` as const; @@ -887,6 +887,14 @@ export const Routes = { guildOnboarding(guildId: Snowflake) { return `/guilds/${guildId}/onboarding` as const; }, + + /** + * Route for: + * - GET `/applications/@me` + */ + currentApplication() { + return '/applications/@me' as const; + }, }; export const StickerPackApplicationId = '710982414301790216'; diff --git a/deno/rest/v9/application.ts b/deno/rest/v9/application.ts index 6c0521c0..3e2d53fc 100644 --- a/deno/rest/v9/application.ts +++ b/deno/rest/v9/application.ts @@ -1,4 +1,4 @@ -import type { APIApplicationRoleConnectionMetadata } from '../../payloads/v9/application.ts'; +import type { APIApplication, APIApplicationRoleConnectionMetadata } from '../../payloads/v9/application.ts'; /** * https://discord.com/developers/docs/resources/application-role-connection-metadata#get-application-role-connection-metadata-records @@ -14,3 +14,8 @@ export type RESTPutAPIApplicationRoleConnectionMetadataJSONBody = APIApplication * https://discord.com/developers/docs/resources/application-role-connection-metadata#update-application-role-connection-metadata-records */ export type RESTPutAPIApplicationRoleConnectionMetadataResult = APIApplicationRoleConnectionMetadata[]; + +/** + * https://discord.com/developers/docs/resources/application#get-current-application + */ +export type RESTGetCurrentApplicationResult = APIApplication; diff --git a/deno/rest/v9/mod.ts b/deno/rest/v9/mod.ts index 7fec5e25..f63c51f5 100644 --- a/deno/rest/v9/mod.ts +++ b/deno/rest/v9/mod.ts @@ -503,7 +503,7 @@ export const Routes = { /** * Route for: - * - GET `/channels/{channel.id}/users/@me/threads/archived/prviate` + * - GET `/channels/{channel.id}/users/@me/threads/archived/private` */ channelJoinedArchivedThreads(channelId: Snowflake) { return `/channels/${channelId}/users/@me/threads/archived/private` as const; @@ -896,6 +896,14 @@ export const Routes = { guildOnboarding(guildId: Snowflake) { return `/guilds/${guildId}/onboarding` as const; }, + + /** + * Route for: + * - GET `/applications/@me` + */ + currentApplication() { + return '/applications/@me' as const; + }, }; export const StickerPackApplicationId = '710982414301790216'; diff --git a/payloads/v10/application.ts b/payloads/v10/application.ts index f7da9fb0..8467fe88 100644 --- a/payloads/v10/application.ts +++ b/payloads/v10/application.ts @@ -4,6 +4,7 @@ import type { Permissions, Snowflake } from '../../globals'; import type { LocalizationMap } from '../common'; +import type { APIPartialGuild } from './guild'; import type { OAuth2Scopes } from './oauth2'; import type { APITeam } from './teams'; import type { APIUser } from './user'; @@ -111,6 +112,14 @@ export interface APIApplication { * 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 f7da9fb0..c4fde92f 100644 --- a/payloads/v9/application.ts +++ b/payloads/v9/application.ts @@ -4,6 +4,7 @@ import type { Permissions, Snowflake } from '../../globals'; import type { LocalizationMap } from '../common'; +import type { APIPartialGuild } from './guild'; import type { OAuth2Scopes } from './oauth2'; import type { APITeam } from './teams'; import type { APIUser } from './user'; @@ -111,6 +112,15 @@ export interface APIApplication { * 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 775245e7..48078caa 100644 --- a/rest/v10/application.ts +++ b/rest/v10/application.ts @@ -1,4 +1,4 @@ -import type { APIApplicationRoleConnectionMetadata } from '../../payloads/v10/application'; +import type { APIApplication, APIApplicationRoleConnectionMetadata } from '../../payloads/v10/application'; /** * https://discord.com/developers/docs/resources/application-role-connection-metadata#get-application-role-connection-metadata-records @@ -14,3 +14,8 @@ export type RESTPutAPIApplicationRoleConnectionMetadataJSONBody = APIApplication * https://discord.com/developers/docs/resources/application-role-connection-metadata#update-application-role-connection-metadata-records */ export type RESTPutAPIApplicationRoleConnectionMetadataResult = APIApplicationRoleConnectionMetadata[]; + +/** + * https://discord.com/developers/docs/resources/application#get-current-application + */ +export type RESTGetCurrentApplicationResult = APIApplication; diff --git a/rest/v10/index.ts b/rest/v10/index.ts index 93633b70..649f71fd 100644 --- a/rest/v10/index.ts +++ b/rest/v10/index.ts @@ -494,7 +494,7 @@ export const Routes = { /** * Route for: - * - GET `/channels/{channel.id}/users/@me/threads/archived/prviate` + * - GET `/channels/{channel.id}/users/@me/threads/archived/private` */ channelJoinedArchivedThreads(channelId: Snowflake) { return `/channels/${channelId}/users/@me/threads/archived/private` as const; @@ -887,6 +887,14 @@ export const Routes = { guildOnboarding(guildId: Snowflake) { return `/guilds/${guildId}/onboarding` as const; }, + + /** + * Route for: + * - GET `/applications/@me` + */ + currentApplication() { + return '/applications/@me' as const; + }, }; export const StickerPackApplicationId = '710982414301790216'; diff --git a/rest/v9/application.ts b/rest/v9/application.ts index ca7ab3a7..67b3f539 100644 --- a/rest/v9/application.ts +++ b/rest/v9/application.ts @@ -1,4 +1,4 @@ -import type { APIApplicationRoleConnectionMetadata } from '../../payloads/v9/application'; +import type { APIApplication, APIApplicationRoleConnectionMetadata } from '../../payloads/v9/application'; /** * https://discord.com/developers/docs/resources/application-role-connection-metadata#get-application-role-connection-metadata-records @@ -14,3 +14,8 @@ export type RESTPutAPIApplicationRoleConnectionMetadataJSONBody = APIApplication * https://discord.com/developers/docs/resources/application-role-connection-metadata#update-application-role-connection-metadata-records */ export type RESTPutAPIApplicationRoleConnectionMetadataResult = APIApplicationRoleConnectionMetadata[]; + +/** + * https://discord.com/developers/docs/resources/application#get-current-application + */ +export type RESTGetCurrentApplicationResult = APIApplication; diff --git a/rest/v9/index.ts b/rest/v9/index.ts index 85f106e4..17ba9abd 100644 --- a/rest/v9/index.ts +++ b/rest/v9/index.ts @@ -503,7 +503,7 @@ export const Routes = { /** * Route for: - * - GET `/channels/{channel.id}/users/@me/threads/archived/prviate` + * - GET `/channels/{channel.id}/users/@me/threads/archived/private` */ channelJoinedArchivedThreads(channelId: Snowflake) { return `/channels/${channelId}/users/@me/threads/archived/private` as const; @@ -896,6 +896,14 @@ export const Routes = { guildOnboarding(guildId: Snowflake) { return `/guilds/${guildId}/onboarding` as const; }, + + /** + * Route for: + * - GET `/applications/@me` + */ + currentApplication() { + return '/applications/@me' as const; + }, }; export const StickerPackApplicationId = '710982414301790216';