#[non_exhaustive]pub enum Route<'a> {
Show 179 variants
AddApplicationEmoji {
application_id: u64,
},
AddGuildMember {
guild_id: u64,
user_id: u64,
},
AddMemberRole {
guild_id: u64,
role_id: u64,
user_id: u64,
},
AddThreadMember {
channel_id: u64,
user_id: u64,
},
CreateAutoModerationRule {
guild_id: u64,
},
CreateBan {
guild_id: u64,
user_id: u64,
},
CreateChannel {
guild_id: u64,
},
CreateEmoji {
guild_id: u64,
},
CreateForumThread {
channel_id: u64,
},
CreateGlobalCommand {
application_id: u64,
},
CreateGuild,
CreateGuildCommand {
application_id: u64,
guild_id: u64,
},
CreateGuildFromTemplate {
template_code: &'a str,
},
CreateGuildIntegration {
guild_id: u64,
},
CreateGuildPrune {
compute_prune_count: Option<bool>,
days: Option<u16>,
guild_id: u64,
include_roles: &'a [Id<RoleMarker>],
},
CreateGuildScheduledEvent {
guild_id: u64,
},
CreateGuildSticker {
guild_id: u64,
},
CreateInvite {
channel_id: u64,
},
CreateMessage {
channel_id: u64,
},
CreatePrivateChannel,
CreateReaction {
channel_id: u64,
emoji: &'a RequestReactionType<'a>,
message_id: u64,
},
CreateRole {
guild_id: u64,
},
CreateStageInstance,
CreateTemplate {
guild_id: u64,
},
CreateTestEntitlement {
application_id: u64,
},
CreateThread {
channel_id: u64,
},
CreateThreadFromMessage {
channel_id: u64,
message_id: u64,
},
CreateTypingTrigger {
channel_id: u64,
},
CreateWebhook {
channel_id: u64,
},
CrosspostMessage {
channel_id: u64,
message_id: u64,
},
DeleteApplicationEmoji {
application_id: u64,
emoji_id: u64,
},
DeleteAutoModerationRule {
guild_id: u64,
auto_moderation_rule_id: u64,
},
DeleteBan {
guild_id: u64,
user_id: u64,
},
DeleteChannel {
channel_id: u64,
},
DeleteEmoji {
emoji_id: u64,
guild_id: u64,
},
DeleteGlobalCommand {
application_id: u64,
command_id: u64,
},
DeleteGuild {
guild_id: u64,
},
DeleteGuildCommand {
application_id: u64,
command_id: u64,
guild_id: u64,
},
DeleteGuildIntegration {
guild_id: u64,
integration_id: u64,
},
DeleteGuildScheduledEvent {
guild_id: u64,
scheduled_event_id: u64,
},
DeleteGuildSticker {
guild_id: u64,
sticker_id: u64,
},
DeleteInteractionOriginal {
application_id: u64,
interaction_token: &'a str,
},
DeleteInvite {
code: &'a str,
},
DeleteMessage {
channel_id: u64,
message_id: u64,
},
DeleteMessageReactions {
channel_id: u64,
message_id: u64,
},
DeleteMessageSpecificReaction {
channel_id: u64,
emoji: &'a RequestReactionType<'a>,
message_id: u64,
},
DeleteMessages {
channel_id: u64,
},
DeletePermissionOverwrite {
channel_id: u64,
target_id: u64,
},
DeleteReaction {
channel_id: u64,
emoji: &'a RequestReactionType<'a>,
message_id: u64,
user_id: u64,
},
DeleteReactionCurrentUser {
channel_id: u64,
emoji: &'a RequestReactionType<'a>,
message_id: u64,
},
DeleteRole {
guild_id: u64,
role_id: u64,
},
DeleteStageInstance {
channel_id: u64,
},
DeleteTemplate {
guild_id: u64,
template_code: &'a str,
},
DeleteWebhook {
token: Option<&'a str>,
webhook_id: u64,
},
DeleteWebhookMessage {
message_id: u64,
thread_id: Option<u64>,
token: &'a str,
webhook_id: u64,
},
DeleteTestEntitlement {
application_id: u64,
entitlement_id: u64,
},
UpdateApplicationEmoji {
application_id: u64,
emoji_id: u64,
},
EndPoll {
channel_id: u64,
message_id: u64,
},
ExecuteWebhook {
thread_id: Option<u64>,
token: &'a str,
wait: Option<bool>,
webhook_id: u64,
},
FollowNewsChannel {
channel_id: u64,
},
GetActiveThreads {
guild_id: u64,
},
GetApplicationEmojis {
application_id: u64,
},
GetAnswerVoters {
after: Option<u64>,
answer_id: u8,
channel_id: u64,
limit: Option<u8>,
message_id: u64,
},
GetAuditLogs {
action_type: Option<u64>,
after: Option<u64>,
before: Option<u64>,
guild_id: u64,
limit: Option<u16>,
user_id: Option<u64>,
},
GetAutoModerationRule {
guild_id: u64,
auto_moderation_rule_id: u64,
},
GetBan {
guild_id: u64,
user_id: u64,
},
GetBans {
guild_id: u64,
},
GetBansWithParameters {
after: Option<u64>,
before: Option<u64>,
limit: Option<u16>,
guild_id: u64,
},
GetChannel {
channel_id: u64,
},
GetChannelInvites {
channel_id: u64,
},
GetChannelWebhooks {
channel_id: u64,
},
GetChannels {
guild_id: u64,
},
GetCommandPermissions {
application_id: u64,
command_id: u64,
guild_id: u64,
},
GetCurrentAuthorizationInformation,
GetCurrentUser,
GetCurrentUserApplicationInfo,
GetCurrentUserGuildMember {
guild_id: u64,
},
GetEmoji {
emoji_id: u64,
guild_id: u64,
},
GetEmojis {
guild_id: u64,
},
GetEntitlements {
after: Option<u64>,
application_id: u64,
before: Option<u64>,
exclude_ended: Option<bool>,
guild_id: Option<u64>,
limit: Option<u8>,
sku_ids: &'a [Id<SkuMarker>],
user_id: Option<u64>,
},
GetFollowupMessage {
application_id: u64,
interaction_token: &'a str,
thread_id: Option<u64>,
message_id: u64,
},
GetGateway,
GetGatewayBot,
GetGlobalCommand {
application_id: u64,
command_id: u64,
},
GetGlobalCommands {
application_id: u64,
with_localizations: Option<bool>,
},
GetGuild {
guild_id: u64,
with_counts: bool,
},
GetGuildAutoModerationRules {
guild_id: u64,
},
GetGuildCommand {
application_id: u64,
command_id: u64,
guild_id: u64,
},
GetGuildCommandPermissions {
application_id: u64,
guild_id: u64,
},
GetGuildCommands {
application_id: u64,
guild_id: u64,
with_localizations: Option<bool>,
},
GetGuildIntegrations {
guild_id: u64,
},
GetGuildInvites {
guild_id: u64,
},
GetGuildMembers {
after: Option<u64>,
guild_id: u64,
limit: Option<u16>,
},
GetGuildOnboarding {
guild_id: u64,
},
GetGuildPreview {
guild_id: u64,
},
GetGuildPruneCount {
days: Option<u16>,
guild_id: u64,
include_roles: &'a [Id<RoleMarker>],
},
GetGuildRoles {
guild_id: u64,
},
GetGuildScheduledEvent {
guild_id: u64,
scheduled_event_id: u64,
with_user_count: bool,
},
GetGuildScheduledEventUsers {
after: Option<u64>,
before: Option<u64>,
guild_id: u64,
limit: Option<u16>,
scheduled_event_id: u64,
with_member: bool,
},
GetGuildScheduledEvents {
guild_id: u64,
with_user_count: bool,
},
GetGuildSticker {
guild_id: u64,
sticker_id: u64,
},
GetGuildStickers {
guild_id: u64,
},
GetGuildVanityUrl {
guild_id: u64,
},
GetGuildVoiceRegions {
guild_id: u64,
},
GetGuildWebhooks {
guild_id: u64,
},
GetGuildWelcomeScreen {
guild_id: u64,
},
GetGuildWidget {
guild_id: u64,
},
GetGuildWidgetSettings {
guild_id: u64,
},
GetGuilds {
after: Option<u64>,
before: Option<u64>,
limit: Option<u16>,
},
GetInteractionOriginal {
application_id: u64,
interaction_token: &'a str,
},
GetInvite {
code: &'a str,
with_counts: bool,
},
GetInviteWithExpiration {
code: &'a str,
with_counts: bool,
with_expiration: bool,
},
GetJoinedPrivateArchivedThreads {
before: Option<u64>,
channel_id: u64,
limit: Option<u64>,
},
GetMember {
guild_id: u64,
user_id: u64,
},
GetMessage {
channel_id: u64,
message_id: u64,
},
GetMessages {
after: Option<u64>,
around: Option<u64>,
before: Option<u64>,
channel_id: u64,
limit: Option<u16>,
},
GetNitroStickerPacks,
GetPins {
channel_id: u64,
},
GetPrivateArchivedThreads {
before: Option<&'a str>,
channel_id: u64,
limit: Option<u64>,
},
GetPublicArchivedThreads {
before: Option<&'a str>,
channel_id: u64,
limit: Option<u64>,
},
GetReactionUsers {
after: Option<u64>,
channel_id: u64,
emoji: &'a RequestReactionType<'a>,
limit: Option<u16>,
message_id: u64,
kind: Option<u8>,
},
GetSKUs {
application_id: u64,
},
GetStageInstance {
channel_id: u64,
},
GetSticker {
sticker_id: u64,
},
GetTemplate {
template_code: &'a str,
},
GetTemplates {
guild_id: u64,
},
GetThreadMember {
channel_id: u64,
user_id: u64,
},
GetThreadMembers {
after: Option<u64>,
channel_id: u64,
limit: Option<u32>,
with_member: Option<bool>,
},
GetUser {
user_id: u64,
},
GetUserConnections,
GetUserPrivateChannels,
GetVoiceRegions,
GetWebhook {
token: Option<&'a str>,
webhook_id: u64,
},
GetWebhookMessage {
message_id: u64,
thread_id: Option<u64>,
token: &'a str,
webhook_id: u64,
},
InteractionCallback {
interaction_id: u64,
interaction_token: &'a str,
},
JoinThread {
channel_id: u64,
},
LeaveGuild {
guild_id: u64,
},
LeaveThread {
channel_id: u64,
},
PinMessage {
channel_id: u64,
message_id: u64,
},
RemoveMember {
guild_id: u64,
user_id: u64,
},
RemoveMemberRole {
guild_id: u64,
role_id: u64,
user_id: u64,
},
RemoveThreadMember {
channel_id: u64,
user_id: u64,
},
SearchGuildMembers {
guild_id: u64,
limit: Option<u16>,
query: &'a str,
},
SetGlobalCommands {
application_id: u64,
},
SetGuildCommands {
application_id: u64,
guild_id: u64,
},
SyncGuildIntegration {
guild_id: u64,
integration_id: u64,
},
SyncTemplate {
guild_id: u64,
template_code: &'a str,
},
UnpinMessage {
channel_id: u64,
message_id: u64,
},
UpdateAutoModerationRule {
auto_moderation_rule_id: u64,
guild_id: u64,
},
UpdateChannel {
channel_id: u64,
},
UpdateCommandPermissions {
application_id: u64,
command_id: u64,
guild_id: u64,
},
UpdateCurrentMember {
guild_id: u64,
},
UpdateCurrentUser,
UpdateCurrentUserVoiceState {
guild_id: u64,
},
UpdateEmoji {
emoji_id: u64,
guild_id: u64,
},
UpdateGlobalCommand {
application_id: u64,
command_id: u64,
},
UpdateGuild {
guild_id: u64,
},
UpdateGuildChannels {
guild_id: u64,
},
UpdateGuildCommand {
application_id: u64,
command_id: u64,
guild_id: u64,
},
UpdateGuildIntegration {
guild_id: u64,
integration_id: u64,
},
UpdateGuildMfa {
guild_id: u64,
},
UpdateGuildOnboarding {
guild_id: u64,
},
UpdateGuildScheduledEvent {
guild_id: u64,
scheduled_event_id: u64,
},
UpdateGuildSticker {
guild_id: u64,
sticker_id: u64,
},
UpdateGuildWelcomeScreen {
guild_id: u64,
},
UpdateGuildWidgetSettings {
guild_id: u64,
},
UpdateInteractionOriginal {
application_id: u64,
interaction_token: &'a str,
},
UpdateMember {
guild_id: u64,
user_id: u64,
},
UpdateMessage {
channel_id: u64,
message_id: u64,
},
UpdateNickname {
guild_id: u64,
},
UpdatePermissionOverwrite {
channel_id: u64,
target_id: u64,
},
UpdateRole {
guild_id: u64,
role_id: u64,
},
UpdateRolePositions {
guild_id: u64,
},
UpdateStageInstance {
channel_id: u64,
},
UpdateTemplate {
guild_id: u64,
template_code: &'a str,
},
UpdateUserVoiceState {
guild_id: u64,
user_id: u64,
},
UpdateWebhook {
token: Option<&'a str>,
webhook_id: u64,
},
UpdateWebhookMessage {
message_id: u64,
thread_id: Option<u64>,
token: &'a str,
webhook_id: u64,
},
UpdateCurrentUserApplication,
}
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
AddApplicationEmoji
Route information to add an emoji to an application.
AddGuildMember
Route information to add a user to a guild.
AddMemberRole
Route information to add a role to guild member.
Fields
AddThreadMember
Route information to add a member to a thread.
CreateAutoModerationRule
Route information to create an auto moderation rule.
CreateBan
Route information to create a ban on a user in a guild.
CreateChannel
Route information to create a channel in a guild.
CreateEmoji
Route information to create an emoji in a guild.
CreateForumThread
Route information to create a thread in a forum channel.
CreateGlobalCommand
Route information to create a global command.
CreateGuild
Route information to create a guild.
CreateGuildCommand
Route information to create a guild command.
CreateGuildFromTemplate
Route information to create a guild from a template.
CreateGuildIntegration
Route information to create a guild’s integration.
CreateGuildPrune
Route information to create a prune in a guild.
Fields
include_roles: &'a [Id<RoleMarker>]
The roles to filter the prune by.
A user must have at least one of these roles to be able to be pruned.
CreateGuildScheduledEvent
Route information to create a scheduled event in a guild.
CreateGuildSticker
Route information to create a sticker in a guild.
CreateInvite
Route information to create an invite to a channel.
CreateMessage
Route information to create a message in a channel.
CreatePrivateChannel
Route information to create a private channel.
CreateReaction
Route information to create a reaction on a message.
Fields
emoji: &'a RequestReactionType<'a>
The URI encoded custom or unicode emoji.
CreateRole
Route information to create a role in a guild.
CreateStageInstance
Route information to create a stage instance.
CreateTemplate
Route information to create a guild template.
CreateTestEntitlement
CreateThread
Route information to create a thread in a channel.
CreateThreadFromMessage
Route information to create a thread from a message.
CreateTypingTrigger
Route information to create a typing trigger in a channel.
CreateWebhook
Route information to create a webhook in a channel.
CrosspostMessage
Route information to crosspost a message to following guilds.
DeleteApplicationEmoji
Route information to delete an application emoji.
DeleteAutoModerationRule
Route information to delete an auto moderation rule for a guild.
DeleteBan
Route information to delete a ban on a user in a guild.
DeleteChannel
Route information to delete a channel.
DeleteEmoji
Route information to delete a guild’s custom emoji.
DeleteGlobalCommand
Route information to delete a global command.
DeleteGuild
Route information to delete a guild.
DeleteGuildCommand
Route information to delete a guild command.
Fields
DeleteGuildIntegration
Route information to delete a guild integration.
DeleteGuildScheduledEvent
Route information to delete a scheduled event in a guild.
DeleteGuildSticker
Route information to delete a guild sticker.
DeleteInteractionOriginal
Route information to delete the original interaction response.
Fields
DeleteInvite
Route information to delete an invite.
DeleteMessage
Route information to delete a channel’s message.
DeleteMessageReactions
Route information to delete all of the reactions on a message.
DeleteMessageSpecificReaction
Route information to delete all of the reactions on a message with a specific emoji.
Fields
emoji: &'a RequestReactionType<'a>
The URI encoded custom or unicode emoji.
DeleteMessages
Route information to bulk delete messages in a channel.
DeletePermissionOverwrite
Route information to delete a permission overwrite for a role or user in a channel.
DeleteReaction
Route information to delete a user’s reaction on a message.
Fields
emoji: &'a RequestReactionType<'a>
The URI encoded custom or unicode emoji.
DeleteReactionCurrentUser
Route information to delete the current user’s reaction on a message.
Fields
emoji: &'a RequestReactionType<'a>
URI encoded custom or unicode emoji.
DeleteRole
Route information to delete a guild’s role.
DeleteStageInstance
Route information to delete a stage instance.
DeleteTemplate
Route information to delete a guild template.
DeleteWebhook
Route information to delete a webhook.
DeleteWebhookMessage
Route information to delete a message created by a webhook.
Fields
DeleteTestEntitlement
Route information to delete a test entitlement.
UpdateApplicationEmoji
Route information to edit an application emoji.
EndPoll
Route information to end a poll.
ExecuteWebhook
Route information to execute a webhook by ID and token.
Fields
FollowNewsChannel
Route information to follow a news channel.
GetActiveThreads
Route information to get active threads in a channel.
GetApplicationEmojis
GetAnswerVoters
Route information for fetching poll vote information.
Fields
GetAuditLogs
Route information to get a paginated list of audit logs in a guild.
Fields
GetAutoModerationRule
Route information to get an auto moderation rule for a guild.
GetBan
Route information to get information about a single ban in a guild.
GetBans
Route information to get a guild’s bans.
GetBansWithParameters
Route information to get a guild’s bans with parameters.
Fields
GetChannel
Route information to get a channel.
GetChannelInvites
Route information to get a channel’s invites.
GetChannelWebhooks
Route information to get a channel’s webhooks.
GetChannels
Route information to get a guild’s channels.
GetCommandPermissions
Route information to get permissions of a specific guild command.
Fields
GetCurrentAuthorizationInformation
Route information to get the current OAuth2 authorization information.
GetCurrentUser
Route information to get the current user.
GetCurrentUserApplicationInfo
Route information to get info about application the current bot user belongs to
GetCurrentUserGuildMember
Route information to get the current user as a member object within a guild.
GetEmoji
Route information to get an emoji by ID within a guild.
GetEmojis
Route information to get a guild’s emojis.
GetEntitlements
Fields
GetFollowupMessage
Route to get a followup message for an interaction.
Fields
GetGateway
Route information to get basic gateway information.
GetGatewayBot
Route information to get gateway information tailored to the current user.
GetGlobalCommand
Route information to get a global command for an application.
GetGlobalCommands
Fields
GetGuild
Route information to get a guild.
Fields
GetGuildAutoModerationRules
Route information to get a list of automation rules for a guild.
GetGuildCommand
Route information to get a guild command.
Fields
GetGuildCommandPermissions
Route information to get permissions of all guild commands.
GetGuildCommands
Route information to get guild commands.
Fields
GetGuildIntegrations
Route information to get a guild’s integrations.
GetGuildInvites
Route information to get a guild’s invites.
GetGuildMembers
Route information to get a guild’s members.
Fields
GetGuildOnboarding
Route information to get a guild’s onboarding information.
GetGuildPreview
Route information to get a guild’s preview.
GetGuildPruneCount
Route information to get the number of members that would be pruned, filtering by inactivity and users with one of the provided roles.
Fields
include_roles: &'a [Id<RoleMarker>]
The roles to filter the prune by.
A user must have at least one of these roles to be able to be pruned.
GetGuildRoles
Route information to get a guild’s roles.
GetGuildScheduledEvent
Route information to get a guild scheduled event.
Fields
GetGuildScheduledEventUsers
Route information to get a guild scheduled event’s members.
Fields
GetGuildScheduledEvents
Route information to get a guild’s scheduled events.
GetGuildSticker
Route information to get a guild’s sticker.
GetGuildStickers
Route information to get a guild’s stickers.
GetGuildVanityUrl
Route information to get a guild’s vanity URL.
GetGuildVoiceRegions
Route information to get a guild’s available voice regions.
GetGuildWebhooks
Route information to get a guild’s webhooks.
GetGuildWelcomeScreen
Route information to get a guild’s welcome screen.
GetGuildWidget
Route information to get a guild’s widget.
GetGuildWidgetSettings
Route information to get a guild’s widget settings.
GetGuilds
Route information to get a paginated list of guilds.
Fields
GetInteractionOriginal
Route information to get an original interaction response message.
Fields
GetInvite
Route information to get an invite.
Fields
GetInviteWithExpiration
Route information to get an invite with an expiration.
Fields
GetJoinedPrivateArchivedThreads
Route information to get joined private archived threads in a channel.
Fields
GetMember
Route information to get a member.
GetMessage
Route information to get a single message in a channel.
GetMessages
Route information to get a paginated list of messages in a channel.
Fields
GetNitroStickerPacks
Route information to get a list of sticker packs available to Nitro subscribers.
GetPins
Route information to get a channel’s pins.
GetPrivateArchivedThreads
Route information to get private archived threads in a channel.
Fields
GetPublicArchivedThreads
Route information to get public archived threads in a channel.
Fields
GetReactionUsers
Route information to get the users who reacted to a message with a specified emoji.
Fields
emoji: &'a RequestReactionType<'a>
The URI encoded custom or unicode emoji.
GetSKUs
GetStageInstance
Route information to get a stage instance.
GetSticker
Route information to get a sticker.
GetTemplate
Route information to get a template.
GetTemplates
Route information to get a list of templates from a guild.
GetThreadMember
Route information to get a member of a thread.
GetThreadMembers
Route information to get members of a thread.
Fields
GetUser
Route information to get a user.
GetUserConnections
Route information to get the current user’s connections.
GetUserPrivateChannels
Route information to get the current user’s private channels and groups.
GetVoiceRegions
Route information to get a list of the voice regions.
GetWebhook
Route information to get a webhook by ID, optionally with a token if the current user doesn’t have access to it.
GetWebhookMessage
Route information to get a previously-sent webhook message.
Fields
InteractionCallback
Route information to respond to an interaction.
Fields
JoinThread
Route information to join a thread as the current user.
LeaveGuild
Route information to leave the guild.
LeaveThread
Route information to leave a thread as the current user.
PinMessage
Route information to pin a message to a channel.
RemoveMember
Route information to remove a member from a guild.
RemoveMemberRole
Route information to remove a role from a member.
Fields
RemoveThreadMember
Route information to remove a member from a thread.
SearchGuildMembers
Route information to search for members in a guild.
Fields
SetGlobalCommands
Route information to set global commands.
SetGuildCommands
Route information to set guild commands.
SyncGuildIntegration
Route information to sync a guild’s integration.
SyncTemplate
Route information to sync a template.
UnpinMessage
Route information to unpin a message from a channel.
UpdateAutoModerationRule
Route information to update an auto moderation rule for a guild.
UpdateChannel
Route information to update a channel, such as a guild channel or group.
UpdateCommandPermissions
Route information to edit permissions of a command in a guild.
Fields
UpdateCurrentMember
Route information to update the current member.
UpdateCurrentUser
Route information to update the current user.
UpdateCurrentUserVoiceState
Route information to update the current user’s voice state.
UpdateEmoji
Route information to update an emoji.
UpdateGlobalCommand
Route information to update a global command.
UpdateGuild
Route information to update a guild.
UpdateGuildChannels
Route information to update a guild channel.
UpdateGuildCommand
Route information to update a guild command.
Fields
UpdateGuildIntegration
Route information to update a guild’s integration.
UpdateGuildMfa
Route information to update a guild’s MFA level.
UpdateGuildOnboarding
UpdateGuildScheduledEvent
Route information to update a scheduled event in a guild.
UpdateGuildSticker
Route information to update a guild sticker.
UpdateGuildWelcomeScreen
Route information to update a guild’s welcome screen.
UpdateGuildWidgetSettings
Route information to update a guild’s widget settings.
UpdateInteractionOriginal
Update the original interaction response.
Fields
UpdateMember
Route information to update a member.
UpdateMessage
Route information to update a message.
UpdateNickname
Route information to update the current member’s nickname.
UpdatePermissionOverwrite
Route information to update the permission overwrite of a role or user in a channel.
UpdateRole
Route information to update a role.
UpdateRolePositions
Route information to update the positions of roles.
UpdateStageInstance
Route information to update an existing stage instance.
UpdateTemplate
Route information to update a template.
UpdateUserVoiceState
Route information to update a user’s voice state.
UpdateWebhook
Route information to update a webhook.
UpdateWebhookMessage
Route information to update a message created by a webhook.
Fields
UpdateCurrentUserApplication
Implementations§
source§impl<'a> Route<'a>
impl<'a> Route<'a>
sourcepub const fn method(&self) -> Method
pub const fn method(&self) -> Method
HTTP method of the route.
§Examples
Assert that the GetGuild
route returns Method::Get
:
use twilight_http::{request::Method, routing::Route};
let route = Route::GetGuild {
guild_id: 123,
with_counts: false,
};
assert_eq!(Method::Get, route.method());
sourcepub fn to_path(&self) -> Path
pub fn to_path(&self) -> Path
Typed path of the route.
Paths are used with a Ratelimiter
.
§Examples
Use a route’s path to retrieve a ratelimiter ticket:
use twilight_http::routing::Route;
use twilight_http_ratelimiting::{InMemoryRatelimiter, Ratelimiter};
let ratelimiter = InMemoryRatelimiter::new();
let route = Route::CreateMessage { channel_id: 123 };
// Take a ticket from the ratelimiter.
let rx = ratelimiter.ticket(route.to_path()).await?;
// Wait to be told that a request can be made...
let _tx = rx.await;
// The request can now be made.
Trait Implementations§
source§impl Display for Route<'_>
impl Display for Route<'_>
Display formatter of the route portion of a URL.
§Examples
Create a formatted representation of the GetPins
route:
use twilight_http::routing::Route;
let route = Route::GetPins { channel_id: 123 };
assert_eq!("channels/123/pins", route.to_string());
Create a formatted representation of the GetInvite
route, which
includes a query parameter:
use twilight_http::routing::Route;
let route = Route::GetInvite {
code: "twilight-rs",
with_counts: true,
};
assert_eq!("invites/twilight-rs?with_counts=true", route.to_string());
impl<'a> Eq for Route<'a>
impl<'a> StructuralPartialEq for Route<'a>
Auto Trait Implementations§
impl<'a> Freeze for Route<'a>
impl<'a> RefUnwindSafe for Route<'a>
impl<'a> Send for Route<'a>
impl<'a> Sync for Route<'a>
impl<'a> Unpin for Route<'a>
impl<'a> UnwindSafe for Route<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.