diff --git a/src/macros.rs b/src/macros.rs index 18f14c7..2a74c85 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -440,7 +440,7 @@ macro_rules! paged_routes_with_id { } macro_rules! streaming { - ($stream:literal@$fn_name:ident ($desc:tt), $($rest:tt)*) => { + ($desc:tt $fn_name:ident@$stream:literal, $($rest:tt)*) => { doc_comment! { concat!( $desc, @@ -468,7 +468,7 @@ tokio_test::block_on(async { });" ), pub async fn $fn_name(&self) -> Result> { - let url = self.route(concat!("/api/v1/streaming/", stringify!($stream))); + let url = self.route(&format!("/api/v1/streaming/{}", $stream)); let response = self.authenticated(self.client.get(&url)).send().await?; debug!( status = log_serde!(response Status), url = &url, @@ -480,7 +480,7 @@ tokio_test::block_on(async { } streaming! { $($rest)* } }; - ($stream:literal($param:ident: $param_type:ty, like $param_doc_val:literal)@$fn_name:ident ($desc:tt), $($rest:tt)*) => { + ($desc:tt $fn_name:ident($param:ident: $param_type:ty, like $param_doc_val:literal)@$stream:literal, $($rest:tt)*) => { doc_comment! { concat!( $desc, diff --git a/src/mastodon.rs b/src/mastodon.rs index 5182281..31adfa0 100644 --- a/src/mastodon.rs +++ b/src/mastodon.rs @@ -130,18 +130,30 @@ impl Mastodon { } streaming! { - "user"@stream_user ("returns events that are relevant to the authorized user, i.e. home timeline & notifications"), - "public"@stream_public ("All public posts known to the server. Analogous to the federated timeline."), - "public:media"@stream_public_media ("All public posts known to the server, filtered for media attachments. Analogous to the federated timeline with 'only media' enabled."), - "public:local"@stream_local ("All public posts originating from this server."), - "public:local:media"@stream_local_media ("All public posts originating from this server, filtered for media attachments. Analogous to the local timeline with 'only media' enabled."), - "public:remote"@stream_remote ("All public posts originating from other servers."), - "public:remote:media"@stream_remote_media ("All public posts originating from other servers, filtered for media attachments."), - "hashtag"(tag: impl AsRef, like "#bots")@stream_hashtag ("All public posts using a certain hashtag."), - "hashtag:local"(tag: impl AsRef, like "#bots")@stream_local_hashtag ("All public posts using a certain hashtag, originating from this server."), - "user:notification"@stream_notifications ("Notifications for the current user."), - "list"(list: impl AsRef, like "12345")@stream_list ("Updates to a specific list."), - "direct"@stream_direct ("Updates to direct conversations."), + "returns events that are relevant to the authorized user, i.e. home timeline & notifications" + stream_user@"user", + "All public posts known to the server. Analogous to the federated timeline." + stream_public@"public", + "All public posts known to the server, filtered for media attachments. Analogous to the federated timeline with 'only media' enabled." + stream_public_media@"public:media", + "All public posts originating from this server." + stream_local@"public:local", + "All public posts originating from this server, filtered for media attachments. Analogous to the local timeline with 'only media' enabled." + stream_local_media@"public:local:media", + "All public posts originating from other servers." + stream_remote@"public:remote", + "All public posts originating from other servers, filtered for media attachments." + stream_remote_media@"public:remote:media", + "All public posts using a certain hashtag." + stream_hashtag(tag: impl AsRef, like "#bots")@"hashtag", + "All public posts using a certain hashtag, originating from this server." + stream_local_hashtag(tag: impl AsRef, like "#bots")@"hashtag:local", + "Notifications for the current user." + stream_notifications@"user:notification", + "Updates to a specific list." + stream_list(list: impl AsRef, like "12345")@"list", + "Updates to direct conversations." + stream_direct@"direct", } /// Create a new Mastodon Client