Enum twilight_http::routing::Route [−][src]
#[non_exhaustive]
pub enum Route<'a> {
Show 127 variants
AddGuildMember {
guild_id: u64,
user_id: u64,
},
AddMemberRole {
guild_id: u64,
role_id: u64,
user_id: u64,
},
CreateBan {
delete_message_days: Option<u64>,
guild_id: u64,
reason: Option<&'a str>,
user_id: u64,
},
CreateChannel {
guild_id: u64,
},
CreateEmoji {
guild_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<u64>,
guild_id: u64,
include_roles: &'a [RoleId],
},
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,
},
CreateTypingTrigger {
channel_id: u64,
},
CreateWebhook {
channel_id: u64,
},
CrosspostMessage {
channel_id: u64,
message_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,
},
DeleteInvite {
code: &'a str,
},
DeleteInteractionOriginal {
application_id: u64,
interaction_token: &'a str,
},
DeleteMessage {
channel_id: u64,
message_id: u64,
},
DeleteMessages {
channel_id: u64,
},
DeleteMessageReactions {
channel_id: u64,
message_id: u64,
},
DeleteMessageSpecificReaction {
channel_id: u64,
emoji: &'a RequestReactionType<'a>,
message_id: u64,
},
DeletePermissionOverwrite {
channel_id: u64,
target_id: u64,
},
DeleteReactionCurrentUser {
channel_id: u64,
emoji: &'a RequestReactionType<'a>,
message_id: u64,
},
DeleteReaction {
channel_id: u64,
emoji: &'a RequestReactionType<'a>,
message_id: u64,
user_id: u64,
},
DeleteRole {
guild_id: u64,
role_id: u64,
},
DeleteStageInstance {
channel_id: u64,
},
DeleteTemplate {
guild_id: u64,
template_code: &'a str,
},
DeleteWebhookMessage {
message_id: u64,
token: &'a str,
webhook_id: u64,
},
DeleteWebhook {
token: Option<&'a str>,
webhook_id: u64,
},
ExecuteWebhook {
token: &'a str,
wait: Option<bool>,
webhook_id: u64,
},
FollowNewsChannel {
channel_id: u64,
},
GetAuditLogs {
action_type: Option<u64>,
before: Option<u64>,
guild_id: u64,
limit: Option<u64>,
user_id: Option<u64>,
},
GetBan {
guild_id: u64,
user_id: u64,
},
GetBans {
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,
},
GetCurrentUserApplicationInfo,
GetCurrentUser,
GetEmoji {
emoji_id: u64,
guild_id: u64,
},
GetEmojis {
guild_id: u64,
},
GetGateway,
GetGatewayBot,
GetGlobalCommands {
application_id: u64,
},
GetGuild {
guild_id: u64,
with_counts: bool,
},
GetGuildCommandPermissions {
application_id: u64,
guild_id: u64,
},
GetGuildCommands {
application_id: u64,
guild_id: u64,
},
GetGuildWidget {
guild_id: u64,
},
GetGuildIntegrations {
guild_id: u64,
},
GetGuildInvites {
guild_id: u64,
},
GetGuildMembers {
after: Option<u64>,
guild_id: u64,
limit: Option<u64>,
presences: Option<bool>,
},
GetGuildPreview {
guild_id: u64,
},
GetGuildPruneCount {
days: Option<u64>,
guild_id: u64,
include_roles: &'a [RoleId],
},
GetGuildRoles {
guild_id: u64,
},
GetGuildVanityUrl {
guild_id: u64,
},
GetGuildVoiceRegions {
guild_id: u64,
},
GetGuildWelcomeScreen {
guild_id: u64,
},
GetGuildWebhooks {
guild_id: u64,
},
GetGuilds {
after: Option<u64>,
before: Option<u64>,
limit: Option<u64>,
},
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,
},
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<u64>,
},
GetPins {
channel_id: u64,
},
GetReactionUsers {
after: Option<u64>,
channel_id: u64,
emoji: &'a RequestReactionType<'a>,
limit: Option<u64>,
message_id: u64,
},
GetStageInstance {
channel_id: u64,
},
GetTemplate {
template_code: &'a str,
},
GetTemplates {
guild_id: u64,
},
GetUser {
user_id: u64,
},
GetUserConnections,
GetUserPrivateChannels,
GetVoiceRegions,
GetWebhook {
token: Option<&'a str>,
webhook_id: u64,
},
GetWebhookMessage {
message_id: u64,
token: &'a str,
webhook_id: u64,
},
InteractionCallback {
interaction_id: u64,
interaction_token: &'a str,
},
LeaveGuild {
guild_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,
},
SearchGuildMembers {
guild_id: u64,
limit: Option<u64>,
query: &'a str,
},
SetCommandPermissions {
application_id: u64,
guild_id: u64,
},
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,
},
UpdateChannel {
channel_id: u64,
},
UpdateCommandPermissions {
application_id: u64,
command_id: u64,
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,
},
UpdateGuildWidget {
guild_id: u64,
},
UpdateGuildIntegration {
guild_id: u64,
integration_id: u64,
},
UpdateGuildWelcomeScreen {
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,
},
UpdateWebhookMessage {
message_id: u64,
token: &'a str,
webhook_id: u64,
},
UpdateWebhook {
token: Option<&'a str>,
webhook_id: u64,
},
}Variants (Non-exhaustive)
This enum is marked as non-exhaustive
Route information to add a user to a guild.
Route information to add a role to guild member.
Fields of AddMemberRole
Route information to create a ban on a user in a guild.
Fields of CreateBan
Route information to create a channel in a guild.
Fields of CreateChannel
guild_id: u64The ID of the guild.
Route information to create an emoji in a guild.
Fields of CreateEmoji
guild_id: u64The ID of the guild.
Route information to create a global command.
Fields of CreateGlobalCommand
application_id: u64The ID of the owner application.
Route information to create a guild.
Route information to create a guild command.
Fields of CreateGuildCommand
Route information to create a guild from a template.
Fields of CreateGuildFromTemplate
template_code: &'a strCode of the template.
Route information to create a guild’s integration.
Fields of CreateGuildIntegration
guild_id: u64The ID of the guild.
Route information to create a prune in a guild.
Fields of CreateGuildPrune
compute_prune_count: Option<bool>Whether to compute the number of pruned users.
days: Option<u64>The number of days that a user must be offline before being able to be pruned.
guild_id: u64The ID of the guild.
include_roles: &'a [RoleId]The roles to filter the prune by.
A user must have at least one of these roles to be able to be pruned.
Route information to create an invite to a channel.
Fields of CreateInvite
channel_id: u64The ID of the channel.
Route information to create a message in a channel.
Fields of CreateMessage
channel_id: u64The ID of the channel.
Route information to create a private channel.
Route information to create a reaction on a message.
Fields of CreateReaction
channel_id: u64The ID of the channel.
emoji: &'a RequestReactionType<'a>The URI encoded custom or unicode emoji.
message_id: u64The ID of the message.
Route information to create a role in a guild.
Fields of CreateRole
guild_id: u64The ID of the guild.
Route information to create a stage instance.
Route information to create a guild template.
Fields of CreateTemplate
guild_id: u64The ID of the guild.
Route information to create a typing trigger in a channel.
Fields of CreateTypingTrigger
channel_id: u64The ID of the channel.
Route information to create a webhook in a channel.
Fields of CreateWebhook
channel_id: u64The ID of the channel.
Route information to crosspost a message to following guilds.
Fields of CrosspostMessage
Route information to delete a ban on a user in a guild.
Route information to delete a channel.
Fields of DeleteChannel
channel_id: u64The ID of the channel.
Route information to delete a guild’s custom emoji.
Route information to delete a global command.
Fields of DeleteGlobalCommand
Route information to delete a guild.
Fields of DeleteGuild
guild_id: u64The ID of the guild.
Route information to delete a guild command.
Fields of DeleteGuildCommand
Route information to delete a guild integration.
Fields of DeleteGuildIntegration
Route information to delete an invite.
Fields of DeleteInvite
code: &'a strThe unique invite code.
Route information to delete the original interaction response.
Fields of DeleteInteractionOriginal
Route information to delete a channel’s message.
Route information to bulk delete messages in a channel.
Fields of DeleteMessages
channel_id: u64The ID of the channel.
Route information to delete all of the reactions on a message.
Fields of DeleteMessageReactions
Route information to delete all of the reactions on a message with a specific emoji.
Fields of DeleteMessageSpecificReaction
channel_id: u64The ID of the channel.
emoji: &'a RequestReactionType<'a>The URI encoded custom or unicode emoji.
message_id: u64The ID of the message.
Route information to delete a permission overwrite for a role or user in a channel.
Fields of DeletePermissionOverwrite
Route information to delete the current user’s reaction on a message.
Fields of DeleteReactionCurrentUser
channel_id: u64ID of the channel.
emoji: &'a RequestReactionType<'a>URI encoded custom or unicode emoji.
message_id: u64ID of the message.
Route information to delete a user’s reaction on a message.
Fields of DeleteReaction
channel_id: u64The ID of the channel.
emoji: &'a RequestReactionType<'a>The URI encoded custom or unicode emoji.
message_id: u64The ID of the message.
user_id: u64The ID of the user.
Route information to delete a guild’s role.
Route information to delete a stage instance.
Fields of DeleteStageInstance
channel_id: u64ID of the stage channel.
Route information to delete a guild template.
Fields of DeleteTemplate
Route information to delete a message created by a webhook.
Route information to delete a webhook.
Fields of DeleteWebhook
Route information to execute a webhook by ID and token.
Fields of ExecuteWebhook
Route information to follow a news channel.
Fields of FollowNewsChannel
channel_id: u64The ID of the channel to follow.
Route information to get a paginated list of audit logs in a guild.
Fields of GetAuditLogs
Route information to get information about a single ban in a guild.
Route information to get a guild’s bans.
Fields of GetBans
guild_id: u64The ID of the guild.
Route information to get a channel.
Fields of GetChannel
channel_id: u64The ID of the channel.
Route information to get a channel’s invites.
Fields of GetChannelInvites
channel_id: u64The ID of the channel.
Route information to get a channel’s webhooks.
Fields of GetChannelWebhooks
channel_id: u64The ID of the channel.
Route information to get a guild’s channels.
Fields of GetChannels
guild_id: u64The ID of the guild.
Route information to get permissions of a specific guild command.
Fields of GetCommandPermissions
Route information to get info about application the current bot user belongs to
Route information to get the current user.
Route information to get an emoji by ID within a guild.
Route information to get a guild’s emojis.
Fields of GetEmojis
guild_id: u64The ID of the guild.
Route information to get basic gateway information.
Route information to get gateway information tailored to the current user.
Fields of GetGlobalCommands
application_id: u64The ID of the owner application.
Route information to get a guild.
Fields of GetGuild
Route information to get permissions of all guild commands.
Fields of GetGuildCommandPermissions
Route information to get guild commands.
Fields of GetGuildCommands
Route information to get a guild’s widget.
Fields of GetGuildWidget
guild_id: u64The ID of the guild.
Route information to get a guild’s integrations.
Fields of GetGuildIntegrations
guild_id: u64The ID of the guild.
Route information to get a guild’s invites.
Fields of GetGuildInvites
guild_id: u64The ID of the guild.
Route information to get a guild’s members.
Fields of GetGuildMembers
Route information to get a guild’s preview.
Fields of GetGuildPreview
guild_id: u64The ID of the guild.
Route information to get the number of members that would be pruned, filtering by inactivity and users with one of the provided roles.
Fields of GetGuildPruneCount
Route information to get a guild’s roles.
Fields of GetGuildRoles
guild_id: u64The ID of the guild.
Route information to get a guild’s vanity URL.
Fields of GetGuildVanityUrl
guild_id: u64The ID of the guild.
Route information to get a guild’s available voice regions.
Fields of GetGuildVoiceRegions
guild_id: u64The ID of the guild.
Route information to get a guild’s welcome screen.
Fields of GetGuildWelcomeScreen
guild_id: u64ID of the guild.
Route information to get a guild’s webhooks.
Fields of GetGuildWebhooks
guild_id: u64The ID of the guild.
Route information to get a paginated list of guilds.
Fields of GetGuilds
Route information to get an original interaction response message.
Fields of GetInteractionOriginal
Route information to get an invite.
Fields of GetInvite
Route information to get an invite with an expiration.
Fields of GetInviteWithExpiration
Route information to get a member.
Route information to get a single message in a channel.
Route information to get a paginated list of messages in a channel.
Fields of GetMessages
Route information to get a channel’s pins.
Fields of GetPins
channel_id: u64The ID of the channel.
Route information to get the users who reacted to a message with a specified emoji.
Fields of GetReactionUsers
Route information to get a stage instance.
Fields of GetStageInstance
channel_id: u64ID of the stage channel.
Route information to get a template.
Fields of GetTemplate
template_code: &'a strThe template code.
Route information to get a list of templates from a guild.
Fields of GetTemplates
guild_id: u64The ID of the guild.
Route information to get a user.
Fields of GetUser
user_id: u64ID of the target user.
Route information to get the current user’s connections.
Route information to get the current user’s private channels and groups.
Route information to get a list of the voice regions.
Route information to get a webhook by ID, optionally with a token if the current user doesn’t have access to it.
Fields of GetWebhook
Route information to get a previously-sent webhook message.
Fields of GetWebhookMessage
Route information to respond to an interaction.
Fields of InteractionCallback
Route information to leave the guild.
Fields of LeaveGuild
guild_id: u64The ID of the guild.
Route information to pin a message to a channel.
Route information to remove a member from a guild.
Route information to remove a role from a member.
Fields of RemoveMemberRole
Route information to search for members in a guild.
Fields of SearchGuildMembers
Route information to set permissions of commands in a guild.
Fields of SetCommandPermissions
Route information to set global commands.
Fields of SetGlobalCommands
application_id: u64The ID of the owner application.
Route information to set guild commands.
Fields of SetGuildCommands
Route information to sync a guild’s integration.
Fields of SyncGuildIntegration
Route information to sync a template.
Route information to unpin a message from a channel.
Route information to update a channel, such as a guild channel or group.
Fields of UpdateChannel
channel_id: u64The ID of the channel.
Route information to edit permissions of a command in a guild.
Fields of UpdateCommandPermissions
Route information to update the current user.
Route information to update the current user’s voice state.
Fields of UpdateCurrentUserVoiceState
guild_id: u64ID of the guild.
Route information to update an emoji.
Route information to update a global command.
Fields of UpdateGlobalCommand
Route information to update a guild.
Fields of UpdateGuild
guild_id: u64The ID of the guild.
Route information to update a guild channel.
Fields of UpdateGuildChannels
guild_id: u64The ID of the guild.
Route information to update a guild command.
Fields of UpdateGuildCommand
Route information to update a guild’s widget.
Fields of UpdateGuildWidget
guild_id: u64The ID of the guild.
Route information to update a guild’s integration.
Fields of UpdateGuildIntegration
Route information to update a guild’s welcome screen.
Fields of UpdateGuildWelcomeScreen
guild_id: u64ID of the guild.
Update the original interaction response.
Fields of UpdateInteractionOriginal
Route information to update a member.
Route information to update a message.
Route information to update the current member’s nickname.
Fields of UpdateNickname
guild_id: u64The ID of the guild.
Route information to update the permission overwrite of a role or user in a channel.
Fields of UpdatePermissionOverwrite
Route information to update a role.
Route information to update the positions of roles.
Fields of UpdateRolePositions
guild_id: u64The ID of the guild.
Route information to update an existing stage instance.
Fields of UpdateStageInstance
channel_id: u64ID of the stage channel.
Route information to update a template.
Route information to update a user’s voice state.
Route information to update a message created by a webhook.
Route information to update a webhook.
Fields of UpdateWebhook
Implementations
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.display().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.display().to_string(), );
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());
Typed path of the route.
Paths are used with the Ratelimiter.
Examples
Use a route’s path to retrieve a ratelimiter ticket:
use twilight_http::{ratelimiting::Ratelimiter, routing::Route}; let ratelimiter = Ratelimiter::new(); let route = Route::CreateMessage { channel_id: 123, }; // Take a ticket from the ratelimiter. let rx = ratelimiter.get(route.path()).await; // Wait to be told that a request can be made... let _tx = rx.await; // The request can now be made.
Trait Implementations
Auto Trait Implementations
impl<'a> RefUnwindSafe for Route<'a>
impl<'a> UnwindSafe for Route<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key and return true if they are equal.
Instruments this type with the provided Span, returning an
Instrumented wrapper. Read more