fizzy-sdk 0.2.4

Official Fizzy API client, generated from the Smithy model in spec/
Documentation
// Generated by fizzy-sdk-generator from openapi.json and behavior-model.json. DO NOT EDIT.

use crate::client::Scope;
use crate::error::Error;
use crate::generated::routes;
use crate::generated::types::*;

/// The `Uploads` operations.
pub struct UploadsService<'a> {
    scope: Scope<'a>,
}

impl<'a> UploadsService<'a> {
    pub(crate) fn new(scope: Scope<'a>) -> Self {
        Self { scope }
    }

    /// The client and account these operations send through.
    pub fn scope(&self) -> &Scope<'a> {
        &self.scope
    }

    /// `CreateDirectUpload` — `POST /{accountId}/rails/active_storage/direct_uploads`.
    ///
    /// Sent once and never resent.
    pub async fn create_direct_upload(
        &self,
        body: &CreateDirectUploadRequestContent,
    ) -> Result<DirectUpload, Error> {
        let mut operation = self.scope.operation(&routes::CREATE_DIRECT_UPLOAD, &[])?;
        operation.json(body)?;
        self.scope.client().send(operation).await
    }
}