Skip to main content

nominal_api/conjure/objects/scout/versioning/api/
commit.rs

1#[derive(
2    Debug,
3    Clone,
4    conjure_object::serde::Serialize,
5    conjure_object::serde::Deserialize,
6    PartialEq,
7    Eq,
8    PartialOrd,
9    Ord,
10    Hash
11)]
12#[serde(crate = "conjure_object::serde")]
13#[conjure_object::private::staged_builder::staged_builder]
14#[builder(crate = conjure_object::private::staged_builder, update, inline)]
15pub struct Commit {
16    #[serde(rename = "id")]
17    id: super::CommitId,
18    #[serde(rename = "resourceRid")]
19    resource_rid: conjure_object::ResourceIdentifier,
20    #[builder(default, into)]
21    #[serde(rename = "parentCommit", skip_serializing_if = "Option::is_none", default)]
22    parent_commit: Option<super::CommitId>,
23    #[builder(default, into)]
24    #[serde(
25        rename = "mergeParentCommit",
26        skip_serializing_if = "Option::is_none",
27        default
28    )]
29    merge_parent_commit: Option<super::CommitId>,
30    #[builder(into)]
31    #[serde(rename = "message")]
32    message: String,
33    #[serde(rename = "isWorkingState")]
34    is_working_state: bool,
35    #[serde(rename = "committedBy")]
36    committed_by: super::super::super::rids::api::UserRid,
37    #[serde(rename = "committedAt")]
38    committed_at: conjure_object::DateTime<conjure_object::Utc>,
39}
40impl Commit {
41    #[inline]
42    pub fn id(&self) -> &super::CommitId {
43        &self.id
44    }
45    #[inline]
46    pub fn resource_rid(&self) -> &conjure_object::ResourceIdentifier {
47        &self.resource_rid
48    }
49    #[inline]
50    pub fn parent_commit(&self) -> Option<&super::CommitId> {
51        self.parent_commit.as_ref().map(|o| &*o)
52    }
53    #[inline]
54    pub fn merge_parent_commit(&self) -> Option<&super::CommitId> {
55        self.merge_parent_commit.as_ref().map(|o| &*o)
56    }
57    #[inline]
58    pub fn message(&self) -> &str {
59        &*self.message
60    }
61    /// A working state commit is created via the `saveWorkingState` endpoint
62    /// and is non-permanent. In the future, it may be compacted and not exist.
63    #[inline]
64    pub fn is_working_state(&self) -> bool {
65        self.is_working_state
66    }
67    #[inline]
68    pub fn committed_by(&self) -> &super::super::super::rids::api::UserRid {
69        &self.committed_by
70    }
71    #[inline]
72    pub fn committed_at(&self) -> conjure_object::DateTime<conjure_object::Utc> {
73        self.committed_at
74    }
75}