A better Rust ATProto crate
at oauth 4.6 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: com.atproto.identity.refreshIdentity 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 bon::Builder 17)] 18#[serde(rename_all = "camelCase")] 19#[builder(start_fn = new)] 20pub struct RefreshIdentity<'a> { 21 #[serde(borrow)] 22 pub identifier: jacquard_common::types::ident::AtIdentifier<'a>, 23 #[serde(flatten)] 24 #[serde(borrow)] 25 #[builder(default)] 26 pub extra_data: ::std::collections::BTreeMap< 27 ::jacquard_common::smol_str::SmolStr, 28 ::jacquard_common::types::value::Data<'a>, 29 >, 30} 31 32impl jacquard_common::IntoStatic for RefreshIdentity<'_> { 33 type Output = RefreshIdentity<'static>; 34 fn into_static(self) -> Self::Output { 35 RefreshIdentity { 36 identifier: self.identifier.into_static(), 37 extra_data: self.extra_data.into_static(), 38 } 39 } 40} 41 42#[jacquard_derive::lexicon] 43#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)] 44#[serde(rename_all = "camelCase")] 45pub struct RefreshIdentityOutput<'a> { 46 #[serde(flatten)] 47 #[serde(borrow)] 48 pub value: crate::com_atproto::identity::IdentityInfo<'a>, 49} 50 51impl jacquard_common::IntoStatic for RefreshIdentityOutput<'_> { 52 type Output = RefreshIdentityOutput<'static>; 53 fn into_static(self) -> Self::Output { 54 RefreshIdentityOutput { 55 value: self.value.into_static(), 56 extra_data: self.extra_data.into_static(), 57 } 58 } 59} 60 61#[jacquard_derive::open_union] 62#[derive( 63 serde::Serialize, 64 serde::Deserialize, 65 Debug, 66 Clone, 67 PartialEq, 68 Eq, 69 thiserror::Error, 70 miette::Diagnostic 71)] 72#[serde(tag = "error", content = "message")] 73#[serde(bound(deserialize = "'de: 'a"))] 74pub enum RefreshIdentityError<'a> { 75 ///The resolution process confirmed that the handle does not resolve to any DID. 76 #[serde(rename = "HandleNotFound")] 77 HandleNotFound(std::option::Option<String>), 78 ///The DID resolution process confirmed that there is no current DID. 79 #[serde(rename = "DidNotFound")] 80 DidNotFound(std::option::Option<String>), 81 ///The DID previously existed, but has been deactivated. 82 #[serde(rename = "DidDeactivated")] 83 DidDeactivated(std::option::Option<String>), 84} 85 86impl std::fmt::Display for RefreshIdentityError<'_> { 87 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 88 match self { 89 Self::HandleNotFound(msg) => { 90 write!(f, "HandleNotFound")?; 91 if let Some(msg) = msg { 92 write!(f, ": {}", msg)?; 93 } 94 Ok(()) 95 } 96 Self::DidNotFound(msg) => { 97 write!(f, "DidNotFound")?; 98 if let Some(msg) = msg { 99 write!(f, ": {}", msg)?; 100 } 101 Ok(()) 102 } 103 Self::DidDeactivated(msg) => { 104 write!(f, "DidDeactivated")?; 105 if let Some(msg) = msg { 106 write!(f, ": {}", msg)?; 107 } 108 Ok(()) 109 } 110 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), 111 } 112 } 113} 114 115impl jacquard_common::IntoStatic for RefreshIdentityError<'_> { 116 type Output = RefreshIdentityError<'static>; 117 fn into_static(self) -> Self::Output { 118 match self { 119 RefreshIdentityError::HandleNotFound(v) => { 120 RefreshIdentityError::HandleNotFound(v.into_static()) 121 } 122 RefreshIdentityError::DidNotFound(v) => { 123 RefreshIdentityError::DidNotFound(v.into_static()) 124 } 125 RefreshIdentityError::DidDeactivated(v) => { 126 RefreshIdentityError::DidDeactivated(v.into_static()) 127 } 128 RefreshIdentityError::Unknown(v) => { 129 RefreshIdentityError::Unknown(v.into_static()) 130 } 131 } 132 } 133} 134 135impl jacquard_common::types::xrpc::XrpcRequest for RefreshIdentity<'_> { 136 const NSID: &'static str = "com.atproto.identity.refreshIdentity"; 137 const METHOD: jacquard_common::types::xrpc::XrpcMethod = jacquard_common::types::xrpc::XrpcMethod::Procedure( 138 "application/json", 139 ); 140 const OUTPUT_ENCODING: &'static str = "application/json"; 141 type Output<'de> = RefreshIdentityOutput<'de>; 142 type Err<'de> = RefreshIdentityError<'de>; 143}