diff --git a/Cargo.toml b/Cargo.toml index b336b20..b10583d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,6 @@ tap-reader = "1" try_from = "0.2.2" toml = { version = "0.4.6", optional = true } - [dependencies.chrono] version = "0.4" features = ["serde"] diff --git a/src/entities/relationship.rs b/src/entities/relationship.rs index 888f7cd..7e6aced 100644 --- a/src/entities/relationship.rs +++ b/src/entities/relationship.rs @@ -22,4 +22,10 @@ pub struct Relationship { pub domain_blocking: bool, /// Whether the user's reblogs will show up in the home timeline pub showing_reblogs: bool, + /// Whether the user is currently endorsing the account + /// + /// This field is not techincally nullable with mastodon >= 2.5.0, but + /// making it `Option` here means we shouldn't get deser errors when + /// making calls to pleroma or mastodon<2.5.0 instances + pub endorsed: bool, } diff --git a/src/lib.rs b/src/lib.rs index 78bbd18..695246c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -181,6 +181,7 @@ impl MastodonClient for Mastodon { (get) notifications: "notifications" => Notification, (get) reports: "reports" => Report, (get (q: &'a str, #[serde(skip_serializing_if = "Option::is_none")] limit: Option, following: bool,)) search_accounts: "accounts/search" => Account, + (get) get_endorsements: "endorsements" => Account, } paged_routes_with_id! { @@ -233,6 +234,8 @@ impl MastodonClient for Mastodon { (get) get_filter: "filters/{}" => Filter, (delete) delete_filter: "filters/{}" => Empty, (delete) delete_from_suggestions: "suggestions/{}" => Empty, + (post) endorse_user: "accounts/{}/pin" => Relationship, + (post) unendorse_user: "accounts/{}/unpin" => Relationship, } fn add_filter(&self, request: &mut AddFilterRequest) -> Result { diff --git a/src/mastodon_client.rs b/src/mastodon_client.rs index e1e9c6a..b44c1ea 100644 --- a/src/mastodon_client.rs +++ b/src/mastodon_client.rs @@ -261,4 +261,16 @@ pub trait MastodonClient { fn delete_from_suggestions(&self, id: u64) -> Result { unimplemented!("This method was not implemented"); } + /// GET /api/v1/endorsements + fn get_endorsements(&self) -> Result> { + unimplemented!("This method was not implemented"); + } + /// POST /api/v1/accounts/:id/pin + fn endorse_user(&self, id: u64) -> Result { + unimplemented!("This method was not implemented"); + } + /// POST /api/v1/accounts/:id/unpin + fn unendorse_user(&self, id: u64) -> Result { + unimplemented!("This method was not implemented"); + } }