atproto blogging
1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: app.bsky.unspecced.initAgeAssurance
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[jacquard_derive::lexicon]
9#[derive(
10 serde::Serialize,
11 serde::Deserialize,
12 Debug,
13 Clone,
14 PartialEq,
15 Eq,
16 jacquard_derive::IntoStatic,
17 Default
18)]
19#[serde(rename_all = "camelCase")]
20pub struct InitAgeAssurance<'a> {
21 /// An ISO 3166-1 alpha-2 code of the user's location.
22 #[serde(borrow)]
23 pub country_code: jacquard_common::CowStr<'a>,
24 /// The user's email address to receive assurance instructions.
25 #[serde(borrow)]
26 pub email: jacquard_common::CowStr<'a>,
27 /// The user's preferred language for communication during the assurance process.
28 #[serde(borrow)]
29 pub language: jacquard_common::CowStr<'a>,
30}
31
32#[jacquard_derive::lexicon]
33#[derive(
34 serde::Serialize,
35 serde::Deserialize,
36 Debug,
37 Clone,
38 PartialEq,
39 Eq,
40 jacquard_derive::IntoStatic
41)]
42#[serde(rename_all = "camelCase")]
43pub struct InitAgeAssuranceOutput<'a> {
44 #[serde(flatten)]
45 #[serde(borrow)]
46 pub value: crate::app_bsky::unspecced::AgeAssuranceState<'a>,
47}
48
49#[jacquard_derive::open_union]
50#[derive(
51 serde::Serialize,
52 serde::Deserialize,
53 Debug,
54 Clone,
55 PartialEq,
56 Eq,
57 thiserror::Error,
58 miette::Diagnostic,
59 jacquard_derive::IntoStatic
60)]
61#[serde(tag = "error", content = "message")]
62#[serde(bound(deserialize = "'de: 'a"))]
63pub enum InitAgeAssuranceError<'a> {
64 #[serde(rename = "InvalidEmail")]
65 InvalidEmail(std::option::Option<jacquard_common::CowStr<'a>>),
66 #[serde(rename = "DidTooLong")]
67 DidTooLong(std::option::Option<jacquard_common::CowStr<'a>>),
68 #[serde(rename = "InvalidInitiation")]
69 InvalidInitiation(std::option::Option<jacquard_common::CowStr<'a>>),
70}
71
72impl core::fmt::Display for InitAgeAssuranceError<'_> {
73 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
74 match self {
75 Self::InvalidEmail(msg) => {
76 write!(f, "InvalidEmail")?;
77 if let Some(msg) = msg {
78 write!(f, ": {}", msg)?;
79 }
80 Ok(())
81 }
82 Self::DidTooLong(msg) => {
83 write!(f, "DidTooLong")?;
84 if let Some(msg) = msg {
85 write!(f, ": {}", msg)?;
86 }
87 Ok(())
88 }
89 Self::InvalidInitiation(msg) => {
90 write!(f, "InvalidInitiation")?;
91 if let Some(msg) = msg {
92 write!(f, ": {}", msg)?;
93 }
94 Ok(())
95 }
96 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
97 }
98 }
99}
100
101/// Response type for
102///app.bsky.unspecced.initAgeAssurance
103pub struct InitAgeAssuranceResponse;
104impl jacquard_common::xrpc::XrpcResp for InitAgeAssuranceResponse {
105 const NSID: &'static str = "app.bsky.unspecced.initAgeAssurance";
106 const ENCODING: &'static str = "application/json";
107 type Output<'de> = InitAgeAssuranceOutput<'de>;
108 type Err<'de> = InitAgeAssuranceError<'de>;
109}
110
111impl<'a> jacquard_common::xrpc::XrpcRequest for InitAgeAssurance<'a> {
112 const NSID: &'static str = "app.bsky.unspecced.initAgeAssurance";
113 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
114 "application/json",
115 );
116 type Response = InitAgeAssuranceResponse;
117}
118
119/// Endpoint type for
120///app.bsky.unspecced.initAgeAssurance
121pub struct InitAgeAssuranceRequest;
122impl jacquard_common::xrpc::XrpcEndpoint for InitAgeAssuranceRequest {
123 const PATH: &'static str = "/xrpc/app.bsky.unspecced.initAgeAssurance";
124 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
125 "application/json",
126 );
127 type Request<'de> = InitAgeAssurance<'de>;
128 type Response = InitAgeAssuranceResponse;
129}