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