Add the "endorsements" endpoints from mastodon 2.5.0

Closes #74
This commit is contained in:
Paul Woolcock
2018-09-14 18:16:56 -04:00
parent 7de1bdc009
commit 1f0ba1846c
4 changed files with 21 additions and 1 deletions
+6
View File
@@ -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,
}
+3
View File
@@ -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> {
+12
View File
@@ -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");
}
}