atrium_api/com/atproto/server/
create_session.rs

1// @generated - This file is generated by atrium-codegen. DO NOT EDIT.
2//!Definitions for the `com.atproto.server.createSession` namespace.
3pub const NSID: &str = "com.atproto.server.createSession";
4#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
5#[serde(rename_all = "camelCase")]
6pub struct InputData {
7    ///When true, instead of throwing error for takendown accounts, a valid response with a narrow scoped token will be returned
8    #[serde(skip_serializing_if = "core::option::Option::is_none")]
9    pub allow_takendown: core::option::Option<bool>,
10    #[serde(skip_serializing_if = "core::option::Option::is_none")]
11    pub auth_factor_token: core::option::Option<String>,
12    ///Handle or other identifier supported by the server for the authenticating user.
13    pub identifier: String,
14    pub password: String,
15}
16pub type Input = crate::types::Object<InputData>;
17#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
18#[serde(rename_all = "camelCase")]
19pub struct OutputData {
20    pub access_jwt: String,
21    #[serde(skip_serializing_if = "core::option::Option::is_none")]
22    pub active: core::option::Option<bool>,
23    pub did: crate::types::string::Did,
24    #[serde(skip_serializing_if = "core::option::Option::is_none")]
25    pub did_doc: core::option::Option<crate::types::Unknown>,
26    #[serde(skip_serializing_if = "core::option::Option::is_none")]
27    pub email: core::option::Option<String>,
28    #[serde(skip_serializing_if = "core::option::Option::is_none")]
29    pub email_auth_factor: core::option::Option<bool>,
30    #[serde(skip_serializing_if = "core::option::Option::is_none")]
31    pub email_confirmed: core::option::Option<bool>,
32    pub handle: crate::types::string::Handle,
33    pub refresh_jwt: String,
34    ///If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted.
35    #[serde(skip_serializing_if = "core::option::Option::is_none")]
36    pub status: core::option::Option<String>,
37}
38pub type Output = crate::types::Object<OutputData>;
39#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
40#[serde(tag = "error", content = "message")]
41pub enum Error {
42    AccountTakedown(Option<String>),
43    AuthFactorTokenRequired(Option<String>),
44}
45impl std::fmt::Display for Error {
46    fn fmt(&self, _f: &mut std::fmt::Formatter) -> std::fmt::Result {
47        match self {
48            Error::AccountTakedown(msg) => {
49                write!(_f, "AccountTakedown")?;
50                if let Some(msg) = msg {
51                    write!(_f, ": {msg}")?;
52                }
53            }
54            Error::AuthFactorTokenRequired(msg) => {
55                write!(_f, "AuthFactorTokenRequired")?;
56                if let Some(msg) = msg {
57                    write!(_f, ": {msg}")?;
58                }
59            }
60        }
61        Ok(())
62    }
63}