atproto blogging
1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: sh.weaver.collab.getInvites
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[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 GetInvites<'a> {
19 #[serde(borrow)]
20 pub actor: jacquard_common::types::ident::AtIdentifier<'a>,
21 #[serde(skip_serializing_if = "std::option::Option::is_none")]
22 #[serde(borrow)]
23 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>,
24 ///(default: "all")
25 #[serde(skip_serializing_if = "std::option::Option::is_none")]
26 #[serde(borrow)]
27 pub direction: std::option::Option<jacquard_common::CowStr<'a>>,
28 ///(default: 50, min: 1, max: 100)
29 #[serde(skip_serializing_if = "std::option::Option::is_none")]
30 pub limit: std::option::Option<i64>,
31 ///(default: "all")
32 #[serde(skip_serializing_if = "std::option::Option::is_none")]
33 #[serde(borrow)]
34 pub status: std::option::Option<jacquard_common::CowStr<'a>>,
35}
36
37pub mod get_invites_state {
38
39 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
40 #[allow(unused)]
41 use ::core::marker::PhantomData;
42 mod sealed {
43 pub trait Sealed {}
44 }
45 /// State trait tracking which required fields have been set
46 pub trait State: sealed::Sealed {
47 type Actor;
48 }
49 /// Empty state - all required fields are unset
50 pub struct Empty(());
51 impl sealed::Sealed for Empty {}
52 impl State for Empty {
53 type Actor = Unset;
54 }
55 ///State transition - sets the `actor` field to Set
56 pub struct SetActor<S: State = Empty>(PhantomData<fn() -> S>);
57 impl<S: State> sealed::Sealed for SetActor<S> {}
58 impl<S: State> State for SetActor<S> {
59 type Actor = Set<members::actor>;
60 }
61 /// Marker types for field names
62 #[allow(non_camel_case_types)]
63 pub mod members {
64 ///Marker type for the `actor` field
65 pub struct actor(());
66 }
67}
68
69/// Builder for constructing an instance of this type
70pub struct GetInvitesBuilder<'a, S: get_invites_state::State> {
71 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
72 __unsafe_private_named: (
73 ::core::option::Option<jacquard_common::types::ident::AtIdentifier<'a>>,
74 ::core::option::Option<jacquard_common::CowStr<'a>>,
75 ::core::option::Option<jacquard_common::CowStr<'a>>,
76 ::core::option::Option<i64>,
77 ::core::option::Option<jacquard_common::CowStr<'a>>,
78 ),
79 _phantom: ::core::marker::PhantomData<&'a ()>,
80}
81
82impl<'a> GetInvites<'a> {
83 /// Create a new builder for this type
84 pub fn new() -> GetInvitesBuilder<'a, get_invites_state::Empty> {
85 GetInvitesBuilder::new()
86 }
87}
88
89impl<'a> GetInvitesBuilder<'a, get_invites_state::Empty> {
90 /// Create a new builder with all fields unset
91 pub fn new() -> Self {
92 GetInvitesBuilder {
93 _phantom_state: ::core::marker::PhantomData,
94 __unsafe_private_named: (None, None, None, None, None),
95 _phantom: ::core::marker::PhantomData,
96 }
97 }
98}
99
100impl<'a, S> GetInvitesBuilder<'a, S>
101where
102 S: get_invites_state::State,
103 S::Actor: get_invites_state::IsUnset,
104{
105 /// Set the `actor` field (required)
106 pub fn actor(
107 mut self,
108 value: impl Into<jacquard_common::types::ident::AtIdentifier<'a>>,
109 ) -> GetInvitesBuilder<'a, get_invites_state::SetActor<S>> {
110 self.__unsafe_private_named.0 = ::core::option::Option::Some(value.into());
111 GetInvitesBuilder {
112 _phantom_state: ::core::marker::PhantomData,
113 __unsafe_private_named: self.__unsafe_private_named,
114 _phantom: ::core::marker::PhantomData,
115 }
116 }
117}
118
119impl<'a, S: get_invites_state::State> GetInvitesBuilder<'a, S> {
120 /// Set the `cursor` field (optional)
121 pub fn cursor(
122 mut self,
123 value: impl Into<Option<jacquard_common::CowStr<'a>>>,
124 ) -> Self {
125 self.__unsafe_private_named.1 = value.into();
126 self
127 }
128 /// Set the `cursor` field to an Option value (optional)
129 pub fn maybe_cursor(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
130 self.__unsafe_private_named.1 = value;
131 self
132 }
133}
134
135impl<'a, S: get_invites_state::State> GetInvitesBuilder<'a, S> {
136 /// Set the `direction` field (optional)
137 pub fn direction(
138 mut self,
139 value: impl Into<Option<jacquard_common::CowStr<'a>>>,
140 ) -> Self {
141 self.__unsafe_private_named.2 = value.into();
142 self
143 }
144 /// Set the `direction` field to an Option value (optional)
145 pub fn maybe_direction(
146 mut self,
147 value: Option<jacquard_common::CowStr<'a>>,
148 ) -> Self {
149 self.__unsafe_private_named.2 = value;
150 self
151 }
152}
153
154impl<'a, S: get_invites_state::State> GetInvitesBuilder<'a, S> {
155 /// Set the `limit` field (optional)
156 pub fn limit(mut self, value: impl Into<Option<i64>>) -> Self {
157 self.__unsafe_private_named.3 = value.into();
158 self
159 }
160 /// Set the `limit` field to an Option value (optional)
161 pub fn maybe_limit(mut self, value: Option<i64>) -> Self {
162 self.__unsafe_private_named.3 = value;
163 self
164 }
165}
166
167impl<'a, S: get_invites_state::State> GetInvitesBuilder<'a, S> {
168 /// Set the `status` field (optional)
169 pub fn status(
170 mut self,
171 value: impl Into<Option<jacquard_common::CowStr<'a>>>,
172 ) -> Self {
173 self.__unsafe_private_named.4 = value.into();
174 self
175 }
176 /// Set the `status` field to an Option value (optional)
177 pub fn maybe_status(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
178 self.__unsafe_private_named.4 = value;
179 self
180 }
181}
182
183impl<'a, S> GetInvitesBuilder<'a, S>
184where
185 S: get_invites_state::State,
186 S::Actor: get_invites_state::IsSet,
187{
188 /// Build the final struct
189 pub fn build(self) -> GetInvites<'a> {
190 GetInvites {
191 actor: self.__unsafe_private_named.0.unwrap(),
192 cursor: self.__unsafe_private_named.1,
193 direction: self.__unsafe_private_named.2,
194 limit: self.__unsafe_private_named.3,
195 status: self.__unsafe_private_named.4,
196 }
197 }
198}
199
200#[jacquard_derive::lexicon]
201#[derive(
202 serde::Serialize,
203 serde::Deserialize,
204 Debug,
205 Clone,
206 PartialEq,
207 Eq,
208 jacquard_derive::IntoStatic
209)]
210#[serde(rename_all = "camelCase")]
211pub struct GetInvitesOutput<'a> {
212 #[serde(skip_serializing_if = "std::option::Option::is_none")]
213 #[serde(borrow)]
214 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>,
215 #[serde(borrow)]
216 pub invites: Vec<crate::sh_weaver::collab::InviteView<'a>>,
217}
218
219/// Response type for
220///sh.weaver.collab.getInvites
221pub struct GetInvitesResponse;
222impl jacquard_common::xrpc::XrpcResp for GetInvitesResponse {
223 const NSID: &'static str = "sh.weaver.collab.getInvites";
224 const ENCODING: &'static str = "application/json";
225 type Output<'de> = GetInvitesOutput<'de>;
226 type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
227}
228
229impl<'a> jacquard_common::xrpc::XrpcRequest for GetInvites<'a> {
230 const NSID: &'static str = "sh.weaver.collab.getInvites";
231 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
232 type Response = GetInvitesResponse;
233}
234
235/// Endpoint type for
236///sh.weaver.collab.getInvites
237pub struct GetInvitesRequest;
238impl jacquard_common::xrpc::XrpcEndpoint for GetInvitesRequest {
239 const PATH: &'static str = "/xrpc/sh.weaver.collab.getInvites";
240 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
241 type Request<'de> = GetInvites<'de>;
242 type Response = GetInvitesResponse;
243}