A better Rust ATProto crate
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: com.atproto.temp.dereferenceScope 4// 5// This file was automatically generated from Lexicon schemas. 6// Any manual changes will be overwritten on the next regeneration. 7 8#[derive( 9 serde::Serialize, 10 serde::Deserialize, 11 Debug, 12 Clone, 13 PartialEq, 14 Eq, 15 bon::Builder, 16 jacquard_derive::IntoStatic 17)] 18#[builder(start_fn = new)] 19#[serde(rename_all = "camelCase")] 20pub struct DereferenceScope<'a> { 21 #[serde(borrow)] 22 #[builder(into)] 23 pub scope: jacquard_common::CowStr<'a>, 24} 25 26#[jacquard_derive::lexicon] 27#[derive( 28 serde::Serialize, 29 serde::Deserialize, 30 Debug, 31 Clone, 32 PartialEq, 33 Eq, 34 jacquard_derive::IntoStatic 35)] 36#[serde(rename_all = "camelCase")] 37pub struct DereferenceScopeOutput<'a> { 38 ///The full oauth permission scope 39 #[serde(borrow)] 40 pub scope: jacquard_common::CowStr<'a>, 41} 42 43#[jacquard_derive::open_union] 44#[derive( 45 serde::Serialize, 46 serde::Deserialize, 47 Debug, 48 Clone, 49 PartialEq, 50 Eq, 51 thiserror::Error, 52 miette::Diagnostic, 53 jacquard_derive::IntoStatic 54)] 55#[serde(tag = "error", content = "message")] 56#[serde(bound(deserialize = "'de: 'a"))] 57pub enum DereferenceScopeError<'a> { 58 ///An invalid scope reference was provided. 59 #[serde(rename = "InvalidScopeReference")] 60 InvalidScopeReference(std::option::Option<String>), 61} 62 63impl std::fmt::Display for DereferenceScopeError<'_> { 64 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 65 match self { 66 Self::InvalidScopeReference(msg) => { 67 write!(f, "InvalidScopeReference")?; 68 if let Some(msg) = msg { 69 write!(f, ": {}", msg)?; 70 } 71 Ok(()) 72 } 73 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), 74 } 75 } 76} 77 78///Response type for 79///com.atproto.temp.dereferenceScope 80pub struct DereferenceScopeResponse; 81impl jacquard_common::xrpc::XrpcResp for DereferenceScopeResponse { 82 const NSID: &'static str = "com.atproto.temp.dereferenceScope"; 83 const ENCODING: &'static str = "application/json"; 84 type Output<'de> = DereferenceScopeOutput<'de>; 85 type Err<'de> = DereferenceScopeError<'de>; 86} 87 88impl<'a> jacquard_common::xrpc::XrpcRequest for DereferenceScope<'a> { 89 const NSID: &'static str = "com.atproto.temp.dereferenceScope"; 90 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 91 type Response = DereferenceScopeResponse; 92} 93 94///Endpoint type for 95///com.atproto.temp.dereferenceScope 96pub struct DereferenceScopeRequest; 97impl jacquard_common::xrpc::XrpcEndpoint for DereferenceScopeRequest { 98 const PATH: &'static str = "/xrpc/com.atproto.temp.dereferenceScope"; 99 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 100 type Request<'de> = DereferenceScope<'de>; 101 type Response = DereferenceScopeResponse; 102}