Skip to content

Commit

Permalink
refactor: allow omitting allow and deny in permission_overwrites (
Browse files Browse the repository at this point in the history
  • Loading branch information
almeidx committed Feb 1, 2022
1 parent 8e13cd8 commit c48aab3
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 16 deletions.
15 changes: 11 additions & 4 deletions deno/rest/v8/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import type {
APIFollowedChannel,
APIMessage,
APIMessageReference,
APIOverwrite,
APIUser,
ChannelType,
InviteTargetType,
Expand All @@ -19,6 +18,10 @@ import type {
} from '../../payloads/v8/mod.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals.ts';

export interface APIChannelPatchOverwrite extends RESTPutAPIChannelPermissionJSONBody {
id: Snowflake;
}

/**
* https://discord.com/developers/docs/resources/channel#get-channel
*/
Expand Down Expand Up @@ -85,7 +88,7 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
*
* Channel types: all
*/
permission_overwrites?: APIOverwrite[] | null;
permission_overwrites?: APIChannelPatchOverwrite[] | null;
/**
* ID of the new parent category for a channel
*
Expand Down Expand Up @@ -392,14 +395,18 @@ export interface RESTPutAPIChannelPermissionJSONBody {
* The bitwise value of all allowed permissions
*
* See https://en.wikipedia.org/wiki/Bit_field
*
* @default "0"
*/
allow: Permissions;
allow?: Permissions | null;
/**
* The bitwise value of all disallowed permissions
*
* See https://en.wikipedia.org/wiki/Bit_field
*
* @default "0"
*/
deny: Permissions;
deny?: Permissions | null;
/**
* `0` for a role or `1` for a member
*/
Expand Down
15 changes: 11 additions & 4 deletions deno/rest/v9/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import type {
APIFollowedChannel,
APIMessage,
APIMessageReference,
APIOverwrite,
APIThreadList,
APIThreadMember,
APIUser,
Expand All @@ -22,6 +21,10 @@ import type {
} from '../../payloads/v9/mod.ts';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals.ts';

export interface APIChannelPatchOverwrite extends RESTPutAPIChannelPermissionJSONBody {
id: Snowflake;
}

/**
* https://discord.com/developers/docs/resources/channel#get-channel
*/
Expand Down Expand Up @@ -88,7 +91,7 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
*
* Channel types: all excluding newsThread, publicThread, privateThread
*/
permission_overwrites?: APIOverwrite[] | null;
permission_overwrites?: APIChannelPatchOverwrite[] | null;
/**
* ID of the new parent category for a channel
*
Expand Down Expand Up @@ -425,14 +428,18 @@ export interface RESTPutAPIChannelPermissionJSONBody {
* The bitwise value of all allowed permissions
*
* See https://en.wikipedia.org/wiki/Bit_field
*
* @default "0"
*/
allow: Permissions;
allow?: Permissions | null;
/**
* The bitwise value of all disallowed permissions
*
* See https://en.wikipedia.org/wiki/Bit_field
*
* @default "0"
*/
deny: Permissions;
deny?: Permissions | null;
/**
* `0` for a role or `1` for a member
*/
Expand Down
15 changes: 11 additions & 4 deletions rest/v8/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import type {
APIFollowedChannel,
APIMessage,
APIMessageReference,
APIOverwrite,
APIUser,
ChannelType,
InviteTargetType,
Expand All @@ -19,6 +18,10 @@ import type {
} from '../../payloads/v8/index';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals';

export interface APIChannelPatchOverwrite extends RESTPutAPIChannelPermissionJSONBody {
id: Snowflake;
}

/**
* https://discord.com/developers/docs/resources/channel#get-channel
*/
Expand Down Expand Up @@ -85,7 +88,7 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
*
* Channel types: all
*/
permission_overwrites?: APIOverwrite[] | null;
permission_overwrites?: APIChannelPatchOverwrite[] | null;
/**
* ID of the new parent category for a channel
*
Expand Down Expand Up @@ -392,14 +395,18 @@ export interface RESTPutAPIChannelPermissionJSONBody {
* The bitwise value of all allowed permissions
*
* See https://en.wikipedia.org/wiki/Bit_field
*
* @default "0"
*/
allow: Permissions;
allow?: Permissions | null;
/**
* The bitwise value of all disallowed permissions
*
* See https://en.wikipedia.org/wiki/Bit_field
*
* @default "0"
*/
deny: Permissions;
deny?: Permissions | null;
/**
* `0` for a role or `1` for a member
*/
Expand Down
15 changes: 11 additions & 4 deletions rest/v9/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import type {
APIFollowedChannel,
APIMessage,
APIMessageReference,
APIOverwrite,
APIThreadList,
APIThreadMember,
APIUser,
Expand All @@ -22,6 +21,10 @@ import type {
} from '../../payloads/v9/index';
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals';

export interface APIChannelPatchOverwrite extends RESTPutAPIChannelPermissionJSONBody {
id: Snowflake;
}

/**
* https://discord.com/developers/docs/resources/channel#get-channel
*/
Expand Down Expand Up @@ -88,7 +91,7 @@ export type RESTPatchAPIChannelJSONBody = AddUndefinedToPossiblyUndefinedPropert
*
* Channel types: all excluding newsThread, publicThread, privateThread
*/
permission_overwrites?: APIOverwrite[] | null;
permission_overwrites?: APIChannelPatchOverwrite[] | null;
/**
* ID of the new parent category for a channel
*
Expand Down Expand Up @@ -425,14 +428,18 @@ export interface RESTPutAPIChannelPermissionJSONBody {
* The bitwise value of all allowed permissions
*
* See https://en.wikipedia.org/wiki/Bit_field
*
* @default "0"
*/
allow: Permissions;
allow?: Permissions | null;
/**
* The bitwise value of all disallowed permissions
*
* See https://en.wikipedia.org/wiki/Bit_field
*
* @default "0"
*/
deny: Permissions;
deny?: Permissions | null;
/**
* `0` for a role or `1` for a member
*/
Expand Down

0 comments on commit c48aab3

Please sign in to comment.