Expand description
§Mastodon API Wrapper
A comprehensive, asynchronous Rust wrapper for the Mastodon API, designed for advanced bot development.
§Core Concepts
§1. Timelines
A Timeline is a chronological list of statuses (posts).
- Public Timeline: Every public post known to your instance (“The Federated Timeline”).
- Local Timeline: Public posts from users specifically on your instance.
- Home Timeline: Personalized feed from accounts you follow.
§2. Statuses
A Status is the technical name for a post. It contains text, media attachments, mentions, etc. Statuses can be regular posts, replies, or reblogs (boosts).
§3. Streaming
Streaming provides real-time updates via WebSockets. Instead of polling, the server “pushes” events (new posts, mentions) to you as they happen.
§4. Accounts
Represents a user. Identified by a local id and a unique acct string (user@domain).
§5. Media Attachments
Media must be uploaded separately to get an ID before being attached to a new status.
§Example
use mastodon_api::MastodonClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = MastodonClient::new("https://mastodon.social").with_token("your_token");
client.statuses().create_simple("Hello from Rust!").await?;
Ok(())
}Re-exports§
pub use error::MastodonError;pub use error::Result;pub use models::Account;pub use models::Announcement;pub use models::AnnouncementReaction;pub use models::FeaturedTag;pub use models::Marker;pub use models::Preferences;pub use models::Relationship;pub use models::Report;pub use models::Status;pub use models::Suggestion;pub use models::Tag;pub use models::WebPushAlerts;pub use models::WebPushSubscription;
Modules§
Structs§
- Mastodon
Client - The main entry point for interacting with the Mastodon API.