[−][src]Trait elefren::MastodonClient
Represents the set of methods that a Mastodon Client can do, so that implementations might be swapped out for testing
Associated Types
Loading content...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
fn authorize_follow_request(&self, id: &str) -> Result<Empty>
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: &str) -> Result<Account>
GET /api/v1/accounts/:id
fn follow(&self, id: &str) -> Result<Relationship>
POST /api/v1/accounts/:id/follow
fn unfollow(&self, id: &str) -> Result<Relationship>
POST /api/v1/accounts/:id/unfollow
fn block(&self, id: &str) -> Result<Relationship>
GET /api/v1/accounts/:id/block
fn unblock(&self, id: &str) -> Result<Relationship>
GET /api/v1/accounts/:id/unblock
fn mute(&self, id: &str) -> Result<Relationship>
GET /api/v1/accounts/:id/mute
fn unmute(&self, id: &str) -> Result<Relationship>
GET /api/v1/accounts/:id/unmute
fn get_notification(&self, id: &str) -> Result<Notification>
GET /api/v1/notifications/:id
fn get_status(&self, id: &str) -> Result<Status>
GET /api/v1/statuses/:id
fn get_context(&self, id: &str) -> Result<Context>
GET /api/v1/statuses/:id/context
fn get_card(&self, id: &str) -> Result<Card>
GET /api/v1/statuses/:id/card
fn reblog(&self, id: &str) -> Result<Status>
POST /api/v1/statuses/:id/reblog
fn unreblog(&self, id: &str) -> Result<Status>
POST /api/v1/statuses/:id/unreblog
fn favourite(&self, id: &str) -> Result<Status>
POST /api/v1/statuses/:id/favourite
fn unfavourite(&self, id: &str) -> Result<Status>
POST /api/v1/statuses/:id/unfavourite
fn delete_status(&self, id: &str) -> 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: NewStatus) -> 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: &str) -> Result<Filter>
GET /api/v1/filters/:id
fn update_filter(
&self,
id: &str,
request: &mut AddFilterRequest
) -> Result<Filter>
&self,
id: &str,
request: &mut AddFilterRequest
) -> Result<Filter>
PUT /api/v1/filters/:id
fn delete_filter(&self, id: &str) -> 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: &str) -> 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: &str) -> Result<Relationship>
POST /api/v1/accounts/:id/pin
fn unendorse_user(&self, id: &str) -> Result<Relationship>
POST /api/v1/accounts/:id/unpin
fn follows_me(&self) -> Result<Page<Account, H>>
Shortcut for: let me = client.verify_credentials(); client.followers()
let follows_me = client.follows_me()?;
fn followed_by_me(&self) -> Result<Page<Account, H>>
Shortcut for
let me = client.verify_credentials(); client.following(&me.id)
let follows_me = client.followed_by_me()?;
fn streaming_user(&self) -> Result<Self::Stream>
Returns events that are relevant to the authorized user, i.e. home timeline and notifications
fn streaming_public(&self) -> Result<Self::Stream>
Returns all public statuses
fn streaming_local(&self) -> Result<Self::Stream>
Returns all local statuses
fn streaming_public_hashtag(&self, hashtag: &str) -> Result<Self::Stream>
Returns all public statuses for a particular hashtag
fn streaming_local_hashtag(&self, hashtag: &str) -> Result<Self::Stream>
Returns all local statuses for a particular hashtag
fn streaming_list(&self, list_id: &str) -> Result<Self::Stream>
Returns statuses for a list
fn streaming_direct(&self) -> Result<Self::Stream>
Returns all direct messages
Implementors
impl<H: HttpSend> MastodonClient<H> for Mastodon<H>
[src]
type Stream = EventReader<BufReader<Response>>
fn favourites(&self) -> Result<Page<Status, H>>
[src]
Equivalent to get /api/v1/favourites
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.favourites();
fn blocks(&self) -> Result<Page<Account, H>>
[src]
Equivalent to get /api/v1/blocks
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.blocks();
fn domain_blocks(&self) -> Result<Page<String, H>>
[src]
Equivalent to get /api/v1/domain_blocks
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.domain_blocks();
fn follow_requests(&self) -> Result<Page<Account, H>>
[src]
Equivalent to get /api/v1/follow_requests
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.follow_requests();
fn get_home_timeline(&self) -> Result<Page<Status, H>>
[src]
Equivalent to get /api/v1/timelines/home
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.get_home_timeline();
fn get_emojis(&self) -> Result<Page<Emoji, H>>
[src]
Equivalent to get /api/v1/custom_emojis
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.get_emojis();
fn mutes(&self) -> Result<Page<Account, H>>
[src]
Equivalent to get /api/v1/mutes
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.mutes();
fn notifications(&self) -> Result<Page<Notification, H>>
[src]
Equivalent to get /api/v1/notifications
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.notifications();
fn reports(&self) -> Result<Page<Report, H>>
[src]
Equivalent to get /api/v1/reports
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.reports();
fn search_accounts<'a>(
&self,
q: &'a str,
limit: Option<u64>,
following: bool
) -> Result<Page<Account, H>>
[src]
&self,
q: &'a str,
limit: Option<u64>,
following: bool
) -> Result<Page<Account, H>>
fn get_endorsements(&self) -> Result<Page<Account, H>>
[src]
Equivalent to get /api/v1/endorsements
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.get_endorsements();
fn followers(&self, id: &str) -> Result<Page<Account, H>>
[src]
Equivalent to get /api/v1/accounts/{}/followers
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.followers("some-id");
fn following(&self, id: &str) -> Result<Page<Account, H>>
[src]
Equivalent to get /api/v1/accounts/{}/following
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.following("some-id");
fn reblogged_by(&self, id: &str) -> Result<Page<Account, H>>
[src]
Equivalent to get /api/v1/statuses/{}/reblogged_by
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.reblogged_by("some-id");
fn favourited_by(&self, id: &str) -> Result<Page<Account, H>>
[src]
Equivalent to get /api/v1/statuses/{}/favourited_by
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.favourited_by("some-id");
fn unblock_domain(&self, domain: String) -> Result<Empty>
[src]
fn instance(&self) -> Result<Instance>
[src]
Equivalent to get /api/v1/instance
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.instance();
fn verify_credentials(&self) -> Result<Account>
[src]
Equivalent to get /api/v1/accounts/verify_credentials
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.verify_credentials();
fn report(
&self,
account_id: &str,
status_ids: Vec<&str>,
comment: String
) -> Result<Report>
[src]
&self,
account_id: &str,
status_ids: Vec<&str>,
comment: String
) -> Result<Report>
fn block_domain(&self, domain: String) -> Result<Empty>
[src]
fn authorize_follow_request(&self, id: &str) -> Result<Empty>
[src]
fn reject_follow_request(&self, id: &str) -> Result<Empty>
[src]
fn search<'a>(&self, q: &'a str, resolve: bool) -> Result<SearchResult>
[src]
fn get_public_timeline<'a>(&self, local: bool) -> Result<Vec<Status>>
[src]
fn follows(&self, uri: Cow<'static, str>) -> Result<Account>
[src]
fn media(&self, file: Cow<'static, str>) -> Result<Attachment>
[src]
fn clear_notifications(&self) -> Result<Empty>
[src]
Equivalent to post /api/v1/notifications/clear
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.clear_notifications();
fn get_push_subscription(&self) -> Result<Subscription>
[src]
Equivalent to get /api/v1/push/subscription
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.get_push_subscription();
fn delete_push_subscription(&self) -> Result<Empty>
[src]
Equivalent to delete /api/v1/push/subscription
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.delete_push_subscription();
fn get_filters(&self) -> Result<Vec<Filter>>
[src]
Equivalent to get /api/v1/filters
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.get_filters();
fn get_follow_suggestions(&self) -> Result<Vec<Account>>
[src]
Equivalent to get /api/v1/suggestions
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.get_follow_suggestions();
fn search_v2<'a>(&self, q: &'a str, resolve: bool) -> Result<SearchResultV2>
[src]
fn get_account(&self, id: &str) -> Result<Account>
[src]
Equivalent to get /api/v1/accounts/{}
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.get_account("42");
fn follow(&self, id: &str) -> Result<Relationship>
[src]
Equivalent to post /api/v1/accounts/{}/follow
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.follow("42");
fn unfollow(&self, id: &str) -> Result<Relationship>
[src]
Equivalent to post /api/v1/accounts/{}/unfollow
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.unfollow("42");
fn block(&self, id: &str) -> Result<Relationship>
[src]
Equivalent to post /api/v1/accounts/{}/block
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.block("42");
fn unblock(&self, id: &str) -> Result<Relationship>
[src]
Equivalent to post /api/v1/accounts/{}/unblock
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.unblock("42");
fn mute(&self, id: &str) -> Result<Relationship>
[src]
Equivalent to get /api/v1/accounts/{}/mute
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.mute("42");
fn unmute(&self, id: &str) -> Result<Relationship>
[src]
Equivalent to get /api/v1/accounts/{}/unmute
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.unmute("42");
fn get_notification(&self, id: &str) -> Result<Notification>
[src]
Equivalent to get /api/v1/notifications/{}
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.get_notification("42");
fn get_status(&self, id: &str) -> Result<Status>
[src]
Equivalent to get /api/v1/statuses/{}
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.get_status("42");
fn get_context(&self, id: &str) -> Result<Context>
[src]
Equivalent to get /api/v1/statuses/{}/context
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.get_context("42");
fn get_card(&self, id: &str) -> Result<Card>
[src]
Equivalent to get /api/v1/statuses/{}/card
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.get_card("42");
fn reblog(&self, id: &str) -> Result<Status>
[src]
Equivalent to post /api/v1/statuses/{}/reblog
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.reblog("42");
fn unreblog(&self, id: &str) -> Result<Status>
[src]
Equivalent to post /api/v1/statuses/{}/unreblog
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.unreblog("42");
fn favourite(&self, id: &str) -> Result<Status>
[src]
Equivalent to post /api/v1/statuses/{}/favourite
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.favourite("42");
fn unfavourite(&self, id: &str) -> Result<Status>
[src]
Equivalent to post /api/v1/statuses/{}/unfavourite
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.unfavourite("42");
fn delete_status(&self, id: &str) -> Result<Empty>
[src]
Equivalent to delete /api/v1/statuses/{}
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.delete_status("42");
fn get_filter(&self, id: &str) -> Result<Filter>
[src]
Equivalent to get /api/v1/filters/{}
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.get_filter("42");
fn delete_filter(&self, id: &str) -> Result<Empty>
[src]
Equivalent to delete /api/v1/filters/{}
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.delete_filter("42");
fn delete_from_suggestions(&self, id: &str) -> Result<Empty>
[src]
Equivalent to delete /api/v1/suggestions/{}
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.delete_from_suggestions("42");
fn endorse_user(&self, id: &str) -> Result<Relationship>
[src]
Equivalent to post /api/v1/accounts/{}/pin
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.endorse_user("42");
fn unendorse_user(&self, id: &str) -> Result<Relationship>
[src]
Equivalent to post /api/v1/accounts/{}/unpin
Errors
If access_token
is not set.
let client = Mastodon::from(data); client.unendorse_user("42");
fn add_filter(&self, request: &mut AddFilterRequest) -> Result<Filter>
[src]
fn update_filter(
&self,
id: &str,
request: &mut AddFilterRequest
) -> Result<Filter>
[src]
&self,
id: &str,
request: &mut AddFilterRequest
) -> Result<Filter>
PUT /api/v1/filters/:id
fn update_credentials(
&self,
builder: &mut UpdateCredsRequest
) -> Result<Account>
[src]
&self,
builder: &mut UpdateCredsRequest
) -> Result<Account>
fn new_status(&self, status: NewStatus) -> Result<Status>
[src]
Post a new status to the account.
fn get_tagged_timeline(
&self,
hashtag: String,
local: bool
) -> Result<Vec<Status>>
[src]
&self,
hashtag: String,
local: bool
) -> Result<Vec<Status>>
Get timeline filtered by a hashtag(eg. #coffee
) either locally or
federated.
fn statuses<'a, 'b: 'a, S>(
&'b self,
id: &'b str,
request: S
) -> Result<Page<Status, H>> where
S: Into<Option<StatusesRequest<'a>>>,
[src]
&'b self,
id: &'b str,
request: S
) -> Result<Page<Status, H>> where
S: Into<Option<StatusesRequest<'a>>>,
Get statuses of a single account by id. Optionally only with pictures and or excluding replies.
Example
let client = Mastodon::from(data); let statuses = client.statuses("user-id", None)?;
let client = Mastodon::from(data); let mut request = StatusesRequest::new(); request.only_media(); let statuses = client.statuses("user-id", request)?;
fn relationships(&self, ids: &[&str]) -> Result<Page<Relationship, H>>
[src]
Returns the client account's relationship to a list of other accounts. Such as whether they follow them or vice versa.
fn add_push_subscription(
&self,
request: &AddPushRequest
) -> Result<Subscription>
[src]
&self,
request: &AddPushRequest
) -> Result<Subscription>
Add a push notifications subscription
fn update_push_data(&self, request: &UpdatePushRequest) -> Result<Subscription>
[src]
Update the data
portion of the push subscription associated with this
access token
fn follows_me(&self) -> Result<Page<Account, H>>
[src]
Get all accounts that follow the authenticated user
fn followed_by_me(&self) -> Result<Page<Account, H>>
[src]
Get all accounts that the authenticated user follows
fn streaming_user(&self) -> Result<Self::Stream>
[src]
returns events that are relevant to the authorized user, i.e. home timeline & notifications
Example
use elefren::entities::event::Event; let client = Mastodon::from(data); for event in client.streaming_user()? { match event { Event::Update(ref status) => { /* .. */ }, Event::Notification(ref notification) => { /* .. */ }, Event::Delete(ref id) => { /* .. */ }, Event::FiltersChanged => { /* .. */ }, } }
fn streaming_public(&self) -> Result<Self::Stream>
[src]
returns all public statuses
fn streaming_local(&self) -> Result<Self::Stream>
[src]
Returns all local statuses
fn streaming_public_hashtag(&self, hashtag: &str) -> Result<Self::Stream>
[src]
Returns all public statuses for a particular hashtag
fn streaming_local_hashtag(&self, hashtag: &str) -> Result<Self::Stream>
[src]
Returns all local statuses for a particular hashtag
fn streaming_list(&self, list_id: &str) -> Result<Self::Stream>
[src]
Returns statuses for a list
fn streaming_direct(&self) -> Result<Self::Stream>
[src]
Returns all direct messages