refactor: allow omitting allow and deny in permission_overwrites (#310)

This commit is contained in:
Almeida
2022-02-01 19:36:23 +00:00
committed by GitHub
parent 8e13cd80c6
commit c48aab3921
4 changed files with 44 additions and 16 deletions

View File

@@ -9,7 +9,6 @@ import type {
APIFollowedChannel,
APIMessage,
APIMessageReference,
APIOverwrite,
APIUser,
ChannelType,
InviteTargetType,
@@ -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
*/
@@ -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
*
@@ -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
*/

View File

@@ -9,7 +9,6 @@ import type {
APIFollowedChannel,
APIMessage,
APIMessageReference,
APIOverwrite,
APIThreadList,
APIThreadMember,
APIUser,
@@ -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
*/
@@ -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
*
@@ -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
*/

View File

@@ -9,7 +9,6 @@ import type {
APIFollowedChannel,
APIMessage,
APIMessageReference,
APIOverwrite,
APIUser,
ChannelType,
InviteTargetType,
@@ -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
*/
@@ -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
*
@@ -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
*/

View File

@@ -9,7 +9,6 @@ import type {
APIFollowedChannel,
APIMessage,
APIMessageReference,
APIOverwrite,
APIThreadList,
APIThreadMember,
APIUser,
@@ -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
*/
@@ -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
*
@@ -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
*/