[−][src]Struct elefren::Mastodon
Your mastodon application client, handles all requests to and from Mastodon.
Fields
data: Data
Raw data about your mastodon instance.
Trait Implementations
impl<H: HttpSend> MastodonClient<H> for Mastodon<H>
[src]
type Stream = EventReader<BufReader<Response>>
Type that wraps streaming API streams
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
impl From<Data> for Mastodon<HttpSender>
[src]
impl<H: Clone + HttpSend> Clone for Mastodon<H>
[src]
fn clone(&self) -> Mastodon<H>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<H: Debug + HttpSend> Debug for Mastodon<H>
[src]
impl<H: HttpSend> Deref for Mastodon<H>
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Erased for T
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,