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