pub struct Attachments<'a> { /* private fields */ }Implementations§
Source§impl<'a> Attachments<'a>
impl<'a> Attachments<'a>
Sourcepub async fn create_direct_upload(
&self,
body: &CreateDirectUploadRequestContent,
) -> Result<DirectUpload, Error>
pub async fn create_direct_upload( &self, body: &CreateDirectUploadRequestContent, ) -> Result<DirectUpload, Error>
Create an Active Storage direct upload for an outgoing attachment. The returned URL is self-authenticating and accepts the raw file bytes via PUT.
Source§impl Attachments<'_>
impl Attachments<'_>
Sourcepub async fn upload(
&self,
filename: &str,
content_type: Option<&str>,
content: impl Into<Bytes>,
) -> Result<DirectUpload, Error>
pub async fn upload( &self, filename: &str, content_type: Option<&str>, content: impl Into<Bytes>, ) -> Result<DirectUpload, Error>
Reserves an Active Storage blob and uploads the bytes to the storage URL HEY named.
The answer’s attachable_sgid is what embeds the attachment in Trix rich text.
Empty content is an empty attachment rather than a mistake, so only a missing filename is refused.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for Attachments<'a>
impl<'a> !UnwindSafe for Attachments<'a>
impl<'a> Freeze for Attachments<'a>
impl<'a> Send for Attachments<'a>
impl<'a> Sync for Attachments<'a>
impl<'a> Unpin for Attachments<'a>
impl<'a> UnsafeUnpin for Attachments<'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