Skip to main content

hey_sdk/generated/services/
attachments.rs

1// Generated by hey-sdk-generator from openapi.json and behavior-model.json. DO NOT EDIT.
2
3#![allow(missing_docs, unreachable_pub, clippy::all, clippy::pedantic)]
4
5use crate::client::Client;
6use crate::error::Error;
7use crate::generated::routes;
8use crate::generated::types::*;
9
10pub struct Attachments<'a> {
11    client: &'a Client,
12}
13
14impl<'a> Attachments<'a> {
15    pub(crate) fn new(client: &'a Client) -> Self {
16        Self { client }
17    }
18
19    /// The client this service sends through.
20    pub fn client(&self) -> &'a Client {
21        self.client
22    }
23
24    /// Create an Active Storage direct upload for an outgoing attachment.
25    /// The returned URL is self-authenticating and accepts the raw file bytes via PUT.
26    pub async fn create_direct_upload(
27        &self,
28        body: &CreateDirectUploadRequestContent,
29    ) -> Result<DirectUpload, Error> {
30        let mut operation = self.client.operation(&routes::CREATE_DIRECT_UPLOAD, &[]);
31        operation.json(body)?;
32        self.client.send(operation).await
33    }
34}