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