A better Rust ATProto crate
at main 5.2 kB view raw
1// @generated by jacquard-lexicon. DO NOT EDIT. 2// 3// Lexicon: sh.tangled.repo.languages 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 bon::Builder 18)] 19#[serde(rename_all = "camelCase")] 20pub struct Language<'a> { 21 /// Hex color code for this language 22 #[serde(skip_serializing_if = "std::option::Option::is_none")] 23 #[builder(into)] 24 #[serde(borrow)] 25 pub color: Option<jacquard_common::CowStr<'a>>, 26 /// File extensions associated with this language 27 #[serde(skip_serializing_if = "std::option::Option::is_none")] 28 #[builder(into)] 29 #[serde(borrow)] 30 pub extensions: Option<Vec<jacquard_common::CowStr<'a>>>, 31 /// Number of files in this language 32 #[serde(skip_serializing_if = "std::option::Option::is_none")] 33 #[builder(into)] 34 pub file_count: Option<i64>, 35 /// Programming language name 36 #[serde(borrow)] 37 #[builder(into)] 38 pub name: jacquard_common::CowStr<'a>, 39 /// Percentage of total codebase (0-100) 40 pub percentage: i64, 41 /// Total size of files in this language (bytes) 42 pub size: i64, 43} 44 45#[derive( 46 serde::Serialize, 47 serde::Deserialize, 48 Debug, 49 Clone, 50 PartialEq, 51 Eq, 52 bon::Builder, 53 jacquard_derive::IntoStatic 54)] 55#[builder(start_fn = new)] 56#[serde(rename_all = "camelCase")] 57pub struct Languages<'a> { 58 ///(default: "HEAD") 59 #[serde(skip_serializing_if = "std::option::Option::is_none")] 60 #[serde(borrow)] 61 #[builder(into)] 62 pub r#ref: std::option::Option<jacquard_common::CowStr<'a>>, 63 #[serde(borrow)] 64 #[builder(into)] 65 pub repo: jacquard_common::CowStr<'a>, 66} 67 68#[jacquard_derive::lexicon] 69#[derive( 70 serde::Serialize, 71 serde::Deserialize, 72 Debug, 73 Clone, 74 PartialEq, 75 Eq, 76 jacquard_derive::IntoStatic 77)] 78#[serde(rename_all = "camelCase")] 79pub struct LanguagesOutput<'a> { 80 #[serde(borrow)] 81 pub languages: Vec<jacquard_common::types::value::Data<'a>>, 82 /// The git reference used 83 #[serde(borrow)] 84 pub r#ref: jacquard_common::CowStr<'a>, 85 /// Total number of files analyzed 86 #[serde(skip_serializing_if = "std::option::Option::is_none")] 87 pub total_files: std::option::Option<i64>, 88 /// Total size of all analyzed files in bytes 89 #[serde(skip_serializing_if = "std::option::Option::is_none")] 90 pub total_size: std::option::Option<i64>, 91} 92 93#[jacquard_derive::open_union] 94#[derive( 95 serde::Serialize, 96 serde::Deserialize, 97 Debug, 98 Clone, 99 PartialEq, 100 Eq, 101 thiserror::Error, 102 miette::Diagnostic, 103 jacquard_derive::IntoStatic 104)] 105#[serde(tag = "error", content = "message")] 106#[serde(bound(deserialize = "'de: 'a"))] 107pub enum LanguagesError<'a> { 108 /// Repository not found or access denied 109 #[serde(rename = "RepoNotFound")] 110 RepoNotFound(std::option::Option<String>), 111 /// Git reference not found 112 #[serde(rename = "RefNotFound")] 113 RefNotFound(std::option::Option<String>), 114 /// Invalid request parameters 115 #[serde(rename = "InvalidRequest")] 116 InvalidRequest(std::option::Option<String>), 117} 118 119impl std::fmt::Display for LanguagesError<'_> { 120 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 121 match self { 122 Self::RepoNotFound(msg) => { 123 write!(f, "RepoNotFound")?; 124 if let Some(msg) = msg { 125 write!(f, ": {}", msg)?; 126 } 127 Ok(()) 128 } 129 Self::RefNotFound(msg) => { 130 write!(f, "RefNotFound")?; 131 if let Some(msg) = msg { 132 write!(f, ": {}", msg)?; 133 } 134 Ok(()) 135 } 136 Self::InvalidRequest(msg) => { 137 write!(f, "InvalidRequest")?; 138 if let Some(msg) = msg { 139 write!(f, ": {}", msg)?; 140 } 141 Ok(()) 142 } 143 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), 144 } 145 } 146} 147 148///Response type for 149///sh.tangled.repo.languages 150pub struct LanguagesResponse; 151impl jacquard_common::xrpc::XrpcResp for LanguagesResponse { 152 const NSID: &'static str = "sh.tangled.repo.languages"; 153 const ENCODING: &'static str = "application/json"; 154 type Output<'de> = LanguagesOutput<'de>; 155 type Err<'de> = LanguagesError<'de>; 156} 157 158impl<'a> jacquard_common::xrpc::XrpcRequest for Languages<'a> { 159 const NSID: &'static str = "sh.tangled.repo.languages"; 160 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 161 type Response = LanguagesResponse; 162} 163 164///Endpoint type for 165///sh.tangled.repo.languages 166pub struct LanguagesRequest; 167impl jacquard_common::xrpc::XrpcEndpoint for LanguagesRequest { 168 const PATH: &'static str = "/xrpc/sh.tangled.repo.languages"; 169 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; 170 type Request<'de> = Languages<'de>; 171 type Response = LanguagesResponse; 172}