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