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