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