hey-sdk 0.31.0

Rust client for the HEY API, generated from a Smithy model of the API
Documentation
// Generated by hey-sdk-generator from openapi.json and behavior-model.json. DO NOT EDIT.

#![allow(missing_docs, unreachable_pub, clippy::all, clippy::pedantic)]

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

pub struct Attachments<'a> {
    client: &'a Client,
}

impl<'a> Attachments<'a> {
    pub(crate) fn new(client: &'a Client) -> Self {
        Self { client }
    }

    /// The client this service sends through.
    pub fn client(&self) -> &'a Client {
        self.client
    }

    /// Create an Active Storage direct upload for an outgoing attachment.
    /// The returned URL is self-authenticating and accepts the raw file bytes via PUT.
    pub async fn create_direct_upload(
        &self,
        body: &CreateDirectUploadRequestContent,
    ) -> Result<DirectUpload, Error> {
        let mut operation = self.client.operation(&routes::CREATE_DIRECT_UPLOAD, &[]);
        operation.json(body)?;
        self.client.send(operation).await
    }
}