A better Rust ATProto crate
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: sh.tangled.repo.compare 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 Compare<'a> { 21 #[serde(borrow)] 22 #[builder(into)] 23 pub repo: jacquard_common::CowStr<'a>, 24 #[serde(borrow)] 25 #[builder(into)] 26 pub rev1: jacquard_common::CowStr<'a>, 27 #[serde(borrow)] 28 #[builder(into)] 29 pub rev2: jacquard_common::CowStr<'a>, 30} 31 32/// Compare output in application/json 33#[jacquard_derive::lexicon] 34#[derive( 35 serde::Serialize, 36 serde::Deserialize, 37 Debug, 38 Clone, 39 PartialEq, 40 Eq, 41 jacquard_derive::IntoStatic 42)] 43#[serde(rename_all = "camelCase")] 44pub struct CompareOutput<'a> {} 45#[jacquard_derive::open_union] 46#[derive( 47 serde::Serialize, 48 serde::Deserialize, 49 Debug, 50 Clone, 51 PartialEq, 52 Eq, 53 thiserror::Error, 54 miette::Diagnostic, 55 jacquard_derive::IntoStatic 56)] 57#[serde(tag = "error", content = "message")] 58#[serde(bound(deserialize = "'de: 'a"))] 59pub enum CompareError<'a> { 60 /// Repository not found or access denied 61 #[serde(rename = "RepoNotFound")] 62 RepoNotFound(std::option::Option<String>), 63 /// One or both revisions not found 64 #[serde(rename = "RevisionNotFound")] 65 RevisionNotFound(std::option::Option<String>), 66 /// Invalid request parameters 67 #[serde(rename = "InvalidRequest")] 68 InvalidRequest(std::option::Option<String>), 69 /// Failed to compare revisions 70 #[serde(rename = "CompareError")] 71 CompareError(std::option::Option<String>), 72} 73 74impl std::fmt::Display for CompareError<'_> { 75 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 76 match self { 77 Self::RepoNotFound(msg) => { 78 write!(f, "RepoNotFound")?; 79 if let Some(msg) = msg { 80 write!(f, ": {}", msg)?; 81 } 82 Ok(()) 83 } 84 Self::RevisionNotFound(msg) => { 85 write!(f, "RevisionNotFound")?; 86 if let Some(msg) = msg { 87 write!(f, ": {}", msg)?; 88 } 89 Ok(()) 90 } 91 Self::InvalidRequest(msg) => { 92 write!(f, "InvalidRequest")?; 93 if let Some(msg) = msg { 94 write!(f, ": {}", msg)?; 95 } 96 Ok(()) 97 } 98 Self::CompareError(msg) => { 99 write!(f, "CompareError")?; 100 if let Some(msg) = msg { 101 write!(f, ": {}", msg)?; 102 } 103 Ok(()) 104 } 105 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), 106 } 107 } 108} 109 110///Response type for 111///sh.tangled.repo.compare 112pub struct CompareResponse; 113impl jacquard_common::xrpc::XrpcResp for CompareResponse { 114 const NSID: &'static str = "sh.tangled.repo.compare"; 115 const ENCODING: &'static str = "*/*"; 116 type Output<'de> = CompareOutput<'de>; 117 type Err<'de> = CompareError<'de>; 118} 119 120impl<'a> jacquard_common::xrpc::XrpcRequest for Compare<'a> { 121 const NSID: &'static str = "sh.tangled.repo.compare"; 122 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 123 type Response = CompareResponse; 124} 125 126///Endpoint type for 127///sh.tangled.repo.compare 128pub struct CompareRequest; 129impl jacquard_common::xrpc::XrpcEndpoint for CompareRequest { 130 const PATH: &'static str = "/xrpc/sh.tangled.repo.compare"; 131 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 132 type Request<'de> = Compare<'de>; 133 type Response = CompareResponse; 134}