onesignal_rust_api/models/
update_live_activity_request.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 * The version of the OpenAPI document: 5.2.1
7 * Contact: devrel@onesignal.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12
13
14#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
15pub struct UpdateLiveActivityRequest {
16    /// An internal name to assist with your campaign organization. This does not get displayed in the message itself.
17    #[serde(rename = "name")]
18    pub name: String,
19    #[serde(rename = "event")]
20    pub event: EventType,
21    /// This must match the ContentState interface you have defined within your Live Activity in your app.
22    #[serde(rename = "event_updates")]
23    pub event_updates: serde_json::Value,
24    #[serde(rename = "contents", skip_serializing_if = "Option::is_none")]
25    pub contents: Option<Box<crate::models::LanguageStringMap>>,
26    #[serde(rename = "headings", skip_serializing_if = "Option::is_none")]
27    pub headings: Option<Box<crate::models::LanguageStringMap>>,
28    /// Sound file that is included in your app to play instead of the default device notification sound. Omit to disable vibration and sound for the notification.
29    #[serde(rename = "sound", skip_serializing_if = "Option::is_none")]
30    pub sound: Option<String>,
31    /// Accepts Unix timestamp in seconds. When time reaches the configured stale date, the system considers the Live Activity out of date, and the ActivityState of the Live Activity changes to ActivityState.stale.
32    #[serde(rename = "stale_date", skip_serializing_if = "Option::is_none")]
33    pub stale_date: Option<i32>,
34    /// Accepts Unix timestamp in seconds; only allowed if event is \"end\"
35    #[serde(rename = "dismissal_date", skip_serializing_if = "Option::is_none")]
36    pub dismissal_date: Option<i32>,
37    /// Delivery priority through the the push provider (APNs). Pass 10 for higher priority notifications, or 5 for lower priority notifications. Lower priority notifications are sent based on the power considerations of the end user's device. If not set, defaults to 10. Some providers (APNs) allow for a limited budget of high priority notifications per hour, and if that budget is exceeded, the provider may throttle notification delivery.
38    #[serde(rename = "priority", skip_serializing_if = "Option::is_none")]
39    pub priority: Option<i32>,
40}
41
42impl UpdateLiveActivityRequest {
43    pub fn new(name: String, event: EventType, event_updates: serde_json::Value) -> UpdateLiveActivityRequest {
44        UpdateLiveActivityRequest {
45            name,
46            event,
47            event_updates,
48            contents: None,
49            headings: None,
50            sound: None,
51            stale_date: None,
52            dismissal_date: None,
53            priority: None,
54        }
55    }
56}
57
58/// 
59#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
60pub enum EventType {
61    #[serde(rename = "update")]
62    Update,
63    #[serde(rename = "end")]
64    End,
65}
66
67impl Default for EventType {
68    fn default() -> EventType {
69        Self::Update
70    }
71}
72