Skip to main content

hey_sdk/generated/services/
designations.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 Designations<'a> {
11    client: &'a Client,
12}
13
14impl<'a> Designations<'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    /// Designate a contact to a box, so everything they send lands there
25    pub async fn create(
26        &self,
27        box_id: i64,
28        body: &CreateBoxDesignationRequestContent,
29    ) -> Result<(), Error> {
30        let mut operation = self
31            .client
32            .operation(&routes::CREATE_BOX_DESIGNATION, &[&box_id]);
33        operation.resource_id(box_id);
34        operation.json(body)?;
35        self.client.send_unit(operation).await
36    }
37
38    /// Remove a designation from a box. The id is the designation's, not the contact's.
39    pub async fn delete(&self, box_id: i64, designation_id: i64) -> Result<(), Error> {
40        let mut operation = self
41            .client
42            .operation(&routes::DELETE_BOX_DESIGNATION, &[&box_id, &designation_id]);
43        operation.resource_id(designation_id);
44        self.client.send_unit(operation).await
45    }
46}