#![allow(
clippy::too_many_arguments,
clippy::wildcard_imports,
clippy::doc_markdown
)]
use bytes::Bytes;
use crate::client::AccountClient;
use crate::error::Error;
use crate::generated::routes;
#[allow(unused_imports)]
use crate::generated::types::*;
#[derive(Debug, Clone, Copy)]
pub struct AttachmentsService<'a> {
client: &'a AccountClient,
}
impl<'a> AttachmentsService<'a> {
pub(crate) fn new(client: &'a AccountClient) -> Self {
Self { client }
}
pub fn client(&self) -> &'a AccountClient {
self.client
}
pub async fn create(
&self,
name: &str,
content_type: &str,
body: Bytes,
) -> Result<CreateAttachmentResponseContent, Error> {
let mut operation = self.client.operation(&routes::CREATE_ATTACHMENT, &[]);
operation.query("name", name);
operation.bytes(content_type, body);
self.client.send(operation).await
}
}