Skip to content

Commit

Permalink
fix(RESTPostAPIChannelMessageJSONBody): number for attachment ids (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiralite committed Aug 24, 2023
1 parent 31c8549 commit 1eb0161
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 24 deletions.
23 changes: 20 additions & 3 deletions deno/rest/v10/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type { Permissions, Snowflake } from '../../globals.ts';
import type {
APIActionRowComponent,
APIAllowedMentions,
APIAttachment,
APIChannel,
APIEmbed,
APIExtendedInvite,
Expand Down Expand Up @@ -240,6 +239,24 @@ export type APIMessageReferenceSend = StrictPartial<APIMessageReference> &
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
*/
Expand Down Expand Up @@ -289,7 +306,7 @@ export interface RESTPostAPIChannelMessageJSONBody {
/**
* Attachment objects with filename and description
*/
attachments?: (Pick<APIAttachment, 'id' | 'description'> & Partial<Pick<APIAttachment, 'filename'>>)[] | undefined;
attachments?: RESTAPIAttachment[] | undefined;
/**
* Message flags combined as a bitfield
*/
Expand Down Expand Up @@ -400,7 +417,7 @@ export interface RESTPatchAPIChannelMessageJSONBody {
*
* See https://discord.com/developers/docs/resources/channel#attachment-object
*/
attachments?: (Pick<APIAttachment, 'id'> & Partial<Pick<APIAttachment, 'filename' | 'description'>>)[] | undefined;
attachments?: RESTAPIAttachment[] | undefined;
/**
* The components to include with the message
*
Expand Down
6 changes: 3 additions & 3 deletions deno/rest/v10/webhook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -139,7 +139,7 @@ export interface RESTPostAPIWebhookWithTokenJSONBody {
/**
* Attachment objects with filename and description
*/
attachments?: (Pick<APIAttachment, 'id' | 'description'> & Partial<Pick<APIAttachment, 'filename'>>)[] | undefined;
attachments?: RESTAPIAttachment[] | undefined;
/**
* Message flags combined as a bitfield
*/
Expand Down Expand Up @@ -257,7 +257,7 @@ export type RESTPatchAPIWebhookWithTokenMessageJSONBody = AddUndefinedToPossibly
*
* See https://discord.com/developers/docs/resources/channel#attachment-object
*/
attachments?: (Pick<APIAttachment, 'id'> & Partial<Pick<APIAttachment, 'filename' | 'description'>>)[] | undefined;
attachments?: RESTAPIAttachment[] | undefined;
};

/**
Expand Down
23 changes: 20 additions & 3 deletions deno/rest/v9/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type { Permissions, Snowflake } from '../../globals.ts';
import type {
APIActionRowComponent,
APIAllowedMentions,
APIAttachment,
APIChannel,
APIEmbed,
APIExtendedInvite,
Expand Down Expand Up @@ -240,6 +239,24 @@ export type APIMessageReferenceSend = StrictPartial<APIMessageReference> &
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
*/
Expand Down Expand Up @@ -297,7 +314,7 @@ export interface RESTPostAPIChannelMessageJSONBody {
/**
* Attachment objects with filename and description
*/
attachments?: (Pick<APIAttachment, 'id' | 'description'> & Partial<Pick<APIAttachment, 'filename'>>)[] | undefined;
attachments?: RESTAPIAttachment[] | undefined;
/**
* Message flags combined as a bitfield
*/
Expand Down Expand Up @@ -416,7 +433,7 @@ export interface RESTPatchAPIChannelMessageJSONBody {
*
* See https://discord.com/developers/docs/resources/channel#attachment-object
*/
attachments?: (Pick<APIAttachment, 'id'> & Partial<Pick<APIAttachment, 'filename' | 'description'>>)[] | undefined;
attachments?: RESTAPIAttachment[] | undefined;
/**
* The components to include with the message
*
Expand Down
6 changes: 3 additions & 3 deletions deno/rest/v9/webhook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -139,7 +139,7 @@ export interface RESTPostAPIWebhookWithTokenJSONBody {
/**
* Attachment objects with filename and description
*/
attachments?: (Pick<APIAttachment, 'id' | 'description'> & Partial<Pick<APIAttachment, 'filename'>>)[] | undefined;
attachments?: RESTAPIAttachment[] | undefined;
/**
* Message flags combined as a bitfield
*/
Expand Down Expand Up @@ -257,7 +257,7 @@ export type RESTPatchAPIWebhookWithTokenMessageJSONBody = AddUndefinedToPossibly
*
* See https://discord.com/developers/docs/resources/channel#attachment-object
*/
attachments?: (Pick<APIAttachment, 'id'> & Partial<Pick<APIAttachment, 'filename' | 'description'>>)[] | undefined;
attachments?: RESTAPIAttachment[] | undefined;
};

/**
Expand Down
23 changes: 20 additions & 3 deletions rest/v10/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type { Permissions, Snowflake } from '../../globals';
import type {
APIActionRowComponent,
APIAllowedMentions,
APIAttachment,
APIChannel,
APIEmbed,
APIExtendedInvite,
Expand Down Expand Up @@ -240,6 +239,24 @@ export type APIMessageReferenceSend = StrictPartial<APIMessageReference> &
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
*/
Expand Down Expand Up @@ -289,7 +306,7 @@ export interface RESTPostAPIChannelMessageJSONBody {
/**
* Attachment objects with filename and description
*/
attachments?: (Pick<APIAttachment, 'id' | 'description'> & Partial<Pick<APIAttachment, 'filename'>>)[] | undefined;
attachments?: RESTAPIAttachment[] | undefined;
/**
* Message flags combined as a bitfield
*/
Expand Down Expand Up @@ -400,7 +417,7 @@ export interface RESTPatchAPIChannelMessageJSONBody {
*
* See https://discord.com/developers/docs/resources/channel#attachment-object
*/
attachments?: (Pick<APIAttachment, 'id'> & Partial<Pick<APIAttachment, 'filename' | 'description'>>)[] | undefined;
attachments?: RESTAPIAttachment[] | undefined;
/**
* The components to include with the message
*
Expand Down
6 changes: 3 additions & 3 deletions rest/v10/webhook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -139,7 +139,7 @@ export interface RESTPostAPIWebhookWithTokenJSONBody {
/**
* Attachment objects with filename and description
*/
attachments?: (Pick<APIAttachment, 'id' | 'description'> & Partial<Pick<APIAttachment, 'filename'>>)[] | undefined;
attachments?: RESTAPIAttachment[] | undefined;
/**
* Message flags combined as a bitfield
*/
Expand Down Expand Up @@ -257,7 +257,7 @@ export type RESTPatchAPIWebhookWithTokenMessageJSONBody = AddUndefinedToPossibly
*
* See https://discord.com/developers/docs/resources/channel#attachment-object
*/
attachments?: (Pick<APIAttachment, 'id'> & Partial<Pick<APIAttachment, 'filename' | 'description'>>)[] | undefined;
attachments?: RESTAPIAttachment[] | undefined;
};

/**
Expand Down
23 changes: 20 additions & 3 deletions rest/v9/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type { Permissions, Snowflake } from '../../globals';
import type {
APIActionRowComponent,
APIAllowedMentions,
APIAttachment,
APIChannel,
APIEmbed,
APIExtendedInvite,
Expand Down Expand Up @@ -240,6 +239,24 @@ export type APIMessageReferenceSend = StrictPartial<APIMessageReference> &
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
*/
Expand Down Expand Up @@ -297,7 +314,7 @@ export interface RESTPostAPIChannelMessageJSONBody {
/**
* Attachment objects with filename and description
*/
attachments?: (Pick<APIAttachment, 'id' | 'description'> & Partial<Pick<APIAttachment, 'filename'>>)[] | undefined;
attachments?: RESTAPIAttachment[] | undefined;
/**
* Message flags combined as a bitfield
*/
Expand Down Expand Up @@ -416,7 +433,7 @@ export interface RESTPatchAPIChannelMessageJSONBody {
*
* See https://discord.com/developers/docs/resources/channel#attachment-object
*/
attachments?: (Pick<APIAttachment, 'id'> & Partial<Pick<APIAttachment, 'filename' | 'description'>>)[] | undefined;
attachments?: RESTAPIAttachment[] | undefined;
/**
* The components to include with the message
*
Expand Down
6 changes: 3 additions & 3 deletions rest/v9/webhook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -139,7 +139,7 @@ export interface RESTPostAPIWebhookWithTokenJSONBody {
/**
* Attachment objects with filename and description
*/
attachments?: (Pick<APIAttachment, 'id' | 'description'> & Partial<Pick<APIAttachment, 'filename'>>)[] | undefined;
attachments?: RESTAPIAttachment[] | undefined;
/**
* Message flags combined as a bitfield
*/
Expand Down Expand Up @@ -257,7 +257,7 @@ export type RESTPatchAPIWebhookWithTokenMessageJSONBody = AddUndefinedToPossibly
*
* See https://discord.com/developers/docs/resources/channel#attachment-object
*/
attachments?: (Pick<APIAttachment, 'id'> & Partial<Pick<APIAttachment, 'filename' | 'description'>>)[] | undefined;
attachments?: RESTAPIAttachment[] | undefined;
};

/**
Expand Down

1 comment on commit 1eb0161

@vercel
Copy link

@vercel vercel bot commented on 1eb0161 Aug 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.