pub struct AttachmentSyncClient<H: HttpClient> { /* private fields */ }Expand description
REST client for attachment upload/download.
Implementations§
Source§impl<H: HttpClient> AttachmentSyncClient<H>
impl<H: HttpClient> AttachmentSyncClient<H>
pub fn new(http: H, base_url: String, auth_token: String) -> Self
Sourcepub async fn init_upload(
&self,
workspace_id: &str,
request: &InitUploadRequest,
) -> Result<InitUploadResponse, String>
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
Sourcepub async fn upload_part(
&self,
workspace_id: &str,
upload_id: &str,
part_no: usize,
data: Vec<u8>,
) -> Result<(), String>
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}
Sourcepub async fn complete_upload(
&self,
workspace_id: &str,
upload_id: &str,
request: &CompleteUploadRequest,
) -> Result<CompleteUploadResponse, String>
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
Sourcepub async fn download(
&self,
workspace_id: &str,
hash: &str,
) -> Result<DownloadedAttachment, String>
pub async fn download( &self, workspace_id: &str, hash: &str, ) -> Result<DownloadedAttachment, String>
Download an attachment by hash.
GET /api/workspaces/{workspaceId}/attachments/{hash}
Sourcepub async fn upload_full(
&self,
workspace_id: &str,
entry_path: &str,
attachment_path: &str,
hash: &str,
mime_type: &str,
data: &[u8],
) -> Result<(), String>
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> 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