Add the "endorsements" endpoints from mastodon 2.5.0

Closes #74
master
Paul Woolcock 6 years ago
parent 7de1bdc009
commit 1f0ba1846c
  1. 1
      Cargo.toml
  2. 6
      src/entities/relationship.rs
  3. 3
      src/lib.rs
  4. 12
      src/mastodon_client.rs

@ -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"]

@ -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<bool>` here means we shouldn't get deser errors when
/// making calls to pleroma or mastodon<2.5.0 instances
pub endorsed: bool,
}

@ -181,6 +181,7 @@ impl<H: HttpSend> MastodonClient<H> for Mastodon<H> {
(get) notifications: "notifications" => Notification,
(get) reports: "reports" => Report,
(get (q: &'a str, #[serde(skip_serializing_if = "Option::is_none")] limit: Option<u64>, following: bool,)) search_accounts: "accounts/search" => Account,
(get) get_endorsements: "endorsements" => Account,
}
paged_routes_with_id! {
@ -233,6 +234,8 @@ impl<H: HttpSend> MastodonClient<H> for Mastodon<H> {
(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<Filter> {

@ -261,4 +261,16 @@ pub trait MastodonClient<H: HttpSend = HttpSender> {
fn delete_from_suggestions(&self, id: u64) -> Result<Empty> {
unimplemented!("This method was not implemented");
}
/// GET /api/v1/endorsements
fn get_endorsements(&self) -> Result<Page<Account, H>> {
unimplemented!("This method was not implemented");
}
/// POST /api/v1/accounts/:id/pin
fn endorse_user(&self, id: u64) -> Result<Relationship> {
unimplemented!("This method was not implemented");
}
/// POST /api/v1/accounts/:id/unpin
fn unendorse_user(&self, id: u64) -> Result<Relationship> {
unimplemented!("This method was not implemented");
}
}

Loading…
Cancel
Save