Skip to content

Commit

Permalink
feat: add guild mfa endpoint and error 50017 (#476)
Browse files Browse the repository at this point in the history
  • Loading branch information
almeidx committed Jun 8, 2022
1 parent 63ca86a commit 292c6b5
Show file tree
Hide file tree
Showing 10 changed files with 106 additions and 0 deletions.
1 change: 1 addition & 0 deletions deno/rest/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ export enum RESTJSONErrorCodes {
InvalidToken,
NoteWasTooLong,
ProvidedTooFewOrTooManyMessagesToDelete,
InvalidMFALevel,

MessageCanOnlyBePinnedInTheChannelItWasSentIn = 50019,
InviteCodeInvalidOrTaken,
Expand Down
18 changes: 18 additions & 0 deletions deno/rest/v10/guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import type {
GuildDefaultMessageNotifications,
GuildExplicitContentFilter,
GuildFeature,
GuildMFALevel,
GuildSystemChannelFlags,
GuildVerificationLevel,
GuildWidgetStyle,
Expand Down Expand Up @@ -158,6 +159,23 @@ export type RESTPostAPIGuildsJSONBody = AddUndefinedToPossiblyUndefinedPropertie
*/
export type RESTPostAPIGuildsResult = APIGuild;

/**
* https://discord.com/developers/docs/resources/guild#modify-guild-mfa-level
*/
export interface RESTPostAPIGuildsMFAJSONBody {
/**
* MFA level
*
* See https://discord.com/developers/docs/resources/guild#guild-object-mfa-level
*/
level: GuildMFALevel;
}

/**
* https://discord.com/developers/docs/resources/guild#modify-guild-mfa-level
*/
export type RESTPostAPIGuildsMFAResult = RESTPostAPIGuildsMFAJSONBody;

/**
* https://discord.com/developers/docs/resources/guild#get-guild
*/
Expand Down
8 changes: 8 additions & 0 deletions deno/rest/v10/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,14 @@ export const Routes = {
return `/guilds/${guildId}/members/${memberId}/roles/${roleId}` as const;
},

/**
* Route for:
* - POST `/guilds/{guild.id}/mfa`
*/
guildMFA(guildId: Snowflake) {
return `/guilds/${guildId}/mfa` as const;
},

/**
* Route for:
* - GET `/guilds/{guild.id}/bans`
Expand Down
18 changes: 18 additions & 0 deletions deno/rest/v9/guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import type {
GuildDefaultMessageNotifications,
GuildExplicitContentFilter,
GuildFeature,
GuildMFALevel,
GuildSystemChannelFlags,
GuildVerificationLevel,
GuildWidgetStyle,
Expand Down Expand Up @@ -158,6 +159,23 @@ export type RESTPostAPIGuildsJSONBody = AddUndefinedToPossiblyUndefinedPropertie
*/
export type RESTPostAPIGuildsResult = APIGuild;

/**
* https://discord.com/developers/docs/resources/guild#modify-guild-mfa-level
*/
export interface RESTPostAPIGuildsMFAJSONBody {
/**
* MFA level
*
* See https://discord.com/developers/docs/resources/guild#guild-object-mfa-level
*/
level: GuildMFALevel;
}

/**
* https://discord.com/developers/docs/resources/guild#modify-guild-mfa-level
*/
export type RESTPostAPIGuildsMFAResult = RESTPostAPIGuildsMFAJSONBody;

/**
* https://discord.com/developers/docs/resources/guild#get-guild
*/
Expand Down
8 changes: 8 additions & 0 deletions deno/rest/v9/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,14 @@ export const Routes = {
return `/guilds/${guildId}/members/${memberId}/roles/${roleId}` as const;
},

/**
* Route for:
* - POST `/guilds/{guild.id}/mfa`
*/
guildMFA(guildId: Snowflake) {
return `/guilds/${guildId}/mfa` as const;
},

/**
* Route for:
* - GET `/guilds/{guild.id}/bans`
Expand Down
1 change: 1 addition & 0 deletions rest/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ export enum RESTJSONErrorCodes {
InvalidToken,
NoteWasTooLong,
ProvidedTooFewOrTooManyMessagesToDelete,
InvalidMFALevel,

MessageCanOnlyBePinnedInTheChannelItWasSentIn = 50019,
InviteCodeInvalidOrTaken,
Expand Down
18 changes: 18 additions & 0 deletions rest/v10/guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import type {
GuildDefaultMessageNotifications,
GuildExplicitContentFilter,
GuildFeature,
GuildMFALevel,
GuildSystemChannelFlags,
GuildVerificationLevel,
GuildWidgetStyle,
Expand Down Expand Up @@ -158,6 +159,23 @@ export type RESTPostAPIGuildsJSONBody = AddUndefinedToPossiblyUndefinedPropertie
*/
export type RESTPostAPIGuildsResult = APIGuild;

/**
* https://discord.com/developers/docs/resources/guild#modify-guild-mfa-level
*/
export interface RESTPostAPIGuildsMFAJSONBody {
/**
* MFA level
*
* See https://discord.com/developers/docs/resources/guild#guild-object-mfa-level
*/
level: GuildMFALevel;
}

/**
* https://discord.com/developers/docs/resources/guild#modify-guild-mfa-level
*/
export type RESTPostAPIGuildsMFAResult = RESTPostAPIGuildsMFAJSONBody;

/**
* https://discord.com/developers/docs/resources/guild#get-guild
*/
Expand Down
8 changes: 8 additions & 0 deletions rest/v10/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,14 @@ export const Routes = {
return `/guilds/${guildId}/members/${memberId}/roles/${roleId}` as const;
},

/**
* Route for:
* - POST `/guilds/{guild.id}/mfa`
*/
guildMFA(guildId: Snowflake) {
return `/guilds/${guildId}/mfa` as const;
},

/**
* Route for:
* - GET `/guilds/{guild.id}/bans`
Expand Down
18 changes: 18 additions & 0 deletions rest/v9/guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import type {
GuildDefaultMessageNotifications,
GuildExplicitContentFilter,
GuildFeature,
GuildMFALevel,
GuildSystemChannelFlags,
GuildVerificationLevel,
GuildWidgetStyle,
Expand Down Expand Up @@ -158,6 +159,23 @@ export type RESTPostAPIGuildsJSONBody = AddUndefinedToPossiblyUndefinedPropertie
*/
export type RESTPostAPIGuildsResult = APIGuild;

/**
* https://discord.com/developers/docs/resources/guild#modify-guild-mfa-level
*/
export interface RESTPostAPIGuildsMFAJSONBody {
/**
* MFA level
*
* See https://discord.com/developers/docs/resources/guild#guild-object-mfa-level
*/
level: GuildMFALevel;
}

/**
* https://discord.com/developers/docs/resources/guild#modify-guild-mfa-level
*/
export type RESTPostAPIGuildsMFAResult = RESTPostAPIGuildsMFAJSONBody;

/**
* https://discord.com/developers/docs/resources/guild#get-guild
*/
Expand Down
8 changes: 8 additions & 0 deletions rest/v9/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,14 @@ export const Routes = {
return `/guilds/${guildId}/members/${memberId}/roles/${roleId}` as const;
},

/**
* Route for:
* - POST `/guilds/{guild.id}/mfa`
*/
guildMFA(guildId: Snowflake) {
return `/guilds/${guildId}/mfa` as const;
},

/**
* Route for:
* - GET `/guilds/{guild.id}/bans`
Expand Down

0 comments on commit 292c6b5

Please sign in to comment.