atproto blogging
1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: com.atproto.admin.getInviteCodes
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 GetInviteCodes<'a> {
19 #[serde(skip_serializing_if = "std::option::Option::is_none")]
20 #[serde(borrow)]
21 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>,
22 ///(default: 100, min: 1, max: 500)
23 #[serde(skip_serializing_if = "std::option::Option::is_none")]
24 pub limit: std::option::Option<i64>,
25 ///(default: "recent")
26 #[serde(skip_serializing_if = "std::option::Option::is_none")]
27 #[serde(borrow)]
28 pub sort: std::option::Option<jacquard_common::CowStr<'a>>,
29}
30
31pub mod get_invite_codes_state {
32
33 pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
34 #[allow(unused)]
35 use ::core::marker::PhantomData;
36 mod sealed {
37 pub trait Sealed {}
38 }
39 /// State trait tracking which required fields have been set
40 pub trait State: sealed::Sealed {}
41 /// Empty state - all required fields are unset
42 pub struct Empty(());
43 impl sealed::Sealed for Empty {}
44 impl State for Empty {}
45 /// Marker types for field names
46 #[allow(non_camel_case_types)]
47 pub mod members {}
48}
49
50/// Builder for constructing an instance of this type
51pub struct GetInviteCodesBuilder<'a, S: get_invite_codes_state::State> {
52 _phantom_state: ::core::marker::PhantomData<fn() -> S>,
53 __unsafe_private_named: (
54 ::core::option::Option<jacquard_common::CowStr<'a>>,
55 ::core::option::Option<i64>,
56 ::core::option::Option<jacquard_common::CowStr<'a>>,
57 ),
58 _phantom: ::core::marker::PhantomData<&'a ()>,
59}
60
61impl<'a> GetInviteCodes<'a> {
62 /// Create a new builder for this type
63 pub fn new() -> GetInviteCodesBuilder<'a, get_invite_codes_state::Empty> {
64 GetInviteCodesBuilder::new()
65 }
66}
67
68impl<'a> GetInviteCodesBuilder<'a, get_invite_codes_state::Empty> {
69 /// Create a new builder with all fields unset
70 pub fn new() -> Self {
71 GetInviteCodesBuilder {
72 _phantom_state: ::core::marker::PhantomData,
73 __unsafe_private_named: (None, None, None),
74 _phantom: ::core::marker::PhantomData,
75 }
76 }
77}
78
79impl<'a, S: get_invite_codes_state::State> GetInviteCodesBuilder<'a, S> {
80 /// Set the `cursor` field (optional)
81 pub fn cursor(
82 mut self,
83 value: impl Into<Option<jacquard_common::CowStr<'a>>>,
84 ) -> Self {
85 self.__unsafe_private_named.0 = value.into();
86 self
87 }
88 /// Set the `cursor` field to an Option value (optional)
89 pub fn maybe_cursor(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
90 self.__unsafe_private_named.0 = value;
91 self
92 }
93}
94
95impl<'a, S: get_invite_codes_state::State> GetInviteCodesBuilder<'a, S> {
96 /// Set the `limit` field (optional)
97 pub fn limit(mut self, value: impl Into<Option<i64>>) -> Self {
98 self.__unsafe_private_named.1 = value.into();
99 self
100 }
101 /// Set the `limit` field to an Option value (optional)
102 pub fn maybe_limit(mut self, value: Option<i64>) -> Self {
103 self.__unsafe_private_named.1 = value;
104 self
105 }
106}
107
108impl<'a, S: get_invite_codes_state::State> GetInviteCodesBuilder<'a, S> {
109 /// Set the `sort` field (optional)
110 pub fn sort(
111 mut self,
112 value: impl Into<Option<jacquard_common::CowStr<'a>>>,
113 ) -> Self {
114 self.__unsafe_private_named.2 = value.into();
115 self
116 }
117 /// Set the `sort` field to an Option value (optional)
118 pub fn maybe_sort(mut self, value: Option<jacquard_common::CowStr<'a>>) -> Self {
119 self.__unsafe_private_named.2 = value;
120 self
121 }
122}
123
124impl<'a, S> GetInviteCodesBuilder<'a, S>
125where
126 S: get_invite_codes_state::State,
127{
128 /// Build the final struct
129 pub fn build(self) -> GetInviteCodes<'a> {
130 GetInviteCodes {
131 cursor: self.__unsafe_private_named.0,
132 limit: self.__unsafe_private_named.1,
133 sort: self.__unsafe_private_named.2,
134 }
135 }
136}
137
138#[jacquard_derive::lexicon]
139#[derive(
140 serde::Serialize,
141 serde::Deserialize,
142 Debug,
143 Clone,
144 PartialEq,
145 Eq,
146 jacquard_derive::IntoStatic
147)]
148#[serde(rename_all = "camelCase")]
149pub struct GetInviteCodesOutput<'a> {
150 #[serde(borrow)]
151 pub codes: Vec<crate::com_atproto::server::InviteCode<'a>>,
152 #[serde(skip_serializing_if = "std::option::Option::is_none")]
153 #[serde(borrow)]
154 pub cursor: std::option::Option<jacquard_common::CowStr<'a>>,
155}
156
157/// Response type for
158///com.atproto.admin.getInviteCodes
159pub struct GetInviteCodesResponse;
160impl jacquard_common::xrpc::XrpcResp for GetInviteCodesResponse {
161 const NSID: &'static str = "com.atproto.admin.getInviteCodes";
162 const ENCODING: &'static str = "application/json";
163 type Output<'de> = GetInviteCodesOutput<'de>;
164 type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
165}
166
167impl<'a> jacquard_common::xrpc::XrpcRequest for GetInviteCodes<'a> {
168 const NSID: &'static str = "com.atproto.admin.getInviteCodes";
169 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
170 type Response = GetInviteCodesResponse;
171}
172
173/// Endpoint type for
174///com.atproto.admin.getInviteCodes
175pub struct GetInviteCodesRequest;
176impl jacquard_common::xrpc::XrpcEndpoint for GetInviteCodesRequest {
177 const PATH: &'static str = "/xrpc/com.atproto.admin.getInviteCodes";
178 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
179 type Request<'de> = GetInviteCodes<'de>;
180 type Response = GetInviteCodesResponse;
181}