Skip to main content

xmtp_api/
attachments.rs

1//! The backend request that signs one attachment upload.
2
3use crate::{ApiClientWrapper, Result, dyn_err};
4use xmtp_proto::{
5    api_client::XmtpBackendClient,
6    backend_v1::{CreateUploadRequest, CreateUploadResponse},
7};
8
9impl<C: XmtpBackendClient> ApiClientWrapper<C> {
10    /// Get the request to send to the configured storage target.
11    #[xmtp_common::rpc_span]
12    pub async fn create_upload(
13        &self,
14        request: CreateUploadRequest,
15    ) -> Result<CreateUploadResponse> {
16        self.retry_call(|| self.api_client.create_upload(request.clone()), false)
17            .await
18            .map_err(dyn_err)
19    }
20}