brevo_rust/api/types/
tier.rs1pub use crate::prelude::*;
2
3#[derive(Debug, Clone, Serialize, Deserialize, Default, PartialEq, Eq, Hash)]
4pub struct Tier {
5 #[serde(rename = "accessConditions")]
7 #[serde(skip_serializing_if = "Option::is_none")]
8 pub access_conditions: Option<Vec<TierAccessConditionsItem>>,
9 #[serde(rename = "createdAt")]
10 #[serde(skip_serializing_if = "Option::is_none")]
11 #[serde(default)]
12 #[serde(with = "crate::core::flexible_datetime::offset::option")]
13 pub created_at: Option<DateTime<FixedOffset>>,
14 #[serde(rename = "groupId")]
16 #[serde(skip_serializing_if = "Option::is_none")]
17 pub group_id: Option<String>,
18 #[serde(rename = "imageRef")]
20 #[serde(skip_serializing_if = "Option::is_none")]
21 pub image_ref: Option<String>,
22 #[serde(rename = "loyaltyProgramId")]
24 #[serde(skip_serializing_if = "Option::is_none")]
25 pub loyalty_program_id: Option<String>,
26 #[serde(skip_serializing_if = "Option::is_none")]
28 pub name: Option<String>,
29 #[serde(rename = "tierId")]
31 #[serde(skip_serializing_if = "Option::is_none")]
32 pub tier_id: Option<String>,
33 #[serde(rename = "tierRewards")]
35 #[serde(skip_serializing_if = "Option::is_none")]
36 pub tier_rewards: Option<Vec<TierTierRewardsItem>>,
37 #[serde(rename = "updatedAt")]
38 #[serde(skip_serializing_if = "Option::is_none")]
39 #[serde(default)]
40 #[serde(with = "crate::core::flexible_datetime::offset::option")]
41 pub updated_at: Option<DateTime<FixedOffset>>,
42}
43
44impl Tier {
45 pub fn builder() -> TierBuilder {
46 <TierBuilder as Default>::default()
47 }
48}
49
50#[derive(Clone, PartialEq, Default, Debug)]
51#[non_exhaustive]
52pub struct TierBuilder {
53 access_conditions: Option<Vec<TierAccessConditionsItem>>,
54 created_at: Option<DateTime<FixedOffset>>,
55 group_id: Option<String>,
56 image_ref: Option<String>,
57 loyalty_program_id: Option<String>,
58 name: Option<String>,
59 tier_id: Option<String>,
60 tier_rewards: Option<Vec<TierTierRewardsItem>>,
61 updated_at: Option<DateTime<FixedOffset>>,
62}
63
64impl TierBuilder {
65 pub fn access_conditions(mut self, value: Vec<TierAccessConditionsItem>) -> Self {
66 self.access_conditions = Some(value);
67 self
68 }
69
70 pub fn created_at(mut self, value: DateTime<FixedOffset>) -> Self {
71 self.created_at = Some(value);
72 self
73 }
74
75 pub fn group_id(mut self, value: impl Into<String>) -> Self {
76 self.group_id = Some(value.into());
77 self
78 }
79
80 pub fn image_ref(mut self, value: impl Into<String>) -> Self {
81 self.image_ref = Some(value.into());
82 self
83 }
84
85 pub fn loyalty_program_id(mut self, value: impl Into<String>) -> Self {
86 self.loyalty_program_id = Some(value.into());
87 self
88 }
89
90 pub fn name(mut self, value: impl Into<String>) -> Self {
91 self.name = Some(value.into());
92 self
93 }
94
95 pub fn tier_id(mut self, value: impl Into<String>) -> Self {
96 self.tier_id = Some(value.into());
97 self
98 }
99
100 pub fn tier_rewards(mut self, value: Vec<TierTierRewardsItem>) -> Self {
101 self.tier_rewards = Some(value);
102 self
103 }
104
105 pub fn updated_at(mut self, value: DateTime<FixedOffset>) -> Self {
106 self.updated_at = Some(value);
107 self
108 }
109
110 pub fn build(self) -> Result<Tier, BuildError> {
112 Ok(Tier {
113 access_conditions: self.access_conditions,
114 created_at: self.created_at,
115 group_id: self.group_id,
116 image_ref: self.image_ref,
117 loyalty_program_id: self.loyalty_program_id,
118 name: self.name,
119 tier_id: self.tier_id,
120 tier_rewards: self.tier_rewards,
121 updated_at: self.updated_at,
122 })
123 }
124}