A better Rust ATProto crate
at main 2.5 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: sh.tangled.owner 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 OwnerOutput<'a> { 20 #[serde(borrow)] 21 pub owner: jacquard_common::types::string::Did<'a>, 22} 23 24#[jacquard_derive::open_union] 25#[derive( 26 serde::Serialize, 27 serde::Deserialize, 28 Debug, 29 Clone, 30 PartialEq, 31 Eq, 32 thiserror::Error, 33 miette::Diagnostic, 34 jacquard_derive::IntoStatic 35)] 36#[serde(tag = "error", content = "message")] 37#[serde(bound(deserialize = "'de: 'a"))] 38pub enum OwnerError<'a> { 39 /// Owner is not set for this service 40 #[serde(rename = "OwnerNotFound")] 41 OwnerNotFound(std::option::Option<String>), 42} 43 44impl std::fmt::Display for OwnerError<'_> { 45 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 46 match self { 47 Self::OwnerNotFound(msg) => { 48 write!(f, "OwnerNotFound")?; 49 if let Some(msg) = msg { 50 write!(f, ": {}", msg)?; 51 } 52 Ok(()) 53 } 54 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), 55 } 56 } 57} 58 59/// XRPC request marker type 60#[derive( 61 Debug, 62 Clone, 63 Copy, 64 PartialEq, 65 Eq, 66 serde::Serialize, 67 serde::Deserialize, 68 jacquard_derive::IntoStatic 69)] 70pub struct Owner; 71///Response type for 72///sh.tangled.owner 73pub struct OwnerResponse; 74impl jacquard_common::xrpc::XrpcResp for OwnerResponse { 75 const NSID: &'static str = "sh.tangled.owner"; 76 const ENCODING: &'static str = "application/json"; 77 type Output<'de> = OwnerOutput<'de>; 78 type Err<'de> = OwnerError<'de>; 79} 80 81impl jacquard_common::xrpc::XrpcRequest for Owner { 82 const NSID: &'static str = "sh.tangled.owner"; 83 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 84 type Response = OwnerResponse; 85} 86 87///Endpoint type for 88///sh.tangled.owner 89pub struct OwnerRequest; 90impl jacquard_common::xrpc::XrpcEndpoint for OwnerRequest { 91 const PATH: &'static str = "/xrpc/sh.tangled.owner"; 92 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 93 type Request<'de> = Owner; 94 type Response = OwnerResponse; 95}