pub struct MastodonClient { /* private fields */ }Expand description
The main entry point for interacting with the Mastodon API.
Use MastodonClient::new to create a new instance, and with_token to authenticate.
Implementations§
Source§impl MastodonClient
impl MastodonClient
Sourcepub fn new(instance_url: &str) -> Self
pub fn new(instance_url: &str) -> Self
Creates a new MastodonClient for the given instance URL.
§Example
use mastodon_api::MastodonClient;
let client = MastodonClient::new("https://mastodon.social");Sourcepub fn with_token(self, token: &str) -> Self
pub fn with_token(self, token: &str) -> Self
Sets the access token for the client, enabling authenticated requests.
Sourcepub fn access_token(&self) -> Option<&str>
pub fn access_token(&self) -> Option<&str>
Returns the access token used by the client, if any.
Sourcepub fn http_client(&self) -> &Client
pub fn http_client(&self) -> &Client
Returns a reference to the underlying HTTP client.
Sourcepub fn accounts(&self) -> AccountsHandler<'_>
pub fn accounts(&self) -> AccountsHandler<'_>
Access account-related endpoints.
Sourcepub fn follow_requests(&self) -> FollowRequestsHandler<'_>
pub fn follow_requests(&self) -> FollowRequestsHandler<'_>
Access follow request-related endpoints.
Sourcepub fn announcements(&self) -> AnnouncementsHandler<'_>
pub fn announcements(&self) -> AnnouncementsHandler<'_>
Access server-wide announcements.
Sourcepub fn statuses(&self) -> StatusesHandler<'_>
pub fn statuses(&self) -> StatusesHandler<'_>
Access status-related (posting) endpoints.
Sourcepub fn timelines(&self) -> TimelinesHandler<'_>
pub fn timelines(&self) -> TimelinesHandler<'_>
Access timeline-related endpoints (Home, Public, etc.).
Sourcepub fn apps(&self) -> AppsHandler<'_>
pub fn apps(&self) -> AppsHandler<'_>
Access application registration and OAuth endpoints.
Sourcepub fn media(&self) -> MediaHandler<'_>
pub fn media(&self) -> MediaHandler<'_>
Access media upload and management endpoints.
Sourcepub fn filters(&self) -> FiltersHandler<'_>
pub fn filters(&self) -> FiltersHandler<'_>
Access content filter management endpoints.
Access tag management endpoints (followed and featured tags).
Sourcepub fn markers(&self) -> MarkersHandler<'_>
pub fn markers(&self) -> MarkersHandler<'_>
Access reading position sync (markers).
Sourcepub fn reports(&self) -> ReportsHandler<'_>
pub fn reports(&self) -> ReportsHandler<'_>
Access reports made by the authenticated user.
Sourcepub fn endorsements(&self) -> EndorsementsHandler<'_>
pub fn endorsements(&self) -> EndorsementsHandler<'_>
Access accounts endorsed (pinned) by the authenticated user.
Sourcepub fn domain_blocks(&self) -> DomainBlocksHandler<'_>
pub fn domain_blocks(&self) -> DomainBlocksHandler<'_>
Access domain blocks for the authenticated user.
Sourcepub fn preferences(&self) -> PreferencesHandler<'_>
pub fn preferences(&self) -> PreferencesHandler<'_>
Access user preferences.
Sourcepub fn push(&self) -> PushHandler<'_>
pub fn push(&self) -> PushHandler<'_>
Access Web Push API subscriptions.
Sourcepub fn admin(&self) -> AdminHandler<'_>
pub fn admin(&self) -> AdminHandler<'_>
Access administrative moderation and management endpoints.
Sourcepub fn lists(&self) -> ListsHandler<'_>
pub fn lists(&self) -> ListsHandler<'_>
Access list management endpoints.
Sourcepub fn conversations(&self) -> ConversationsHandler<'_>
pub fn conversations(&self) -> ConversationsHandler<'_>
Access direct conversation (DM) endpoints.
Sourcepub fn notifications(&self) -> NotificationsHandler<'_>
pub fn notifications(&self) -> NotificationsHandler<'_>
Access notification management endpoints.
Sourcepub fn search(&self) -> SearchHandler<'_>
pub fn search(&self) -> SearchHandler<'_>
Access global search endpoints.
Sourcepub fn suggestions(&self) -> SuggestionsHandler<'_>
pub fn suggestions(&self) -> SuggestionsHandler<'_>
Access account suggestions for follow.
Sourcepub fn trends(&self) -> TrendsHandler<'_>
pub fn trends(&self) -> TrendsHandler<'_>
Access trending content endpoints.
Sourcepub fn emojis(&self) -> EmojisHandler<'_>
pub fn emojis(&self) -> EmojisHandler<'_>
Access custom emoji endpoints.
Sourcepub fn instance(&self) -> InstanceHandler<'_>
pub fn instance(&self) -> InstanceHandler<'_>
Access instance metadata endpoints.
Sourcepub fn streaming(&self) -> StreamingClient
pub fn streaming(&self) -> StreamingClient
Create a new streaming client for real-time events.
Trait Implementations§
Source§impl Clone for MastodonClient
impl Clone for MastodonClient
Source§fn clone(&self) -> MastodonClient
fn clone(&self) -> MastodonClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more