jacquard_api/tools_ozone/moderation/
get_event.rs1#[allow(unused_imports)]
9use core::marker::PhantomData;
10use jacquard_derive::IntoStatic;
11use serde::{Serialize, Deserialize};
12use crate::tools_ozone::moderation::ModEventViewDetail;
13
14#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
15#[serde(rename_all = "camelCase")]
16pub struct GetEvent {
17 pub id: i64,
18}
19
20
21#[jacquard_derive::lexicon]
22#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
23#[serde(rename_all = "camelCase")]
24pub struct GetEventOutput<'a> {
25 #[serde(flatten)]
26 #[serde(borrow)]
27 pub value: ModEventViewDetail<'a>,
28}
29
30pub struct GetEventResponse;
32impl jacquard_common::xrpc::XrpcResp for GetEventResponse {
33 const NSID: &'static str = "tools.ozone.moderation.getEvent";
34 const ENCODING: &'static str = "application/json";
35 type Output<'de> = GetEventOutput<'de>;
36 type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
37}
38
39impl jacquard_common::xrpc::XrpcRequest for GetEvent {
40 const NSID: &'static str = "tools.ozone.moderation.getEvent";
41 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
42 type Response = GetEventResponse;
43}
44
45pub struct GetEventRequest;
47impl jacquard_common::xrpc::XrpcEndpoint for GetEventRequest {
48 const PATH: &'static str = "/xrpc/tools.ozone.moderation.getEvent";
49 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
50 type Request<'de> = GetEvent;
51 type Response = GetEventResponse;
52}
53
54pub mod get_event_state {
55
56 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
57 #[allow(unused)]
58 use ::core::marker::PhantomData;
59 mod sealed {
60 pub trait Sealed {}
61 }
62 pub trait State: sealed::Sealed {
64 type Id;
65 }
66 pub struct Empty(());
68 impl sealed::Sealed for Empty {}
69 impl State for Empty {
70 type Id = Unset;
71 }
72 pub struct SetId<S: State = Empty>(PhantomData<fn() -> S>);
74 impl<S: State> sealed::Sealed for SetId<S> {}
75 impl<S: State> State for SetId<S> {
76 type Id = Set<members::id>;
77 }
78 #[allow(non_camel_case_types)]
80 pub mod members {
81 pub struct id(());
83 }
84}
85
86pub struct GetEventBuilder<S: get_event_state::State> {
88 _state: PhantomData<fn() -> S>,
89 _fields: (Option<i64>,),
90}
91
92impl GetEvent {
93 pub fn new() -> GetEventBuilder<get_event_state::Empty> {
95 GetEventBuilder::new()
96 }
97}
98
99impl GetEventBuilder<get_event_state::Empty> {
100 pub fn new() -> Self {
102 GetEventBuilder {
103 _state: PhantomData,
104 _fields: (None,),
105 }
106 }
107}
108
109impl<S> GetEventBuilder<S>
110where
111 S: get_event_state::State,
112 S::Id: get_event_state::IsUnset,
113{
114 pub fn id(
116 mut self,
117 value: impl Into<i64>,
118 ) -> GetEventBuilder<get_event_state::SetId<S>> {
119 self._fields.0 = Option::Some(value.into());
120 GetEventBuilder {
121 _state: PhantomData,
122 _fields: self._fields,
123 }
124 }
125}
126
127impl<S> GetEventBuilder<S>
128where
129 S: get_event_state::State,
130 S::Id: get_event_state::IsSet,
131{
132 pub fn build(self) -> GetEvent {
134 GetEvent {
135 id: self._fields.0.unwrap(),
136 }
137 }
138}