Skip to main content

hey_sdk/generated/services/
boxes.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::*;
9use crate::pagination::Page;
10
11/// Optional query parameters for `GetBox`.
12#[derive(Debug, Clone, Default, PartialEq)]
13pub struct GetBoxParams {
14    pub page: Option<String>,
15}
16
17/// Optional query parameters for `GetAsidebox`.
18#[derive(Debug, Clone, Default, PartialEq)]
19pub struct GetAsideboxParams {
20    pub page: Option<String>,
21}
22
23/// Optional query parameters for `GetBubblebox`.
24#[derive(Debug, Clone, Default, PartialEq)]
25pub struct GetBubbleboxParams {
26    pub page: Option<String>,
27}
28
29/// Optional query parameters for `GetFeedbox`.
30#[derive(Debug, Clone, Default, PartialEq)]
31pub struct GetFeedboxParams {
32    pub page: Option<String>,
33}
34
35/// Optional query parameters for `GetBoxGroup`.
36#[derive(Debug, Clone, Default, PartialEq)]
37pub struct GetBoxGroupParams {
38    pub page: Option<String>,
39}
40
41/// Optional query parameters for `GetImbox`.
42#[derive(Debug, Clone, Default, PartialEq)]
43pub struct GetImboxParams {
44    pub page: Option<String>,
45}
46
47/// Optional query parameters for `GetImboxSeen`.
48#[derive(Debug, Clone, Default, PartialEq)]
49pub struct GetImboxSeenParams {
50    pub page: Option<String>,
51}
52
53/// Optional query parameters for `GetLaterbox`.
54#[derive(Debug, Clone, Default, PartialEq)]
55pub struct GetLaterboxParams {
56    pub page: Option<String>,
57}
58
59/// Optional query parameters for `GetTrailbox`.
60#[derive(Debug, Clone, Default, PartialEq)]
61pub struct GetTrailboxParams {
62    pub page: Option<String>,
63}
64
65pub struct Boxes<'a> {
66    client: &'a Client,
67}
68
69impl<'a> Boxes<'a> {
70    pub(crate) fn new(client: &'a Client) -> Self {
71        Self { client }
72    }
73
74    /// The client this service sends through.
75    pub fn client(&self) -> &'a Client {
76        self.client
77    }
78
79    /// Create a Set Aside group out of a selection of postings.
80    ///
81    /// This endpoint does not split a comma-joined posting_ids string — send an array.
82    pub async fn create_group(
83        &self,
84        box_id: i64,
85        body: &CreateBoxGroupRequestContent,
86    ) -> Result<CreateBoxGroupResponseContent, Error> {
87        let mut operation = self.client.operation(&routes::CREATE_BOX_GROUP, &[&box_id]);
88        operation.resource_id(box_id);
89        operation.json(body)?;
90        self.client.send(operation).await
91    }
92
93    /// Break up a Set Aside group, moving its postings back to Previously Seen
94    pub async fn delete_group(&self, box_id: i64, group_id: i64) -> Result<(), Error> {
95        let mut operation = self
96            .client
97            .operation(&routes::DELETE_BOX_GROUP, &[&box_id, &group_id]);
98        operation.resource_id(group_id);
99        self.client.send_unit(operation).await
100    }
101
102    /// Get a specific box
103    pub async fn get(
104        &self,
105        box_id: i64,
106        params: &GetBoxParams,
107    ) -> Result<Page<GetBoxResponseContent>, Error> {
108        let mut operation = self.client.operation(&routes::GET_BOX, &[&box_id]);
109        operation.resource_id(box_id);
110        operation.query_optional("page", params.page.as_ref());
111        self.client.send_page(operation).await
112    }
113
114    /// Get the Set Aside box
115    pub async fn get_asidebox(
116        &self,
117        params: &GetAsideboxParams,
118    ) -> Result<GetAsideboxResponseContent, Error> {
119        let mut operation = self.client.operation(&routes::GET_ASIDEBOX, &[]);
120        operation.query_optional("page", params.page.as_ref());
121        self.client.send(operation).await
122    }
123
124    /// Get the Bubble Up box
125    pub async fn get_bubblebox(
126        &self,
127        params: &GetBubbleboxParams,
128    ) -> Result<GetBubbleboxResponseContent, Error> {
129        let mut operation = self.client.operation(&routes::GET_BUBBLEBOX, &[]);
130        operation.query_optional("page", params.page.as_ref());
131        self.client.send(operation).await
132    }
133
134    /// Get the Feed
135    pub async fn get_feedbox(
136        &self,
137        params: &GetFeedboxParams,
138    ) -> Result<GetFeedboxResponseContent, Error> {
139        let mut operation = self.client.operation(&routes::GET_FEEDBOX, &[]);
140        operation.query_optional("page", params.page.as_ref());
141        self.client.send(operation).await
142    }
143
144    /// Read one Set Aside group with the postings in it.
145    ///
146    /// The postings are paged like a folder's: newest observed first, 30 to a page, with the
147    /// next page in the Link header and the total in X-Total-Count.
148    pub async fn get_group(
149        &self,
150        box_id: i64,
151        group_id: i64,
152        params: &GetBoxGroupParams,
153    ) -> Result<Page<GetBoxGroupResponseContent>, Error> {
154        let mut operation = self
155            .client
156            .operation(&routes::GET_BOX_GROUP, &[&box_id, &group_id]);
157        operation.resource_id(group_id);
158        operation.query_optional("page", params.page.as_ref());
159        self.client.send_page(operation).await
160    }
161
162    /// Get the Imbox
163    pub async fn get_imbox(
164        &self,
165        params: &GetImboxParams,
166    ) -> Result<GetImboxResponseContent, Error> {
167        let mut operation = self.client.operation(&routes::GET_IMBOX, &[]);
168        operation.query_optional("page", params.page.as_ref());
169        self.client.send(operation).await
170    }
171
172    /// Get the Imbox's Previously Seen postings
173    pub async fn get_imbox_seen(
174        &self,
175        params: &GetImboxSeenParams,
176    ) -> Result<GetImboxSeenResponseContent, Error> {
177        let mut operation = self.client.operation(&routes::GET_IMBOX_SEEN, &[]);
178        operation.query_optional("page", params.page.as_ref());
179        self.client.send(operation).await
180    }
181
182    /// Get the Reply Later box
183    pub async fn get_laterbox(
184        &self,
185        params: &GetLaterboxParams,
186    ) -> Result<GetLaterboxResponseContent, Error> {
187        let mut operation = self.client.operation(&routes::GET_LATERBOX, &[]);
188        operation.query_optional("page", params.page.as_ref());
189        self.client.send(operation).await
190    }
191
192    /// Get the Paper Trail
193    pub async fn get_trailbox(
194        &self,
195        params: &GetTrailboxParams,
196    ) -> Result<GetTrailboxResponseContent, Error> {
197        let mut operation = self.client.operation(&routes::GET_TRAILBOX, &[]);
198        operation.query_optional("page", params.page.as_ref());
199        self.client.send(operation).await
200    }
201
202    /// List all boxes
203    pub async fn list(&self) -> Result<Page<ListBoxesResponseContent>, Error> {
204        let operation = self.client.operation(&routes::LIST_BOXES, &[]);
205        self.client.send_page(operation).await
206    }
207
208    /// List the Set Aside groups in a box
209    pub async fn list_groups(&self, box_id: i64) -> Result<ListBoxGroupsResponseContent, Error> {
210        let mut operation = self.client.operation(&routes::LIST_BOX_GROUPS, &[&box_id]);
211        operation.resource_id(box_id);
212        self.client.send(operation).await
213    }
214
215    /// Mark everything in a box as seen. The work is queued, so the effect is eventually consistent.
216    pub async fn mark_seen(&self, box_id: i64) -> Result<(), Error> {
217        let mut operation = self.client.operation(&routes::MARK_BOX_SEEN, &[&box_id]);
218        operation.resource_id(box_id);
219        self.client.send_unit(operation).await
220    }
221}