atrium_api/com/atproto/temp/
check_handle_availability.rs

1// @generated - This file is generated by atrium-codegen. DO NOT EDIT.
2//!Definitions for the `com.atproto.temp.checkHandleAvailability` namespace.
3pub const NSID: &str = "com.atproto.temp.checkHandleAvailability";
4#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
5#[serde(rename_all = "camelCase")]
6pub struct ParametersData {
7    ///User-provided birth date. Might be used to build handle suggestions.
8    #[serde(skip_serializing_if = "core::option::Option::is_none")]
9    pub birth_date: core::option::Option<crate::types::string::Datetime>,
10    ///User-provided email. Might be used to build handle suggestions.
11    #[serde(skip_serializing_if = "core::option::Option::is_none")]
12    pub email: core::option::Option<String>,
13    ///Tentative handle. Will be checked for availability or used to build handle suggestions.
14    pub handle: crate::types::string::Handle,
15}
16pub type Parameters = crate::types::Object<ParametersData>;
17#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
18#[serde(rename_all = "camelCase")]
19pub struct OutputData {
20    ///Echo of the input handle.
21    pub handle: crate::types::string::Handle,
22    pub result: crate::types::Union<OutputResultRefs>,
23}
24pub type Output = crate::types::Object<OutputData>;
25#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
26#[serde(tag = "error", content = "message")]
27pub enum Error {
28    ///An invalid email was provided.
29    InvalidEmail(Option<String>),
30}
31impl std::fmt::Display for Error {
32    fn fmt(&self, _f: &mut std::fmt::Formatter) -> std::fmt::Result {
33        match self {
34            Error::InvalidEmail(msg) => {
35                write!(_f, "InvalidEmail")?;
36                if let Some(msg) = msg {
37                    write!(_f, ": {msg}")?;
38                }
39            }
40        }
41        Ok(())
42    }
43}
44///Indicates the provided handle is available.
45#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
46#[serde(rename_all = "camelCase")]
47pub struct ResultAvailableData {}
48pub type ResultAvailable = crate::types::Object<ResultAvailableData>;
49///Indicates the provided handle is unavailable and gives suggestions of available handles.
50#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
51#[serde(rename_all = "camelCase")]
52pub struct ResultUnavailableData {
53    ///List of suggested handles based on the provided inputs.
54    pub suggestions: Vec<Suggestion>,
55}
56pub type ResultUnavailable = crate::types::Object<ResultUnavailableData>;
57#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
58#[serde(rename_all = "camelCase")]
59pub struct SuggestionData {
60    pub handle: crate::types::string::Handle,
61    ///Method used to build this suggestion. Should be considered opaque to clients. Can be used for metrics.
62    pub method: String,
63}
64pub type Suggestion = crate::types::Object<SuggestionData>;
65#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
66#[serde(tag = "$type")]
67pub enum OutputResultRefs {
68    #[serde(rename = "com.atproto.temp.checkHandleAvailability#resultAvailable")]
69    ResultAvailable(Box<ResultAvailable>),
70    #[serde(rename = "com.atproto.temp.checkHandleAvailability#resultUnavailable")]
71    ResultUnavailable(Box<ResultUnavailable>),
72}