Trait AttachmentService

Source
pub trait AttachmentService<O> {
    type GetContentBody: WriteBody<O> + 'static;

    // Required methods
    fn create(
        &self,
        auth_: BearerToken,
        request: CreateAttachmentRequest,
    ) -> Result<Attachment, Error>;
    fn get(
        &self,
        auth_: BearerToken,
        rid: AttachmentRid,
    ) -> Result<Attachment, Error>;
    fn get_batch(
        &self,
        auth_: BearerToken,
        request: GetAttachmentsRequest,
    ) -> Result<GetAttachmentsResponse, Error>;
    fn get_content(
        &self,
        auth_: BearerToken,
        rid: AttachmentRid,
    ) -> Result<Self::GetContentBody, Error>;
    fn get_uri(
        &self,
        auth_: BearerToken,
        rid: AttachmentRid,
    ) -> Result<AttachmentUri, Error>;
    fn update(
        &self,
        auth_: BearerToken,
        rid: AttachmentRid,
        request: UpdateAttachmentRequest,
    ) -> Result<Attachment, Error>;
    fn archive(
        &self,
        auth_: BearerToken,
        rid: AttachmentRid,
    ) -> Result<(), Error>;
    fn unarchive(
        &self,
        auth_: BearerToken,
        rid: AttachmentRid,
    ) -> Result<(), Error>;
}
Expand description

The attachment service provides functionality for creating, updating, and archiving attachments uploaded to S3.

Required Associated Types§

Source

type GetContentBody: WriteBody<O> + 'static

The body type returned by the get_content method.

Required Methods§

Source

fn create( &self, auth_: BearerToken, request: CreateAttachmentRequest, ) -> Result<Attachment, Error>

Create a new attachment. Assumes the file is already uploaded to S3 through the upload service.

Source

fn get( &self, auth_: BearerToken, rid: AttachmentRid, ) -> Result<Attachment, Error>

Get an attachment by its RID.

Source

fn get_batch( &self, auth_: BearerToken, request: GetAttachmentsRequest, ) -> Result<GetAttachmentsResponse, Error>

Get a set of attachments by their RIDs.

Source

fn get_content( &self, auth_: BearerToken, rid: AttachmentRid, ) -> Result<Self::GetContentBody, Error>

Get the binary content of an attachment.

Source

fn get_uri( &self, auth_: BearerToken, rid: AttachmentRid, ) -> Result<AttachmentUri, Error>

Get a pre-signed URI to download an attachment. The link expires in 1 minute.

Source

fn update( &self, auth_: BearerToken, rid: AttachmentRid, request: UpdateAttachmentRequest, ) -> Result<Attachment, Error>

Update an attachment. Only the fields that are set in the request will be updated.

Source

fn archive(&self, auth_: BearerToken, rid: AttachmentRid) -> Result<(), Error>

Archive an attachment.

Source

fn unarchive(&self, auth_: BearerToken, rid: AttachmentRid) -> Result<(), Error>

Unarchive an attachment.

Implementors§