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 bon::Builder
16)]
17#[builder(start_fn = new)]
18#[serde(rename_all = "camelCase")]
19pub struct GetAccountInviteCodes {
20 ///(default: true)
21 #[serde(skip_serializing_if = "std::option::Option::is_none")]
22 pub create_available: std::option::Option<bool>,
23 ///(default: true)
24 #[serde(skip_serializing_if = "std::option::Option::is_none")]
25 pub include_used: std::option::Option<bool>,
26}
27
28impl jacquard_common::IntoStatic for GetAccountInviteCodes {
29 type Output = GetAccountInviteCodes;
30 fn into_static(self) -> Self::Output {
31 self
32 }
33}
34
35#[jacquard_derive::lexicon]
36#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
37#[serde(rename_all = "camelCase")]
38pub struct GetAccountInviteCodesOutput<'a> {
39 #[serde(borrow)]
40 pub codes: Vec<crate::com_atproto::server::InviteCode<'a>>,
41}
42
43impl jacquard_common::IntoStatic for GetAccountInviteCodesOutput<'_> {
44 type Output = GetAccountInviteCodesOutput<'static>;
45 fn into_static(self) -> Self::Output {
46 GetAccountInviteCodesOutput {
47 codes: self.codes.into_static(),
48 extra_data: self.extra_data.into_static(),
49 }
50 }
51}
52
53#[jacquard_derive::open_union]
54#[derive(
55 serde::Serialize,
56 serde::Deserialize,
57 Debug,
58 Clone,
59 PartialEq,
60 Eq,
61 thiserror::Error,
62 miette::Diagnostic
63)]
64#[serde(tag = "error", content = "message")]
65#[serde(bound(deserialize = "'de: 'a"))]
66pub enum GetAccountInviteCodesError<'a> {
67 #[serde(rename = "DuplicateCreate")]
68 DuplicateCreate(std::option::Option<String>),
69}
70
71impl std::fmt::Display for GetAccountInviteCodesError<'_> {
72 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
73 match self {
74 Self::DuplicateCreate(msg) => {
75 write!(f, "DuplicateCreate")?;
76 if let Some(msg) = msg {
77 write!(f, ": {}", msg)?;
78 }
79 Ok(())
80 }
81 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
82 }
83 }
84}
85
86impl jacquard_common::IntoStatic for GetAccountInviteCodesError<'_> {
87 type Output = GetAccountInviteCodesError<'static>;
88 fn into_static(self) -> Self::Output {
89 match self {
90 GetAccountInviteCodesError::DuplicateCreate(v) => {
91 GetAccountInviteCodesError::DuplicateCreate(v.into_static())
92 }
93 GetAccountInviteCodesError::Unknown(v) => {
94 GetAccountInviteCodesError::Unknown(v.into_static())
95 }
96 }
97 }
98}
99
100impl jacquard_common::types::xrpc::XrpcRequest for GetAccountInviteCodes {
101 const NSID: &'static str = "com.atproto.server.getAccountInviteCodes";
102 const METHOD: jacquard_common::types::xrpc::XrpcMethod = jacquard_common::types::xrpc::XrpcMethod::Query;
103 const OUTPUT_ENCODING: &'static str = "application/json";
104 type Output<'de> = GetAccountInviteCodesOutput<'de>;
105 type Err<'de> = GetAccountInviteCodesError<'de>;
106}