Skip to main content

atrium_api/app/bsky/ageassurance/
begin.rs

1// @generated - This file is generated by atrium-codegen. DO NOT EDIT.
2//!Definitions for the `app.bsky.ageassurance.begin` namespace.
3pub const NSID: &str = "app.bsky.ageassurance.begin";
4#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
5#[serde(rename_all = "camelCase")]
6pub struct InputData {
7    ///An ISO 3166-1 alpha-2 code of the user's location.
8    pub country_code: String,
9    ///The user's email address to receive Age Assurance instructions.
10    pub email: String,
11    ///The user's preferred language for communication during the Age Assurance process.
12    pub language: String,
13    ///An optional ISO 3166-2 code of the user's region or state within the country.
14    #[serde(skip_serializing_if = "core::option::Option::is_none")]
15    pub region_code: core::option::Option<String>,
16}
17pub type Input = crate::types::Object<InputData>;
18pub type Output = crate::app::bsky::ageassurance::defs::State;
19#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
20#[serde(tag = "error", content = "message")]
21pub enum Error {
22    InvalidEmail(Option<String>),
23    DidTooLong(Option<String>),
24    InvalidInitiation(Option<String>),
25    RegionNotSupported(Option<String>),
26}
27impl std::fmt::Display for Error {
28    fn fmt(&self, _f: &mut std::fmt::Formatter) -> std::fmt::Result {
29        match self {
30            Error::InvalidEmail(msg) => {
31                write!(_f, "InvalidEmail")?;
32                if let Some(msg) = msg {
33                    write!(_f, ": {msg}")?;
34                }
35            }
36            Error::DidTooLong(msg) => {
37                write!(_f, "DidTooLong")?;
38                if let Some(msg) = msg {
39                    write!(_f, ": {msg}")?;
40                }
41            }
42            Error::InvalidInitiation(msg) => {
43                write!(_f, "InvalidInitiation")?;
44                if let Some(msg) = msg {
45                    write!(_f, ": {msg}")?;
46                }
47            }
48            Error::RegionNotSupported(msg) => {
49                write!(_f, "RegionNotSupported")?;
50                if let Some(msg) = msg {
51                    write!(_f, ": {msg}")?;
52                }
53            }
54        }
55        Ok(())
56    }
57}