Skip to main content

onesignal_rust_api/models/
segment_details.rs

1/*
2 * OneSignal
3 *
4 * A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
5 *
6 * Contact: devrel@onesignal.com
7 * Generated by: https://openapi-generator.tech
8 */
9
10/// SegmentDetails : Segment details. Only included when the include-segment-detail query parameter is set to true.
11
12
13
14#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
15pub struct SegmentDetails {
16    /// The unique identifier for the segment (UUID v4).
17    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
18    pub id: Option<String>,
19    /// The segment name.
20    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
21    pub name: Option<String>,
22    /// Human-readable description for the segment. `null` when unset. Maximum 255 characters.
23    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
24    pub description: Option<String>,
25    /// Unix timestamp when the segment was created.
26    #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")]
27    pub created_at: Option<i32>,
28    /// The source of the segment.
29    #[serde(rename = "source", skip_serializing_if = "Option::is_none")]
30    pub source: Option<SourceType>,
31    /// Array of filter and operator objects defining the segment criteria. Uses the same format as the Create Segment API, so filters can be directly used to recreate or update the segment.
32    #[serde(rename = "filters", skip_serializing_if = "Option::is_none")]
33    pub filters: Option<Vec<crate::models::FilterExpression>>,
34}
35
36impl SegmentDetails {
37    /// Segment details. Only included when the include-segment-detail query parameter is set to true.
38    pub fn new() -> SegmentDetails {
39        SegmentDetails {
40            id: None,
41            name: None,
42            description: None,
43            created_at: None,
44            source: None,
45            filters: None,
46        }
47    }
48}
49
50/// The source of the segment.
51#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
52pub enum SourceType {
53    #[serde(rename = "default")]
54    Default,
55    #[serde(rename = "custom")]
56    Custom,
57    #[serde(rename = "quickstart")]
58    Quickstart,
59}
60
61impl Default for SourceType {
62    fn default() -> SourceType {
63        Self::Default
64    }
65}
66