Trait elefren::MastodonClient [−][src]
pub trait MastodonClient<H: HttpSend = HttpSender> { fn favourites(&self) -> Result<Page<Status, H>> { ... } fn blocks(&self) -> Result<Page<Account, H>> { ... } fn domain_blocks(&self) -> Result<Page<String, H>> { ... } fn follow_requests(&self) -> Result<Page<Account, H>> { ... } fn get_home_timeline(&self) -> Result<Page<Status, H>> { ... } fn get_emojis(&self) -> Result<Page<Emoji, H>> { ... } fn mutes(&self) -> Result<Page<Account, H>> { ... } fn notifications(&self) -> Result<Page<Notification, H>> { ... } fn reports(&self) -> Result<Page<Report, H>> { ... } fn followers(&self, id: &str) -> Result<Page<Account, H>> { ... } fn following(&self, id: &str) -> Result<Page<Account, H>> { ... } fn reblogged_by(&self, id: &str) -> Result<Page<Account, H>> { ... } fn favourited_by(&self, id: &str) -> Result<Page<Account, H>> { ... } fn unblock_domain(&self, domain: String) -> Result<Empty> { ... } fn instance(&self) -> Result<Instance> { ... } fn verify_credentials(&self) -> Result<Account> { ... } fn report(
&self,
account_id: &str,
status_ids: Vec<&str>,
comment: String
) -> Result<Report> { ... } fn block_domain(&self, domain: String) -> Result<Empty> { ... } fn authorize_follow_request(&self, id: &str) -> Result<Empty> { ... } fn reject_follow_request(&self, id: &str) -> Result<Empty> { ... } fn search<'a>(&self, q: &'a str, resolve: bool) -> Result<SearchResult> { ... } fn search_v2<'a>(&self, q: &'a str, resolve: bool) -> Result<SearchResultV2> { ... } fn follows(&self, uri: Cow<'static, str>) -> Result<Account> { ... } fn media(&self, file: Cow<'static, str>) -> Result<Attachment> { ... } fn clear_notifications(&self) -> Result<Empty> { ... } fn get_account(&self, id: u64) -> Result<Account> { ... } fn follow(&self, id: u64) -> Result<Account> { ... } fn unfollow(&self, id: u64) -> Result<Relationship> { ... } fn block(&self, id: u64) -> Result<Account> { ... } fn unblock(&self, id: u64) -> Result<Account> { ... } fn mute(&self, id: u64) -> Result<Account> { ... } fn unmute(&self, id: u64) -> Result<Account> { ... } fn get_notification(&self, id: u64) -> Result<Notification> { ... } fn get_status(&self, id: u64) -> Result<Status> { ... } fn get_context(&self, id: u64) -> Result<Context> { ... } fn get_card(&self, id: u64) -> Result<Card> { ... } fn reblog(&self, id: u64) -> Result<Status> { ... } fn unreblog(&self, id: u64) -> Result<Status> { ... } fn favourite(&self, id: u64) -> Result<Status> { ... } fn unfavourite(&self, id: u64) -> Result<Status> { ... } fn delete_status(&self, id: u64) -> Result<Empty> { ... } fn update_credentials(
&self,
builder: &mut UpdateCredsRequest
) -> Result<Account> { ... } fn new_status(&self, status: StatusBuilder) -> Result<Status> { ... } fn get_public_timeline(&self, local: bool) -> Result<Vec<Status>> { ... } fn get_tagged_timeline(
&self,
hashtag: String,
local: bool
) -> Result<Vec<Status>> { ... } fn statuses<'a, 'b: 'a, S>(
&'b self,
id: &'b str,
request: S
) -> Result<Page<Status, H>>
where
S: Into<Option<StatusesRequest<'a>>>, { ... } fn relationships(&self, ids: &[&str]) -> Result<Page<Relationship, H>> { ... } fn search_accounts(
&self,
query: &str,
limit: Option<u64>,
following: bool
) -> Result<Page<Account, H>> { ... } fn add_push_subscription(
&self,
request: &AddPushRequest
) -> Result<Subscription> { ... } fn update_push_data(
&self,
request: &UpdatePushRequest
) -> Result<Subscription> { ... } fn get_push_subscription(&self) -> Result<Subscription> { ... } fn delete_push_subscription(&self) -> Result<Empty> { ... } fn get_filters(&self) -> Result<Vec<Filter>> { ... } fn add_filter(&self, request: &mut AddFilterRequest) -> Result<Filter> { ... } fn get_filter(&self, id: u64) -> Result<Filter> { ... } fn update_filter(
&self,
id: u64,
request: &mut AddFilterRequest
) -> Result<Filter> { ... } fn delete_filter(&self, id: u64) -> Result<Empty> { ... } fn get_follow_suggestions(&self) -> Result<Vec<Account>> { ... } fn delete_from_suggestions(&self, id: u64) -> Result<Empty> { ... } fn get_endorsements(&self) -> Result<Page<Account, H>> { ... } fn endorse_user(&self, id: u64) -> Result<Relationship> { ... } fn unendorse_user(&self, id: u64) -> Result<Relationship> { ... } }
Represents the set of methods that a Mastodon Client can do, so that implementations might be swapped out for testing
Provided Methods
fn favourites(&self) -> Result<Page<Status, H>>
GET /api/v1/favourites
fn blocks(&self) -> Result<Page<Account, H>>
GET /api/v1/blocks
fn domain_blocks(&self) -> Result<Page<String, H>>
GET /api/v1/domain_blocks
fn follow_requests(&self) -> Result<Page<Account, H>>
GET /api/v1/follow_requests
fn get_home_timeline(&self) -> Result<Page<Status, H>>
GET /api/v1/timelines/home
fn get_emojis(&self) -> Result<Page<Emoji, H>>
GET /api/v1/custom_emojis
fn mutes(&self) -> Result<Page<Account, H>>
GET /api/v1/mutes
fn notifications(&self) -> Result<Page<Notification, H>>
GET /api/v1/notifications
fn reports(&self) -> Result<Page<Report, H>>
GET /api/v1/reports
fn followers(&self, id: &str) -> Result<Page<Account, H>>
GET /api/v1/accounts/:id/followers
fn following(&self, id: &str) -> Result<Page<Account, H>>
GET /api/v1/accounts/:id/following
fn reblogged_by(&self, id: &str) -> Result<Page<Account, H>>
GET /api/v1/statuses/:id/reblogged_by
fn favourited_by(&self, id: &str) -> Result<Page<Account, H>>
GET /api/v1/statuses/:id/favourited_by
fn unblock_domain(&self, domain: String) -> Result<Empty>
DELETE /api/v1/domain_blocks
fn instance(&self) -> Result<Instance>
GET /api/v1/instance
fn verify_credentials(&self) -> Result<Account>
GET /api/v1/accounts/verify_credentials
fn report(
&self,
account_id: &str,
status_ids: Vec<&str>,
comment: String
) -> Result<Report>
&self,
account_id: &str,
status_ids: Vec<&str>,
comment: String
) -> Result<Report>
POST /api/v1/reports
fn block_domain(&self, domain: String) -> Result<Empty>
POST /api/v1/domain_blocks
POST /api/v1/accounts/follow_requests/authorize
fn reject_follow_request(&self, id: &str) -> Result<Empty>
POST /api/v1/accounts/follow_requests/reject
fn search<'a>(&self, q: &'a str, resolve: bool) -> Result<SearchResult>
GET /api/v1/search
fn search_v2<'a>(&self, q: &'a str, resolve: bool) -> Result<SearchResultV2>
GET /api/v2/search
fn follows(&self, uri: Cow<'static, str>) -> Result<Account>
POST /api/v1/follows
fn media(&self, file: Cow<'static, str>) -> Result<Attachment>
POST /api/v1/media
fn clear_notifications(&self) -> Result<Empty>
POST /api/v1/notifications/clear
fn get_account(&self, id: u64) -> Result<Account>
GET /api/v1/accounts/:id
fn follow(&self, id: u64) -> Result<Account>
POST /api/v1/accounts/:id/follow
fn unfollow(&self, id: u64) -> Result<Relationship>
POST /api/v1/accounts/:id/unfollow
fn block(&self, id: u64) -> Result<Account>
GET /api/v1/accounts/:id/block
fn unblock(&self, id: u64) -> Result<Account>
GET /api/v1/accounts/:id/unblock
fn mute(&self, id: u64) -> Result<Account>
GET /api/v1/accounts/:id/mute
fn unmute(&self, id: u64) -> Result<Account>
GET /api/v1/accounts/:id/unmute
fn get_notification(&self, id: u64) -> Result<Notification>
GET /api/v1/notifications/:id
fn get_status(&self, id: u64) -> Result<Status>
GET /api/v1/statuses/:id
fn get_context(&self, id: u64) -> Result<Context>
GET /api/v1/statuses/:id/context
fn get_card(&self, id: u64) -> Result<Card>
GET /api/v1/statuses/:id/card
fn reblog(&self, id: u64) -> Result<Status>
POST /api/v1/statuses/:id/reblog
fn unreblog(&self, id: u64) -> Result<Status>
POST /api/v1/statuses/:id/unreblog
fn favourite(&self, id: u64) -> Result<Status>
POST /api/v1/statuses/:id/favourite
fn unfavourite(&self, id: u64) -> Result<Status>
POST /api/v1/statuses/:id/unfavourite
fn delete_status(&self, id: u64) -> Result<Empty>
DELETE /api/v1/statuses/:id
fn update_credentials(
&self,
builder: &mut UpdateCredsRequest
) -> Result<Account>
&self,
builder: &mut UpdateCredsRequest
) -> Result<Account>
PATCH /api/v1/accounts/update_credentials
fn new_status(&self, status: StatusBuilder) -> Result<Status>
POST /api/v1/statuses
fn get_public_timeline(&self, local: bool) -> Result<Vec<Status>>
GET /api/v1/timelines/public
fn get_tagged_timeline(
&self,
hashtag: String,
local: bool
) -> Result<Vec<Status>>
&self,
hashtag: String,
local: bool
) -> Result<Vec<Status>>
GET /api/v1/timelines/tag/:hashtag
fn statuses<'a, 'b: 'a, S>(
&'b self,
id: &'b str,
request: S
) -> Result<Page<Status, H>> where
S: Into<Option<StatusesRequest<'a>>>,
&'b self,
id: &'b str,
request: S
) -> Result<Page<Status, H>> where
S: Into<Option<StatusesRequest<'a>>>,
GET /api/v1/accounts/:id/statuses
fn relationships(&self, ids: &[&str]) -> Result<Page<Relationship, H>>
GET /api/v1/accounts/relationships
fn search_accounts(
&self,
query: &str,
limit: Option<u64>,
following: bool
) -> Result<Page<Account, H>>
&self,
query: &str,
limit: Option<u64>,
following: bool
) -> Result<Page<Account, H>>
GET /api/v1/accounts/search?q=:query&limit=:limit&following=:following
fn add_push_subscription(
&self,
request: &AddPushRequest
) -> Result<Subscription>
&self,
request: &AddPushRequest
) -> Result<Subscription>
POST /api/v1/push/subscription
fn update_push_data(&self, request: &UpdatePushRequest) -> Result<Subscription>
PUT /api/v1/push/subscription
fn get_push_subscription(&self) -> Result<Subscription>
GET /api/v1/push/subscription
fn delete_push_subscription(&self) -> Result<Empty>
DELETE /api/v1/push/subscription
fn get_filters(&self) -> Result<Vec<Filter>>
GET /api/v1/filters
fn add_filter(&self, request: &mut AddFilterRequest) -> Result<Filter>
POST /api/v1/filters
fn get_filter(&self, id: u64) -> Result<Filter>
GET /api/v1/filters/:id
fn update_filter(
&self,
id: u64,
request: &mut AddFilterRequest
) -> Result<Filter>
&self,
id: u64,
request: &mut AddFilterRequest
) -> Result<Filter>
PUT /api/v1/filters/:id
fn delete_filter(&self, id: u64) -> Result<Empty>
DELETE /api/v1/filters/:id
fn get_follow_suggestions(&self) -> Result<Vec<Account>>
GET /api/v1/suggestions
fn delete_from_suggestions(&self, id: u64) -> Result<Empty>
DELETE /api/v1/suggestions/:account_id
fn get_endorsements(&self) -> Result<Page<Account, H>>
GET /api/v1/endorsements
fn endorse_user(&self, id: u64) -> Result<Relationship>
POST /api/v1/accounts/:id/pin
fn unendorse_user(&self, id: u64) -> Result<Relationship>
POST /api/v1/accounts/:id/unpin