// @generated by jacquard-lexicon. DO NOT EDIT. // // Lexicon: sh.tangled.repo.archive // // This file was automatically generated from Lexicon schemas. // Any manual changes will be overwritten on the next regeneration. #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, bon::Builder, jacquard_derive::IntoStatic )] #[builder(start_fn = new)] #[serde(rename_all = "camelCase")] pub struct Archive<'a> { ///(default: "tar.gz") #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] #[builder(into)] pub format: std::option::Option>, #[serde(skip_serializing_if = "std::option::Option::is_none")] #[serde(borrow)] #[builder(into)] pub prefix: std::option::Option>, #[serde(borrow)] #[builder(into)] pub r#ref: jacquard_common::CowStr<'a>, #[serde(borrow)] #[builder(into)] pub repo: jacquard_common::CowStr<'a>, } /// Binary archive data #[jacquard_derive::lexicon] #[derive( serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq, jacquard_derive::IntoStatic )] #[serde(rename_all = "camelCase")] pub struct ArchiveOutput<'a> {} #[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 ArchiveError<'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), /// Invalid request parameters #[serde(rename = "InvalidRequest")] InvalidRequest(std::option::Option), /// Failed to create archive #[serde(rename = "ArchiveError")] ArchiveError(std::option::Option), } impl std::fmt::Display for ArchiveError<'_> { 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::InvalidRequest(msg) => { write!(f, "InvalidRequest")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::ArchiveError(msg) => { write!(f, "ArchiveError")?; if let Some(msg) = msg { write!(f, ": {}", msg)?; } Ok(()) } Self::Unknown(err) => write!(f, "Unknown error: {:?}", err), } } } ///Response type for ///sh.tangled.repo.archive pub struct ArchiveResponse; impl jacquard_common::xrpc::XrpcResp for ArchiveResponse { const NSID: &'static str = "sh.tangled.repo.archive"; const ENCODING: &'static str = "*/*"; type Output<'de> = ArchiveOutput<'de>; type Err<'de> = ArchiveError<'de>; } impl<'a> jacquard_common::xrpc::XrpcRequest for Archive<'a> { const NSID: &'static str = "sh.tangled.repo.archive"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; type Response = ArchiveResponse; } ///Endpoint type for ///sh.tangled.repo.archive pub struct ArchiveRequest; impl jacquard_common::xrpc::XrpcEndpoint for ArchiveRequest { const PATH: &'static str = "/xrpc/sh.tangled.repo.archive"; const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query; type Request<'de> = Archive<'de>; type Response = ArchiveResponse; }