jacquard_api/place_stream/server/
list_webhooks.rs1#[derive(
9 serde::Serialize,
10 serde::Deserialize,
11 Debug,
12 Clone,
13 PartialEq,
14 Eq,
15 jacquard_derive::IntoStatic
16)]
17#[serde(rename_all = "camelCase")]
18pub struct ListWebhooks<'a> {
19 #[serde(skip_serializing_if = "std::option::Option::is_none")]
20 pub active: std::option::Option<bool>,
21 #[serde(skip_serializing_if = "std::option::Option::is_none")]
22 #[serde(borrow)]
23 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>,
24 #[serde(skip_serializing_if = "std::option::Option::is_none")]
25 #[serde(borrow)]
26 pub event: std::option::Option<jacquard_common::CowStr<'a>>,
27 #[serde(skip_serializing_if = "std::option::Option::is_none")]
29 pub limit: std::option::Option<i64>,
30}
31
32pub mod list_webhooks_state {
33
34 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
35 #[allow(unused)]
36 use ::core::marker::PhantomData;
37 mod sealed {
38 pub trait Sealed {}
39 }
40 pub trait State: sealed::Sealed {}
42 pub struct Empty(());
44 impl sealed::Sealed for Empty {}
45 impl State for Empty {}
46 #[allow(non_camel_case_types)]
48 pub mod members {}
49}
50
51pub struct ListWebhooksBuilder<'a, S: list_webhooks_state::State> {
53 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
54 __unsafe_private_named: (
55 ::core::option::Option<bool>,
56 ::core::option::Option<jacquard_common::CowStr<'a>>,
57 ::core::option::Option<jacquard_common::CowStr<'a>>,
58 ::core::option::Option<i64>,
59 ),
60 _phantom: ::core::marker::PhantomData<&'a ()>,
61}
62
63impl<'a> ListWebhooks<'a> {
64 pub fn new() -> ListWebhooksBuilder<'a, list_webhooks_state::Empty> {
66 ListWebhooksBuilder::new()
67 }
68}
69
70impl<'a> ListWebhooksBuilder<'a, list_webhooks_state::Empty> {
71 pub fn new() -> Self {
73 ListWebhooksBuilder {
74 _phantom_state: ::core::marker::PhantomData,
75 __unsafe_private_named: (None, None, None, None),
76 _phantom: ::core::marker::PhantomData,
77 }
78 }
79}
80
81impl<'a, S: list_webhooks_state::State> ListWebhooksBuilder<'a, S> {
82 pub fn active(mut self, value: impl Into<Option<bool>>) -> Self {
84 self.__unsafe_private_named.0 = value.into();
85 self
86 }
87 pub fn maybe_active(mut self, value: Option<bool>) -> Self {
89 self.__unsafe_private_named.0 = value;
90 self
91 }
92}
93
94impl<'a, S: list_webhooks_state::State> ListWebhooksBuilder<'a, S> {
95 pub fn cursor(
97 mut self,
98 value: impl Into<Option<jacquard_common::CowStr<'a>>>,
99 ) -> Self {
100 self.__unsafe_private_named.1 = value.into();
101 self
102 }
103 pub fn maybe_cursor(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
105 self.__unsafe_private_named.1 = value;
106 self
107 }
108}
109
110impl<'a, S: list_webhooks_state::State> ListWebhooksBuilder<'a, S> {
111 pub fn event(
113 mut self,
114 value: impl Into<Option<jacquard_common::CowStr<'a>>>,
115 ) -> Self {
116 self.__unsafe_private_named.2 = value.into();
117 self
118 }
119 pub fn maybe_event(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
121 self.__unsafe_private_named.2 = value;
122 self
123 }
124}
125
126impl<'a, S: list_webhooks_state::State> ListWebhooksBuilder<'a, S> {
127 pub fn limit(mut self, value: impl Into<Option<i64>>) -> Self {
129 self.__unsafe_private_named.3 = value.into();
130 self
131 }
132 pub fn maybe_limit(mut self, value: Option<i64>) -> Self {
134 self.__unsafe_private_named.3 = value;
135 self
136 }
137}
138
139impl<'a, S> ListWebhooksBuilder<'a, S>
140where
141 S: list_webhooks_state::State,
142{
143 pub fn build(self) -> ListWebhooks<'a> {
145 ListWebhooks {
146 active: self.__unsafe_private_named.0,
147 cursor: self.__unsafe_private_named.1,
148 event: self.__unsafe_private_named.2,
149 limit: self.__unsafe_private_named.3,
150 }
151 }
152}
153
154#[jacquard_derive::lexicon]
155#[derive(
156 serde::Serialize,
157 serde::Deserialize,
158 Debug,
159 Clone,
160 PartialEq,
161 Eq,
162 jacquard_derive::IntoStatic
163)]
164#[serde(rename_all = "camelCase")]
165pub struct ListWebhooksOutput<'a> {
166 #[serde(skip_serializing_if = "std::option::Option::is_none")]
168 #[serde(borrow)]
169 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>,
170 #[serde(borrow)]
171 pub webhooks: Vec<crate::place_stream::server::Webhook<'a>>,
172}
173
174#[jacquard_derive::open_union]
175#[derive(
176 serde::Serialize,
177 serde::Deserialize,
178 Debug,
179 Clone,
180 PartialEq,
181 Eq,
182 thiserror::Error,
183 miette::Diagnostic,
184 jacquard_derive::IntoStatic
185)]
186#[serde(tag = "error", content = "message")]
187#[serde(bound(deserialize = "'de: 'a"))]
188pub enum ListWebhooksError<'a> {
189 #[serde(rename = "InvalidCursor")]
191 InvalidCursor(std::option::Option<String>),
192}
193
194impl std::fmt::Display for ListWebhooksError<'_> {
195 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
196 match self {
197 Self::InvalidCursor(msg) => {
198 write!(f, "InvalidCursor")?;
199 if let Some(msg) = msg {
200 write!(f, ": {}", msg)?;
201 }
202 Ok(())
203 }
204 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
205 }
206 }
207}
208
209pub struct ListWebhooksResponse;
212impl jacquard_common::xrpc::XrpcResp for ListWebhooksResponse {
213 const NSID: &'static str = "place.stream.server.listWebhooks";
214 const ENCODING: &'static str = "application/json";
215 type Output<'de> = ListWebhooksOutput<'de>;
216 type Err<'de> = ListWebhooksError<'de>;
217}
218
219impl<'a> jacquard_common::xrpc::XrpcRequest for ListWebhooks<'a> {
220 const NSID: &'static str = "place.stream.server.listWebhooks";
221 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
222 type Response = ListWebhooksResponse;
223}
224
225pub struct ListWebhooksRequest;
228impl jacquard_common::xrpc::XrpcEndpoint for ListWebhooksRequest {
229 const PATH: &'static str = "/xrpc/place.stream.server.listWebhooks";
230 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
231 type Request<'de> = ListWebhooks<'de>;
232 type Response = ListWebhooksResponse;
233}