1#[allow(unused_imports)]
9use alloc::collections::BTreeMap;
10
11#[allow(unused_imports)]
12use core::marker::PhantomData;
13use jacquard_common::CowStr;
14use jacquard_common::types::string::{Did, Nsid, Datetime, UriValue};
15use jacquard_derive::{IntoStatic, lexicon};
16use serde::{Serialize, Deserialize};
17use crate::tools_ozone::moderation::ModEventView;
18
19#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
20#[serde(rename_all = "camelCase")]
21pub struct QueryEvents<'a> {
22 #[serde(skip_serializing_if = "Option::is_none")]
23 #[serde(borrow)]
24 pub added_labels: Option<Vec<CowStr<'a>>>,
25 #[serde(skip_serializing_if = "Option::is_none")]
26 #[serde(borrow)]
27 pub added_tags: Option<Vec<CowStr<'a>>>,
28 #[serde(skip_serializing_if = "Option::is_none")]
29 #[serde(borrow)]
30 pub age_assurance_state: Option<CowStr<'a>>,
31 #[serde(skip_serializing_if = "Option::is_none")]
32 #[serde(borrow)]
33 pub batch_id: Option<CowStr<'a>>,
34 #[serde(skip_serializing_if = "Option::is_none")]
35 #[serde(borrow)]
36 pub collections: Option<Vec<Nsid<'a>>>,
37 #[serde(skip_serializing_if = "Option::is_none")]
38 #[serde(borrow)]
39 pub comment: Option<CowStr<'a>>,
40 #[serde(skip_serializing_if = "Option::is_none")]
41 pub created_after: Option<Datetime>,
42 #[serde(skip_serializing_if = "Option::is_none")]
43 pub created_before: Option<Datetime>,
44 #[serde(skip_serializing_if = "Option::is_none")]
45 #[serde(borrow)]
46 pub created_by: Option<Did<'a>>,
47 #[serde(skip_serializing_if = "Option::is_none")]
48 #[serde(borrow)]
49 pub cursor: Option<CowStr<'a>>,
50 #[serde(skip_serializing_if = "Option::is_none")]
51 pub has_comment: Option<bool>,
52 #[serde(default = "_default_include_all_user_records")]
54 #[serde(skip_serializing_if = "Option::is_none")]
55 pub include_all_user_records: Option<bool>,
56 #[serde(default = "_default_limit")]
58 #[serde(skip_serializing_if = "Option::is_none")]
59 pub limit: Option<i64>,
60 #[serde(skip_serializing_if = "Option::is_none")]
61 #[serde(borrow)]
62 pub mod_tool: Option<Vec<CowStr<'a>>>,
63 #[serde(skip_serializing_if = "Option::is_none")]
64 #[serde(borrow)]
65 pub policies: Option<Vec<CowStr<'a>>>,
66 #[serde(skip_serializing_if = "Option::is_none")]
67 #[serde(borrow)]
68 pub removed_labels: Option<Vec<CowStr<'a>>>,
69 #[serde(skip_serializing_if = "Option::is_none")]
70 #[serde(borrow)]
71 pub removed_tags: Option<Vec<CowStr<'a>>>,
72 #[serde(skip_serializing_if = "Option::is_none")]
73 #[serde(borrow)]
74 pub report_types: Option<Vec<CowStr<'a>>>,
75 #[serde(default = "_default_sort_direction")]
77 #[serde(skip_serializing_if = "Option::is_none")]
78 #[serde(borrow)]
79 pub sort_direction: Option<CowStr<'a>>,
80 #[serde(skip_serializing_if = "Option::is_none")]
81 #[serde(borrow)]
82 pub subject: Option<UriValue<'a>>,
83 #[serde(skip_serializing_if = "Option::is_none")]
84 #[serde(borrow)]
85 pub subject_type: Option<CowStr<'a>>,
86 #[serde(skip_serializing_if = "Option::is_none")]
87 #[serde(borrow)]
88 pub types: Option<Vec<CowStr<'a>>>,
89 #[serde(skip_serializing_if = "Option::is_none")]
90 pub with_strike: Option<bool>,
91}
92
93
94#[lexicon]
95#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
96#[serde(rename_all = "camelCase")]
97pub struct QueryEventsOutput<'a> {
98 #[serde(skip_serializing_if = "Option::is_none")]
99 #[serde(borrow)]
100 pub cursor: Option<CowStr<'a>>,
101 #[serde(borrow)]
102 pub events: Vec<ModEventView<'a>>,
103}
104
105pub struct QueryEventsResponse;
107impl jacquard_common::xrpc::XrpcResp for QueryEventsResponse {
108 const NSID: &'static str = "tools.ozone.moderation.queryEvents";
109 const ENCODING: &'static str = "application/json";
110 type Output<'de> = QueryEventsOutput<'de>;
111 type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
112}
113
114impl<'a> jacquard_common::xrpc::XrpcRequest for QueryEvents<'a> {
115 const NSID: &'static str = "tools.ozone.moderation.queryEvents";
116 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
117 type Response = QueryEventsResponse;
118}
119
120pub struct QueryEventsRequest;
122impl jacquard_common::xrpc::XrpcEndpoint for QueryEventsRequest {
123 const PATH: &'static str = "/xrpc/tools.ozone.moderation.queryEvents";
124 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
125 type Request<'de> = QueryEvents<'de>;
126 type Response = QueryEventsResponse;
127}
128
129fn _default_include_all_user_records() -> Option<bool> {
130 Some(false)
131}
132
133fn _default_limit() -> Option<i64> {
134 Some(50i64)
135}
136
137fn _default_sort_direction() -> Option<CowStr<'static>> {
138 Some(CowStr::from("desc"))
139}
140
141pub mod query_events_state {
142
143 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
144 #[allow(unused)]
145 use ::core::marker::PhantomData;
146 mod sealed {
147 pub trait Sealed {}
148 }
149 pub trait State: sealed::Sealed {}
151 pub struct Empty(());
153 impl sealed::Sealed for Empty {}
154 impl State for Empty {}
155 #[allow(non_camel_case_types)]
157 pub mod members {}
158}
159
160pub struct QueryEventsBuilder<'a, S: query_events_state::State> {
162 _state: PhantomData<fn() -> S>,
163 _fields: (
164 Option<Vec<CowStr<'a>>>,
165 Option<Vec<CowStr<'a>>>,
166 Option<CowStr<'a>>,
167 Option<CowStr<'a>>,
168 Option<Vec<Nsid<'a>>>,
169 Option<CowStr<'a>>,
170 Option<Datetime>,
171 Option<Datetime>,
172 Option<Did<'a>>,
173 Option<CowStr<'a>>,
174 Option<bool>,
175 Option<bool>,
176 Option<i64>,
177 Option<Vec<CowStr<'a>>>,
178 Option<Vec<CowStr<'a>>>,
179 Option<Vec<CowStr<'a>>>,
180 Option<Vec<CowStr<'a>>>,
181 Option<Vec<CowStr<'a>>>,
182 Option<CowStr<'a>>,
183 Option<UriValue<'a>>,
184 Option<CowStr<'a>>,
185 Option<Vec<CowStr<'a>>>,
186 Option<bool>,
187 ),
188 _lifetime: PhantomData<&'a ()>,
189}
190
191impl<'a> QueryEvents<'a> {
192 pub fn new() -> QueryEventsBuilder<'a, query_events_state::Empty> {
194 QueryEventsBuilder::new()
195 }
196}
197
198impl<'a> QueryEventsBuilder<'a, query_events_state::Empty> {
199 pub fn new() -> Self {
201 QueryEventsBuilder {
202 _state: PhantomData,
203 _fields: (
204 None,
205 None,
206 None,
207 None,
208 None,
209 None,
210 None,
211 None,
212 None,
213 None,
214 None,
215 None,
216 None,
217 None,
218 None,
219 None,
220 None,
221 None,
222 None,
223 None,
224 None,
225 None,
226 None,
227 ),
228 _lifetime: PhantomData,
229 }
230 }
231}
232
233impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
234 pub fn added_labels(mut self, value: impl Into<Option<Vec<CowStr<'a>>>>) -> Self {
236 self._fields.0 = value.into();
237 self
238 }
239 pub fn maybe_added_labels(mut self, value: Option<Vec<CowStr<'a>>>) -> Self {
241 self._fields.0 = value;
242 self
243 }
244}
245
246impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
247 pub fn added_tags(mut self, value: impl Into<Option<Vec<CowStr<'a>>>>) -> Self {
249 self._fields.1 = value.into();
250 self
251 }
252 pub fn maybe_added_tags(mut self, value: Option<Vec<CowStr<'a>>>) -> Self {
254 self._fields.1 = value;
255 self
256 }
257}
258
259impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
260 pub fn age_assurance_state(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
262 self._fields.2 = value.into();
263 self
264 }
265 pub fn maybe_age_assurance_state(mut self, value: Option<CowStr<'a>>) -> Self {
267 self._fields.2 = value;
268 self
269 }
270}
271
272impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
273 pub fn batch_id(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
275 self._fields.3 = value.into();
276 self
277 }
278 pub fn maybe_batch_id(mut self, value: Option<CowStr<'a>>) -> Self {
280 self._fields.3 = value;
281 self
282 }
283}
284
285impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
286 pub fn collections(mut self, value: impl Into<Option<Vec<Nsid<'a>>>>) -> Self {
288 self._fields.4 = value.into();
289 self
290 }
291 pub fn maybe_collections(mut self, value: Option<Vec<Nsid<'a>>>) -> Self {
293 self._fields.4 = value;
294 self
295 }
296}
297
298impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
299 pub fn comment(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
301 self._fields.5 = value.into();
302 self
303 }
304 pub fn maybe_comment(mut self, value: Option<CowStr<'a>>) -> Self {
306 self._fields.5 = value;
307 self
308 }
309}
310
311impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
312 pub fn created_after(mut self, value: impl Into<Option<Datetime>>) -> Self {
314 self._fields.6 = value.into();
315 self
316 }
317 pub fn maybe_created_after(mut self, value: Option<Datetime>) -> Self {
319 self._fields.6 = value;
320 self
321 }
322}
323
324impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
325 pub fn created_before(mut self, value: impl Into<Option<Datetime>>) -> Self {
327 self._fields.7 = value.into();
328 self
329 }
330 pub fn maybe_created_before(mut self, value: Option<Datetime>) -> Self {
332 self._fields.7 = value;
333 self
334 }
335}
336
337impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
338 pub fn created_by(mut self, value: impl Into<Option<Did<'a>>>) -> Self {
340 self._fields.8 = value.into();
341 self
342 }
343 pub fn maybe_created_by(mut self, value: Option<Did<'a>>) -> Self {
345 self._fields.8 = value;
346 self
347 }
348}
349
350impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
351 pub fn cursor(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
353 self._fields.9 = value.into();
354 self
355 }
356 pub fn maybe_cursor(mut self, value: Option<CowStr<'a>>) -> Self {
358 self._fields.9 = value;
359 self
360 }
361}
362
363impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
364 pub fn has_comment(mut self, value: impl Into<Option<bool>>) -> Self {
366 self._fields.10 = value.into();
367 self
368 }
369 pub fn maybe_has_comment(mut self, value: Option<bool>) -> Self {
371 self._fields.10 = value;
372 self
373 }
374}
375
376impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
377 pub fn include_all_user_records(mut self, value: impl Into<Option<bool>>) -> Self {
379 self._fields.11 = value.into();
380 self
381 }
382 pub fn maybe_include_all_user_records(mut self, value: Option<bool>) -> Self {
384 self._fields.11 = value;
385 self
386 }
387}
388
389impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
390 pub fn limit(mut self, value: impl Into<Option<i64>>) -> Self {
392 self._fields.12 = value.into();
393 self
394 }
395 pub fn maybe_limit(mut self, value: Option<i64>) -> Self {
397 self._fields.12 = value;
398 self
399 }
400}
401
402impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
403 pub fn mod_tool(mut self, value: impl Into<Option<Vec<CowStr<'a>>>>) -> Self {
405 self._fields.13 = value.into();
406 self
407 }
408 pub fn maybe_mod_tool(mut self, value: Option<Vec<CowStr<'a>>>) -> Self {
410 self._fields.13 = value;
411 self
412 }
413}
414
415impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
416 pub fn policies(mut self, value: impl Into<Option<Vec<CowStr<'a>>>>) -> Self {
418 self._fields.14 = value.into();
419 self
420 }
421 pub fn maybe_policies(mut self, value: Option<Vec<CowStr<'a>>>) -> Self {
423 self._fields.14 = value;
424 self
425 }
426}
427
428impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
429 pub fn removed_labels(mut self, value: impl Into<Option<Vec<CowStr<'a>>>>) -> Self {
431 self._fields.15 = value.into();
432 self
433 }
434 pub fn maybe_removed_labels(mut self, value: Option<Vec<CowStr<'a>>>) -> Self {
436 self._fields.15 = value;
437 self
438 }
439}
440
441impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
442 pub fn removed_tags(mut self, value: impl Into<Option<Vec<CowStr<'a>>>>) -> Self {
444 self._fields.16 = value.into();
445 self
446 }
447 pub fn maybe_removed_tags(mut self, value: Option<Vec<CowStr<'a>>>) -> Self {
449 self._fields.16 = value;
450 self
451 }
452}
453
454impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
455 pub fn report_types(mut self, value: impl Into<Option<Vec<CowStr<'a>>>>) -> Self {
457 self._fields.17 = value.into();
458 self
459 }
460 pub fn maybe_report_types(mut self, value: Option<Vec<CowStr<'a>>>) -> Self {
462 self._fields.17 = value;
463 self
464 }
465}
466
467impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
468 pub fn sort_direction(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
470 self._fields.18 = value.into();
471 self
472 }
473 pub fn maybe_sort_direction(mut self, value: Option<CowStr<'a>>) -> Self {
475 self._fields.18 = value;
476 self
477 }
478}
479
480impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
481 pub fn subject(mut self, value: impl Into<Option<UriValue<'a>>>) -> Self {
483 self._fields.19 = value.into();
484 self
485 }
486 pub fn maybe_subject(mut self, value: Option<UriValue<'a>>) -> Self {
488 self._fields.19 = value;
489 self
490 }
491}
492
493impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
494 pub fn subject_type(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
496 self._fields.20 = value.into();
497 self
498 }
499 pub fn maybe_subject_type(mut self, value: Option<CowStr<'a>>) -> Self {
501 self._fields.20 = value;
502 self
503 }
504}
505
506impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
507 pub fn types(mut self, value: impl Into<Option<Vec<CowStr<'a>>>>) -> Self {
509 self._fields.21 = value.into();
510 self
511 }
512 pub fn maybe_types(mut self, value: Option<Vec<CowStr<'a>>>) -> Self {
514 self._fields.21 = value;
515 self
516 }
517}
518
519impl<'a, S: query_events_state::State> QueryEventsBuilder<'a, S> {
520 pub fn with_strike(mut self, value: impl Into<Option<bool>>) -> Self {
522 self._fields.22 = value.into();
523 self
524 }
525 pub fn maybe_with_strike(mut self, value: Option<bool>) -> Self {
527 self._fields.22 = value;
528 self
529 }
530}
531
532impl<'a, S> QueryEventsBuilder<'a, S>
533where
534 S: query_events_state::State,
535{
536 pub fn build(self) -> QueryEvents<'a> {
538 QueryEvents {
539 added_labels: self._fields.0,
540 added_tags: self._fields.1,
541 age_assurance_state: self._fields.2,
542 batch_id: self._fields.3,
543 collections: self._fields.4,
544 comment: self._fields.5,
545 created_after: self._fields.6,
546 created_before: self._fields.7,
547 created_by: self._fields.8,
548 cursor: self._fields.9,
549 has_comment: self._fields.10,
550 include_all_user_records: self._fields.11,
551 limit: self._fields.12,
552 mod_tool: self._fields.13,
553 policies: self._fields.14,
554 removed_labels: self._fields.15,
555 removed_tags: self._fields.16,
556 report_types: self._fields.17,
557 sort_direction: self._fields.18,
558 subject: self._fields.19,
559 subject_type: self._fields.20,
560 types: self._fields.21,
561 with_strike: self._fields.22,
562 }
563 }
564}