Skip to main content

jacquard_api/sh_tangled/git/temp/
get_tree.rs

1// @generated by jacquard-lexicon. DO NOT EDIT.
2//
3// Lexicon: sh.tangled.git.temp.getTree
4//
5// This file was automatically generated from Lexicon schemas.
6// Any manual changes will be overwritten on the next regeneration.
7
8#[allow(unused_imports)]
9use alloc::collections::BTreeMap;
10
11#[allow(unused_imports)]
12use core::marker::PhantomData;
13use jacquard_common::CowStr;
14
15#[allow(unused_imports)]
16use jacquard_common::deps::codegen::unicode_segmentation::UnicodeSegmentation;
17use jacquard_common::types::string::{AtUri, Datetime};
18use jacquard_derive::{IntoStatic, lexicon, open_union};
19use jacquard_lexicon::lexicon::LexiconDoc;
20use jacquard_lexicon::schema::LexiconSchema;
21
22#[allow(unused_imports)]
23use jacquard_lexicon::validation::{ConstraintError, ValidationPath};
24use serde::{Serialize, Deserialize};
25use crate::sh_tangled::git::temp::get_tree;
26
27#[lexicon]
28#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
29#[serde(rename_all = "camelCase")]
30pub struct LastCommit<'a> {
31    #[serde(skip_serializing_if = "Option::is_none")]
32    #[serde(borrow)]
33    pub author: Option<get_tree::Signature<'a>>,
34    ///Commit hash
35    #[serde(borrow)]
36    pub hash: CowStr<'a>,
37    ///Commit message
38    #[serde(borrow)]
39    pub message: CowStr<'a>,
40    ///Commit timestamp
41    pub when: Datetime,
42}
43
44
45#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
46#[serde(rename_all = "camelCase")]
47pub struct GetTree<'a> {
48    ///Defaults to `""`.
49    #[serde(default = "_default_path")]
50    #[serde(skip_serializing_if = "Option::is_none")]
51    #[serde(borrow)]
52    pub path: Option<CowStr<'a>>,
53    #[serde(borrow)]
54    pub r#ref: CowStr<'a>,
55    #[serde(borrow)]
56    pub repo: AtUri<'a>,
57}
58
59
60#[lexicon]
61#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
62#[serde(rename_all = "camelCase")]
63pub struct GetTreeOutput<'a> {
64    ///Parent directory path
65    #[serde(skip_serializing_if = "Option::is_none")]
66    #[serde(borrow)]
67    pub dotdot: Option<CowStr<'a>>,
68    #[serde(borrow)]
69    pub files: Vec<get_tree::TreeEntry<'a>>,
70    #[serde(skip_serializing_if = "Option::is_none")]
71    #[serde(borrow)]
72    pub last_commit: Option<get_tree::LastCommit<'a>>,
73    ///The parent path in the tree
74    #[serde(skip_serializing_if = "Option::is_none")]
75    #[serde(borrow)]
76    pub parent: Option<CowStr<'a>>,
77    ///Readme for this file tree
78    #[serde(skip_serializing_if = "Option::is_none")]
79    #[serde(borrow)]
80    pub readme: Option<get_tree::Readme<'a>>,
81    ///The git reference used
82    #[serde(borrow)]
83    pub r#ref: CowStr<'a>,
84}
85
86
87#[open_union]
88#[derive(
89    Serialize,
90    Deserialize,
91    Debug,
92    Clone,
93    PartialEq,
94    Eq,
95    thiserror::Error,
96    miette::Diagnostic,
97    IntoStatic
98)]
99
100#[serde(tag = "error", content = "message")]
101#[serde(bound(deserialize = "'de: 'a"))]
102pub enum GetTreeError<'a> {
103    /// Repository not found or access denied
104    #[serde(rename = "RepoNotFound")]
105    RepoNotFound(Option<CowStr<'a>>),
106    /// Git reference not found
107    #[serde(rename = "RefNotFound")]
108    RefNotFound(Option<CowStr<'a>>),
109    /// Path not found in repository tree
110    #[serde(rename = "PathNotFound")]
111    PathNotFound(Option<CowStr<'a>>),
112    /// Invalid request parameters
113    #[serde(rename = "InvalidRequest")]
114    InvalidRequest(Option<CowStr<'a>>),
115}
116
117impl core::fmt::Display for GetTreeError<'_> {
118    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
119        match self {
120            Self::RepoNotFound(msg) => {
121                write!(f, "RepoNotFound")?;
122                if let Some(msg) = msg {
123                    write!(f, ": {}", msg)?;
124                }
125                Ok(())
126            }
127            Self::RefNotFound(msg) => {
128                write!(f, "RefNotFound")?;
129                if let Some(msg) = msg {
130                    write!(f, ": {}", msg)?;
131                }
132                Ok(())
133            }
134            Self::PathNotFound(msg) => {
135                write!(f, "PathNotFound")?;
136                if let Some(msg) = msg {
137                    write!(f, ": {}", msg)?;
138                }
139                Ok(())
140            }
141            Self::InvalidRequest(msg) => {
142                write!(f, "InvalidRequest")?;
143                if let Some(msg) = msg {
144                    write!(f, ": {}", msg)?;
145                }
146                Ok(())
147            }
148            Self::Unknown(err) => write!(f, "Unknown error: {:?}", err),
149        }
150    }
151}
152
153
154#[lexicon]
155#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
156#[serde(rename_all = "camelCase")]
157pub struct Readme<'a> {
158    ///Contents of the readme file
159    #[serde(borrow)]
160    pub contents: CowStr<'a>,
161    ///Name of the readme file
162    #[serde(borrow)]
163    pub filename: CowStr<'a>,
164}
165
166
167#[lexicon]
168#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
169#[serde(rename_all = "camelCase")]
170pub struct Signature<'a> {
171    ///Author email
172    #[serde(borrow)]
173    pub email: CowStr<'a>,
174    ///Author name
175    #[serde(borrow)]
176    pub name: CowStr<'a>,
177    ///Author timestamp
178    pub when: Datetime,
179}
180
181
182#[lexicon]
183#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
184#[serde(rename_all = "camelCase")]
185pub struct TreeEntry<'a> {
186    #[serde(skip_serializing_if = "Option::is_none")]
187    #[serde(borrow)]
188    pub last_commit: Option<get_tree::LastCommit<'a>>,
189    ///File mode
190    #[serde(borrow)]
191    pub mode: CowStr<'a>,
192    ///Relative file or directory name
193    #[serde(borrow)]
194    pub name: CowStr<'a>,
195    ///File size in bytes
196    pub size: i64,
197}
198
199impl<'a> LexiconSchema for LastCommit<'a> {
200    fn nsid() -> &'static str {
201        "sh.tangled.git.temp.getTree"
202    }
203    fn def_name() -> &'static str {
204        "lastCommit"
205    }
206    fn lexicon_doc() -> LexiconDoc<'static> {
207        lexicon_doc_sh_tangled_git_temp_getTree()
208    }
209    fn validate(&self) -> Result<(), ConstraintError> {
210        Ok(())
211    }
212}
213
214/// Response type for sh.tangled.git.temp.getTree
215pub struct GetTreeResponse;
216impl jacquard_common::xrpc::XrpcResp for GetTreeResponse {
217    const NSID: &'static str = "sh.tangled.git.temp.getTree";
218    const ENCODING: &'static str = "application/json";
219    type Output<'de> = GetTreeOutput<'de>;
220    type Err<'de> = GetTreeError<'de>;
221}
222
223impl<'a> jacquard_common::xrpc::XrpcRequest for GetTree<'a> {
224    const NSID: &'static str = "sh.tangled.git.temp.getTree";
225    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
226    type Response = GetTreeResponse;
227}
228
229/// Endpoint type for sh.tangled.git.temp.getTree
230pub struct GetTreeRequest;
231impl jacquard_common::xrpc::XrpcEndpoint for GetTreeRequest {
232    const PATH: &'static str = "/xrpc/sh.tangled.git.temp.getTree";
233    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Query;
234    type Request<'de> = GetTree<'de>;
235    type Response = GetTreeResponse;
236}
237
238impl<'a> LexiconSchema for Readme<'a> {
239    fn nsid() -> &'static str {
240        "sh.tangled.git.temp.getTree"
241    }
242    fn def_name() -> &'static str {
243        "readme"
244    }
245    fn lexicon_doc() -> LexiconDoc<'static> {
246        lexicon_doc_sh_tangled_git_temp_getTree()
247    }
248    fn validate(&self) -> Result<(), ConstraintError> {
249        Ok(())
250    }
251}
252
253impl<'a> LexiconSchema for Signature<'a> {
254    fn nsid() -> &'static str {
255        "sh.tangled.git.temp.getTree"
256    }
257    fn def_name() -> &'static str {
258        "signature"
259    }
260    fn lexicon_doc() -> LexiconDoc<'static> {
261        lexicon_doc_sh_tangled_git_temp_getTree()
262    }
263    fn validate(&self) -> Result<(), ConstraintError> {
264        Ok(())
265    }
266}
267
268impl<'a> LexiconSchema for TreeEntry<'a> {
269    fn nsid() -> &'static str {
270        "sh.tangled.git.temp.getTree"
271    }
272    fn def_name() -> &'static str {
273        "treeEntry"
274    }
275    fn lexicon_doc() -> LexiconDoc<'static> {
276        lexicon_doc_sh_tangled_git_temp_getTree()
277    }
278    fn validate(&self) -> Result<(), ConstraintError> {
279        Ok(())
280    }
281}
282
283pub mod last_commit_state {
284
285    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
286    #[allow(unused)]
287    use ::core::marker::PhantomData;
288    mod sealed {
289        pub trait Sealed {}
290    }
291    /// State trait tracking which required fields have been set
292    pub trait State: sealed::Sealed {
293        type When;
294        type Hash;
295        type Message;
296    }
297    /// Empty state - all required fields are unset
298    pub struct Empty(());
299    impl sealed::Sealed for Empty {}
300    impl State for Empty {
301        type When = Unset;
302        type Hash = Unset;
303        type Message = Unset;
304    }
305    ///State transition - sets the `when` field to Set
306    pub struct SetWhen<S: State = Empty>(PhantomData<fn() -> S>);
307    impl<S: State> sealed::Sealed for SetWhen<S> {}
308    impl<S: State> State for SetWhen<S> {
309        type When = Set<members::when>;
310        type Hash = S::Hash;
311        type Message = S::Message;
312    }
313    ///State transition - sets the `hash` field to Set
314    pub struct SetHash<S: State = Empty>(PhantomData<fn() -> S>);
315    impl<S: State> sealed::Sealed for SetHash<S> {}
316    impl<S: State> State for SetHash<S> {
317        type When = S::When;
318        type Hash = Set<members::hash>;
319        type Message = S::Message;
320    }
321    ///State transition - sets the `message` field to Set
322    pub struct SetMessage<S: State = Empty>(PhantomData<fn() -> S>);
323    impl<S: State> sealed::Sealed for SetMessage<S> {}
324    impl<S: State> State for SetMessage<S> {
325        type When = S::When;
326        type Hash = S::Hash;
327        type Message = Set<members::message>;
328    }
329    /// Marker types for field names
330    #[allow(non_camel_case_types)]
331    pub mod members {
332        ///Marker type for the `when` field
333        pub struct when(());
334        ///Marker type for the `hash` field
335        pub struct hash(());
336        ///Marker type for the `message` field
337        pub struct message(());
338    }
339}
340
341/// Builder for constructing an instance of this type
342pub struct LastCommitBuilder<'a, S: last_commit_state::State> {
343    _state: PhantomData<fn() -> S>,
344    _fields: (
345        Option<get_tree::Signature<'a>>,
346        Option<CowStr<'a>>,
347        Option<CowStr<'a>>,
348        Option<Datetime>,
349    ),
350    _lifetime: PhantomData<&'a ()>,
351}
352
353impl<'a> LastCommit<'a> {
354    /// Create a new builder for this type
355    pub fn new() -> LastCommitBuilder<'a, last_commit_state::Empty> {
356        LastCommitBuilder::new()
357    }
358}
359
360impl<'a> LastCommitBuilder<'a, last_commit_state::Empty> {
361    /// Create a new builder with all fields unset
362    pub fn new() -> Self {
363        LastCommitBuilder {
364            _state: PhantomData,
365            _fields: (None, None, None, None),
366            _lifetime: PhantomData,
367        }
368    }
369}
370
371impl<'a, S: last_commit_state::State> LastCommitBuilder<'a, S> {
372    /// Set the `author` field (optional)
373    pub fn author(mut self, value: impl Into<Option<get_tree::Signature<'a>>>) -> Self {
374        self._fields.0 = value.into();
375        self
376    }
377    /// Set the `author` field to an Option value (optional)
378    pub fn maybe_author(mut self, value: Option<get_tree::Signature<'a>>) -> Self {
379        self._fields.0 = value;
380        self
381    }
382}
383
384impl<'a, S> LastCommitBuilder<'a, S>
385where
386    S: last_commit_state::State,
387    S::Hash: last_commit_state::IsUnset,
388{
389    /// Set the `hash` field (required)
390    pub fn hash(
391        mut self,
392        value: impl Into<CowStr<'a>>,
393    ) -> LastCommitBuilder<'a, last_commit_state::SetHash<S>> {
394        self._fields.1 = Option::Some(value.into());
395        LastCommitBuilder {
396            _state: PhantomData,
397            _fields: self._fields,
398            _lifetime: PhantomData,
399        }
400    }
401}
402
403impl<'a, S> LastCommitBuilder<'a, S>
404where
405    S: last_commit_state::State,
406    S::Message: last_commit_state::IsUnset,
407{
408    /// Set the `message` field (required)
409    pub fn message(
410        mut self,
411        value: impl Into<CowStr<'a>>,
412    ) -> LastCommitBuilder<'a, last_commit_state::SetMessage<S>> {
413        self._fields.2 = Option::Some(value.into());
414        LastCommitBuilder {
415            _state: PhantomData,
416            _fields: self._fields,
417            _lifetime: PhantomData,
418        }
419    }
420}
421
422impl<'a, S> LastCommitBuilder<'a, S>
423where
424    S: last_commit_state::State,
425    S::When: last_commit_state::IsUnset,
426{
427    /// Set the `when` field (required)
428    pub fn when(
429        mut self,
430        value: impl Into<Datetime>,
431    ) -> LastCommitBuilder<'a, last_commit_state::SetWhen<S>> {
432        self._fields.3 = Option::Some(value.into());
433        LastCommitBuilder {
434            _state: PhantomData,
435            _fields: self._fields,
436            _lifetime: PhantomData,
437        }
438    }
439}
440
441impl<'a, S> LastCommitBuilder<'a, S>
442where
443    S: last_commit_state::State,
444    S::When: last_commit_state::IsSet,
445    S::Hash: last_commit_state::IsSet,
446    S::Message: last_commit_state::IsSet,
447{
448    /// Build the final struct
449    pub fn build(self) -> LastCommit<'a> {
450        LastCommit {
451            author: self._fields.0,
452            hash: self._fields.1.unwrap(),
453            message: self._fields.2.unwrap(),
454            when: self._fields.3.unwrap(),
455            extra_data: Default::default(),
456        }
457    }
458    /// Build the final struct with custom extra_data
459    pub fn build_with_data(
460        self,
461        extra_data: BTreeMap<
462            jacquard_common::deps::smol_str::SmolStr,
463            jacquard_common::types::value::Data<'a>,
464        >,
465    ) -> LastCommit<'a> {
466        LastCommit {
467            author: self._fields.0,
468            hash: self._fields.1.unwrap(),
469            message: self._fields.2.unwrap(),
470            when: self._fields.3.unwrap(),
471            extra_data: Some(extra_data),
472        }
473    }
474}
475
476fn lexicon_doc_sh_tangled_git_temp_getTree() -> LexiconDoc<'static> {
477    #[allow(unused_imports)]
478    use jacquard_common::{CowStr, deps::smol_str::SmolStr, types::blob::MimeType};
479    use jacquard_lexicon::lexicon::*;
480    use alloc::collections::BTreeMap;
481    LexiconDoc {
482        lexicon: Lexicon::Lexicon1,
483        id: CowStr::new_static("sh.tangled.git.temp.getTree"),
484        defs: {
485            let mut map = BTreeMap::new();
486            map.insert(
487                SmolStr::new_static("lastCommit"),
488                LexUserType::Object(LexObject {
489                    required: Some(
490                        vec![
491                            SmolStr::new_static("hash"), SmolStr::new_static("message"),
492                            SmolStr::new_static("when")
493                        ],
494                    ),
495                    properties: {
496                        #[allow(unused_mut)]
497                        let mut map = BTreeMap::new();
498                        map.insert(
499                            SmolStr::new_static("author"),
500                            LexObjectProperty::Ref(LexRef {
501                                r#ref: CowStr::new_static("#signature"),
502                                ..Default::default()
503                            }),
504                        );
505                        map.insert(
506                            SmolStr::new_static("hash"),
507                            LexObjectProperty::String(LexString {
508                                description: Some(CowStr::new_static("Commit hash")),
509                                ..Default::default()
510                            }),
511                        );
512                        map.insert(
513                            SmolStr::new_static("message"),
514                            LexObjectProperty::String(LexString {
515                                description: Some(CowStr::new_static("Commit message")),
516                                ..Default::default()
517                            }),
518                        );
519                        map.insert(
520                            SmolStr::new_static("when"),
521                            LexObjectProperty::String(LexString {
522                                description: Some(CowStr::new_static("Commit timestamp")),
523                                format: Some(LexStringFormat::Datetime),
524                                ..Default::default()
525                            }),
526                        );
527                        map
528                    },
529                    ..Default::default()
530                }),
531            );
532            map.insert(
533                SmolStr::new_static("main"),
534                LexUserType::XrpcQuery(LexXrpcQuery {
535                    parameters: Some(
536                        LexXrpcQueryParameter::Params(LexXrpcParameters {
537                            required: Some(
538                                vec![
539                                    SmolStr::new_static("repo"), SmolStr::new_static("ref")
540                                ],
541                            ),
542                            properties: {
543                                #[allow(unused_mut)]
544                                let mut map = BTreeMap::new();
545                                map.insert(
546                                    SmolStr::new_static("path"),
547                                    LexXrpcParametersProperty::String(LexString {
548                                        description: Some(
549                                            CowStr::new_static("Path within the repository tree"),
550                                        ),
551                                        ..Default::default()
552                                    }),
553                                );
554                                map.insert(
555                                    SmolStr::new_static("ref"),
556                                    LexXrpcParametersProperty::String(LexString {
557                                        description: Some(
558                                            CowStr::new_static(
559                                                "Git reference (branch, tag, or commit SHA)",
560                                            ),
561                                        ),
562                                        ..Default::default()
563                                    }),
564                                );
565                                map.insert(
566                                    SmolStr::new_static("repo"),
567                                    LexXrpcParametersProperty::String(LexString {
568                                        description: Some(
569                                            CowStr::new_static("AT-URI of the repository"),
570                                        ),
571                                        format: Some(LexStringFormat::AtUri),
572                                        ..Default::default()
573                                    }),
574                                );
575                                map
576                            },
577                            ..Default::default()
578                        }),
579                    ),
580                    ..Default::default()
581                }),
582            );
583            map.insert(
584                SmolStr::new_static("readme"),
585                LexUserType::Object(LexObject {
586                    required: Some(
587                        vec![
588                            SmolStr::new_static("filename"),
589                            SmolStr::new_static("contents")
590                        ],
591                    ),
592                    properties: {
593                        #[allow(unused_mut)]
594                        let mut map = BTreeMap::new();
595                        map.insert(
596                            SmolStr::new_static("contents"),
597                            LexObjectProperty::String(LexString {
598                                description: Some(
599                                    CowStr::new_static("Contents of the readme file"),
600                                ),
601                                ..Default::default()
602                            }),
603                        );
604                        map.insert(
605                            SmolStr::new_static("filename"),
606                            LexObjectProperty::String(LexString {
607                                description: Some(
608                                    CowStr::new_static("Name of the readme file"),
609                                ),
610                                ..Default::default()
611                            }),
612                        );
613                        map
614                    },
615                    ..Default::default()
616                }),
617            );
618            map.insert(
619                SmolStr::new_static("signature"),
620                LexUserType::Object(LexObject {
621                    required: Some(
622                        vec![
623                            SmolStr::new_static("name"), SmolStr::new_static("email"),
624                            SmolStr::new_static("when")
625                        ],
626                    ),
627                    properties: {
628                        #[allow(unused_mut)]
629                        let mut map = BTreeMap::new();
630                        map.insert(
631                            SmolStr::new_static("email"),
632                            LexObjectProperty::String(LexString {
633                                description: Some(CowStr::new_static("Author email")),
634                                ..Default::default()
635                            }),
636                        );
637                        map.insert(
638                            SmolStr::new_static("name"),
639                            LexObjectProperty::String(LexString {
640                                description: Some(CowStr::new_static("Author name")),
641                                ..Default::default()
642                            }),
643                        );
644                        map.insert(
645                            SmolStr::new_static("when"),
646                            LexObjectProperty::String(LexString {
647                                description: Some(CowStr::new_static("Author timestamp")),
648                                format: Some(LexStringFormat::Datetime),
649                                ..Default::default()
650                            }),
651                        );
652                        map
653                    },
654                    ..Default::default()
655                }),
656            );
657            map.insert(
658                SmolStr::new_static("treeEntry"),
659                LexUserType::Object(LexObject {
660                    required: Some(
661                        vec![
662                            SmolStr::new_static("name"), SmolStr::new_static("mode"),
663                            SmolStr::new_static("size")
664                        ],
665                    ),
666                    properties: {
667                        #[allow(unused_mut)]
668                        let mut map = BTreeMap::new();
669                        map.insert(
670                            SmolStr::new_static("last_commit"),
671                            LexObjectProperty::Ref(LexRef {
672                                r#ref: CowStr::new_static("#lastCommit"),
673                                ..Default::default()
674                            }),
675                        );
676                        map.insert(
677                            SmolStr::new_static("mode"),
678                            LexObjectProperty::String(LexString {
679                                description: Some(CowStr::new_static("File mode")),
680                                ..Default::default()
681                            }),
682                        );
683                        map.insert(
684                            SmolStr::new_static("name"),
685                            LexObjectProperty::String(LexString {
686                                description: Some(
687                                    CowStr::new_static("Relative file or directory name"),
688                                ),
689                                ..Default::default()
690                            }),
691                        );
692                        map.insert(
693                            SmolStr::new_static("size"),
694                            LexObjectProperty::Integer(LexInteger {
695                                ..Default::default()
696                            }),
697                        );
698                        map
699                    },
700                    ..Default::default()
701                }),
702            );
703            map
704        },
705        ..Default::default()
706    }
707}
708
709fn _default_path() -> Option<CowStr<'static>> {
710    Some(CowStr::from(""))
711}
712
713pub mod get_tree_state {
714
715    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
716    #[allow(unused)]
717    use ::core::marker::PhantomData;
718    mod sealed {
719        pub trait Sealed {}
720    }
721    /// State trait tracking which required fields have been set
722    pub trait State: sealed::Sealed {
723        type Repo;
724        type Ref;
725    }
726    /// Empty state - all required fields are unset
727    pub struct Empty(());
728    impl sealed::Sealed for Empty {}
729    impl State for Empty {
730        type Repo = Unset;
731        type Ref = Unset;
732    }
733    ///State transition - sets the `repo` field to Set
734    pub struct SetRepo<S: State = Empty>(PhantomData<fn() -> S>);
735    impl<S: State> sealed::Sealed for SetRepo<S> {}
736    impl<S: State> State for SetRepo<S> {
737        type Repo = Set<members::repo>;
738        type Ref = S::Ref;
739    }
740    ///State transition - sets the `ref` field to Set
741    pub struct SetRef<S: State = Empty>(PhantomData<fn() -> S>);
742    impl<S: State> sealed::Sealed for SetRef<S> {}
743    impl<S: State> State for SetRef<S> {
744        type Repo = S::Repo;
745        type Ref = Set<members::r#ref>;
746    }
747    /// Marker types for field names
748    #[allow(non_camel_case_types)]
749    pub mod members {
750        ///Marker type for the `repo` field
751        pub struct repo(());
752        ///Marker type for the `ref` field
753        pub struct r#ref(());
754    }
755}
756
757/// Builder for constructing an instance of this type
758pub struct GetTreeBuilder<'a, S: get_tree_state::State> {
759    _state: PhantomData<fn() -> S>,
760    _fields: (Option<CowStr<'a>>, Option<CowStr<'a>>, Option<AtUri<'a>>),
761    _lifetime: PhantomData<&'a ()>,
762}
763
764impl<'a> GetTree<'a> {
765    /// Create a new builder for this type
766    pub fn new() -> GetTreeBuilder<'a, get_tree_state::Empty> {
767        GetTreeBuilder::new()
768    }
769}
770
771impl<'a> GetTreeBuilder<'a, get_tree_state::Empty> {
772    /// Create a new builder with all fields unset
773    pub fn new() -> Self {
774        GetTreeBuilder {
775            _state: PhantomData,
776            _fields: (None, None, None),
777            _lifetime: PhantomData,
778        }
779    }
780}
781
782impl<'a, S: get_tree_state::State> GetTreeBuilder<'a, S> {
783    /// Set the `path` field (optional)
784    pub fn path(mut self, value: impl Into<Option<CowStr<'a>>>) -> Self {
785        self._fields.0 = value.into();
786        self
787    }
788    /// Set the `path` field to an Option value (optional)
789    pub fn maybe_path(mut self, value: Option<CowStr<'a>>) -> Self {
790        self._fields.0 = value;
791        self
792    }
793}
794
795impl<'a, S> GetTreeBuilder<'a, S>
796where
797    S: get_tree_state::State,
798    S::Ref: get_tree_state::IsUnset,
799{
800    /// Set the `ref` field (required)
801    pub fn r#ref(
802        mut self,
803        value: impl Into<CowStr<'a>>,
804    ) -> GetTreeBuilder<'a, get_tree_state::SetRef<S>> {
805        self._fields.1 = Option::Some(value.into());
806        GetTreeBuilder {
807            _state: PhantomData,
808            _fields: self._fields,
809            _lifetime: PhantomData,
810        }
811    }
812}
813
814impl<'a, S> GetTreeBuilder<'a, S>
815where
816    S: get_tree_state::State,
817    S::Repo: get_tree_state::IsUnset,
818{
819    /// Set the `repo` field (required)
820    pub fn repo(
821        mut self,
822        value: impl Into<AtUri<'a>>,
823    ) -> GetTreeBuilder<'a, get_tree_state::SetRepo<S>> {
824        self._fields.2 = Option::Some(value.into());
825        GetTreeBuilder {
826            _state: PhantomData,
827            _fields: self._fields,
828            _lifetime: PhantomData,
829        }
830    }
831}
832
833impl<'a, S> GetTreeBuilder<'a, S>
834where
835    S: get_tree_state::State,
836    S::Repo: get_tree_state::IsSet,
837    S::Ref: get_tree_state::IsSet,
838{
839    /// Build the final struct
840    pub fn build(self) -> GetTree<'a> {
841        GetTree {
842            path: self._fields.0,
843            r#ref: self._fields.1.unwrap(),
844            repo: self._fields.2.unwrap(),
845        }
846    }
847}
848
849pub mod signature_state {
850
851    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
852    #[allow(unused)]
853    use ::core::marker::PhantomData;
854    mod sealed {
855        pub trait Sealed {}
856    }
857    /// State trait tracking which required fields have been set
858    pub trait State: sealed::Sealed {
859        type Email;
860        type When;
861        type Name;
862    }
863    /// Empty state - all required fields are unset
864    pub struct Empty(());
865    impl sealed::Sealed for Empty {}
866    impl State for Empty {
867        type Email = Unset;
868        type When = Unset;
869        type Name = Unset;
870    }
871    ///State transition - sets the `email` field to Set
872    pub struct SetEmail<S: State = Empty>(PhantomData<fn() -> S>);
873    impl<S: State> sealed::Sealed for SetEmail<S> {}
874    impl<S: State> State for SetEmail<S> {
875        type Email = Set<members::email>;
876        type When = S::When;
877        type Name = S::Name;
878    }
879    ///State transition - sets the `when` field to Set
880    pub struct SetWhen<S: State = Empty>(PhantomData<fn() -> S>);
881    impl<S: State> sealed::Sealed for SetWhen<S> {}
882    impl<S: State> State for SetWhen<S> {
883        type Email = S::Email;
884        type When = Set<members::when>;
885        type Name = S::Name;
886    }
887    ///State transition - sets the `name` field to Set
888    pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>);
889    impl<S: State> sealed::Sealed for SetName<S> {}
890    impl<S: State> State for SetName<S> {
891        type Email = S::Email;
892        type When = S::When;
893        type Name = Set<members::name>;
894    }
895    /// Marker types for field names
896    #[allow(non_camel_case_types)]
897    pub mod members {
898        ///Marker type for the `email` field
899        pub struct email(());
900        ///Marker type for the `when` field
901        pub struct when(());
902        ///Marker type for the `name` field
903        pub struct name(());
904    }
905}
906
907/// Builder for constructing an instance of this type
908pub struct SignatureBuilder<'a, S: signature_state::State> {
909    _state: PhantomData<fn() -> S>,
910    _fields: (Option<CowStr<'a>>, Option<CowStr<'a>>, Option<Datetime>),
911    _lifetime: PhantomData<&'a ()>,
912}
913
914impl<'a> Signature<'a> {
915    /// Create a new builder for this type
916    pub fn new() -> SignatureBuilder<'a, signature_state::Empty> {
917        SignatureBuilder::new()
918    }
919}
920
921impl<'a> SignatureBuilder<'a, signature_state::Empty> {
922    /// Create a new builder with all fields unset
923    pub fn new() -> Self {
924        SignatureBuilder {
925            _state: PhantomData,
926            _fields: (None, None, None),
927            _lifetime: PhantomData,
928        }
929    }
930}
931
932impl<'a, S> SignatureBuilder<'a, S>
933where
934    S: signature_state::State,
935    S::Email: signature_state::IsUnset,
936{
937    /// Set the `email` field (required)
938    pub fn email(
939        mut self,
940        value: impl Into<CowStr<'a>>,
941    ) -> SignatureBuilder<'a, signature_state::SetEmail<S>> {
942        self._fields.0 = Option::Some(value.into());
943        SignatureBuilder {
944            _state: PhantomData,
945            _fields: self._fields,
946            _lifetime: PhantomData,
947        }
948    }
949}
950
951impl<'a, S> SignatureBuilder<'a, S>
952where
953    S: signature_state::State,
954    S::Name: signature_state::IsUnset,
955{
956    /// Set the `name` field (required)
957    pub fn name(
958        mut self,
959        value: impl Into<CowStr<'a>>,
960    ) -> SignatureBuilder<'a, signature_state::SetName<S>> {
961        self._fields.1 = Option::Some(value.into());
962        SignatureBuilder {
963            _state: PhantomData,
964            _fields: self._fields,
965            _lifetime: PhantomData,
966        }
967    }
968}
969
970impl<'a, S> SignatureBuilder<'a, S>
971where
972    S: signature_state::State,
973    S::When: signature_state::IsUnset,
974{
975    /// Set the `when` field (required)
976    pub fn when(
977        mut self,
978        value: impl Into<Datetime>,
979    ) -> SignatureBuilder<'a, signature_state::SetWhen<S>> {
980        self._fields.2 = Option::Some(value.into());
981        SignatureBuilder {
982            _state: PhantomData,
983            _fields: self._fields,
984            _lifetime: PhantomData,
985        }
986    }
987}
988
989impl<'a, S> SignatureBuilder<'a, S>
990where
991    S: signature_state::State,
992    S::Email: signature_state::IsSet,
993    S::When: signature_state::IsSet,
994    S::Name: signature_state::IsSet,
995{
996    /// Build the final struct
997    pub fn build(self) -> Signature<'a> {
998        Signature {
999            email: self._fields.0.unwrap(),
1000            name: self._fields.1.unwrap(),
1001            when: self._fields.2.unwrap(),
1002            extra_data: Default::default(),
1003        }
1004    }
1005    /// Build the final struct with custom extra_data
1006    pub fn build_with_data(
1007        self,
1008        extra_data: BTreeMap<
1009            jacquard_common::deps::smol_str::SmolStr,
1010            jacquard_common::types::value::Data<'a>,
1011        >,
1012    ) -> Signature<'a> {
1013        Signature {
1014            email: self._fields.0.unwrap(),
1015            name: self._fields.1.unwrap(),
1016            when: self._fields.2.unwrap(),
1017            extra_data: Some(extra_data),
1018        }
1019    }
1020}
1021
1022pub mod tree_entry_state {
1023
1024    pub use crate::builder_types::{Set, Unset, IsSet, IsUnset};
1025    #[allow(unused)]
1026    use ::core::marker::PhantomData;
1027    mod sealed {
1028        pub trait Sealed {}
1029    }
1030    /// State trait tracking which required fields have been set
1031    pub trait State: sealed::Sealed {
1032        type Mode;
1033        type Size;
1034        type Name;
1035    }
1036    /// Empty state - all required fields are unset
1037    pub struct Empty(());
1038    impl sealed::Sealed for Empty {}
1039    impl State for Empty {
1040        type Mode = Unset;
1041        type Size = Unset;
1042        type Name = Unset;
1043    }
1044    ///State transition - sets the `mode` field to Set
1045    pub struct SetMode<S: State = Empty>(PhantomData<fn() -> S>);
1046    impl<S: State> sealed::Sealed for SetMode<S> {}
1047    impl<S: State> State for SetMode<S> {
1048        type Mode = Set<members::mode>;
1049        type Size = S::Size;
1050        type Name = S::Name;
1051    }
1052    ///State transition - sets the `size` field to Set
1053    pub struct SetSize<S: State = Empty>(PhantomData<fn() -> S>);
1054    impl<S: State> sealed::Sealed for SetSize<S> {}
1055    impl<S: State> State for SetSize<S> {
1056        type Mode = S::Mode;
1057        type Size = Set<members::size>;
1058        type Name = S::Name;
1059    }
1060    ///State transition - sets the `name` field to Set
1061    pub struct SetName<S: State = Empty>(PhantomData<fn() -> S>);
1062    impl<S: State> sealed::Sealed for SetName<S> {}
1063    impl<S: State> State for SetName<S> {
1064        type Mode = S::Mode;
1065        type Size = S::Size;
1066        type Name = Set<members::name>;
1067    }
1068    /// Marker types for field names
1069    #[allow(non_camel_case_types)]
1070    pub mod members {
1071        ///Marker type for the `mode` field
1072        pub struct mode(());
1073        ///Marker type for the `size` field
1074        pub struct size(());
1075        ///Marker type for the `name` field
1076        pub struct name(());
1077    }
1078}
1079
1080/// Builder for constructing an instance of this type
1081pub struct TreeEntryBuilder<'a, S: tree_entry_state::State> {
1082    _state: PhantomData<fn() -> S>,
1083    _fields: (
1084        Option<get_tree::LastCommit<'a>>,
1085        Option<CowStr<'a>>,
1086        Option<CowStr<'a>>,
1087        Option<i64>,
1088    ),
1089    _lifetime: PhantomData<&'a ()>,
1090}
1091
1092impl<'a> TreeEntry<'a> {
1093    /// Create a new builder for this type
1094    pub fn new() -> TreeEntryBuilder<'a, tree_entry_state::Empty> {
1095        TreeEntryBuilder::new()
1096    }
1097}
1098
1099impl<'a> TreeEntryBuilder<'a, tree_entry_state::Empty> {
1100    /// Create a new builder with all fields unset
1101    pub fn new() -> Self {
1102        TreeEntryBuilder {
1103            _state: PhantomData,
1104            _fields: (None, None, None, None),
1105            _lifetime: PhantomData,
1106        }
1107    }
1108}
1109
1110impl<'a, S: tree_entry_state::State> TreeEntryBuilder<'a, S> {
1111    /// Set the `last_commit` field (optional)
1112    pub fn last_commit(
1113        mut self,
1114        value: impl Into<Option<get_tree::LastCommit<'a>>>,
1115    ) -> Self {
1116        self._fields.0 = value.into();
1117        self
1118    }
1119    /// Set the `last_commit` field to an Option value (optional)
1120    pub fn maybe_last_commit(mut self, value: Option<get_tree::LastCommit<'a>>) -> Self {
1121        self._fields.0 = value;
1122        self
1123    }
1124}
1125
1126impl<'a, S> TreeEntryBuilder<'a, S>
1127where
1128    S: tree_entry_state::State,
1129    S::Mode: tree_entry_state::IsUnset,
1130{
1131    /// Set the `mode` field (required)
1132    pub fn mode(
1133        mut self,
1134        value: impl Into<CowStr<'a>>,
1135    ) -> TreeEntryBuilder<'a, tree_entry_state::SetMode<S>> {
1136        self._fields.1 = Option::Some(value.into());
1137        TreeEntryBuilder {
1138            _state: PhantomData,
1139            _fields: self._fields,
1140            _lifetime: PhantomData,
1141        }
1142    }
1143}
1144
1145impl<'a, S> TreeEntryBuilder<'a, S>
1146where
1147    S: tree_entry_state::State,
1148    S::Name: tree_entry_state::IsUnset,
1149{
1150    /// Set the `name` field (required)
1151    pub fn name(
1152        mut self,
1153        value: impl Into<CowStr<'a>>,
1154    ) -> TreeEntryBuilder<'a, tree_entry_state::SetName<S>> {
1155        self._fields.2 = Option::Some(value.into());
1156        TreeEntryBuilder {
1157            _state: PhantomData,
1158            _fields: self._fields,
1159            _lifetime: PhantomData,
1160        }
1161    }
1162}
1163
1164impl<'a, S> TreeEntryBuilder<'a, S>
1165where
1166    S: tree_entry_state::State,
1167    S::Size: tree_entry_state::IsUnset,
1168{
1169    /// Set the `size` field (required)
1170    pub fn size(
1171        mut self,
1172        value: impl Into<i64>,
1173    ) -> TreeEntryBuilder<'a, tree_entry_state::SetSize<S>> {
1174        self._fields.3 = Option::Some(value.into());
1175        TreeEntryBuilder {
1176            _state: PhantomData,
1177            _fields: self._fields,
1178            _lifetime: PhantomData,
1179        }
1180    }
1181}
1182
1183impl<'a, S> TreeEntryBuilder<'a, S>
1184where
1185    S: tree_entry_state::State,
1186    S::Mode: tree_entry_state::IsSet,
1187    S::Size: tree_entry_state::IsSet,
1188    S::Name: tree_entry_state::IsSet,
1189{
1190    /// Build the final struct
1191    pub fn build(self) -> TreeEntry<'a> {
1192        TreeEntry {
1193            last_commit: self._fields.0,
1194            mode: self._fields.1.unwrap(),
1195            name: self._fields.2.unwrap(),
1196            size: self._fields.3.unwrap(),
1197            extra_data: Default::default(),
1198        }
1199    }
1200    /// Build the final struct with custom extra_data
1201    pub fn build_with_data(
1202        self,
1203        extra_data: BTreeMap<
1204            jacquard_common::deps::smol_str::SmolStr,
1205            jacquard_common::types::value::Data<'a>,
1206        >,
1207    ) -> TreeEntry<'a> {
1208        TreeEntry {
1209            last_commit: self._fields.0,
1210            mode: self._fields.1.unwrap(),
1211            name: self._fields.2.unwrap(),
1212            size: self._fields.3.unwrap(),
1213            extra_data: Some(extra_data),
1214        }
1215    }
1216}