mirror of
https://github.com/discordjs/discord-api-types.git
synced 2026-05-31 16:00:09 +00:00
feat(RESTPostAPIGuildChannelJSONBody): add default_auto_archive prop (#400)
This commit is contained in:
@@ -26,10 +26,11 @@ import type {
|
||||
} from '../../payloads/v10/mod.ts';
|
||||
import type {
|
||||
AddUndefinedToPossiblyUndefinedPropertiesOfInterface,
|
||||
DistributiveOmit,
|
||||
DistributivePick,
|
||||
Nullable,
|
||||
StrictPartial,
|
||||
StrictRequired,
|
||||
UnionToIntersection,
|
||||
} from '../../utils/internals.ts';
|
||||
|
||||
export interface APIGuildCreateOverwrite extends RESTPutAPIChannelPermissionJSONBody {
|
||||
@@ -38,9 +39,9 @@ export interface APIGuildCreateOverwrite extends RESTPutAPIChannelPermissionJSON
|
||||
|
||||
export type APIGuildChannelResolvable = Exclude<APIChannel, APIDMChannel | APIGroupDMChannel>;
|
||||
export type APIGuildCreatePartialChannel = StrictPartial<
|
||||
Pick<
|
||||
UnionToIntersection<APIGuildChannelResolvable>,
|
||||
'type' | 'topic' | 'nsfw' | 'bitrate' | 'user_limit' | 'rate_limit_per_user'
|
||||
DistributivePick<
|
||||
APIGuildChannelResolvable,
|
||||
'type' | 'topic' | 'nsfw' | 'bitrate' | 'user_limit' | 'rate_limit_per_user' | 'default_auto_archive_duration'
|
||||
>
|
||||
> &
|
||||
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
@@ -291,7 +292,7 @@ export type RESTGetAPIGuildChannelsResult = APIChannel[];
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#create-guild-channel
|
||||
*/
|
||||
export type RESTPostAPIGuildChannelJSONBody = Omit<APIGuildCreatePartialChannel, 'id'>;
|
||||
export type RESTPostAPIGuildChannelJSONBody = DistributiveOmit<APIGuildCreatePartialChannel, 'id'>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#create-guild-channel
|
||||
|
||||
@@ -26,10 +26,11 @@ import type {
|
||||
} from '../../payloads/v9/mod.ts';
|
||||
import type {
|
||||
AddUndefinedToPossiblyUndefinedPropertiesOfInterface,
|
||||
DistributiveOmit,
|
||||
DistributivePick,
|
||||
Nullable,
|
||||
StrictPartial,
|
||||
StrictRequired,
|
||||
UnionToIntersection,
|
||||
} from '../../utils/internals.ts';
|
||||
|
||||
export interface APIGuildCreateOverwrite extends RESTPutAPIChannelPermissionJSONBody {
|
||||
@@ -38,9 +39,9 @@ export interface APIGuildCreateOverwrite extends RESTPutAPIChannelPermissionJSON
|
||||
|
||||
export type APIGuildChannelResolvable = Exclude<APIChannel, APIDMChannel | APIGroupDMChannel>;
|
||||
export type APIGuildCreatePartialChannel = StrictPartial<
|
||||
Pick<
|
||||
UnionToIntersection<APIGuildChannelResolvable>,
|
||||
'type' | 'topic' | 'nsfw' | 'bitrate' | 'user_limit' | 'rate_limit_per_user'
|
||||
DistributivePick<
|
||||
APIGuildChannelResolvable,
|
||||
'type' | 'topic' | 'nsfw' | 'bitrate' | 'user_limit' | 'rate_limit_per_user' | 'default_auto_archive_duration'
|
||||
>
|
||||
> &
|
||||
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
@@ -291,7 +292,7 @@ export type RESTGetAPIGuildChannelsResult = APIChannel[];
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#create-guild-channel
|
||||
*/
|
||||
export type RESTPostAPIGuildChannelJSONBody = Omit<APIGuildCreatePartialChannel, 'id'>;
|
||||
export type RESTPostAPIGuildChannelJSONBody = DistributiveOmit<APIGuildCreatePartialChannel, 'id'>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#create-guild-channel
|
||||
|
||||
@@ -14,4 +14,26 @@ export type StrictPartial<Base> = AddUndefinedToPossiblyUndefinedPropertiesOfInt
|
||||
|
||||
export type StrictRequired<Base> = Required<{ [K in keyof Base]: Exclude<Base[K], undefined> }>;
|
||||
|
||||
export type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) extends (x: infer R) => any ? R : never;
|
||||
export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
||||
|
||||
type Keys<T> = keyof T;
|
||||
type DistributiveKeys<T> = T extends unknown ? Keys<T> : never;
|
||||
/**
|
||||
* Allows picking of keys from unions that are disjoint
|
||||
*/
|
||||
export type DistributivePick<T, K extends DistributiveKeys<T>> = T extends unknown
|
||||
? keyof Pick_<T, K> extends never
|
||||
? never
|
||||
: { [P in keyof Pick_<T, K>]: Pick_<T, K>[P] }
|
||||
: never;
|
||||
|
||||
type Pick_<T, K> = Pick<T, Extract<keyof T, K>>;
|
||||
|
||||
/**
|
||||
* Allows omitting of keys from unions that are disjoint
|
||||
*/
|
||||
export type DistributiveOmit<T, K extends DistributiveKeys<T>> = T extends unknown
|
||||
? { [P in keyof Omit_<T, K>]: Omit_<T, K>[P] }
|
||||
: never;
|
||||
|
||||
type Omit_<T, K> = Omit<T, Extract<keyof T, K>>;
|
||||
|
||||
@@ -26,10 +26,11 @@ import type {
|
||||
} from '../../payloads/v10/index';
|
||||
import type {
|
||||
AddUndefinedToPossiblyUndefinedPropertiesOfInterface,
|
||||
DistributiveOmit,
|
||||
DistributivePick,
|
||||
Nullable,
|
||||
StrictPartial,
|
||||
StrictRequired,
|
||||
UnionToIntersection,
|
||||
} from '../../utils/internals';
|
||||
|
||||
export interface APIGuildCreateOverwrite extends RESTPutAPIChannelPermissionJSONBody {
|
||||
@@ -38,9 +39,9 @@ export interface APIGuildCreateOverwrite extends RESTPutAPIChannelPermissionJSON
|
||||
|
||||
export type APIGuildChannelResolvable = Exclude<APIChannel, APIDMChannel | APIGroupDMChannel>;
|
||||
export type APIGuildCreatePartialChannel = StrictPartial<
|
||||
Pick<
|
||||
UnionToIntersection<APIGuildChannelResolvable>,
|
||||
'type' | 'topic' | 'nsfw' | 'bitrate' | 'user_limit' | 'rate_limit_per_user'
|
||||
DistributivePick<
|
||||
APIGuildChannelResolvable,
|
||||
'type' | 'topic' | 'nsfw' | 'bitrate' | 'user_limit' | 'rate_limit_per_user' | 'default_auto_archive_duration'
|
||||
>
|
||||
> &
|
||||
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
@@ -291,7 +292,7 @@ export type RESTGetAPIGuildChannelsResult = APIChannel[];
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#create-guild-channel
|
||||
*/
|
||||
export type RESTPostAPIGuildChannelJSONBody = Omit<APIGuildCreatePartialChannel, 'id'>;
|
||||
export type RESTPostAPIGuildChannelJSONBody = DistributiveOmit<APIGuildCreatePartialChannel, 'id'>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#create-guild-channel
|
||||
|
||||
@@ -26,10 +26,11 @@ import type {
|
||||
} from '../../payloads/v9/index';
|
||||
import type {
|
||||
AddUndefinedToPossiblyUndefinedPropertiesOfInterface,
|
||||
DistributiveOmit,
|
||||
DistributivePick,
|
||||
Nullable,
|
||||
StrictPartial,
|
||||
StrictRequired,
|
||||
UnionToIntersection,
|
||||
} from '../../utils/internals';
|
||||
|
||||
export interface APIGuildCreateOverwrite extends RESTPutAPIChannelPermissionJSONBody {
|
||||
@@ -38,9 +39,9 @@ export interface APIGuildCreateOverwrite extends RESTPutAPIChannelPermissionJSON
|
||||
|
||||
export type APIGuildChannelResolvable = Exclude<APIChannel, APIDMChannel | APIGroupDMChannel>;
|
||||
export type APIGuildCreatePartialChannel = StrictPartial<
|
||||
Pick<
|
||||
UnionToIntersection<APIGuildChannelResolvable>,
|
||||
'type' | 'topic' | 'nsfw' | 'bitrate' | 'user_limit' | 'rate_limit_per_user'
|
||||
DistributivePick<
|
||||
APIGuildChannelResolvable,
|
||||
'type' | 'topic' | 'nsfw' | 'bitrate' | 'user_limit' | 'rate_limit_per_user' | 'default_auto_archive_duration'
|
||||
>
|
||||
> &
|
||||
AddUndefinedToPossiblyUndefinedPropertiesOfInterface<{
|
||||
@@ -291,7 +292,7 @@ export type RESTGetAPIGuildChannelsResult = APIChannel[];
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#create-guild-channel
|
||||
*/
|
||||
export type RESTPostAPIGuildChannelJSONBody = Omit<APIGuildCreatePartialChannel, 'id'>;
|
||||
export type RESTPostAPIGuildChannelJSONBody = DistributiveOmit<APIGuildCreatePartialChannel, 'id'>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#create-guild-channel
|
||||
|
||||
@@ -14,4 +14,26 @@ export type StrictPartial<Base> = AddUndefinedToPossiblyUndefinedPropertiesOfInt
|
||||
|
||||
export type StrictRequired<Base> = Required<{ [K in keyof Base]: Exclude<Base[K], undefined> }>;
|
||||
|
||||
export type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) extends (x: infer R) => any ? R : never;
|
||||
export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
||||
|
||||
type Keys<T> = keyof T;
|
||||
type DistributiveKeys<T> = T extends unknown ? Keys<T> : never;
|
||||
/**
|
||||
* Allows picking of keys from unions that are disjoint
|
||||
*/
|
||||
export type DistributivePick<T, K extends DistributiveKeys<T>> = T extends unknown
|
||||
? keyof Pick_<T, K> extends never
|
||||
? never
|
||||
: { [P in keyof Pick_<T, K>]: Pick_<T, K>[P] }
|
||||
: never;
|
||||
|
||||
type Pick_<T, K> = Pick<T, Extract<keyof T, K>>;
|
||||
|
||||
/**
|
||||
* Allows omitting of keys from unions that are disjoint
|
||||
*/
|
||||
export type DistributiveOmit<T, K extends DistributiveKeys<T>> = T extends unknown
|
||||
? { [P in keyof Omit_<T, K>]: Omit_<T, K>[P] }
|
||||
: never;
|
||||
|
||||
type Omit_<T, K> = Omit<T, Extract<keyof T, K>>;
|
||||
|
||||
Reference in New Issue
Block a user