Skip to main content

nominal_api/conjure/objects/authentication/api/
coachmark_dismissal.rs

1/// A record of a coachmark dismissal, including when it was dismissed
2/// and on which app version.
3#[derive(
4    Debug,
5    Clone,
6    conjure_object::serde::Serialize,
7    conjure_object::serde::Deserialize,
8    PartialEq,
9    Eq,
10    PartialOrd,
11    Ord,
12    Hash
13)]
14#[serde(crate = "conjure_object::serde")]
15#[conjure_object::private::staged_builder::staged_builder]
16#[builder(crate = conjure_object::private::staged_builder, update, inline)]
17pub struct CoachmarkDismissal {
18    #[builder(into)]
19    #[serde(rename = "coachmarkId")]
20    coachmark_id: String,
21    #[serde(rename = "dismissedAt")]
22    dismissed_at: conjure_object::DateTime<conjure_object::Utc>,
23    #[builder(into)]
24    #[serde(rename = "appVersion")]
25    app_version: String,
26    #[builder(default, into)]
27    #[serde(rename = "stepIndex", skip_serializing_if = "Option::is_none", default)]
28    step_index: Option<i32>,
29}
30impl CoachmarkDismissal {
31    /// Constructs a new instance of the type.
32    #[inline]
33    pub fn new(
34        coachmark_id: impl Into<String>,
35        dismissed_at: conjure_object::DateTime<conjure_object::Utc>,
36        app_version: impl Into<String>,
37    ) -> Self {
38        Self::builder()
39            .coachmark_id(coachmark_id)
40            .dismissed_at(dismissed_at)
41            .app_version(app_version)
42            .build()
43    }
44    /// The coachmark identifier (typically the feature flag name)
45    #[inline]
46    pub fn coachmark_id(&self) -> &str {
47        &*self.coachmark_id
48    }
49    /// ISO 8601 timestamp of when the coachmark was dismissed
50    #[inline]
51    pub fn dismissed_at(&self) -> conjure_object::DateTime<conjure_object::Utc> {
52        self.dismissed_at
53    }
54    /// The apps-scout version (semver) when the coachmark was dismissed
55    #[inline]
56    pub fn app_version(&self) -> &str {
57        &*self.app_version
58    }
59    /// The step index when dismissed (for multi-step coachmarks).
60    /// If not present, the coachmark was dismissed via the X button.
61    #[inline]
62    pub fn step_index(&self) -> Option<i32> {
63        self.step_index.as_ref().map(|o| *o)
64    }
65}