Skip to main content

fizzy_sdk/generated/services/
uploads.rs

1// Generated by fizzy-sdk-generator from openapi.json and behavior-model.json. DO NOT EDIT.
2
3use crate::client::Scope;
4use crate::error::Error;
5use crate::generated::routes;
6use crate::generated::types::*;
7
8/// The `Uploads` operations.
9pub struct UploadsService<'a> {
10    scope: Scope<'a>,
11}
12
13impl<'a> UploadsService<'a> {
14    pub(crate) fn new(scope: Scope<'a>) -> Self {
15        Self { scope }
16    }
17
18    /// The client and account these operations send through.
19    pub fn scope(&self) -> &Scope<'a> {
20        &self.scope
21    }
22
23    /// `CreateDirectUpload` — `POST /{accountId}/rails/active_storage/direct_uploads`.
24    ///
25    /// Sent once and never resent.
26    pub async fn create_direct_upload(
27        &self,
28        body: &CreateDirectUploadRequestContent,
29    ) -> Result<DirectUpload, Error> {
30        let mut operation = self.scope.operation(&routes::CREATE_DIRECT_UPLOAD, &[])?;
31        operation.json(body)?;
32        self.scope.client().send(operation).await
33    }
34}