diff --git a/docs/BasicNotification.md b/docs/BasicNotification.md index 3f92173..dd0ca43 100644 --- a/docs/BasicNotification.md +++ b/docs/BasicNotification.md @@ -103,7 +103,7 @@ | **summary_arg_count** | **Integer** | Channel: Push Notifications Platform: iOS 12+ When using thread_id, you can also control the count of the number of notifications in the group. For example, if the group already has 12 notifications, and you send a new notification with summary_arg_count = 2, the new total will be 14 and the summary will be \"14 more notifications from summary_arg\" | [optional] | | **ios_relevance_score** | **Float** | Channel: Push Notifications Platform: iOS 15+ A score to be set per notification to indicate how it should be displayed when grouped. Use a float between 0-1. | [optional] | | **ios_interruption_level** | **String** | Channel: Push Notifications Platform: iOS 15+ Focus Modes and Interruption Levels indicate the priority and delivery timing of a notification, to \"interrupt\" the user. Can choose from options: ['active', 'passive', 'time_sensitive', 'critical']. Default is active. | [optional] | -| **email_subject** | **String** | Channel: Email Required. The subject of the email. | [optional] | +| **email_subject** | **String** | Channel: Email Required. The subject of the email. | [optional] | | **email_body** | **String** | Channel: Email Required unless template_id is set. HTML suported The body of the email you wish to send. Typically, customers include their own HTML templates here. Must include [unsubscribe_url] in an <a> tag somewhere in the email. Note: any malformed HTML content will be sent to users. Please double-check your HTML is valid. | [optional] | | **email_from_name** | **String** | Channel: Email The name the email is from. If not specified, will default to \"from name\" set in the OneSignal Dashboard Email Settings. | [optional] | | **email_from_address** | **String** | Channel: Email The email address the email is from. If not specified, will default to \"from email\" set in the OneSignal Dashboard Email Settings. | [optional] | @@ -113,6 +113,8 @@ | **include_unsubscribed** | **Boolean** | Channel: Email Default is `false`. This field is used to send transactional notifications. If set to `true`, this notification will also be sent to unsubscribed emails. If a `template_id` is provided, the `include_unsubscribed` value from the template will be inherited. If you are using a third-party ESP, this field requires the ESP's list of unsubscribed emails to be cleared. | [optional] | | **email_bcc** | **Array<String>** | Channel: Email BCC recipients for the email. Maximum 5 addresses. Only supported when the email service provider is OneSignal Email. | [optional] | | **email_sender_domain** | **String** | Channel: Email Sender domain to use for the email message. Overrides the default sender domain configured for the app. Only supported when the email service provider is OneSignal Email. | [optional] | +| **kind** | **String** | Channel: Email Set to \"warmup\" to send this as an Auto Warm Up campaign: a single campaign delivered gradually to your audience over several days, so you don't have to pace sends manually. OneSignal generates a sending schedule based on your past delivery volumes, scheduled Auto Warm Up emails, and the size of your current audience. When set, `email_warm_up` is required and describes the campaign's stages and (optionally) its scheduling strategy. `send_after` cannot be combined with `kind: \"warmup\"`. The campaign will be scheduled to begin at its first stage's `start` time. Only supported for Email notifications. | [optional] | +| **email_warm_up** | [**EmailWarmUpRequest**](EmailWarmUpRequest.md) | | [optional] | | **sms_from** | **String** | Channel: SMS Phone Number used to send SMS. Should be a registered Twilio phone number in E.164 format. | [optional] | | **sms_media_urls** | **Array<String>** | Channel: SMS URLs for the media files to be attached to the SMS content. Limit: 10 media urls with a total max. size of 5MBs. | [optional] | | **filters** | [**Array<FilterExpression>**](FilterExpression.md) | | [optional] | @@ -238,6 +240,8 @@ instance = OneSignal::BasicNotification.new( include_unsubscribed: nil, email_bcc: nil, email_sender_domain: nil, + kind: nil, + email_warm_up: nil, sms_from: nil, sms_media_urls: nil, filters: nil, diff --git a/docs/BasicNotificationAllOf.md b/docs/BasicNotificationAllOf.md index 0242a87..3456a39 100644 --- a/docs/BasicNotificationAllOf.md +++ b/docs/BasicNotificationAllOf.md @@ -89,7 +89,7 @@ | **summary_arg_count** | **Integer** | Channel: Push Notifications Platform: iOS 12+ When using thread_id, you can also control the count of the number of notifications in the group. For example, if the group already has 12 notifications, and you send a new notification with summary_arg_count = 2, the new total will be 14 and the summary will be \"14 more notifications from summary_arg\" | [optional] | | **ios_relevance_score** | **Float** | Channel: Push Notifications Platform: iOS 15+ A score to be set per notification to indicate how it should be displayed when grouped. Use a float between 0-1. | [optional] | | **ios_interruption_level** | **String** | Channel: Push Notifications Platform: iOS 15+ Focus Modes and Interruption Levels indicate the priority and delivery timing of a notification, to \"interrupt\" the user. Can choose from options: ['active', 'passive', 'time_sensitive', 'critical']. Default is active. | [optional] | -| **email_subject** | **String** | Channel: Email Required. The subject of the email. | [optional] | +| **email_subject** | **String** | Channel: Email Required. The subject of the email. | [optional] | | **email_body** | **String** | Channel: Email Required unless template_id is set. HTML suported The body of the email you wish to send. Typically, customers include their own HTML templates here. Must include [unsubscribe_url] in an <a> tag somewhere in the email. Note: any malformed HTML content will be sent to users. Please double-check your HTML is valid. | [optional] | | **email_from_name** | **String** | Channel: Email The name the email is from. If not specified, will default to \"from name\" set in the OneSignal Dashboard Email Settings. | [optional] | | **email_from_address** | **String** | Channel: Email The email address the email is from. If not specified, will default to \"from email\" set in the OneSignal Dashboard Email Settings. | [optional] | @@ -99,6 +99,8 @@ | **include_unsubscribed** | **Boolean** | Channel: Email Default is `false`. This field is used to send transactional notifications. If set to `true`, this notification will also be sent to unsubscribed emails. If a `template_id` is provided, the `include_unsubscribed` value from the template will be inherited. If you are using a third-party ESP, this field requires the ESP's list of unsubscribed emails to be cleared. | [optional] | | **email_bcc** | **Array<String>** | Channel: Email BCC recipients for the email. Maximum 5 addresses. Only supported when the email service provider is OneSignal Email. | [optional] | | **email_sender_domain** | **String** | Channel: Email Sender domain to use for the email message. Overrides the default sender domain configured for the app. Only supported when the email service provider is OneSignal Email. | [optional] | +| **kind** | **String** | Channel: Email Set to \"warmup\" to send this as an Auto Warm Up campaign: a single campaign delivered gradually to your audience over several days, so you don't have to pace sends manually. OneSignal generates a sending schedule based on your past delivery volumes, scheduled Auto Warm Up emails, and the size of your current audience. When set, `email_warm_up` is required and describes the campaign's stages and (optionally) its scheduling strategy. `send_after` cannot be combined with `kind: \"warmup\"`. The campaign will be scheduled to begin at its first stage's `start` time. Only supported for Email notifications. | [optional] | +| **email_warm_up** | [**EmailWarmUpRequest**](EmailWarmUpRequest.md) | | [optional] | | **sms_from** | **String** | Channel: SMS Phone Number used to send SMS. Should be a registered Twilio phone number in E.164 format. | [optional] | | **sms_media_urls** | **Array<String>** | Channel: SMS URLs for the media files to be attached to the SMS content. Limit: 10 media urls with a total max. size of 5MBs. | [optional] | | **filters** | [**Array<FilterExpression>**](FilterExpression.md) | | [optional] | @@ -210,6 +212,8 @@ instance = OneSignal::BasicNotificationAllOf.new( include_unsubscribed: nil, email_bcc: nil, email_sender_domain: nil, + kind: nil, + email_warm_up: nil, sms_from: nil, sms_media_urls: nil, filters: nil, diff --git a/docs/EmailWarmUp.md b/docs/EmailWarmUp.md new file mode 100644 index 0000000..76a7d7c --- /dev/null +++ b/docs/EmailWarmUp.md @@ -0,0 +1,24 @@ +# OneSignal::EmailWarmUp + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **stages** | [**Array<EmailWarmUpStage>**](EmailWarmUpStage.md) | The campaign's sending schedule, stage by stage. | [optional] | +| **strategy** | **String** | How the stage schedule was produced: * `recommended` - OneSignal generated (and may still adjust) the schedule based on past delivery volumes, scheduled Auto Warm Up emails, and the size of the current audience. * `custom` - The stages were provided as-is in the create request. | [optional] | +| **status** | **String** | Current status of the campaign: * `initializing` - The stages have been submitted and the schedule is being set up. * `draft` - The campaign has been created but has not started sending. * `active` - The campaign is currently working through its stages. * `finished` - All stages have completed. * `canceled` - The campaign was canceled before finishing. | [optional] | +| **is_live** | **Boolean** | Whether the campaign is currently live (actively sending). | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::EmailWarmUp.new( + stages: nil, + strategy: nil, + status: nil, + is_live: nil +) +``` + diff --git a/docs/EmailWarmUpRequest.md b/docs/EmailWarmUpRequest.md new file mode 100644 index 0000000..10abbb7 --- /dev/null +++ b/docs/EmailWarmUpRequest.md @@ -0,0 +1,20 @@ +# OneSignal::EmailWarmUpRequest + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **stages** | [**Array<EmailWarmUpStage>**](EmailWarmUpStage.md) | Required. The ordered stages that make up the campaign's sending schedule. | | +| **strategy** | **String** | How the stage schedule should be treated: * `recommended` - (Default) OneSignal may adjust the provided stages based on past delivery volumes, scheduled Auto Warm Up emails, and the size of the current audience. * `custom` - The stages provided are sent as-is. | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::EmailWarmUpRequest.new( + stages: nil, + strategy: nil +) +``` + diff --git a/docs/EmailWarmUpStage.md b/docs/EmailWarmUpStage.md new file mode 100644 index 0000000..9a4c4fb --- /dev/null +++ b/docs/EmailWarmUpStage.md @@ -0,0 +1,24 @@ +# OneSignal::EmailWarmUpStage + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **start** | **Time** | ISO 8601 timestamp for the start of this stage. Sending for this stage will not begin before this time. | | +| **_end** | **Time** | ISO 8601 timestamp for the end of this stage. This stage's quota is expected to be sent by this time. | | +| **quota** | **Integer** | Number of emails to send during this stage. | | +| **acked** | **Boolean** | Whether this stage has been picked up and acknowledged by the warm-up scheduler. Not accepted on create. This is only present when reading back a campaign. | [optional][readonly] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::EmailWarmUpStage.new( + start: nil, + _end: nil, + quota: nil, + acked: nil +) +``` + diff --git a/docs/Notification.md b/docs/Notification.md index 44fbfe4..f91b951 100644 --- a/docs/Notification.md +++ b/docs/Notification.md @@ -103,7 +103,7 @@ | **summary_arg_count** | **Integer** | Channel: Push Notifications Platform: iOS 12+ When using thread_id, you can also control the count of the number of notifications in the group. For example, if the group already has 12 notifications, and you send a new notification with summary_arg_count = 2, the new total will be 14 and the summary will be \"14 more notifications from summary_arg\" | [optional] | | **ios_relevance_score** | **Float** | Channel: Push Notifications Platform: iOS 15+ A score to be set per notification to indicate how it should be displayed when grouped. Use a float between 0-1. | [optional] | | **ios_interruption_level** | **String** | Channel: Push Notifications Platform: iOS 15+ Focus Modes and Interruption Levels indicate the priority and delivery timing of a notification, to \"interrupt\" the user. Can choose from options: ['active', 'passive', 'time_sensitive', 'critical']. Default is active. | [optional] | -| **email_subject** | **String** | Channel: Email Required. The subject of the email. | [optional] | +| **email_subject** | **String** | Channel: Email Required. The subject of the email. | [optional] | | **email_body** | **String** | Channel: Email Required unless template_id is set. HTML suported The body of the email you wish to send. Typically, customers include their own HTML templates here. Must include [unsubscribe_url] in an <a> tag somewhere in the email. Note: any malformed HTML content will be sent to users. Please double-check your HTML is valid. | [optional] | | **email_from_name** | **String** | Channel: Email The name the email is from. If not specified, will default to \"from name\" set in the OneSignal Dashboard Email Settings. | [optional] | | **email_from_address** | **String** | Channel: Email The email address the email is from. If not specified, will default to \"from email\" set in the OneSignal Dashboard Email Settings. | [optional] | @@ -113,6 +113,8 @@ | **include_unsubscribed** | **Boolean** | Channel: Email Default is `false`. This field is used to send transactional notifications. If set to `true`, this notification will also be sent to unsubscribed emails. If a `template_id` is provided, the `include_unsubscribed` value from the template will be inherited. If you are using a third-party ESP, this field requires the ESP's list of unsubscribed emails to be cleared. | [optional] | | **email_bcc** | **Array<String>** | Channel: Email BCC recipients for the email. Maximum 5 addresses. Only supported when the email service provider is OneSignal Email. | [optional] | | **email_sender_domain** | **String** | Channel: Email Sender domain to use for the email message. Overrides the default sender domain configured for the app. Only supported when the email service provider is OneSignal Email. | [optional] | +| **kind** | **String** | Channel: Email Set to \"warmup\" to send this as an Auto Warm Up campaign: a single campaign delivered gradually to your audience over several days, so you don't have to pace sends manually. OneSignal generates a sending schedule based on your past delivery volumes, scheduled Auto Warm Up emails, and the size of your current audience. When set, `email_warm_up` is required and describes the campaign's stages and (optionally) its scheduling strategy. `send_after` cannot be combined with `kind: \"warmup\"`. The campaign will be scheduled to begin at its first stage's `start` time. Only supported for Email notifications. | [optional] | +| **email_warm_up** | [**EmailWarmUpRequest**](EmailWarmUpRequest.md) | | [optional] | | **sms_from** | **String** | Channel: SMS Phone Number used to send SMS. Should be a registered Twilio phone number in E.164 format. | [optional] | | **sms_media_urls** | **Array<String>** | Channel: SMS URLs for the media files to be attached to the SMS content. Limit: 10 media urls with a total max. size of 5MBs. | [optional] | | **filters** | [**Array<FilterExpression>**](FilterExpression.md) | | [optional] | @@ -239,6 +241,8 @@ instance = OneSignal::Notification.new( include_unsubscribed: nil, email_bcc: nil, email_sender_domain: nil, + kind: nil, + email_warm_up: nil, sms_from: nil, sms_media_urls: nil, filters: nil, diff --git a/docs/NotificationWithMeta.md b/docs/NotificationWithMeta.md index ed9dade..729d8e3 100644 --- a/docs/NotificationWithMeta.md +++ b/docs/NotificationWithMeta.md @@ -103,7 +103,7 @@ | **summary_arg_count** | **Integer** | Channel: Push Notifications Platform: iOS 12+ When using thread_id, you can also control the count of the number of notifications in the group. For example, if the group already has 12 notifications, and you send a new notification with summary_arg_count = 2, the new total will be 14 and the summary will be \"14 more notifications from summary_arg\" | [optional] | | **ios_relevance_score** | **Float** | Channel: Push Notifications Platform: iOS 15+ A score to be set per notification to indicate how it should be displayed when grouped. Use a float between 0-1. | [optional] | | **ios_interruption_level** | **String** | Channel: Push Notifications Platform: iOS 15+ Focus Modes and Interruption Levels indicate the priority and delivery timing of a notification, to \"interrupt\" the user. Can choose from options: ['active', 'passive', 'time_sensitive', 'critical']. Default is active. | [optional] | -| **email_subject** | **String** | Channel: Email Required. The subject of the email. | [optional] | +| **email_subject** | **String** | Channel: Email Required. The subject of the email. | [optional] | | **email_body** | **String** | Channel: Email Required unless template_id is set. HTML suported The body of the email you wish to send. Typically, customers include their own HTML templates here. Must include [unsubscribe_url] in an <a> tag somewhere in the email. Note: any malformed HTML content will be sent to users. Please double-check your HTML is valid. | [optional] | | **email_from_name** | **String** | Channel: Email The name the email is from. If not specified, will default to \"from name\" set in the OneSignal Dashboard Email Settings. | [optional] | | **email_from_address** | **String** | Channel: Email The email address the email is from. If not specified, will default to \"from email\" set in the OneSignal Dashboard Email Settings. | [optional] | @@ -113,6 +113,8 @@ | **include_unsubscribed** | **Boolean** | Channel: Email Default is `false`. This field is used to send transactional notifications. If set to `true`, this notification will also be sent to unsubscribed emails. If a `template_id` is provided, the `include_unsubscribed` value from the template will be inherited. If you are using a third-party ESP, this field requires the ESP's list of unsubscribed emails to be cleared. | [optional] | | **email_bcc** | **Array<String>** | BCC recipients that were set on this email notification. | [optional] | | **email_sender_domain** | **String** | Channel: Email Sender domain to use for the email message. Overrides the default sender domain configured for the app. Only supported when the email service provider is OneSignal Email. | [optional] | +| **kind** | **String** | Channel: Email Set to \"warmup\" to send this as an Auto Warm Up campaign: a single campaign delivered gradually to your audience over several days, so you don't have to pace sends manually. OneSignal generates a sending schedule based on your past delivery volumes, scheduled Auto Warm Up emails, and the size of your current audience. When set, `email_warm_up` is required and describes the campaign's stages and (optionally) its scheduling strategy. `send_after` cannot be combined with `kind: \"warmup\"`. The campaign will be scheduled to begin at its first stage's `start` time. Only supported for Email notifications. | [optional] | +| **email_warm_up** | [**EmailWarmUp**](EmailWarmUp.md) | | [optional] | | **sms_from** | **String** | Channel: SMS Phone Number used to send SMS. Should be a registered Twilio phone number in E.164 format. | [optional] | | **sms_media_urls** | **Array<String>** | Channel: SMS URLs for the media files to be attached to the SMS content. Limit: 10 media urls with a total max. size of 5MBs. | [optional] | | **filters** | [**Array<FilterExpression>**](FilterExpression.md) | | [optional] | @@ -251,6 +253,8 @@ instance = OneSignal::NotificationWithMeta.new( include_unsubscribed: nil, email_bcc: nil, email_sender_domain: nil, + kind: nil, + email_warm_up: nil, sms_from: nil, sms_media_urls: nil, filters: nil, diff --git a/docs/NotificationWithMetaAllOf.md b/docs/NotificationWithMetaAllOf.md index c92a4a8..15ab4ee 100644 --- a/docs/NotificationWithMetaAllOf.md +++ b/docs/NotificationWithMetaAllOf.md @@ -18,6 +18,7 @@ | **canceled** | **Boolean** | Indicates whether the notification was canceled before it could be sent. | [optional] | | **email_bcc** | **Array<String>** | BCC recipients that were set on this email notification. | [optional] | | **bcc_sent** | **Integer** | Number of BCC copies successfully sent for this notification. | [optional] | +| **email_warm_up** | [**EmailWarmUp**](EmailWarmUp.md) | | [optional] | ## Example @@ -38,7 +39,8 @@ instance = OneSignal::NotificationWithMetaAllOf.new( throttle_rate_per_minute: nil, canceled: nil, email_bcc: nil, - bcc_sent: nil + bcc_sent: nil, + email_warm_up: nil ) ``` diff --git a/lib/onesignal.rb b/lib/onesignal.rb index b015ef0..493c7ea 100644 --- a/lib/onesignal.rb +++ b/lib/onesignal.rb @@ -42,6 +42,9 @@ require 'onesignal/models/custom_event' require 'onesignal/models/custom_events_request' require 'onesignal/models/delivery_data' +require 'onesignal/models/email_warm_up' +require 'onesignal/models/email_warm_up_request' +require 'onesignal/models/email_warm_up_stage' require 'onesignal/models/export_events_success_response' require 'onesignal/models/export_subscriptions_request_body' require 'onesignal/models/export_subscriptions_success_response' diff --git a/lib/onesignal/models/basic_notification.rb b/lib/onesignal/models/basic_notification.rb index 0c01c05..7d10293 100644 --- a/lib/onesignal/models/basic_notification.rb +++ b/lib/onesignal/models/basic_notification.rb @@ -303,7 +303,7 @@ class BasicNotification # Channel: Push Notifications Platform: iOS 15+ Focus Modes and Interruption Levels indicate the priority and delivery timing of a notification, to \"interrupt\" the user. Can choose from options: ['active', 'passive', 'time_sensitive', 'critical']. Default is active. attr_accessor :ios_interruption_level - # Channel: Email Required. The subject of the email. + # Channel: Email Required. The subject of the email. attr_accessor :email_subject # Channel: Email Required unless template_id is set. HTML suported The body of the email you wish to send. Typically, customers include their own HTML templates here. Must include [unsubscribe_url] in an tag somewhere in the email. Note: any malformed HTML content will be sent to users. Please double-check your HTML is valid. @@ -333,6 +333,11 @@ class BasicNotification # Channel: Email Sender domain to use for the email message. Overrides the default sender domain configured for the app. Only supported when the email service provider is OneSignal Email. attr_accessor :email_sender_domain + # Channel: Email Set to \"warmup\" to send this as an Auto Warm Up campaign: a single campaign delivered gradually to your audience over several days, so you don't have to pace sends manually. OneSignal generates a sending schedule based on your past delivery volumes, scheduled Auto Warm Up emails, and the size of your current audience. When set, `email_warm_up` is required and describes the campaign's stages and (optionally) its scheduling strategy. `send_after` cannot be combined with `kind: \"warmup\"`. The campaign will be scheduled to begin at its first stage's `start` time. Only supported for Email notifications. + attr_accessor :kind + + attr_accessor :email_warm_up + # Channel: SMS Phone Number used to send SMS. Should be a registered Twilio phone number in E.164 format. attr_accessor :sms_from @@ -493,6 +498,8 @@ def self.attribute_map :'include_unsubscribed' => :'include_unsubscribed', :'email_bcc' => :'email_bcc', :'email_sender_domain' => :'email_sender_domain', + :'kind' => :'kind', + :'email_warm_up' => :'email_warm_up', :'sms_from' => :'sms_from', :'sms_media_urls' => :'sms_media_urls', :'filters' => :'filters', @@ -622,6 +629,8 @@ def self.openapi_types :'include_unsubscribed' => :'Boolean', :'email_bcc' => :'Array', :'email_sender_domain' => :'String', + :'kind' => :'String', + :'email_warm_up' => :'EmailWarmUpRequest', :'sms_from' => :'String', :'sms_media_urls' => :'Array', :'filters' => :'Array', @@ -723,6 +732,8 @@ def self.openapi_nullable :'include_unsubscribed', :'email_bcc', :'email_sender_domain', + :'kind', + :'email_warm_up', :'sms_from', :'sms_media_urls', :'filters', @@ -1226,6 +1237,14 @@ def initialize(attributes = {}) self.email_sender_domain = attributes[:'email_sender_domain'] end + if attributes.key?(:'kind') + self.kind = attributes[:'kind'] + end + + if attributes.key?(:'email_warm_up') + self.email_warm_up = attributes[:'email_warm_up'] + end + if attributes.key?(:'sms_from') self.sms_from = attributes[:'sms_from'] end @@ -1291,6 +1310,8 @@ def valid? return false unless aggregation_validator.valid?(@aggregation) return false if @app_id.nil? return false if !@email_bcc.nil? && @email_bcc.length > 5 + kind_validator = EnumAttributeValidator.new('String', ["warmup"]) + return false unless kind_validator.valid?(@kind) huawei_category_validator = EnumAttributeValidator.new('String', ["IM", "VOIP", "SUBSCRIPTION", "TRAVEL", "HEALTH", "WORK", "ACCOUNT", "EXPRESS", "FINANCE", "DEVICE_REMINDER", "MAIL", "MARKETING"]) return false unless huawei_category_validator.valid?(@huawei_category) true @@ -1326,6 +1347,16 @@ def email_bcc=(email_bcc) @email_bcc = email_bcc end + # Custom attribute writer method checking allowed values (enum). + # @param [Object] kind Object to be assigned + def kind=(kind) + validator = EnumAttributeValidator.new('String', ["warmup"]) + unless validator.valid?(kind) + fail ArgumentError, "invalid value for \"kind\", must be one of #{validator.allowable_values}." + end + @kind = kind + end + # Custom attribute writer method checking allowed values (enum). # @param [Object] huawei_category Object to be assigned def huawei_category=(huawei_category) @@ -1450,6 +1481,8 @@ def ==(o) include_unsubscribed == o.include_unsubscribed && email_bcc == o.email_bcc && email_sender_domain == o.email_sender_domain && + kind == o.kind && + email_warm_up == o.email_warm_up && sms_from == o.sms_from && sms_media_urls == o.sms_media_urls && filters == o.filters && @@ -1470,7 +1503,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [included_segments, excluded_segments, include_subscription_ids, include_email_tokens, email_to, include_phone_numbers, include_ios_tokens, include_wp_wns_uris, include_amazon_reg_ids, include_chrome_reg_ids, include_chrome_web_reg_ids, include_android_reg_ids, include_aliases, target_channel, id, value, name, aggregation, is_ios, is_android, is_huawei, is_any_web, is_chrome_web, is_firefox, is_safari, is_wp_wns, is_adm, is_chrome, app_id, external_id, idempotency_key, contents, headings, subtitle, data, huawei_msg_type, url, web_url, app_url, ios_attachments, template_id, content_available, mutable_content, target_content_identifier, big_picture, global_image, huawei_big_picture, adm_big_picture, chrome_big_picture, chrome_web_image, buttons, web_buttons, ios_category, android_channel_id, huawei_channel_id, existing_android_channel_id, huawei_existing_channel_id, android_background_layout, small_icon, huawei_small_icon, large_icon, huawei_large_icon, adm_small_icon, adm_large_icon, chrome_web_icon, chrome_web_badge, firefox_icon, chrome_icon, ios_sound, android_sound, huawei_sound, adm_sound, wp_wns_sound, android_led_color, huawei_led_color, android_accent_color, huawei_accent_color, android_visibility, huawei_visibility, ios_badge_type, ios_badge_count, collapse_id, web_push_topic, apns_alert, delayed_option, delivery_time_of_day, ttl, priority, apns_push_type_override, throttle_rate_per_minute, android_group, android_group_message, adm_group, adm_group_message, thread_id, summary_arg, summary_arg_count, ios_relevance_score, ios_interruption_level, email_subject, email_body, email_from_name, email_from_address, email_reply_to_address, email_preheader, disable_email_click_tracking, include_unsubscribed, email_bcc, email_sender_domain, sms_from, sms_media_urls, filters, custom_data, huawei_badge_class, huawei_badge_add_num, huawei_badge_set_num, huawei_category, huawei_bi_tag].hash + [included_segments, excluded_segments, include_subscription_ids, include_email_tokens, email_to, include_phone_numbers, include_ios_tokens, include_wp_wns_uris, include_amazon_reg_ids, include_chrome_reg_ids, include_chrome_web_reg_ids, include_android_reg_ids, include_aliases, target_channel, id, value, name, aggregation, is_ios, is_android, is_huawei, is_any_web, is_chrome_web, is_firefox, is_safari, is_wp_wns, is_adm, is_chrome, app_id, external_id, idempotency_key, contents, headings, subtitle, data, huawei_msg_type, url, web_url, app_url, ios_attachments, template_id, content_available, mutable_content, target_content_identifier, big_picture, global_image, huawei_big_picture, adm_big_picture, chrome_big_picture, chrome_web_image, buttons, web_buttons, ios_category, android_channel_id, huawei_channel_id, existing_android_channel_id, huawei_existing_channel_id, android_background_layout, small_icon, huawei_small_icon, large_icon, huawei_large_icon, adm_small_icon, adm_large_icon, chrome_web_icon, chrome_web_badge, firefox_icon, chrome_icon, ios_sound, android_sound, huawei_sound, adm_sound, wp_wns_sound, android_led_color, huawei_led_color, android_accent_color, huawei_accent_color, android_visibility, huawei_visibility, ios_badge_type, ios_badge_count, collapse_id, web_push_topic, apns_alert, delayed_option, delivery_time_of_day, ttl, priority, apns_push_type_override, throttle_rate_per_minute, android_group, android_group_message, adm_group, adm_group_message, thread_id, summary_arg, summary_arg_count, ios_relevance_score, ios_interruption_level, email_subject, email_body, email_from_name, email_from_address, email_reply_to_address, email_preheader, disable_email_click_tracking, include_unsubscribed, email_bcc, email_sender_domain, kind, email_warm_up, sms_from, sms_media_urls, filters, custom_data, huawei_badge_class, huawei_badge_add_num, huawei_badge_set_num, huawei_category, huawei_bi_tag].hash end # Builds the object from hash diff --git a/lib/onesignal/models/basic_notification_all_of.rb b/lib/onesignal/models/basic_notification_all_of.rb index 43c6fbc..ef9aa85 100644 --- a/lib/onesignal/models/basic_notification_all_of.rb +++ b/lib/onesignal/models/basic_notification_all_of.rb @@ -262,7 +262,7 @@ class BasicNotificationAllOf # Channel: Push Notifications Platform: iOS 15+ Focus Modes and Interruption Levels indicate the priority and delivery timing of a notification, to \"interrupt\" the user. Can choose from options: ['active', 'passive', 'time_sensitive', 'critical']. Default is active. attr_accessor :ios_interruption_level - # Channel: Email Required. The subject of the email. + # Channel: Email Required. The subject of the email. attr_accessor :email_subject # Channel: Email Required unless template_id is set. HTML suported The body of the email you wish to send. Typically, customers include their own HTML templates here. Must include [unsubscribe_url] in an tag somewhere in the email. Note: any malformed HTML content will be sent to users. Please double-check your HTML is valid. @@ -292,6 +292,11 @@ class BasicNotificationAllOf # Channel: Email Sender domain to use for the email message. Overrides the default sender domain configured for the app. Only supported when the email service provider is OneSignal Email. attr_accessor :email_sender_domain + # Channel: Email Set to \"warmup\" to send this as an Auto Warm Up campaign: a single campaign delivered gradually to your audience over several days, so you don't have to pace sends manually. OneSignal generates a sending schedule based on your past delivery volumes, scheduled Auto Warm Up emails, and the size of your current audience. When set, `email_warm_up` is required and describes the campaign's stages and (optionally) its scheduling strategy. `send_after` cannot be combined with `kind: \"warmup\"`. The campaign will be scheduled to begin at its first stage's `start` time. Only supported for Email notifications. + attr_accessor :kind + + attr_accessor :email_warm_up + # Channel: SMS Phone Number used to send SMS. Should be a registered Twilio phone number in E.164 format. attr_accessor :sms_from @@ -438,6 +443,8 @@ def self.attribute_map :'include_unsubscribed' => :'include_unsubscribed', :'email_bcc' => :'email_bcc', :'email_sender_domain' => :'email_sender_domain', + :'kind' => :'kind', + :'email_warm_up' => :'email_warm_up', :'sms_from' => :'sms_from', :'sms_media_urls' => :'sms_media_urls', :'filters' => :'filters', @@ -553,6 +560,8 @@ def self.openapi_types :'include_unsubscribed' => :'Boolean', :'email_bcc' => :'Array', :'email_sender_domain' => :'String', + :'kind' => :'String', + :'email_warm_up' => :'EmailWarmUpRequest', :'sms_from' => :'String', :'sms_media_urls' => :'Array', :'filters' => :'Array', @@ -652,6 +661,8 @@ def self.openapi_nullable :'include_unsubscribed', :'email_bcc', :'email_sender_domain', + :'kind', + :'email_warm_up', :'sms_from', :'sms_media_urls', :'filters', @@ -1065,6 +1076,14 @@ def initialize(attributes = {}) self.email_sender_domain = attributes[:'email_sender_domain'] end + if attributes.key?(:'kind') + self.kind = attributes[:'kind'] + end + + if attributes.key?(:'email_warm_up') + self.email_warm_up = attributes[:'email_warm_up'] + end + if attributes.key?(:'sms_from') self.sms_from = attributes[:'sms_from'] end @@ -1123,6 +1142,8 @@ def valid? aggregation_validator = EnumAttributeValidator.new('String', ["sum", "count"]) return false unless aggregation_validator.valid?(@aggregation) return false if !@email_bcc.nil? && @email_bcc.length > 5 + kind_validator = EnumAttributeValidator.new('String', ["warmup"]) + return false unless kind_validator.valid?(@kind) huawei_category_validator = EnumAttributeValidator.new('String', ["IM", "VOIP", "SUBSCRIPTION", "TRAVEL", "HEALTH", "WORK", "ACCOUNT", "EXPRESS", "FINANCE", "DEVICE_REMINDER", "MAIL", "MARKETING"]) return false unless huawei_category_validator.valid?(@huawei_category) true @@ -1148,6 +1169,16 @@ def email_bcc=(email_bcc) @email_bcc = email_bcc end + # Custom attribute writer method checking allowed values (enum). + # @param [Object] kind Object to be assigned + def kind=(kind) + validator = EnumAttributeValidator.new('String', ["warmup"]) + unless validator.valid?(kind) + fail ArgumentError, "invalid value for \"kind\", must be one of #{validator.allowable_values}." + end + @kind = kind + end + # Custom attribute writer method checking allowed values (enum). # @param [Object] huawei_category Object to be assigned def huawei_category=(huawei_category) @@ -1258,6 +1289,8 @@ def ==(o) include_unsubscribed == o.include_unsubscribed && email_bcc == o.email_bcc && email_sender_domain == o.email_sender_domain && + kind == o.kind && + email_warm_up == o.email_warm_up && sms_from == o.sms_from && sms_media_urls == o.sms_media_urls && filters == o.filters && @@ -1278,7 +1311,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [id, value, name, aggregation, is_ios, is_android, is_huawei, is_any_web, is_chrome_web, is_firefox, is_safari, is_wp_wns, is_adm, is_chrome, app_id, external_id, idempotency_key, contents, headings, subtitle, data, huawei_msg_type, url, web_url, app_url, ios_attachments, template_id, content_available, mutable_content, target_content_identifier, big_picture, global_image, huawei_big_picture, adm_big_picture, chrome_big_picture, chrome_web_image, buttons, web_buttons, ios_category, android_channel_id, huawei_channel_id, existing_android_channel_id, huawei_existing_channel_id, android_background_layout, small_icon, huawei_small_icon, large_icon, huawei_large_icon, adm_small_icon, adm_large_icon, chrome_web_icon, chrome_web_badge, firefox_icon, chrome_icon, ios_sound, android_sound, huawei_sound, adm_sound, wp_wns_sound, android_led_color, huawei_led_color, android_accent_color, huawei_accent_color, android_visibility, huawei_visibility, ios_badge_type, ios_badge_count, collapse_id, web_push_topic, apns_alert, delayed_option, delivery_time_of_day, ttl, priority, apns_push_type_override, throttle_rate_per_minute, android_group, android_group_message, adm_group, adm_group_message, thread_id, summary_arg, summary_arg_count, ios_relevance_score, ios_interruption_level, email_subject, email_body, email_from_name, email_from_address, email_reply_to_address, email_preheader, disable_email_click_tracking, include_unsubscribed, email_bcc, email_sender_domain, sms_from, sms_media_urls, filters, custom_data, huawei_badge_class, huawei_badge_add_num, huawei_badge_set_num, huawei_category, huawei_bi_tag].hash + [id, value, name, aggregation, is_ios, is_android, is_huawei, is_any_web, is_chrome_web, is_firefox, is_safari, is_wp_wns, is_adm, is_chrome, app_id, external_id, idempotency_key, contents, headings, subtitle, data, huawei_msg_type, url, web_url, app_url, ios_attachments, template_id, content_available, mutable_content, target_content_identifier, big_picture, global_image, huawei_big_picture, adm_big_picture, chrome_big_picture, chrome_web_image, buttons, web_buttons, ios_category, android_channel_id, huawei_channel_id, existing_android_channel_id, huawei_existing_channel_id, android_background_layout, small_icon, huawei_small_icon, large_icon, huawei_large_icon, adm_small_icon, adm_large_icon, chrome_web_icon, chrome_web_badge, firefox_icon, chrome_icon, ios_sound, android_sound, huawei_sound, adm_sound, wp_wns_sound, android_led_color, huawei_led_color, android_accent_color, huawei_accent_color, android_visibility, huawei_visibility, ios_badge_type, ios_badge_count, collapse_id, web_push_topic, apns_alert, delayed_option, delivery_time_of_day, ttl, priority, apns_push_type_override, throttle_rate_per_minute, android_group, android_group_message, adm_group, adm_group_message, thread_id, summary_arg, summary_arg_count, ios_relevance_score, ios_interruption_level, email_subject, email_body, email_from_name, email_from_address, email_reply_to_address, email_preheader, disable_email_click_tracking, include_unsubscribed, email_bcc, email_sender_domain, kind, email_warm_up, sms_from, sms_media_urls, filters, custom_data, huawei_badge_class, huawei_badge_add_num, huawei_badge_set_num, huawei_category, huawei_bi_tag].hash end # Builds the object from hash diff --git a/lib/onesignal/models/email_warm_up.rb b/lib/onesignal/models/email_warm_up.rb new file mode 100644 index 0000000..70b7849 --- /dev/null +++ b/lib/onesignal/models/email_warm_up.rb @@ -0,0 +1,298 @@ +=begin +#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 +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + # Channel: Email Present only when this notification's `kind` is \"warmup\". The Auto Warm Up campaign's stage schedule, scheduling strategy, and live status. + class EmailWarmUp + # The campaign's sending schedule, stage by stage. + attr_accessor :stages + + # How the stage schedule was produced: * `recommended` - OneSignal generated (and may still adjust) the schedule based on past delivery volumes, scheduled Auto Warm Up emails, and the size of the current audience. * `custom` - The stages were provided as-is in the create request. + attr_accessor :strategy + + # Current status of the campaign: * `initializing` - The stages have been submitted and the schedule is being set up. * `draft` - The campaign has been created but has not started sending. * `active` - The campaign is currently working through its stages. * `finished` - All stages have completed. * `canceled` - The campaign was canceled before finishing. + attr_accessor :status + + # Whether the campaign is currently live (actively sending). + attr_accessor :is_live + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'stages' => :'stages', + :'strategy' => :'strategy', + :'status' => :'status', + :'is_live' => :'is_live' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'stages' => :'Array', + :'strategy' => :'String', + :'status' => :'String', + :'is_live' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::EmailWarmUp` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::EmailWarmUp`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'stages') + if (value = attributes[:'stages']).is_a?(Array) + self.stages = value + end + end + + if attributes.key?(:'strategy') + self.strategy = attributes[:'strategy'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'is_live') + self.is_live = attributes[:'is_live'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + strategy_validator = EnumAttributeValidator.new('String', ["recommended", "custom"]) + return false unless strategy_validator.valid?(@strategy) + status_validator = EnumAttributeValidator.new('String', ["initializing", "draft", "active", "finished", "canceled"]) + return false unless status_validator.valid?(@status) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] strategy Object to be assigned + def strategy=(strategy) + validator = EnumAttributeValidator.new('String', ["recommended", "custom"]) + unless validator.valid?(strategy) + fail ArgumentError, "invalid value for \"strategy\", must be one of #{validator.allowable_values}." + end + @strategy = strategy + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] status Object to be assigned + def status=(status) + validator = EnumAttributeValidator.new('String', ["initializing", "draft", "active", "finished", "canceled"]) + unless validator.valid?(status) + fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." + end + @status = status + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + stages == o.stages && + strategy == o.strategy && + status == o.status && + is_live == o.is_live + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [stages, strategy, status, is_live].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OneSignal.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onesignal/models/email_warm_up_request.rb b/lib/onesignal/models/email_warm_up_request.rb new file mode 100644 index 0000000..7e4d516 --- /dev/null +++ b/lib/onesignal/models/email_warm_up_request.rb @@ -0,0 +1,272 @@ +=begin +#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 +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + # Channel: Email Required when `kind` is \"warmup\". The gradual sending schedule for the Auto Warm Up campaign. + class EmailWarmUpRequest + # Required. The ordered stages that make up the campaign's sending schedule. + attr_accessor :stages + + # How the stage schedule should be treated: * `recommended` - (Default) OneSignal may adjust the provided stages based on past delivery volumes, scheduled Auto Warm Up emails, and the size of the current audience. * `custom` - The stages provided are sent as-is. + attr_accessor :strategy + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'stages' => :'stages', + :'strategy' => :'strategy' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'stages' => :'Array', + :'strategy' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'strategy' + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::EmailWarmUpRequest` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::EmailWarmUpRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'stages') + if (value = attributes[:'stages']).is_a?(Array) + self.stages = value + end + end + + if attributes.key?(:'strategy') + self.strategy = attributes[:'strategy'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @stages.nil? + invalid_properties.push('invalid value for "stages", stages cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @stages.nil? + strategy_validator = EnumAttributeValidator.new('String', ["recommended", "custom"]) + return false unless strategy_validator.valid?(@strategy) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] strategy Object to be assigned + def strategy=(strategy) + validator = EnumAttributeValidator.new('String', ["recommended", "custom"]) + unless validator.valid?(strategy) + fail ArgumentError, "invalid value for \"strategy\", must be one of #{validator.allowable_values}." + end + @strategy = strategy + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + stages == o.stages && + strategy == o.strategy + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [stages, strategy].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OneSignal.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onesignal/models/email_warm_up_stage.rb b/lib/onesignal/models/email_warm_up_stage.rb new file mode 100644 index 0000000..ecd0922 --- /dev/null +++ b/lib/onesignal/models/email_warm_up_stage.rb @@ -0,0 +1,284 @@ +=begin +#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 +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + # Channel: Email One stage of an Auto Warm Up campaign's sending schedule. + class EmailWarmUpStage + # ISO 8601 timestamp for the start of this stage. Sending for this stage will not begin before this time. + attr_accessor :start + + # ISO 8601 timestamp for the end of this stage. This stage's quota is expected to be sent by this time. + attr_accessor :_end + + # Number of emails to send during this stage. + attr_accessor :quota + + # Whether this stage has been picked up and acknowledged by the warm-up scheduler. Not accepted on create. This is only present when reading back a campaign. + attr_accessor :acked + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'start' => :'start', + :'_end' => :'end', + :'quota' => :'quota', + :'acked' => :'acked' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'start' => :'Time', + :'_end' => :'Time', + :'quota' => :'Integer', + :'acked' => :'Boolean' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `OneSignal::EmailWarmUpStage` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `OneSignal::EmailWarmUpStage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'start') + self.start = attributes[:'start'] + end + + if attributes.key?(:'_end') + self._end = attributes[:'_end'] + end + + if attributes.key?(:'quota') + self.quota = attributes[:'quota'] + end + + if attributes.key?(:'acked') + self.acked = attributes[:'acked'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @start.nil? + invalid_properties.push('invalid value for "start", start cannot be nil.') + end + + if @_end.nil? + invalid_properties.push('invalid value for "_end", _end cannot be nil.') + end + + if @quota.nil? + invalid_properties.push('invalid value for "quota", quota cannot be nil.') + end + + if @quota < 0 + invalid_properties.push('invalid value for "quota", must be greater than or equal to 0.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @start.nil? + return false if @_end.nil? + return false if @quota.nil? + return false if @quota < 0 + true + end + + # Custom attribute writer method with validation + # @param [Object] quota Value to be assigned + def quota=(quota) + if quota.nil? + fail ArgumentError, 'quota cannot be nil' + end + + if quota < 0 + fail ArgumentError, 'invalid value for "quota", must be greater than or equal to 0.' + end + + @quota = quota + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + start == o.start && + _end == o._end && + quota == o.quota && + acked == o.acked + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [start, _end, quota, acked].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = OneSignal.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/onesignal/models/notification.rb b/lib/onesignal/models/notification.rb index 3850609..498ebd1 100644 --- a/lib/onesignal/models/notification.rb +++ b/lib/onesignal/models/notification.rb @@ -303,7 +303,7 @@ class Notification # Channel: Push Notifications Platform: iOS 15+ Focus Modes and Interruption Levels indicate the priority and delivery timing of a notification, to \"interrupt\" the user. Can choose from options: ['active', 'passive', 'time_sensitive', 'critical']. Default is active. attr_accessor :ios_interruption_level - # Channel: Email Required. The subject of the email. + # Channel: Email Required. The subject of the email. attr_accessor :email_subject # Channel: Email Required unless template_id is set. HTML suported The body of the email you wish to send. Typically, customers include their own HTML templates here. Must include [unsubscribe_url] in an tag somewhere in the email. Note: any malformed HTML content will be sent to users. Please double-check your HTML is valid. @@ -333,6 +333,11 @@ class Notification # Channel: Email Sender domain to use for the email message. Overrides the default sender domain configured for the app. Only supported when the email service provider is OneSignal Email. attr_accessor :email_sender_domain + # Channel: Email Set to \"warmup\" to send this as an Auto Warm Up campaign: a single campaign delivered gradually to your audience over several days, so you don't have to pace sends manually. OneSignal generates a sending schedule based on your past delivery volumes, scheduled Auto Warm Up emails, and the size of your current audience. When set, `email_warm_up` is required and describes the campaign's stages and (optionally) its scheduling strategy. `send_after` cannot be combined with `kind: \"warmup\"`. The campaign will be scheduled to begin at its first stage's `start` time. Only supported for Email notifications. + attr_accessor :kind + + attr_accessor :email_warm_up + # Channel: SMS Phone Number used to send SMS. Should be a registered Twilio phone number in E.164 format. attr_accessor :sms_from @@ -496,6 +501,8 @@ def self.attribute_map :'include_unsubscribed' => :'include_unsubscribed', :'email_bcc' => :'email_bcc', :'email_sender_domain' => :'email_sender_domain', + :'kind' => :'kind', + :'email_warm_up' => :'email_warm_up', :'sms_from' => :'sms_from', :'sms_media_urls' => :'sms_media_urls', :'filters' => :'filters', @@ -626,6 +633,8 @@ def self.openapi_types :'include_unsubscribed' => :'Boolean', :'email_bcc' => :'Array', :'email_sender_domain' => :'String', + :'kind' => :'String', + :'email_warm_up' => :'EmailWarmUpRequest', :'sms_from' => :'String', :'sms_media_urls' => :'Array', :'filters' => :'Array', @@ -728,6 +737,8 @@ def self.openapi_nullable :'include_unsubscribed', :'email_bcc', :'email_sender_domain', + :'kind', + :'email_warm_up', :'sms_from', :'sms_media_urls', :'filters', @@ -1232,6 +1243,14 @@ def initialize(attributes = {}) self.email_sender_domain = attributes[:'email_sender_domain'] end + if attributes.key?(:'kind') + self.kind = attributes[:'kind'] + end + + if attributes.key?(:'email_warm_up') + self.email_warm_up = attributes[:'email_warm_up'] + end + if attributes.key?(:'sms_from') self.sms_from = attributes[:'sms_from'] end @@ -1301,6 +1320,8 @@ def valid? return false unless aggregation_validator.valid?(@aggregation) return false if @app_id.nil? return false if !@email_bcc.nil? && @email_bcc.length > 5 + kind_validator = EnumAttributeValidator.new('String', ["warmup"]) + return false unless kind_validator.valid?(@kind) huawei_category_validator = EnumAttributeValidator.new('String', ["IM", "VOIP", "SUBSCRIPTION", "TRAVEL", "HEALTH", "WORK", "ACCOUNT", "EXPRESS", "FINANCE", "DEVICE_REMINDER", "MAIL", "MARKETING"]) return false unless huawei_category_validator.valid?(@huawei_category) true @@ -1336,6 +1357,16 @@ def email_bcc=(email_bcc) @email_bcc = email_bcc end + # Custom attribute writer method checking allowed values (enum). + # @param [Object] kind Object to be assigned + def kind=(kind) + validator = EnumAttributeValidator.new('String', ["warmup"]) + unless validator.valid?(kind) + fail ArgumentError, "invalid value for \"kind\", must be one of #{validator.allowable_values}." + end + @kind = kind + end + # Custom attribute writer method checking allowed values (enum). # @param [Object] huawei_category Object to be assigned def huawei_category=(huawei_category) @@ -1460,6 +1491,8 @@ def ==(o) include_unsubscribed == o.include_unsubscribed && email_bcc == o.email_bcc && email_sender_domain == o.email_sender_domain && + kind == o.kind && + email_warm_up == o.email_warm_up && sms_from == o.sms_from && sms_media_urls == o.sms_media_urls && filters == o.filters && @@ -1481,7 +1514,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [included_segments, excluded_segments, include_subscription_ids, include_email_tokens, email_to, include_phone_numbers, include_ios_tokens, include_wp_wns_uris, include_amazon_reg_ids, include_chrome_reg_ids, include_chrome_web_reg_ids, include_android_reg_ids, include_aliases, target_channel, id, value, name, aggregation, is_ios, is_android, is_huawei, is_any_web, is_chrome_web, is_firefox, is_safari, is_wp_wns, is_adm, is_chrome, app_id, external_id, idempotency_key, contents, headings, subtitle, data, huawei_msg_type, url, web_url, app_url, ios_attachments, template_id, content_available, mutable_content, target_content_identifier, big_picture, global_image, huawei_big_picture, adm_big_picture, chrome_big_picture, chrome_web_image, buttons, web_buttons, ios_category, android_channel_id, huawei_channel_id, existing_android_channel_id, huawei_existing_channel_id, android_background_layout, small_icon, huawei_small_icon, large_icon, huawei_large_icon, adm_small_icon, adm_large_icon, chrome_web_icon, chrome_web_badge, firefox_icon, chrome_icon, ios_sound, android_sound, huawei_sound, adm_sound, wp_wns_sound, android_led_color, huawei_led_color, android_accent_color, huawei_accent_color, android_visibility, huawei_visibility, ios_badge_type, ios_badge_count, collapse_id, web_push_topic, apns_alert, delayed_option, delivery_time_of_day, ttl, priority, apns_push_type_override, throttle_rate_per_minute, android_group, android_group_message, adm_group, adm_group_message, thread_id, summary_arg, summary_arg_count, ios_relevance_score, ios_interruption_level, email_subject, email_body, email_from_name, email_from_address, email_reply_to_address, email_preheader, disable_email_click_tracking, include_unsubscribed, email_bcc, email_sender_domain, sms_from, sms_media_urls, filters, custom_data, huawei_badge_class, huawei_badge_add_num, huawei_badge_set_num, huawei_category, huawei_bi_tag, send_after].hash + [included_segments, excluded_segments, include_subscription_ids, include_email_tokens, email_to, include_phone_numbers, include_ios_tokens, include_wp_wns_uris, include_amazon_reg_ids, include_chrome_reg_ids, include_chrome_web_reg_ids, include_android_reg_ids, include_aliases, target_channel, id, value, name, aggregation, is_ios, is_android, is_huawei, is_any_web, is_chrome_web, is_firefox, is_safari, is_wp_wns, is_adm, is_chrome, app_id, external_id, idempotency_key, contents, headings, subtitle, data, huawei_msg_type, url, web_url, app_url, ios_attachments, template_id, content_available, mutable_content, target_content_identifier, big_picture, global_image, huawei_big_picture, adm_big_picture, chrome_big_picture, chrome_web_image, buttons, web_buttons, ios_category, android_channel_id, huawei_channel_id, existing_android_channel_id, huawei_existing_channel_id, android_background_layout, small_icon, huawei_small_icon, large_icon, huawei_large_icon, adm_small_icon, adm_large_icon, chrome_web_icon, chrome_web_badge, firefox_icon, chrome_icon, ios_sound, android_sound, huawei_sound, adm_sound, wp_wns_sound, android_led_color, huawei_led_color, android_accent_color, huawei_accent_color, android_visibility, huawei_visibility, ios_badge_type, ios_badge_count, collapse_id, web_push_topic, apns_alert, delayed_option, delivery_time_of_day, ttl, priority, apns_push_type_override, throttle_rate_per_minute, android_group, android_group_message, adm_group, adm_group_message, thread_id, summary_arg, summary_arg_count, ios_relevance_score, ios_interruption_level, email_subject, email_body, email_from_name, email_from_address, email_reply_to_address, email_preheader, disable_email_click_tracking, include_unsubscribed, email_bcc, email_sender_domain, kind, email_warm_up, sms_from, sms_media_urls, filters, custom_data, huawei_badge_class, huawei_badge_add_num, huawei_badge_set_num, huawei_category, huawei_bi_tag, send_after].hash end # Builds the object from hash diff --git a/lib/onesignal/models/notification_with_meta.rb b/lib/onesignal/models/notification_with_meta.rb index 4fa210b..93553ae 100644 --- a/lib/onesignal/models/notification_with_meta.rb +++ b/lib/onesignal/models/notification_with_meta.rb @@ -303,7 +303,7 @@ class NotificationWithMeta # Channel: Push Notifications Platform: iOS 15+ Focus Modes and Interruption Levels indicate the priority and delivery timing of a notification, to \"interrupt\" the user. Can choose from options: ['active', 'passive', 'time_sensitive', 'critical']. Default is active. attr_accessor :ios_interruption_level - # Channel: Email Required. The subject of the email. + # Channel: Email Required. The subject of the email. attr_accessor :email_subject # Channel: Email Required unless template_id is set. HTML suported The body of the email you wish to send. Typically, customers include their own HTML templates here. Must include [unsubscribe_url] in an tag somewhere in the email. Note: any malformed HTML content will be sent to users. Please double-check your HTML is valid. @@ -333,6 +333,11 @@ class NotificationWithMeta # Channel: Email Sender domain to use for the email message. Overrides the default sender domain configured for the app. Only supported when the email service provider is OneSignal Email. attr_accessor :email_sender_domain + # Channel: Email Set to \"warmup\" to send this as an Auto Warm Up campaign: a single campaign delivered gradually to your audience over several days, so you don't have to pace sends manually. OneSignal generates a sending schedule based on your past delivery volumes, scheduled Auto Warm Up emails, and the size of your current audience. When set, `email_warm_up` is required and describes the campaign's stages and (optionally) its scheduling strategy. `send_after` cannot be combined with `kind: \"warmup\"`. The campaign will be scheduled to begin at its first stage's `start` time. Only supported for Email notifications. + attr_accessor :kind + + attr_accessor :email_warm_up + # Channel: SMS Phone Number used to send SMS. Should be a registered Twilio phone number in E.164 format. attr_accessor :sms_from @@ -530,6 +535,8 @@ def self.attribute_map :'include_unsubscribed' => :'include_unsubscribed', :'email_bcc' => :'email_bcc', :'email_sender_domain' => :'email_sender_domain', + :'kind' => :'kind', + :'email_warm_up' => :'email_warm_up', :'sms_from' => :'sms_from', :'sms_media_urls' => :'sms_media_urls', :'filters' => :'filters', @@ -672,6 +679,8 @@ def self.openapi_types :'include_unsubscribed' => :'Boolean', :'email_bcc' => :'Array', :'email_sender_domain' => :'String', + :'kind' => :'String', + :'email_warm_up' => :'EmailWarmUp', :'sms_from' => :'String', :'sms_media_urls' => :'Array', :'filters' => :'Array', @@ -786,6 +795,7 @@ def self.openapi_nullable :'include_unsubscribed', :'email_bcc', :'email_sender_domain', + :'kind', :'sms_from', :'sms_media_urls', :'filters', @@ -1295,6 +1305,14 @@ def initialize(attributes = {}) self.email_sender_domain = attributes[:'email_sender_domain'] end + if attributes.key?(:'kind') + self.kind = attributes[:'kind'] + end + + if attributes.key?(:'email_warm_up') + self.email_warm_up = attributes[:'email_warm_up'] + end + if attributes.key?(:'sms_from') self.sms_from = attributes[:'sms_from'] end @@ -1409,6 +1427,8 @@ def valid? aggregation_validator = EnumAttributeValidator.new('String', ["sum", "count"]) return false unless aggregation_validator.valid?(@aggregation) return false if @app_id.nil? + kind_validator = EnumAttributeValidator.new('String', ["warmup"]) + return false unless kind_validator.valid?(@kind) huawei_category_validator = EnumAttributeValidator.new('String', ["IM", "VOIP", "SUBSCRIPTION", "TRAVEL", "HEALTH", "WORK", "ACCOUNT", "EXPRESS", "FINANCE", "DEVICE_REMINDER", "MAIL", "MARKETING"]) return false unless huawei_category_validator.valid?(@huawei_category) true @@ -1434,6 +1454,16 @@ def aggregation=(aggregation) @aggregation = aggregation end + # Custom attribute writer method checking allowed values (enum). + # @param [Object] kind Object to be assigned + def kind=(kind) + validator = EnumAttributeValidator.new('String', ["warmup"]) + unless validator.valid?(kind) + fail ArgumentError, "invalid value for \"kind\", must be one of #{validator.allowable_values}." + end + @kind = kind + end + # Custom attribute writer method checking allowed values (enum). # @param [Object] huawei_category Object to be assigned def huawei_category=(huawei_category) @@ -1558,6 +1588,8 @@ def ==(o) include_unsubscribed == o.include_unsubscribed && email_bcc == o.email_bcc && email_sender_domain == o.email_sender_domain && + kind == o.kind && + email_warm_up == o.email_warm_up && sms_from == o.sms_from && sms_media_urls == o.sms_media_urls && filters == o.filters && @@ -1591,7 +1623,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [included_segments, excluded_segments, include_subscription_ids, include_email_tokens, email_to, include_phone_numbers, include_ios_tokens, include_wp_wns_uris, include_amazon_reg_ids, include_chrome_reg_ids, include_chrome_web_reg_ids, include_android_reg_ids, include_aliases, target_channel, id, value, name, aggregation, is_ios, is_android, is_huawei, is_any_web, is_chrome_web, is_firefox, is_safari, is_wp_wns, is_adm, is_chrome, app_id, external_id, idempotency_key, contents, headings, subtitle, data, huawei_msg_type, url, web_url, app_url, ios_attachments, template_id, content_available, mutable_content, target_content_identifier, big_picture, global_image, huawei_big_picture, adm_big_picture, chrome_big_picture, chrome_web_image, buttons, web_buttons, ios_category, android_channel_id, huawei_channel_id, existing_android_channel_id, huawei_existing_channel_id, android_background_layout, small_icon, huawei_small_icon, large_icon, huawei_large_icon, adm_small_icon, adm_large_icon, chrome_web_icon, chrome_web_badge, firefox_icon, chrome_icon, ios_sound, android_sound, huawei_sound, adm_sound, wp_wns_sound, android_led_color, huawei_led_color, android_accent_color, huawei_accent_color, android_visibility, huawei_visibility, ios_badge_type, ios_badge_count, collapse_id, web_push_topic, apns_alert, delayed_option, delivery_time_of_day, ttl, priority, apns_push_type_override, throttle_rate_per_minute, android_group, android_group_message, adm_group, adm_group_message, thread_id, summary_arg, summary_arg_count, ios_relevance_score, ios_interruption_level, email_subject, email_body, email_from_name, email_from_address, email_reply_to_address, email_preheader, disable_email_click_tracking, include_unsubscribed, email_bcc, email_sender_domain, sms_from, sms_media_urls, filters, custom_data, huawei_badge_class, huawei_badge_add_num, huawei_badge_set_num, huawei_category, huawei_bi_tag, successful, failed, errored, converted, received, outcomes, remaining, queued_at, send_after, completed_at, platform_delivery_stats, canceled, bcc_sent].hash + [included_segments, excluded_segments, include_subscription_ids, include_email_tokens, email_to, include_phone_numbers, include_ios_tokens, include_wp_wns_uris, include_amazon_reg_ids, include_chrome_reg_ids, include_chrome_web_reg_ids, include_android_reg_ids, include_aliases, target_channel, id, value, name, aggregation, is_ios, is_android, is_huawei, is_any_web, is_chrome_web, is_firefox, is_safari, is_wp_wns, is_adm, is_chrome, app_id, external_id, idempotency_key, contents, headings, subtitle, data, huawei_msg_type, url, web_url, app_url, ios_attachments, template_id, content_available, mutable_content, target_content_identifier, big_picture, global_image, huawei_big_picture, adm_big_picture, chrome_big_picture, chrome_web_image, buttons, web_buttons, ios_category, android_channel_id, huawei_channel_id, existing_android_channel_id, huawei_existing_channel_id, android_background_layout, small_icon, huawei_small_icon, large_icon, huawei_large_icon, adm_small_icon, adm_large_icon, chrome_web_icon, chrome_web_badge, firefox_icon, chrome_icon, ios_sound, android_sound, huawei_sound, adm_sound, wp_wns_sound, android_led_color, huawei_led_color, android_accent_color, huawei_accent_color, android_visibility, huawei_visibility, ios_badge_type, ios_badge_count, collapse_id, web_push_topic, apns_alert, delayed_option, delivery_time_of_day, ttl, priority, apns_push_type_override, throttle_rate_per_minute, android_group, android_group_message, adm_group, adm_group_message, thread_id, summary_arg, summary_arg_count, ios_relevance_score, ios_interruption_level, email_subject, email_body, email_from_name, email_from_address, email_reply_to_address, email_preheader, disable_email_click_tracking, include_unsubscribed, email_bcc, email_sender_domain, kind, email_warm_up, sms_from, sms_media_urls, filters, custom_data, huawei_badge_class, huawei_badge_add_num, huawei_badge_set_num, huawei_category, huawei_bi_tag, successful, failed, errored, converted, received, outcomes, remaining, queued_at, send_after, completed_at, platform_delivery_stats, canceled, bcc_sent].hash end # Builds the object from hash diff --git a/lib/onesignal/models/notification_with_meta_all_of.rb b/lib/onesignal/models/notification_with_meta_all_of.rb index 534d3c4..3ddc8d4 100644 --- a/lib/onesignal/models/notification_with_meta_all_of.rb +++ b/lib/onesignal/models/notification_with_meta_all_of.rb @@ -55,6 +55,8 @@ class NotificationWithMetaAllOf # Number of BCC copies successfully sent for this notification. attr_accessor :bcc_sent + attr_accessor :email_warm_up + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -71,7 +73,8 @@ def self.attribute_map :'throttle_rate_per_minute' => :'throttle_rate_per_minute', :'canceled' => :'canceled', :'email_bcc' => :'email_bcc', - :'bcc_sent' => :'bcc_sent' + :'bcc_sent' => :'bcc_sent', + :'email_warm_up' => :'email_warm_up' } end @@ -96,7 +99,8 @@ def self.openapi_types :'throttle_rate_per_minute' => :'Integer', :'canceled' => :'Boolean', :'email_bcc' => :'Array', - :'bcc_sent' => :'Integer' + :'bcc_sent' => :'Integer', + :'email_warm_up' => :'EmailWarmUp' } end @@ -108,7 +112,7 @@ def self.openapi_nullable :'received', :'throttle_rate_per_minute', :'email_bcc', - :'bcc_sent' + :'bcc_sent', ]) end @@ -184,6 +188,10 @@ def initialize(attributes = {}) if attributes.key?(:'bcc_sent') self.bcc_sent = attributes[:'bcc_sent'] end + + if attributes.key?(:'email_warm_up') + self.email_warm_up = attributes[:'email_warm_up'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -217,7 +225,8 @@ def ==(o) throttle_rate_per_minute == o.throttle_rate_per_minute && canceled == o.canceled && email_bcc == o.email_bcc && - bcc_sent == o.bcc_sent + bcc_sent == o.bcc_sent && + email_warm_up == o.email_warm_up end # @see the `==` method @@ -229,7 +238,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [remaining, successful, failed, errored, converted, queued_at, send_after, completed_at, platform_delivery_stats, received, throttle_rate_per_minute, canceled, email_bcc, bcc_sent].hash + [remaining, successful, failed, errored, converted, queued_at, send_after, completed_at, platform_delivery_stats, received, throttle_rate_per_minute, canceled, email_bcc, bcc_sent, email_warm_up].hash end # Builds the object from hash diff --git a/spec/models/basic_notification_all_of_spec.rb b/spec/models/basic_notification_all_of_spec.rb index 182a398..2d7dbbc 100644 --- a/spec/models/basic_notification_all_of_spec.rb +++ b/spec/models/basic_notification_all_of_spec.rb @@ -598,6 +598,22 @@ end end + describe 'test attribute "kind"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["warmup"]) + # validator.allowable_values.each do |value| + # expect { instance.kind = value }.not_to raise_error + # end + end + end + + describe 'test attribute "email_warm_up"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + describe 'test attribute "sms_from"' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers diff --git a/spec/models/basic_notification_spec.rb b/spec/models/basic_notification_spec.rb index dd8a045..e4cbe1c 100644 --- a/spec/models/basic_notification_spec.rb +++ b/spec/models/basic_notification_spec.rb @@ -686,6 +686,22 @@ end end + describe 'test attribute "kind"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["warmup"]) + # validator.allowable_values.each do |value| + # expect { instance.kind = value }.not_to raise_error + # end + end + end + + describe 'test attribute "email_warm_up"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + describe 'test attribute "sms_from"' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers diff --git a/spec/models/email_warm_up_request_spec.rb b/spec/models/email_warm_up_request_spec.rb new file mode 100644 index 0000000..7629ca1 --- /dev/null +++ b/spec/models/email_warm_up_request_spec.rb @@ -0,0 +1,43 @@ +=begin +#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 +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OneSignal::EmailWarmUpRequest +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OneSignal::EmailWarmUpRequest do + let(:instance) { OneSignal::EmailWarmUpRequest.new } + + describe 'test an instance of EmailWarmUpRequest' do + it 'should create an instance of EmailWarmUpRequest' do + expect(instance).to be_instance_of(OneSignal::EmailWarmUpRequest) + end + end + describe 'test attribute "stages"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "strategy"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["recommended", "custom"]) + # validator.allowable_values.each do |value| + # expect { instance.strategy = value }.not_to raise_error + # end + end + end + +end diff --git a/spec/models/email_warm_up_spec.rb b/spec/models/email_warm_up_spec.rb new file mode 100644 index 0000000..9b637be --- /dev/null +++ b/spec/models/email_warm_up_spec.rb @@ -0,0 +1,59 @@ +=begin +#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 +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OneSignal::EmailWarmUp +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OneSignal::EmailWarmUp do + let(:instance) { OneSignal::EmailWarmUp.new } + + describe 'test an instance of EmailWarmUp' do + it 'should create an instance of EmailWarmUp' do + expect(instance).to be_instance_of(OneSignal::EmailWarmUp) + end + end + describe 'test attribute "stages"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "strategy"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["recommended", "custom"]) + # validator.allowable_values.each do |value| + # expect { instance.strategy = value }.not_to raise_error + # end + end + end + + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["initializing", "draft", "active", "finished", "canceled"]) + # validator.allowable_values.each do |value| + # expect { instance.status = value }.not_to raise_error + # end + end + end + + describe 'test attribute "is_live"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/email_warm_up_stage_spec.rb b/spec/models/email_warm_up_stage_spec.rb new file mode 100644 index 0000000..2af3042 --- /dev/null +++ b/spec/models/email_warm_up_stage_spec.rb @@ -0,0 +1,51 @@ +=begin +#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 +OpenAPI Generator version: 6.0.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for OneSignal::EmailWarmUpStage +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe OneSignal::EmailWarmUpStage do + let(:instance) { OneSignal::EmailWarmUpStage.new } + + describe 'test an instance of EmailWarmUpStage' do + it 'should create an instance of EmailWarmUpStage' do + expect(instance).to be_instance_of(OneSignal::EmailWarmUpStage) + end + end + describe 'test attribute "start"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "_end"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "quota"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "acked"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/spec/models/notification_spec.rb b/spec/models/notification_spec.rb index 39555b8..07a1c9a 100644 --- a/spec/models/notification_spec.rb +++ b/spec/models/notification_spec.rb @@ -686,6 +686,22 @@ end end + describe 'test attribute "kind"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["warmup"]) + # validator.allowable_values.each do |value| + # expect { instance.kind = value }.not_to raise_error + # end + end + end + + describe 'test attribute "email_warm_up"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + describe 'test attribute "sms_from"' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers diff --git a/spec/models/notification_with_meta_all_of_spec.rb b/spec/models/notification_with_meta_all_of_spec.rb index f81f90f..115492b 100644 --- a/spec/models/notification_with_meta_all_of_spec.rb +++ b/spec/models/notification_with_meta_all_of_spec.rb @@ -108,4 +108,10 @@ end end + describe 'test attribute "email_warm_up"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + end diff --git a/spec/models/notification_with_meta_spec.rb b/spec/models/notification_with_meta_spec.rb index a56e3f9..6e3128d 100644 --- a/spec/models/notification_with_meta_spec.rb +++ b/spec/models/notification_with_meta_spec.rb @@ -686,6 +686,22 @@ end end + describe 'test attribute "kind"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["warmup"]) + # validator.allowable_values.each do |value| + # expect { instance.kind = value }.not_to raise_error + # end + end + end + + describe 'test attribute "email_warm_up"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + describe 'test attribute "sms_from"' do it 'should work' do # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers