twilight_http/
routing.rs

1use percent_encoding::{utf8_percent_encode, NON_ALPHANUMERIC};
2pub use twilight_http_ratelimiting::request::{Path, PathParseError, PathParseErrorType};
3
4use crate::{
5    query_formatter::{QueryArray, QueryStringFormatter},
6    request::{channel::reaction::RequestReactionType, Method},
7};
8use std::fmt::{Display, Formatter, Result as FmtResult};
9use twilight_model::id::{
10    marker::{RoleMarker, SkuMarker},
11    Id,
12};
13
14#[derive(Clone, Debug, Eq, Hash, PartialEq)]
15#[non_exhaustive]
16pub enum Route<'a> {
17    /// Route information to add an emoji to an application.
18    AddApplicationEmoji {
19        /// The ID of the application.
20        application_id: u64,
21    },
22    /// Route information to add a user to a guild.
23    AddGuildMember {
24        guild_id: u64,
25        user_id: u64,
26    },
27    /// Route information to add a role to guild member.
28    AddMemberRole {
29        /// The ID of the guild.
30        guild_id: u64,
31        /// The ID of the role.
32        role_id: u64,
33        /// The ID of the user.
34        user_id: u64,
35    },
36    /// Route information to add a member to a thread.
37    AddThreadMember {
38        /// ID of the thread.
39        channel_id: u64,
40        /// ID of the member.
41        user_id: u64,
42    },
43    /// Route information to create an auto moderation rule.
44    CreateAutoModerationRule {
45        /// ID of the guild.
46        guild_id: u64,
47    },
48    /// Route information to create a ban on a user in a guild.
49    CreateBan {
50        /// The ID of the guild.
51        guild_id: u64,
52        /// The ID of the user.
53        user_id: u64,
54    },
55    /// Route information to create a channel in a guild.
56    CreateChannel {
57        /// The ID of the guild.
58        guild_id: u64,
59    },
60    /// Route information to create an emoji in a guild.
61    CreateEmoji {
62        /// The ID of the guild.
63        guild_id: u64,
64    },
65    /// Route information to create a thread in a forum channel.
66    CreateForumThread {
67        /// The ID of the channel.
68        channel_id: u64,
69    },
70    /// Route information to create a global command.
71    CreateGlobalCommand {
72        /// The ID of the owner application.
73        application_id: u64,
74    },
75    /// Route information to create a guild.
76    CreateGuild,
77    /// Route information to create a guild command.
78    CreateGuildCommand {
79        /// The ID of the owner application.
80        application_id: u64,
81        /// The ID of the guild.
82        guild_id: u64,
83    },
84    /// Route information to create a guild from a template.
85    CreateGuildFromTemplate {
86        /// Code of the template.
87        template_code: &'a str,
88    },
89    /// Route information to create a guild's integration.
90    CreateGuildIntegration {
91        /// The ID of the guild.
92        guild_id: u64,
93    },
94    /// Route information to create a prune in a guild.
95    CreateGuildPrune {
96        /// Whether to compute the number of pruned users.
97        compute_prune_count: Option<bool>,
98        /// The number of days that a user must be offline before being able to
99        /// be pruned.
100        days: Option<u16>,
101        /// The ID of the guild.
102        guild_id: u64,
103        /// The roles to filter the prune by.
104        ///
105        /// A user must have at least one of these roles to be able to be
106        /// pruned.
107        include_roles: &'a [Id<RoleMarker>],
108    },
109    /// Route information to create a scheduled event in a guild.
110    CreateGuildScheduledEvent {
111        /// ID of the guild.
112        guild_id: u64,
113    },
114    /// Route information to create a sticker in a guild.
115    CreateGuildSticker {
116        /// ID of the guild.
117        guild_id: u64,
118    },
119    /// Route information to create an invite to a channel.
120    CreateInvite {
121        /// The ID of the channel.
122        channel_id: u64,
123    },
124    /// Route information to create a message in a channel.
125    CreateMessage {
126        /// The ID of the channel.
127        channel_id: u64,
128    },
129    /// Route information to create a private channel.
130    CreatePrivateChannel,
131    /// Route information to create a reaction on a message.
132    CreateReaction {
133        /// The ID of the channel.
134        channel_id: u64,
135        /// The URI encoded custom or unicode emoji.
136        emoji: &'a RequestReactionType<'a>,
137        /// The ID of the message.
138        message_id: u64,
139    },
140    /// Route information to create a role in a guild.
141    CreateRole {
142        /// The ID of the guild.
143        guild_id: u64,
144    },
145    /// Route information to create a stage instance.
146    CreateStageInstance,
147    /// Route information to create a guild template.
148    CreateTemplate {
149        /// The ID of the guild.
150        guild_id: u64,
151    },
152    CreateTestEntitlement {
153        /// The ID of the application.
154        application_id: u64,
155    },
156    /// Route information to create a thread in a channel.
157    CreateThread {
158        /// ID of the channel.
159        channel_id: u64,
160    },
161    /// Route information to create a thread from a message.
162    CreateThreadFromMessage {
163        /// ID of the channel.
164        channel_id: u64,
165        /// ID of the message.
166        message_id: u64,
167    },
168    /// Route information to create a typing trigger in a channel.
169    CreateTypingTrigger {
170        /// The ID of the channel.
171        channel_id: u64,
172    },
173    /// Route information to create a webhook in a channel.
174    CreateWebhook {
175        /// The ID of the channel.
176        channel_id: u64,
177    },
178    /// Route information to crosspost a message to following guilds.
179    CrosspostMessage {
180        /// The ID of the channel.
181        channel_id: u64,
182        /// The ID of the message.
183        message_id: u64,
184    },
185    /// Route information to delete an application emoji.
186    DeleteApplicationEmoji {
187        /// The ID of the application.
188        application_id: u64,
189        /// The ID of the emoji.
190        emoji_id: u64,
191    },
192    /// Route information to delete an auto moderation rule for a guild.
193    DeleteAutoModerationRule {
194        /// ID of the guild.
195        guild_id: u64,
196        /// ID of the auto moderation rule.
197        auto_moderation_rule_id: u64,
198    },
199    /// Route information to delete a ban on a user in a guild.
200    DeleteBan {
201        /// The ID of the guild.
202        guild_id: u64,
203        /// The ID of the user.
204        user_id: u64,
205    },
206    /// Route information to delete a channel.
207    DeleteChannel {
208        /// The ID of the channel.
209        channel_id: u64,
210    },
211    /// Route information to delete a guild's custom emoji.
212    DeleteEmoji {
213        /// The ID of the emoji.
214        emoji_id: u64,
215        /// The ID of the guild.
216        guild_id: u64,
217    },
218    /// Route information to delete a global command.
219    DeleteGlobalCommand {
220        /// The ID of the owner application.
221        application_id: u64,
222        /// The ID of the command.
223        command_id: u64,
224    },
225    /// Route information to delete a guild.
226    DeleteGuild {
227        /// The ID of the guild.
228        guild_id: u64,
229    },
230    /// Route information to delete a guild command.
231    DeleteGuildCommand {
232        /// The ID of the owner application.
233        application_id: u64,
234        /// The ID of the command.
235        command_id: u64,
236        /// The ID of the guild.
237        guild_id: u64,
238    },
239    /// Route information to delete a guild integration.
240    DeleteGuildIntegration {
241        /// The ID of the guild.
242        guild_id: u64,
243        /// The ID of the integration.
244        integration_id: u64,
245    },
246    /// Route information to delete a scheduled event in a guild.
247    DeleteGuildScheduledEvent {
248        /// ID of the guild.
249        guild_id: u64,
250        /// ID of the scheduled event.
251        scheduled_event_id: u64,
252    },
253    /// Route information to delete a guild sticker.
254    DeleteGuildSticker {
255        /// ID of the guild.
256        guild_id: u64,
257        /// ID of the sticker.
258        sticker_id: u64,
259    },
260    /// Route information to delete the original interaction response.
261    DeleteInteractionOriginal {
262        /// The ID of the owner application
263        application_id: u64,
264        /// The token of the interaction.
265        interaction_token: &'a str,
266    },
267    /// Route information to delete an invite.
268    DeleteInvite {
269        /// The unique invite code.
270        code: &'a str,
271    },
272    /// Route information to delete a channel's message.
273    DeleteMessage {
274        /// The ID of the channel.
275        channel_id: u64,
276        /// The ID of the message.
277        message_id: u64,
278    },
279    /// Route information to delete all of the reactions on a message.
280    DeleteMessageReactions {
281        /// The ID of the channel.
282        channel_id: u64,
283        /// The ID of the message.
284        message_id: u64,
285    },
286    /// Route information to delete all of the reactions on a message with a
287    /// specific emoji.
288    DeleteMessageSpecificReaction {
289        /// The ID of the channel.
290        channel_id: u64,
291        /// The URI encoded custom or unicode emoji.
292        emoji: &'a RequestReactionType<'a>,
293        /// The ID of the message.
294        message_id: u64,
295    },
296    /// Route information to bulk delete messages in a channel.
297    DeleteMessages {
298        /// The ID of the channel.
299        channel_id: u64,
300    },
301    /// Route information to delete a permission overwrite for a role or user in
302    /// a channel.
303    DeletePermissionOverwrite {
304        /// The ID of the channel.
305        channel_id: u64,
306        /// The ID of the target role or user.
307        target_id: u64,
308    },
309    /// Route information to delete a user's reaction on a message.
310    DeleteReaction {
311        /// The ID of the channel.
312        channel_id: u64,
313        /// The URI encoded custom or unicode emoji.
314        emoji: &'a RequestReactionType<'a>,
315        /// The ID of the message.
316        message_id: u64,
317        /// The ID of the user.
318        user_id: u64,
319    },
320    /// Route information to delete the current user's reaction on a message.
321    DeleteReactionCurrentUser {
322        /// ID of the channel.
323        channel_id: u64,
324        /// URI encoded custom or unicode emoji.
325        emoji: &'a RequestReactionType<'a>,
326        /// ID of the message.
327        message_id: u64,
328    },
329    /// Route information to delete a guild's role.
330    DeleteRole {
331        /// The ID of the guild.
332        guild_id: u64,
333        /// The ID of the role.
334        role_id: u64,
335    },
336    /// Route information to delete a stage instance.
337    DeleteStageInstance {
338        /// ID of the stage channel.
339        channel_id: u64,
340    },
341    /// Route information to delete a guild template.
342    DeleteTemplate {
343        /// The ID of the guild.
344        guild_id: u64,
345        /// The target template code.
346        template_code: &'a str,
347    },
348    /// Route information to delete a webhook.
349    DeleteWebhook {
350        /// The token of the webhook.
351        token: Option<&'a str>,
352        /// The ID of the webhook.
353        webhook_id: u64,
354    },
355    /// Route information to delete a message created by a webhook.
356    DeleteWebhookMessage {
357        message_id: u64,
358        /// ID of the thread channel, if there is one.
359        thread_id: Option<u64>,
360        token: &'a str,
361        webhook_id: u64,
362    },
363    /// Route information to delete a test entitlement.
364    DeleteTestEntitlement {
365        /// The ID of the application.
366        application_id: u64,
367        /// The ID of the entitlement.
368        entitlement_id: u64,
369    },
370    /// Route information to edit an application emoji.
371    UpdateApplicationEmoji {
372        /// The ID of the application.
373        application_id: u64,
374        /// The ID of the emoji.
375        emoji_id: u64,
376    },
377    /// Route information to end a poll.
378    EndPoll {
379        channel_id: u64,
380        message_id: u64,
381    },
382    /// Route information to execute a webhook by ID and token.
383    ExecuteWebhook {
384        /// ID of the thread channel, if there is one.
385        thread_id: Option<u64>,
386        /// The token of the webhook.
387        token: &'a str,
388        /// Whether to wait for a message response.
389        wait: Option<bool>,
390        /// The ID of the webhook.
391        webhook_id: u64,
392    },
393    /// Route information to follow a news channel.
394    FollowNewsChannel {
395        /// The ID of the channel to follow.
396        channel_id: u64,
397    },
398    /// Route information to get active threads in a channel.
399    GetActiveThreads {
400        /// ID of the guild.
401        guild_id: u64,
402    },
403    GetApplicationEmojis {
404        /// The ID of the application.
405        application_id: u64,
406    },
407    /// Route information for fetching poll vote information.
408    GetAnswerVoters {
409        /// Get users after this user ID.
410        after: Option<u64>,
411        /// The id of the poll answer.
412        answer_id: u8,
413        /// The ID of the channel the poll is in.
414        channel_id: u64,
415        /// The maximum number of users to return (1-100).
416        limit: Option<u8>,
417        /// The message ID of the poll.
418        message_id: u64,
419    },
420    /// Route information to get a paginated list of audit logs in a guild.
421    GetAuditLogs {
422        /// The type of action to get audit logs for.
423        action_type: Option<u64>,
424        /// The minimum ID of audit logs to get.
425        after: Option<u64>,
426        /// The maximum ID of audit logs to get.
427        before: Option<u64>,
428        /// The ID of the guild.
429        guild_id: u64,
430        /// The maximum number of audit logs to get.
431        limit: Option<u16>,
432        /// The ID of the user, if specified.
433        user_id: Option<u64>,
434    },
435    /// Route information to get an auto moderation rule for a guild.
436    GetAutoModerationRule {
437        /// ID of the guild.
438        guild_id: u64,
439        /// ID of the auto moderation rule.
440        auto_moderation_rule_id: u64,
441    },
442    /// Route information to get information about a single ban in a guild.
443    GetBan {
444        /// The ID of the guild.
445        guild_id: u64,
446        /// The ID of the user.
447        user_id: u64,
448    },
449    /// Route information to get a guild's bans.
450    GetBans {
451        /// The ID of the guild.
452        guild_id: u64,
453    },
454    /// Route information to get a guild's bans with parameters.
455    GetBansWithParameters {
456        /// User ID after which to retrieve bans.
457        after: Option<u64>,
458        /// User ID before which to retrieve bans.
459        before: Option<u64>,
460        /// Maximum number of bans to retrieve.
461        limit: Option<u16>,
462        /// ID of the guild.
463        guild_id: u64,
464    },
465    /// Route information to get a channel.
466    GetChannel {
467        /// The ID of the channel.
468        channel_id: u64,
469    },
470    /// Route information to get a channel's invites.
471    GetChannelInvites {
472        /// The ID of the channel.
473        channel_id: u64,
474    },
475    /// Route information to get a channel's webhooks.
476    GetChannelWebhooks {
477        /// The ID of the channel.
478        channel_id: u64,
479    },
480    /// Route information to get a guild's channels.
481    GetChannels {
482        /// The ID of the guild.
483        guild_id: u64,
484    },
485    /// Route information to get permissions of a specific guild command.
486    GetCommandPermissions {
487        /// The ID of the application.
488        application_id: u64,
489        /// The ID of the command.
490        command_id: u64,
491        /// The ID of the guild.
492        guild_id: u64,
493    },
494    /// Route information to get the current OAuth2 authorization information.
495    GetCurrentAuthorizationInformation,
496    /// Route information to get the current user.
497    GetCurrentUser,
498    /// Route information to get info about application the current bot user belongs to
499    GetCurrentUserApplicationInfo,
500    /// Route information to get the current user as a member object within a guild.
501    GetCurrentUserGuildMember {
502        /// ID of the guild.
503        guild_id: u64,
504    },
505    /// Route information to get the current user's voice state.
506    GetCurrentUserVoiceState {
507        /// ID of the guild.
508        guild_id: u64,
509    },
510    /// Route information to get an emoji by ID within a guild.
511    GetEmoji {
512        /// The ID of the emoji.
513        emoji_id: u64,
514        /// The ID of the guild.
515        guild_id: u64,
516    },
517    /// Route information to get a guild's emojis.
518    GetEmojis {
519        /// The ID of the guild.
520        guild_id: u64,
521    },
522    GetEntitlements {
523        /// Retrieve entitlements after this time.
524        after: Option<u64>,
525        /// The ID of the application.
526        application_id: u64,
527        /// Retrieve entitlements before this time.
528        before: Option<u64>,
529        /// Whether to exclude ended entitlements.
530        exclude_ended: Option<bool>,
531        /// Guild ID to look up entitlements for.
532        guild_id: Option<u64>,
533        /// Number of entitlements to return. Set to 100 if unspecified.
534        limit: Option<u8>,
535        /// List of SKU IDs to check entitlements for.
536        sku_ids: &'a [Id<SkuMarker>],
537        /// User ID to look up entitlements for.
538        user_id: Option<u64>,
539    },
540    /// Route to get a followup message for an interaction.
541    GetFollowupMessage {
542        /// ID of the application.
543        application_id: u64,
544        /// Token of the interaction.
545        interaction_token: &'a str,
546        /// ID of the thread channel, if there is one.
547        thread_id: Option<u64>,
548        /// ID of the followup message.
549        message_id: u64,
550    },
551    /// Route information to get basic gateway information.
552    GetGateway,
553    /// Route information to get gateway information tailored to the current
554    /// user.
555    GetGatewayBot,
556    /// Route information to get a global command for an application.
557    GetGlobalCommand {
558        /// ID of the owner application.
559        application_id: u64,
560        /// ID of the command.
561        command_id: u64,
562    },
563    GetGlobalCommands {
564        /// The ID of the owner application.
565        application_id: u64,
566        /// Whether to include full localization dictionaries.
567        with_localizations: Option<bool>,
568    },
569    /// Route information to get a guild.
570    GetGuild {
571        /// The ID of the guild.
572        guild_id: u64,
573        /// Whether to include approximate member and presence counts for the
574        /// guild.
575        with_counts: bool,
576    },
577    /// Route information to get a list of automation rules for a guild.
578    GetGuildAutoModerationRules {
579        /// ID of the guild.
580        guild_id: u64,
581    },
582    /// Route information to get a guild command.
583    GetGuildCommand {
584        /// ID of the owner application.
585        application_id: u64,
586        /// ID of the command.
587        command_id: u64,
588        /// ID of the guild.
589        guild_id: u64,
590    },
591    /// Route information to get permissions of all guild commands.
592    GetGuildCommandPermissions {
593        /// The ID of the application.
594        application_id: u64,
595        /// The ID of the guild.
596        guild_id: u64,
597    },
598    /// Route information to get guild commands.
599    GetGuildCommands {
600        /// The ID of the owner application.
601        application_id: u64,
602        /// The ID of the guild.
603        guild_id: u64,
604        /// Whether to include full localization dictionaries.
605        with_localizations: Option<bool>,
606    },
607    /// Route information to get a guild's integrations.
608    GetGuildIntegrations {
609        /// The ID of the guild.
610        guild_id: u64,
611    },
612    /// Route information to get a guild's invites.
613    GetGuildInvites {
614        /// The ID of the guild.
615        guild_id: u64,
616    },
617    /// Route information to get a guild's members.
618    GetGuildMembers {
619        /// The minimum ID of members to get.
620        after: Option<u64>,
621        /// The ID of the guild.
622        guild_id: u64,
623        /// The maximum number of members to get.
624        limit: Option<u16>,
625    },
626    /// Route information to get a guild's onboarding information.
627    GetGuildOnboarding {
628        /// The ID of the guild to get onboarding information for.
629        guild_id: u64,
630    },
631    /// Route information to get a guild's preview.
632    GetGuildPreview {
633        /// The ID of the guild.
634        guild_id: u64,
635    },
636    /// Route information to get the number of members that would be pruned,
637    /// filtering by inactivity and users with one of the provided roles.
638    GetGuildPruneCount {
639        /// The number of days that a user must be offline before being able to
640        /// be pruned.
641        days: Option<u16>,
642        /// The ID of the guild.
643        guild_id: u64,
644        /// The roles to filter the prune by.
645        ///
646        /// A user must have at least one of these roles to be able to be
647        /// pruned.
648        include_roles: &'a [Id<RoleMarker>],
649    },
650    /// Route information to get guild's roles.
651    GetGuildRoles {
652        /// The ID of the guild.
653        guild_id: u64,
654    },
655    /// Route information to get a guild scheduled event.
656    GetGuildScheduledEvent {
657        /// ID of the guild.
658        guild_id: u64,
659        // ID of the scheduled event.
660        scheduled_event_id: u64,
661        /// Whether to include user counts.
662        with_user_count: bool,
663    },
664    /// Route information to get a guild scheduled event's members.
665    GetGuildScheduledEventUsers {
666        /// Get members after this ID.
667        after: Option<u64>,
668        /// Get members before this ID.
669        before: Option<u64>,
670        /// ID of the guild.
671        guild_id: u64,
672        /// Maximum amount of members to get.
673        limit: Option<u16>,
674        /// ID of the scheduled event.
675        scheduled_event_id: u64,
676        /// Whether to return a member object.
677        with_member: bool,
678    },
679    /// Route information to get a guild's scheduled events.
680    GetGuildScheduledEvents {
681        /// ID of the guild.
682        guild_id: u64,
683        /// Whether to include user counts.
684        with_user_count: bool,
685    },
686    /// Route information to get a guild's sticker.
687    GetGuildSticker {
688        /// ID of the guild.
689        guild_id: u64,
690        /// ID of the stickers.
691        sticker_id: u64,
692    },
693    /// Route information to get a guild's stickers.
694    GetGuildStickers {
695        /// ID of the guild.
696        guild_id: u64,
697    },
698    /// Route information to get a guild's vanity URL.
699    GetGuildVanityUrl {
700        /// The ID of the guild.
701        guild_id: u64,
702    },
703    /// Route information to get a guild's available voice regions.
704    GetGuildVoiceRegions {
705        /// The ID of the guild.
706        guild_id: u64,
707    },
708    /// Route information to get a guild's webhooks.
709    GetGuildWebhooks {
710        /// The ID of the guild.
711        guild_id: u64,
712    },
713    /// Route information to get a guild's welcome screen.
714    GetGuildWelcomeScreen {
715        /// ID of the guild.
716        guild_id: u64,
717    },
718    /// Route information to get a guild's widget.
719    GetGuildWidget {
720        /// ID of the guild.
721        guild_id: u64,
722    },
723    /// Route information to get a guild's widget settings.
724    GetGuildWidgetSettings {
725        /// ID of the guild.
726        guild_id: u64,
727    },
728    /// Route information to get a paginated list of guilds.
729    GetGuilds {
730        /// The minimum ID of guilds to get.
731        after: Option<u64>,
732        /// The maximum ID of guilds to get.
733        before: Option<u64>,
734        /// The maximum number of guilds to get.
735        limit: Option<u16>,
736    },
737    /// Route information to get an original interaction response message.
738    GetInteractionOriginal {
739        /// ID of the owner application.
740        application_id: u64,
741        /// Token of the interaction.
742        interaction_token: &'a str,
743    },
744    /// Route information to get an invite.
745    GetInvite {
746        /// The unique invite code.
747        code: &'a str,
748        /// Whether to retrieve statistics about the invite.
749        with_counts: bool,
750    },
751    /// Route information to get an invite with an expiration.
752    GetInviteWithExpiration {
753        /// The unique invite code.
754        code: &'a str,
755        /// Whether to retrieve statistics about the invite.
756        with_counts: bool,
757        /// Whether to retrieve the expiration date of the invite.
758        with_expiration: bool,
759    },
760    /// Route information to get joined private archived threads in a channel.
761    GetJoinedPrivateArchivedThreads {
762        /// Optional timestamp to return threads before.
763        before: Option<u64>,
764        /// ID of the channel.
765        channel_id: u64,
766        /// Optional maximum number of threads to return.
767        limit: Option<u64>,
768    },
769    /// Route information to get a member.
770    GetMember {
771        /// The ID of the guild.
772        guild_id: u64,
773        /// The ID of the user.
774        user_id: u64,
775    },
776    /// Route information to get a single message in a channel.
777    GetMessage {
778        /// The ID of the channel.
779        channel_id: u64,
780        /// The ID of the message.
781        message_id: u64,
782    },
783    /// Route information to get a paginated list of messages in a channel.
784    GetMessages {
785        /// The minimum ID of messages to get.
786        after: Option<u64>,
787        /// The message ID to get the messages around.
788        around: Option<u64>,
789        /// The maximum ID of messages to get.
790        before: Option<u64>,
791        /// The ID of the channel.
792        channel_id: u64,
793        /// The maximum number of messages to get.
794        limit: Option<u16>,
795    },
796    /// Route information to get a list of sticker packs available to Nitro
797    /// subscribers.
798    GetNitroStickerPacks,
799    /// Route information to get a channel's pins.
800    GetPins {
801        /// The ID of the channel.
802        channel_id: u64,
803    },
804    /// Route information to get private archived threads in a channel.
805    GetPrivateArchivedThreads {
806        /// Optional timestamp to return threads before.
807        before: Option<&'a str>,
808        /// ID of the channel.
809        channel_id: u64,
810        /// Optional maximum number of threads to return.
811        limit: Option<u64>,
812    },
813    /// Route information to get public archived threads in a channel.
814    GetPublicArchivedThreads {
815        /// Optional timestamp to return threads before.
816        before: Option<&'a str>,
817        /// ID of the channel.
818        channel_id: u64,
819        /// Optional maximum number of threads to return.
820        limit: Option<u64>,
821    },
822    /// Route information to get the users who reacted to a message with a
823    /// specified emoji.
824    GetReactionUsers {
825        /// The minimum ID of users to get.
826        after: Option<u64>,
827        /// The ID of the channel.
828        channel_id: u64,
829        /// The URI encoded custom or unicode emoji.
830        emoji: &'a RequestReactionType<'a>,
831        /// The maximum number of users to retrieve.
832        limit: Option<u16>,
833        /// The ID of the message.
834        message_id: u64,
835        /// The type of reactions to fetch.
836        kind: Option<u8>,
837    },
838    /// Route information to get a guild's role.
839    GetRole {
840        /// The ID of the guild.
841        guild_id: u64,
842        /// The ID of the role.
843        role_id: u64,
844    },
845    GetSKUs {
846        /// The ID of the application.
847        application_id: u64,
848    },
849    /// Route information to get a stage instance.
850    GetStageInstance {
851        /// ID of the stage channel.
852        channel_id: u64,
853    },
854    /// Route information to get a sticker.
855    GetSticker {
856        /// ID of the sticker.
857        sticker_id: u64,
858    },
859    /// Route information to get a template.
860    GetTemplate {
861        /// The template code.
862        template_code: &'a str,
863    },
864    /// Route information to get a list of templates from a guild.
865    GetTemplates {
866        /// The ID of the guild.
867        guild_id: u64,
868    },
869    /// Route information to get a member of a thread.
870    GetThreadMember {
871        /// ID of the thread.
872        channel_id: u64,
873        /// ID of the member.
874        user_id: u64,
875    },
876    /// Route information to get members of a thread.
877    GetThreadMembers {
878        /// Fetch thread members after this user ID.
879        after: Option<u64>,
880        /// ID of the thread.
881        channel_id: u64,
882        /// Maximum number of thread members to return.
883        ///
884        /// Must be between 1 and 100. Defaults to 100.
885        limit: Option<u32>,
886        /// Whether to include associated member objects.
887        with_member: Option<bool>,
888    },
889    /// Route information to get a user.
890    GetUser {
891        /// ID of the target user.
892        user_id: u64,
893    },
894    /// Route information to get the current user's connections.
895    GetUserConnections,
896    /// Route information to get the current user's private channels and groups.
897    GetUserPrivateChannels,
898    /// Route information to get a user's voice state.
899    GetUserVoiceState {
900        /// The ID of the guild.
901        guild_id: u64,
902        /// ID of the target user.
903        user_id: u64,
904    },
905    /// Route information to get a list of the voice regions.
906    GetVoiceRegions,
907    /// Route information to get a webhook by ID, optionally with a token if the
908    /// current user doesn't have access to it.
909    GetWebhook {
910        /// The token of the webhook.
911        token: Option<&'a str>,
912        /// The ID of the webhook.
913        webhook_id: u64,
914    },
915    /// Route information to get a previously-sent webhook message.
916    GetWebhookMessage {
917        /// ID of the message.
918        message_id: u64,
919        /// ID of the thread channel, if there is one.
920        thread_id: Option<u64>,
921        /// Token of the webhook.
922        token: &'a str,
923        /// ID of the webhook.
924        webhook_id: u64,
925    },
926    /// Route information to respond to an interaction.
927    InteractionCallback {
928        /// The ID of the interaction.
929        interaction_id: u64,
930        /// The token for the interaction.
931        interaction_token: &'a str,
932    },
933    /// Route information to join a thread as the current user.
934    JoinThread {
935        /// ID of the thread.
936        channel_id: u64,
937    },
938    /// Route information to leave the guild.
939    LeaveGuild {
940        /// The ID of the guild.
941        guild_id: u64,
942    },
943    /// Route information to leave a thread as the current user.
944    LeaveThread {
945        /// ID of the thread.
946        channel_id: u64,
947    },
948    /// Route information to pin a message to a channel.
949    PinMessage {
950        /// The ID of the channel.
951        channel_id: u64,
952        /// The ID of the message.
953        message_id: u64,
954    },
955    /// Route information to remove a member from a guild.
956    RemoveMember {
957        /// The ID of the guild.
958        guild_id: u64,
959        /// The ID of the user.
960        user_id: u64,
961    },
962    /// Route information to remove a role from a member.
963    RemoveMemberRole {
964        /// The ID of the guild.
965        guild_id: u64,
966        /// The ID of the role.
967        role_id: u64,
968        /// The ID of the user.
969        user_id: u64,
970    },
971    /// Route information to remove a member from a thread.
972    RemoveThreadMember {
973        /// ID of the thread.
974        channel_id: u64,
975        /// ID of the member.
976        user_id: u64,
977    },
978    /// Route information to search for members in a guild.
979    SearchGuildMembers {
980        /// ID of the guild to search in.
981        guild_id: u64,
982        /// Upper limit of members to query for.
983        limit: Option<u16>,
984        /// Query to search by.
985        query: &'a str,
986    },
987    /// Route information to set global commands.
988    SetGlobalCommands {
989        /// The ID of the owner application.
990        application_id: u64,
991    },
992    /// Route information to set guild commands.
993    SetGuildCommands {
994        /// The ID of the owner application.
995        application_id: u64,
996        /// The ID of the guild.
997        guild_id: u64,
998    },
999    /// Route information to sync a guild's integration.
1000    SyncGuildIntegration {
1001        /// The ID of the guild.
1002        guild_id: u64,
1003        /// The ID of the integration.
1004        integration_id: u64,
1005    },
1006    /// Route information to sync a template.
1007    SyncTemplate {
1008        /// The ID of the guild.
1009        guild_id: u64,
1010        /// The template code.
1011        template_code: &'a str,
1012    },
1013    /// Route information to unpin a message from a channel.
1014    UnpinMessage {
1015        /// The ID of the channel.
1016        channel_id: u64,
1017        /// The ID of the message.
1018        message_id: u64,
1019    },
1020    /// Route information to update an auto moderation rule for a guild.
1021    UpdateAutoModerationRule {
1022        /// ID of the auto moderation rule.
1023        auto_moderation_rule_id: u64,
1024        /// ID of the guild.
1025        guild_id: u64,
1026    },
1027    /// Route information to update a channel, such as a guild channel or group.
1028    UpdateChannel {
1029        /// The ID of the channel.
1030        channel_id: u64,
1031    },
1032    /// Route information to edit permissions of a command in a guild.
1033    UpdateCommandPermissions {
1034        /// The ID of the application.
1035        application_id: u64,
1036        /// The ID of the command.
1037        command_id: u64,
1038        /// The ID of the guild.
1039        guild_id: u64,
1040    },
1041    /// Route information to update the current member.
1042    UpdateCurrentMember {
1043        /// ID of the guild.
1044        guild_id: u64,
1045    },
1046    /// Route information to update the current user.
1047    UpdateCurrentUser,
1048    /// Route information to update the current user's voice state.
1049    UpdateCurrentUserVoiceState {
1050        /// ID of the guild.
1051        guild_id: u64,
1052    },
1053    /// Route information to update an emoji.
1054    UpdateEmoji {
1055        /// The ID of the emoji.
1056        emoji_id: u64,
1057        /// The ID of the guild.
1058        guild_id: u64,
1059    },
1060    /// Route information to update a global command.
1061    UpdateGlobalCommand {
1062        /// The ID of the owner application.
1063        application_id: u64,
1064        /// The ID of the command.
1065        command_id: u64,
1066    },
1067    /// Route information to update a guild.
1068    UpdateGuild {
1069        /// The ID of the guild.
1070        guild_id: u64,
1071    },
1072    /// Route information to update a guild channel.
1073    UpdateGuildChannels {
1074        /// The ID of the guild.
1075        guild_id: u64,
1076    },
1077    /// Route information to update a guild command.
1078    UpdateGuildCommand {
1079        /// The ID of the owner application.
1080        application_id: u64,
1081        /// The ID of the command.
1082        command_id: u64,
1083        /// The ID of the guild.
1084        guild_id: u64,
1085    },
1086    /// Route information to update a guild's integration.
1087    UpdateGuildIntegration {
1088        /// The ID of the guild.
1089        guild_id: u64,
1090        /// The ID of the integration.
1091        integration_id: u64,
1092    },
1093    /// Route information to update a guild's MFA level.
1094    UpdateGuildMfa {
1095        /// ID of the guild.
1096        guild_id: u64,
1097    },
1098    UpdateGuildOnboarding {
1099        /// The ID of the guild to update onboarding information for.
1100        guild_id: u64,
1101    },
1102    /// Route information to update a scheduled event in a guild.
1103    UpdateGuildScheduledEvent {
1104        /// ID of the guild.
1105        guild_id: u64,
1106        /// ID of the scheduled event.
1107        scheduled_event_id: u64,
1108    },
1109    /// Route information to update a guild sticker.
1110    UpdateGuildSticker {
1111        /// ID of the guild.
1112        guild_id: u64,
1113        /// ID of the sticker.
1114        sticker_id: u64,
1115    },
1116    /// Route information to update a guild's welcome screen.
1117    UpdateGuildWelcomeScreen {
1118        /// ID of the guild.
1119        guild_id: u64,
1120    },
1121    /// Route information to update a guild's widget settings.
1122    UpdateGuildWidgetSettings {
1123        /// ID of the guild.
1124        guild_id: u64,
1125    },
1126    /// Update the original interaction response.
1127    UpdateInteractionOriginal {
1128        /// The ID of the owner application.
1129        application_id: u64,
1130        /// The token for the interaction.
1131        interaction_token: &'a str,
1132    },
1133    /// Route information to update a member.
1134    UpdateMember {
1135        /// The ID of the guild.
1136        guild_id: u64,
1137        /// The ID of the user.
1138        user_id: u64,
1139    },
1140    /// Route information to update a message.
1141    UpdateMessage {
1142        /// The ID of the channel.
1143        channel_id: u64,
1144        /// The ID of the message.
1145        message_id: u64,
1146    },
1147    /// Route information to update the current member's nickname.
1148    UpdateNickname {
1149        /// The ID of the guild.
1150        guild_id: u64,
1151    },
1152    /// Route information to update the permission overwrite of a role or user
1153    /// in a channel.
1154    UpdatePermissionOverwrite {
1155        /// The ID of the channel.
1156        channel_id: u64,
1157        /// The ID of the role or user.
1158        target_id: u64,
1159    },
1160    /// Route information to update a role.
1161    UpdateRole {
1162        /// The ID of the guild.
1163        guild_id: u64,
1164        /// The ID of the role.
1165        role_id: u64,
1166    },
1167    /// Route information to update the positions of roles.
1168    UpdateRolePositions {
1169        /// The ID of the guild.
1170        guild_id: u64,
1171    },
1172    /// Route information to update an existing stage instance.
1173    UpdateStageInstance {
1174        /// ID of the stage channel.
1175        channel_id: u64,
1176    },
1177    /// Route information to update a template.
1178    UpdateTemplate {
1179        /// The ID of the guild.
1180        guild_id: u64,
1181        /// The template code.
1182        template_code: &'a str,
1183    },
1184    /// Route information to update a user's voice state.
1185    UpdateUserVoiceState {
1186        /// ID of the guild.
1187        guild_id: u64,
1188        /// ID of the user.
1189        user_id: u64,
1190    },
1191    /// Route information to update a webhook.
1192    UpdateWebhook {
1193        /// The token of the webhook.
1194        token: Option<&'a str>,
1195        /// The ID of the webhook.
1196        webhook_id: u64,
1197    },
1198    /// Route information to update a message created by a webhook.
1199    UpdateWebhookMessage {
1200        message_id: u64,
1201        /// ID of the thread channel, if there is one.
1202        thread_id: Option<u64>,
1203        token: &'a str,
1204        webhook_id: u64,
1205    },
1206    UpdateCurrentUserApplication,
1207}
1208
1209impl Route<'_> {
1210    /// HTTP method of the route.
1211    ///
1212    /// # Examples
1213    ///
1214    /// Assert that the [`GetGuild`] route returns [`Method::Get`]:
1215    ///
1216    /// ```
1217    /// use twilight_http::{request::Method, routing::Route};
1218    ///
1219    /// let route = Route::GetGuild {
1220    ///     guild_id: 123,
1221    ///     with_counts: false,
1222    /// };
1223    ///
1224    /// assert_eq!(Method::Get, route.method());
1225    /// ```
1226    ///
1227    /// [`GetGuild`]: Self::GetGuild
1228    #[allow(clippy::too_many_lines)]
1229    pub const fn method(&self) -> Method {
1230        match self {
1231            Self::DeleteAutoModerationRule { .. }
1232            | Self::DeleteApplicationEmoji { .. }
1233            | Self::DeleteBan { .. }
1234            | Self::DeleteChannel { .. }
1235            | Self::DeleteEmoji { .. }
1236            | Self::DeleteGlobalCommand { .. }
1237            | Self::DeleteGuild { .. }
1238            | Self::DeleteGuildCommand { .. }
1239            | Self::DeleteGuildIntegration { .. }
1240            | Self::DeleteGuildScheduledEvent { .. }
1241            | Self::DeleteGuildSticker { .. }
1242            | Self::DeleteTestEntitlement { .. }
1243            | Self::DeleteInteractionOriginal { .. }
1244            | Self::DeleteInvite { .. }
1245            | Self::DeleteMessageReactions { .. }
1246            | Self::DeleteMessageSpecificReaction { .. }
1247            | Self::DeleteMessage { .. }
1248            | Self::DeletePermissionOverwrite { .. }
1249            | Self::DeleteReactionCurrentUser { .. }
1250            | Self::DeleteReaction { .. }
1251            | Self::DeleteRole { .. }
1252            | Self::DeleteStageInstance { .. }
1253            | Self::DeleteTemplate { .. }
1254            | Self::DeleteWebhookMessage { .. }
1255            | Self::DeleteWebhook { .. }
1256            | Self::LeaveGuild { .. }
1257            | Self::LeaveThread { .. }
1258            | Self::RemoveMember { .. }
1259            | Self::RemoveMemberRole { .. }
1260            | Self::RemoveThreadMember { .. }
1261            | Self::UnpinMessage { .. } => Method::Delete,
1262            Self::GetActiveThreads { .. }
1263            | Self::GetApplicationEmojis { .. }
1264            | Self::GetAnswerVoters { .. }
1265            | Self::GetAuditLogs { .. }
1266            | Self::GetAutoModerationRule { .. }
1267            | Self::GetBan { .. }
1268            | Self::GetBans { .. }
1269            | Self::GetBansWithParameters { .. }
1270            | Self::GetGatewayBot
1271            | Self::GetChannel { .. }
1272            | Self::GetChannelInvites { .. }
1273            | Self::GetChannelWebhooks { .. }
1274            | Self::GetChannels { .. }
1275            | Self::GetCommandPermissions { .. }
1276            | Self::GetCurrentAuthorizationInformation
1277            | Self::GetCurrentUserApplicationInfo
1278            | Self::GetCurrentUser
1279            | Self::GetCurrentUserGuildMember { .. }
1280            | Self::GetCurrentUserVoiceState { .. }
1281            | Self::GetEmoji { .. }
1282            | Self::GetEmojis { .. }
1283            | Self::GetEntitlements { .. }
1284            | Self::GetGateway
1285            | Self::GetFollowupMessage { .. }
1286            | Self::GetGlobalCommand { .. }
1287            | Self::GetGlobalCommands { .. }
1288            | Self::GetGuild { .. }
1289            | Self::GetGuildAutoModerationRules { .. }
1290            | Self::GetGuildCommand { .. }
1291            | Self::GetGuildCommandPermissions { .. }
1292            | Self::GetGuildCommands { .. }
1293            | Self::GetGuildIntegrations { .. }
1294            | Self::GetGuildInvites { .. }
1295            | Self::GetGuildMembers { .. }
1296            | Self::GetGuildOnboarding { .. }
1297            | Self::GetGuildPreview { .. }
1298            | Self::GetGuildPruneCount { .. }
1299            | Self::GetGuildRoles { .. }
1300            | Self::GetGuildScheduledEvent { .. }
1301            | Self::GetGuildScheduledEventUsers { .. }
1302            | Self::GetGuildScheduledEvents { .. }
1303            | Self::GetGuildSticker { .. }
1304            | Self::GetGuildStickers { .. }
1305            | Self::GetGuildVanityUrl { .. }
1306            | Self::GetGuildVoiceRegions { .. }
1307            | Self::GetGuildWelcomeScreen { .. }
1308            | Self::GetGuildWebhooks { .. }
1309            | Self::GetGuildWidget { .. }
1310            | Self::GetGuildWidgetSettings { .. }
1311            | Self::GetGuilds { .. }
1312            | Self::GetInteractionOriginal { .. }
1313            | Self::GetInvite { .. }
1314            | Self::GetInviteWithExpiration { .. }
1315            | Self::GetMember { .. }
1316            | Self::GetMessage { .. }
1317            | Self::GetMessages { .. }
1318            | Self::GetNitroStickerPacks { .. }
1319            | Self::GetPins { .. }
1320            | Self::GetJoinedPrivateArchivedThreads { .. }
1321            | Self::GetPrivateArchivedThreads { .. }
1322            | Self::GetPublicArchivedThreads { .. }
1323            | Self::GetReactionUsers { .. }
1324            | Self::GetRole { .. }
1325            | Self::GetSKUs { .. }
1326            | Self::GetStageInstance { .. }
1327            | Self::GetSticker { .. }
1328            | Self::GetTemplate { .. }
1329            | Self::GetTemplates { .. }
1330            | Self::GetThreadMember { .. }
1331            | Self::GetThreadMembers { .. }
1332            | Self::GetUser { .. }
1333            | Self::GetUserConnections
1334            | Self::GetUserPrivateChannels
1335            | Self::GetUserVoiceState { .. }
1336            | Self::GetVoiceRegions
1337            | Self::GetWebhook { .. }
1338            | Self::GetWebhookMessage { .. }
1339            | Self::SearchGuildMembers { .. } => Method::Get,
1340            Self::UpdateAutoModerationRule { .. }
1341            | Self::UpdateChannel { .. }
1342            | Self::UpdateCurrentMember { .. }
1343            | Self::UpdateCurrentUser
1344            | Self::UpdateCurrentUserVoiceState { .. }
1345            | Self::UpdateEmoji { .. }
1346            | Self::UpdateGlobalCommand { .. }
1347            | Self::UpdateGuild { .. }
1348            | Self::UpdateGuildChannels { .. }
1349            | Self::UpdateGuildCommand { .. }
1350            | Self::UpdateGuildMfa { .. }
1351            | Self::UpdateGuildWidgetSettings { .. }
1352            | Self::UpdateGuildIntegration { .. }
1353            | Self::UpdateGuildScheduledEvent { .. }
1354            | Self::UpdateGuildSticker { .. }
1355            | Self::UpdateGuildWelcomeScreen { .. }
1356            | Self::UpdateInteractionOriginal { .. }
1357            | Self::UpdateMember { .. }
1358            | Self::UpdateMessage { .. }
1359            | Self::UpdateNickname { .. }
1360            | Self::UpdateRole { .. }
1361            | Self::UpdateRolePositions { .. }
1362            | Self::UpdateStageInstance { .. }
1363            | Self::UpdateTemplate { .. }
1364            | Self::UpdateUserVoiceState { .. }
1365            | Self::UpdateWebhookMessage { .. }
1366            | Self::UpdateCurrentUserApplication
1367            | Self::UpdateApplicationEmoji { .. }
1368            | Self::UpdateWebhook { .. } => Method::Patch,
1369            Self::CreateChannel { .. }
1370            | Self::AddApplicationEmoji { .. }
1371            | Self::CreateGlobalCommand { .. }
1372            | Self::CreateGuildCommand { .. }
1373            | Self::CreateEmoji { .. }
1374            | Self::CreateForumThread { .. }
1375            | Self::CreateGuild
1376            | Self::CreateAutoModerationRule { .. }
1377            | Self::CreateGuildFromTemplate { .. }
1378            | Self::CreateGuildIntegration { .. }
1379            | Self::CreateGuildPrune { .. }
1380            | Self::CreateGuildScheduledEvent { .. }
1381            | Self::CreateGuildSticker { .. }
1382            | Self::CreateInvite { .. }
1383            | Self::CreateMessage { .. }
1384            | Self::CreatePrivateChannel
1385            | Self::CreateThread { .. }
1386            | Self::CreateThreadFromMessage { .. }
1387            | Self::CreateRole { .. }
1388            | Self::CreateStageInstance { .. }
1389            | Self::CreateTemplate { .. }
1390            | Self::CreateTestEntitlement { .. }
1391            | Self::CreateTypingTrigger { .. }
1392            | Self::CreateWebhook { .. }
1393            | Self::CrosspostMessage { .. }
1394            | Self::DeleteMessages { .. }
1395            | Self::EndPoll { .. }
1396            | Self::ExecuteWebhook { .. }
1397            | Self::FollowNewsChannel { .. }
1398            | Self::InteractionCallback { .. }
1399            | Self::SyncGuildIntegration { .. } => Method::Post,
1400            Self::AddGuildMember { .. }
1401            | Self::AddMemberRole { .. }
1402            | Self::AddThreadMember { .. }
1403            | Self::CreateBan { .. }
1404            | Self::CreateReaction { .. }
1405            | Self::JoinThread { .. }
1406            | Self::PinMessage { .. }
1407            | Self::SetGlobalCommands { .. }
1408            | Self::SetGuildCommands { .. }
1409            | Self::SyncTemplate { .. }
1410            | Self::UpdateCommandPermissions { .. }
1411            | Self::UpdateGuildOnboarding { .. }
1412            | Self::UpdatePermissionOverwrite { .. } => Method::Put,
1413        }
1414    }
1415
1416    /// Typed path of the route.
1417    ///
1418    /// Paths are used with a [`Ratelimiter`].
1419    ///
1420    /// # Examples
1421    ///
1422    /// Use a route's path to retrieve a ratelimiter ticket:
1423    ///
1424    /// ```
1425    /// # #[tokio::main]
1426    /// # async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
1427    /// use twilight_http::routing::Route;
1428    /// use twilight_http_ratelimiting::{InMemoryRatelimiter, Ratelimiter};
1429    ///
1430    /// let ratelimiter = InMemoryRatelimiter::new();
1431    /// let route = Route::CreateMessage { channel_id: 123 };
1432    ///
1433    /// // Take a ticket from the ratelimiter.
1434    /// let rx = ratelimiter.ticket(route.to_path()).await?;
1435    ///
1436    /// // Wait to be told that a request can be made...
1437    /// let _tx = rx.await;
1438    ///
1439    /// // The request can now be made.
1440    /// # Ok(()) }
1441    /// ```
1442    ///
1443    /// [`Ratelimiter`]: twilight_http_ratelimiting::Ratelimiter
1444    #[allow(clippy::too_many_lines)]
1445    pub fn to_path(&self) -> Path {
1446        match *self {
1447            Self::AddGuildMember { guild_id, .. }
1448            | Self::GetMember { guild_id, .. }
1449            | Self::RemoveMember { guild_id, .. }
1450            | Self::UpdateMember { guild_id, .. } => Path::GuildsIdMembersId(guild_id),
1451            Self::AddMemberRole { guild_id, .. } | Self::RemoveMemberRole { guild_id, .. } => {
1452                Path::GuildsIdMembersIdRolesId(guild_id)
1453            }
1454            Self::AddThreadMember { channel_id, .. }
1455            | Self::GetThreadMember { channel_id, .. }
1456            | Self::GetThreadMembers { channel_id, .. }
1457            | Self::JoinThread { channel_id, .. }
1458            | Self::LeaveThread { channel_id, .. }
1459            | Self::RemoveThreadMember { channel_id, .. } => {
1460                Path::ChannelsIdThreadMembers(channel_id)
1461            }
1462            Self::CreateAutoModerationRule { guild_id, .. }
1463            | Self::GetGuildAutoModerationRules { guild_id, .. } => {
1464                Path::GuildsIdAutoModerationRules(guild_id)
1465            }
1466            Self::CreateBan { guild_id, .. } | Self::DeleteBan { guild_id, .. } => {
1467                Path::GuildsIdBansUserId(guild_id)
1468            }
1469            Self::CreateChannel { guild_id } => Path::GuildsIdChannels(guild_id),
1470            Self::CreateEmoji { guild_id } | Self::GetEmojis { guild_id } => {
1471                Path::GuildsIdEmojis(guild_id)
1472            }
1473            Self::CreateGlobalCommand { application_id }
1474            | Self::GetGlobalCommands { application_id, .. }
1475            | Self::SetGlobalCommands { application_id } => {
1476                Path::ApplicationCommand(application_id)
1477            }
1478            Self::CreateGuild => Path::Guilds,
1479            Self::CreateGuildFromTemplate { template_code, .. }
1480            | Self::GetTemplate { template_code, .. } => {
1481                Path::GuildsTemplatesCode(template_code.to_string())
1482            }
1483            Self::CreateGuildCommand { application_id, .. }
1484            | Self::DeleteGuildCommand { application_id, .. }
1485            | Self::GetGuildCommand { application_id, .. }
1486            | Self::GetGuildCommandPermissions { application_id, .. }
1487            | Self::GetGuildCommands { application_id, .. }
1488            | Self::SetGuildCommands { application_id, .. }
1489            | Self::UpdateGuildCommand { application_id, .. } => {
1490                Path::ApplicationGuildCommand(application_id)
1491            }
1492            Self::CreateGuildIntegration { guild_id } => Path::GuildsIdIntegrationsId(guild_id),
1493            Self::CreateGuildPrune { guild_id, .. } | Self::GetGuildPruneCount { guild_id, .. } => {
1494                Path::GuildsIdPrune(guild_id)
1495            }
1496            Self::CreateGuildSticker { guild_id, .. }
1497            | Self::DeleteGuildSticker { guild_id, .. }
1498            | Self::GetGuildSticker { guild_id, .. }
1499            | Self::GetGuildStickers { guild_id, .. }
1500            | Self::UpdateGuildSticker { guild_id, .. } => Path::GuildsIdStickers(guild_id),
1501            Self::CreateInvite { channel_id } | Self::GetChannelInvites { channel_id } => {
1502                Path::ChannelsIdInvites(channel_id)
1503            }
1504            Self::CreateMessage { channel_id } | Self::GetMessages { channel_id, .. } => {
1505                Path::ChannelsIdMessages(channel_id)
1506            }
1507            Self::CreatePrivateChannel | Self::GetUserPrivateChannels => Path::UsersIdChannels,
1508            Self::CreateReaction { channel_id, .. }
1509            | Self::DeleteReactionCurrentUser { channel_id, .. }
1510            | Self::DeleteReaction { channel_id, .. } => {
1511                Path::ChannelsIdMessagesIdReactionsUserIdType(channel_id)
1512            }
1513            Self::CreateRole { guild_id } | Self::GetGuildRoles { guild_id } => {
1514                Path::GuildsIdRoles(guild_id)
1515            }
1516            Self::CreateStageInstance { .. }
1517            | Self::DeleteStageInstance { .. }
1518            | Self::GetStageInstance { .. }
1519            | Self::UpdateStageInstance { .. } => Path::StageInstances,
1520            Self::CreateTemplate { guild_id } | Self::GetTemplates { guild_id } => {
1521                Path::GuildsIdTemplates(guild_id)
1522            }
1523            Self::CreateForumThread { channel_id }
1524            | Self::CreateThread { channel_id, .. }
1525            | Self::GetJoinedPrivateArchivedThreads { channel_id, .. }
1526            | Self::GetPrivateArchivedThreads { channel_id, .. }
1527            | Self::GetPublicArchivedThreads { channel_id, .. } => {
1528                Path::ChannelsIdThreads(channel_id)
1529            }
1530            Self::CreateThreadFromMessage { channel_id, .. } => {
1531                Path::ChannelsIdMessagesIdThreads(channel_id)
1532            }
1533            Self::CreateTestEntitlement { application_id }
1534            | Self::GetEntitlements { application_id, .. }
1535            | Self::DeleteTestEntitlement { application_id, .. } => {
1536                Path::ApplicationIdEntitlements(application_id)
1537            }
1538            Self::CreateTypingTrigger { channel_id } => Path::ChannelsIdTyping(channel_id),
1539            Self::CreateWebhook { channel_id } | Self::GetChannelWebhooks { channel_id } => {
1540                Path::ChannelsIdWebhooks(channel_id)
1541            }
1542            Self::CrosspostMessage { channel_id, .. } => {
1543                Path::ChannelsIdMessagesIdCrosspost(channel_id)
1544            }
1545            Self::DeleteAutoModerationRule { guild_id, .. }
1546            | Self::GetAutoModerationRule { guild_id, .. }
1547            | Self::UpdateAutoModerationRule { guild_id, .. } => {
1548                Path::GuildsIdAutoModerationRulesId(guild_id)
1549            }
1550            Self::DeleteChannel { channel_id } => Path::ChannelsId(channel_id),
1551            Self::DeleteEmoji { guild_id, .. } => Path::GuildsIdEmojisId(guild_id),
1552            Self::DeleteGlobalCommand { application_id, .. }
1553            | Self::GetGlobalCommand { application_id, .. }
1554            | Self::UpdateGlobalCommand { application_id, .. } => {
1555                Path::ApplicationCommandId(application_id)
1556            }
1557            Self::DeleteGuild { guild_id } => Path::GuildsId(guild_id),
1558            Self::DeleteGuildIntegration { guild_id, .. }
1559            | Self::UpdateGuildIntegration { guild_id, .. } => {
1560                Path::GuildsIdIntegrationsId(guild_id)
1561            }
1562            Self::DeleteInteractionOriginal {
1563                application_id,
1564                interaction_token,
1565                ..
1566            }
1567            | Self::GetFollowupMessage {
1568                application_id,
1569                interaction_token,
1570                ..
1571            }
1572            | Self::GetInteractionOriginal {
1573                application_id,
1574                interaction_token,
1575                ..
1576            }
1577            | Self::UpdateInteractionOriginal {
1578                application_id,
1579                interaction_token,
1580                ..
1581            } => Path::WebhooksIdTokenMessagesId(application_id, interaction_token.to_string()),
1582            Self::DeleteInvite { .. }
1583            | Self::GetInvite { .. }
1584            | Self::GetInviteWithExpiration { .. } => Path::InvitesCode,
1585            Self::DeleteMessageReactions { channel_id, .. }
1586            | Self::DeleteMessageSpecificReaction { channel_id, .. }
1587            | Self::GetReactionUsers { channel_id, .. } => {
1588                Path::ChannelsIdMessagesIdReactions(channel_id)
1589            }
1590            Self::DeleteMessage { message_id, .. } => {
1591                Path::ChannelsIdMessagesId(Method::Delete, message_id)
1592            }
1593            Self::DeleteMessages { channel_id } => Path::ChannelsIdMessagesBulkDelete(channel_id),
1594            Self::DeletePermissionOverwrite { channel_id, .. }
1595            | Self::UpdatePermissionOverwrite { channel_id, .. } => {
1596                Path::ChannelsIdPermissionsOverwriteId(channel_id)
1597            }
1598            Self::DeleteRole { guild_id, .. }
1599            | Self::GetRole { guild_id, .. }
1600            | Self::UpdateRole { guild_id, .. }
1601            | Self::UpdateRolePositions { guild_id } => Path::GuildsIdRolesId(guild_id),
1602            Self::DeleteTemplate {
1603                guild_id,
1604                template_code,
1605                ..
1606            }
1607            | Self::SyncTemplate {
1608                guild_id,
1609                template_code,
1610                ..
1611            }
1612            | Self::UpdateTemplate {
1613                guild_id,
1614                template_code,
1615                ..
1616            } => Path::GuildsIdTemplatesCode(guild_id, template_code.to_string()),
1617            Self::DeleteWebhookMessage {
1618                webhook_id, token, ..
1619            }
1620            | Self::GetWebhookMessage {
1621                webhook_id, token, ..
1622            }
1623            | Self::UpdateWebhookMessage {
1624                webhook_id, token, ..
1625            } => Path::WebhooksIdTokenMessagesId(webhook_id, token.to_string()),
1626            Self::DeleteWebhook {
1627                webhook_id,
1628                token: Some(token),
1629                ..
1630            }
1631            | Self::ExecuteWebhook {
1632                webhook_id, token, ..
1633            }
1634            | Self::GetWebhook {
1635                webhook_id,
1636                token: Some(token),
1637                ..
1638            }
1639            | Self::UpdateWebhook {
1640                webhook_id,
1641                token: Some(token),
1642            } => Path::WebhooksIdToken(webhook_id, token.to_string()),
1643            Self::DeleteWebhook { webhook_id, .. }
1644            | Self::GetWebhook { webhook_id, .. }
1645            | Self::UpdateWebhook { webhook_id, .. } => Path::WebhooksId(webhook_id),
1646            Self::FollowNewsChannel { channel_id } => Path::ChannelsIdFollowers(channel_id),
1647            Self::GetActiveThreads { guild_id, .. } => Path::GuildsIdThreads(guild_id),
1648            Self::GetApplicationEmojis { application_id, .. }
1649            | Self::UpdateApplicationEmoji { application_id, .. }
1650            | Self::AddApplicationEmoji { application_id }
1651            | Self::DeleteApplicationEmoji { application_id, .. } => {
1652                Path::ApplicationEmojis(application_id)
1653            }
1654            Self::GetAuditLogs { guild_id, .. } => Path::GuildsIdAuditLogs(guild_id),
1655            Self::GetBan { guild_id, .. } => Path::GuildsIdBansId(guild_id),
1656            Self::GetBans { guild_id } | Self::GetBansWithParameters { guild_id, .. } => {
1657                Path::GuildsIdBans(guild_id)
1658            }
1659            Self::GetGatewayBot => Path::GatewayBot,
1660            Self::GetChannel { channel_id } | Self::UpdateChannel { channel_id } => {
1661                Path::ChannelsId(channel_id)
1662            }
1663            Self::GetChannels { guild_id } | Self::UpdateGuildChannels { guild_id } => {
1664                Path::GuildsIdChannels(guild_id)
1665            }
1666            Self::GetCommandPermissions { application_id, .. }
1667            | Self::UpdateCommandPermissions { application_id, .. } => {
1668                Path::ApplicationGuildCommandId(application_id)
1669            }
1670            Self::GetCurrentAuthorizationInformation => Path::OauthMe,
1671            Self::GetCurrentUserApplicationInfo | Self::UpdateCurrentUserApplication => {
1672                Path::ApplicationsMe
1673            }
1674            Self::GetCurrentUser | Self::GetUser { .. } | Self::UpdateCurrentUser => Path::UsersId,
1675            Self::GetCurrentUserGuildMember { .. } => Path::UsersIdGuildsIdMember,
1676            Self::GetEmoji { guild_id, .. } | Self::UpdateEmoji { guild_id, .. } => {
1677                Path::GuildsIdEmojisId(guild_id)
1678            }
1679            Self::GetGateway => Path::Gateway,
1680            Self::GetGuild { guild_id, .. } | Self::UpdateGuild { guild_id } => {
1681                Path::GuildsId(guild_id)
1682            }
1683            Self::GetGuildWidget { guild_id } => Path::GuildsIdWidgetJson(guild_id),
1684            Self::GetGuildWidgetSettings { guild_id }
1685            | Self::UpdateGuildWidgetSettings { guild_id } => Path::GuildsIdWidget(guild_id),
1686            Self::GetGuildIntegrations { guild_id } => Path::GuildsIdIntegrations(guild_id),
1687            Self::GetGuildInvites { guild_id } => Path::GuildsIdInvites(guild_id),
1688            Self::GetGuildMembers { guild_id, .. } | Self::UpdateCurrentMember { guild_id, .. } => {
1689                Path::GuildsIdMembers(guild_id)
1690            }
1691            Self::GetGuildOnboarding { guild_id } | Self::UpdateGuildOnboarding { guild_id } => {
1692                Path::GuildsIdOnboarding(guild_id)
1693            }
1694            Self::CreateGuildScheduledEvent { guild_id, .. }
1695            | Self::GetGuildScheduledEvents { guild_id, .. } => {
1696                Path::GuildsIdScheduledEvents(guild_id)
1697            }
1698            Self::DeleteGuildScheduledEvent { guild_id, .. }
1699            | Self::GetGuildScheduledEvent { guild_id, .. }
1700            | Self::UpdateGuildScheduledEvent { guild_id, .. } => {
1701                Path::GuildsIdScheduledEventsId(guild_id)
1702            }
1703            Self::GetGuildScheduledEventUsers { guild_id, .. } => {
1704                Path::GuildsIdScheduledEventsIdUsers(guild_id)
1705            }
1706            Self::GetGuildPreview { guild_id } => Path::GuildsIdPreview(guild_id),
1707            Self::GetGuildVanityUrl { guild_id } => Path::GuildsIdVanityUrl(guild_id),
1708            Self::GetGuildVoiceRegions { guild_id } => Path::GuildsIdRegions(guild_id),
1709            Self::GetGuildWelcomeScreen { guild_id }
1710            | Self::UpdateGuildWelcomeScreen { guild_id } => Path::GuildsIdWelcomeScreen(guild_id),
1711            Self::GetGuildWebhooks { guild_id } => Path::GuildsIdWebhooks(guild_id),
1712            Self::GetGuilds { .. } => Path::UsersIdGuilds,
1713            Self::GetMessage { channel_id, .. } => {
1714                Path::ChannelsIdMessagesId(Method::Get, channel_id)
1715            }
1716            Self::GetNitroStickerPacks { .. } => Path::StickerPacks,
1717            Self::GetPins { channel_id } | Self::PinMessage { channel_id, .. } => {
1718                Path::ChannelsIdPins(channel_id)
1719            }
1720            Self::GetSKUs { application_id } => Path::ApplicationIdSKUs(application_id),
1721            Self::GetSticker { .. } => Path::Stickers,
1722            Self::GetUserConnections => Path::UsersIdConnections,
1723            Self::GetVoiceRegions => Path::VoiceRegions,
1724            Self::InteractionCallback { interaction_id, .. } => {
1725                Path::InteractionCallback(interaction_id)
1726            }
1727            Self::LeaveGuild { .. } => Path::UsersIdGuildsId,
1728            Self::SearchGuildMembers { guild_id, .. } => Path::GuildsIdMembersSearch(guild_id),
1729            Self::SyncGuildIntegration { guild_id, .. } => {
1730                Path::GuildsIdIntegrationsIdSync(guild_id)
1731            }
1732            Self::UnpinMessage { channel_id, .. } => Path::ChannelsIdPinsMessageId(channel_id),
1733            Self::GetCurrentUserVoiceState { guild_id, .. }
1734            | Self::GetUserVoiceState { guild_id, .. }
1735            | Self::UpdateCurrentUserVoiceState { guild_id }
1736            | Self::UpdateUserVoiceState { guild_id, .. } => Path::GuildsIdVoiceStates(guild_id),
1737            Self::UpdateMessage { channel_id, .. } => {
1738                Path::ChannelsIdMessagesId(Method::Patch, channel_id)
1739            }
1740            Self::UpdateNickname { guild_id } => Path::GuildsIdMembersMeNick(guild_id),
1741            Self::UpdateGuildMfa { guild_id } => Path::GuildsIdMfa(guild_id),
1742            Self::EndPoll { channel_id, .. } | Self::GetAnswerVoters { channel_id, .. } => {
1743                Path::ChannelsIdPolls(channel_id)
1744            }
1745        }
1746    }
1747}
1748
1749/// Display formatter of the route portion of a URL.
1750///
1751/// # Examples
1752///
1753/// Create a formatted representation of the [`GetPins`] route:
1754///
1755/// ```
1756/// use twilight_http::routing::Route;
1757///
1758/// let route = Route::GetPins { channel_id: 123 };
1759/// assert_eq!("channels/123/pins", route.to_string());
1760/// ```
1761///
1762/// Create a formatted representation of the [`GetInvite`] route, which
1763/// includes a query parameter:
1764///
1765/// ```
1766/// use twilight_http::routing::Route;
1767///
1768/// let route = Route::GetInvite {
1769///     code: "twilight-rs",
1770///     with_counts: true,
1771/// };
1772///
1773/// assert_eq!("invites/twilight-rs?with_counts=true", route.to_string());
1774/// ```
1775///
1776/// [`GetInvite`]: Self::GetInvite
1777/// [`GetPins`]: Self::GetPins
1778impl Display for Route<'_> {
1779    // Notably, we don't use macros like `write!` or `format_args!` due to them
1780    // both compiling slowly and performing slowly during runtime.
1781    //
1782    // See:
1783    // <https://github.com/rust-lang/rust/issues/76490>
1784    // <https://github.com/rust-lang/rust/issues/10761>
1785    #[allow(clippy::too_many_lines)]
1786    fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
1787        match self {
1788            Route::AddGuildMember { guild_id, user_id }
1789            | Route::GetMember { guild_id, user_id }
1790            | Route::RemoveMember { guild_id, user_id }
1791            | Route::UpdateMember { guild_id, user_id } => {
1792                f.write_str("guilds/")?;
1793                Display::fmt(guild_id, f)?;
1794                f.write_str("/members/")?;
1795
1796                Display::fmt(user_id, f)
1797            }
1798            Route::AddMemberRole {
1799                guild_id,
1800                role_id,
1801                user_id,
1802            }
1803            | Route::RemoveMemberRole {
1804                guild_id,
1805                role_id,
1806                user_id,
1807            } => {
1808                f.write_str("guilds/")?;
1809                Display::fmt(guild_id, f)?;
1810                f.write_str("/members/")?;
1811                Display::fmt(user_id, f)?;
1812                f.write_str("/roles/")?;
1813
1814                Display::fmt(role_id, f)
1815            }
1816            Route::AddThreadMember {
1817                channel_id,
1818                user_id,
1819            }
1820            | Route::GetThreadMember {
1821                channel_id,
1822                user_id,
1823            }
1824            | Route::RemoveThreadMember {
1825                channel_id,
1826                user_id,
1827            } => {
1828                f.write_str("channels/")?;
1829                Display::fmt(channel_id, f)?;
1830                f.write_str("/thread-members/")?;
1831
1832                Display::fmt(user_id, f)
1833            }
1834            Route::CreateAutoModerationRule { guild_id, .. }
1835            | Route::GetGuildAutoModerationRules { guild_id, .. } => {
1836                f.write_str("guilds/")?;
1837                Display::fmt(guild_id, f)?;
1838
1839                f.write_str("/auto-moderation/rules")
1840            }
1841            Route::CreateChannel { guild_id }
1842            | Route::GetChannels { guild_id }
1843            | Route::UpdateGuildChannels { guild_id } => {
1844                f.write_str("guilds/")?;
1845                Display::fmt(guild_id, f)?;
1846
1847                f.write_str("/channels")
1848            }
1849            Route::CreateEmoji { guild_id } | Route::GetEmojis { guild_id } => {
1850                f.write_str("guilds/")?;
1851                Display::fmt(guild_id, f)?;
1852
1853                f.write_str("/emojis")
1854            }
1855            Route::CreateGlobalCommand { application_id }
1856            | Route::SetGlobalCommands { application_id } => {
1857                f.write_str("applications/")?;
1858                Display::fmt(application_id, f)?;
1859
1860                f.write_str("/commands")
1861            }
1862            Route::DeleteAutoModerationRule {
1863                auto_moderation_rule_id,
1864                guild_id,
1865                ..
1866            }
1867            | Route::GetAutoModerationRule {
1868                auto_moderation_rule_id,
1869                guild_id,
1870                ..
1871            }
1872            | Route::UpdateAutoModerationRule {
1873                auto_moderation_rule_id,
1874                guild_id,
1875                ..
1876            } => {
1877                f.write_str("guilds/")?;
1878                Display::fmt(guild_id, f)?;
1879                f.write_str("/auto-moderation/rules/")?;
1880
1881                Display::fmt(auto_moderation_rule_id, f)
1882            }
1883            Route::GetAnswerVoters {
1884                after,
1885                answer_id,
1886                channel_id,
1887                limit,
1888                message_id,
1889            } => {
1890                f.write_str("channels/")?;
1891                Display::fmt(channel_id, f)?;
1892                f.write_str("/polls/")?;
1893                Display::fmt(message_id, f)?;
1894                f.write_str("/answers/")?;
1895                Display::fmt(answer_id, f)?;
1896                f.write_str("?")?;
1897
1898                let mut writer = QueryStringFormatter::new(f);
1899                writer.write_opt_param("after", after.as_ref())?;
1900                writer.write_opt_param("limit", limit.as_ref())
1901            }
1902            Route::GetGlobalCommands {
1903                application_id,
1904                with_localizations,
1905            } => {
1906                f.write_str("applications/")?;
1907                Display::fmt(application_id, f)?;
1908                f.write_str("/commands")?;
1909
1910                let mut writer = QueryStringFormatter::new(f);
1911
1912                writer.write_opt_param("with_localizations", with_localizations.as_ref())
1913            }
1914            Route::CreateGuild => f.write_str("guilds"),
1915            Route::CreateGuildCommand {
1916                application_id,
1917                guild_id,
1918            }
1919            | Route::SetGuildCommands {
1920                application_id,
1921                guild_id,
1922            } => {
1923                f.write_str("applications/")?;
1924                Display::fmt(application_id, f)?;
1925                f.write_str("/guilds/")?;
1926                Display::fmt(guild_id, f)?;
1927
1928                f.write_str("/commands")
1929            }
1930            Route::GetGuildCommands {
1931                application_id,
1932                guild_id,
1933                with_localizations,
1934            } => {
1935                f.write_str("applications/")?;
1936                Display::fmt(application_id, f)?;
1937                f.write_str("/guilds/")?;
1938                Display::fmt(guild_id, f)?;
1939                f.write_str("/commands")?;
1940
1941                let mut writer = QueryStringFormatter::new(f);
1942                writer.write_opt_param("with_localizations", with_localizations.as_ref())
1943            }
1944            Route::CreateGuildFromTemplate { template_code }
1945            | Route::GetTemplate { template_code } => {
1946                f.write_str("guilds/templates/")?;
1947
1948                f.write_str(template_code)
1949            }
1950            Route::CreateTestEntitlement { application_id } => {
1951                f.write_str("applications/")?;
1952                Display::fmt(application_id, f)?;
1953
1954                f.write_str("/entitlements")
1955            }
1956            Route::CreateGuildIntegration { guild_id }
1957            | Route::GetGuildIntegrations { guild_id } => {
1958                f.write_str("guilds/")?;
1959                Display::fmt(guild_id, f)?;
1960
1961                f.write_str("/integrations")
1962            }
1963            Route::CreateGuildPrune {
1964                compute_prune_count,
1965                days,
1966                guild_id,
1967                include_roles,
1968            } => {
1969                f.write_str("guilds/")?;
1970                Display::fmt(guild_id, f)?;
1971                f.write_str("/prune")?;
1972
1973                let mut writer = QueryStringFormatter::new(f);
1974
1975                writer.write_opt_param("compute_prune_count", compute_prune_count.as_ref())?;
1976                writer.write_opt_param("days", days.as_ref())?;
1977
1978                if !include_roles.is_empty() {
1979                    writer.write_param("include_roles", &QueryArray(*include_roles))?;
1980                }
1981
1982                Ok(())
1983            }
1984            Route::CreateGuildScheduledEvent { guild_id } => {
1985                f.write_str("guilds/")?;
1986                Display::fmt(guild_id, f)?;
1987
1988                f.write_str("/scheduled-events")
1989            }
1990            Route::CreateGuildSticker { guild_id, .. }
1991            | Route::GetGuildStickers { guild_id, .. } => {
1992                f.write_str("guilds/")?;
1993                Display::fmt(guild_id, f)?;
1994
1995                f.write_str("/stickers")
1996            }
1997            Route::CreateInvite { channel_id } | Route::GetChannelInvites { channel_id } => {
1998                f.write_str("channels/")?;
1999                Display::fmt(channel_id, f)?;
2000
2001                f.write_str("/invites")
2002            }
2003            Route::CreateMessage { channel_id } => {
2004                f.write_str("channels/")?;
2005                Display::fmt(channel_id, f)?;
2006
2007                f.write_str("/messages")
2008            }
2009            Route::CreatePrivateChannel | Route::GetUserPrivateChannels => {
2010                f.write_str("users/@me/channels")
2011            }
2012            Route::CreateReaction {
2013                channel_id,
2014                emoji,
2015                message_id,
2016            }
2017            | Route::DeleteReactionCurrentUser {
2018                channel_id,
2019                emoji,
2020                message_id,
2021            } => {
2022                f.write_str("channels/")?;
2023                Display::fmt(channel_id, f)?;
2024                f.write_str("/messages/")?;
2025                Display::fmt(message_id, f)?;
2026                f.write_str("/reactions/")?;
2027                Display::fmt(&emoji, f)?;
2028
2029                f.write_str("/@me")
2030            }
2031            Route::CreateRole { guild_id }
2032            | Route::GetGuildRoles { guild_id }
2033            | Route::UpdateRolePositions { guild_id } => {
2034                f.write_str("guilds/")?;
2035                Display::fmt(guild_id, f)?;
2036
2037                f.write_str("/roles")
2038            }
2039            Route::CreateStageInstance { .. } => f.write_str("stage-instances"),
2040            Route::CreateTemplate { guild_id } | Route::GetTemplates { guild_id } => {
2041                f.write_str("guilds/")?;
2042                Display::fmt(guild_id, f)?;
2043
2044                f.write_str("/templates")
2045            }
2046            Route::CreateForumThread { channel_id } | Route::CreateThread { channel_id } => {
2047                f.write_str("channels/")?;
2048                Display::fmt(channel_id, f)?;
2049
2050                f.write_str("/threads")
2051            }
2052            Route::CreateThreadFromMessage {
2053                channel_id,
2054                message_id,
2055            } => {
2056                f.write_str("channels/")?;
2057                Display::fmt(channel_id, f)?;
2058                f.write_str("/messages/")?;
2059                Display::fmt(message_id, f)?;
2060
2061                f.write_str("/threads")
2062            }
2063            Route::CreateTypingTrigger { channel_id } => {
2064                f.write_str("channels/")?;
2065                Display::fmt(channel_id, f)?;
2066
2067                f.write_str("/typing")
2068            }
2069            Route::CreateWebhook { channel_id } | Route::GetChannelWebhooks { channel_id } => {
2070                f.write_str("channels/")?;
2071                Display::fmt(channel_id, f)?;
2072
2073                f.write_str("/webhooks")
2074            }
2075            Route::CrosspostMessage {
2076                channel_id,
2077                message_id,
2078            } => {
2079                f.write_str("channels/")?;
2080                Display::fmt(channel_id, f)?;
2081                f.write_str("/messages/")?;
2082                Display::fmt(message_id, f)?;
2083
2084                f.write_str("/crosspost")
2085            }
2086            Route::DeleteBan { guild_id, user_id }
2087            | Route::GetBan { guild_id, user_id }
2088            | Route::CreateBan { guild_id, user_id } => {
2089                f.write_str("guilds/")?;
2090                Display::fmt(guild_id, f)?;
2091                f.write_str("/bans/")?;
2092
2093                Display::fmt(user_id, f)
2094            }
2095            Route::DeleteChannel { channel_id }
2096            | Route::GetChannel { channel_id }
2097            | Route::UpdateChannel { channel_id } => {
2098                f.write_str("channels/")?;
2099
2100                Display::fmt(channel_id, f)
2101            }
2102            Route::DeleteEmoji { emoji_id, guild_id }
2103            | Route::GetEmoji { emoji_id, guild_id }
2104            | Route::UpdateEmoji { emoji_id, guild_id } => {
2105                f.write_str("guilds/")?;
2106                Display::fmt(guild_id, f)?;
2107                f.write_str("/emojis/")?;
2108
2109                Display::fmt(emoji_id, f)
2110            }
2111            Route::GetEntitlements {
2112                after,
2113                application_id,
2114                before,
2115                exclude_ended,
2116                guild_id,
2117                limit,
2118                sku_ids,
2119                user_id,
2120            } => {
2121                f.write_str("applications/")?;
2122                Display::fmt(application_id, f)?;
2123                f.write_str("/entitlements")?;
2124
2125                f.write_str("?")?;
2126
2127                if let Some(after) = after {
2128                    f.write_str("after=")?;
2129                    Display::fmt(after, f)?;
2130                }
2131
2132                if let Some(before) = before {
2133                    f.write_str("&before=")?;
2134                    Display::fmt(before, f)?;
2135                }
2136
2137                if let Some(exclude_ended) = exclude_ended {
2138                    f.write_str("&exclude_ended=")?;
2139                    Display::fmt(exclude_ended, f)?;
2140                }
2141
2142                if let Some(guild_id) = guild_id {
2143                    f.write_str("&guild_id=")?;
2144                    Display::fmt(guild_id, f)?;
2145                }
2146
2147                if let Some(limit) = limit {
2148                    f.write_str("&limit=")?;
2149                    Display::fmt(limit, f)?;
2150                }
2151
2152                if !sku_ids.is_empty() {
2153                    let sku_id_count = sku_ids.len() - 1;
2154
2155                    f.write_str("&sku_ids=")?;
2156
2157                    for (idx, sku_id) in sku_ids.iter().enumerate() {
2158                        Display::fmt(sku_id, f)?;
2159
2160                        if idx < sku_id_count {
2161                            f.write_str(",")?;
2162                        }
2163                    }
2164                }
2165
2166                if let Some(user_id) = user_id {
2167                    f.write_str("&user_id=")?;
2168                    Display::fmt(user_id, f)?;
2169                }
2170
2171                Ok(())
2172            }
2173            Route::DeleteGlobalCommand {
2174                application_id,
2175                command_id,
2176            }
2177            | Route::GetGlobalCommand {
2178                application_id,
2179                command_id,
2180            }
2181            | Route::UpdateGlobalCommand {
2182                application_id,
2183                command_id,
2184            } => {
2185                f.write_str("applications/")?;
2186                Display::fmt(application_id, f)?;
2187                f.write_str("/commands/")?;
2188
2189                Display::fmt(command_id, f)
2190            }
2191            Route::DeleteGuild { guild_id } | Route::UpdateGuild { guild_id } => {
2192                f.write_str("guilds/")?;
2193
2194                Display::fmt(guild_id, f)
2195            }
2196            Route::DeleteGuildCommand {
2197                application_id,
2198                command_id,
2199                guild_id,
2200            }
2201            | Route::GetGuildCommand {
2202                application_id,
2203                command_id,
2204                guild_id,
2205            }
2206            | Route::UpdateGuildCommand {
2207                application_id,
2208                command_id,
2209                guild_id,
2210            } => {
2211                f.write_str("applications/")?;
2212                Display::fmt(application_id, f)?;
2213                f.write_str("/guilds/")?;
2214                Display::fmt(guild_id, f)?;
2215                f.write_str("/commands/")?;
2216
2217                Display::fmt(command_id, f)
2218            }
2219            Route::DeleteGuildIntegration {
2220                guild_id,
2221                integration_id,
2222            }
2223            | Route::UpdateGuildIntegration {
2224                guild_id,
2225                integration_id,
2226            } => {
2227                f.write_str("guilds/")?;
2228                Display::fmt(guild_id, f)?;
2229                f.write_str("/integrations/")?;
2230
2231                Display::fmt(integration_id, f)
2232            }
2233            Route::DeleteInteractionOriginal {
2234                application_id,
2235                interaction_token,
2236            }
2237            | Route::GetInteractionOriginal {
2238                application_id,
2239                interaction_token,
2240            }
2241            | Route::UpdateInteractionOriginal {
2242                application_id,
2243                interaction_token,
2244            } => {
2245                f.write_str("webhooks/")?;
2246                Display::fmt(application_id, f)?;
2247                f.write_str("/")?;
2248                f.write_str(interaction_token)?;
2249
2250                f.write_str("/messages/@original")
2251            }
2252            Route::DeleteInvite { code } => {
2253                f.write_str("invites/")?;
2254
2255                f.write_str(code)
2256            }
2257            Route::DeleteMessageReactions {
2258                channel_id,
2259                message_id,
2260            } => {
2261                f.write_str("channels/")?;
2262                Display::fmt(channel_id, f)?;
2263                f.write_str("/messages/")?;
2264                Display::fmt(message_id, f)?;
2265
2266                f.write_str("/reactions")
2267            }
2268            Route::DeleteMessageSpecificReaction {
2269                channel_id,
2270                message_id,
2271                emoji,
2272            } => {
2273                f.write_str("channels/")?;
2274                Display::fmt(channel_id, f)?;
2275                f.write_str("/messages/")?;
2276                Display::fmt(message_id, f)?;
2277                f.write_str("/reactions/")?;
2278
2279                Display::fmt(&emoji, f)
2280            }
2281            Route::DeleteMessage {
2282                channel_id,
2283                message_id,
2284            }
2285            | Route::GetMessage {
2286                channel_id,
2287                message_id,
2288            }
2289            | Route::UpdateMessage {
2290                channel_id,
2291                message_id,
2292            } => {
2293                f.write_str("channels/")?;
2294                Display::fmt(channel_id, f)?;
2295                f.write_str("/messages/")?;
2296
2297                Display::fmt(message_id, f)
2298            }
2299            Route::DeleteMessages { channel_id } => {
2300                f.write_str("channels/")?;
2301                Display::fmt(channel_id, f)?;
2302
2303                f.write_str("/messages/bulk-delete")
2304            }
2305            Route::DeletePermissionOverwrite {
2306                channel_id,
2307                target_id,
2308            }
2309            | Route::UpdatePermissionOverwrite {
2310                channel_id,
2311                target_id,
2312            } => {
2313                f.write_str("channels/")?;
2314                Display::fmt(channel_id, f)?;
2315                f.write_str("/permissions/")?;
2316
2317                Display::fmt(target_id, f)
2318            }
2319            Route::DeleteReaction {
2320                channel_id,
2321                emoji,
2322                message_id,
2323                user_id,
2324            } => {
2325                f.write_str("channels/")?;
2326                Display::fmt(channel_id, f)?;
2327                f.write_str("/messages/")?;
2328                Display::fmt(message_id, f)?;
2329                f.write_str("/reactions/")?;
2330                Display::fmt(&emoji, f)?;
2331                f.write_str("/")?;
2332
2333                Display::fmt(user_id, f)
2334            }
2335            Route::DeleteRole { guild_id, role_id }
2336            | Route::GetRole { guild_id, role_id }
2337            | Route::UpdateRole { guild_id, role_id } => {
2338                f.write_str("guilds/")?;
2339                Display::fmt(guild_id, f)?;
2340                f.write_str("/roles/")?;
2341
2342                Display::fmt(role_id, f)
2343            }
2344            Route::DeleteStageInstance { channel_id }
2345            | Route::GetStageInstance { channel_id }
2346            | Route::UpdateStageInstance { channel_id } => {
2347                f.write_str("stage-instances/")?;
2348
2349                Display::fmt(channel_id, f)
2350            }
2351            Route::DeleteTemplate {
2352                guild_id,
2353                template_code,
2354            }
2355            | Route::SyncTemplate {
2356                guild_id,
2357                template_code,
2358            }
2359            | Route::UpdateTemplate {
2360                guild_id,
2361                template_code,
2362            } => {
2363                f.write_str("guilds/")?;
2364                Display::fmt(guild_id, f)?;
2365                f.write_str("/templates/")?;
2366
2367                f.write_str(template_code)
2368            }
2369            Route::DeleteWebhookMessage {
2370                message_id,
2371                thread_id,
2372                token,
2373                webhook_id,
2374            }
2375            | Route::GetFollowupMessage {
2376                application_id: webhook_id,
2377                interaction_token: token,
2378                thread_id,
2379                message_id,
2380            }
2381            | Route::GetWebhookMessage {
2382                message_id,
2383                token,
2384                thread_id,
2385                webhook_id,
2386            }
2387            | Route::UpdateWebhookMessage {
2388                message_id,
2389                thread_id,
2390                token,
2391                webhook_id,
2392            } => {
2393                f.write_str("webhooks/")?;
2394                Display::fmt(webhook_id, f)?;
2395                f.write_str("/")?;
2396                f.write_str(token)?;
2397                f.write_str("/messages/")?;
2398                Display::fmt(message_id, f)?;
2399
2400                let mut query_formatter = QueryStringFormatter::new(f);
2401
2402                query_formatter.write_opt_param("thread_id", thread_id.as_ref())
2403            }
2404            Route::DeleteWebhook { token, webhook_id }
2405            | Route::GetWebhook { token, webhook_id }
2406            | Route::UpdateWebhook { token, webhook_id } => {
2407                f.write_str("webhooks/")?;
2408                Display::fmt(webhook_id, f)?;
2409
2410                if let Some(token) = token {
2411                    f.write_str("/")?;
2412                    f.write_str(token)?;
2413                }
2414
2415                Ok(())
2416            }
2417            Route::EndPoll {
2418                channel_id,
2419                message_id,
2420            } => {
2421                f.write_str("channels/")?;
2422                Display::fmt(channel_id, f)?;
2423                f.write_str("/polls/")?;
2424                Display::fmt(message_id, f)?;
2425
2426                f.write_str("/expire")
2427            }
2428            Route::ExecuteWebhook {
2429                thread_id,
2430                token,
2431                wait,
2432                webhook_id,
2433            } => {
2434                f.write_str("webhooks/")?;
2435                Display::fmt(webhook_id, f)?;
2436                f.write_str("/")?;
2437                f.write_str(token)?;
2438
2439                let mut query_formatter = QueryStringFormatter::new(f);
2440
2441                query_formatter.write_opt_param("thread_id", thread_id.as_ref())?;
2442                query_formatter.write_opt_param("wait", wait.as_ref())
2443            }
2444            Route::DeleteTestEntitlement {
2445                application_id,
2446                entitlement_id,
2447            } => {
2448                f.write_str("applications/")?;
2449                Display::fmt(application_id, f)?;
2450                f.write_str("/entitlements/")?;
2451
2452                Display::fmt(entitlement_id, f)
2453            }
2454            Route::FollowNewsChannel { channel_id } => {
2455                f.write_str("channels/")?;
2456                Display::fmt(channel_id, f)?;
2457
2458                f.write_str("/followers")
2459            }
2460            Route::GetActiveThreads { guild_id } => {
2461                f.write_str("guilds/")?;
2462                Display::fmt(guild_id, f)?;
2463
2464                f.write_str("/threads/active")
2465            }
2466            Route::DeleteApplicationEmoji {
2467                application_id,
2468                emoji_id,
2469            }
2470            | Route::UpdateApplicationEmoji {
2471                application_id,
2472                emoji_id,
2473            } => {
2474                f.write_str("applications/")?;
2475                Display::fmt(application_id, f)?;
2476                f.write_str("/emojis/")?;
2477
2478                Display::fmt(emoji_id, f)
2479            }
2480            Route::GetApplicationEmojis { application_id }
2481            | Route::AddApplicationEmoji { application_id } => {
2482                f.write_str("applications/")?;
2483                Display::fmt(application_id, f)?;
2484
2485                f.write_str("/emojis")
2486            }
2487            Route::GetAuditLogs {
2488                action_type,
2489                after,
2490                before,
2491                guild_id,
2492                limit,
2493                user_id,
2494            } => {
2495                f.write_str("guilds/")?;
2496                Display::fmt(guild_id, f)?;
2497                f.write_str("/audit-logs")?;
2498
2499                let mut query_formatter = QueryStringFormatter::new(f);
2500
2501                query_formatter.write_opt_param("action_type", action_type.as_ref())?;
2502                query_formatter.write_opt_param("after", after.as_ref())?;
2503                query_formatter.write_opt_param("before", before.as_ref())?;
2504                query_formatter.write_opt_param("limit", limit.as_ref())?;
2505                query_formatter.write_opt_param("user_id", user_id.as_ref())
2506            }
2507            Route::GetBans { guild_id } => {
2508                f.write_str("guilds/")?;
2509                Display::fmt(guild_id, f)?;
2510
2511                f.write_str("/bans")
2512            }
2513            Route::GetBansWithParameters {
2514                after,
2515                before,
2516                guild_id,
2517                limit,
2518            } => {
2519                f.write_str("guilds/")?;
2520                Display::fmt(guild_id, f)?;
2521                f.write_str("/bans")?;
2522
2523                let mut query_formatter = QueryStringFormatter::new(f);
2524
2525                query_formatter.write_opt_param("after", after.as_ref())?;
2526                query_formatter.write_opt_param("before", before.as_ref())?;
2527                query_formatter.write_opt_param("limit", limit.as_ref())
2528            }
2529            Route::GetGatewayBot => f.write_str("gateway/bot"),
2530            Route::GetCommandPermissions {
2531                application_id,
2532                command_id,
2533                guild_id,
2534            }
2535            | Route::UpdateCommandPermissions {
2536                application_id,
2537                command_id,
2538                guild_id,
2539            } => {
2540                f.write_str("applications/")?;
2541                Display::fmt(application_id, f)?;
2542                f.write_str("/guilds/")?;
2543                Display::fmt(guild_id, f)?;
2544                f.write_str("/commands/")?;
2545                Display::fmt(command_id, f)?;
2546
2547                f.write_str("/permissions")
2548            }
2549            Route::GetCurrentAuthorizationInformation => f.write_str("oauth2/@me"),
2550            Route::GetCurrentUserApplicationInfo | Route::UpdateCurrentUserApplication => {
2551                f.write_str("applications/@me")
2552            }
2553            Route::GetCurrentUser | Route::UpdateCurrentUser => f.write_str("users/@me"),
2554            Route::GetCurrentUserGuildMember { guild_id } => {
2555                f.write_str("users/@me/guilds/")?;
2556                Display::fmt(guild_id, f)?;
2557
2558                f.write_str("/member")
2559            }
2560            Route::GetGateway => f.write_str("gateway"),
2561            Route::GetGuild {
2562                guild_id,
2563                with_counts,
2564            } => {
2565                f.write_str("guilds/")?;
2566                Display::fmt(guild_id, f)?;
2567
2568                let mut query_formatter = QueryStringFormatter::new(f);
2569
2570                if *with_counts {
2571                    query_formatter.write_param("with_counts", &true)?;
2572                }
2573
2574                Ok(())
2575            }
2576            Route::GetGuildCommandPermissions {
2577                application_id,
2578                guild_id,
2579            } => {
2580                f.write_str("applications/")?;
2581                Display::fmt(application_id, f)?;
2582                f.write_str("/guilds/")?;
2583                Display::fmt(guild_id, f)?;
2584
2585                f.write_str("/commands/permissions")
2586            }
2587            Route::GetGuildInvites { guild_id } => {
2588                f.write_str("guilds/")?;
2589                Display::fmt(guild_id, f)?;
2590
2591                f.write_str("/invites")
2592            }
2593            Route::GetGuildMembers {
2594                after,
2595                guild_id,
2596                limit,
2597            } => {
2598                f.write_str("guilds/")?;
2599                Display::fmt(guild_id, f)?;
2600                f.write_str("/members")?;
2601
2602                let mut query_formatter = QueryStringFormatter::new(f);
2603
2604                query_formatter.write_opt_param("after", after.as_ref())?;
2605                query_formatter.write_opt_param("limit", limit.as_ref())
2606            }
2607            Route::GetGuildOnboarding { guild_id } | Route::UpdateGuildOnboarding { guild_id } => {
2608                f.write_str("guilds/")?;
2609                Display::fmt(guild_id, f)?;
2610
2611                f.write_str("/onboarding")
2612            }
2613            Route::GetGuildPreview { guild_id } => {
2614                f.write_str("guilds/")?;
2615                Display::fmt(guild_id, f)?;
2616
2617                f.write_str("/preview")
2618            }
2619            Route::GetGuildPruneCount {
2620                days,
2621                guild_id,
2622                include_roles,
2623            } => {
2624                f.write_str("guilds/")?;
2625                Display::fmt(guild_id, f)?;
2626                f.write_str("/prune")?;
2627
2628                let mut query_formatter = QueryStringFormatter::new(f);
2629
2630                query_formatter.write_opt_param("days", days.as_ref())?;
2631
2632                if !include_roles.is_empty() {
2633                    query_formatter.write_param("include_roles", &QueryArray(*include_roles))?;
2634                }
2635
2636                Ok(())
2637            }
2638            Route::GetGuildScheduledEvent {
2639                guild_id,
2640                scheduled_event_id,
2641                with_user_count,
2642            } => {
2643                f.write_str("guilds/")?;
2644                Display::fmt(guild_id, f)?;
2645                f.write_str("/scheduled-events/")?;
2646                Display::fmt(scheduled_event_id, f)?;
2647
2648                let mut query_formatter = QueryStringFormatter::new(f);
2649
2650                if *with_user_count {
2651                    query_formatter.write_param("with_user_count", &true)?;
2652                }
2653
2654                Ok(())
2655            }
2656            Route::GetGuildScheduledEventUsers {
2657                after,
2658                before,
2659                guild_id,
2660                limit,
2661                scheduled_event_id,
2662                with_member,
2663            } => {
2664                f.write_str("guilds/")?;
2665                Display::fmt(guild_id, f)?;
2666                f.write_str("/scheduled-events/")?;
2667                Display::fmt(scheduled_event_id, f)?;
2668                f.write_str("/users")?;
2669
2670                let mut query_formatter = QueryStringFormatter::new(f);
2671
2672                query_formatter.write_opt_param("after", after.as_ref())?;
2673                query_formatter.write_opt_param("before", before.as_ref())?;
2674                query_formatter.write_opt_param("limit", limit.as_ref())?;
2675
2676                if *with_member {
2677                    query_formatter.write_param("with_member", &true)?;
2678                }
2679
2680                Ok(())
2681            }
2682            Route::GetGuildScheduledEvents {
2683                guild_id,
2684                with_user_count,
2685            } => {
2686                f.write_str("guilds/")?;
2687                Display::fmt(guild_id, f)?;
2688                f.write_str("/scheduled-events")?;
2689
2690                let mut query_formatter = QueryStringFormatter::new(f);
2691
2692                if *with_user_count {
2693                    query_formatter.write_param("with_user_count", &true)?;
2694                }
2695
2696                Ok(())
2697            }
2698            Route::GetGuildSticker {
2699                guild_id,
2700                sticker_id,
2701                ..
2702            }
2703            | Route::DeleteGuildSticker {
2704                guild_id,
2705                sticker_id,
2706                ..
2707            }
2708            | Route::UpdateGuildSticker {
2709                guild_id,
2710                sticker_id,
2711                ..
2712            } => {
2713                f.write_str("guilds/")?;
2714                Display::fmt(guild_id, f)?;
2715                f.write_str("/stickers/")?;
2716
2717                Display::fmt(sticker_id, f)
2718            }
2719            Route::GetGuildVanityUrl { guild_id } => {
2720                f.write_str("guilds/")?;
2721                Display::fmt(guild_id, f)?;
2722
2723                f.write_str("/vanity-url")
2724            }
2725            Route::GetGuildVoiceRegions { guild_id } => {
2726                f.write_str("guilds/")?;
2727                Display::fmt(guild_id, f)?;
2728
2729                f.write_str("/regions")
2730            }
2731            Route::GetGuildWelcomeScreen { guild_id }
2732            | Route::UpdateGuildWelcomeScreen { guild_id } => {
2733                f.write_str("guilds/")?;
2734                Display::fmt(guild_id, f)?;
2735
2736                f.write_str("/welcome-screen")
2737            }
2738            Route::GetGuildWebhooks { guild_id } => {
2739                f.write_str("guilds/")?;
2740                Display::fmt(guild_id, f)?;
2741
2742                f.write_str("/webhooks")
2743            }
2744            Route::GetGuildWidget { guild_id } => {
2745                f.write_str("guilds/")?;
2746                Display::fmt(guild_id, f)?;
2747
2748                f.write_str("/widget.json")
2749            }
2750            Route::GetGuildWidgetSettings { guild_id }
2751            | Route::UpdateGuildWidgetSettings { guild_id } => {
2752                f.write_str("guilds/")?;
2753                Display::fmt(guild_id, f)?;
2754
2755                f.write_str("/widget")
2756            }
2757            Route::GetGuilds {
2758                after,
2759                before,
2760                limit,
2761            } => {
2762                f.write_str("users/@me/guilds")?;
2763
2764                let mut query_formatter = QueryStringFormatter::new(f);
2765
2766                query_formatter.write_opt_param("after", after.as_ref())?;
2767                query_formatter.write_opt_param("before", before.as_ref())?;
2768                query_formatter.write_opt_param("limit", limit.as_ref())
2769            }
2770            Route::GetInvite { code, with_counts } => {
2771                f.write_str("invites/")?;
2772                f.write_str(code)?;
2773
2774                let mut query_formatter = QueryStringFormatter::new(f);
2775
2776                if *with_counts {
2777                    query_formatter.write_param("with_counts", &true)?;
2778                }
2779
2780                Ok(())
2781            }
2782            Route::GetInviteWithExpiration {
2783                code,
2784                with_counts,
2785                with_expiration,
2786            } => {
2787                f.write_str("invites/")?;
2788                f.write_str(code)?;
2789
2790                let mut query_formatter = QueryStringFormatter::new(f);
2791
2792                if *with_counts {
2793                    query_formatter.write_param("with_counts", &true)?;
2794                }
2795
2796                if *with_expiration {
2797                    query_formatter.write_param("with_expiration", &true)?;
2798                }
2799
2800                Ok(())
2801            }
2802            Route::GetMessages {
2803                channel_id,
2804                after,
2805                around,
2806                before,
2807                limit,
2808            } => {
2809                f.write_str("channels/")?;
2810                Display::fmt(channel_id, f)?;
2811                f.write_str("/messages")?;
2812
2813                let mut query_formatter = QueryStringFormatter::new(f);
2814
2815                query_formatter.write_opt_param("after", after.as_ref())?;
2816                query_formatter.write_opt_param("around", around.as_ref())?;
2817                query_formatter.write_opt_param("before", before.as_ref())?;
2818                query_formatter.write_opt_param("limit", limit.as_ref())
2819            }
2820            Route::GetNitroStickerPacks { .. } => f.write_str("sticker-packs"),
2821            Route::GetPins { channel_id } => {
2822                f.write_str("channels/")?;
2823                Display::fmt(channel_id, f)?;
2824
2825                f.write_str("/pins")
2826            }
2827            Route::GetJoinedPrivateArchivedThreads {
2828                before,
2829                channel_id,
2830                limit,
2831            } => {
2832                f.write_str("channels/")?;
2833                Display::fmt(channel_id, f)?;
2834                f.write_str("/users/@me/threads/archived/private")?;
2835
2836                let mut query_formatter = QueryStringFormatter::new(f);
2837
2838                query_formatter.write_opt_param("before", before.as_ref())?;
2839                query_formatter.write_opt_param("limit", limit.as_ref())
2840            }
2841            Route::GetPrivateArchivedThreads {
2842                before,
2843                channel_id,
2844                limit,
2845            } => {
2846                f.write_str("channels/")?;
2847                Display::fmt(channel_id, f)?;
2848                f.write_str("/threads/archived/private")?;
2849
2850                let mut query_formatter = QueryStringFormatter::new(f);
2851
2852                query_formatter.write_opt_param("before", before.as_ref())?;
2853                query_formatter.write_opt_param("limit", limit.as_ref())
2854            }
2855            Route::GetPublicArchivedThreads {
2856                before,
2857                channel_id,
2858                limit,
2859            } => {
2860                f.write_str("channels/")?;
2861                Display::fmt(channel_id, f)?;
2862                f.write_str("/threads/archived/public")?;
2863
2864                let mut query_formatter = QueryStringFormatter::new(f);
2865
2866                query_formatter.write_opt_param("before", before.as_ref())?;
2867                query_formatter.write_opt_param("limit", limit.as_ref())
2868            }
2869            Route::GetReactionUsers {
2870                after,
2871                channel_id,
2872                emoji,
2873                limit,
2874                message_id,
2875                kind,
2876            } => {
2877                f.write_str("channels/")?;
2878                Display::fmt(channel_id, f)?;
2879                f.write_str("/messages/")?;
2880                Display::fmt(message_id, f)?;
2881                f.write_str("/reactions/")?;
2882                Display::fmt(&emoji, f)?;
2883
2884                let mut query_formatter = QueryStringFormatter::new(f);
2885
2886                query_formatter.write_opt_param("after", after.as_ref())?;
2887                query_formatter.write_opt_param("limit", limit.as_ref())?;
2888                query_formatter.write_opt_param("type", kind.as_ref())
2889            }
2890            Route::GetSticker { sticker_id } => {
2891                f.write_str("stickers/")?;
2892
2893                Display::fmt(sticker_id, f)
2894            }
2895            Route::GetThreadMembers {
2896                after,
2897                channel_id,
2898                limit,
2899                with_member,
2900            } => {
2901                f.write_str("channels/")?;
2902                Display::fmt(channel_id, f)?;
2903                f.write_str("/thread-members")?;
2904
2905                let mut query_formatter = QueryStringFormatter::new(f);
2906
2907                query_formatter.write_opt_param("after", after.as_ref())?;
2908                query_formatter.write_opt_param("limit", limit.as_ref())?;
2909                query_formatter.write_opt_param("with_member", with_member.as_ref())
2910            }
2911            Route::GetUserConnections => f.write_str("users/@me/connections"),
2912            Route::GetUser { user_id } => {
2913                f.write_str("users/")?;
2914
2915                Display::fmt(user_id, f)
2916            }
2917            Route::GetVoiceRegions => f.write_str("voice/regions"),
2918            Route::InteractionCallback {
2919                interaction_id,
2920                interaction_token,
2921            } => {
2922                f.write_str("interactions/")?;
2923                Display::fmt(interaction_id, f)?;
2924                f.write_str("/")?;
2925                f.write_str(interaction_token)?;
2926
2927                f.write_str("/callback")
2928            }
2929            Route::JoinThread { channel_id } | Route::LeaveThread { channel_id } => {
2930                f.write_str("channels/")?;
2931                Display::fmt(channel_id, f)?;
2932
2933                f.write_str("/thread-members/@me")
2934            }
2935            Route::LeaveGuild { guild_id } => {
2936                f.write_str("users/@me/guilds/")?;
2937
2938                Display::fmt(guild_id, f)
2939            }
2940            Route::PinMessage {
2941                channel_id,
2942                message_id,
2943            }
2944            | Route::UnpinMessage {
2945                channel_id,
2946                message_id,
2947            } => {
2948                f.write_str("channels/")?;
2949                Display::fmt(channel_id, f)?;
2950                f.write_str("/pins/")?;
2951
2952                Display::fmt(message_id, f)
2953            }
2954            Route::SearchGuildMembers {
2955                guild_id,
2956                limit,
2957                query,
2958            } => {
2959                f.write_str("guilds/")?;
2960                Display::fmt(guild_id, f)?;
2961                f.write_str("/members/search")?;
2962
2963                let mut query_formatter = QueryStringFormatter::new(f);
2964
2965                query_formatter
2966                    .write_param("query", &utf8_percent_encode(query, NON_ALPHANUMERIC))?;
2967                query_formatter.write_opt_param("limit", limit.as_ref())
2968            }
2969            Route::SyncGuildIntegration {
2970                guild_id,
2971                integration_id,
2972            } => {
2973                f.write_str("guilds/")?;
2974                Display::fmt(guild_id, f)?;
2975                f.write_str("/integrations/")?;
2976                Display::fmt(integration_id, f)?;
2977
2978                f.write_str("/sync")
2979            }
2980            Route::UpdateCurrentMember { guild_id } => {
2981                f.write_str("guilds/")?;
2982                Display::fmt(guild_id, f)?;
2983
2984                f.write_str("/members/@me")
2985            }
2986            Route::GetCurrentUserVoiceState { guild_id }
2987            | Route::UpdateCurrentUserVoiceState { guild_id } => {
2988                f.write_str("guilds/")?;
2989                Display::fmt(guild_id, f)?;
2990
2991                f.write_str("/voice-states/@me")
2992            }
2993            Route::DeleteGuildScheduledEvent {
2994                guild_id,
2995                scheduled_event_id,
2996            }
2997            | Route::UpdateGuildScheduledEvent {
2998                guild_id,
2999                scheduled_event_id,
3000            } => {
3001                f.write_str("guilds/")?;
3002                Display::fmt(guild_id, f)?;
3003                f.write_str("/scheduled-events/")?;
3004
3005                Display::fmt(scheduled_event_id, f)
3006            }
3007            Route::UpdateNickname { guild_id } => {
3008                f.write_str("guilds/")?;
3009                Display::fmt(guild_id, f)?;
3010
3011                f.write_str("/members/@me/nick")
3012            }
3013            Route::GetUserVoiceState { guild_id, user_id }
3014            | Route::UpdateUserVoiceState { guild_id, user_id } => {
3015                f.write_str("guilds/")?;
3016                Display::fmt(guild_id, f)?;
3017                f.write_str("/voice-states/")?;
3018
3019                Display::fmt(user_id, f)
3020            }
3021            Route::UpdateGuildMfa { guild_id, .. } => {
3022                f.write_str("guilds/")?;
3023                Display::fmt(guild_id, f)?;
3024
3025                f.write_str("/mfa")
3026            }
3027            Route::GetSKUs { application_id } => {
3028                f.write_str("applications/")?;
3029                Display::fmt(application_id, f)?;
3030
3031                f.write_str("/skus")
3032            }
3033        }
3034    }
3035}
3036
3037#[cfg(test)]
3038mod tests {
3039    use super::Route;
3040    use crate::request::{channel::reaction::RequestReactionType, Method};
3041    use twilight_model::id::Id;
3042
3043    /// Test a route for each method.
3044    #[test]
3045    fn methods() {
3046        assert_eq!(
3047            Method::Delete,
3048            Route::DeleteInvite {
3049                code: "twilight-rs",
3050            }
3051            .method()
3052        );
3053        assert_eq!(
3054            Method::Get,
3055            Route::GetInvite {
3056                code: "twilight-rs",
3057                with_counts: false,
3058            }
3059            .method()
3060        );
3061        assert_eq!(
3062            Method::Patch,
3063            Route::UpdateMessage {
3064                channel_id: 123,
3065                message_id: 456,
3066            }
3067            .method()
3068        );
3069        assert_eq!(Method::Post, Route::CreateGuild.method());
3070        assert_eq!(
3071            Method::Put,
3072            Route::SyncTemplate {
3073                guild_id: 123,
3074                template_code: "abc",
3075            }
3076            .method()
3077        );
3078    }
3079
3080    // Test display implementation
3081
3082    const APPLICATION_ID: u64 = 1;
3083    const CHANNEL_ID: u64 = 2;
3084    const CODE: &str = "invitecode";
3085    const COMMAND_ID: u64 = 3;
3086    const EMOJI_ID: u64 = 4;
3087    const GUILD_ID: u64 = 5;
3088    const INTERACTION_ID: u64 = 6;
3089    const INTERACTION_TOKEN: &str = "interactiontoken";
3090    const INTEGRATION_ID: u64 = 7;
3091    const MESSAGE_ID: u64 = 8;
3092    const ROLE_ID: u64 = 9;
3093    const STICKER_ID: u64 = 10;
3094    const TEMPLATE_CODE: &str = "templatecode";
3095    const USER_ID: u64 = 11;
3096    const SCHEDULED_EVENT_ID: u64 = 12;
3097    const AUTO_MODERATION_RULE_ID: u64 = 13;
3098
3099    const fn emoji() -> RequestReactionType<'static> {
3100        RequestReactionType::Custom {
3101            id: Id::new(EMOJI_ID),
3102            name: None,
3103        }
3104    }
3105
3106    #[test]
3107    fn get_public_archived_threads() {
3108        let route = Route::GetPublicArchivedThreads {
3109            channel_id: 1,
3110            before: Some("2021-01-01T00:00:00Z"),
3111            limit: None,
3112        };
3113
3114        assert_eq!(
3115            "channels/1/threads/archived/public?before=2021-01-01T00:00:00Z",
3116            route.to_string()
3117        );
3118    }
3119
3120    #[test]
3121    fn update_webhook_message_thread_id() {
3122        let route = Route::UpdateWebhookMessage {
3123            message_id: 1,
3124            thread_id: Some(2),
3125            token: "token",
3126            webhook_id: 3,
3127        };
3128
3129        assert_eq!("webhooks/3/token/messages/1?thread_id=2", route.to_string());
3130    }
3131
3132    #[test]
3133    fn add_guild_member() {
3134        let route = Route::AddGuildMember {
3135            guild_id: GUILD_ID,
3136            user_id: USER_ID,
3137        };
3138        assert_eq!(
3139            route.to_string(),
3140            format!("guilds/{GUILD_ID}/members/{USER_ID}")
3141        );
3142    }
3143
3144    #[test]
3145    fn get_member() {
3146        let route = Route::GetMember {
3147            guild_id: GUILD_ID,
3148            user_id: USER_ID,
3149        };
3150        assert_eq!(
3151            route.to_string(),
3152            format!("guilds/{GUILD_ID}/members/{USER_ID}")
3153        );
3154    }
3155
3156    #[test]
3157    fn remove_member() {
3158        let route = Route::RemoveMember {
3159            guild_id: GUILD_ID,
3160            user_id: USER_ID,
3161        };
3162        assert_eq!(
3163            route.to_string(),
3164            format!("guilds/{GUILD_ID}/members/{USER_ID}")
3165        );
3166    }
3167
3168    #[test]
3169    fn update_member() {
3170        let route = Route::UpdateMember {
3171            guild_id: GUILD_ID,
3172            user_id: USER_ID,
3173        };
3174        assert_eq!(
3175            route.to_string(),
3176            format!("guilds/{GUILD_ID}/members/{USER_ID}")
3177        );
3178    }
3179
3180    #[test]
3181    fn add_member_role() {
3182        let route = Route::AddMemberRole {
3183            guild_id: GUILD_ID,
3184            role_id: ROLE_ID,
3185            user_id: USER_ID,
3186        };
3187        assert_eq!(
3188            route.to_string(),
3189            format!("guilds/{GUILD_ID}/members/{USER_ID}/roles/{ROLE_ID}")
3190        );
3191    }
3192
3193    #[test]
3194    fn remove_member_role() {
3195        let route = Route::RemoveMemberRole {
3196            guild_id: GUILD_ID,
3197            role_id: ROLE_ID,
3198            user_id: USER_ID,
3199        };
3200        assert_eq!(
3201            route.to_string(),
3202            format!("guilds/{GUILD_ID}/members/{USER_ID}/roles/{ROLE_ID}")
3203        );
3204    }
3205
3206    #[test]
3207    fn add_thread_member() {
3208        let route = Route::AddThreadMember {
3209            channel_id: CHANNEL_ID,
3210            user_id: USER_ID,
3211        };
3212        assert_eq!(
3213            route.to_string(),
3214            format!("channels/{CHANNEL_ID}/thread-members/{USER_ID}")
3215        );
3216    }
3217
3218    #[test]
3219    fn get_thread_member() {
3220        let route = Route::GetThreadMember {
3221            channel_id: CHANNEL_ID,
3222            user_id: USER_ID,
3223        };
3224        assert_eq!(
3225            route.to_string(),
3226            format!("channels/{CHANNEL_ID}/thread-members/{USER_ID}")
3227        );
3228    }
3229
3230    #[test]
3231    fn remove_thread_member() {
3232        let route = Route::RemoveThreadMember {
3233            channel_id: CHANNEL_ID,
3234            user_id: USER_ID,
3235        };
3236        assert_eq!(
3237            route.to_string(),
3238            format!("channels/{CHANNEL_ID}/thread-members/{USER_ID}")
3239        );
3240    }
3241
3242    #[test]
3243    fn create_channel() {
3244        let route = Route::CreateChannel { guild_id: GUILD_ID };
3245        assert_eq!(route.to_string(), format!("guilds/{GUILD_ID}/channels"));
3246    }
3247
3248    #[test]
3249    fn get_channels() {
3250        let route = Route::GetChannels { guild_id: GUILD_ID };
3251        assert_eq!(route.to_string(), format!("guilds/{GUILD_ID}/channels"));
3252    }
3253
3254    #[test]
3255    fn update_guild_channels() {
3256        let route = Route::UpdateGuildChannels { guild_id: GUILD_ID };
3257        assert_eq!(route.to_string(), format!("guilds/{GUILD_ID}/channels"));
3258    }
3259
3260    #[test]
3261    fn create_emoji() {
3262        let route = Route::CreateEmoji { guild_id: GUILD_ID };
3263        assert_eq!(route.to_string(), format!("guilds/{GUILD_ID}/emojis"));
3264    }
3265
3266    #[test]
3267    fn get_emojis() {
3268        let route = Route::GetEmojis { guild_id: GUILD_ID };
3269        assert_eq!(route.to_string(), format!("guilds/{GUILD_ID}/emojis"));
3270    }
3271
3272    #[test]
3273    fn create_global_command() {
3274        let route = Route::CreateGlobalCommand {
3275            application_id: APPLICATION_ID,
3276        };
3277        assert_eq!(
3278            route.to_string(),
3279            format!("applications/{APPLICATION_ID}/commands")
3280        );
3281    }
3282
3283    #[test]
3284    fn get_global_commands() {
3285        let route = Route::GetGlobalCommands {
3286            application_id: APPLICATION_ID,
3287            with_localizations: Some(true),
3288        };
3289        assert_eq!(
3290            route.to_string(),
3291            format!("applications/{APPLICATION_ID}/commands?with_localizations=true")
3292        );
3293
3294        let route = Route::GetGlobalCommands {
3295            application_id: APPLICATION_ID,
3296            with_localizations: None,
3297        };
3298        assert_eq!(
3299            route.to_string(),
3300            format!("applications/{APPLICATION_ID}/commands")
3301        );
3302    }
3303
3304    #[test]
3305    fn set_global_commands() {
3306        let route = Route::SetGlobalCommands {
3307            application_id: APPLICATION_ID,
3308        };
3309        assert_eq!(
3310            route.to_string(),
3311            format!("applications/{APPLICATION_ID}/commands")
3312        );
3313    }
3314
3315    #[test]
3316    fn create_guild() {
3317        let route = Route::CreateGuild;
3318        assert_eq!(route.to_string(), "guilds");
3319    }
3320
3321    #[test]
3322    fn create_guild_command() {
3323        let route = Route::CreateGuildCommand {
3324            application_id: APPLICATION_ID,
3325            guild_id: GUILD_ID,
3326        };
3327        assert_eq!(
3328            route.to_string(),
3329            format!("applications/{APPLICATION_ID}/guilds/{GUILD_ID}/commands")
3330        );
3331    }
3332
3333    #[test]
3334    fn get_guild_commands() {
3335        let route = Route::GetGuildCommands {
3336            application_id: APPLICATION_ID,
3337            guild_id: GUILD_ID,
3338            with_localizations: Some(true),
3339        };
3340        assert_eq!(
3341            route.to_string(),
3342            format!(
3343                "applications/{APPLICATION_ID}/guilds/{GUILD_ID}/commands?with_localizations=true"
3344            )
3345        );
3346
3347        let route = Route::GetGuildCommands {
3348            application_id: APPLICATION_ID,
3349            guild_id: GUILD_ID,
3350            with_localizations: None,
3351        };
3352        assert_eq!(
3353            route.to_string(),
3354            format!("applications/{APPLICATION_ID}/guilds/{GUILD_ID}/commands")
3355        );
3356    }
3357
3358    #[test]
3359    fn set_guild_commands() {
3360        let route = Route::SetGuildCommands {
3361            application_id: APPLICATION_ID,
3362            guild_id: GUILD_ID,
3363        };
3364        assert_eq!(
3365            route.to_string(),
3366            format!("applications/{APPLICATION_ID}/guilds/{GUILD_ID}/commands")
3367        );
3368    }
3369
3370    #[test]
3371    fn create_guild_from_template() {
3372        let route = Route::CreateGuildFromTemplate {
3373            template_code: TEMPLATE_CODE,
3374        };
3375        assert_eq!(
3376            route.to_string(),
3377            format!("guilds/templates/{TEMPLATE_CODE}")
3378        );
3379    }
3380
3381    #[test]
3382    fn get_template() {
3383        let route = Route::GetTemplate {
3384            template_code: TEMPLATE_CODE,
3385        };
3386        assert_eq!(
3387            route.to_string(),
3388            format!("guilds/templates/{TEMPLATE_CODE}")
3389        );
3390    }
3391
3392    #[test]
3393    fn create_guild_integration() {
3394        let route = Route::CreateGuildIntegration { guild_id: GUILD_ID };
3395        assert_eq!(route.to_string(), format!("guilds/{GUILD_ID}/integrations"));
3396    }
3397
3398    #[test]
3399    fn get_guild_integrations() {
3400        let route = Route::GetGuildIntegrations { guild_id: GUILD_ID };
3401        assert_eq!(route.to_string(), format!("guilds/{GUILD_ID}/integrations"));
3402    }
3403
3404    #[test]
3405    fn create_guild_sticker() {
3406        let route = Route::CreateGuildSticker { guild_id: GUILD_ID };
3407        assert_eq!(route.to_string(), format!("guilds/{GUILD_ID}/stickers"));
3408    }
3409
3410    #[test]
3411    fn get_guild_stickers() {
3412        let route = Route::GetGuildStickers { guild_id: GUILD_ID };
3413        assert_eq!(route.to_string(), format!("guilds/{GUILD_ID}/stickers"));
3414    }
3415
3416    #[test]
3417    fn create_invite() {
3418        let route = Route::CreateInvite {
3419            channel_id: CHANNEL_ID,
3420        };
3421        assert_eq!(route.to_string(), format!("channels/{CHANNEL_ID}/invites"));
3422    }
3423
3424    #[test]
3425    fn get_channel_invites() {
3426        let route = Route::GetChannelInvites {
3427            channel_id: CHANNEL_ID,
3428        };
3429        assert_eq!(route.to_string(), format!("channels/{CHANNEL_ID}/invites"));
3430    }
3431
3432    #[test]
3433    fn create_message() {
3434        let route = Route::CreateMessage {
3435            channel_id: CHANNEL_ID,
3436        };
3437        assert_eq!(route.to_string(), format!("channels/{CHANNEL_ID}/messages"));
3438    }
3439
3440    #[test]
3441    fn create_private_channel() {
3442        let route = Route::CreatePrivateChannel;
3443        assert_eq!(route.to_string(), "users/@me/channels");
3444    }
3445
3446    #[test]
3447    fn get_user_private_channels() {
3448        let route = Route::GetUserPrivateChannels;
3449        assert_eq!(route.to_string(), "users/@me/channels");
3450    }
3451
3452    #[test]
3453    fn create_reaction() {
3454        let emoji = emoji();
3455
3456        let route = Route::CreateReaction {
3457            channel_id: CHANNEL_ID,
3458            emoji: &emoji,
3459            message_id: MESSAGE_ID,
3460        };
3461        assert_eq!(
3462            route.to_string(),
3463            format!("channels/{CHANNEL_ID}/messages/{MESSAGE_ID}/reactions/{emoji}/@me")
3464        );
3465    }
3466
3467    #[test]
3468    fn delete_reaction_current_user() {
3469        let emoji = emoji();
3470
3471        let route = Route::DeleteReactionCurrentUser {
3472            channel_id: CHANNEL_ID,
3473            emoji: &emoji,
3474            message_id: MESSAGE_ID,
3475        };
3476        assert_eq!(
3477            route.to_string(),
3478            format!("channels/{CHANNEL_ID}/messages/{MESSAGE_ID}/reactions/{emoji}/@me")
3479        );
3480    }
3481
3482    #[test]
3483    fn create_role() {
3484        let route = Route::CreateRole { guild_id: GUILD_ID };
3485        assert_eq!(route.to_string(), format!("guilds/{GUILD_ID}/roles"));
3486    }
3487
3488    #[test]
3489    fn get_guild_roles() {
3490        let route = Route::GetGuildRoles { guild_id: GUILD_ID };
3491        assert_eq!(route.to_string(), format!("guilds/{GUILD_ID}/roles"));
3492    }
3493
3494    #[test]
3495    fn update_role_positions() {
3496        let route = Route::UpdateRolePositions { guild_id: GUILD_ID };
3497        assert_eq!(route.to_string(), format!("guilds/{GUILD_ID}/roles"));
3498    }
3499
3500    #[test]
3501    fn create_stage_instance() {
3502        let route = Route::CreateStageInstance;
3503        assert_eq!(route.to_string(), "stage-instances");
3504    }
3505
3506    #[test]
3507    fn create_template() {
3508        let route = Route::CreateTemplate { guild_id: GUILD_ID };
3509        assert_eq!(route.to_string(), format!("guilds/{GUILD_ID}/templates"));
3510    }
3511
3512    #[test]
3513    fn get_templates() {
3514        let route = Route::GetTemplates { guild_id: GUILD_ID };
3515        assert_eq!(route.to_string(), format!("guilds/{GUILD_ID}/templates"));
3516    }
3517
3518    #[test]
3519    fn create_thread() {
3520        let route = Route::CreateThread {
3521            channel_id: CHANNEL_ID,
3522        };
3523        assert_eq!(route.to_string(), format!("channels/{CHANNEL_ID}/threads"));
3524    }
3525
3526    #[test]
3527    fn create_thread_from_message() {
3528        let route = Route::CreateThreadFromMessage {
3529            channel_id: CHANNEL_ID,
3530            message_id: MESSAGE_ID,
3531        };
3532        assert_eq!(
3533            route.to_string(),
3534            format!("channels/{CHANNEL_ID}/messages/{MESSAGE_ID}/threads")
3535        );
3536    }
3537
3538    #[test]
3539    fn create_typing_trigger() {
3540        let route = Route::CreateTypingTrigger {
3541            channel_id: CHANNEL_ID,
3542        };
3543        assert_eq!(route.to_string(), format!("channels/{CHANNEL_ID}/typing"));
3544    }
3545
3546    #[test]
3547    fn create_webhook() {
3548        let route = Route::CreateWebhook {
3549            channel_id: CHANNEL_ID,
3550        };
3551        assert_eq!(route.to_string(), format!("channels/{CHANNEL_ID}/webhooks"));
3552    }
3553
3554    #[test]
3555    fn get_channel_webhooks() {
3556        let route = Route::GetChannelWebhooks {
3557            channel_id: CHANNEL_ID,
3558        };
3559        assert_eq!(route.to_string(), format!("channels/{CHANNEL_ID}/webhooks"));
3560    }
3561
3562    #[test]
3563    fn crosspost_message() {
3564        let route = Route::CrosspostMessage {
3565            channel_id: CHANNEL_ID,
3566            message_id: MESSAGE_ID,
3567        };
3568        assert_eq!(
3569            route.to_string(),
3570            format!("channels/{CHANNEL_ID}/messages/{MESSAGE_ID}/crosspost")
3571        );
3572    }
3573
3574    #[test]
3575    fn delete_ban() {
3576        let route = Route::DeleteBan {
3577            guild_id: GUILD_ID,
3578            user_id: USER_ID,
3579        };
3580        assert_eq!(
3581            route.to_string(),
3582            format!("guilds/{GUILD_ID}/bans/{USER_ID}")
3583        );
3584    }
3585
3586    #[test]
3587    fn get_ban() {
3588        let route = Route::GetBan {
3589            guild_id: GUILD_ID,
3590            user_id: USER_ID,
3591        };
3592        assert_eq!(
3593            route.to_string(),
3594            format!("guilds/{GUILD_ID}/bans/{USER_ID}")
3595        );
3596    }
3597
3598    #[test]
3599    fn delete_channel() {
3600        let route = Route::DeleteChannel {
3601            channel_id: CHANNEL_ID,
3602        };
3603        assert_eq!(route.to_string(), format!("channels/{CHANNEL_ID}"));
3604    }
3605
3606    #[test]
3607    fn get_channel() {
3608        let route = Route::GetChannel {
3609            channel_id: CHANNEL_ID,
3610        };
3611        assert_eq!(route.to_string(), format!("channels/{CHANNEL_ID}"));
3612    }
3613
3614    #[test]
3615    fn update_channel() {
3616        let route = Route::UpdateChannel {
3617            channel_id: CHANNEL_ID,
3618        };
3619        assert_eq!(route.to_string(), format!("channels/{CHANNEL_ID}"));
3620    }
3621
3622    #[test]
3623    fn delete_emoji() {
3624        let route = Route::DeleteEmoji {
3625            emoji_id: EMOJI_ID,
3626            guild_id: GUILD_ID,
3627        };
3628        assert_eq!(
3629            route.to_string(),
3630            format!("guilds/{GUILD_ID}/emojis/{EMOJI_ID}")
3631        );
3632    }
3633
3634    #[test]
3635    fn get_emoji() {
3636        let route = Route::GetEmoji {
3637            emoji_id: EMOJI_ID,
3638            guild_id: GUILD_ID,
3639        };
3640        assert_eq!(
3641            route.to_string(),
3642            format!("guilds/{GUILD_ID}/emojis/{EMOJI_ID}")
3643        );
3644    }
3645
3646    #[test]
3647    fn update_emoji() {
3648        let route = Route::UpdateEmoji {
3649            emoji_id: EMOJI_ID,
3650            guild_id: GUILD_ID,
3651        };
3652        assert_eq!(
3653            route.to_string(),
3654            format!("guilds/{GUILD_ID}/emojis/{EMOJI_ID}")
3655        );
3656    }
3657
3658    #[test]
3659    fn delete_global_command() {
3660        let route = Route::DeleteGlobalCommand {
3661            application_id: APPLICATION_ID,
3662            command_id: COMMAND_ID,
3663        };
3664        assert_eq!(
3665            route.to_string(),
3666            format!("applications/{APPLICATION_ID}/commands/{COMMAND_ID}")
3667        );
3668    }
3669
3670    #[test]
3671    fn get_global_command() {
3672        let route = Route::GetGlobalCommand {
3673            application_id: APPLICATION_ID,
3674            command_id: COMMAND_ID,
3675        };
3676        assert_eq!(
3677            route.to_string(),
3678            format!("applications/{APPLICATION_ID}/commands/{COMMAND_ID}")
3679        );
3680    }
3681
3682    #[test]
3683    fn update_global_command() {
3684        let route = Route::UpdateGlobalCommand {
3685            application_id: APPLICATION_ID,
3686            command_id: COMMAND_ID,
3687        };
3688        assert_eq!(
3689            route.to_string(),
3690            format!("applications/{APPLICATION_ID}/commands/{COMMAND_ID}")
3691        );
3692    }
3693
3694    #[test]
3695    fn delete_guild() {
3696        let route = Route::DeleteGuild { guild_id: GUILD_ID };
3697        assert_eq!(route.to_string(), format!("guilds/{GUILD_ID}"));
3698    }
3699
3700    #[test]
3701    fn update_guild() {
3702        let route = Route::UpdateGuild { guild_id: GUILD_ID };
3703        assert_eq!(route.to_string(), format!("guilds/{GUILD_ID}"));
3704    }
3705
3706    #[test]
3707    fn delete_guild_command() {
3708        let route = Route::DeleteGuildCommand {
3709            application_id: APPLICATION_ID,
3710            command_id: COMMAND_ID,
3711            guild_id: GUILD_ID,
3712        };
3713        assert_eq!(
3714            route.to_string(),
3715            format!("applications/{APPLICATION_ID}/guilds/{GUILD_ID}/commands/{COMMAND_ID}")
3716        );
3717    }
3718
3719    #[test]
3720    fn get_guild_command() {
3721        let route = Route::GetGuildCommand {
3722            application_id: APPLICATION_ID,
3723            command_id: COMMAND_ID,
3724            guild_id: GUILD_ID,
3725        };
3726        assert_eq!(
3727            route.to_string(),
3728            format!("applications/{APPLICATION_ID}/guilds/{GUILD_ID}/commands/{COMMAND_ID}")
3729        );
3730    }
3731
3732    #[test]
3733    fn update_guild_command() {
3734        let route = Route::UpdateGuildCommand {
3735            application_id: APPLICATION_ID,
3736            command_id: COMMAND_ID,
3737            guild_id: GUILD_ID,
3738        };
3739        assert_eq!(
3740            route.to_string(),
3741            format!("applications/{APPLICATION_ID}/guilds/{GUILD_ID}/commands/{COMMAND_ID}")
3742        );
3743    }
3744
3745    #[test]
3746    fn delete_guild_integration() {
3747        let route = Route::DeleteGuildIntegration {
3748            guild_id: GUILD_ID,
3749            integration_id: INTEGRATION_ID,
3750        };
3751        assert_eq!(
3752            route.to_string(),
3753            format!("guilds/{GUILD_ID}/integrations/{INTEGRATION_ID}")
3754        );
3755    }
3756
3757    #[test]
3758    fn update_guild_integration() {
3759        let route = Route::UpdateGuildIntegration {
3760            guild_id: GUILD_ID,
3761            integration_id: INTEGRATION_ID,
3762        };
3763        assert_eq!(
3764            route.to_string(),
3765            format!("guilds/{GUILD_ID}/integrations/{INTEGRATION_ID}")
3766        );
3767    }
3768
3769    #[test]
3770    fn delete_interaction_original() {
3771        let route = Route::DeleteInteractionOriginal {
3772            application_id: APPLICATION_ID,
3773            interaction_token: INTERACTION_TOKEN,
3774        };
3775        assert_eq!(
3776            route.to_string(),
3777            format!("webhooks/{APPLICATION_ID}/{INTERACTION_TOKEN}/messages/@original")
3778        );
3779    }
3780
3781    #[test]
3782    fn get_interaction_original() {
3783        let route = Route::GetInteractionOriginal {
3784            application_id: APPLICATION_ID,
3785            interaction_token: INTERACTION_TOKEN,
3786        };
3787        assert_eq!(
3788            route.to_string(),
3789            format!("webhooks/{APPLICATION_ID}/{INTERACTION_TOKEN}/messages/@original")
3790        );
3791    }
3792
3793    #[test]
3794    fn update_interaction_original() {
3795        let route = Route::UpdateInteractionOriginal {
3796            application_id: APPLICATION_ID,
3797            interaction_token: INTERACTION_TOKEN,
3798        };
3799        assert_eq!(
3800            route.to_string(),
3801            format!("webhooks/{APPLICATION_ID}/{INTERACTION_TOKEN}/messages/@original")
3802        );
3803    }
3804
3805    #[test]
3806    fn delete_invite() {
3807        let route = Route::DeleteInvite { code: CODE };
3808        assert_eq!(route.to_string(), format!("invites/{CODE}"));
3809    }
3810
3811    #[test]
3812    fn delete_message_reactions() {
3813        let route = Route::DeleteMessageReactions {
3814            channel_id: CHANNEL_ID,
3815            message_id: MESSAGE_ID,
3816        };
3817        assert_eq!(
3818            route.to_string(),
3819            format!("channels/{CHANNEL_ID}/messages/{MESSAGE_ID}/reactions")
3820        );
3821    }
3822
3823    #[test]
3824    fn delete_message_specific_reaction() {
3825        let emoji = emoji();
3826
3827        let route = Route::DeleteMessageSpecificReaction {
3828            channel_id: CHANNEL_ID,
3829            message_id: MESSAGE_ID,
3830            emoji: &emoji,
3831        };
3832        assert_eq!(
3833            route.to_string(),
3834            format!("channels/{CHANNEL_ID}/messages/{MESSAGE_ID}/reactions/{emoji}")
3835        );
3836    }
3837
3838    #[test]
3839    fn delete_message() {
3840        let route = Route::DeleteMessage {
3841            channel_id: CHANNEL_ID,
3842            message_id: MESSAGE_ID,
3843        };
3844        assert_eq!(
3845            route.to_string(),
3846            format!("channels/{CHANNEL_ID}/messages/{MESSAGE_ID}")
3847        );
3848    }
3849
3850    #[test]
3851    fn get_message() {
3852        let route = Route::GetMessage {
3853            channel_id: CHANNEL_ID,
3854            message_id: MESSAGE_ID,
3855        };
3856        assert_eq!(
3857            route.to_string(),
3858            format!("channels/{CHANNEL_ID}/messages/{MESSAGE_ID}")
3859        );
3860    }
3861
3862    #[test]
3863    fn update_message() {
3864        let route = Route::UpdateMessage {
3865            channel_id: CHANNEL_ID,
3866            message_id: MESSAGE_ID,
3867        };
3868        assert_eq!(
3869            route.to_string(),
3870            format!("channels/{CHANNEL_ID}/messages/{MESSAGE_ID}")
3871        );
3872    }
3873
3874    #[test]
3875    fn delete_messages() {
3876        let route = Route::DeleteMessages {
3877            channel_id: CHANNEL_ID,
3878        };
3879        assert_eq!(
3880            route.to_string(),
3881            format!("channels/{CHANNEL_ID}/messages/bulk-delete")
3882        );
3883    }
3884
3885    #[test]
3886    fn delete_permission_overwrite() {
3887        let route = Route::DeletePermissionOverwrite {
3888            channel_id: CHANNEL_ID,
3889            target_id: ROLE_ID,
3890        };
3891        assert_eq!(
3892            route.to_string(),
3893            format!("channels/{CHANNEL_ID}/permissions/{ROLE_ID}")
3894        );
3895    }
3896
3897    #[test]
3898    fn update_permission_overwrite() {
3899        let route = Route::UpdatePermissionOverwrite {
3900            channel_id: CHANNEL_ID,
3901            target_id: USER_ID,
3902        };
3903        assert_eq!(
3904            route.to_string(),
3905            format!("channels/{CHANNEL_ID}/permissions/{USER_ID}")
3906        );
3907    }
3908
3909    #[test]
3910    fn delete_reaction() {
3911        let emoji = emoji();
3912
3913        let route = Route::DeleteReaction {
3914            channel_id: CHANNEL_ID,
3915            emoji: &emoji,
3916            message_id: MESSAGE_ID,
3917            user_id: USER_ID,
3918        };
3919        assert_eq!(
3920            route.to_string(),
3921            format!("channels/{CHANNEL_ID}/messages/{MESSAGE_ID}/reactions/{emoji}/{USER_ID}")
3922        );
3923    }
3924
3925    #[test]
3926    fn delete_role() {
3927        let route = Route::DeleteRole {
3928            guild_id: GUILD_ID,
3929            role_id: ROLE_ID,
3930        };
3931        assert_eq!(
3932            route.to_string(),
3933            format!("guilds/{GUILD_ID}/roles/{ROLE_ID}")
3934        );
3935    }
3936
3937    #[test]
3938    fn update_role() {
3939        let route = Route::UpdateRole {
3940            guild_id: GUILD_ID,
3941            role_id: ROLE_ID,
3942        };
3943        assert_eq!(
3944            route.to_string(),
3945            format!("guilds/{GUILD_ID}/roles/{ROLE_ID}")
3946        );
3947    }
3948
3949    #[test]
3950    fn delete_stage_instance() {
3951        let route = Route::DeleteStageInstance {
3952            channel_id: CHANNEL_ID,
3953        };
3954        assert_eq!(route.to_string(), format!("stage-instances/{CHANNEL_ID}"));
3955    }
3956
3957    #[test]
3958    fn get_stage_instance() {
3959        let route = Route::GetStageInstance {
3960            channel_id: CHANNEL_ID,
3961        };
3962        assert_eq!(route.to_string(), format!("stage-instances/{CHANNEL_ID}"));
3963    }
3964
3965    #[test]
3966    fn update_stage_instance() {
3967        let route = Route::UpdateStageInstance {
3968            channel_id: CHANNEL_ID,
3969        };
3970        assert_eq!(route.to_string(), format!("stage-instances/{CHANNEL_ID}"));
3971    }
3972
3973    #[test]
3974    fn delete_template() {
3975        let route = Route::DeleteTemplate {
3976            guild_id: GUILD_ID,
3977            template_code: TEMPLATE_CODE,
3978        };
3979        assert_eq!(
3980            route.to_string(),
3981            format!("guilds/{GUILD_ID}/templates/{TEMPLATE_CODE}")
3982        );
3983    }
3984
3985    #[test]
3986    fn sync_template() {
3987        let route = Route::SyncTemplate {
3988            guild_id: GUILD_ID,
3989            template_code: TEMPLATE_CODE,
3990        };
3991        assert_eq!(
3992            route.to_string(),
3993            format!("guilds/{GUILD_ID}/templates/{TEMPLATE_CODE}")
3994        );
3995    }
3996
3997    #[test]
3998    fn update_template() {
3999        let route = Route::UpdateTemplate {
4000            guild_id: GUILD_ID,
4001            template_code: TEMPLATE_CODE,
4002        };
4003        assert_eq!(
4004            route.to_string(),
4005            format!("guilds/{GUILD_ID}/templates/{TEMPLATE_CODE}")
4006        );
4007    }
4008
4009    #[test]
4010    fn follow_news_channel() {
4011        let route = Route::FollowNewsChannel {
4012            channel_id: CHANNEL_ID,
4013        };
4014        assert_eq!(
4015            route.to_string(),
4016            format!("channels/{CHANNEL_ID}/followers")
4017        );
4018    }
4019
4020    #[test]
4021    fn get_active_threads() {
4022        let route = Route::GetActiveThreads { guild_id: GUILD_ID };
4023        assert_eq!(
4024            route.to_string(),
4025            format!("guilds/{GUILD_ID}/threads/active")
4026        );
4027    }
4028
4029    #[test]
4030    fn get_bans() {
4031        let route = Route::GetBans { guild_id: GUILD_ID };
4032        assert_eq!(route.to_string(), format!("guilds/{GUILD_ID}/bans"));
4033    }
4034
4035    #[test]
4036    fn get_bans_with_parameters() {
4037        let route = Route::GetBansWithParameters {
4038            after: None,
4039            before: None,
4040            guild_id: GUILD_ID,
4041            limit: None,
4042        };
4043        assert_eq!(route.to_string(), format!("guilds/{GUILD_ID}/bans"));
4044
4045        let route = Route::GetBansWithParameters {
4046            after: Some(USER_ID),
4047            before: None,
4048            guild_id: GUILD_ID,
4049            limit: None,
4050        };
4051        assert_eq!(
4052            route.to_string(),
4053            format!("guilds/{GUILD_ID}/bans?after={USER_ID}")
4054        );
4055
4056        let route = Route::GetBansWithParameters {
4057            after: None,
4058            before: Some(USER_ID),
4059            guild_id: GUILD_ID,
4060            limit: None,
4061        };
4062        assert_eq!(
4063            route.to_string(),
4064            format!("guilds/{GUILD_ID}/bans?before={USER_ID}")
4065        );
4066
4067        let route = Route::GetBansWithParameters {
4068            after: None,
4069            before: None,
4070            guild_id: GUILD_ID,
4071            limit: Some(100),
4072        };
4073        assert_eq!(
4074            route.to_string(),
4075            format!("guilds/{GUILD_ID}/bans?limit={limit}", limit = 100)
4076        );
4077
4078        let route = Route::GetBansWithParameters {
4079            after: Some(USER_ID),
4080            before: Some(USER_ID + 100),
4081            guild_id: GUILD_ID,
4082            limit: Some(25),
4083        };
4084        assert_eq!(
4085            route.to_string(),
4086            format!(
4087                "guilds/{GUILD_ID}/bans?after={USER_ID}&before={before}&limit={limit}",
4088                before = USER_ID + 100,
4089                limit = 25,
4090            )
4091        );
4092    }
4093
4094    #[test]
4095    fn get_gateway_bot() {
4096        let route = Route::GetGatewayBot;
4097        assert_eq!(route.to_string(), "gateway/bot");
4098    }
4099
4100    #[test]
4101    fn get_entitlements() {
4102        let route = Route::GetEntitlements {
4103            after: Some(32),
4104            application_id: 1,
4105            before: Some(2),
4106            exclude_ended: Some(true),
4107            guild_id: Some(42),
4108            limit: Some(99),
4109            sku_ids: &[Id::new(7)],
4110            user_id: Some(11),
4111        };
4112
4113        assert_eq!(
4114            route.to_string(),
4115            "applications/1/entitlements?after=32&before=2&exclude_ended=true&guild_id=42&limit=99&sku_ids=7&user_id=11"
4116        );
4117    }
4118
4119    #[test]
4120    fn create_test_entitlement() {
4121        let route = Route::CreateTestEntitlement { application_id: 1 };
4122
4123        assert_eq!(route.to_string(), "applications/1/entitlements");
4124    }
4125
4126    #[test]
4127    fn get_command_permissions() {
4128        let route = Route::GetCommandPermissions {
4129            application_id: APPLICATION_ID,
4130            command_id: COMMAND_ID,
4131            guild_id: GUILD_ID,
4132        };
4133        assert_eq!(
4134            route.to_string(),
4135            format!(
4136                "applications/{APPLICATION_ID}/guilds/{GUILD_ID}/commands/{COMMAND_ID}/permissions"
4137            )
4138        );
4139    }
4140
4141    #[test]
4142    fn update_command_permissions() {
4143        let route = Route::UpdateCommandPermissions {
4144            application_id: APPLICATION_ID,
4145            command_id: COMMAND_ID,
4146            guild_id: GUILD_ID,
4147        };
4148        assert_eq!(
4149            route.to_string(),
4150            format!(
4151                "applications/{APPLICATION_ID}/guilds/{GUILD_ID}/commands/{COMMAND_ID}/permissions"
4152            )
4153        );
4154    }
4155
4156    #[test]
4157    fn get_current_authorization_info() {
4158        let route = Route::GetCurrentAuthorizationInformation;
4159        assert_eq!(route.to_string(), "oauth2/@me");
4160    }
4161
4162    #[test]
4163    fn get_current_user_application_info() {
4164        let route = Route::GetCurrentUserApplicationInfo;
4165        assert_eq!(route.to_string(), "applications/@me");
4166    }
4167
4168    #[test]
4169    fn update_current_user_application() {
4170        let route = Route::UpdateCurrentUserApplication;
4171        assert_eq!(route.to_string(), "applications/@me");
4172    }
4173
4174    #[test]
4175    fn get_current_user() {
4176        let route = Route::GetCurrentUser;
4177        assert_eq!(route.to_string(), "users/@me");
4178    }
4179
4180    #[test]
4181    fn get_current_user_guild_member() {
4182        let route = Route::GetCurrentUserGuildMember { guild_id: GUILD_ID };
4183        assert_eq!(
4184            route.to_string(),
4185            format!("users/@me/guilds/{GUILD_ID}/member")
4186        );
4187    }
4188
4189    #[test]
4190    fn update_current_user() {
4191        let route = Route::UpdateCurrentUser;
4192        assert_eq!(route.to_string(), "users/@me");
4193    }
4194
4195    #[test]
4196    fn get_gateway() {
4197        let route = Route::GetGateway;
4198        assert_eq!(route.to_string(), "gateway");
4199    }
4200
4201    #[test]
4202    fn get_guild_command_permissions() {
4203        let route = Route::GetGuildCommandPermissions {
4204            application_id: APPLICATION_ID,
4205            guild_id: GUILD_ID,
4206        };
4207        assert_eq!(
4208            route.to_string(),
4209            format!("applications/{APPLICATION_ID}/guilds/{GUILD_ID}/commands/permissions")
4210        );
4211    }
4212
4213    #[test]
4214    fn get_guild_invites() {
4215        let route = Route::GetGuildInvites { guild_id: GUILD_ID };
4216        assert_eq!(route.to_string(), format!("guilds/{GUILD_ID}/invites"));
4217    }
4218
4219    #[test]
4220    fn get_guild_preview() {
4221        let route = Route::GetGuildPreview { guild_id: GUILD_ID };
4222        assert_eq!(route.to_string(), format!("guilds/{GUILD_ID}/preview"));
4223    }
4224
4225    #[test]
4226    fn get_guild_sticker() {
4227        let route = Route::GetGuildSticker {
4228            guild_id: GUILD_ID,
4229            sticker_id: STICKER_ID,
4230        };
4231        assert_eq!(
4232            route.to_string(),
4233            format!("guilds/{GUILD_ID}/stickers/{STICKER_ID}")
4234        );
4235    }
4236
4237    #[test]
4238    fn delete_guild_sticker() {
4239        let route = Route::DeleteGuildSticker {
4240            guild_id: GUILD_ID,
4241            sticker_id: STICKER_ID,
4242        };
4243        assert_eq!(
4244            route.to_string(),
4245            format!("guilds/{GUILD_ID}/stickers/{STICKER_ID}")
4246        );
4247    }
4248
4249    #[test]
4250    fn update_guild_sticker() {
4251        let route = Route::UpdateGuildSticker {
4252            guild_id: GUILD_ID,
4253            sticker_id: STICKER_ID,
4254        };
4255        assert_eq!(
4256            route.to_string(),
4257            format!("guilds/{GUILD_ID}/stickers/{STICKER_ID}")
4258        );
4259    }
4260
4261    #[test]
4262    fn get_guild_vanity_url() {
4263        let route = Route::GetGuildVanityUrl { guild_id: GUILD_ID };
4264        assert_eq!(route.to_string(), format!("guilds/{GUILD_ID}/vanity-url"));
4265    }
4266
4267    #[test]
4268    fn get_guild_voice_regions() {
4269        let route = Route::GetGuildVoiceRegions { guild_id: GUILD_ID };
4270        assert_eq!(route.to_string(), format!("guilds/{GUILD_ID}/regions"));
4271    }
4272
4273    #[test]
4274    fn get_guild_welcome_screen() {
4275        let route = Route::GetGuildWelcomeScreen { guild_id: GUILD_ID };
4276        assert_eq!(
4277            route.to_string(),
4278            format!("guilds/{GUILD_ID}/welcome-screen")
4279        );
4280    }
4281
4282    #[test]
4283    fn update_guild_welcome_screen() {
4284        let route = Route::UpdateGuildWelcomeScreen { guild_id: GUILD_ID };
4285        assert_eq!(
4286            route.to_string(),
4287            format!("guilds/{GUILD_ID}/welcome-screen")
4288        );
4289    }
4290
4291    #[test]
4292    fn get_guild_webhooks() {
4293        let route = Route::GetGuildWebhooks { guild_id: GUILD_ID };
4294        assert_eq!(route.to_string(), format!("guilds/{GUILD_ID}/webhooks"));
4295    }
4296
4297    #[test]
4298    fn get_guild_widget() {
4299        let route = Route::GetGuildWidget { guild_id: GUILD_ID };
4300        assert_eq!(route.to_string(), format!("guilds/{GUILD_ID}/widget.json"));
4301    }
4302
4303    #[test]
4304    fn get_guild_widget_settings() {
4305        let route = Route::GetGuildWidgetSettings { guild_id: GUILD_ID };
4306        assert_eq!(route.to_string(), format!("guilds/{GUILD_ID}/widget"));
4307    }
4308
4309    #[test]
4310    fn update_guild_widget_settings() {
4311        let route = Route::UpdateGuildWidgetSettings { guild_id: GUILD_ID };
4312        assert_eq!(route.to_string(), format!("guilds/{GUILD_ID}/widget"));
4313    }
4314
4315    #[test]
4316    fn get_nitro_sticker_packs() {
4317        let route = Route::GetNitroStickerPacks;
4318
4319        assert_eq!(route.to_string(), "sticker-packs");
4320    }
4321
4322    #[test]
4323    fn get_pins() {
4324        let route = Route::GetPins {
4325            channel_id: CHANNEL_ID,
4326        };
4327        assert_eq!(route.to_string(), format!("channels/{CHANNEL_ID}/pins"));
4328    }
4329
4330    #[test]
4331    fn get_sticker() {
4332        let route = Route::GetSticker {
4333            sticker_id: STICKER_ID,
4334        };
4335        assert_eq!(route.to_string(), format!("stickers/{STICKER_ID}"));
4336    }
4337
4338    #[test]
4339    fn get_thread_members() {
4340        let route = Route::GetThreadMembers {
4341            after: None,
4342            channel_id: CHANNEL_ID,
4343            limit: None,
4344            with_member: None,
4345        };
4346        assert_eq!(
4347            route.to_string(),
4348            format!("channels/{CHANNEL_ID}/thread-members")
4349        );
4350
4351        let route = Route::GetThreadMembers {
4352            after: Some(USER_ID),
4353            channel_id: CHANNEL_ID,
4354            limit: Some(1),
4355            with_member: Some(true),
4356        };
4357
4358        assert_eq!(
4359            route.to_string(),
4360            format!(
4361                "channels/{CHANNEL_ID}/thread-members?after={USER_ID}&limit=1&with_member=true"
4362            )
4363        );
4364    }
4365
4366    #[test]
4367    fn get_user_connections() {
4368        let route = Route::GetUserConnections;
4369        assert_eq!(route.to_string(), "users/@me/connections");
4370    }
4371
4372    #[test]
4373    fn get_user() {
4374        let route = Route::GetUser { user_id: USER_ID };
4375        assert_eq!(route.to_string(), format!("users/{USER_ID}"));
4376    }
4377
4378    #[test]
4379    fn get_voice_regions() {
4380        let route = Route::GetVoiceRegions;
4381        assert_eq!(route.to_string(), "voice/regions");
4382    }
4383
4384    #[test]
4385    fn interaction_callback() {
4386        let route = Route::InteractionCallback {
4387            interaction_id: INTERACTION_ID,
4388            interaction_token: INTERACTION_TOKEN,
4389        };
4390        assert_eq!(
4391            route.to_string(),
4392            format!("interactions/{INTERACTION_ID}/{INTERACTION_TOKEN}/callback")
4393        );
4394    }
4395
4396    #[test]
4397    fn join_thread() {
4398        let route = Route::JoinThread {
4399            channel_id: CHANNEL_ID,
4400        };
4401        assert_eq!(
4402            route.to_string(),
4403            format!("channels/{CHANNEL_ID}/thread-members/@me")
4404        );
4405    }
4406
4407    #[test]
4408    fn leave_thread() {
4409        let route = Route::LeaveThread {
4410            channel_id: CHANNEL_ID,
4411        };
4412        assert_eq!(
4413            route.to_string(),
4414            format!("channels/{CHANNEL_ID}/thread-members/@me")
4415        );
4416    }
4417
4418    #[test]
4419    fn leave_guild() {
4420        let route = Route::LeaveGuild { guild_id: GUILD_ID };
4421        assert_eq!(route.to_string(), format!("users/@me/guilds/{GUILD_ID}"));
4422    }
4423
4424    #[test]
4425    fn pin_message() {
4426        let route = Route::PinMessage {
4427            channel_id: CHANNEL_ID,
4428            message_id: MESSAGE_ID,
4429        };
4430        assert_eq!(
4431            route.to_string(),
4432            format!("channels/{CHANNEL_ID}/pins/{MESSAGE_ID}")
4433        );
4434    }
4435
4436    #[test]
4437    fn unpin_message() {
4438        let route = Route::UnpinMessage {
4439            channel_id: CHANNEL_ID,
4440            message_id: MESSAGE_ID,
4441        };
4442        assert_eq!(
4443            route.to_string(),
4444            format!("channels/{CHANNEL_ID}/pins/{MESSAGE_ID}")
4445        );
4446    }
4447
4448    #[test]
4449    fn sync_guild_integration() {
4450        let route = Route::SyncGuildIntegration {
4451            guild_id: GUILD_ID,
4452            integration_id: INTEGRATION_ID,
4453        };
4454        assert_eq!(
4455            route.to_string(),
4456            format!("guilds/{GUILD_ID}/integrations/{INTEGRATION_ID}/sync")
4457        );
4458    }
4459
4460    #[test]
4461    fn update_current_member() {
4462        let route = Route::UpdateCurrentMember { guild_id: GUILD_ID };
4463        assert_eq!(route.to_string(), format!("guilds/{GUILD_ID}/members/@me"));
4464    }
4465
4466    #[test]
4467    fn get_current_user_voice_state() {
4468        let route = Route::GetCurrentUserVoiceState { guild_id: GUILD_ID };
4469        assert_eq!(
4470            route.to_string(),
4471            format!("guilds/{GUILD_ID}/voice-states/@me")
4472        );
4473    }
4474
4475    #[test]
4476    fn update_current_user_voice_state() {
4477        let route = Route::UpdateCurrentUserVoiceState { guild_id: GUILD_ID };
4478        assert_eq!(
4479            route.to_string(),
4480            format!("guilds/{GUILD_ID}/voice-states/@me")
4481        );
4482    }
4483
4484    #[test]
4485    fn update_nickname() {
4486        let route = Route::UpdateNickname { guild_id: GUILD_ID };
4487        assert_eq!(
4488            route.to_string(),
4489            format!("guilds/{GUILD_ID}/members/@me/nick")
4490        );
4491    }
4492
4493    #[test]
4494    fn get_user_voice_state() {
4495        let route = Route::GetUserVoiceState {
4496            guild_id: GUILD_ID,
4497            user_id: USER_ID,
4498        };
4499        assert_eq!(
4500            route.to_string(),
4501            format!("guilds/{GUILD_ID}/voice-states/{USER_ID}")
4502        );
4503    }
4504
4505    #[test]
4506    fn update_user_voice_state() {
4507        let route = Route::UpdateUserVoiceState {
4508            guild_id: GUILD_ID,
4509            user_id: USER_ID,
4510        };
4511        assert_eq!(
4512            route.to_string(),
4513            format!("guilds/{GUILD_ID}/voice-states/{USER_ID}")
4514        );
4515    }
4516
4517    #[test]
4518    fn create_ban() {
4519        let mut route = Route::CreateBan {
4520            guild_id: GUILD_ID,
4521            user_id: USER_ID,
4522        };
4523        assert_eq!(
4524            route.to_string(),
4525            format!("guilds/{GUILD_ID}/bans/{USER_ID}")
4526        );
4527
4528        route = Route::CreateBan {
4529            guild_id: GUILD_ID,
4530            user_id: USER_ID,
4531        };
4532        assert_eq!(
4533            route.to_string(),
4534            format!("guilds/{GUILD_ID}/bans/{USER_ID}")
4535        );
4536    }
4537
4538    #[test]
4539    fn create_guild_prune_none() {
4540        let route = Route::CreateGuildPrune {
4541            compute_prune_count: None,
4542            days: None,
4543            guild_id: GUILD_ID,
4544            include_roles: &[],
4545        };
4546        assert_eq!(route.to_string(), format!("guilds/{GUILD_ID}/prune"));
4547    }
4548
4549    #[test]
4550    fn create_guild_prune_compute_prune_count_true() {
4551        let route = Route::CreateGuildPrune {
4552            compute_prune_count: Some(true),
4553            days: None,
4554            guild_id: GUILD_ID,
4555            include_roles: &[],
4556        };
4557        assert_eq!(
4558            route.to_string(),
4559            format!("guilds/{GUILD_ID}/prune?compute_prune_count=true")
4560        );
4561    }
4562
4563    #[test]
4564    fn create_guild_prune_compute_prune_count_false() {
4565        let route = Route::CreateGuildPrune {
4566            compute_prune_count: Some(false),
4567            days: None,
4568            guild_id: GUILD_ID,
4569            include_roles: &[],
4570        };
4571        assert_eq!(
4572            route.to_string(),
4573            format!("guilds/{GUILD_ID}/prune?compute_prune_count=false")
4574        );
4575    }
4576
4577    #[test]
4578    fn create_guild_prune_days() {
4579        let route = Route::CreateGuildPrune {
4580            compute_prune_count: None,
4581            days: Some(4),
4582            guild_id: GUILD_ID,
4583            include_roles: &[],
4584        };
4585        assert_eq!(route.to_string(), format!("guilds/{GUILD_ID}/prune?days=4"));
4586    }
4587
4588    #[test]
4589    fn create_guild_prune_include_one_role() {
4590        let include_roles = [Id::new(1)];
4591
4592        let route = Route::CreateGuildPrune {
4593            compute_prune_count: None,
4594            days: None,
4595            guild_id: GUILD_ID,
4596            include_roles: &include_roles,
4597        };
4598        assert_eq!(
4599            route.to_string(),
4600            format!("guilds/{GUILD_ID}/prune?include_roles=1")
4601        );
4602    }
4603
4604    #[test]
4605    fn create_guild_prune_include_two_roles() {
4606        let include_roles = [Id::new(1), Id::new(2)];
4607
4608        let route = Route::CreateGuildPrune {
4609            compute_prune_count: None,
4610            days: None,
4611            guild_id: GUILD_ID,
4612            include_roles: &include_roles,
4613        };
4614        assert_eq!(
4615            route.to_string(),
4616            format!("guilds/{GUILD_ID}/prune?include_roles=1,2")
4617        );
4618    }
4619
4620    #[test]
4621    fn create_guild_prune_all() {
4622        let include_roles = [Id::new(1), Id::new(2)];
4623
4624        let route = Route::CreateGuildPrune {
4625            compute_prune_count: Some(true),
4626            days: Some(4),
4627            guild_id: GUILD_ID,
4628            include_roles: &include_roles,
4629        };
4630        assert_eq!(
4631            route.to_string(),
4632            format!("guilds/{GUILD_ID}/prune?compute_prune_count=true&days=4&include_roles=1,2")
4633        );
4634    }
4635
4636    #[test]
4637    fn get_guild_scheduled_events() {
4638        let route = Route::GetGuildScheduledEvents {
4639            guild_id: GUILD_ID,
4640            with_user_count: false,
4641        };
4642
4643        assert_eq!(
4644            route.to_string(),
4645            format!("guilds/{GUILD_ID}/scheduled-events")
4646        );
4647
4648        let route = Route::GetGuildScheduledEvents {
4649            guild_id: GUILD_ID,
4650            with_user_count: true,
4651        };
4652
4653        assert_eq!(
4654            route.to_string(),
4655            format!("guilds/{GUILD_ID}/scheduled-events?with_user_count=true")
4656        );
4657    }
4658
4659    #[test]
4660    fn create_guild_scheduled_event() {
4661        let route = Route::CreateGuildScheduledEvent { guild_id: GUILD_ID };
4662
4663        assert_eq!(
4664            route.to_string(),
4665            format!("guilds/{GUILD_ID}/scheduled-events")
4666        );
4667    }
4668
4669    #[test]
4670    fn get_guild_scheduled_event() {
4671        let route = Route::GetGuildScheduledEvent {
4672            guild_id: GUILD_ID,
4673            scheduled_event_id: SCHEDULED_EVENT_ID,
4674            with_user_count: false,
4675        };
4676
4677        assert_eq!(
4678            route.to_string(),
4679            format!("guilds/{GUILD_ID}/scheduled-events/{SCHEDULED_EVENT_ID}")
4680        );
4681
4682        let route = Route::GetGuildScheduledEvent {
4683            guild_id: GUILD_ID,
4684            scheduled_event_id: SCHEDULED_EVENT_ID,
4685            with_user_count: true,
4686        };
4687
4688        assert_eq!(
4689            route.to_string(),
4690            format!("guilds/{GUILD_ID}/scheduled-events/{SCHEDULED_EVENT_ID}?with_user_count=true")
4691        );
4692    }
4693
4694    #[test]
4695    fn update_guild_scheduled_event() {
4696        let route = Route::UpdateGuildScheduledEvent {
4697            guild_id: GUILD_ID,
4698            scheduled_event_id: SCHEDULED_EVENT_ID,
4699        };
4700
4701        assert_eq!(
4702            route.to_string(),
4703            format!("guilds/{GUILD_ID}/scheduled-events/{SCHEDULED_EVENT_ID}")
4704        );
4705    }
4706
4707    #[test]
4708    fn delete_guild_scheduled_event() {
4709        let route = Route::DeleteGuildScheduledEvent {
4710            guild_id: GUILD_ID,
4711            scheduled_event_id: SCHEDULED_EVENT_ID,
4712        };
4713
4714        assert_eq!(
4715            route.to_string(),
4716            format!("guilds/{GUILD_ID}/scheduled-events/{SCHEDULED_EVENT_ID}")
4717        );
4718    }
4719
4720    #[test]
4721    fn get_guild_scheduled_event_users() {
4722        let route = Route::GetGuildScheduledEventUsers {
4723            after: None,
4724            before: Some(USER_ID),
4725            guild_id: GUILD_ID,
4726            limit: None,
4727            scheduled_event_id: SCHEDULED_EVENT_ID,
4728            with_member: true,
4729        };
4730
4731        assert_eq!(
4732            route.to_string(),
4733            format!(
4734                "guilds/{GUILD_ID}/scheduled-events/{SCHEDULED_EVENT_ID}/users?before={USER_ID}&with_member=true"
4735            )
4736        );
4737
4738        let route = Route::GetGuildScheduledEventUsers {
4739            after: Some(USER_ID),
4740            before: None,
4741            guild_id: GUILD_ID,
4742            limit: Some(101),
4743            scheduled_event_id: SCHEDULED_EVENT_ID,
4744            with_member: false,
4745        };
4746
4747        assert_eq!(
4748            route.to_string(),
4749            format!(
4750                "guilds/{GUILD_ID}/scheduled-events/{SCHEDULED_EVENT_ID}/users?after={USER_ID}&limit=101"
4751            )
4752        );
4753
4754        let route = Route::GetGuildScheduledEventUsers {
4755            after: Some(USER_ID),
4756            before: Some(USER_ID),
4757            guild_id: GUILD_ID,
4758            limit: Some(99),
4759            scheduled_event_id: SCHEDULED_EVENT_ID,
4760            with_member: false,
4761        };
4762
4763        assert_eq!(
4764            route.to_string(),
4765            format!(
4766                "guilds/{GUILD_ID}/scheduled-events/{SCHEDULED_EVENT_ID}/users?after={USER_ID}&before={USER_ID}&limit=99"
4767            )
4768        );
4769    }
4770
4771    #[test]
4772    fn search_guild_members() {
4773        let route = Route::SearchGuildMembers {
4774            guild_id: GUILD_ID,
4775            limit: Some(99),
4776            query: "foo bar",
4777        };
4778
4779        assert_eq!(
4780            route.to_string(),
4781            format!("guilds/{GUILD_ID}/members/search?query=foo%20bar&limit=99")
4782        );
4783
4784        let route = Route::SearchGuildMembers {
4785            guild_id: GUILD_ID,
4786            limit: Some(99),
4787            query: "foo/bar",
4788        };
4789
4790        assert_eq!(
4791            route.to_string(),
4792            format!("guilds/{GUILD_ID}/members/search?query=foo%2Fbar&limit=99")
4793        );
4794    }
4795
4796    #[test]
4797    fn update_guild_mfa() {
4798        let route = Route::UpdateGuildMfa { guild_id: GUILD_ID };
4799        assert_eq!(route.to_string(), format!("guilds/{GUILD_ID}/mfa"));
4800    }
4801
4802    #[test]
4803    fn create_auto_moderation_rule() {
4804        let route = Route::CreateAutoModerationRule { guild_id: GUILD_ID };
4805        assert_eq!(
4806            route.to_string(),
4807            format!("guilds/{GUILD_ID}/auto-moderation/rules")
4808        );
4809    }
4810
4811    #[test]
4812    fn delete_auto_moderation_rule() {
4813        let route = Route::DeleteAutoModerationRule {
4814            guild_id: GUILD_ID,
4815            auto_moderation_rule_id: AUTO_MODERATION_RULE_ID,
4816        };
4817        assert_eq!(
4818            route.to_string(),
4819            format!("guilds/{GUILD_ID}/auto-moderation/rules/{AUTO_MODERATION_RULE_ID}")
4820        );
4821    }
4822
4823    #[test]
4824    fn get_auto_moderation_rule() {
4825        let route = Route::GetAutoModerationRule {
4826            guild_id: GUILD_ID,
4827            auto_moderation_rule_id: AUTO_MODERATION_RULE_ID,
4828        };
4829        assert_eq!(
4830            route.to_string(),
4831            format!("guilds/{GUILD_ID}/auto-moderation/rules/{AUTO_MODERATION_RULE_ID}")
4832        );
4833    }
4834
4835    #[test]
4836    fn get_guild_auto_moderation_rules() {
4837        let route = Route::GetGuildAutoModerationRules { guild_id: GUILD_ID };
4838        assert_eq!(
4839            route.to_string(),
4840            format!("guilds/{GUILD_ID}/auto-moderation/rules")
4841        );
4842    }
4843
4844    #[test]
4845    fn update_auto_moderation_rule() {
4846        let route = Route::UpdateAutoModerationRule {
4847            guild_id: GUILD_ID,
4848            auto_moderation_rule_id: AUTO_MODERATION_RULE_ID,
4849        };
4850        assert_eq!(
4851            route.to_string(),
4852            format!("guilds/{GUILD_ID}/auto-moderation/rules/{AUTO_MODERATION_RULE_ID}")
4853        );
4854    }
4855
4856    #[test]
4857    fn get_guild_onboarding() {
4858        let route = Route::GetGuildOnboarding { guild_id: GUILD_ID };
4859        assert_eq!(route.to_string(), format!("guilds/{GUILD_ID}/onboarding"));
4860    }
4861
4862    #[test]
4863    fn get_skus() {
4864        let route = Route::GetSKUs { application_id: 1 };
4865        assert_eq!(route.to_string(), format!("applications/1/skus"));
4866    }
4867}