From 1eb01618a3d7421012b0423aea7a8bde032c08fc Mon Sep 17 00:00:00 2001 From: Jiralite <33201955+Jiralite@users.noreply.github.com> Date: Fri, 25 Aug 2023 00:52:43 +0100 Subject: [PATCH] fix(RESTPostAPIChannelMessageJSONBody): `number` for attachment ids (#811) --- deno/rest/v10/channel.ts | 23 ++++++++++++++++++++--- deno/rest/v10/webhook.ts | 6 +++--- deno/rest/v9/channel.ts | 23 ++++++++++++++++++++--- deno/rest/v9/webhook.ts | 6 +++--- rest/v10/channel.ts | 23 ++++++++++++++++++++--- rest/v10/webhook.ts | 6 +++--- rest/v9/channel.ts | 23 ++++++++++++++++++++--- rest/v9/webhook.ts | 6 +++--- 8 files changed, 92 insertions(+), 24 deletions(-) diff --git a/deno/rest/v10/channel.ts b/deno/rest/v10/channel.ts index 3e1ba7a5..6da51ca1 100644 --- a/deno/rest/v10/channel.ts +++ b/deno/rest/v10/channel.ts @@ -2,7 +2,6 @@ import type { Permissions, Snowflake } from '../../globals.ts'; import type { APIActionRowComponent, APIAllowedMentions, - APIAttachment, APIChannel, APIEmbed, APIExtendedInvite, @@ -240,6 +239,24 @@ export type APIMessageReferenceSend = StrictPartial & fail_if_not_exists?: boolean | undefined; }; +/** + * https://discord.com/developers/docs/resources/channel#attachment-object + */ +export interface RESTAPIAttachment { + /** + * Attachment id or a number that matches `n` in `files[n]` + */ + id: Snowflake | number; + /** + * Name of the file + */ + filename?: string | undefined; + /** + * Description of the file + */ + description?: string | undefined; +} + /** * https://discord.com/developers/docs/resources/channel#create-message */ @@ -289,7 +306,7 @@ export interface RESTPostAPIChannelMessageJSONBody { /** * Attachment objects with filename and description */ - attachments?: (Pick & Partial>)[] | undefined; + attachments?: RESTAPIAttachment[] | undefined; /** * Message flags combined as a bitfield */ @@ -400,7 +417,7 @@ export interface RESTPatchAPIChannelMessageJSONBody { * * See https://discord.com/developers/docs/resources/channel#attachment-object */ - attachments?: (Pick & Partial>)[] | undefined; + attachments?: RESTAPIAttachment[] | undefined; /** * The components to include with the message * diff --git a/deno/rest/v10/webhook.ts b/deno/rest/v10/webhook.ts index 45049732..f07e6d18 100644 --- a/deno/rest/v10/webhook.ts +++ b/deno/rest/v10/webhook.ts @@ -5,11 +5,11 @@ import type { APIEmbed, APIMessage, APIWebhook, - APIAttachment, MessageFlags, APIMessageActionRowComponent, } from '../../payloads/v10/mod.ts'; import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, Nullable } from '../../utils/internals.ts'; +import type { RESTAPIAttachment } from './channel.ts'; /** * https://discord.com/developers/docs/resources/webhook#create-webhook */ @@ -139,7 +139,7 @@ export interface RESTPostAPIWebhookWithTokenJSONBody { /** * Attachment objects with filename and description */ - attachments?: (Pick & Partial>)[] | undefined; + attachments?: RESTAPIAttachment[] | undefined; /** * Message flags combined as a bitfield */ @@ -257,7 +257,7 @@ export type RESTPatchAPIWebhookWithTokenMessageJSONBody = AddUndefinedToPossibly * * See https://discord.com/developers/docs/resources/channel#attachment-object */ - attachments?: (Pick & Partial>)[] | undefined; + attachments?: RESTAPIAttachment[] | undefined; }; /** diff --git a/deno/rest/v9/channel.ts b/deno/rest/v9/channel.ts index 46f4c536..b56a572d 100644 --- a/deno/rest/v9/channel.ts +++ b/deno/rest/v9/channel.ts @@ -2,7 +2,6 @@ import type { Permissions, Snowflake } from '../../globals.ts'; import type { APIActionRowComponent, APIAllowedMentions, - APIAttachment, APIChannel, APIEmbed, APIExtendedInvite, @@ -240,6 +239,24 @@ export type APIMessageReferenceSend = StrictPartial & fail_if_not_exists?: boolean | undefined; }; +/** + * https://discord.com/developers/docs/resources/channel#attachment-object + */ +export interface RESTAPIAttachment { + /** + * Attachment id or a number that matches `n` in `files[n]` + */ + id: Snowflake | number; + /** + * Name of the file + */ + filename?: string | undefined; + /** + * Description of the file + */ + description?: string | undefined; +} + /** * https://discord.com/developers/docs/resources/channel#create-message */ @@ -297,7 +314,7 @@ export interface RESTPostAPIChannelMessageJSONBody { /** * Attachment objects with filename and description */ - attachments?: (Pick & Partial>)[] | undefined; + attachments?: RESTAPIAttachment[] | undefined; /** * Message flags combined as a bitfield */ @@ -416,7 +433,7 @@ export interface RESTPatchAPIChannelMessageJSONBody { * * See https://discord.com/developers/docs/resources/channel#attachment-object */ - attachments?: (Pick & Partial>)[] | undefined; + attachments?: RESTAPIAttachment[] | undefined; /** * The components to include with the message * diff --git a/deno/rest/v9/webhook.ts b/deno/rest/v9/webhook.ts index 34961d90..50fd075a 100644 --- a/deno/rest/v9/webhook.ts +++ b/deno/rest/v9/webhook.ts @@ -5,11 +5,11 @@ import type { APIEmbed, APIMessage, APIWebhook, - APIAttachment, MessageFlags, APIMessageActionRowComponent, } from '../../payloads/v9/mod.ts'; import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, Nullable } from '../../utils/internals.ts'; +import type { RESTAPIAttachment } from './channel.ts'; /** * https://discord.com/developers/docs/resources/webhook#create-webhook */ @@ -139,7 +139,7 @@ export interface RESTPostAPIWebhookWithTokenJSONBody { /** * Attachment objects with filename and description */ - attachments?: (Pick & Partial>)[] | undefined; + attachments?: RESTAPIAttachment[] | undefined; /** * Message flags combined as a bitfield */ @@ -257,7 +257,7 @@ export type RESTPatchAPIWebhookWithTokenMessageJSONBody = AddUndefinedToPossibly * * See https://discord.com/developers/docs/resources/channel#attachment-object */ - attachments?: (Pick & Partial>)[] | undefined; + attachments?: RESTAPIAttachment[] | undefined; }; /** diff --git a/rest/v10/channel.ts b/rest/v10/channel.ts index 97ebb0e8..3f9113db 100644 --- a/rest/v10/channel.ts +++ b/rest/v10/channel.ts @@ -2,7 +2,6 @@ import type { Permissions, Snowflake } from '../../globals'; import type { APIActionRowComponent, APIAllowedMentions, - APIAttachment, APIChannel, APIEmbed, APIExtendedInvite, @@ -240,6 +239,24 @@ export type APIMessageReferenceSend = StrictPartial & fail_if_not_exists?: boolean | undefined; }; +/** + * https://discord.com/developers/docs/resources/channel#attachment-object + */ +export interface RESTAPIAttachment { + /** + * Attachment id or a number that matches `n` in `files[n]` + */ + id: Snowflake | number; + /** + * Name of the file + */ + filename?: string | undefined; + /** + * Description of the file + */ + description?: string | undefined; +} + /** * https://discord.com/developers/docs/resources/channel#create-message */ @@ -289,7 +306,7 @@ export interface RESTPostAPIChannelMessageJSONBody { /** * Attachment objects with filename and description */ - attachments?: (Pick & Partial>)[] | undefined; + attachments?: RESTAPIAttachment[] | undefined; /** * Message flags combined as a bitfield */ @@ -400,7 +417,7 @@ export interface RESTPatchAPIChannelMessageJSONBody { * * See https://discord.com/developers/docs/resources/channel#attachment-object */ - attachments?: (Pick & Partial>)[] | undefined; + attachments?: RESTAPIAttachment[] | undefined; /** * The components to include with the message * diff --git a/rest/v10/webhook.ts b/rest/v10/webhook.ts index aca9d432..bf4dc6c0 100644 --- a/rest/v10/webhook.ts +++ b/rest/v10/webhook.ts @@ -5,11 +5,11 @@ import type { APIEmbed, APIMessage, APIWebhook, - APIAttachment, MessageFlags, APIMessageActionRowComponent, } from '../../payloads/v10/index'; import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, Nullable } from '../../utils/internals'; +import type { RESTAPIAttachment } from './channel'; /** * https://discord.com/developers/docs/resources/webhook#create-webhook */ @@ -139,7 +139,7 @@ export interface RESTPostAPIWebhookWithTokenJSONBody { /** * Attachment objects with filename and description */ - attachments?: (Pick & Partial>)[] | undefined; + attachments?: RESTAPIAttachment[] | undefined; /** * Message flags combined as a bitfield */ @@ -257,7 +257,7 @@ export type RESTPatchAPIWebhookWithTokenMessageJSONBody = AddUndefinedToPossibly * * See https://discord.com/developers/docs/resources/channel#attachment-object */ - attachments?: (Pick & Partial>)[] | undefined; + attachments?: RESTAPIAttachment[] | undefined; }; /** diff --git a/rest/v9/channel.ts b/rest/v9/channel.ts index 310fb17e..b34d7dac 100644 --- a/rest/v9/channel.ts +++ b/rest/v9/channel.ts @@ -2,7 +2,6 @@ import type { Permissions, Snowflake } from '../../globals'; import type { APIActionRowComponent, APIAllowedMentions, - APIAttachment, APIChannel, APIEmbed, APIExtendedInvite, @@ -240,6 +239,24 @@ export type APIMessageReferenceSend = StrictPartial & fail_if_not_exists?: boolean | undefined; }; +/** + * https://discord.com/developers/docs/resources/channel#attachment-object + */ +export interface RESTAPIAttachment { + /** + * Attachment id or a number that matches `n` in `files[n]` + */ + id: Snowflake | number; + /** + * Name of the file + */ + filename?: string | undefined; + /** + * Description of the file + */ + description?: string | undefined; +} + /** * https://discord.com/developers/docs/resources/channel#create-message */ @@ -297,7 +314,7 @@ export interface RESTPostAPIChannelMessageJSONBody { /** * Attachment objects with filename and description */ - attachments?: (Pick & Partial>)[] | undefined; + attachments?: RESTAPIAttachment[] | undefined; /** * Message flags combined as a bitfield */ @@ -416,7 +433,7 @@ export interface RESTPatchAPIChannelMessageJSONBody { * * See https://discord.com/developers/docs/resources/channel#attachment-object */ - attachments?: (Pick & Partial>)[] | undefined; + attachments?: RESTAPIAttachment[] | undefined; /** * The components to include with the message * diff --git a/rest/v9/webhook.ts b/rest/v9/webhook.ts index a63d9626..135c486b 100644 --- a/rest/v9/webhook.ts +++ b/rest/v9/webhook.ts @@ -5,11 +5,11 @@ import type { APIEmbed, APIMessage, APIWebhook, - APIAttachment, MessageFlags, APIMessageActionRowComponent, } from '../../payloads/v9/index'; import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, Nullable } from '../../utils/internals'; +import type { RESTAPIAttachment } from './channel'; /** * https://discord.com/developers/docs/resources/webhook#create-webhook */ @@ -139,7 +139,7 @@ export interface RESTPostAPIWebhookWithTokenJSONBody { /** * Attachment objects with filename and description */ - attachments?: (Pick & Partial>)[] | undefined; + attachments?: RESTAPIAttachment[] | undefined; /** * Message flags combined as a bitfield */ @@ -257,7 +257,7 @@ export type RESTPatchAPIWebhookWithTokenMessageJSONBody = AddUndefinedToPossibly * * See https://discord.com/developers/docs/resources/channel#attachment-object */ - attachments?: (Pick & Partial>)[] | undefined; + attachments?: RESTAPIAttachment[] | undefined; }; /**