mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-04 01:40:08 +00:00
chore: lil organizing of rest types
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
export * from './typings/routes.js'
|
||||
|
||||
export * from './invalidBucket.js'
|
||||
export * from './manager.js'
|
||||
export * from './queue.js'
|
||||
export * from './types.js'
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
import { delay, logger } from '@discordeno/utils'
|
||||
import type { RestManager, SendRequestOptions } from './manager.js'
|
||||
import type { RestManager, SendRequestOptions } from './types.js'
|
||||
|
||||
export class Queue {
|
||||
/** The rest manager */
|
||||
|
||||
2439
packages/rest/src/types.ts
Normal file
2439
packages/rest/src/types.ts
Normal file
File diff suppressed because it is too large
Load Diff
243
packages/rest/src/typings/routes.ts
Normal file
243
packages/rest/src/typings/routes.ts
Normal file
@@ -0,0 +1,243 @@
|
||||
import type {
|
||||
BigString,
|
||||
GetBans,
|
||||
GetGuildAuditLog,
|
||||
GetGuildPruneCountQuery,
|
||||
GetInvite,
|
||||
GetMessagesOptions,
|
||||
GetReactions,
|
||||
GetScheduledEventUsers,
|
||||
ListArchivedThreads,
|
||||
ListGuildMembers,
|
||||
} from '@discordeno/types'
|
||||
|
||||
export interface RestRoutes {
|
||||
/** Route to get a bots session info. */
|
||||
sessionInfo: () => string
|
||||
/** A specific user route. */
|
||||
user: (id: BigString) => string
|
||||
/** Current bot user route. */
|
||||
userBot: () => string
|
||||
// OAuth2
|
||||
oauth2Application: () => string
|
||||
// Gateway Bot
|
||||
gatewayBot: () => string
|
||||
// Nitro Sticker Packs
|
||||
nitroStickerPacks: () => string
|
||||
/** Routes for webhook related routes. */
|
||||
webhooks: {
|
||||
/** Route for managing the original message sent by a webhook. */
|
||||
original: (webhookId: BigString, token: string, options?: { threadId?: BigString }) => string
|
||||
/** Route for webhook with a id. */
|
||||
id: (webhookId: BigString) => string
|
||||
/** Route for handling a webhook with a token. */
|
||||
webhook: (webhookId: BigString, token: string, options?: { wait?: boolean; threadId?: BigString }) => string
|
||||
/** Route for handling a message that was sent through a webhook. */
|
||||
message: (webhookId: BigString, token: string, messageId: BigString, options?: { threadId?: BigString }) => string
|
||||
}
|
||||
/** Routes for channel related endpoints. */
|
||||
channels: {
|
||||
/** Route for handling bulk messages in a channel. */
|
||||
bulk: (channelId: BigString) => string
|
||||
/** Route for non-specific dm channel. */
|
||||
dm: () => string
|
||||
/** Route for handling a specific pin. */
|
||||
pin: (channelId: BigString, messageId: BigString) => string
|
||||
/** Route for handling a channels pins. */
|
||||
pins: (channelId: BigString) => string
|
||||
/** Route for non-specific webhook in a channel. */
|
||||
webhooks: (channelId: BigString) => string
|
||||
/** Route for a specific channel. */
|
||||
channel: (channelId: BigString) => string
|
||||
/** Route for following a specific channel. */
|
||||
follow: (channelId: BigString) => string
|
||||
/** Route for managing a forum with a message. */
|
||||
forum: (channelId: BigString) => string
|
||||
/** Route for a specific channel's invites. */
|
||||
invites: (channelId: BigString) => string
|
||||
/** Route for a specific message */
|
||||
message: (channelId: BigString, id: BigString) => string
|
||||
/** Route for handling non-specific messages. */
|
||||
messages: (channelId: BigString, options?: GetMessagesOptions) => string
|
||||
/** Route for handling a specific overwrite. */
|
||||
overwrite: (channelId: BigString, overwriteId: BigString) => string
|
||||
/** Route for handling crossposting a specific message. */
|
||||
crosspost: (channelId: BigString, messageId: BigString) => string
|
||||
/** Route for handling non-specific stages */
|
||||
stages: () => string
|
||||
/** Route for handling a specific stage */
|
||||
stage: (channelId: BigString) => string
|
||||
/** Routes for handling thread related to a channel. */
|
||||
threads: {
|
||||
/** Route for thread a specific message. */
|
||||
message: (channelId: BigString, messageId: BigString) => string
|
||||
/** Route for thread without a message. */
|
||||
all: (channelId: BigString) => string
|
||||
/** Route for active threads. */
|
||||
active: (guildId: BigString) => string
|
||||
/** Route for members in a thread. */
|
||||
members: (channelId: BigString) => string
|
||||
/** Route for the bot member in a thread. */
|
||||
me: (channelId: BigString) => string
|
||||
/** Route for a specific member in a thread. */
|
||||
user: (channelId: BigString, userId: BigString) => string
|
||||
/** Route for handling archived threads. */
|
||||
archived: (channelId: BigString) => string
|
||||
/** Route for handling publically archived threads. */
|
||||
public: (channelId: BigString, options?: ListArchivedThreads) => string
|
||||
/** Route for handling private archived threads. */
|
||||
private: (channelId: BigString, options?: ListArchivedThreads) => string
|
||||
/** Route for handling private archived threads that the bot has joined. */
|
||||
joined: (channelId: BigString, options?: ListArchivedThreads) => string
|
||||
}
|
||||
/** Route for handling typing indicators in a c«hannel. */
|
||||
typing: (channelId: BigString) => string
|
||||
/** Routes for handling reactions on a message. */
|
||||
reactions: {
|
||||
/** Route for handling a bots reaction. */
|
||||
bot: (channelId: BigString, messageId: BigString, emoji: string) => string
|
||||
/** Route for handling a user's reactions. */
|
||||
user: (channelId: BigString, messageId: BigString, emoji: string, userId: BigString) => string
|
||||
/** Route for handling all the reactions on a message. */
|
||||
all: (channelId: BigString, messageId: BigString) => string
|
||||
/** Route for handling all reactions for a single emoji on a message. */
|
||||
emoji: (channelId: BigString, messageId: BigString, emoji: string, options?: GetReactions) => string
|
||||
/** Route for handling a specific reaction on a message. */
|
||||
message: (channelId: BigString, messageId: BigString, emoji: string, options?: GetReactions) => string
|
||||
}
|
||||
}
|
||||
/** Routes for guild related endpoints. */
|
||||
guilds: {
|
||||
/** Routes for handling a non-specific guild. */
|
||||
all: () => string
|
||||
/** Route for handling audit logs in a guild. */
|
||||
auditlogs: (guildId: BigString, options?: GetGuildAuditLog) => string
|
||||
/** Routes for a guilds automoderation. */
|
||||
automod: {
|
||||
/** Route for handling a guild's automoderation. */
|
||||
rules: (guildId: BigString) => string
|
||||
/** Route for handling a specific automoderation rule guild's */
|
||||
rule: (guildId: BigString, ruleId: BigString) => string
|
||||
}
|
||||
/** Routes for handling a guild's scheduled events. */
|
||||
events: {
|
||||
/** Route for handling non-specific scheduled event. */
|
||||
events: (guildId: BigString, withUserCount?: boolean) => string
|
||||
/** Route for handling a specific scheduled event. */
|
||||
event: (guildId: BigString, eventId: BigString, withUserCount?: boolean) => string
|
||||
/** Route for handling a scheduled event users. */
|
||||
users: (guildId: BigString, eventId: BigString, options?: GetScheduledEventUsers) => string
|
||||
}
|
||||
/** Route for handling non-specific channels in a guild */
|
||||
channels: (guildId: BigString) => string
|
||||
/** Route for handling a specific emoji. */
|
||||
emoji: (guildId: BigString, id: BigString) => string
|
||||
/** Route for handling non-specific emojis. */
|
||||
emojis: (guildId: BigString) => string
|
||||
/** Route for handling a specific guild. */
|
||||
guild: (guildId: BigString, withCounts?: boolean) => string
|
||||
/** Route for handling a specific integration. */
|
||||
integration: (guildId: BigString, integrationId: BigString) => string
|
||||
/** Route for handling non-specific integrations. */
|
||||
integrations: (guildId: BigString) => string
|
||||
/** Route for handling a specific guild invite. */
|
||||
invite: (inviteCode: string, options?: GetInvite) => string
|
||||
/** Route for handling non-specific invites in a guild. */
|
||||
invites: (guildId: BigString) => string
|
||||
/** Route for handling a bot leaving a guild. */
|
||||
leave: (guildId: BigString) => string
|
||||
/** Route for handling a guild's preview. */
|
||||
preview: (guildId: BigString) => string
|
||||
/** Route for handling pruning of a guild. */
|
||||
prune: (guildId: BigString, options?: GetGuildPruneCountQuery) => string
|
||||
/** Route for handling non-specific webhooks in a guild */
|
||||
webhooks: (guildId: BigString) => string
|
||||
/** Route for handling a guild's welcome screen. */
|
||||
welcome: (guildId: BigString) => string
|
||||
/** Route for handling a guild's widget. */
|
||||
widget: (guildId: BigString) => string
|
||||
/** Route for handling a guild's widget in the form of json. */
|
||||
widgetJson: (guildId: BigString) => string
|
||||
/** Route for handling a guilds mfa level. */
|
||||
mfa: (guildId: BigString) => string
|
||||
/** Routes for handling a guild's members. */
|
||||
members: {
|
||||
/** Route for handling a specific guild member's ban. */
|
||||
ban: (guildId: BigString, userId: BigString) => string
|
||||
/** Route for handling non-specific bans in a guild. */
|
||||
bans: (guildId: BigString, options?: GetBans) => string
|
||||
/** Route for handling a the bot guild member. */
|
||||
bot: (guildId: BigString) => string
|
||||
/** Route for handling a specific guild member. */
|
||||
member: (guildId: BigString, userId: BigString) => string
|
||||
/** Route for handling non-specific guild members. */
|
||||
members: (guildId: BigString, options?: ListGuildMembers) => string
|
||||
/** Route for handling member searching in a guild. */
|
||||
search: (guildId: BigString, query: string, options?: { limit?: number }) => string
|
||||
/** Route for handling pruning guild members. */
|
||||
prune: (guildId: BigString, options?: GetGuildPruneCountQuery) => string
|
||||
}
|
||||
/** Routes for handling a guild's templates. */
|
||||
templates: {
|
||||
/** Route for handling a specifc guild's templates with a code only. */
|
||||
code: (code: string) => string
|
||||
/** Route for handling a specific guild's template with a guild id and code. */
|
||||
guild: (guildId: BigString, code: string) => string
|
||||
/** Route for handling non-specific guild's templates. */
|
||||
all: (guildId: BigString) => string
|
||||
}
|
||||
/** Route for handling a guild's vanity url. */
|
||||
vanity: (guildId: BigString) => string
|
||||
/** Route for handling a guild's regions. */
|
||||
regions: (guildId: BigString) => string
|
||||
/** Routes for handling a guild's roles. */
|
||||
roles: {
|
||||
/** Route for handling a specific guild role. */
|
||||
one: (guildId: BigString, roleId: BigString) => string
|
||||
/** Route for handling a guild's roles. */
|
||||
all: (guildId: BigString) => string
|
||||
/** Route for handling a members roles in a guild. */
|
||||
member: (guildId: BigString, memberId: BigString, roleId: BigString) => string
|
||||
}
|
||||
/** Route for handling a specific guild sticker. */
|
||||
stickers: (guildId: BigString) => string
|
||||
/** Route for handling non-specific guild stickers. */
|
||||
sticker: (guildId: BigString, stickerId: BigString) => string
|
||||
/** Route for handling a voice state. */
|
||||
voice: (guildId: BigString, userId?: BigString) => string
|
||||
}
|
||||
/** Routes for interaction related endpoints. */
|
||||
interactions: {
|
||||
/** Routes for interaction command related endpoints. */
|
||||
commands: {
|
||||
/** Route for non-specific commands. */
|
||||
commands: (applicationId: BigString) => string
|
||||
/** Route for guild related commands. */
|
||||
guilds: {
|
||||
/** Route for non-specific guild commands. */
|
||||
all: (applicationId: BigString, guildId: BigString) => string
|
||||
/** Route for a specific guild command. */
|
||||
one: (applicationId: BigString, guildId: BigString, commandId: BigString, withLocalizations?: boolean) => string
|
||||
}
|
||||
/** Route for non-specific command permissions. */
|
||||
permissions: (applicationId: BigString, guildId: BigString) => string
|
||||
/** Route for a specific command's permission. */
|
||||
permission: (applicationId: BigString, guildId: BigString, commandId: BigString) => string
|
||||
/** Route for a specific command. */
|
||||
command: (applicationId: BigString, commandId: BigString, withLocalizations?: boolean) => string
|
||||
}
|
||||
/** Routes for interaction response related endpoints. */
|
||||
responses: {
|
||||
/** Route for handling a callback response with id and token. */
|
||||
callback: (interactionId: BigString, token: string) => string
|
||||
/** Route for handling the original response using id and token. */
|
||||
original: (interactionId: BigString, token: string) => string
|
||||
/** Route for handling a followup message from a interaction response. */
|
||||
message: (applicationId: BigString, token: string, messageId: BigString) => string
|
||||
}
|
||||
}
|
||||
/** Route for handling a sticker. */
|
||||
sticker: (stickerId: BigString) => string
|
||||
/** Route for handling all voice regions. */
|
||||
regions: () => string
|
||||
}
|
||||
@@ -1101,3 +1101,54 @@ export interface GetGuildWidgetImageQuery {
|
||||
*/
|
||||
style?: 'shield' | 'banner1' | 'banner2' | 'banner3' | 'banner4'
|
||||
}
|
||||
|
||||
export interface CreateTemplate {
|
||||
/** Name which the template should have */
|
||||
name: string
|
||||
/** Description of the template */
|
||||
description?: string
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/template#modify-guild-template */
|
||||
export interface ModifyGuildTemplate {
|
||||
/** Name of the template (1-100 characters) */
|
||||
name?: string
|
||||
/** Description of the template (0-120 characters) */
|
||||
description?: string | null
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/guild#create-guild-ban */
|
||||
export interface CreateGuildBan extends WithReason {
|
||||
/** Number of seconds to delete messages for, between 0 and 604800 (7 days) */
|
||||
deleteMessageSeconds?: number
|
||||
}
|
||||
|
||||
export interface EditBotMemberOptions extends WithReason {
|
||||
nick?: string | null
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/guild#modify-guild-member */
|
||||
export interface ModifyGuildMember {
|
||||
/** Value to set users nickname to. Requires the `MANAGE_NICKNAMES` permission */
|
||||
nick?: string | null
|
||||
/** Array of role ids the member is assigned. Requires the `MANAGE_ROLES` permission */
|
||||
roles?: BigString[] | null
|
||||
/** Whether the user is muted in voice channels. Will throw a 400 if the user is not in a voice channel. Requires the `MUTE_MEMBERS` permission */
|
||||
mute?: boolean | null
|
||||
/** Whether the user is deafened in voice channels. Will throw a 400 if the user is not in a voice channel. Requires the `MOVE_MEMBERS` permission */
|
||||
deaf?: boolean | null
|
||||
/** Id of channel to move user to (if they are connected to voice). Requires the `MOVE_MEMBERS` permission */
|
||||
channelId?: BigString | null
|
||||
/** when the user's timeout will expire and the user will be able to communicate in the guild again (up to 28 days in the future), set to null to remove timeout. Requires the `MODERATE_MEMBERS` permission */
|
||||
communicationDisabledUntil?: number | null
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/guild#begin-guild-prune */
|
||||
export interface BeginGuildPrune {
|
||||
/** Number of days to prune (1 or more), default: 7 */
|
||||
days?: number
|
||||
/** Whether 'pruned' is returned, discouraged for large guilds, default: true */
|
||||
computePruneCount?: boolean
|
||||
/** Role(s) ro include, default: none */
|
||||
includeRoles?: string[]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user