feat(webhook): Support with_components (#10945)

feat: support `with_components`
This commit is contained in:
Jiralite
2025-06-22 10:42:01 +01:00
committed by GitHub
parent 127bb59638
commit cbb20566c5

View File

@@ -9,6 +9,7 @@ import {
type RESTPatchAPIWebhookJSONBody,
type RESTPatchAPIWebhookResult,
type RESTPatchAPIWebhookWithTokenMessageJSONBody,
type RESTPatchAPIWebhookWithTokenMessageQuery,
type RESTPatchAPIWebhookWithTokenMessageResult,
type RESTPostAPIWebhookWithTokenGitHubQuery,
type RESTPostAPIWebhookWithTokenJSONBody,
@@ -21,9 +22,9 @@ import {
export type CreateWebhookMessageOptions = RESTPostAPIWebhookWithTokenJSONBody &
RESTPostAPIWebhookWithTokenQuery & { files?: RawFile[] };
export type EditWebhookMessageOptions = RESTPatchAPIWebhookWithTokenMessageJSONBody & {
export type EditWebhookMessageOptions = RESTPatchAPIWebhookWithTokenMessageJSONBody &
RESTPatchAPIWebhookWithTokenMessageQuery & {
files?: RawFile[];
thread_id?: string;
};
export class WebhooksAPI {
@@ -132,11 +133,11 @@ export class WebhooksAPI {
public async execute(
id: Snowflake,
token: string,
{ wait, thread_id, files, ...body }: CreateWebhookMessageOptions,
{ wait, thread_id, with_components, files, ...body }: CreateWebhookMessageOptions,
{ signal }: Pick<RequestData, 'signal'> = {},
) {
return this.rest.post(Routes.webhook(id, token), {
query: makeURLSearchParams({ wait, thread_id }),
query: makeURLSearchParams({ wait, thread_id, with_components }),
files,
body,
auth: false,
@@ -232,11 +233,11 @@ export class WebhooksAPI {
id: Snowflake,
token: string,
messageId: Snowflake,
{ thread_id, files, ...body }: EditWebhookMessageOptions,
{ thread_id, with_components, files, ...body }: EditWebhookMessageOptions,
{ signal }: Pick<RequestData, 'signal'> = {},
) {
return this.rest.patch(Routes.webhookMessage(id, token, messageId), {
query: makeURLSearchParams({ thread_id }),
query: makeURLSearchParams({ thread_id, with_components }),
auth: false,
body,
signal,