Skip to content

Commit f019f0f

Browse files
authored
feat(RESTAPIAttachment): add more properties (#1073)
1 parent e09ded6 commit f019f0f

File tree

12 files changed

+40
-60
lines changed

12 files changed

+40
-60
lines changed

deno/payloads/v10/channel.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ export interface APIMessage {
573573
/**
574574
* Any attached files
575575
*
576-
* See https://discord.com/developers/docs/resources/channel#attachment-object
576+
* See https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure
577577
*
578578
* The `MESSAGE_CONTENT` privileged gateway intent is required for verified applications to receive a non-empty value from this field
579579
*
@@ -1415,7 +1415,7 @@ export interface APIEmbedField {
14151415
}
14161416

14171417
/**
1418-
* https://discord.com/developers/docs/resources/channel#attachment-object-attachment-structure
1418+
* https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure
14191419
*/
14201420
export interface APIAttachment {
14211421
/**

deno/payloads/v9/channel.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ export interface APIMessage {
567567
/**
568568
* Any attached files
569569
*
570-
* See https://discord.com/developers/docs/resources/channel#attachment-object
570+
* See https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure
571571
*
572572
* The `MESSAGE_CONTENT` privileged gateway intent will become required after **August 31, 2022** for verified applications to receive a non-empty value from this field
573573
*
@@ -1382,7 +1382,7 @@ export interface APIEmbedField {
13821382
}
13831383

13841384
/**
1385-
* https://discord.com/developers/docs/resources/channel#attachment-object-attachment-structure
1385+
* https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure
13861386
*/
13871387
export interface APIAttachment {
13881388
/**

deno/rest/v10/channel.ts

+7-12
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import type {
2424
SortOrderType,
2525
ForumLayoutType,
2626
ChannelFlags,
27+
APIAttachment,
2728
} from '../../payloads/v10/mod.ts';
2829
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals.ts';
2930
import type { RESTAPIPoll } from './poll.ts';
@@ -260,22 +261,16 @@ export type RESTAPIMessageReference = AddUndefinedToPossiblyUndefinedPropertiesO
260261
export type APIMessageReferenceSend = RESTAPIMessageReference;
261262

262263
/**
263-
* https://discord.com/developers/docs/resources/channel#attachment-object
264+
* https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure
264265
*/
265-
export interface RESTAPIAttachment {
266+
export type RESTAPIAttachment = Partial<
267+
Pick<APIAttachment, 'description' | 'duration_secs' | 'filename' | 'title' | 'waveform'>
268+
> & {
266269
/**
267270
* Attachment id or a number that matches `n` in `files[n]`
268271
*/
269272
id: Snowflake | number;
270-
/**
271-
* Name of the file
272-
*/
273-
filename?: string | undefined;
274-
/**
275-
* Description of the file
276-
*/
277-
description?: string | undefined;
278-
}
273+
};
279274

280275
/**
281276
* https://discord.com/developers/docs/resources/channel#create-message
@@ -461,7 +456,7 @@ export interface RESTPatchAPIChannelMessageJSONBody {
461456
*
462457
* Starting with API v10, the `attachments` array must contain all attachments that should be present after edit, including **retained and new** attachments provided in the request body.
463458
*
464-
* See https://discord.com/developers/docs/resources/channel#attachment-object
459+
* See https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure
465460
*/
466461
attachments?: RESTAPIAttachment[] | undefined;
467462
/**

deno/rest/v10/webhook.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ export type RESTPatchAPIWebhookWithTokenMessageJSONBody = AddUndefinedToPossibly
264264
*
265265
* Starting with API v10, the `attachments` array must contain all attachments that should be present after edit, including **retained and new** attachments provided in the request body.
266266
*
267-
* See https://discord.com/developers/docs/resources/channel#attachment-object
267+
* See https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure
268268
*/
269269
attachments?: RESTAPIAttachment[] | undefined;
270270
};

deno/rest/v9/channel.ts

+7-12
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import type {
2424
SortOrderType,
2525
ForumLayoutType,
2626
ChannelFlags,
27+
APIAttachment,
2728
} from '../../payloads/v9/mod.ts';
2829
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals.ts';
2930
import type { RESTAPIPoll } from './poll.ts';
@@ -260,22 +261,16 @@ export type RESTAPIMessageReference = AddUndefinedToPossiblyUndefinedPropertiesO
260261
export type APIMessageReferenceSend = RESTAPIMessageReference;
261262

262263
/**
263-
* https://discord.com/developers/docs/resources/channel#attachment-object
264+
* https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure
264265
*/
265-
export interface RESTAPIAttachment {
266+
export type RESTAPIAttachment = Partial<
267+
Pick<APIAttachment, 'description' | 'duration_secs' | 'filename' | 'title' | 'waveform'>
268+
> & {
266269
/**
267270
* Attachment id or a number that matches `n` in `files[n]`
268271
*/
269272
id: Snowflake | number;
270-
/**
271-
* Name of the file
272-
*/
273-
filename?: string | undefined;
274-
/**
275-
* Description of the file
276-
*/
277-
description?: string | undefined;
278-
}
273+
};
279274

280275
/**
281276
* https://discord.com/developers/docs/resources/channel#create-message
@@ -477,7 +472,7 @@ export interface RESTPatchAPIChannelMessageJSONBody {
477472
*
478473
* Starting with API v10, the `attachments` array must contain all attachments that should be present after edit, including **retained and new** attachments provided in the request body.
479474
*
480-
* See https://discord.com/developers/docs/resources/channel#attachment-object
475+
* See https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure
481476
*/
482477
attachments?: RESTAPIAttachment[] | undefined;
483478
/**

deno/rest/v9/webhook.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ export type RESTPatchAPIWebhookWithTokenMessageJSONBody = AddUndefinedToPossibly
264264
*
265265
* Starting with API v10, the `attachments` array must contain all attachments that should be present after edit, including **retained and new** attachments provided in the request body.
266266
*
267-
* See https://discord.com/developers/docs/resources/channel#attachment-object
267+
* See https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure
268268
*/
269269
attachments?: RESTAPIAttachment[] | undefined;
270270
};

payloads/v10/channel.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ export interface APIMessage {
573573
/**
574574
* Any attached files
575575
*
576-
* See https://discord.com/developers/docs/resources/channel#attachment-object
576+
* See https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure
577577
*
578578
* The `MESSAGE_CONTENT` privileged gateway intent is required for verified applications to receive a non-empty value from this field
579579
*
@@ -1415,7 +1415,7 @@ export interface APIEmbedField {
14151415
}
14161416

14171417
/**
1418-
* https://discord.com/developers/docs/resources/channel#attachment-object-attachment-structure
1418+
* https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure
14191419
*/
14201420
export interface APIAttachment {
14211421
/**

payloads/v9/channel.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ export interface APIMessage {
567567
/**
568568
* Any attached files
569569
*
570-
* See https://discord.com/developers/docs/resources/channel#attachment-object
570+
* See https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure
571571
*
572572
* The `MESSAGE_CONTENT` privileged gateway intent will become required after **August 31, 2022** for verified applications to receive a non-empty value from this field
573573
*
@@ -1382,7 +1382,7 @@ export interface APIEmbedField {
13821382
}
13831383

13841384
/**
1385-
* https://discord.com/developers/docs/resources/channel#attachment-object-attachment-structure
1385+
* https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure
13861386
*/
13871387
export interface APIAttachment {
13881388
/**

rest/v10/channel.ts

+7-12
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import type {
2424
SortOrderType,
2525
ForumLayoutType,
2626
ChannelFlags,
27+
APIAttachment,
2728
} from '../../payloads/v10/index';
2829
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals';
2930
import type { RESTAPIPoll } from './poll';
@@ -260,22 +261,16 @@ export type RESTAPIMessageReference = AddUndefinedToPossiblyUndefinedPropertiesO
260261
export type APIMessageReferenceSend = RESTAPIMessageReference;
261262

262263
/**
263-
* https://discord.com/developers/docs/resources/channel#attachment-object
264+
* https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure
264265
*/
265-
export interface RESTAPIAttachment {
266+
export type RESTAPIAttachment = Partial<
267+
Pick<APIAttachment, 'description' | 'duration_secs' | 'filename' | 'title' | 'waveform'>
268+
> & {
266269
/**
267270
* Attachment id or a number that matches `n` in `files[n]`
268271
*/
269272
id: Snowflake | number;
270-
/**
271-
* Name of the file
272-
*/
273-
filename?: string | undefined;
274-
/**
275-
* Description of the file
276-
*/
277-
description?: string | undefined;
278-
}
273+
};
279274

280275
/**
281276
* https://discord.com/developers/docs/resources/channel#create-message
@@ -461,7 +456,7 @@ export interface RESTPatchAPIChannelMessageJSONBody {
461456
*
462457
* Starting with API v10, the `attachments` array must contain all attachments that should be present after edit, including **retained and new** attachments provided in the request body.
463458
*
464-
* See https://discord.com/developers/docs/resources/channel#attachment-object
459+
* See https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure
465460
*/
466461
attachments?: RESTAPIAttachment[] | undefined;
467462
/**

rest/v10/webhook.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ export type RESTPatchAPIWebhookWithTokenMessageJSONBody = AddUndefinedToPossibly
264264
*
265265
* Starting with API v10, the `attachments` array must contain all attachments that should be present after edit, including **retained and new** attachments provided in the request body.
266266
*
267-
* See https://discord.com/developers/docs/resources/channel#attachment-object
267+
* See https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure
268268
*/
269269
attachments?: RESTAPIAttachment[] | undefined;
270270
};

rest/v9/channel.ts

+7-12
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import type {
2424
SortOrderType,
2525
ForumLayoutType,
2626
ChannelFlags,
27+
APIAttachment,
2728
} from '../../payloads/v9/index';
2829
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, StrictPartial } from '../../utils/internals';
2930
import type { RESTAPIPoll } from './poll';
@@ -260,22 +261,16 @@ export type RESTAPIMessageReference = AddUndefinedToPossiblyUndefinedPropertiesO
260261
export type APIMessageReferenceSend = RESTAPIMessageReference;
261262

262263
/**
263-
* https://discord.com/developers/docs/resources/channel#attachment-object
264+
* https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure
264265
*/
265-
export interface RESTAPIAttachment {
266+
export type RESTAPIAttachment = Partial<
267+
Pick<APIAttachment, 'description' | 'duration_secs' | 'filename' | 'title' | 'waveform'>
268+
> & {
266269
/**
267270
* Attachment id or a number that matches `n` in `files[n]`
268271
*/
269272
id: Snowflake | number;
270-
/**
271-
* Name of the file
272-
*/
273-
filename?: string | undefined;
274-
/**
275-
* Description of the file
276-
*/
277-
description?: string | undefined;
278-
}
273+
};
279274

280275
/**
281276
* https://discord.com/developers/docs/resources/channel#create-message
@@ -477,7 +472,7 @@ export interface RESTPatchAPIChannelMessageJSONBody {
477472
*
478473
* Starting with API v10, the `attachments` array must contain all attachments that should be present after edit, including **retained and new** attachments provided in the request body.
479474
*
480-
* See https://discord.com/developers/docs/resources/channel#attachment-object
475+
* See https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure
481476
*/
482477
attachments?: RESTAPIAttachment[] | undefined;
483478
/**

rest/v9/webhook.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ export type RESTPatchAPIWebhookWithTokenMessageJSONBody = AddUndefinedToPossibly
264264
*
265265
* Starting with API v10, the `attachments` array must contain all attachments that should be present after edit, including **retained and new** attachments provided in the request body.
266266
*
267-
* See https://discord.com/developers/docs/resources/channel#attachment-object
267+
* See https://discord.com/developers/docs/resources/message#attachment-object-attachment-structure
268268
*/
269269
attachments?: RESTAPIAttachment[] | undefined;
270270
};

0 commit comments

Comments
 (0)