diff --git a/examples/follow_profile.rs b/examples/follow_profile.rs index ba0b8c3..9e589d2 100644 --- a/examples/follow_profile.rs +++ b/examples/follow_profile.rs @@ -9,7 +9,7 @@ use std::error; fn main() -> Result<(), Box> { let mastodon = register::get_mastodon_data()?; let input = register::read_line("Enter the account id you'd like to follow: ")?; - let new_follow = mastodon.follow(input.trim().parse()?)?; + let new_follow = mastodon.follow(input.trim())?; println!("{:#?}", new_follow); diff --git a/src/lib.rs b/src/lib.rs index aad83e9..6e63541 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -249,7 +249,7 @@ impl MastodonClient for Mastodon { } /// PUT /api/v1/filters/:id - fn update_filter(&self, id: u64, request: &mut AddFilterRequest) -> Result { + fn update_filter(&self, id: &str, request: &mut AddFilterRequest) -> Result { let url = self.route(&format!("/api/v1/filters/{}", id)); let response = self.send(self.client.put(&url).json(&request))?; diff --git a/src/macros.rs b/src/macros.rs index 967cb16..0f9f1a2 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -308,12 +308,12 @@ macro_rules! route_id { "# token: \"tsaohueaheis\".into(),\n", "# };\n", "let client = Mastodon::from(data);\n", - "client.", stringify!($name), "(42);\n", + "client.", stringify!($name), "(\"42\");\n", "# Ok(())\n", "# }\n", "```" ), - fn $name(&self, id: u64) -> Result<$ret> { + fn $name(&self, id: &str) -> Result<$ret> { self.$method(self.route(&format!(concat!("/api/v1/", $url), id))) } } diff --git a/src/mastodon_client.rs b/src/mastodon_client.rs index b44c1ea..ca8a98a 100644 --- a/src/mastodon_client.rs +++ b/src/mastodon_client.rs @@ -118,67 +118,67 @@ pub trait MastodonClient { unimplemented!("This method was not implemented"); } /// GET /api/v1/accounts/:id - fn get_account(&self, id: u64) -> Result { + fn get_account(&self, id: &str) -> Result { unimplemented!("This method was not implemented"); } /// POST /api/v1/accounts/:id/follow - fn follow(&self, id: u64) -> Result { + fn follow(&self, id: &str) -> Result { unimplemented!("This method was not implemented"); } /// POST /api/v1/accounts/:id/unfollow - fn unfollow(&self, id: u64) -> Result { + fn unfollow(&self, id: &str) -> Result { unimplemented!("This method was not implemented"); } /// GET /api/v1/accounts/:id/block - fn block(&self, id: u64) -> Result { + fn block(&self, id: &str) -> Result { unimplemented!("This method was not implemented"); } /// GET /api/v1/accounts/:id/unblock - fn unblock(&self, id: u64) -> Result { + fn unblock(&self, id: &str) -> Result { unimplemented!("This method was not implemented"); } /// GET /api/v1/accounts/:id/mute - fn mute(&self, id: u64) -> Result { + fn mute(&self, id: &str) -> Result { unimplemented!("This method was not implemented"); } /// GET /api/v1/accounts/:id/unmute - fn unmute(&self, id: u64) -> Result { + fn unmute(&self, id: &str) -> Result { unimplemented!("This method was not implemented"); } /// GET /api/v1/notifications/:id - fn get_notification(&self, id: u64) -> Result { + fn get_notification(&self, id: &str) -> Result { unimplemented!("This method was not implemented"); } /// GET /api/v1/statuses/:id - fn get_status(&self, id: u64) -> Result { + fn get_status(&self, id: &str) -> Result { unimplemented!("This method was not implemented"); } /// GET /api/v1/statuses/:id/context - fn get_context(&self, id: u64) -> Result { + fn get_context(&self, id: &str) -> Result { unimplemented!("This method was not implemented"); } /// GET /api/v1/statuses/:id/card - fn get_card(&self, id: u64) -> Result { + fn get_card(&self, id: &str) -> Result { unimplemented!("This method was not implemented"); } /// POST /api/v1/statuses/:id/reblog - fn reblog(&self, id: u64) -> Result { + fn reblog(&self, id: &str) -> Result { unimplemented!("This method was not implemented"); } /// POST /api/v1/statuses/:id/unreblog - fn unreblog(&self, id: u64) -> Result { + fn unreblog(&self, id: &str) -> Result { unimplemented!("This method was not implemented"); } /// POST /api/v1/statuses/:id/favourite - fn favourite(&self, id: u64) -> Result { + fn favourite(&self, id: &str) -> Result { unimplemented!("This method was not implemented"); } /// POST /api/v1/statuses/:id/unfavourite - fn unfavourite(&self, id: u64) -> Result { + fn unfavourite(&self, id: &str) -> Result { unimplemented!("This method was not implemented"); } /// DELETE /api/v1/statuses/:id - fn delete_status(&self, id: u64) -> Result { + fn delete_status(&self, id: &str) -> Result { unimplemented!("This method was not implemented"); } /// PATCH /api/v1/accounts/update_credentials @@ -242,15 +242,15 @@ pub trait MastodonClient { unimplemented!("This method was not implemented"); } /// GET /api/v1/filters/:id - fn get_filter(&self, id: u64) -> Result { + fn get_filter(&self, id: &str) -> Result { unimplemented!("This method was not implemented"); } /// PUT /api/v1/filters/:id - fn update_filter(&self, id: u64, request: &mut AddFilterRequest) -> Result { + fn update_filter(&self, id: &str, request: &mut AddFilterRequest) -> Result { unimplemented!("This method was not implemented"); } /// DELETE /api/v1/filters/:id - fn delete_filter(&self, id: u64) -> Result { + fn delete_filter(&self, id: &str) -> Result { unimplemented!("This method was not implemented"); } /// GET /api/v1/suggestions @@ -258,7 +258,7 @@ pub trait MastodonClient { unimplemented!("This method was not implemented"); } /// DELETE /api/v1/suggestions/:account_id - fn delete_from_suggestions(&self, id: u64) -> Result { + fn delete_from_suggestions(&self, id: &str) -> Result { unimplemented!("This method was not implemented"); } /// GET /api/v1/endorsements @@ -266,11 +266,11 @@ pub trait MastodonClient { unimplemented!("This method was not implemented"); } /// POST /api/v1/accounts/:id/pin - fn endorse_user(&self, id: u64) -> Result { + fn endorse_user(&self, id: &str) -> Result { unimplemented!("This method was not implemented"); } /// POST /api/v1/accounts/:id/unpin - fn unendorse_user(&self, id: u64) -> Result { + fn unendorse_user(&self, id: &str) -> Result { unimplemented!("This method was not implemented"); } }