// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: sh.tangled.repo.blob // // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, bon::Builder )] #[serde(rename_all = "camelCase")] pub struct LastCommit<'a> { #[serde(skip_serializing_if = "std::option::Option::is_none")] #[builder(into)] #[serde(borrow)] pub author: Option>, /// Commit hash #[serde(borrow)] #[builder(into)] pub hash: jacquard_common::CowStr<'a>, /// Commit message #[serde(borrow)] #[builder(into)] pub message: jacquard_common::CowStr<'a>, /// Short commit hash #[serde(skip_serializing_if = "std::option::Option::is_none")] #[builder(into)] #[serde(borrow)] pub short_hash: Option>, /// Commit timestamp pub when: jacquard_common::types::string::Datetime, } #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, bon::Builder, jacquard_derive::IntoStatic )] #[builder(start_fn = new)] #[serde(rename_all = "camelCase")] pub struct Blob<'a> { #[serde(borrow)] #[builder(into)] pub path: jacquard_common::CowStr<'a>, ///(default: false) #[serde(skip_serializing_if = "std::option::Option::is_none")] pub raw: std::option::Option, #[serde(borrow)] #[builder(into)] pub r#ref: jacquard_common::CowStr<'a>, #[serde(borrow)] #[builder(into)] pub repo: jacquard_common::CowStr<'a>, } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, Default )] #[serde(rename_all = "camelCase")] pub struct BlobOutput<'a> { /// File content (base64 encoded for binary files) #[serde(borrow)] pub content: jacquard_common::CowStr<'a>, /// Content encoding #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub encoding: std::option::Option>, /// Whether the file is binary #[serde(skip_serializing_if = "std::option::Option::is_none")] pub is_binary: std::option::Option, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub last_commit: std::option::Option>, /// MIME type of the file #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] pub mime_type: std::option::Option>, /// The file path #[serde(borrow)] pub path: jacquard_common::CowStr<'a>, /// The git reference used #[serde(borrow)] pub r#ref: jacquard_common::CowStr<'a>, /// File size in bytes #[serde(skip_serializing_if = "std::option::Option::is_none")] pub size: std::option::Option, } #[jacquard_derive::open_union] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, thiserror::Error, miette::Diagnostic, jacquard_derive::IntoStatic )] #[serde(tag = "error", content = "message")] #[serde(bound(deserialize = "'de: 'a"))] pub enum BlobError<'a> { /// Repository not found or access denied #[serde(rename = "RepoNotFound")] RepoNotFound(std::option::Option), /// Git reference not found #[serde(rename = "RefNotFound")] RefNotFound(std::option::Option), /// File not found at the specified path #[serde(rename = "FileNotFound")] FileNotFound(std::option::Option), /// Invalid request parameters #[serde(rename = "InvalidRequest")] InvalidRequest(std::option::Option), } impl std::fmt::Display for BlobError<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::RepoNotFound(msg) => { write!(f, "RepoNotFound")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::RefNotFound(msg) => { write!(f, "RefNotFound")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::FileNotFound(msg) => { write!(f, "FileNotFound")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::InvalidRequest(msg) => { write!(f, "InvalidRequest")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), } } } ///Response type for ///sh.tangled.repo.blob pub struct BlobResponse; impl jacquard_common::xrpc::XrpcResp for BlobResponse { const NSID: &'static str = "sh.tangled.repo.blob"; const ENCODING: &'static str = "application/json"; type Output<'de> = BlobOutput<'de>; type Err<'de> = BlobError<'de>; } impl<'a> jacquard_common::xrpc::XrpcRequest for Blob<'a> { const NSID: &'static str = "sh.tangled.repo.blob"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; type Response = BlobResponse; } ///Endpoint type for ///sh.tangled.repo.blob pub struct BlobRequest; impl jacquard_common::xrpc::XrpcEndpoint for BlobRequest { const PATH: &'static str = "/xrpc/sh.tangled.repo.blob"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; type Request<'de> = Blob<'de>; type Response = BlobResponse; } #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic, bon::Builder )] #[serde(rename_all = "camelCase")] pub struct Signature<'a> { /// Author email #[serde(borrow)] #[builder(into)] pub email: jacquard_common::CowStr<'a>, /// Author name #[serde(borrow)] #[builder(into)] pub name: jacquard_common::CowStr<'a>, /// Author timestamp pub when: jacquard_common::types::string::Datetime, }