Skip to main content

AttachmentSyncClient

Struct AttachmentSyncClient 

Source
pub struct AttachmentSyncClient<H: HttpClient> { /* private fields */ }
Expand description

REST client for attachment upload/download.

Implementations§

Source§

impl<H: HttpClient> AttachmentSyncClient<H>

Source

pub fn new(http: H, base_url: String, auth_token: String) -> Self

Source

pub async fn init_upload( &self, workspace_id: &str, request: &InitUploadRequest, ) -> Result<InitUploadResponse, String>

Initialize a resumable attachment upload.

POST /api/workspaces/{workspaceId}/attachments/uploads

Source

pub async fn upload_part( &self, workspace_id: &str, upload_id: &str, part_no: usize, data: Vec<u8>, ) -> Result<(), String>

Upload a single part.

PUT /api/workspaces/{workspaceId}/attachments/uploads/{uploadId}/parts/{partNo}

Source

pub async fn complete_upload( &self, workspace_id: &str, upload_id: &str, request: &CompleteUploadRequest, ) -> Result<CompleteUploadResponse, String>

Complete a resumable upload.

POST /api/workspaces/{workspaceId}/attachments/uploads/{uploadId}/complete

Source

pub async fn download( &self, workspace_id: &str, hash: &str, ) -> Result<DownloadedAttachment, String>

Download an attachment by hash.

GET /api/workspaces/{workspaceId}/attachments/{hash}

Source

pub async fn upload_full( &self, workspace_id: &str, entry_path: &str, attachment_path: &str, hash: &str, mime_type: &str, data: &[u8], ) -> Result<(), String>

Full upload flow: init → parts → complete (with retry + re-upload).

data is the full attachment bytes. This function handles:

  • Splitting into parts
  • Skipping already-uploaded parts
  • Retrying failed parts
  • Re-uploading missing parts on completion conflict

Auto Trait Implementations§

§

impl<H> Freeze for AttachmentSyncClient<H>
where H: Freeze,

§

impl<H> RefUnwindSafe for AttachmentSyncClient<H>
where H: RefUnwindSafe,

§

impl<H> Send for AttachmentSyncClient<H>
where H: Send,

§

impl<H> Sync for AttachmentSyncClient<H>
where H: Sync,

§

impl<H> Unpin for AttachmentSyncClient<H>
where H: Unpin,

§

impl<H> UnsafeUnpin for AttachmentSyncClient<H>
where H: UnsafeUnpin,

§

impl<H> UnwindSafe for AttachmentSyncClient<H>
where H: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.