jacquard_api/sh_tangled/knot/
version.rs1#[jacquard_derive::lexicon]
9#[derive(
10 serde::Serialize,
11 serde::Deserialize,
12 Debug,
13 Clone,
14 PartialEq,
15 Eq,
16 jacquard_derive::IntoStatic
17)]
18#[serde(rename_all = "camelCase")]
19pub struct VersionOutput<'a> {
20 #[serde(borrow)]
21 pub version: jacquard_common::CowStr<'a>,
22}
23
24#[jacquard_derive::open_union]
25#[derive(
26 serde::Serialize,
27 serde::Deserialize,
28 Debug,
29 Clone,
30 PartialEq,
31 Eq,
32 thiserror::Error,
33 miette::Diagnostic
34)]
35#[serde(tag = "error", content = "message")]
36#[serde(bound(deserialize = "'de: 'a"))]
37pub enum VersionError<'a> {}
38impl std::fmt::Display for VersionError<'_> {
39 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
40 match self {
41 Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
42 }
43 }
44}
45
46impl jacquard_common::IntoStatic for VersionError<'_> {
47 type Output = VersionError<'static>;
48 fn into_static(self) -> Self::Output {
49 match self {
50 VersionError::Unknown(v) => VersionError::Unknown(v.into_static()),
51 }
52 }
53}
54
55#[derive(
57 Debug,
58 Clone,
59 Copy,
60 PartialEq,
61 Eq,
62 serde::Serialize,
63 serde::Deserialize,
64 jacquard_derive::IntoStatic
65)]
66pub struct Version;
67pub struct VersionResponse;
70impl jacquard_common::xrpc::XrpcResp for VersionResponse {
71 const NSID: &'static str = "sh.tangled.knot.version";
72 const ENCODING: &'static str = "application/json";
73 type Output<'de> = VersionOutput<'de>;
74 type Err<'de> = VersionError<'de>;
75}
76
77impl<'de> jacquard_common::xrpc::XrpcRequest<'de> for Version {
78 const NSID: &'static str = "sh.tangled.knot.version";
79 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
80 type Response = VersionResponse;
81}
82
83pub struct VersionRequest;
86impl jacquard_common::xrpc::XrpcEndpoint for VersionRequest {
87 const PATH: &'static str = "/xrpc/sh.tangled.knot.version";
88 const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
89 type Request<'de> = Version;
90 type Response = VersionResponse;
91}