/*
* OneSignal
*
* A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
*
* Contact: devrel@onesignal.com
* Generated by: https://openapi-generator.tech
*/
/// EstimateNotificationRecipientsRequest : The targeting subset of notification fields this endpoint honors. `included_segments` (or its `\"All\"` shorthand) is required. `excluded_segments`, `filters`, `include_aliases`, and `target_channel` narrow that segment-based audience further when present. Use `target_channel` to select which platforms to count. Other notification targeting fields (`include_subscription_ids` and the other raw subscription id/token fields, and the individual `isIos` / `isAndroid` / etc. platform flags) are not read by this endpoint. All non-targeting notification fields (content, delivery options, and so on) are accepted, but ignored.
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct EstimateNotificationRecipientsRequest {
/// The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] `\"All\"` is a shorthand for every subscribed user: if the array includes the string `\"All\"` and the app has no segment actually named `All`, it targets all subscribers instead of a literal segment lookup.
#[serde(rename = "included_segments", skip_serializing_if = "Option::is_none")]
pub included_segments: Option<Vec<String>>,
/// Segment that will be excluded when sending. Users in these segments will not receive a notification, even if they were included in included_segments. This targeting parameter is only compatible with included_segments. Example: [\"Active Users\", \"Inactive Users\"]
#[serde(rename = "excluded_segments", skip_serializing_if = "Option::is_none")]
pub excluded_segments: Option<Vec<String>>,
/// The OneSignal App ID for your app, which can be found in Keys & IDs.
#[serde(rename = "app_id")]
pub app_id: String,
#[serde(rename = "filters", skip_serializing_if = "Option::is_none")]
pub filters: Option<Vec<crate::models::FilterExpression>>,
/// Target specific users by aliases assigned via API. An alias can be an external_id, onesignal_id, or a custom alias. Accepts an object where keys are alias labels and values are arrays of alias IDs to include Example usage: { \"external_id\": [\"exId1\", \"extId2\"], \"internal_label\": [\"id1\", \"id2\"] } Keys must match API spellings exactly (for example the label for External ID is the string `external_id`; arbitrary keys such as camelCase variants are not aliases and may yield no recipients). Not compatible with any other targeting parameters. REQUIRED: REST API Key Authentication Limit of 2,000 entries per REST API call Note: If targeting push, email, or sms subscribers with same ids, use with target_channel to indicate you are sending a push or email or sms.
#[serde(rename = "include_aliases", skip_serializing_if = "Option::is_none")]
pub include_aliases: Option<::std::collections::HashMap<String, Vec<String>>>,
/// Which platforms to count recipients for. Selects the same default platforms Create notification would use for the channel. Individual platform flags (`isIos`, `isAndroid`, etc.) are not supported by this endpoint.
#[serde(rename = "target_channel", skip_serializing_if = "Option::is_none")]
pub target_channel: Option<TargetChannelType>,
}
impl EstimateNotificationRecipientsRequest {
/// The targeting subset of notification fields this endpoint honors. `included_segments` (or its `\"All\"` shorthand) is required. `excluded_segments`, `filters`, `include_aliases`, and `target_channel` narrow that segment-based audience further when present. Use `target_channel` to select which platforms to count. Other notification targeting fields (`include_subscription_ids` and the other raw subscription id/token fields, and the individual `isIos` / `isAndroid` / etc. platform flags) are not read by this endpoint. All non-targeting notification fields (content, delivery options, and so on) are accepted, but ignored.
pub fn new(app_id: String) -> EstimateNotificationRecipientsRequest {
EstimateNotificationRecipientsRequest {
included_segments: None,
excluded_segments: None,
app_id,
filters: None,
include_aliases: None,
target_channel: None,
}
}
}
/// Which platforms to count recipients for. Selects the same default platforms Create notification would use for the channel. Individual platform flags (`isIos`, `isAndroid`, etc.) are not supported by this endpoint.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum TargetChannelType {
#[serde(rename = "push")]
Push,
#[serde(rename = "email")]
Email,
#[serde(rename = "sms")]
Sms,
}
impl Default for TargetChannelType {
fn default() -> TargetChannelType {
Self::Push
}
}