feat: support new pinned messages routes (#1254)

This commit is contained in:
Jiralite
2025-06-27 11:01:20 +01:00
committed by GitHub
parent 7fbb3e3310
commit 71c6d2609f
12 changed files with 324 additions and 10 deletions

View File

@@ -2454,3 +2454,17 @@ export type APIMessageSnapshotFields = Pick<
| 'timestamp'
| 'type'
>;
/**
* @see {@link https://discord.com/developers/docs/resources/message#message-pin-object}
*/
export interface APIMessagePin {
/**
* The time the message was pinned
*/
pinned_at: string;
/**
* The pinned message
*/
message: APIMessage;
}

View File

@@ -2451,3 +2451,17 @@ export type APIMessageSnapshotFields = Pick<
| 'timestamp'
| 'type'
>;
/**
* @see {@link https://discord.com/developers/docs/resources/message#message-pin-object}
*/
export interface APIMessagePin {
/**
* The time the message was pinned
*/
pinned_at: string;
/**
* The pinned message
*/
message: APIMessage;
}

View File

@@ -24,6 +24,7 @@ import type {
ChannelFlags,
APIAttachment,
APIMessageTopLevelComponent,
APIMessagePin,
} from '../../payloads/v10/mod.ts';
import type { _AddUndefinedToPossiblyUndefinedPropertiesOfInterface, _StrictPartial } from '../../utils/internals.ts';
import type { RESTAPIPoll } from './poll.ts';
@@ -617,17 +618,60 @@ export type RESTPostAPIChannelFollowersResult = APIFollowedChannel;
export type RESTPostAPIChannelTypingResult = never;
/**
* @see {@link https://discord.com/developers/docs/resources/channel#get-pinned-messages}
* @see {@link https://discord.com/developers/docs/resources/message#get-channel-pins}
*/
export interface RESTGetAPIChannelMessagesPinsQuery {
/**
* Get messages pinned before this timestamp
*/
before?: string;
/**
* Maximum number of pins to return (1-50).
*
* @defaultValue `50`
*/
limit?: number;
}
/**
* @see {@link https://discord.com/developers/docs/resources/message#get-channel-pins}
*/
export interface RESTGetAPIChannelMessagesPinsResult {
/**
* Array of pinned messages
*/
items: APIMessagePin[];
/**
* Whether there are more items available
*/
has_more: boolean;
}
/**
* @see {@link https://discord.com/developers/docs/resources/message#pin-message}
*/
export type RESTPutAPIChannelMessagesPinResult = never;
/**
* @see {@link https://discord.com/developers/docs/resources/message#unpin-message}
*/
export type RESTDeleteAPIChannelMessagesPinResult = never;
/**
* @see {@link https://discord.com/developers/docs/resources/message#get-pinned-messages-deprecated}
* @deprecated
*/
export type RESTGetAPIChannelPinsResult = APIMessage[];
/**
* @see {@link https://discord.com/developers/docs/resources/channel#pin-message}
* @see {@link https://discord.com/developers/docs/resources/message#pin-message-deprecated}
* @deprecated
*/
export type RESTPutAPIChannelPinResult = never;
/**
* @see {@link https://discord.com/developers/docs/resources/channel#unpin-message}
* @see {@link https://discord.com/developers/docs/resources/message#unpin-message-deprecated}
* @deprecated
*/
export type RESTDeleteAPIChannelPinResult = never;

21
deno/rest/v10/mod.ts generated
View File

@@ -181,9 +181,28 @@ export const Routes = {
return `/channels/${channelId}/typing` as const;
},
/**
* Route for:
* - GET `/channels/{channel.id}/messages/pins`
*/
channelMessagesPins(channelId: Snowflake) {
return `/channels/${channelId}/messages/pins` as const;
},
/**
* Route for:
* - PUT `/channels/{channel.id}/messages/pins/{message.id}`
* - DELETE `/channels/{channel.id}/messages/pins/{message.id}`
*/
channelMessagesPin(channelId: Snowflake, messageId: Snowflake) {
return `/channels/${channelId}/messages/pins/${messageId}` as const;
},
/**
* Route for:
* - GET `/channels/{channel.id}/pins`
*
* @deprecated Use {@link Routes.channelMessagesPins} instead.
*/
channelPins(channelId: Snowflake) {
return `/channels/${channelId}/pins` as const;
@@ -193,6 +212,8 @@ export const Routes = {
* Route for:
* - PUT `/channels/{channel.id}/pins/{message.id}`
* - DELETE `/channels/{channel.id}/pins/{message.id}`
*
* @deprecated Use {@link Routes.channelMessagesPin} instead.
*/
channelPin(channelId: Snowflake, messageId: Snowflake) {
return `/channels/${channelId}/pins/${messageId}` as const;

View File

@@ -24,6 +24,7 @@ import type {
ChannelFlags,
APIAttachment,
APIMessageTopLevelComponent,
APIMessagePin,
} from '../../payloads/v9/mod.ts';
import type { _AddUndefinedToPossiblyUndefinedPropertiesOfInterface, _StrictPartial } from '../../utils/internals.ts';
import type { RESTAPIPoll } from './poll.ts';
@@ -631,12 +632,54 @@ export type RESTPostAPIChannelFollowersResult = APIFollowedChannel;
export type RESTPostAPIChannelTypingResult = never;
/**
* @see {@link https://discord.com/developers/docs/resources/channel#get-pinned-messages}
* @see {@link https://discord.com/developers/docs/resources/message#get-channel-pins}
*/
export interface RESTGetAPIChannelMessagesPinsQuery {
/**
* Get messages pinned before this timestamp
*/
before?: string;
/**
* Maximum number of pins to return (1-50).
*
* @defaultValue `50`
*/
limit?: number;
}
/**
* @see {@link https://discord.com/developers/docs/resources/message#get-channel-pins}
*/
export interface RESTGetAPIChannelMessagesPinsResult {
/**
* Array of pinned messages
*/
items: APIMessagePin[];
/**
* Whether there are more items available
*/
has_more: boolean;
}
/**
* @see {@link https://discord.com/developers/docs/resources/message#pin-message}
*/
export type RESTPutAPIChannelMessagesPinResult = never;
/**
* @see {@link https://discord.com/developers/docs/resources/message#unpin-message}
*/
export type RESTDeleteAPIChannelMessagesPinResult = never;
/**
* @see {@link https://discord.com/developers/docs/resources/message#get-pinned-messages-deprecated}
* @deprecated
*/
export type RESTGetAPIChannelPinsResult = APIMessage[];
/**
* @see {@link https://discord.com/developers/docs/resources/channel#pin-message}
* @see {@link https://discord.com/developers/docs/resources/message#pin-message-deprecated}
* @deprecated
*/
export type RESTPutAPIChannelPinResult = never;

21
deno/rest/v9/mod.ts generated
View File

@@ -181,9 +181,28 @@ export const Routes = {
return `/channels/${channelId}/typing` as const;
},
/**
* Route for:
* - GET `/channels/{channel.id}/messages/pins`
*/
channelMessagesPins(channelId: Snowflake) {
return `/channels/${channelId}/messages/pins` as const;
},
/**
* Route for:
* - PUT `/channels/{channel.id}/messages/pins/{message.id}`
* - DELETE `/channels/{channel.id}/messages/pins/{message.id}`
*/
channelMessagesPin(channelId: Snowflake, messageId: Snowflake) {
return `/channels/${channelId}/messages/pins/${messageId}` as const;
},
/**
* Route for:
* - GET `/channels/{channel.id}/pins`
*
* @deprecated Use {@link Routes.channelMessagesPins} instead.
*/
channelPins(channelId: Snowflake) {
return `/channels/${channelId}/pins` as const;
@@ -193,6 +212,8 @@ export const Routes = {
* Route for:
* - PUT `/channels/{channel.id}/pins/{message.id}`
* - DELETE `/channels/{channel.id}/pins/{message.id}`
*
* @deprecated Use {@link Routes.channelMessagesPin} instead.
*/
channelPin(channelId: Snowflake, messageId: Snowflake) {
return `/channels/${channelId}/pins/${messageId}` as const;

View File

@@ -2454,3 +2454,17 @@ export type APIMessageSnapshotFields = Pick<
| 'timestamp'
| 'type'
>;
/**
* @see {@link https://discord.com/developers/docs/resources/message#message-pin-object}
*/
export interface APIMessagePin {
/**
* The time the message was pinned
*/
pinned_at: string;
/**
* The pinned message
*/
message: APIMessage;
}

View File

@@ -2451,3 +2451,17 @@ export type APIMessageSnapshotFields = Pick<
| 'timestamp'
| 'type'
>;
/**
* @see {@link https://discord.com/developers/docs/resources/message#message-pin-object}
*/
export interface APIMessagePin {
/**
* The time the message was pinned
*/
pinned_at: string;
/**
* The pinned message
*/
message: APIMessage;
}

View File

@@ -24,6 +24,7 @@ import type {
ChannelFlags,
APIAttachment,
APIMessageTopLevelComponent,
APIMessagePin,
} from '../../payloads/v10/index';
import type { _AddUndefinedToPossiblyUndefinedPropertiesOfInterface, _StrictPartial } from '../../utils/internals';
import type { RESTAPIPoll } from './poll';
@@ -617,17 +618,60 @@ export type RESTPostAPIChannelFollowersResult = APIFollowedChannel;
export type RESTPostAPIChannelTypingResult = never;
/**
* @see {@link https://discord.com/developers/docs/resources/channel#get-pinned-messages}
* @see {@link https://discord.com/developers/docs/resources/message#get-channel-pins}
*/
export interface RESTGetAPIChannelMessagesPinsQuery {
/**
* Get messages pinned before this timestamp
*/
before?: string;
/**
* Maximum number of pins to return (1-50).
*
* @defaultValue `50`
*/
limit?: number;
}
/**
* @see {@link https://discord.com/developers/docs/resources/message#get-channel-pins}
*/
export interface RESTGetAPIChannelMessagesPinsResult {
/**
* Array of pinned messages
*/
items: APIMessagePin[];
/**
* Whether there are more items available
*/
has_more: boolean;
}
/**
* @see {@link https://discord.com/developers/docs/resources/message#pin-message}
*/
export type RESTPutAPIChannelMessagesPinResult = never;
/**
* @see {@link https://discord.com/developers/docs/resources/message#unpin-message}
*/
export type RESTDeleteAPIChannelMessagesPinResult = never;
/**
* @see {@link https://discord.com/developers/docs/resources/message#get-pinned-messages-deprecated}
* @deprecated
*/
export type RESTGetAPIChannelPinsResult = APIMessage[];
/**
* @see {@link https://discord.com/developers/docs/resources/channel#pin-message}
* @see {@link https://discord.com/developers/docs/resources/message#pin-message-deprecated}
* @deprecated
*/
export type RESTPutAPIChannelPinResult = never;
/**
* @see {@link https://discord.com/developers/docs/resources/channel#unpin-message}
* @see {@link https://discord.com/developers/docs/resources/message#unpin-message-deprecated}
* @deprecated
*/
export type RESTDeleteAPIChannelPinResult = never;

View File

@@ -181,9 +181,28 @@ export const Routes = {
return `/channels/${channelId}/typing` as const;
},
/**
* Route for:
* - GET `/channels/{channel.id}/messages/pins`
*/
channelMessagesPins(channelId: Snowflake) {
return `/channels/${channelId}/messages/pins` as const;
},
/**
* Route for:
* - PUT `/channels/{channel.id}/messages/pins/{message.id}`
* - DELETE `/channels/{channel.id}/messages/pins/{message.id}`
*/
channelMessagesPin(channelId: Snowflake, messageId: Snowflake) {
return `/channels/${channelId}/messages/pins/${messageId}` as const;
},
/**
* Route for:
* - GET `/channels/{channel.id}/pins`
*
* @deprecated Use {@link Routes.channelMessagesPins} instead.
*/
channelPins(channelId: Snowflake) {
return `/channels/${channelId}/pins` as const;
@@ -193,6 +212,8 @@ export const Routes = {
* Route for:
* - PUT `/channels/{channel.id}/pins/{message.id}`
* - DELETE `/channels/{channel.id}/pins/{message.id}`
*
* @deprecated Use {@link Routes.channelMessagesPin} instead.
*/
channelPin(channelId: Snowflake, messageId: Snowflake) {
return `/channels/${channelId}/pins/${messageId}` as const;

View File

@@ -24,6 +24,7 @@ import type {
ChannelFlags,
APIAttachment,
APIMessageTopLevelComponent,
APIMessagePin,
} from '../../payloads/v9/index';
import type { _AddUndefinedToPossiblyUndefinedPropertiesOfInterface, _StrictPartial } from '../../utils/internals';
import type { RESTAPIPoll } from './poll';
@@ -631,12 +632,54 @@ export type RESTPostAPIChannelFollowersResult = APIFollowedChannel;
export type RESTPostAPIChannelTypingResult = never;
/**
* @see {@link https://discord.com/developers/docs/resources/channel#get-pinned-messages}
* @see {@link https://discord.com/developers/docs/resources/message#get-channel-pins}
*/
export interface RESTGetAPIChannelMessagesPinsQuery {
/**
* Get messages pinned before this timestamp
*/
before?: string;
/**
* Maximum number of pins to return (1-50).
*
* @defaultValue `50`
*/
limit?: number;
}
/**
* @see {@link https://discord.com/developers/docs/resources/message#get-channel-pins}
*/
export interface RESTGetAPIChannelMessagesPinsResult {
/**
* Array of pinned messages
*/
items: APIMessagePin[];
/**
* Whether there are more items available
*/
has_more: boolean;
}
/**
* @see {@link https://discord.com/developers/docs/resources/message#pin-message}
*/
export type RESTPutAPIChannelMessagesPinResult = never;
/**
* @see {@link https://discord.com/developers/docs/resources/message#unpin-message}
*/
export type RESTDeleteAPIChannelMessagesPinResult = never;
/**
* @see {@link https://discord.com/developers/docs/resources/message#get-pinned-messages-deprecated}
* @deprecated
*/
export type RESTGetAPIChannelPinsResult = APIMessage[];
/**
* @see {@link https://discord.com/developers/docs/resources/channel#pin-message}
* @see {@link https://discord.com/developers/docs/resources/message#pin-message-deprecated}
* @deprecated
*/
export type RESTPutAPIChannelPinResult = never;

View File

@@ -181,9 +181,28 @@ export const Routes = {
return `/channels/${channelId}/typing` as const;
},
/**
* Route for:
* - GET `/channels/{channel.id}/messages/pins`
*/
channelMessagesPins(channelId: Snowflake) {
return `/channels/${channelId}/messages/pins` as const;
},
/**
* Route for:
* - PUT `/channels/{channel.id}/messages/pins/{message.id}`
* - DELETE `/channels/{channel.id}/messages/pins/{message.id}`
*/
channelMessagesPin(channelId: Snowflake, messageId: Snowflake) {
return `/channels/${channelId}/messages/pins/${messageId}` as const;
},
/**
* Route for:
* - GET `/channels/{channel.id}/pins`
*
* @deprecated Use {@link Routes.channelMessagesPins} instead.
*/
channelPins(channelId: Snowflake) {
return `/channels/${channelId}/pins` as const;
@@ -193,6 +212,8 @@ export const Routes = {
* Route for:
* - PUT `/channels/{channel.id}/pins/{message.id}`
* - DELETE `/channels/{channel.id}/pins/{message.id}`
*
* @deprecated Use {@link Routes.channelMessagesPin} instead.
*/
channelPin(channelId: Snowflake, messageId: Snowflake) {
return `/channels/${channelId}/pins/${messageId}` as const;