stripe/resources/generated/
test_helpers_test_clock.rs

1// ======================================
2// This file was automatically generated.
3// ======================================
4
5use crate::ids::TestHelpersTestClockId;
6use crate::params::{Object, Timestamp};
7use serde::{Deserialize, Serialize};
8
9/// The resource representing a Stripe "TestClock".
10#[derive(Clone, Debug, Default, Deserialize, Serialize)]
11pub struct TestHelpersTestClock {
12    /// Unique identifier for the object.
13    pub id: TestHelpersTestClockId,
14
15    /// Time at which the object was created.
16    ///
17    /// Measured in seconds since the Unix epoch.
18    #[serde(skip_serializing_if = "Option::is_none")]
19    pub created: Option<Timestamp>,
20
21    // Always true for a deleted object
22    #[serde(default)]
23    pub deleted: bool,
24
25    /// Time at which this clock is scheduled to auto delete.
26    #[serde(skip_serializing_if = "Option::is_none")]
27    pub deletes_after: Option<Timestamp>,
28
29    /// Time at which all objects belonging to this clock are frozen.
30    #[serde(skip_serializing_if = "Option::is_none")]
31    pub frozen_time: Option<Timestamp>,
32
33    /// Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
34    #[serde(skip_serializing_if = "Option::is_none")]
35    pub livemode: Option<bool>,
36
37    /// The custom name supplied at creation.
38    #[serde(skip_serializing_if = "Option::is_none")]
39    pub name: Option<String>,
40
41    /// The status of the Test Clock.
42    #[serde(skip_serializing_if = "Option::is_none")]
43    pub status: Option<TestHelpersTestClockStatus>,
44}
45
46impl Object for TestHelpersTestClock {
47    type Id = TestHelpersTestClockId;
48    fn id(&self) -> Self::Id {
49        self.id.clone()
50    }
51    fn object(&self) -> &'static str {
52        "test_helpers.test_clock"
53    }
54}
55
56/// An enum representing the possible values of an `TestHelpersTestClock`'s `status` field.
57#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
58#[serde(rename_all = "snake_case")]
59pub enum TestHelpersTestClockStatus {
60    Advancing,
61    InternalFailure,
62    Ready,
63}
64
65impl TestHelpersTestClockStatus {
66    pub fn as_str(self) -> &'static str {
67        match self {
68            TestHelpersTestClockStatus::Advancing => "advancing",
69            TestHelpersTestClockStatus::InternalFailure => "internal_failure",
70            TestHelpersTestClockStatus::Ready => "ready",
71        }
72    }
73}
74
75impl AsRef<str> for TestHelpersTestClockStatus {
76    fn as_ref(&self) -> &str {
77        self.as_str()
78    }
79}
80
81impl std::fmt::Display for TestHelpersTestClockStatus {
82    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
83        self.as_str().fmt(f)
84    }
85}
86impl std::default::Default for TestHelpersTestClockStatus {
87    fn default() -> Self {
88        Self::Advancing
89    }
90}