jacquard_api/com_atproto/admin/
get_invite_codes.rs1#[allow(unused_imports)]
9use alloc::collections::BTreeMap;
10
11#[allow(unused_imports)]
12use core::marker::PhantomData;
13use jacquard_common::CowStr;
14use jacquard_derive::{IntoStatic, lexicon};
15use serde::{Serialize, Deserialize};
16use crate::com_atproto::server::InviteCode;
17
18#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
19#[serde(rename_all = "camelCase")]
20pub struct GetInviteCodes<'a> {
21 #[serde(skip_serializing_if = "Option::is_none")]
22 #[serde(borrow)]
23 pub cursor: Option<CowStr<'a>>,
24 #[serde(default = "_default_limit")]
26 #[serde(skip_serializing_if = "Option::is_none")]
27 pub limit: Option<i64>,
28 #[serde(default = "_default_sort")]
30 #[serde(skip_serializing_if = "Option::is_none")]
31 #[serde(borrow)]
32 pub sort: Option<CowStr<'a>>,
33}
34
35
36#[lexicon]
37#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
38#[serde(rename_all = "camelCase")]
39pub struct GetInviteCodesOutput<'a> {
40 #[serde(borrow)]
41 pub codes: Vec<InviteCode<'a>>,
42 #[serde(skip_serializing_if = "Option::is_none")]
43 #[serde(borrow)]
44 pub cursor: Option<CowStr<'a>>,
45}
46
47pub struct GetInviteCodesResponse;
49impl jacquard_common::xrpc::XrpcResp for GetInviteCodesResponse {
50 const NSID: &'static str = "com.atproto.admin.getInviteCodes";
51 const ENCODING: &'static str = "application/json";
52 type Output<'de> = GetInviteCodesOutput<'de>;
53 type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
54}
55
56impl<'a> jacquard_common::xrpc::XrpcRequest for GetInviteCodes<'a> {
57 const NSID: &'static str = "com.atproto.admin.getInviteCodes";
58 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
59 type Response = GetInviteCodesResponse;
60}
61
62pub struct GetInviteCodesRequest;
64impl jacquard_common::xrpc::XrpcEndpoint for GetInviteCodesRequest {
65 const PATH: &'static str = "/xrpc/com.atproto.admin.getInviteCodes";
66 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
67 type Request<'de> = GetInviteCodes<'de>;
68 type Response = GetInviteCodesResponse;
69}
70
71fn _default_limit() -> Option<i64> {
72 Some(100i64)
73}
74
75fn _default_sort() -> Option<CowStr<'static>> {
76 Some(CowStr::from("recent"))
77}
78
79pub mod get_invite_codes_state {
80
81 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
82 #[allow(unused)]
83 use ::core::marker::PhantomData;
84 mod sealed {
85 pub trait Sealed {}
86 }
87 pub trait State: sealed::Sealed {}
89 pub struct Empty(());
91 impl sealed::Sealed for Empty {}
92 impl State for Empty {}
93 #[allow(non_camel_case_types)]
95 pub mod members {}
96}
97
98pub struct GetInviteCodesBuilder<'a, S: get_invite_codes_state::State> {
100 _state: PhantomData<fn() -> S>,
101 _fields: (Option<CowStr<'a>>, Option<i64>, Option<CowStr<'a>>),
102 _lifetime: PhantomData<&'a ()>,
103}
104
105impl<'a> GetInviteCodes<'a> {
106 pub fn new() -> GetInviteCodesBuilder<'a, get_invite_codes_state::Empty> {
108 GetInviteCodesBuilder::new()
109 }
110}
111
112impl<'a> GetInviteCodesBuilder<'a, get_invite_codes_state::Empty> {
113 pub fn new() -> Self {
115 GetInviteCodesBuilder {
116 _state: PhantomData,
117 _fields: (None, None, None),
118 _lifetime: PhantomData,
119 }
120 }
121}
122
123impl<'a, S: get_invite_codes_state::State> GetInviteCodesBuilder<'a, S> {
124 pub fn cursor(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
126 self._fields.0 = value.into();
127 self
128 }
129 pub fn maybe_cursor(mut self, value: Option<CowStr<'a>>) -> Self {
131 self._fields.0 = value;
132 self
133 }
134}
135
136impl<'a, S: get_invite_codes_state::State> GetInviteCodesBuilder<'a, S> {
137 pub fn limit(mut self, value: impl Into<Option<i64>>) -> Self {
139 self._fields.1 = value.into();
140 self
141 }
142 pub fn maybe_limit(mut self, value: Option<i64>) -> Self {
144 self._fields.1 = value;
145 self
146 }
147}
148
149impl<'a, S: get_invite_codes_state::State> GetInviteCodesBuilder<'a, S> {
150 pub fn sort(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
152 self._fields.2 = value.into();
153 self
154 }
155 pub fn maybe_sort(mut self, value: Option<CowStr<'a>>) -> Self {
157 self._fields.2 = value;
158 self
159 }
160}
161
162impl<'a, S> GetInviteCodesBuilder<'a, S>
163where
164 S: get_invite_codes_state::State,
165{
166 pub fn build(self) -> GetInviteCodes<'a> {
168 GetInviteCodes {
169 cursor: self._fields.0,
170 limit: self._fields.1,
171 sort: self._fields.2,
172 }
173 }
174}