pub struct MediaHandler<'a> { /* private fields */ }Expand description
Handler for media upload API endpoints.
Implementations§
Source§impl<'a> MediaHandler<'a>
impl<'a> MediaHandler<'a>
pub fn new(client: &'a MastodonClient) -> Self
Sourcepub async fn upload(
&self,
file_path: &str,
description: Option<String>,
) -> Result<MediaAttachment>
pub async fn upload( &self, file_path: &str, description: Option<String>, ) -> Result<MediaAttachment>
Uploads a media file (image, video, etc.) to the instance.
Parameters:
file_path: The path to the file to upload.description: An optional description for the media.
Returns:
Result<MediaAttachment>: The uploaded media attachment.
Corresponds to POST /api/v1/media.
Auto Trait Implementations§
impl<'a> Freeze for MediaHandler<'a>
impl<'a> !RefUnwindSafe for MediaHandler<'a>
impl<'a> Send for MediaHandler<'a>
impl<'a> Sync for MediaHandler<'a>
impl<'a> Unpin for MediaHandler<'a>
impl<'a> !UnwindSafe for MediaHandler<'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