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, BosStr, DefaultStr, FromStaticStr};
14use jacquard_common::deps::smol_str::SmolStr;
15use jacquard_common::types::value::Data;
16use jacquard_derive::IntoStatic;
17use serde::{Serialize, Deserialize};
18use crate::com_atproto::server::InviteCode;
19
20#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
21#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
22pub struct GetInviteCodes<S: BosStr = DefaultStr> {
23 #[serde(skip_serializing_if = "Option::is_none")]
24 pub cursor: Option<S>,
25 #[serde(default = "_default_limit")]
27 #[serde(skip_serializing_if = "Option::is_none")]
28 pub limit: Option<i64>,
29 #[serde(default = "_default_sort")]
31 #[serde(skip_serializing_if = "Option::is_none")]
32 pub sort: Option<S>,
33}
34
35
36#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
37#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]
38pub struct GetInviteCodesOutput<S: BosStr = DefaultStr> {
39 pub codes: Vec<InviteCode<S>>,
40 #[serde(skip_serializing_if = "Option::is_none")]
41 pub cursor: Option<S>,
42 #[serde(flatten, default, skip_serializing_if = "Option::is_none")]
43 pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,
44}
45
46pub struct GetInviteCodesResponse;
50impl jacquard_common::xrpc::XrpcResp for GetInviteCodesResponse {
51 const NSID: &'static str = "com.atproto.admin.getInviteCodes";
52 const ENCODING: &'static str = "application/json";
53 type Output<S: BosStr> = GetInviteCodesOutput<S>;
54 type Err = jacquard_common::xrpc::GenericError;
55}
56
57impl<S: BosStr> jacquard_common::xrpc::XrpcRequest for GetInviteCodes<S> {
58 const NSID: &'static str = "com.atproto.admin.getInviteCodes";
59 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
60 type Response = GetInviteCodesResponse;
61}
62
63pub struct GetInviteCodesRequest;
67impl jacquard_common::xrpc::XrpcEndpoint for GetInviteCodesRequest {
68 const PATH: &'static str = "/xrpc/com.atproto.admin.getInviteCodes";
69 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
70 type Request<S: BosStr> = GetInviteCodes<S>;
71 type Response = GetInviteCodesResponse;
72}
73
74fn _default_limit() -> Option<i64> {
75 Some(100i64)
76}
77
78fn _default_sort<S: jacquard_common::FromStaticStr>() -> Option<S> {
79 Some(S::from_static("recent"))
80}
81
82pub mod get_invite_codes_state {
83
84 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
85 #[allow(unused)]
86 use ::core::marker::PhantomData;
87 mod sealed {
88 pub trait Sealed {}
89 }
90 pub trait State: sealed::Sealed {}
92 pub struct Empty(());
94 impl sealed::Sealed for Empty {}
95 impl State for Empty {}
96 #[allow(non_camel_case_types)]
98 pub mod members {}
99}
100
101pub struct GetInviteCodesBuilder<
103 St: get_invite_codes_state::State,
104 S: BosStr = DefaultStr,
105> {
106 _state: PhantomData<fn() -> St>,
107 _fields: (Option<S>, Option<i64>, Option<S>),
108 _type: PhantomData<fn() -> S>,
109}
110
111impl GetInviteCodes<DefaultStr> {
112 pub fn new() -> GetInviteCodesBuilder<get_invite_codes_state::Empty, DefaultStr> {
114 GetInviteCodesBuilder::new()
115 }
116}
117
118impl<S: BosStr> GetInviteCodes<S> {
119 pub fn builder() -> GetInviteCodesBuilder<get_invite_codes_state::Empty, S> {
121 GetInviteCodesBuilder::builder()
122 }
123}
124
125impl GetInviteCodesBuilder<get_invite_codes_state::Empty, DefaultStr> {
126 pub fn new() -> Self {
128 GetInviteCodesBuilder {
129 _state: PhantomData,
130 _fields: (None, None, None),
131 _type: PhantomData,
132 }
133 }
134}
135
136impl<S: BosStr> GetInviteCodesBuilder<get_invite_codes_state::Empty, S> {
137 pub fn builder() -> Self {
139 GetInviteCodesBuilder {
140 _state: PhantomData,
141 _fields: (None, None, None),
142 _type: PhantomData,
143 }
144 }
145}
146
147impl<St: get_invite_codes_state::State, S: BosStr> GetInviteCodesBuilder<St, S> {
148 pub fn cursor(mut self, value: impl Into<Option<S>>) -> Self {
150 self._fields.0 = value.into();
151 self
152 }
153 pub fn maybe_cursor(mut self, value: Option<S>) -> Self {
155 self._fields.0 = value;
156 self
157 }
158}
159
160impl<St: get_invite_codes_state::State, S: BosStr> GetInviteCodesBuilder<St, S> {
161 pub fn limit(mut self, value: impl Into<Option<i64>>) -> Self {
163 self._fields.1 = value.into();
164 self
165 }
166 pub fn maybe_limit(mut self, value: Option<i64>) -> Self {
168 self._fields.1 = value;
169 self
170 }
171}
172
173impl<St: get_invite_codes_state::State, S: BosStr> GetInviteCodesBuilder<St, S> {
174 pub fn sort(mut self, value: impl Into<Option<S>>) -> Self {
176 self._fields.2 = value.into();
177 self
178 }
179 pub fn maybe_sort(mut self, value: Option<S>) -> Self {
181 self._fields.2 = value;
182 self
183 }
184}
185
186impl<St, S: BosStr> GetInviteCodesBuilder<St, S>
187where
188 St: get_invite_codes_state::State,
189{
190 pub fn build(self) -> GetInviteCodes<S> {
192 GetInviteCodes {
193 cursor: self._fields.0,
194 limit: self._fields.1,
195 sort: self._fields.2,
196 }
197 }
198}