onesignal_rust_api/models/
player.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: 1.4.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 Player {
16    /// The device's OneSignal ID
17    #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
18    pub id: Option<String>,
19    /// If true, this is the equivalent of a user being Unsubscribed
20    #[serde(rename = "invalid_identifier", skip_serializing_if = "Option::is_none")]
21    pub invalid_identifier: Option<bool>,
22    #[serde(rename = "app_id", skip_serializing_if = "Option::is_none")]
23    pub app_id: Option<String>,
24    /// Required The device's platform:   0 = iOS   1 = Android   2 = Amazon   3 = WindowsPhone (MPNS)   4 = Chrome Apps / Extensions   5 = Chrome Web Push   6 = Windows (WNS)   7 = Safari   8 = Firefox   9 = MacOS   10 = Alexa   11 = Email   13 = For Huawei App Gallery Builds SDK Setup. Not for Huawei Devices using FCM   14 = SMS 
25    #[serde(rename = "device_type")]
26    pub device_type: i32,
27    /// a custom user ID
28    #[serde(rename = "external_user_id", skip_serializing_if = "Option::is_none")]
29    pub external_user_id: Option<String>,
30    /// Only required if you have enabled Identity Verification and device_type is NOT 11 email.
31    #[serde(rename = "external_user_id_auth_hash", skip_serializing_if = "Option::is_none")]
32    pub external_user_id_auth_hash: Option<String>,
33    /// Email - Only required if you have enabled Identity Verification and device_type is email (11).
34    #[serde(rename = "email_auth_hash", skip_serializing_if = "Option::is_none")]
35    pub email_auth_hash: Option<String>,
36    /// Recommended: For Push Notifications, this is the Push Token Identifier from Google or Apple. For Apple Push identifiers, you must strip all non alphanumeric characters. Examples: iOS: 7abcd558f29d0b1f048083e2834ad8ea4b3d87d8ad9c088b33c132706ff445f0 Android: APA91bHbYHk7aq-Uam_2pyJ2qbZvqllyyh2wjfPRaw5gLEX2SUlQBRvOc6sck1sa7H7nGeLNlDco8lXj83HWWwzV... For Email Addresses, set the full email address email@email.com and make sure to set device_type to 11. 
37    #[serde(rename = "identifier", skip_serializing_if = "Option::is_none")]
38    pub identifier: Option<String>,
39    /// Language code. Typically lower case two letters, except for Chinese where it must be one of zh-Hans or zh-Hant. Example: en 
40    #[serde(rename = "language", skip_serializing_if = "Option::is_none")]
41    pub language: Option<String>,
42    /// Number of seconds away from UTC. Example: -28800 
43    #[serde(rename = "timezone", skip_serializing_if = "Option::is_none")]
44    pub timezone: Option<i32>,
45    /// Version of your app. Example: 1.1 
46    #[serde(rename = "game_version", skip_serializing_if = "Option::is_none")]
47    pub game_version: Option<String>,
48    /// Device make and model. Example: iPhone5,1 
49    #[serde(rename = "device_model", skip_serializing_if = "Option::is_none")]
50    pub device_model: Option<String>,
51    /// Device operating system version. Example: 7.0.4 
52    #[serde(rename = "device_os", skip_serializing_if = "Option::is_none")]
53    pub device_os: Option<String>,
54    /// The ad id for the device's platform: Android = Advertising Id iOS = identifierForVendor WP8.0 = DeviceUniqueId WP8.1 = AdvertisingId 
55    #[serde(rename = "ad_id", skip_serializing_if = "Option::is_none")]
56    pub ad_id: Option<String>,
57    /// Name and version of the sdk/plugin that's calling this API method (if any)
58    #[serde(rename = "sdk", skip_serializing_if = "Option::is_none")]
59    pub sdk: Option<String>,
60    /// Number of times the user has played the game, defaults to 1
61    #[serde(rename = "session_count", skip_serializing_if = "Option::is_none")]
62    pub session_count: Option<i32>,
63    /// Custom tags for the player. Only support string and integer key value pairs. Does not support arrays or other nested objects. Setting a tag value to null or an empty string will remove the tag. Example: {\"foo\":\"bar\",\"this\":\"that\"} Limitations: - 100 tags per call - Android SDK users: tags cannot be removed or changed via API if set through SDK sendTag methods. Recommended to only tag devices with 1 kilobyte of data Please consider using your own Database to save more than 1 kilobyte of data. See: Internal Database & CRM 
64    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
65    pub tags: Option<serde_json::Value>,
66    /// Amount the user has spent in USD, up to two decimal places
67    #[serde(rename = "amount_spent", skip_serializing_if = "Option::is_none")]
68    pub amount_spent: Option<f32>,
69    /// Unixtime when the player joined the game
70    #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")]
71    pub created_at: Option<i64>,
72    /// Seconds player was running your app.
73    #[serde(rename = "playtime", skip_serializing_if = "Option::is_none")]
74    pub playtime: Option<i64>,
75    /// Current iOS badge count displayed on the app icon NOTE: Not supported for apps created after June 2018, since badge count for apps created after this date are handled on the client. 
76    #[serde(rename = "badge_count", skip_serializing_if = "Option::is_none")]
77    pub badge_count: Option<i32>,
78    /// Unixtime when the player was last active
79    #[serde(rename = "last_active", skip_serializing_if = "Option::is_none")]
80    pub last_active: Option<i32>,
81    /// 1 = subscribed -2 = unsubscribed iOS - These values are set each time the user opens the app from the SDK. Use the SDK function set Subscription instead. Android - You may set this but you can no longer use the SDK method setSubscription later in your app as it will create synchronization issues. 
82    #[serde(rename = "notification_types", skip_serializing_if = "Option::is_none")]
83    pub notification_types: Option<i32>,
84    /// This is used in deciding whether to use your iOS Sandbox or Production push certificate when sending a push when both have been uploaded. Set to the iOS provisioning profile that was used to build your app. 1 = Development 2 = Ad-Hoc Omit this field for App Store builds. 
85    #[serde(rename = "test_type", skip_serializing_if = "Option::is_none")]
86    pub test_type: Option<i32>,
87    /// Longitude of the device, used for geotagging to segment on.
88    #[serde(rename = "long", skip_serializing_if = "Option::is_none")]
89    pub long: Option<f32>,
90    /// Latitude of the device, used for geotagging to segment on.
91    #[serde(rename = "lat", skip_serializing_if = "Option::is_none")]
92    pub lat: Option<f32>,
93    /// Country code in the ISO 3166-1 Alpha 2 format
94    #[serde(rename = "country", skip_serializing_if = "Option::is_none")]
95    pub country: Option<String>,
96}
97
98impl Player {
99    pub fn new(device_type: i32) -> Player {
100        Player {
101            id: None,
102            invalid_identifier: None,
103            app_id: None,
104            device_type,
105            external_user_id: None,
106            external_user_id_auth_hash: None,
107            email_auth_hash: None,
108            identifier: None,
109            language: None,
110            timezone: None,
111            game_version: None,
112            device_model: None,
113            device_os: None,
114            ad_id: None,
115            sdk: None,
116            session_count: None,
117            tags: None,
118            amount_spent: None,
119            created_at: None,
120            playtime: None,
121            badge_count: None,
122            last_active: None,
123            notification_types: None,
124            test_type: None,
125            long: None,
126            lat: None,
127            country: None,
128        }
129    }
130}
131
132