hey_sdk/generated/services/
postings.rs1#![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#[derive(Debug, Clone, Default, PartialEq)]
13pub struct GetBoxPostingChangesParams {
14 pub v: Option<String>,
15 pub page: Option<String>,
16 pub per_page: Option<String>,
17}
18
19#[derive(Debug, Clone, Default, PartialEq)]
21pub struct GetBundleUnseenPostingsParams {
22 pub page: Option<String>,
23}
24
25#[derive(Debug, Clone, Default, PartialEq)]
27pub struct UnfilePostingsParams {
28 pub folder_id: Option<i64>,
29}
30
31pub struct Postings<'a> {
32 client: &'a Client,
33}
34
35impl<'a> Postings<'a> {
36 pub(crate) fn new(client: &'a Client) -> Self {
37 Self { client }
38 }
39
40 pub fn client(&self) -> &'a Client {
42 self.client
43 }
44
45 pub async fn add_to_box_group(
47 &self,
48 body: &AddPostingsToBoxGroupRequestContent,
49 ) -> Result<(), Error> {
50 let mut operation = self
51 .client
52 .operation(&routes::ADD_POSTINGS_TO_BOX_GROUP, &[]);
53 operation.json(body)?;
54 self.client.send_unit(operation).await
55 }
56
57 pub async fn bubble_up_now(&self, body: &MarkPostingsRequestContent) -> Result<(), Error> {
59 let mut operation = self.client.operation(&routes::BUBBLE_UP_POSTINGS_NOW, &[]);
60 operation.json(body)?;
61 self.client.send_unit(operation).await
62 }
63
64 pub async fn cancel_bubble_up(&self, posting_ids: &str) -> Result<(), Error> {
66 let mut operation = self
67 .client
68 .operation(&routes::CANCEL_POSTINGS_BUBBLE_UP, &[]);
69 operation.query("posting_ids", posting_ids);
70 self.client.send_unit(operation).await
71 }
72
73 pub async fn create_folder(
75 &self,
76 body: &CreateFolderForPostingsRequestContent,
77 ) -> Result<(), Error> {
78 let mut operation = self
79 .client
80 .operation(&routes::CREATE_FOLDER_FOR_POSTINGS, &[]);
81 operation.json(body)?;
82 self.client.send_unit(operation).await
83 }
84
85 pub async fn file(&self, body: &FilePostingsRequestContent) -> Result<(), Error> {
87 let mut operation = self.client.operation(&routes::FILE_POSTINGS, &[]);
88 operation.json(body)?;
89 self.client.send_unit(operation).await
90 }
91
92 pub async fn get_box_changes(
102 &self,
103 box_id: i64,
104 since: &str,
105 params: &GetBoxPostingChangesParams,
106 ) -> Result<Page<GetBoxPostingChangesResponseContent>, Error> {
107 let mut operation = self
108 .client
109 .operation(&routes::GET_BOX_POSTING_CHANGES, &[&box_id]);
110 operation.resource_id(box_id);
111 operation.query("since", since);
112 operation.query_optional("v", params.v.as_ref());
113 operation.query_optional("page", params.page.as_ref());
114 operation.query_optional("per_page", params.per_page.as_ref());
115 self.client.send_page(operation).await
116 }
117
118 pub async fn get_bundle_unseen(
123 &self,
124 posting_id: i64,
125 params: &GetBundleUnseenPostingsParams,
126 ) -> Result<Page<GetBundleUnseenPostingsResponseContent>, Error> {
127 let mut operation = self
128 .client
129 .operation(&routes::GET_BUNDLE_UNSEEN_POSTINGS, &[&posting_id]);
130 operation.resource_id(posting_id);
131 operation.query_optional("page", params.page.as_ref());
132 self.client.send_page(operation).await
133 }
134
135 pub async fn mark_seen(&self, body: &MarkPostingsRequestContent) -> Result<(), Error> {
137 let mut operation = self.client.operation(&routes::MARK_POSTINGS_SEEN, &[]);
138 operation.json(body)?;
139 self.client.send_unit(operation).await
140 }
141
142 pub async fn mark_spam(&self, body: &MarkPostingsRequestContent) -> Result<(), Error> {
147 let mut operation = self.client.operation(&routes::MARK_POSTINGS_SPAM, &[]);
148 operation.json(body)?;
149 self.client.send_unit(operation).await
150 }
151
152 pub async fn mark_unseen(&self, body: &MarkPostingsRequestContent) -> Result<(), Error> {
154 let mut operation = self.client.operation(&routes::MARK_POSTINGS_UNSEEN, &[]);
155 operation.json(body)?;
156 self.client.send_unit(operation).await
157 }
158
159 pub async fn move_postings(&self, body: &MovePostingsRequestContent) -> Result<(), Error> {
164 let mut operation = self.client.operation(&routes::MOVE_POSTINGS, &[]);
165 operation.json(body)?;
166 self.client.send_unit(operation).await
167 }
168
169 pub async fn mute(&self, body: &MarkPostingsRequestContent) -> Result<(), Error> {
172 let mut operation = self.client.operation(&routes::MUTE_POSTINGS, &[]);
173 operation.json(body)?;
174 self.client.send_unit(operation).await
175 }
176
177 pub async fn remove_from_box_group(&self, posting_ids: &str) -> Result<(), Error> {
179 let mut operation = self
180 .client
181 .operation(&routes::REMOVE_POSTINGS_FROM_BOX_GROUP, &[]);
182 operation.query("posting_ids", posting_ids);
183 self.client.send_unit(operation).await
184 }
185
186 pub async fn schedule_bubble_up(
195 &self,
196 body: &SchedulePostingsBubbleUpRequestContent,
197 ) -> Result<(), Error> {
198 let mut operation = self
199 .client
200 .operation(&routes::SCHEDULE_POSTINGS_BUBBLE_UP, &[]);
201 operation.json(body)?;
202 self.client.send_unit(operation).await
203 }
204
205 pub async fn trash(&self, body: &TrashPostingsRequestContent) -> Result<(), Error> {
210 let mut operation = self.client.operation(&routes::TRASH_POSTINGS, &[]);
211 operation.json(body)?;
212 self.client.send_unit(operation).await
213 }
214
215 pub async fn unfile(
217 &self,
218 posting_ids: &str,
219 params: &UnfilePostingsParams,
220 ) -> Result<(), Error> {
221 let mut operation = self.client.operation(&routes::UNFILE_POSTINGS, &[]);
222 operation.query("posting_ids", posting_ids);
223 operation.query_optional("folder_id", params.folder_id.as_ref());
224 self.client.send_unit(operation).await
225 }
226
227 pub async fn unmute(&self, posting_ids: &str) -> Result<(), Error> {
231 let mut operation = self.client.operation(&routes::UNMUTE_POSTINGS, &[]);
232 operation.query("posting_ids", posting_ids);
233 self.client.send_unit(operation).await
234 }
235}