Something went wrong. Try again.
atproto Thingiverse but good
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232// @generated by jacquard-lexicon. DO NOT EDIT.//// Lexicon: com.atproto.server.refreshSession//// This file was automatically generated from Lexicon schemas.// Any manual changes will be overwritten on the next regeneration.
#[allow(unused_imports)]use alloc::collections::BTreeMap;
#[allow(unused_imports)]use core::marker::PhantomData;use jacquard_common::{CowStr, BosStr, DefaultStr, FromStaticStr};use jacquard_common::deps::smol_str::SmolStr;use jacquard_common::types::string::{Did, Handle};use jacquard_common::types::value::Data;use jacquard_derive::{IntoStatic, open_union};use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]#[serde(rename_all = "camelCase", bound(deserialize = "S: Deserialize<'de> + BosStr"))]pub struct RefreshSessionOutput<S: BosStr = DefaultStr> { pub access_jwt: S, #[serde(skip_serializing_if = "Option::is_none")] pub active: Option<bool>, pub did: Did<S>, #[serde(skip_serializing_if = "Option::is_none")] pub did_doc: Option<Data<S>>, #[serde(skip_serializing_if = "Option::is_none")] pub email: Option<S>, #[serde(skip_serializing_if = "Option::is_none")] pub email_auth_factor: Option<bool>, #[serde(skip_serializing_if = "Option::is_none")] pub email_confirmed: Option<bool>, pub handle: Handle<S>, pub refresh_jwt: S, ///Hosting status of the account. If not specified, then assume 'active'. #[serde(skip_serializing_if = "Option::is_none")] pub status: Option<RefreshSessionOutputStatus<S>>, #[serde(flatten, default, skip_serializing_if = "Option::is_none")] pub extra_data: Option<BTreeMap<SmolStr, Data<S>>>,}
/// Hosting status of the account. If not specified, then assume 'active'.
#[derive(Debug, Clone, PartialEq, Eq, Hash)]pub enum RefreshSessionOutputStatus<S: BosStr = DefaultStr> { Takendown, Suspended, Deactivated, Other(S),}
impl<S: BosStr> RefreshSessionOutputStatus<S> { pub fn as_str(&self) -> &str { match self { Self::Takendown => "takendown", Self::Suspended => "suspended", Self::Deactivated => "deactivated", Self::Other(s) => s.as_ref(), } } /// Construct from a string-like value, matching known values. pub fn from_value(s: S) -> Self { match s.as_ref() { "takendown" => Self::Takendown, "suspended" => Self::Suspended, "deactivated" => Self::Deactivated, _ => Self::Other(s), } }}
impl<S: BosStr> core::fmt::Display for RefreshSessionOutputStatus<S> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "{}", self.as_str()) }}
impl<S: BosStr> AsRef<str> for RefreshSessionOutputStatus<S> { fn as_ref(&self) -> &str { self.as_str() }}
impl<S: BosStr> Serialize for RefreshSessionOutputStatus<S> { fn serialize<Ser>(&self, serializer: Ser) -> Result<Ser::Ok, Ser::Error> where Ser: serde::Serializer, { serializer.serialize_str(self.as_str()) }}
impl<'de, S: Deserialize<'de> + BosStr> Deserialize<'de>for RefreshSessionOutputStatus<S> { fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: serde::Deserializer<'de>, { let s = S::deserialize(deserializer)?; Ok(Self::from_value(s)) }}
impl<S: BosStr + Default> Default for RefreshSessionOutputStatus<S> { fn default() -> Self { Self::Other(Default::default()) }}
impl<S: BosStr> jacquard_common::IntoStatic for RefreshSessionOutputStatus<S>where S: BosStr + jacquard_common::IntoStatic, S::Output: BosStr,{ type Output = RefreshSessionOutputStatus<S::Output>; fn into_static(self) -> Self::Output { match self { RefreshSessionOutputStatus::Takendown => { RefreshSessionOutputStatus::Takendown } RefreshSessionOutputStatus::Suspended => { RefreshSessionOutputStatus::Suspended } RefreshSessionOutputStatus::Deactivated => { RefreshSessionOutputStatus::Deactivated } RefreshSessionOutputStatus::Other(v) => { RefreshSessionOutputStatus::Other(v.into_static()) } } }}
#[derive( Serialize, Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic)]
#[serde(tag = "error", content = "message")]pub enum RefreshSessionError { #[serde(rename = "AccountTakedown")] AccountTakedown(Option<SmolStr>), #[serde(rename = "InvalidToken")] InvalidToken(Option<SmolStr>), #[serde(rename = "ExpiredToken")] ExpiredToken(Option<SmolStr>), /// Catch-all for unknown error codes. #[serde(untagged)] Other { error: SmolStr, message: Option<SmolStr> },}
impl core::fmt::Display for RefreshSessionError { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { match self { Self::AccountTakedown(msg) => { write!(f, "AccountTakedown")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::InvalidToken(msg) => { write!(f, "InvalidToken")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::ExpiredToken(msg) => { write!(f, "ExpiredToken")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::Other { error, message } => { write!(f, "{}", error)?; if let Some(msg) = message { write!(f, ": {}", msg)?; } Ok(()) } } }}
/** Request marker for the `com.atproto.server.refreshSession` procedure.
This endpoint has no request parameters or input body; send this marker with `jacquard::Client`.*/
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Copy)]pub struct RefreshSession;/** Response marker for the `com.atproto.server.refreshSession` procedure.
Implements `jacquard_common::xrpc::XrpcResp`; successful bodies decode as `Self::Output<S>`, which is `RefreshSessionOutput<S>` for this endpoint.*/pub struct RefreshSessionResponse;impl jacquard_common::xrpc::XrpcResp for RefreshSessionResponse { const NSID: &'static str = "com.atproto.server.refreshSession"; const ENCODING: &'static str = "application/json"; type Output<S: BosStr> = RefreshSessionOutput<S>; type Err = RefreshSessionError;}
impl jacquard_common::xrpc::XrpcRequest for RefreshSession { const NSID: &'static str = "com.atproto.server.refreshSession"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( "application/json", ); type Response = RefreshSessionResponse;}
/** Endpoint marker for the `com.atproto.server.refreshSession` procedure.
Path: `/xrpc/com.atproto.server.refreshSession`. The request payload type is `RefreshSession`; use this marker with lower-level `XrpcEndpoint` APIs when you need endpoint metadata.*/pub struct RefreshSessionRequest;impl jacquard_common::xrpc::XrpcEndpoint for RefreshSessionRequest { const PATH: &'static str = "/xrpc/com.atproto.server.refreshSession"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( "application/json", ); type Request<S: BosStr> = RefreshSession; type Response = RefreshSessionResponse;}