jacquard_api/sh_tangled/git/
ref_update.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: sh.tangled.git.refUpdate
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[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 CommitCountBreakdown<'a> {
20    #[serde(skip_serializing_if = "std::option::Option::is_none")]
21    #[serde(borrow)]
22    pub by_email: std::option::Option<
23        Vec<crate::sh_tangled::git::ref_update::IndividualEmailCommitCount<'a>>,
24    >,
25}
26
27#[jacquard_derive::lexicon]
28#[derive(
29    serde::Serialize,
30    serde::Deserialize,
31    Debug,
32    Clone,
33    PartialEq,
34    Eq,
35    jacquard_derive::IntoStatic
36)]
37#[serde(rename_all = "camelCase")]
38pub struct IndividualEmailCommitCount<'a> {
39    pub count: i64,
40    #[serde(borrow)]
41    pub email: jacquard_common::CowStr<'a>,
42}
43
44#[jacquard_derive::lexicon]
45#[derive(
46    serde::Serialize,
47    serde::Deserialize,
48    Debug,
49    Clone,
50    PartialEq,
51    Eq,
52    jacquard_derive::IntoStatic
53)]
54#[serde(rename_all = "camelCase")]
55pub struct IndividualLanguageSize<'a> {
56    #[serde(borrow)]
57    pub lang: jacquard_common::CowStr<'a>,
58    pub size: i64,
59}
60
61#[jacquard_derive::lexicon]
62#[derive(
63    serde::Serialize,
64    serde::Deserialize,
65    Debug,
66    Clone,
67    PartialEq,
68    Eq,
69    jacquard_derive::IntoStatic
70)]
71#[serde(rename_all = "camelCase")]
72pub struct LangBreakdown<'a> {
73    #[serde(skip_serializing_if = "std::option::Option::is_none")]
74    #[serde(borrow)]
75    pub inputs: std::option::Option<
76        Vec<crate::sh_tangled::git::ref_update::IndividualLanguageSize<'a>>,
77    >,
78}
79
80///An update to a git repository, emitted by knots.
81#[jacquard_derive::lexicon]
82#[derive(
83    serde::Serialize,
84    serde::Deserialize,
85    Debug,
86    Clone,
87    PartialEq,
88    Eq,
89    jacquard_derive::IntoStatic
90)]
91#[serde(rename_all = "camelCase")]
92pub struct RefUpdate<'a> {
93    ///did of the user that pushed this ref
94    #[serde(borrow)]
95    pub committer_did: jacquard_common::types::string::Did<'a>,
96    #[serde(borrow)]
97    pub meta: crate::sh_tangled::git::ref_update::Meta<'a>,
98    ///new SHA of this ref
99    #[serde(borrow)]
100    pub new_sha: jacquard_common::CowStr<'a>,
101    ///old SHA of this ref
102    #[serde(borrow)]
103    pub old_sha: jacquard_common::CowStr<'a>,
104    ///Ref being updated
105    #[serde(borrow)]
106    pub r#ref: jacquard_common::CowStr<'a>,
107    ///did of the owner of the repo
108    #[serde(borrow)]
109    pub repo_did: jacquard_common::types::string::Did<'a>,
110    ///name of the repo
111    #[serde(borrow)]
112    pub repo_name: jacquard_common::CowStr<'a>,
113}
114
115/// Typed wrapper for GetRecord response with this collection's record type.
116#[derive(
117    serde::Serialize,
118    serde::Deserialize,
119    Debug,
120    Clone,
121    PartialEq,
122    Eq,
123    jacquard_derive::IntoStatic
124)]
125#[serde(rename_all = "camelCase")]
126pub struct RefUpdateGetRecordOutput<'a> {
127    #[serde(skip_serializing_if = "std::option::Option::is_none")]
128    #[serde(borrow)]
129    pub cid: std::option::Option<jacquard_common::types::string::Cid<'a>>,
130    #[serde(borrow)]
131    pub uri: jacquard_common::types::string::AtUri<'a>,
132    #[serde(borrow)]
133    pub value: RefUpdate<'a>,
134}
135
136/// Marker type for deserializing records from this collection.
137pub struct RefUpdateRecord;
138impl jacquard_common::xrpc::XrpcResp for RefUpdateRecord {
139    const NSID: &'static str = "sh.tangled.git.refUpdate";
140    const ENCODING: &'static str = "application/json";
141    type Output<'de> = RefUpdateGetRecordOutput<'de>;
142    type Err<'de> = jacquard_common::types::collection::RecordError<'de>;
143}
144
145impl jacquard_common::types::collection::Collection for RefUpdate<'_> {
146    const NSID: &'static str = "sh.tangled.git.refUpdate";
147    type Record = RefUpdateRecord;
148}
149
150impl From<RefUpdateGetRecordOutput<'_>> for RefUpdate<'_> {
151    fn from(output: RefUpdateGetRecordOutput<'_>) -> Self {
152        use jacquard_common::IntoStatic;
153        output.value.into_static()
154    }
155}
156
157#[jacquard_derive::lexicon]
158#[derive(
159    serde::Serialize,
160    serde::Deserialize,
161    Debug,
162    Clone,
163    PartialEq,
164    Eq,
165    jacquard_derive::IntoStatic
166)]
167#[serde(rename_all = "camelCase")]
168pub struct Meta<'a> {
169    #[serde(borrow)]
170    pub commit_count: crate::sh_tangled::git::ref_update::CommitCountBreakdown<'a>,
171    pub is_default_ref: bool,
172    #[serde(skip_serializing_if = "std::option::Option::is_none")]
173    #[serde(borrow)]
174    pub lang_breakdown: std::option::Option<
175        crate::sh_tangled::git::ref_update::LangBreakdown<'a>,
176    >,
177}