A better Rust ATProto crate
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: com.atproto.server.refreshSession 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)] 18#[serde(rename_all = "camelCase")] 19pub struct RefreshSessionOutput<'a> { 20 #[serde(borrow)] 21 pub access_jwt: jacquard_common::CowStr<'a>, 22 #[serde(skip_serializing_if = "std::option::Option::is_none")] 23 pub active: std::option::Option<bool>, 24 #[serde(borrow)] 25 pub did: jacquard_common::types::string::Did<'a>, 26 #[serde(skip_serializing_if = "std::option::Option::is_none")] 27 #[serde(borrow)] 28 pub did_doc: std::option::Option<jacquard_common::types::value::Data<'a>>, 29 #[serde(borrow)] 30 pub handle: jacquard_common::types::string::Handle<'a>, 31 #[serde(borrow)] 32 pub refresh_jwt: jacquard_common::CowStr<'a>, 33 /// Hosting status of the account. If not specified, then assume 'active'. 34 #[serde(skip_serializing_if = "std::option::Option::is_none")] 35 #[serde(borrow)] 36 pub status: std::option::Option<jacquard_common::CowStr<'a>>, 37} 38 39#[jacquard_derive::open_union] 40#[derive( 41 serde::Serialize, 42 serde::Deserialize, 43 Debug, 44 Clone, 45 PartialEq, 46 Eq, 47 thiserror::Error, 48 miette::Diagnostic, 49 jacquard_derive::IntoStatic 50)] 51#[serde(tag = "error", content = "message")] 52#[serde(bound(deserialize = "'de: 'a"))] 53pub enum RefreshSessionError<'a> { 54 #[serde(rename = "AccountTakedown")] 55 AccountTakedown(std::option::Option<String>), 56} 57 58impl std::fmt::Display for RefreshSessionError<'_> { 59 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 60 match self { 61 Self::AccountTakedown(msg) => { 62 write!(f, "AccountTakedown")?; 63 if let Some(msg) = msg { 64 write!(f, ": {}", msg)?; 65 } 66 Ok(()) 67 } 68 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), 69 } 70 } 71} 72 73/// XRPC request marker type 74#[derive( 75 Debug, 76 Clone, 77 Copy, 78 PartialEq, 79 Eq, 80 serde::Serialize, 81 serde::Deserialize, 82 jacquard_derive::IntoStatic 83)] 84pub struct RefreshSession; 85///Response type for 86///com.atproto.server.refreshSession 87pub struct RefreshSessionResponse; 88impl jacquard_common::xrpc::XrpcResp for RefreshSessionResponse { 89 const NSID: &'static str = "com.atproto.server.refreshSession"; 90 const ENCODING: &'static str = "application/json"; 91 type Output<'de> = RefreshSessionOutput<'de>; 92 type Err<'de> = RefreshSessionError<'de>; 93} 94 95impl jacquard_common::xrpc::XrpcRequest for RefreshSession { 96 const NSID: &'static str = "com.atproto.server.refreshSession"; 97 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( 98 "application/json", 99 ); 100 type Response = RefreshSessionResponse; 101} 102 103///Endpoint type for 104///com.atproto.server.refreshSession 105pub struct RefreshSessionRequest; 106impl jacquard_common::xrpc::XrpcEndpoint for RefreshSessionRequest { 107 const PATH: &'static str = "/xrpc/com.atproto.server.refreshSession"; 108 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure( 109 "application/json", 110 ); 111 type Request<'de> = RefreshSession; 112 type Response = RefreshSessionResponse; 113}