atproto blogging
at main 142 lines 4.4 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: app.bsky.ageassurance.begin 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 Begin<'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 Age Assurance instructions. 25 #[serde(borrow)] 26 pub email: jacquard_common::CowStr<'a>, 27 /// The user's preferred language for communication during the Age Assurance process. 28 #[serde(borrow)] 29 pub language: jacquard_common::CowStr<'a>, 30 /// An optional ISO 3166-2 code of the user's region or state within the country. 31 #[serde(skip_serializing_if = "std::option::Option::is_none")] 32 #[serde(borrow)] 33 pub region_code: std::option::Option<jacquard_common::CowStr<'a>>, 34} 35 36#[jacquard_derive::lexicon] 37#[derive( 38 serde::Serialize, 39 serde::Deserialize, 40 Debug, 41 Clone, 42 PartialEq, 43 Eq, 44 jacquard_derive::IntoStatic 45)] 46#[serde(rename_all = "camelCase")] 47pub struct BeginOutput<'a> { 48 #[serde(flatten)] 49 #[serde(borrow)] 50 pub value: crate::app_bsky::ageassurance::State<'a>, 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 jacquard_derive::IntoStatic 64)] 65#[serde(tag = "error", content = "message")] 66#[serde(bound(deserialize = "'de: 'a"))] 67pub enum BeginError<'a> { 68 #[serde(rename = "InvalidEmail")] 69 InvalidEmail(std::option::Option<jacquard_common::CowStr<'a>>), 70 #[serde(rename = "DidTooLong")] 71 DidTooLong(std::option::Option<jacquard_common::CowStr<'a>>), 72 #[serde(rename = "InvalidInitiation")] 73 InvalidInitiation(std::option::Option<jacquard_common::CowStr<'a>>), 74 #[serde(rename = "RegionNotSupported")] 75 RegionNotSupported(std::option::Option<jacquard_common::CowStr<'a>>), 76} 77 78impl core::fmt::Display for BeginError<'_> { 79 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { 80 match self { 81 Self::InvalidEmail(msg) => { 82 write!(f, "InvalidEmail")?; 83 if let Some(msg) = msg { 84 write!(f, ": {}", msg)?; 85 } 86 Ok(()) 87 } 88 Self::DidTooLong(msg) => { 89 write!(f, "DidTooLong")?; 90 if let Some(msg) = msg { 91 write!(f, ": {}", msg)?; 92 } 93 Ok(()) 94 } 95 Self::InvalidInitiation(msg) => { 96 write!(f, "InvalidInitiation")?; 97 if let Some(msg) = msg { 98 write!(f, ": {}", msg)?; 99 } 100 Ok(()) 101 } 102 Self::RegionNotSupported(msg) => { 103 write!(f, "RegionNotSupported")?; 104 if let Some(msg) = msg { 105 write!(f, ": {}", msg)?; 106 } 107 Ok(()) 108 } 109 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), 110 } 111 } 112} 113 114/// Response type for 115///app.bsky.ageassurance.begin 116pub struct BeginResponse; 117impl jacquard_common::xrpc::XrpcResp for BeginResponse { 118 const NSID: &'static str = "app.bsky.ageassurance.begin"; 119 const ENCODING: &'static str = "application/json"; 120 type Output<'de> = BeginOutput<'de>; 121 type Err<'de> = BeginError<'de>; 122} 123 124impl<'a> jacquard_common::xrpc::XrpcRequest for Begin<'a> { 125 const NSID: &'static str = "app.bsky.ageassurance.begin"; 126 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( 127 "application/json", 128 ); 129 type Response = BeginResponse; 130} 131 132/// Endpoint type for 133///app.bsky.ageassurance.begin 134pub struct BeginRequest; 135impl jacquard_common::xrpc::XrpcEndpoint for BeginRequest { 136 const PATH: &'static str = "/xrpc/app.bsky.ageassurance.begin"; 137 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( 138 "application/json", 139 ); 140 type Request<'de> = Begin<'de>; 141 type Response = BeginResponse; 142}