pub struct AnnouncementsHandler<'a> { /* private fields */ }Expand description
Handler for announcement-related API endpoints.
Implementations§
Source§impl<'a> AnnouncementsHandler<'a>
impl<'a> AnnouncementsHandler<'a>
Sourcepub fn new(client: &'a MastodonClient) -> Self
pub fn new(client: &'a MastodonClient) -> Self
Creates a new AnnouncementsHandler for the given client.
Sourcepub async fn list(&self) -> Result<Vec<Announcement>>
pub async fn list(&self) -> Result<Vec<Announcement>>
Fetches all active announcements from the server.
Returns:
Result<Vec<Announcement>>: The announcements.
Corresponds to GET /api/v1/announcements.
Sourcepub async fn dismiss(&self, id: &str) -> Result<()>
pub async fn dismiss(&self, id: &str) -> Result<()>
Dismisses an announcement for the authenticated user.
Parameters:
id: The ID of the announcement to dismiss.
Returns:
Result<()>: Success if the announcement was dismissed.
Corresponds to POST /api/v1/announcements/:id/dismiss.
Sourcepub async fn add_reaction(
&self,
id: &str,
name: &str,
) -> Result<AnnouncementReaction>
pub async fn add_reaction( &self, id: &str, name: &str, ) -> Result<AnnouncementReaction>
Adds a reaction to an announcement.
Parameters:
id: The ID of the announcement.name: The name of the reaction (emoji).
Returns:
Result<AnnouncementReaction>: The updated reaction.
Corresponds to POST /api/v1/announcements/:id/reactions/:name.
Sourcepub async fn remove_reaction(
&self,
id: &str,
name: &str,
) -> Result<AnnouncementReaction>
pub async fn remove_reaction( &self, id: &str, name: &str, ) -> Result<AnnouncementReaction>
Removes a reaction from an announcement.
Parameters:
id: The ID of the announcement.name: The name of the reaction (emoji).
Returns:
Result<AnnouncementReaction>: The updated reaction.
Corresponds to DELETE /api/v1/announcements/:id/reactions/:name.
Auto Trait Implementations§
impl<'a> Freeze for AnnouncementsHandler<'a>
impl<'a> !RefUnwindSafe for AnnouncementsHandler<'a>
impl<'a> Send for AnnouncementsHandler<'a>
impl<'a> Sync for AnnouncementsHandler<'a>
impl<'a> Unpin for AnnouncementsHandler<'a>
impl<'a> !UnwindSafe for AnnouncementsHandler<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more