[−][src]Crate elefren
Elefren: API Wrapper around the Mastodon API.
Most of the api is documented on Mastodon's github
use elefren::{helpers::cli, prelude::*}; let registration = Registration::new("https://mastodon.social") .client_name("elefren_test") .build()?; let mastodon = cli::authenticate(registration)?; println!( "{:?}", mastodon .get_home_timeline()? .items_iter() .take(100) .collect::<Vec<_>>() );
Elefren also supports Mastodon's Streaming API:
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 => { /* .. */ }, } }
Re-exports
pub use data::Data; |
pub use errors::ApiError; |
pub use errors::Error; |
pub use errors::Result; |
pub use registration::Registration; |
pub use status_builder::NewStatus; |
pub use status_builder::StatusBuilder; |
Modules
apps | Registering your App |
data | Contains the struct that holds the client auth data |
entities | Entities returned from the API |
errors | Errors |
helpers | Collection of helpers for serializing/deserializing |
http_send | Contains trait for converting |
page | Handling multiple pages of entities. |
prelude | Automatically import the things you need |
registration | Registering your app. |
requests | Requests |
scopes | OAuth Scopes |
status_builder | Constructing a status |
Macros
format_err | Used to easily create errors from strings |
Structs
AddFilterRequest | Form used to create a filter |
AddPushRequest | Builder to pass to the Mastodon::add_push_subscription method |
EventReader | Iterator that produces events from a mastodon streaming API event stream |
Mastodon | Your mastodon application client, handles all requests to and from Mastodon. |
MastodonUnauth | Client that can make unauthenticated calls to a mastodon instance |
StatusesRequest | Builder for making a client.statuses() call |
UpdateCredsRequest | Builder to pass to the Mastodon::update_credentials method |
UpdatePushRequest | Builder to pass to the Mastodon::update_push_data method |
Enums
Language |
Traits
MastodonClient | Represents the set of methods that a Mastodon Client can do, so that implementations might be swapped out for testing |
MastodonUnauthenticated | Trait that represents clients that can make unauthenticated calls to a mastodon instance |