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