diff --git a/deno/rest/v8/mod.ts b/deno/rest/v8/mod.ts index 7030653a..6b3f4bd4 100644 --- a/deno/rest/v8/mod.ts +++ b/deno/rest/v8/mod.ts @@ -569,6 +569,30 @@ export const Routes = { return `/oauth2/@me` as const; }, + /** + * Route for: + * - GET `/oauth2/authorize` + */ + oauth2Authorization() { + return `/oauth2/authorize` as const; + }, + + /** + * Route for: + * - POST `/oauth2/token` + */ + oauth2TokenExchange() { + return `/oauth2/token` as const; + }, + + /** + * Route for: + * - POST `/oauth2/token/revoke` + */ + oauth2TokenRevocation() { + return `/oauth2/token/revoke` as const; + }, + /** * Route for: * - GET `/applications/{application.id}/commands` @@ -728,12 +752,12 @@ export const RouteBases = { Object.freeze(RouteBases); export const OAuth2Routes = { - authorizationURL: `https://discord.com/api/v${APIVersion}/oauth2/authorize`, - tokenURL: `https://discord.com/api/v${APIVersion}/oauth2/token`, + authorizationURL: `${RouteBases.api}${Routes.oauth2Authorization()}`, + tokenURL: `${RouteBases.api}${Routes.oauth2TokenExchange()}`, /** * See https://tools.ietf.org/html/rfc7009 */ - tokenRevocationURL: `https://discord.com/api/v${APIVersion}/oauth2/token/revoke`, + tokenRevocationURL: `${RouteBases.api}${Routes.oauth2TokenRevocation()}`, } as const; // Freeze OAuth2 route object diff --git a/deno/rest/v9/mod.ts b/deno/rest/v9/mod.ts index b7a503d2..7ec3f207 100644 --- a/deno/rest/v9/mod.ts +++ b/deno/rest/v9/mod.ts @@ -637,6 +637,30 @@ export const Routes = { return `/oauth2/@me` as const; }, + /** + * Route for: + * - GET `/oauth2/authorize` + */ + oauth2Authorization() { + return `/oauth2/authorize` as const; + }, + + /** + * Route for: + * - POST `/oauth2/token` + */ + oauth2TokenExchange() { + return `/oauth2/token` as const; + }, + + /** + * Route for: + * - POST `/oauth2/token/revoke` + */ + oauth2TokenRevocation() { + return `/oauth2/token/revoke` as const; + }, + /** * Route for: * - GET `/applications/{application.id}/commands` @@ -796,12 +820,12 @@ export const RouteBases = { Object.freeze(RouteBases); export const OAuth2Routes = { - authorizationURL: `https://discord.com/api/v${APIVersion}/oauth2/authorize`, - tokenURL: `https://discord.com/api/v${APIVersion}/oauth2/token`, + authorizationURL: `${RouteBases.api}${Routes.oauth2Authorization()}`, + tokenURL: `${RouteBases.api}${Routes.oauth2TokenExchange()}`, /** * See https://tools.ietf.org/html/rfc7009 */ - tokenRevocationURL: `https://discord.com/api/v${APIVersion}/oauth2/token/revoke`, + tokenRevocationURL: `${RouteBases.api}${Routes.oauth2TokenRevocation()}`, } as const; // Freeze OAuth2 route object diff --git a/rest/v8/index.ts b/rest/v8/index.ts index 6a407780..de475255 100644 --- a/rest/v8/index.ts +++ b/rest/v8/index.ts @@ -569,6 +569,30 @@ export const Routes = { return `/oauth2/@me` as const; }, + /** + * Route for: + * - GET `/oauth2/authorize` + */ + oauth2Authorization() { + return `/oauth2/authorize` as const; + }, + + /** + * Route for: + * - POST `/oauth2/token` + */ + oauth2TokenExchange() { + return `/oauth2/token` as const; + }, + + /** + * Route for: + * - POST `/oauth2/token/revoke` + */ + oauth2TokenRevocation() { + return `/oauth2/token/revoke` as const; + }, + /** * Route for: * - GET `/applications/{application.id}/commands` @@ -728,12 +752,12 @@ export const RouteBases = { Object.freeze(RouteBases); export const OAuth2Routes = { - authorizationURL: `https://discord.com/api/v${APIVersion}/oauth2/authorize`, - tokenURL: `https://discord.com/api/v${APIVersion}/oauth2/token`, + authorizationURL: `${RouteBases.api}${Routes.oauth2Authorization()}`, + tokenURL: `${RouteBases.api}${Routes.oauth2TokenExchange()}`, /** * See https://tools.ietf.org/html/rfc7009 */ - tokenRevocationURL: `https://discord.com/api/v${APIVersion}/oauth2/token/revoke`, + tokenRevocationURL: `${RouteBases.api}${Routes.oauth2TokenRevocation()}`, } as const; // Freeze OAuth2 route object diff --git a/rest/v9/index.ts b/rest/v9/index.ts index 644fd896..b5971d33 100644 --- a/rest/v9/index.ts +++ b/rest/v9/index.ts @@ -637,6 +637,30 @@ export const Routes = { return `/oauth2/@me` as const; }, + /** + * Route for: + * - GET `/oauth2/authorize` + */ + oauth2Authorization() { + return `/oauth2/authorize` as const; + }, + + /** + * Route for: + * - POST `/oauth2/token` + */ + oauth2TokenExchange() { + return `/oauth2/token` as const; + }, + + /** + * Route for: + * - POST `/oauth2/token/revoke` + */ + oauth2TokenRevocation() { + return `/oauth2/token/revoke` as const; + }, + /** * Route for: * - GET `/applications/{application.id}/commands` @@ -796,12 +820,12 @@ export const RouteBases = { Object.freeze(RouteBases); export const OAuth2Routes = { - authorizationURL: `https://discord.com/api/v${APIVersion}/oauth2/authorize`, - tokenURL: `https://discord.com/api/v${APIVersion}/oauth2/token`, + authorizationURL: `${RouteBases.api}${Routes.oauth2Authorization()}`, + tokenURL: `${RouteBases.api}${Routes.oauth2TokenExchange()}`, /** * See https://tools.ietf.org/html/rfc7009 */ - tokenRevocationURL: `https://discord.com/api/v${APIVersion}/oauth2/token/revoke`, + tokenRevocationURL: `${RouteBases.api}${Routes.oauth2TokenRevocation()}`, } as const; // Freeze OAuth2 route object