From f393ba520d7d6d2aacaca7b3ca5d355fab614f6e Mon Sep 17 00:00:00 2001 From: ckohen Date: Thu, 24 Jun 2021 02:30:56 -0700 Subject: [PATCH] feat(Threads): add typed thread creation (#148) Co-authored-by: Vlad Frangu Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- deno/rest/v9/channel.ts | 17 ++++++++++++++++- rest/v9/channel.ts | 17 ++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/deno/rest/v9/channel.ts b/deno/rest/v9/channel.ts index 88c9a1e9..bc070aca 100644 --- a/deno/rest/v9/channel.ts +++ b/deno/rest/v9/channel.ts @@ -515,7 +515,7 @@ export type RESTDeleteAPIChannelRecipientResult = unknown; /** * https://discord.com/developers/docs/resources/channel#start-thread-with-message */ -export interface RESTPostAPIChannelThreadsJSONBody { +export interface RESTPostAPIChannelMessagesThreadsJSONBody { /** * 2-100 character thread name */ @@ -529,6 +529,21 @@ export interface RESTPostAPIChannelThreadsJSONBody { /** * https://discord.com/developers/docs/resources/channel#start-thread-with-message */ +export type RESTPostAPIChannelMessagesThreadsResult = APIChannel; + +/** + * https://discord.com/developers/docs/resources/channel#start-thread-without-message + */ +export interface RESTPostAPIChannelThreadsJSONBody extends RESTPostAPIChannelMessagesThreadsJSONBody { + /** + * The type of thread to create + */ + type: ChannelType.GuildNewsThread | ChannelType.GuildPublicThread | ChannelType.GuildPrivateThread; +} + +/** + * https://discord.com/developers/docs/resources/channel#start-thread-without-message + */ export type RESTPostAPIChannelThreadsResult = APIChannel; /** diff --git a/rest/v9/channel.ts b/rest/v9/channel.ts index 1eedc148..ce1ccb13 100644 --- a/rest/v9/channel.ts +++ b/rest/v9/channel.ts @@ -515,7 +515,7 @@ export type RESTDeleteAPIChannelRecipientResult = unknown; /** * https://discord.com/developers/docs/resources/channel#start-thread-with-message */ -export interface RESTPostAPIChannelThreadsJSONBody { +export interface RESTPostAPIChannelMessagesThreadsJSONBody { /** * 2-100 character thread name */ @@ -529,6 +529,21 @@ export interface RESTPostAPIChannelThreadsJSONBody { /** * https://discord.com/developers/docs/resources/channel#start-thread-with-message */ +export type RESTPostAPIChannelMessagesThreadsResult = APIChannel; + +/** + * https://discord.com/developers/docs/resources/channel#start-thread-without-message + */ +export interface RESTPostAPIChannelThreadsJSONBody extends RESTPostAPIChannelMessagesThreadsJSONBody { + /** + * The type of thread to create + */ + type: ChannelType.GuildNewsThread | ChannelType.GuildPublicThread | ChannelType.GuildPrivateThread; +} + +/** + * https://discord.com/developers/docs/resources/channel#start-thread-without-message + */ export type RESTPostAPIChannelThreadsResult = APIChannel; /**