From aa5a0bea2fadf3f023d76de5f1492f25af3f7d34 Mon Sep 17 00:00:00 2001 From: Rodrigo Date: Wed, 13 Oct 2021 18:04:14 -0500 Subject: [PATCH] 1.0.0 Beta 1 Release Commit --- .gitignore | 41 +- .openapi-generator-ignore | 23 + .openapi-generator/FILES | 126 ++ .openapi-generator/VERSION | 1 + .rspec | 2 + .rubocop.yml | 147 +- .travis.yml | 19 +- Gemfile | 7 +- README.md | 218 +-- Rakefile | 16 +- docs/App.md | 76 + docs/Button.md | 22 + docs/DefaultApi.md | 1394 ++++++++++++++++ docs/DeliveryData.md | 26 + docs/ExportPlayersRequestBody.md | 22 + docs/Filter.md | 24 + docs/FilterExpressions.md | 26 + docs/FilterNotificationTarget.md | 40 + docs/GetNotificationRequestBody.md | 22 + docs/InlineResponse200.md | 24 + docs/InlineResponse2001.md | 18 + docs/InlineResponse2002.md | 20 + docs/InlineResponse2003.md | 18 + docs/InlineResponse2004.md | 20 + docs/InlineResponse2005.md | 18 + docs/InlineResponse201.md | 20 + docs/InlineResponse400.md | 18 + docs/InlineResponse4001.md | 20 + docs/InlineResponse4002.md | 18 + docs/InlineResponse409.md | 20 + docs/Notification.md | 240 +++ docs/NotificationAllOf.md | 192 +++ ...otificationAllOfAndroidBackgroundLayout.md | 22 + docs/NotificationSlice.md | 24 + docs/NotificationTarget.md | 64 + docs/Operator.md | 18 + docs/OutcomeData.md | 22 + docs/PlatformDeliveryData.md | 28 + docs/Player.md | 70 + docs/PlayerNotificationTarget.md | 36 + docs/PlayerSlice.md | 24 + docs/Purchase.md | 22 + docs/Segment.md | 22 + docs/SegmentNotificationTarget.md | 20 + docs/StringMap.md | 102 ++ docs/UpdatePlayerTagsRequestBody.md | 18 + git_push.sh | 58 + lib/onesignal.rb | 84 +- lib/onesignal/api/default_api.rb | 1338 ++++++++++++++++ lib/onesignal/api_client.rb | 391 +++++ lib/onesignal/api_error.rb | 57 + lib/onesignal/configuration.rb | 242 +++ lib/onesignal/models/app.rb | 532 ++++++- lib/onesignal/models/button.rb | 241 +++ lib/onesignal/models/delivery_data.rb | 254 +++ .../models/export_players_request_body.rb | 241 +++ lib/onesignal/models/filter.rb | 293 ++++ lib/onesignal/models/filter_expressions.rb | 335 ++++ .../models/filter_notification_target.rb | 329 ++++ .../models/get_notification_request_body.rb | 272 ++++ lib/onesignal/models/inline_response200.rb | 256 +++ lib/onesignal/models/inline_response2001.rb | 218 +++ lib/onesignal/models/inline_response2002.rb | 227 +++ lib/onesignal/models/inline_response2003.rb | 218 +++ lib/onesignal/models/inline_response2004.rb | 227 +++ lib/onesignal/models/inline_response2005.rb | 218 +++ lib/onesignal/models/inline_response201.rb | 228 +++ lib/onesignal/models/inline_response400.rb | 220 +++ lib/onesignal/models/inline_response4001.rb | 229 +++ lib/onesignal/models/inline_response4002.rb | 220 +++ lib/onesignal/models/inline_response409.rb | 229 +++ lib/onesignal/models/notification.rb | 1400 ++++++++++++++++- lib/onesignal/models/notification_all_of.rb | 1124 +++++++++++++ ...cation_all_of_android_background_layout.rb | 240 +++ lib/onesignal/models/notification_slice.rb | 247 +++ lib/onesignal/models/notification_target.rb | 494 ++++++ lib/onesignal/models/operator.rb | 253 +++ lib/onesignal/models/outcome_data.rb | 285 ++++ .../models/platform_delivery_data.rb | 264 ++++ lib/onesignal/models/player.rb | 492 +++++- .../models/player_notification_target.rb | 329 ++++ lib/onesignal/models/player_slice.rb | 247 +++ lib/onesignal/models/purchase.rb | 254 +++ lib/onesignal/models/segment.rb | 251 +++ .../models/segment_notification_target.rb | 233 +++ lib/onesignal/models/string_map.rb | 644 ++++++++ .../models/update_player_tags_request_body.rb | 219 +++ lib/onesignal/version.rb | 14 +- onesignal.gemspec | 64 +- spec/api/default_api_spec.rb | 285 ++++ spec/api_client_spec.rb | 226 +++ spec/configuration_spec.rb | 42 + spec/models/app_spec.rb | 212 +++ spec/models/button_spec.rb | 46 + spec/models/delivery_data_spec.rb | 58 + .../export_players_request_body_spec.rb | 46 + spec/models/filter_expressions_spec.rb | 66 + .../models/filter_notification_target_spec.rb | 100 ++ spec/models/filter_spec.rb | 56 + .../get_notification_request_body_spec.rb | 50 + spec/models/inline_response2001_spec.rb | 34 + spec/models/inline_response2002_spec.rb | 40 + spec/models/inline_response2003_spec.rb | 34 + spec/models/inline_response2004_spec.rb | 40 + spec/models/inline_response2005_spec.rb | 34 + spec/models/inline_response200_spec.rb | 52 + spec/models/inline_response201_spec.rb | 40 + spec/models/inline_response4001_spec.rb | 40 + spec/models/inline_response4002_spec.rb | 34 + spec/models/inline_response400_spec.rb | 34 + spec/models/inline_response409_spec.rb | 40 + ...n_all_of_android_background_layout_spec.rb | 46 + spec/models/notification_all_of_spec.rb | 560 +++++++ spec/models/notification_slice_spec.rb | 52 + spec/models/notification_spec.rb | 704 +++++++++ spec/models/notification_target_spec.rb | 172 ++ spec/models/operator_spec.rb | 38 + spec/models/outcome_data_spec.rb | 50 + spec/models/platform_delivery_data_spec.rb | 64 + .../models/player_notification_target_spec.rb | 88 ++ spec/models/player_slice_spec.rb | 52 + spec/models/player_spec.rb | 190 +++ spec/models/purchase_spec.rb | 46 + .../segment_notification_target_spec.rb | 40 + spec/models/segment_spec.rb | 46 + spec/models/string_map_spec.rb | 286 ++++ .../update_player_tags_request_body_spec.rb | 34 + spec/spec_helper.rb | 111 ++ 128 files changed, 21573 insertions(+), 216 deletions(-) create mode 100644 .openapi-generator-ignore create mode 100644 .openapi-generator/FILES create mode 100644 .openapi-generator/VERSION create mode 100644 .rspec create mode 100644 docs/App.md create mode 100644 docs/Button.md create mode 100644 docs/DefaultApi.md create mode 100644 docs/DeliveryData.md create mode 100644 docs/ExportPlayersRequestBody.md create mode 100644 docs/Filter.md create mode 100644 docs/FilterExpressions.md create mode 100644 docs/FilterNotificationTarget.md create mode 100644 docs/GetNotificationRequestBody.md create mode 100644 docs/InlineResponse200.md create mode 100644 docs/InlineResponse2001.md create mode 100644 docs/InlineResponse2002.md create mode 100644 docs/InlineResponse2003.md create mode 100644 docs/InlineResponse2004.md create mode 100644 docs/InlineResponse2005.md create mode 100644 docs/InlineResponse201.md create mode 100644 docs/InlineResponse400.md create mode 100644 docs/InlineResponse4001.md create mode 100644 docs/InlineResponse4002.md create mode 100644 docs/InlineResponse409.md create mode 100644 docs/Notification.md create mode 100644 docs/NotificationAllOf.md create mode 100644 docs/NotificationAllOfAndroidBackgroundLayout.md create mode 100644 docs/NotificationSlice.md create mode 100644 docs/NotificationTarget.md create mode 100644 docs/Operator.md create mode 100644 docs/OutcomeData.md create mode 100644 docs/PlatformDeliveryData.md create mode 100644 docs/Player.md create mode 100644 docs/PlayerNotificationTarget.md create mode 100644 docs/PlayerSlice.md create mode 100644 docs/Purchase.md create mode 100644 docs/Segment.md create mode 100644 docs/SegmentNotificationTarget.md create mode 100644 docs/StringMap.md create mode 100644 docs/UpdatePlayerTagsRequestBody.md create mode 100644 git_push.sh create mode 100644 lib/onesignal/api/default_api.rb create mode 100644 lib/onesignal/api_client.rb create mode 100644 lib/onesignal/api_error.rb create mode 100644 lib/onesignal/configuration.rb create mode 100644 lib/onesignal/models/button.rb create mode 100644 lib/onesignal/models/delivery_data.rb create mode 100644 lib/onesignal/models/export_players_request_body.rb create mode 100644 lib/onesignal/models/filter.rb create mode 100644 lib/onesignal/models/filter_expressions.rb create mode 100644 lib/onesignal/models/filter_notification_target.rb create mode 100644 lib/onesignal/models/get_notification_request_body.rb create mode 100644 lib/onesignal/models/inline_response200.rb create mode 100644 lib/onesignal/models/inline_response2001.rb create mode 100644 lib/onesignal/models/inline_response2002.rb create mode 100644 lib/onesignal/models/inline_response2003.rb create mode 100644 lib/onesignal/models/inline_response2004.rb create mode 100644 lib/onesignal/models/inline_response2005.rb create mode 100644 lib/onesignal/models/inline_response201.rb create mode 100644 lib/onesignal/models/inline_response400.rb create mode 100644 lib/onesignal/models/inline_response4001.rb create mode 100644 lib/onesignal/models/inline_response4002.rb create mode 100644 lib/onesignal/models/inline_response409.rb create mode 100644 lib/onesignal/models/notification_all_of.rb create mode 100644 lib/onesignal/models/notification_all_of_android_background_layout.rb create mode 100644 lib/onesignal/models/notification_slice.rb create mode 100644 lib/onesignal/models/notification_target.rb create mode 100644 lib/onesignal/models/operator.rb create mode 100644 lib/onesignal/models/outcome_data.rb create mode 100644 lib/onesignal/models/platform_delivery_data.rb create mode 100644 lib/onesignal/models/player_notification_target.rb create mode 100644 lib/onesignal/models/player_slice.rb create mode 100644 lib/onesignal/models/purchase.rb create mode 100644 lib/onesignal/models/segment.rb create mode 100644 lib/onesignal/models/segment_notification_target.rb create mode 100644 lib/onesignal/models/string_map.rb create mode 100644 lib/onesignal/models/update_player_tags_request_body.rb create mode 100644 spec/api/default_api_spec.rb create mode 100644 spec/api_client_spec.rb create mode 100644 spec/configuration_spec.rb create mode 100644 spec/models/app_spec.rb create mode 100644 spec/models/button_spec.rb create mode 100644 spec/models/delivery_data_spec.rb create mode 100644 spec/models/export_players_request_body_spec.rb create mode 100644 spec/models/filter_expressions_spec.rb create mode 100644 spec/models/filter_notification_target_spec.rb create mode 100644 spec/models/filter_spec.rb create mode 100644 spec/models/get_notification_request_body_spec.rb create mode 100644 spec/models/inline_response2001_spec.rb create mode 100644 spec/models/inline_response2002_spec.rb create mode 100644 spec/models/inline_response2003_spec.rb create mode 100644 spec/models/inline_response2004_spec.rb create mode 100644 spec/models/inline_response2005_spec.rb create mode 100644 spec/models/inline_response200_spec.rb create mode 100644 spec/models/inline_response201_spec.rb create mode 100644 spec/models/inline_response4001_spec.rb create mode 100644 spec/models/inline_response4002_spec.rb create mode 100644 spec/models/inline_response400_spec.rb create mode 100644 spec/models/inline_response409_spec.rb create mode 100644 spec/models/notification_all_of_android_background_layout_spec.rb create mode 100644 spec/models/notification_all_of_spec.rb create mode 100644 spec/models/notification_slice_spec.rb create mode 100644 spec/models/notification_spec.rb create mode 100644 spec/models/notification_target_spec.rb create mode 100644 spec/models/operator_spec.rb create mode 100644 spec/models/outcome_data_spec.rb create mode 100644 spec/models/platform_delivery_data_spec.rb create mode 100644 spec/models/player_notification_target_spec.rb create mode 100644 spec/models/player_slice_spec.rb create mode 100644 spec/models/player_spec.rb create mode 100644 spec/models/purchase_spec.rb create mode 100644 spec/models/segment_notification_target_spec.rb create mode 100644 spec/models/segment_spec.rb create mode 100644 spec/models/string_map_spec.rb create mode 100644 spec/models/update_player_tags_request_body_spec.rb create mode 100644 spec/spec_helper.rb diff --git a/.gitignore b/.gitignore index ec9cc8f..05a17cb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,39 @@ -/.bundle/ -/.yardoc -/Gemfile.lock -/_yardoc/ +# Generated by: https://openapi-generator.tech +# + +*.gem +*.rbc +/.config /coverage/ -/doc/ +/InstalledFiles /pkg/ /spec/reports/ +/spec/examples.txt +/test/tmp/ +/test/version_tmp/ /tmp/ -test.rb \ No newline at end of file + +## Specific to RubyMotion: +.dat* +.repl_history +build/ + +## Documentation cache and generated files: +/.yardoc/ +/_yardoc/ +/doc/ +/rdoc/ + +## Environment normalization: +/.bundle/ +/vendor/bundle +/lib/bundler/man/ + +# for a library or gem, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# Gemfile.lock +# .ruby-version +# .ruby-gemset + +# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: +.rvmrc diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore new file mode 100644 index 0000000..7484ee5 --- /dev/null +++ b/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES new file mode 100644 index 0000000..a6b9bdb --- /dev/null +++ b/.openapi-generator/FILES @@ -0,0 +1,126 @@ +.gitignore +.openapi-generator-ignore +.rspec +.rubocop.yml +.travis.yml +Gemfile +README.md +Rakefile +docs/App.md +docs/Button.md +docs/DefaultApi.md +docs/DeliveryData.md +docs/ExportPlayersRequestBody.md +docs/Filter.md +docs/FilterExpressions.md +docs/FilterNotificationTarget.md +docs/GetNotificationRequestBody.md +docs/InlineResponse200.md +docs/InlineResponse2001.md +docs/InlineResponse2002.md +docs/InlineResponse2003.md +docs/InlineResponse2004.md +docs/InlineResponse2005.md +docs/InlineResponse201.md +docs/InlineResponse400.md +docs/InlineResponse4001.md +docs/InlineResponse4002.md +docs/InlineResponse409.md +docs/Notification.md +docs/NotificationAllOf.md +docs/NotificationAllOfAndroidBackgroundLayout.md +docs/NotificationSlice.md +docs/NotificationTarget.md +docs/Operator.md +docs/OutcomeData.md +docs/PlatformDeliveryData.md +docs/Player.md +docs/PlayerNotificationTarget.md +docs/PlayerSlice.md +docs/Purchase.md +docs/Segment.md +docs/SegmentNotificationTarget.md +docs/StringMap.md +docs/UpdatePlayerTagsRequestBody.md +git_push.sh +lib/onesignal.rb +lib/onesignal/api/default_api.rb +lib/onesignal/api_client.rb +lib/onesignal/api_error.rb +lib/onesignal/configuration.rb +lib/onesignal/models/app.rb +lib/onesignal/models/button.rb +lib/onesignal/models/delivery_data.rb +lib/onesignal/models/export_players_request_body.rb +lib/onesignal/models/filter.rb +lib/onesignal/models/filter_expressions.rb +lib/onesignal/models/filter_notification_target.rb +lib/onesignal/models/get_notification_request_body.rb +lib/onesignal/models/inline_response200.rb +lib/onesignal/models/inline_response2001.rb +lib/onesignal/models/inline_response2002.rb +lib/onesignal/models/inline_response2003.rb +lib/onesignal/models/inline_response2004.rb +lib/onesignal/models/inline_response2005.rb +lib/onesignal/models/inline_response201.rb +lib/onesignal/models/inline_response400.rb +lib/onesignal/models/inline_response4001.rb +lib/onesignal/models/inline_response4002.rb +lib/onesignal/models/inline_response409.rb +lib/onesignal/models/notification.rb +lib/onesignal/models/notification_all_of.rb +lib/onesignal/models/notification_all_of_android_background_layout.rb +lib/onesignal/models/notification_slice.rb +lib/onesignal/models/notification_target.rb +lib/onesignal/models/operator.rb +lib/onesignal/models/outcome_data.rb +lib/onesignal/models/platform_delivery_data.rb +lib/onesignal/models/player.rb +lib/onesignal/models/player_notification_target.rb +lib/onesignal/models/player_slice.rb +lib/onesignal/models/purchase.rb +lib/onesignal/models/segment.rb +lib/onesignal/models/segment_notification_target.rb +lib/onesignal/models/string_map.rb +lib/onesignal/models/update_player_tags_request_body.rb +lib/onesignal/version.rb +onesignal.gemspec +spec/api/default_api_spec.rb +spec/api_client_spec.rb +spec/configuration_spec.rb +spec/models/app_spec.rb +spec/models/button_spec.rb +spec/models/delivery_data_spec.rb +spec/models/export_players_request_body_spec.rb +spec/models/filter_expressions_spec.rb +spec/models/filter_notification_target_spec.rb +spec/models/filter_spec.rb +spec/models/get_notification_request_body_spec.rb +spec/models/inline_response2001_spec.rb +spec/models/inline_response2002_spec.rb +spec/models/inline_response2003_spec.rb +spec/models/inline_response2004_spec.rb +spec/models/inline_response2005_spec.rb +spec/models/inline_response200_spec.rb +spec/models/inline_response201_spec.rb +spec/models/inline_response4001_spec.rb +spec/models/inline_response4002_spec.rb +spec/models/inline_response400_spec.rb +spec/models/inline_response409_spec.rb +spec/models/notification_all_of_android_background_layout_spec.rb +spec/models/notification_all_of_spec.rb +spec/models/notification_slice_spec.rb +spec/models/notification_spec.rb +spec/models/notification_target_spec.rb +spec/models/operator_spec.rb +spec/models/outcome_data_spec.rb +spec/models/platform_delivery_data_spec.rb +spec/models/player_notification_target_spec.rb +spec/models/player_slice_spec.rb +spec/models/player_spec.rb +spec/models/purchase_spec.rb +spec/models/segment_notification_target_spec.rb +spec/models/segment_spec.rb +spec/models/string_map_spec.rb +spec/models/update_player_tags_request_body_spec.rb +spec/spec_helper.rb diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION new file mode 100644 index 0000000..6555596 --- /dev/null +++ b/.openapi-generator/VERSION @@ -0,0 +1 @@ +5.2.0-SNAPSHOT \ No newline at end of file diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..83e16f8 --- /dev/null +++ b/.rspec @@ -0,0 +1,2 @@ +--color +--require spec_helper diff --git a/.rubocop.yml b/.rubocop.yml index 0e404d2..d32b2b1 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,17 +1,148 @@ +# This file is based on https://github.com/rails/rails/blob/master/.rubocop.yml (MIT license) +# Automatically generated by OpenAPI Generator (https://openapi-generator.tech) AllCops: - TargetRubyVersion: 2.1 + TargetRubyVersion: 2.4 + # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop + # to ignore them, so only the ones explicitly set in this file are enabled. + DisabledByDefault: true + Exclude: + - '**/templates/**/*' + - '**/vendor/**/*' + - 'actionpack/lib/action_dispatch/journey/parser.rb' -ClassLength: - Enabled: false +# Prefer &&/|| over and/or. +Style/AndOr: + Enabled: true -Documentation: - Enabled: false +# Align `when` with `case`. +Layout/CaseIndentation: + Enabled: true + +# Align comments with method definitions. +Layout/CommentIndentation: + Enabled: true + +Layout/ElseAlignment: + Enabled: true + +Layout/EmptyLineAfterMagicComment: + Enabled: true + +# In a regular class definition, no empty lines around the body. +Layout/EmptyLinesAroundClassBody: + Enabled: true + +# In a regular method definition, no empty lines around the body. +Layout/EmptyLinesAroundMethodBody: + Enabled: true + +# In a regular module definition, no empty lines around the body. +Layout/EmptyLinesAroundModuleBody: + Enabled: true + +Layout/FirstArgumentIndentation: + Enabled: true -IfUnlessModifier: +# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }. +Style/HashSyntax: Enabled: false -MethodLength: +# Method definitions after `private` or `protected` isolated calls need one +# extra level of indentation. +Layout/IndentationConsistency: + Enabled: true + EnforcedStyle: indented_internal_methods + +# Two spaces, no tabs (for indentation). +Layout/IndentationWidth: + Enabled: true + +Layout/LeadingCommentSpace: + Enabled: true + +Layout/SpaceAfterColon: + Enabled: true + +Layout/SpaceAfterComma: + Enabled: true + +Layout/SpaceAroundEqualsInParameterDefault: + Enabled: true + +Layout/SpaceAroundKeyword: + Enabled: true + +Layout/SpaceAroundOperators: + Enabled: true + +Layout/SpaceBeforeComma: + Enabled: true + +Layout/SpaceBeforeFirstArg: + Enabled: true + +Style/DefWithParentheses: + Enabled: true + +# Defining a method with parameters needs parentheses. +Style/MethodDefParentheses: + Enabled: true + +Style/FrozenStringLiteralComment: Enabled: false + EnforcedStyle: always + +# Use `foo {}` not `foo{}`. +Layout/SpaceBeforeBlockBraces: + Enabled: true + +# Use `foo { bar }` not `foo {bar}`. +Layout/SpaceInsideBlockBraces: + Enabled: true + +# Use `{ a: 1 }` not `{a:1}`. +Layout/SpaceInsideHashLiteralBraces: + Enabled: true + +Layout/SpaceInsideParens: + Enabled: true -NumericLiterals: +# Check quotes usage according to lint rule below. +#Style/StringLiterals: +# Enabled: true +# EnforcedStyle: single_quotes + +# Detect hard tabs, no hard tabs. +Layout/IndentationStyle: + Enabled: true + +# Blank lines should not have any spaces. +Layout/TrailingEmptyLines: + Enabled: true + +# No trailing whitespace. +Layout/TrailingWhitespace: Enabled: false + +# Use quotes for string literals when they are enough. +Style/RedundantPercentQ: + Enabled: true + +# Align `end` with the matching keyword or starting expression except for +# assignments, where it should be aligned with the LHS. +Layout/EndAlignment: + Enabled: true + EnforcedStyleAlignWith: variable + AutoCorrect: true + +# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg. +Lint/RequireParentheses: + Enabled: true + +Style/RedundantReturn: + Enabled: true + AllowMultipleReturnValues: true + +Style/Semicolon: + Enabled: true + AllowAsExpressionSeparator: true diff --git a/.travis.yml b/.travis.yml index 518b035..636db68 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,9 @@ language: ruby cache: bundler - rvm: - - 2.0.0 - - 2.1.0 - - 2.2.0 - - 2.3.0 - -before_install: - - gem install bundler -v 1.11.2 - -notifications: - slack: - rooms: - secure: Gr8OCGVXegUFZmA0GYQnvAMs6cei1139C7sce13VvcG1HulIvpidnobJuNghfTx44psQTYDptHpz8AVn+kChbsQ46+0zXdNgCq2t9fJAVzTlTGnsB5O28FjUUEJAppjztUeRPKJX+B284AHJ0ZM/Vw7upoJ9IPbJ9bpcr5Xbms8eF/iYmJcicZ7iZNkHET8PFKqQP4H4/ahBOHfiI150zys1Pjos66wRukss1K52i6cvGmMajx58aVxDdwrw8wksNOHFu7VuoThipNHTIFyzr39EdG+DDrrfDLkLtpcb4+3QFn3/XZO7WHNfubnUY2DQ9xZrn8mUgIBFx6bVbcZ+xt/eh+4h5cDQyeEFY3GI+GiWJBDQa8VS69+CZQqEAvBNzHMPAkp19DZt0KFPEQqNG7KwXwuMx/kVsbnDhSGGN7d1Dc2m1XXVHViOUS6YePPzwjOZ3B7MTtb4FFSnsDeYvFFeBxqkX7a25L4llR9AcBMMxgCHDJi070qr3bOoQv9Qwi/Xw4P92ZLQ+VRoskzPRmbFcdfZxsI6R9orxJ1YgA/FGuQZAbmVQ3gZAWcW4iP1sgYh8EkOUH/c1c5tb03gC4OyU1R44L/FBBQiAXBCAl50PhJgCR13KrR6vxBnV/AIg+Pbk1uQPx4zqda4UbertMc+bB0M6EDV9OUPezb59Pk= + - 2.7.4 +script: + - bundle install --path vendor/bundle + - bundle exec rspec + - gem build onesignal.gemspec + - gem install ./onesignal-1.0.0.gem diff --git a/Gemfile b/Gemfile index a64092c..c2e3127 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,9 @@ source 'https://rubygems.org' -# Specify your gem's dependencies in onesignal.gemspec gemspec + +group :development, :test do + gem 'rake', '~> 13.0.1' + gem 'pry-byebug' + gem 'rubocop', '~> 0.66.0' +end diff --git a/README.md b/README.md index 832862c..32cac5f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,12 @@ -# OneSignal +# onesignal -[![Gem Version][rgb]][rgl] [![Build Status][trb]][trl] [![Code Climate][ccb]][ccl] +[![Gem Version][rgb]][rgl] + +OneSignal - the Ruby gem for the OneSignal + +A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: OneSignal is a simple ruby wrapper for the [OneSignal API][osa]. @@ -9,7 +15,7 @@ OneSignal is a simple ruby wrapper for the [OneSignal API][osa]. Add this line to your application's Gemfile: ```ruby -gem 'onesignal' +gem 'onesignal', '~> 1.0.0.beta1' ``` And then execute: @@ -18,112 +24,112 @@ And then execute: Or install it yourself as: - $ gem install onesignal - -## Usage - -You can find your auth keys and app IDs on the Account Management page when -you're logged into OneSignal. With those at hand, you can create a client. - -```ruby -client = OneSignal::Client.new(auth_token: 'AUTH_TOKEN', app_id: 'APP_ID') -``` - -### Design - -This gem follows a strict design of resources as methods on your client. For -examples, for apps, you will call your client like this: - -```ruby -client = OneSignal::Client.new(auth_token: 'AUTH_TOKEN') -client.apps #=> AppResource -``` - -It will return objects that contain the information provided by the API. For -example: - -```ruby -client = OneSignal::Client.new(auth_token: 'AUTH_TOKEN') -client.apps.all -# => [ OneSignal::App(id: '92911750-242d-4260-9e00-9d9034f139ce', name: 'Your App 1', ...), OneSignal::App(id: 'e4e87830-b954-11e3-811d-f3b376925f15', name: Your app 2', ...) ] -``` - -To retrieve objects, you can perform this type of action on the resource (if -the API supports it): - -```ruby -client = OneSignal::Client.new(auth_token: 'AUTH_TOKEN') -app = client.apps.find(id: 'e4e87830-b954-11e3-811d-f3b376925f15') -# => OneSignal::App(id: 'e4e87830-b954-11e3-811d-f3b376925f15', name: 'Your app', ...) -``` - -To create objects, you just have to build a params hash and pass it to the -action on the resource: - -```ruby -client = OneSignal::Client.new(auth_token: 'AUTH_TOKEN') -params = { name: 'Your app', apns_env: 'sandbox', ... } -app = client.apps.create(params) -# => OneSignal::App(id: 'e4e87830-b954-11e3-811d-f3b376925f15', name: 'Your app', ...) -``` - -### All Resources and actions - -#### App resource - -```ruby -client = OneSignal::Client.new(auth_token: 'AUTH_TOKEN') -client.apps #=> OneSignal::AppResource -``` - -Actions supported: + $ gem install onesignal --pre -* `client.apps.all` -* `client.apps.find(id)` -* `client.apps.create(params)` -* `client.apps.update(id, params)` +## Getting Started -#### Player resource +Please follow the [installation](#installation) procedure and then run the following code: ```ruby -client = OneSignal::Client.new(auth_token: 'AUTH_TOKEN', app_id: 'APP_ID') -client.players #=> OneSignal::PlayerResource -``` - -Actions supported: - -* `client.players.all` -* `client.players.all(params)` -* `client.players.find(id)` -* `client.players.create(params)` -* `client.players.update(id, params)` -* `client.players.on_session(id, params)` -* `client.players.on_purchase(id, params)` -* `client.players.on_focus(id, params)` -* `client.players.csv_export(id)` - -#### Notification resource +# Load the gem +require 'onesignal' + +# Setup authorization +OneSignal.configure do |config| + # Configure Bearer authorization: app_key + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = OneSignal::DefaultApi.new +app_id = 'app_id_example' # String | +notification_id = 'notification_id_example' # String | + +begin + #Stop a scheduled or currently outgoing notification + result = api_instance.cancel_notification(app_id, notification_id) + p result +rescue OneSignal::ApiError => e + puts "Exception when calling DefaultApi->cancel_notification: #{e}" +end -```ruby -client = OneSignal::Client.new(auth_token: 'AUTH_TOKEN', app_id: 'APP_ID') -client.notifications #=> OneSignal::NotificationResource ``` -Actions supported: - -* `client.notifications.all` -* `client.notifications.all(params)` -* `client.notifications.find(id)` -* `client.notifications.track_open(id, params)` -* `client.notifications.create(params)` -* `client.notifications.cancel(id)` - -## Contributing - -Bug reports and pull requests are welcome on [GitHub][gh]. - -This project is intended to be a safe, welcoming space for collaboration, and -contributors are expected to adhere to the [Contributor Covenant][cc] code of conduct. +## Documentation for API Endpoints + +All URIs are relative to *https://onesignal.com/api/v1* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*OneSignal::DefaultApi* | [**cancel_notification**](docs/DefaultApi.md#cancel_notification) | **DELETE** /notifications/{notification_id} | Stop a scheduled or currently outgoing notification +*OneSignal::DefaultApi* | [**create_app**](docs/DefaultApi.md#create_app) | **POST** /apps | Create an app +*OneSignal::DefaultApi* | [**create_notification**](docs/DefaultApi.md#create_notification) | **POST** /notifications | Create notification +*OneSignal::DefaultApi* | [**create_player**](docs/DefaultApi.md#create_player) | **POST** /players | Add a device +*OneSignal::DefaultApi* | [**create_segments**](docs/DefaultApi.md#create_segments) | **POST** /apps/{app_id}/segments | Create Segments +*OneSignal::DefaultApi* | [**delete_player**](docs/DefaultApi.md#delete_player) | **DELETE** /players/{player_id} | Delete a user record +*OneSignal::DefaultApi* | [**delete_segments**](docs/DefaultApi.md#delete_segments) | **DELETE** /apps/{app_id}/segments/{segment_id} | Delete Segments +*OneSignal::DefaultApi* | [**export_players**](docs/DefaultApi.md#export_players) | **POST** /players/csv_export?app_id={app_id} | CSV export +*OneSignal::DefaultApi* | [**get_app**](docs/DefaultApi.md#get_app) | **GET** /apps/{app_id} | View an app +*OneSignal::DefaultApi* | [**get_apps**](docs/DefaultApi.md#get_apps) | **GET** /apps | View apps +*OneSignal::DefaultApi* | [**get_notification**](docs/DefaultApi.md#get_notification) | **GET** /notifications/{notification_id} | View notification +*OneSignal::DefaultApi* | [**get_notification_history**](docs/DefaultApi.md#get_notification_history) | **POST** /notifications/{notification_id}/history | Notification History +*OneSignal::DefaultApi* | [**get_notifications**](docs/DefaultApi.md#get_notifications) | **GET** /notifications | View notifications +*OneSignal::DefaultApi* | [**get_outcomes**](docs/DefaultApi.md#get_outcomes) | **GET** /apps/{app_id}/outcomes | View Outcomes +*OneSignal::DefaultApi* | [**get_player**](docs/DefaultApi.md#get_player) | **GET** /players/{player_id} | View device +*OneSignal::DefaultApi* | [**get_players**](docs/DefaultApi.md#get_players) | **GET** /players | View devices +*OneSignal::DefaultApi* | [**update_app**](docs/DefaultApi.md#update_app) | **PUT** /apps/{app_id} | Update an app +*OneSignal::DefaultApi* | [**update_player**](docs/DefaultApi.md#update_player) | **PUT** /players/{player_id} | Edit device +*OneSignal::DefaultApi* | [**update_player_tags**](docs/DefaultApi.md#update_player_tags) | **PUT** /apps/{app_id}/users/{external_user_id} | Edit tags with external user id + + +## Documentation for Models + + - [OneSignal::App](docs/App.md) + - [OneSignal::Button](docs/Button.md) + - [OneSignal::DeliveryData](docs/DeliveryData.md) + - [OneSignal::ExportPlayersRequestBody](docs/ExportPlayersRequestBody.md) + - [OneSignal::Filter](docs/Filter.md) + - [OneSignal::FilterExpressions](docs/FilterExpressions.md) + - [OneSignal::FilterNotificationTarget](docs/FilterNotificationTarget.md) + - [OneSignal::GetNotificationRequestBody](docs/GetNotificationRequestBody.md) + - [OneSignal::InlineResponse200](docs/InlineResponse200.md) + - [OneSignal::InlineResponse2001](docs/InlineResponse2001.md) + - [OneSignal::InlineResponse2002](docs/InlineResponse2002.md) + - [OneSignal::InlineResponse2003](docs/InlineResponse2003.md) + - [OneSignal::InlineResponse2004](docs/InlineResponse2004.md) + - [OneSignal::InlineResponse2005](docs/InlineResponse2005.md) + - [OneSignal::InlineResponse201](docs/InlineResponse201.md) + - [OneSignal::InlineResponse400](docs/InlineResponse400.md) + - [OneSignal::InlineResponse4001](docs/InlineResponse4001.md) + - [OneSignal::InlineResponse4002](docs/InlineResponse4002.md) + - [OneSignal::InlineResponse409](docs/InlineResponse409.md) + - [OneSignal::Notification](docs/Notification.md) + - [OneSignal::NotificationAllOf](docs/NotificationAllOf.md) + - [OneSignal::NotificationAllOfAndroidBackgroundLayout](docs/NotificationAllOfAndroidBackgroundLayout.md) + - [OneSignal::NotificationSlice](docs/NotificationSlice.md) + - [OneSignal::NotificationTarget](docs/NotificationTarget.md) + - [OneSignal::Operator](docs/Operator.md) + - [OneSignal::OutcomeData](docs/OutcomeData.md) + - [OneSignal::PlatformDeliveryData](docs/PlatformDeliveryData.md) + - [OneSignal::Player](docs/Player.md) + - [OneSignal::PlayerNotificationTarget](docs/PlayerNotificationTarget.md) + - [OneSignal::PlayerSlice](docs/PlayerSlice.md) + - [OneSignal::Purchase](docs/Purchase.md) + - [OneSignal::Segment](docs/Segment.md) + - [OneSignal::SegmentNotificationTarget](docs/SegmentNotificationTarget.md) + - [OneSignal::StringMap](docs/StringMap.md) + - [OneSignal::UpdatePlayerTagsRequestBody](docs/UpdatePlayerTagsRequestBody.md) + + +## Documentation for Authorization + + +### app_key + +- **Type**: Bearer authentication + +### user_key + +- **Type**: Bearer authentication ## License @@ -131,11 +137,5 @@ The gem is available as open source under the terms of the [MIT License][mit]. [rgb]: https://img.shields.io/gem/v/onesignal.svg [rgl]: https://rubygems.org/gems/onesignal -[trb]: https://travis-ci.org/coding-chimp/onesignal.svg?branch=master -[trl]: https://travis-ci.org/coding-chimp/onesignal -[ccb]: https://codeclimate.com/github/coding-chimp/onesignal/badges/gpa.svg -[ccl]: https://codeclimate.com/github/coding-chimp/onesignal -[osa]: https://documentation.onesignal.com/docs/server-api-overview -[cc]: http://contributor-covenant.org -[gh]: https://github.com/coding-chimp/onesignal +[osa]: https://documentation.onesignal.com/reference/ [mit]: http://opensource.org/licenses/MIT diff --git a/Rakefile b/Rakefile index 4b2b782..c72ca30 100644 --- a/Rakefile +++ b/Rakefile @@ -1,10 +1,10 @@ -require 'bundler/gem_tasks' -require 'rake/testtask' +require "bundler/gem_tasks" -Rake::TestTask.new(:test) do |t| - t.libs << 'test' - t.libs << 'lib' - t.test_files = FileList['test/**/*_test.rb'] -end +begin + require 'rspec/core/rake_task' -task default: :test + RSpec::Core::RakeTask.new(:spec) + task default: :spec +rescue LoadError + # no rspec available +end diff --git a/docs/App.md b/docs/App.md new file mode 100644 index 0000000..837356c --- /dev/null +++ b/docs/App.md @@ -0,0 +1,76 @@ +# OneSignal::App + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | | [readonly] | +| **name** | **String** | The name of your app, as displayed on your apps list on the dashboard. This can be renamed. | [optional] | +| **players** | **Integer** | | [optional][readonly] | +| **messageable_players** | **Integer** | | [optional][readonly] | +| **updated_at** | **Time** | | [optional][readonly] | +| **created_at** | **Time** | | [optional][readonly] | +| **android_gcm_sender_id** | **String** | Android: Your Google Project number. Also known as Sender ID. | [optional] | +| **gcm_key** | **String** | Android: Your Google Push Messaging Auth Key | [optional] | +| **chrome_web_origin** | **String** | Chrome (All Browsers except Safari) (Recommended): The URL to your website. This field is required if you wish to enable web push and specify other web push parameters. | [optional] | +| **chrome_key** | **String** | Not for web push. Your Google Push Messaging Auth Key if you use Chrome Apps / Extensions. | [optional] | +| **chrome_web_default_notification_icon** | **String** | Chrome (All Browsers except Safari): Your default notification icon. Should be 256x256 pixels, min 80x80. | [optional] | +| **chrome_web_sub_domain** | **String** | Chrome (All Browsers except Safari): A subdomain of your choice in order to support Web Push on non-HTTPS websites. This field must be set in order for the chrome_web_gcm_sender_id property to be processed. | [optional] | +| **apns_env** | **String** | iOS: Either sandbox or production | [optional] | +| **apns_p12** | **String** | iOS: Your apple push notification p12 certificate file, converted to a string and Base64 encoded. | [optional] | +| **apns_p12_password** | **String** | iOS: Required if using p12 certificate. Password for the apns_p12 file. | [optional] | +| **apns_certificates** | **String** | | [optional][readonly] | +| **safari_apns_certificates** | **String** | | [optional][readonly] | +| **safari_apns_p12** | **String** | Safari: Your apple push notification p12 certificate file for Safari Push Notifications, converted to a string and Base64 encoded. | [optional] | +| **safari_apns_p12_password** | **String** | Safari: Password for safari_apns_p12 file | [optional] | +| **safari_site_origin** | **String** | Safari (Recommended): The hostname to your website including http(s):// | [optional] | +| **safari_push_id** | **String** | | [optional][readonly] | +| **safari_icon_16_16** | **String** | | [optional][readonly] | +| **safari_icon_32_32** | **String** | | [optional][readonly] | +| **safari_icon_64_64** | **String** | | [optional][readonly] | +| **safari_icon_128_128** | **String** | | [optional][readonly] | +| **safari_icon_256_256** | **String** | Safari: A url for a 256x256 png notification icon. This is the only Safari icon URL you need to provide. | [optional] | +| **site_name** | **String** | All Browsers (Recommended): The Site Name. Requires both chrome_web_origin and safari_site_origin to be set to add or update it. | [optional] | +| **basic_auth_key** | **String** | | [optional][readonly] | +| **organization_id** | **String** | The Id of the Organization you would like to add this app to. | [optional] | +| **additional_data_is_root_payload** | **Boolean** | iOS: Notification data (additional data) values will be added to the root of the apns payload when sent to the device. Ignore if you're not using any other plugins, or not using OneSignal SDK methods to read the payload. | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::App.new( + id: null, + name: null, + players: null, + messageable_players: null, + updated_at: null, + created_at: null, + android_gcm_sender_id: null, + gcm_key: null, + chrome_web_origin: null, + chrome_key: null, + chrome_web_default_notification_icon: null, + chrome_web_sub_domain: null, + apns_env: null, + apns_p12: null, + apns_p12_password: null, + apns_certificates: null, + safari_apns_certificates: null, + safari_apns_p12: null, + safari_apns_p12_password: null, + safari_site_origin: null, + safari_push_id: null, + safari_icon_16_16: null, + safari_icon_32_32: null, + safari_icon_64_64: null, + safari_icon_128_128: null, + safari_icon_256_256: null, + site_name: null, + basic_auth_key: null, + organization_id: null, + additional_data_is_root_payload: null +) +``` + diff --git a/docs/Button.md b/docs/Button.md new file mode 100644 index 0000000..59790aa --- /dev/null +++ b/docs/Button.md @@ -0,0 +1,22 @@ +# OneSignal::Button + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | | | +| **text** | **String** | | [optional] | +| **icon** | **String** | | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::Button.new( + id: null, + text: null, + icon: null +) +``` + diff --git a/docs/DefaultApi.md b/docs/DefaultApi.md new file mode 100644 index 0000000..baf7607 --- /dev/null +++ b/docs/DefaultApi.md @@ -0,0 +1,1394 @@ +# OneSignal::DefaultApi + +All URIs are relative to *https://onesignal.com/api/v1* + +| Method | HTTP request | Description | +| ------ | ------------ | ----------- | +| [**cancel_notification**](DefaultApi.md#cancel_notification) | **DELETE** /notifications/{notification_id} | Stop a scheduled or currently outgoing notification | +| [**create_app**](DefaultApi.md#create_app) | **POST** /apps | Create an app | +| [**create_notification**](DefaultApi.md#create_notification) | **POST** /notifications | Create notification | +| [**create_player**](DefaultApi.md#create_player) | **POST** /players | Add a device | +| [**create_segments**](DefaultApi.md#create_segments) | **POST** /apps/{app_id}/segments | Create Segments | +| [**delete_player**](DefaultApi.md#delete_player) | **DELETE** /players/{player_id} | Delete a user record | +| [**delete_segments**](DefaultApi.md#delete_segments) | **DELETE** /apps/{app_id}/segments/{segment_id} | Delete Segments | +| [**export_players**](DefaultApi.md#export_players) | **POST** /players/csv_export?app_id={app_id} | CSV export | +| [**get_app**](DefaultApi.md#get_app) | **GET** /apps/{app_id} | View an app | +| [**get_apps**](DefaultApi.md#get_apps) | **GET** /apps | View apps | +| [**get_notification**](DefaultApi.md#get_notification) | **GET** /notifications/{notification_id} | View notification | +| [**get_notification_history**](DefaultApi.md#get_notification_history) | **POST** /notifications/{notification_id}/history | Notification History | +| [**get_notifications**](DefaultApi.md#get_notifications) | **GET** /notifications | View notifications | +| [**get_outcomes**](DefaultApi.md#get_outcomes) | **GET** /apps/{app_id}/outcomes | View Outcomes | +| [**get_player**](DefaultApi.md#get_player) | **GET** /players/{player_id} | View device | +| [**get_players**](DefaultApi.md#get_players) | **GET** /players | View devices | +| [**update_app**](DefaultApi.md#update_app) | **PUT** /apps/{app_id} | Update an app | +| [**update_player**](DefaultApi.md#update_player) | **PUT** /players/{player_id} | Edit device | +| [**update_player_tags**](DefaultApi.md#update_player_tags) | **PUT** /apps/{app_id}/users/{external_user_id} | Edit tags with external user id | + + +## cancel_notification + +> cancel_notification(app_id, notification_id) + +Stop a scheduled or currently outgoing notification + +Used to stop a scheduled or currently outgoing notification + +### Examples + +```ruby +require 'time' +require 'onesignal' +# setup authorization +OneSignal.configure do |config| + # Configure Bearer authorization: app_key + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = OneSignal::DefaultApi.new +app_id = 'app_id_example' # String | +notification_id = 'notification_id_example' # String | + +begin + # Stop a scheduled or currently outgoing notification + result = api_instance.cancel_notification(app_id, notification_id) + p result +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->cancel_notification: #{e}" +end +``` + +#### Using the cancel_notification_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> cancel_notification_with_http_info(app_id, notification_id) + +```ruby +begin + # Stop a scheduled or currently outgoing notification + data, status_code, headers = api_instance.cancel_notification_with_http_info(app_id, notification_id) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->cancel_notification_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **app_id** | **String** | | | +| **notification_id** | **String** | | | + +### Return type + +[**InlineResponse2001**](InlineResponse2001.md) + +### Authorization + +[app_key](../README.md#app_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## create_app + +> create_app(app) + +Create an app + +Creates a new OneSignal app + +### Examples + +```ruby +require 'time' +require 'onesignal' +# setup authorization +OneSignal.configure do |config| + # Configure Bearer authorization: user_key + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = OneSignal::DefaultApi.new +app = OneSignal::App.new({id: 'id_example'}) # App | + +begin + # Create an app + result = api_instance.create_app(app) + p result +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->create_app: #{e}" +end +``` + +#### Using the create_app_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> create_app_with_http_info(app) + +```ruby +begin + # Create an app + data, status_code, headers = api_instance.create_app_with_http_info(app) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->create_app_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **app** | [**App**](App.md) | | | + +### Return type + +[**App**](App.md) + +### Authorization + +[user_key](../README.md#user_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## create_notification + +> create_notification(notification) + +Create notification + +Sends notifications to your users + +### Examples + +```ruby +require 'time' +require 'onesignal' +# setup authorization +OneSignal.configure do |config| + # Configure Bearer authorization: app_key + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = OneSignal::DefaultApi.new +notification = OneSignal::Notification.new({app_id: 'app_id_example'}) # Notification | + +begin + # Create notification + result = api_instance.create_notification(notification) + p result +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->create_notification: #{e}" +end +``` + +#### Using the create_notification_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> create_notification_with_http_info(notification) + +```ruby +begin + # Create notification + data, status_code, headers = api_instance.create_notification_with_http_info(notification) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->create_notification_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **notification** | [**Notification**](Notification.md) | | | + +### Return type + +[**InlineResponse200**](InlineResponse200.md) + +### Authorization + +[app_key](../README.md#app_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## create_player + +> create_player(player) + +Add a device + +Register a new device to one of your OneSignal apps 🚧 Don't use this This API endpoint is designed to be used from our open source Mobile and Web Push SDKs. It is not designed for developers to use it directly, unless instructed to do so by OneSignal support. If you use this method instead of our SDKs, many OneSignal features such as conversion tracking, timezone tracking, language detection, and rich-push won't work out of the box. It will also make it harder to identify possible setup issues. This method is used to register a new device with OneSignal. If a device is already registered with the specified identifier, then this will update the existing device record instead of creating a new one. The returned player is a player / user ID. Use the returned ID to send push notifications to this specific user later, or to include this player when sending to a set of users. 🚧 iOS Must set test_type to 1 when building your iOS app as development. Omit this field in your production app builds. + +### Examples + +```ruby +require 'time' +require 'onesignal' +# setup authorization +OneSignal.configure do |config| + # Configure Bearer authorization: app_key + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = OneSignal::DefaultApi.new +player = OneSignal::Player.new({id: 'id_example', app_id: 'app_id_example', device_type: 37}) # Player | + +begin + # Add a device + result = api_instance.create_player(player) + p result +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->create_player: #{e}" +end +``` + +#### Using the create_player_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> create_player_with_http_info(player) + +```ruby +begin + # Add a device + data, status_code, headers = api_instance.create_player_with_http_info(player) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->create_player_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **player** | [**Player**](Player.md) | | | + +### Return type + +[**InlineResponse2004**](InlineResponse2004.md) + +### Authorization + +[app_key](../README.md#app_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## create_segments + +> create_segments(app_id, opts) + +Create Segments + +Create segments visible and usable in the dashboard and API - Required: OneSignal Paid Plan The Create Segment method is used when you want your server to programmatically create a segment instead of using the OneSignal Dashboard UI. Just like creating Segments from the dashboard you can pass in filters with multiple \"AND\" or \"OR\" operator's. 🚧 Does Not Update Segments This endpoint will only create segments, it does not edit or update currently created Segments. You will need to use the Delete Segments endpoint and re-create it with this endpoint to edit. + +### Examples + +```ruby +require 'time' +require 'onesignal' +# setup authorization +OneSignal.configure do |config| + # Configure Bearer authorization: app_key + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = OneSignal::DefaultApi.new +app_id = 'app_id_example' # String | The OneSignal App ID for your app. Available in Keys & IDs. +opts = { + segment: OneSignal::Segment.new({name: 'name_example', filters: [OneSignal::FilterExpressions.new({field: 'field_example', relation: '>'})]}) # Segment | +} + +begin + # Create Segments + result = api_instance.create_segments(app_id, opts) + p result +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->create_segments: #{e}" +end +``` + +#### Using the create_segments_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> create_segments_with_http_info(app_id, opts) + +```ruby +begin + # Create Segments + data, status_code, headers = api_instance.create_segments_with_http_info(app_id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->create_segments_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **app_id** | **String** | The OneSignal App ID for your app. Available in Keys & IDs. | | +| **segment** | [**Segment**](Segment.md) | | [optional] | + +### Return type + +[**InlineResponse201**](InlineResponse201.md) + +### Authorization + +[app_key](../README.md#app_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## delete_player + +> delete_player(app_id, player_id) + +Delete a user record + +Delete player - Required: Used to delete a single, specific Player ID record from a specific OneSignal app. + +### Examples + +```ruby +require 'time' +require 'onesignal' +# setup authorization +OneSignal.configure do |config| + # Configure Bearer authorization: app_key + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = OneSignal::DefaultApi.new +app_id = 'app_id_example' # String | The OneSignal App ID for your app. Available in Keys & IDs. +player_id = 'player_id_example' # String | The OneSignal player_id + +begin + # Delete a user record + result = api_instance.delete_player(app_id, player_id) + p result +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->delete_player: #{e}" +end +``` + +#### Using the delete_player_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> delete_player_with_http_info(app_id, player_id) + +```ruby +begin + # Delete a user record + data, status_code, headers = api_instance.delete_player_with_http_info(app_id, player_id) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->delete_player_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **app_id** | **String** | The OneSignal App ID for your app. Available in Keys & IDs. | | +| **player_id** | **String** | The OneSignal player_id | | + +### Return type + +[**InlineResponse2001**](InlineResponse2001.md) + +### Authorization + +[app_key](../README.md#app_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## delete_segments + +> delete_segments(app_id, segment_id) + +Delete Segments + +Delete segments (not user devices) - Required: OneSignal Paid Plan You can delete a segment under your app by calling this API. You must provide an API key in the Authorization header that has admin access on the app. The segment_id can be found in the URL of the segment when viewing it in the dashboard. + +### Examples + +```ruby +require 'time' +require 'onesignal' +# setup authorization +OneSignal.configure do |config| + # Configure Bearer authorization: app_key + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = OneSignal::DefaultApi.new +app_id = 'app_id_example' # String | The OneSignal App ID for your app. Available in Keys & IDs. +segment_id = 'segment_id_example' # String | The segment_id can be found in the URL of the segment when viewing it in the dashboard. + +begin + # Delete Segments + result = api_instance.delete_segments(app_id, segment_id) + p result +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->delete_segments: #{e}" +end +``` + +#### Using the delete_segments_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> delete_segments_with_http_info(app_id, segment_id) + +```ruby +begin + # Delete Segments + data, status_code, headers = api_instance.delete_segments_with_http_info(app_id, segment_id) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->delete_segments_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **app_id** | **String** | The OneSignal App ID for your app. Available in Keys & IDs. | | +| **segment_id** | **String** | The segment_id can be found in the URL of the segment when viewing it in the dashboard. | | + +### Return type + +[**InlineResponse2003**](InlineResponse2003.md) + +### Authorization + +[app_key](../README.md#app_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## export_players + +> export_players(app_id, opts) + +CSV export + +Generate a compressed CSV export of all of your current user data This method can be used to generate a compressed CSV export of all of your current user data. It is a much faster alternative than retrieving this data using the /players API endpoint. The file will be compressed using GZip. The file may take several minutes to generate depending on the number of users in your app. The URL generated will be available for 3 days and includes random v4 uuid as part of the resource name to be unguessable. 🚧 403 Error Responses You can test if it is complete by making a GET request to the csv_file_url value. This file may take time to generate depending on how many device records are being pulled. If the file is not ready, a 403 error will be returned. Otherwise the file itself will be returned. 🚧 Requires Authentication Key Requires your OneSignal App's REST API Key, available in Keys & IDs. 🚧 Concurrent Exports Only one concurrent export is allowed per OneSignal account. Please ensure you have successfully downloaded the .csv.gz file before exporting another app. CSV File Format: - Default Columns: | Field | Details | | --- | --- | | id | OneSignal Player Id | | identifier | Push Token | | session_count | Number of times they visited the app or site | language | Device language code | | timezone | Number of seconds away from UTC. Example: -28800 | | game_version | Version of your mobile app gathered from Android Studio versionCode in your App/build.gradle and iOS uses kCFBundleVersionKey in Xcode. | | device_os | Device Operating System Version. Example: 80 = Chrome 80, 9 = Android 9 | | device_type | Device Operating System Type | | device_model | Device Hardware String Code. Example: Mobile Web Subscribers will have `Linux armv` | | ad_id | Based on the Google Advertising Id for Android, identifierForVendor for iOS. OptedOut means user turned off Advertising tracking on the device. | | tags | Current OneSignal Data Tags on the device. | | last_active | Date and time the user last opened the mobile app or visited the site. | | playtime | Total amount of time in seconds the user had the mobile app open. | | amount_spent | Mobile only - amount spent in USD on In-App Purchases. | | created_at | Date and time the device record was created in OneSignal. Mobile - first time they opened the app with OneSignal SDK. Web - first time the user subscribed to the site. | | invalid_identifier | t = unsubscribed, f = subscibed | | badge_count | Current number of badges on the device | - Extra Columns: | Field | Details | | --- | --- | | external_user_id | Your User Id set on the device | | notification_types | Notification types | | location | Location points (Latitude and Longitude) set on the device. | | country | Country code | | rooted | Android device rooted or not | | ip | IP Address of the device if being tracked. See Handling Personal Data. | | web_auth | Web Only authorization key. | | web_p256 | Web Only p256 key. | + +### Examples + +```ruby +require 'time' +require 'onesignal' +# setup authorization +OneSignal.configure do |config| + # Configure Bearer authorization: app_key + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = OneSignal::DefaultApi.new +app_id = 'app_id_example' # String | The app ID that you want to export devices from +opts = { + export_players_request_body: OneSignal::ExportPlayersRequestBody.new # ExportPlayersRequestBody | +} + +begin + # CSV export + result = api_instance.export_players(app_id, opts) + p result +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->export_players: #{e}" +end +``` + +#### Using the export_players_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> export_players_with_http_info(app_id, opts) + +```ruby +begin + # CSV export + data, status_code, headers = api_instance.export_players_with_http_info(app_id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->export_players_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **app_id** | **String** | The app ID that you want to export devices from | | +| **export_players_request_body** | [**ExportPlayersRequestBody**](ExportPlayersRequestBody.md) | | [optional] | + +### Return type + +[**InlineResponse2005**](InlineResponse2005.md) + +### Authorization + +[app_key](../README.md#app_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## get_app + +> get_app(app_id) + +View an app + +View the details of a single OneSignal app + +### Examples + +```ruby +require 'time' +require 'onesignal' +# setup authorization +OneSignal.configure do |config| + # Configure Bearer authorization: user_key + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = OneSignal::DefaultApi.new +app_id = 'app_id_example' # String | An app id + +begin + # View an app + result = api_instance.get_app(app_id) + p result +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->get_app: #{e}" +end +``` + +#### Using the get_app_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_app_with_http_info(app_id) + +```ruby +begin + # View an app + data, status_code, headers = api_instance.get_app_with_http_info(app_id) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->get_app_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **app_id** | **String** | An app id | | + +### Return type + +[**App**](App.md) + +### Authorization + +[user_key](../README.md#user_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_apps + +> String get_apps + +View apps + +View the details of all of your current OneSignal apps + +### Examples + +```ruby +require 'time' +require 'onesignal' +# setup authorization +OneSignal.configure do |config| + # Configure Bearer authorization: user_key + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = OneSignal::DefaultApi.new + +begin + # View apps + result = api_instance.get_apps + p result +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->get_apps: #{e}" +end +``` + +#### Using the get_apps_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> get_apps_with_http_info + +```ruby +begin + # View apps + data, status_code, headers = api_instance.get_apps_with_http_info + p status_code # => 2xx + p headers # => { ... } + p data # => String +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->get_apps_with_http_info: #{e}" +end +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +**String** + +### Authorization + +[user_key](../README.md#user_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_notification + +> get_notification(app_id, notification_id) + +View notification + +View the details of a single notification and outcomes associated with it + +### Examples + +```ruby +require 'time' +require 'onesignal' +# setup authorization +OneSignal.configure do |config| + # Configure Bearer authorization: app_key + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = OneSignal::DefaultApi.new +app_id = 'app_id_example' # String | +notification_id = 'notification_id_example' # String | + +begin + # View notification + result = api_instance.get_notification(app_id, notification_id) + p result +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->get_notification: #{e}" +end +``` + +#### Using the get_notification_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_notification_with_http_info(app_id, notification_id) + +```ruby +begin + # View notification + data, status_code, headers = api_instance.get_notification_with_http_info(app_id, notification_id) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->get_notification_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **app_id** | **String** | | | +| **notification_id** | **String** | | | + +### Return type + +[**Notification**](Notification.md) + +### Authorization + +[app_key](../README.md#app_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_notification_history + +> get_notification_history(notification_id, get_notification_request_body) + +Notification History + +-> View the devices sent a message - OneSignal Paid Plan Required This method will return all devices that were sent the given notification_id of an Email or Push Notification if used within 7 days of the date sent. After 7 days of the sending date, the message history data will be unavailable. After a successful response is received, the destination url may be polled until the file becomes available. Most exports are done in ~1-3 minutes, so setting a poll interval of 10 seconds should be adequate. For use cases that are not meant to be consumed by a script, an email will be sent to the supplied email address. 🚧 Requirements A OneSignal Paid Plan. Turn on Send History via OneSignal API in Settings -> Analytics. Cannot get data before this was turned on. Must be called within 7 days after sending the message. Messages targeting under 1000 recipients will not have \"sent\" events recorded, but will show \"clicked\" events. Requires your OneSignal App's REST API Key, available in Keys & IDs. + +### Examples + +```ruby +require 'time' +require 'onesignal' +# setup authorization +OneSignal.configure do |config| + # Configure Bearer authorization: app_key + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = OneSignal::DefaultApi.new +notification_id = 'notification_id_example' # String | The \"id\" of the message found in the Notification object +get_notification_request_body = OneSignal::GetNotificationRequestBody.new # GetNotificationRequestBody | + +begin + # Notification History + result = api_instance.get_notification_history(notification_id, get_notification_request_body) + p result +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->get_notification_history: #{e}" +end +``` + +#### Using the get_notification_history_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_notification_history_with_http_info(notification_id, get_notification_request_body) + +```ruby +begin + # Notification History + data, status_code, headers = api_instance.get_notification_history_with_http_info(notification_id, get_notification_request_body) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->get_notification_history_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **notification_id** | **String** | The \"id\" of the message found in the Notification object | | +| **get_notification_request_body** | [**GetNotificationRequestBody**](GetNotificationRequestBody.md) | | | + +### Return type + +[**InlineResponse2002**](InlineResponse2002.md) + +### Authorization + +[app_key](../README.md#app_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## get_notifications + +> get_notifications(app_id, opts) + +View notifications + +View the details of multiple notifications + +### Examples + +```ruby +require 'time' +require 'onesignal' +# setup authorization +OneSignal.configure do |config| + # Configure Bearer authorization: app_key + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = OneSignal::DefaultApi.new +app_id = 'app_id_example' # String | The app ID that you want to view notifications from +opts = { + limit: 'limit_example', # String | How many notifications to return. Max is 50. Default is 50. + offset: 56, # Integer | Page offset. Default is 0. Results are sorted by queued_at in descending order. queued_at is a representation of the time that the notification was queued at. + kind: 0 # Integer | Kind of notifications returned: * unset - All notification types (default) * `0` - Dashboard only * `1` - API only * `3` - Automated only +} + +begin + # View notifications + result = api_instance.get_notifications(app_id, opts) + p result +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->get_notifications: #{e}" +end +``` + +#### Using the get_notifications_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_notifications_with_http_info(app_id, opts) + +```ruby +begin + # View notifications + data, status_code, headers = api_instance.get_notifications_with_http_info(app_id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->get_notifications_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **app_id** | **String** | The app ID that you want to view notifications from | | +| **limit** | **String** | How many notifications to return. Max is 50. Default is 50. | [optional] | +| **offset** | **Integer** | Page offset. Default is 0. Results are sorted by queued_at in descending order. queued_at is a representation of the time that the notification was queued at. | [optional] | +| **kind** | **Integer** | Kind of notifications returned: * unset - All notification types (default) * `0` - Dashboard only * `1` - API only * `3` - Automated only | [optional] | + +### Return type + +[**NotificationSlice**](NotificationSlice.md) + +### Authorization + +[app_key](../README.md#app_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_outcomes + +> > get_outcomes(app_id, outcome_names, opts) + +View Outcomes + +View the details of all the outcomes associated with your app 🚧 Requires Authentication Key Requires your OneSignal App's REST API Key, available in Keys & IDs. 🚧 Outcome Data Limitations Outcomes are only accessible for around 30 days before deleted from our servers. You will need to export this data every month if you want to keep it. + +### Examples + +```ruby +require 'time' +require 'onesignal' +# setup authorization +OneSignal.configure do |config| + # Configure Bearer authorization: app_key + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = OneSignal::DefaultApi.new +app_id = 'app_id_example' # String | The OneSignal App ID for your app. Available in Keys & IDs. +outcome_names = 'outcome_names_example' # String | Required Comma-separated list of names and the value (sum/count) for the returned outcome data. Note: Clicks only support count aggregation. For out-of-the-box OneSignal outcomes such as click and session duration, please use the “os” prefix with two underscores. For other outcomes, please use the name specified by the user. Example:os__session_duration.count,os__click.count,CustomOutcomeName.sum +opts = { + outcome_names2: 'outcome_names_example', # String | Optional If outcome names contain any commas, then please specify only one value at a time. Example: outcome_names[]=os__click.count&outcome_names[]=Sales, Purchase.count where “Sales, Purchase” is the custom outcomes with a comma in the name. + outcome_time_range: 'outcome_time_range_example', # String | Optional Time range for the returned data. The values can be 1h (for the last 1 hour data), 1d (for the last 1 day data), or 1mo (for the last 1 month data). Default is 1h if the parameter is omitted. + outcome_platforms: 'outcome_platforms_example', # String | Optional Platform id. Refer device's platform ids for values. Example: outcome_platform=0 for iOS outcome_platform=7,8 for Safari and Firefox Default is data from all platforms if the parameter is omitted. + outcome_attribution: 'outcome_attribution_example' # String | Optional Attribution type for the outcomes. The values can be direct or influenced or unattributed. Example: outcome_attribution=direct Default is total (returns direct+influenced+unattributed) if the parameter is omitted. +} + +begin + # View Outcomes + result = api_instance.get_outcomes(app_id, outcome_names, opts) + p result +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->get_outcomes: #{e}" +end +``` + +#### Using the get_outcomes_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> >, Integer, Hash)> get_outcomes_with_http_info(app_id, outcome_names, opts) + +```ruby +begin + # View Outcomes + data, status_code, headers = api_instance.get_outcomes_with_http_info(app_id, outcome_names, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => > +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->get_outcomes_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **app_id** | **String** | The OneSignal App ID for your app. Available in Keys & IDs. | | +| **outcome_names** | **String** | Required Comma-separated list of names and the value (sum/count) for the returned outcome data. Note: Clicks only support count aggregation. For out-of-the-box OneSignal outcomes such as click and session duration, please use the “os” prefix with two underscores. For other outcomes, please use the name specified by the user. Example:os__session_duration.count,os__click.count,CustomOutcomeName.sum | | +| **outcome_names2** | **String** | Optional If outcome names contain any commas, then please specify only one value at a time. Example: outcome_names[]=os__click.count&outcome_names[]=Sales, Purchase.count where “Sales, Purchase” is the custom outcomes with a comma in the name. | [optional] | +| **outcome_time_range** | **String** | Optional Time range for the returned data. The values can be 1h (for the last 1 hour data), 1d (for the last 1 day data), or 1mo (for the last 1 month data). Default is 1h if the parameter is omitted. | [optional] | +| **outcome_platforms** | **String** | Optional Platform id. Refer device's platform ids for values. Example: outcome_platform=0 for iOS outcome_platform=7,8 for Safari and Firefox Default is data from all platforms if the parameter is omitted. | [optional] | +| **outcome_attribution** | **String** | Optional Attribution type for the outcomes. The values can be direct or influenced or unattributed. Example: outcome_attribution=direct Default is total (returns direct+influenced+unattributed) if the parameter is omitted. | [optional] | + +### Return type + +[**Array<OutcomeData>**](OutcomeData.md) + +### Authorization + +[app_key](../README.md#app_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_player + +> get_player(app_id, player_id, opts) + +View device + +View the details of an existing device in one of your OneSignal apps + +### Examples + +```ruby +require 'time' +require 'onesignal' +# setup authorization +OneSignal.configure do |config| + # Configure Bearer authorization: app_key + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = OneSignal::DefaultApi.new +app_id = 'app_id_example' # String | Your app_id for this device +player_id = 'player_id_example' # String | Player's OneSignal ID +opts = { + email_auth_hash: 'email_auth_hash_example' # String | Email - Only required if you have enabled Identity Verification and device_type is email (11). +} + +begin + # View device + result = api_instance.get_player(app_id, player_id, opts) + p result +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->get_player: #{e}" +end +``` + +#### Using the get_player_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_player_with_http_info(app_id, player_id, opts) + +```ruby +begin + # View device + data, status_code, headers = api_instance.get_player_with_http_info(app_id, player_id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->get_player_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **app_id** | **String** | Your app_id for this device | | +| **player_id** | **String** | Player's OneSignal ID | | +| **email_auth_hash** | **String** | Email - Only required if you have enabled Identity Verification and device_type is email (11). | [optional] | + +### Return type + +[**Player**](Player.md) + +### Authorization + +[app_key](../README.md#app_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## get_players + +> get_players(app_id, opts) + +View devices + +View the details of multiple devices in one of your OneSignal apps Unavailable for Apps Over 80,000 Users For performance reasons, this method is not available for larger apps. Larger apps should use the CSV export API endpoint, which is much more performant. + +### Examples + +```ruby +require 'time' +require 'onesignal' +# setup authorization +OneSignal.configure do |config| + # Configure Bearer authorization: app_key + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = OneSignal::DefaultApi.new +app_id = 'app_id_example' # String | The app ID that you want to view players from +opts = { + limit: 'limit_example', # String | How many devices to return. Max is 300. Default is 300 + offset: 56 # Integer | Result offset. Default is 0. Results are sorted by id; +} + +begin + # View devices + result = api_instance.get_players(app_id, opts) + p result +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->get_players: #{e}" +end +``` + +#### Using the get_players_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> get_players_with_http_info(app_id, opts) + +```ruby +begin + # View devices + data, status_code, headers = api_instance.get_players_with_http_info(app_id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->get_players_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **app_id** | **String** | The app ID that you want to view players from | | +| **limit** | **String** | How many devices to return. Max is 300. Default is 300 | [optional] | +| **offset** | **Integer** | Result offset. Default is 0. Results are sorted by id; | [optional] | + +### Return type + +[**PlayerSlice**](PlayerSlice.md) + +### Authorization + +[app_key](../README.md#app_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + + +## update_app + +> update_app(app_id, app) + +Update an app + +Updates the name or configuration settings of an existing OneSignal app + +### Examples + +```ruby +require 'time' +require 'onesignal' +# setup authorization +OneSignal.configure do |config| + # Configure Bearer authorization: user_key + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = OneSignal::DefaultApi.new +app_id = 'app_id_example' # String | An app id +app = OneSignal::App.new({id: 'id_example'}) # App | + +begin + # Update an app + result = api_instance.update_app(app_id, app) + p result +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->update_app: #{e}" +end +``` + +#### Using the update_app_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> update_app_with_http_info(app_id, app) + +```ruby +begin + # Update an app + data, status_code, headers = api_instance.update_app_with_http_info(app_id, app) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->update_app_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **app_id** | **String** | An app id | | +| **app** | [**App**](App.md) | | | + +### Return type + +[**App**](App.md) + +### Authorization + +[user_key](../README.md#user_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## update_player + +> update_player(player_id, player) + +Edit device + +Update an existing device in one of your OneSignal apps + +### Examples + +```ruby +require 'time' +require 'onesignal' +# setup authorization +OneSignal.configure do |config| + # Configure Bearer authorization: app_key + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = OneSignal::DefaultApi.new +player_id = 'player_id_example' # String | Player's OneSignal ID +player = OneSignal::Player.new({id: 'id_example', app_id: 'app_id_example', device_type: 37}) # Player | + +begin + # Edit device + result = api_instance.update_player(player_id, player) + p result +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->update_player: #{e}" +end +``` + +#### Using the update_player_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> update_player_with_http_info(player_id, player) + +```ruby +begin + # Edit device + data, status_code, headers = api_instance.update_player_with_http_info(player_id, player) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->update_player_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **player_id** | **String** | Player's OneSignal ID | | +| **player** | [**Player**](Player.md) | | | + +### Return type + +[**InlineResponse2001**](InlineResponse2001.md) + +### Authorization + +[app_key](../README.md#app_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + + +## update_player_tags + +> update_player_tags(app_id, external_user_id, opts) + +Edit tags with external user id + +Update an existing device's tags in one of your OneSignal apps using the External User ID. Warning - Android SDK Data Synchronization Tags added through the Android SDK tagging methods may not update if using the API to change or update the same tag. For example, if you use SDK method sendTag(\"key\", \"value1\") then update the tag value to \"value2\" with this API endpoint. You will not be able to set the value back to \"value1\" through the SDK, you will need to change it to something different through the SDK to be reset. Recommendations if using this Endpoint on Android Mobile Apps: 1 - Do not use the same tag keys for SDK and API updates 2 - If you want to use the same key for both SDK and API updates, call the SDK getTags method first to update the device's tags. This is only applicable on the Android Mobile App SDKs. 📘 Deleting Tags To delete a tag, include its key and set its value to blank. Omitting a key/value will not delete it. For example, if I wanted to delete two existing tags rank and category while simultaneously adding a new tag class, the tags JSON would look like the following: \"tags\": { \"rank\": \"\", \"category\": \"\", \"class\": \"my_new_value\" } + +### Examples + +```ruby +require 'time' +require 'onesignal' +# setup authorization +OneSignal.configure do |config| + # Configure Bearer authorization: app_key + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = OneSignal::DefaultApi.new +app_id = 'app_id_example' # String | The OneSignal App ID the user record is found under. +external_user_id = 'external_user_id_example' # String | The External User ID mapped to teh device record in OneSignal. Must be actively set on the device to be updated. +opts = { + update_player_tags_request_body: OneSignal::UpdatePlayerTagsRequestBody.new # UpdatePlayerTagsRequestBody | +} + +begin + # Edit tags with external user id + result = api_instance.update_player_tags(app_id, external_user_id, opts) + p result +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->update_player_tags: #{e}" +end +``` + +#### Using the update_player_tags_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> update_player_tags_with_http_info(app_id, external_user_id, opts) + +```ruby +begin + # Edit tags with external user id + data, status_code, headers = api_instance.update_player_tags_with_http_info(app_id, external_user_id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue OneSignal::ApiError => e + puts "Error when calling DefaultApi->update_player_tags_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **app_id** | **String** | The OneSignal App ID the user record is found under. | | +| **external_user_id** | **String** | The External User ID mapped to teh device record in OneSignal. Must be actively set on the device to be updated. | | +| **update_player_tags_request_body** | [**UpdatePlayerTagsRequestBody**](UpdatePlayerTagsRequestBody.md) | | [optional] | + +### Return type + +[**InlineResponse2003**](InlineResponse2003.md) + +### Authorization + +[app_key](../README.md#app_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + diff --git a/docs/DeliveryData.md b/docs/DeliveryData.md new file mode 100644 index 0000000..ed33471 --- /dev/null +++ b/docs/DeliveryData.md @@ -0,0 +1,26 @@ +# OneSignal::DeliveryData + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **successful** | **Integer** | | [optional] | +| **failed** | **Integer** | | [optional] | +| **errored** | **Integer** | | [optional] | +| **converted** | **Integer** | | [optional] | +| **received** | **Integer** | | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::DeliveryData.new( + successful: null, + failed: null, + errored: null, + converted: null, + received: null +) +``` + diff --git a/docs/ExportPlayersRequestBody.md b/docs/ExportPlayersRequestBody.md new file mode 100644 index 0000000..b6b1564 --- /dev/null +++ b/docs/ExportPlayersRequestBody.md @@ -0,0 +1,22 @@ +# OneSignal::ExportPlayersRequestBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **extra_fields** | **Array<String>** | Additional fields that you wish to include. Currently supports location, country, rooted, notification_types, ip, external_user_id, web_auth, and web_p256. | [optional] | +| **last_active_since** | **Integer** | Export all devices with a last_active timestamp greater than this time. Unixtime in seconds. | [optional] | +| **segment_name** | **String** | Export al ldevices belonging to the segment. | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::ExportPlayersRequestBody.new( + extra_fields: null, + last_active_since: null, + segment_name: null +) +``` + diff --git a/docs/Filter.md b/docs/Filter.md new file mode 100644 index 0000000..25673fa --- /dev/null +++ b/docs/Filter.md @@ -0,0 +1,24 @@ +# OneSignal::Filter + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **field** | **String** | Name of the field to use as the first operand in the filter expression. | | +| **key** | **String** | If `field` is `tag`, this field is *required* to specify `key` inside the tags. | [optional] | +| **value** | **String** | Constant value to use as the second operand in the filter expression. This value is *required* when the relation operator is a binary operator. | [optional] | +| **relation** | **String** | Operator of a filter expression. | | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::Filter.new( + field: null, + key: null, + value: null, + relation: null +) +``` + diff --git a/docs/FilterExpressions.md b/docs/FilterExpressions.md new file mode 100644 index 0000000..2090c06 --- /dev/null +++ b/docs/FilterExpressions.md @@ -0,0 +1,26 @@ +# OneSignal::FilterExpressions + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **field** | **String** | Name of the field to use as the first operand in the filter expression. | | +| **key** | **String** | If `field` is `tag`, this field is *required* to specify `key` inside the tags. | [optional] | +| **value** | **String** | Constant value to use as the second operand in the filter expression. This value is *required* when the relation operator is a binary operator. | [optional] | +| **relation** | **String** | Operator of a filter expression. | | +| **operator** | **String** | Strictly, this must be either `\"OR\"`, or `\"AND\"`. It can be used to compose Filters as part of a Filters object. | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::FilterExpressions.new( + field: null, + key: null, + value: null, + relation: null, + operator: null +) +``` + diff --git a/docs/FilterNotificationTarget.md b/docs/FilterNotificationTarget.md new file mode 100644 index 0000000..194820d --- /dev/null +++ b/docs/FilterNotificationTarget.md @@ -0,0 +1,40 @@ +# OneSignal::FilterNotificationTarget + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **last_session** | **String** | relation = \">\" or \"<\" hours_ago = number of hours before or after the users last session. Example: \"1.1\" | [optional] | +| **first_session** | **String** | relation = \">\" or \"<\" hours_ago = number of hours before or after the users first session. Example: \"1.1\" | [optional] | +| **session_count** | **String** | relation = \">\", \"<\", \"=\" or \"!=\" value = number sessions. Example: \"1\" | [optional] | +| **session_time** | **String** | relation = \">\", \"<\", \"=\" or \"!=\" value = Time in seconds the user has been in your app. Example: \"3600\" | [optional] | +| **amount_spent** | **String** | relation = \">\", \"<\", or \"=\" value = Amount in USD a user has spent on IAP (In App Purchases). Example: \"0.99\" | [optional] | +| **bought_sku** | **String** | relation = \">\", \"<\" or \"=\" key = SKU purchased in your app as an IAP (In App Purchases). Example: \"com.domain.100coinpack\" value = value of SKU to compare to. Example: \"0.99\" | [optional] | +| **tag** | **String** | relation = \">\", \"<\", \"=\", \"!=\", \"exists\", \"not_exists\", \"time_elapsed_gt\" (paid plan only) or \"time_elapsed_lt\" (paid plan only) See Time Operators key = Tag key to compare. value = Tag value to compare. Not required for \"exists\" or \"not_exists\". Example: See Formatting Filters | [optional] | +| **language** | **String** | relation = \"=\" or \"!=\" value = 2 character language code. Example: \"en\". For a list of all language codes see Language & Localization. | [optional] | +| **app_version** | **String** | relation = \">\", \"<\", \"=\" or \"!=\" value = app version. Example: \"1.0.0\" | [optional] | +| **location** | **String** | radius = in meters lat = latitude long = longitude | [optional] | +| **email** | **String** | value = email address Only for sending Push Notifications Use this for targeting push subscribers associated with an email set with all SDK setEmail methods To send emails to specific email addresses use include_email_tokens parameter | [optional] | +| **country** | **String** | relation = \"=\" value = 2-digit Country code Example: \"field\": \"country\", \"relation\": \"=\", \"value\", \"US\" | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::FilterNotificationTarget.new( + last_session: null, + first_session: null, + session_count: null, + session_time: null, + amount_spent: null, + bought_sku: null, + tag: null, + language: null, + app_version: null, + location: null, + email: null, + country: null +) +``` + diff --git a/docs/GetNotificationRequestBody.md b/docs/GetNotificationRequestBody.md new file mode 100644 index 0000000..5ae559b --- /dev/null +++ b/docs/GetNotificationRequestBody.md @@ -0,0 +1,22 @@ +# OneSignal::GetNotificationRequestBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **events** | **String** | -> \"sent\" - All the devices by player_id that were sent the specified notification_id. Notifications targeting under 1000 recipients will not have \"sent\" events recorded, but will show \"clicked\" events. \"clicked\" - All the devices by `player_id` that clicked the specified notification_id. | [optional] | +| **email** | **String** | The email address you would like the report sent. | [optional] | +| **app_id** | **String** | | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::GetNotificationRequestBody.new( + events: null, + email: null, + app_id: null +) +``` + diff --git a/docs/InlineResponse200.md b/docs/InlineResponse200.md new file mode 100644 index 0000000..fc1972e --- /dev/null +++ b/docs/InlineResponse200.md @@ -0,0 +1,24 @@ +# OneSignal::InlineResponse200 + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | | | +| **recipients** | **Integer** | Estimated number of subscribers targetted by notification. | | +| **external_id** | **String** | | [optional] | +| **errors** | [**OneOfobjectarray**](OneOfobjectarray.md) | | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::InlineResponse200.new( + id: null, + recipients: null, + external_id: null, + errors: null +) +``` + diff --git a/docs/InlineResponse2001.md b/docs/InlineResponse2001.md new file mode 100644 index 0000000..ab72962 --- /dev/null +++ b/docs/InlineResponse2001.md @@ -0,0 +1,18 @@ +# OneSignal::InlineResponse2001 + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **success** | **String** | | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::InlineResponse2001.new( + success: null +) +``` + diff --git a/docs/InlineResponse2002.md b/docs/InlineResponse2002.md new file mode 100644 index 0000000..ed29ea8 --- /dev/null +++ b/docs/InlineResponse2002.md @@ -0,0 +1,20 @@ +# OneSignal::InlineResponse2002 + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **success** | **String** | | [optional] | +| **destination_url** | **String** | | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::InlineResponse2002.new( + success: null, + destination_url: null +) +``` + diff --git a/docs/InlineResponse2003.md b/docs/InlineResponse2003.md new file mode 100644 index 0000000..c465b45 --- /dev/null +++ b/docs/InlineResponse2003.md @@ -0,0 +1,18 @@ +# OneSignal::InlineResponse2003 + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **success** | **Boolean** | | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::InlineResponse2003.new( + success: null +) +``` + diff --git a/docs/InlineResponse2004.md b/docs/InlineResponse2004.md new file mode 100644 index 0000000..fb1d90c --- /dev/null +++ b/docs/InlineResponse2004.md @@ -0,0 +1,20 @@ +# OneSignal::InlineResponse2004 + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **success** | **Boolean** | | [optional] | +| **id** | **String** | | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::InlineResponse2004.new( + success: null, + id: null +) +``` + diff --git a/docs/InlineResponse2005.md b/docs/InlineResponse2005.md new file mode 100644 index 0000000..6edd9c3 --- /dev/null +++ b/docs/InlineResponse2005.md @@ -0,0 +1,18 @@ +# OneSignal::InlineResponse2005 + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **csv_file_url** | **String** | | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::InlineResponse2005.new( + csv_file_url: null +) +``` + diff --git a/docs/InlineResponse201.md b/docs/InlineResponse201.md new file mode 100644 index 0000000..ff9bcc4 --- /dev/null +++ b/docs/InlineResponse201.md @@ -0,0 +1,20 @@ +# OneSignal::InlineResponse201 + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **success** | **Boolean** | | [optional] | +| **id** | **String** | UUID of created segment | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::InlineResponse201.new( + success: null, + id: null +) +``` + diff --git a/docs/InlineResponse400.md b/docs/InlineResponse400.md new file mode 100644 index 0000000..5ad8d28 --- /dev/null +++ b/docs/InlineResponse400.md @@ -0,0 +1,18 @@ +# OneSignal::InlineResponse400 + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **errors** | **Array<String>** | | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::InlineResponse400.new( + errors: null +) +``` + diff --git a/docs/InlineResponse4001.md b/docs/InlineResponse4001.md new file mode 100644 index 0000000..7ef0b73 --- /dev/null +++ b/docs/InlineResponse4001.md @@ -0,0 +1,20 @@ +# OneSignal::InlineResponse4001 + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **success** | **String** | | [optional] | +| **errors** | **Array<String>** | | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::InlineResponse4001.new( + success: null, + errors: null +) +``` + diff --git a/docs/InlineResponse4002.md b/docs/InlineResponse4002.md new file mode 100644 index 0000000..848bbde --- /dev/null +++ b/docs/InlineResponse4002.md @@ -0,0 +1,18 @@ +# OneSignal::InlineResponse4002 + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **erorrs** | **Array<String>** | | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::InlineResponse4002.new( + erorrs: null +) +``` + diff --git a/docs/InlineResponse409.md b/docs/InlineResponse409.md new file mode 100644 index 0000000..ada9064 --- /dev/null +++ b/docs/InlineResponse409.md @@ -0,0 +1,20 @@ +# OneSignal::InlineResponse409 + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **success** | **Boolean** | | [optional] | +| **errors** | **Array<String>** | | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::InlineResponse409.new( + success: null, + errors: null +) +``` + diff --git a/docs/Notification.md b/docs/Notification.md new file mode 100644 index 0000000..1499c99 --- /dev/null +++ b/docs/Notification.md @@ -0,0 +1,240 @@ +# OneSignal::Notification + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **included_segments** | **Array<String>** | The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] | [optional] | +| **excluded_segments** | **Array<String>** | Segment that will be excluded when sending. Users in these segments will not receive a notification, even if they were included in included_segments. This targeting parameter is only compatible with included_segments. Example: [\"Active Users\", \"Inactive Users\"] | [optional] | +| **last_session** | **String** | relation = \">\" or \"<\" hours_ago = number of hours before or after the users last session. Example: \"1.1\" | [optional] | +| **first_session** | **String** | relation = \">\" or \"<\" hours_ago = number of hours before or after the users first session. Example: \"1.1\" | [optional] | +| **session_count** | **String** | relation = \">\", \"<\", \"=\" or \"!=\" value = number sessions. Example: \"1\" | [optional] | +| **session_time** | **String** | relation = \">\", \"<\", \"=\" or \"!=\" value = Time in seconds the user has been in your app. Example: \"3600\" | [optional] | +| **amount_spent** | **String** | relation = \">\", \"<\", or \"=\" value = Amount in USD a user has spent on IAP (In App Purchases). Example: \"0.99\" | [optional] | +| **bought_sku** | **String** | relation = \">\", \"<\" or \"=\" key = SKU purchased in your app as an IAP (In App Purchases). Example: \"com.domain.100coinpack\" value = value of SKU to compare to. Example: \"0.99\" | [optional] | +| **tag** | **String** | relation = \">\", \"<\", \"=\", \"!=\", \"exists\", \"not_exists\", \"time_elapsed_gt\" (paid plan only) or \"time_elapsed_lt\" (paid plan only) See Time Operators key = Tag key to compare. value = Tag value to compare. Not required for \"exists\" or \"not_exists\". Example: See Formatting Filters | [optional] | +| **language** | **String** | relation = \"=\" or \"!=\" value = 2 character language code. Example: \"en\". For a list of all language codes see Language & Localization. | [optional] | +| **app_version** | **String** | relation = \">\", \"<\", \"=\" or \"!=\" value = app version. Example: \"1.0.0\" | [optional] | +| **location** | **String** | radius = in meters lat = latitude long = longitude | [optional] | +| **email** | **String** | value = email address Only for sending Push Notifications Use this for targeting push subscribers associated with an email set with all SDK setEmail methods To send emails to specific email addresses use include_email_tokens parameter | [optional] | +| **country** | **String** | relation = \"=\" value = 2-digit Country code Example: \"field\": \"country\", \"relation\": \"=\", \"value\", \"US\" | [optional] | +| **include_player_ids** | **Array<String>** | Specific playerids to send your notification to. _Does not require API Auth Key. Do not combine with other targeting parameters. Not compatible with any other targeting parameters. Example: [\"1dd608f2-c6a1-11e3-851d-000c2940e62c\"] Limit of 2,000 entries per REST API call | [optional] | +| **include_external_user_ids** | **Array<String>** | Target specific devices by custom user IDs assigned via API. Not compatible with any other targeting parameters Example: [“custom-id-assigned-by-api”] REQUIRED: REST API Key Authentication Limit of 2,000 entries per REST API call. Note: If targeting push, email, or sms subscribers with same ids, use with channel_for_external_user_ids to indicate you are sending a push or email or sms. | [optional] | +| **include_email_tokens** | **Array<String>** | Recommended for Sending Emails - Target specific email addresses. If an email does not correspond to an existing user, a new user will be created. Example: nick@catfac.ts Limit of 2,000 entries per REST API call | [optional] | +| **include_phone_numbers** | **Array<String>** | Recommended for Sending SMS - Target specific phone numbers. The phone number should be in the E.164 format. Phone number should be an existing subscriber on OneSignal. Refer our docs to learn how to add phone numbers to OneSignal. Example phone number: +1999999999 Limit of 2,000 entries per REST API call | [optional] | +| **include_ios_tokens** | **Array<String>** | Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using iOS device tokens. Warning: Only works with Production tokens. All non-alphanumeric characters must be removed from each token. If a token does not correspond to an existing user, a new user will be created. Example: ce777617da7f548fe7a9ab6febb56cf39fba6d38203... Limit of 2,000 entries per REST API call | [optional] | +| **include_wp_wns_uris** | **Array<String>** | Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Windows URIs. If a token does not correspond to an existing user, a new user will be created. Example: http://s.notify.live.net/u/1/bn1/HmQAAACPaLDr-... Limit of 2,000 entries per REST API call | [optional] | +| **include_amazon_reg_ids** | **Array<String>** | Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Amazon ADM registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: amzn1.adm-registration.v1.XpvSSUk0Rc3hTVVV... Limit of 2,000 entries per REST API call | [optional] | +| **include_chrome_reg_ids** | **Array<String>** | Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Chrome App registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: APA91bEeiUeSukAAUdnw3O2RB45FWlSpgJ7Ji_... Limit of 2,000 entries per REST API call | [optional] | +| **include_chrome_web_reg_ids** | **Array<String>** | Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Chrome Web Push registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: APA91bEeiUeSukAAUdnw3O2RB45FWlSpgJ7Ji_... Limit of 2,000 entries per REST API call | [optional] | +| **include_android_reg_ids** | **Array<String>** | Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Android device registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: APA91bEeiUeSukAAUdnw3O2RB45FWlSpgJ7Ji_... Limit of 2,000 entries per REST API call | [optional] | +| **id** | **String** | | [optional] | +| **value** | **Integer** | | [optional][readonly] | +| **aggregation** | **String** | | [optional][readonly] | +| **is_ios** | **Boolean** | Indicates whether to send to all devices registered under your app's Apple iOS platform. | [optional][default to true] | +| **is_android** | **Boolean** | Indicates whether to send to all devices registered under your app's Google Android platform. | [optional] | +| **is_huawei** | **Boolean** | Indicates whether to send to all devices registered under your app's Huawei Android platform. | [optional] | +| **is_any_web** | **Boolean** | Indicates whether to send to all subscribed web browser users, including Chrome, Firefox, and Safari. You may use this instead as a combined flag instead of separately enabling isChromeWeb, isFirefox, and isSafari, though the three options are equivalent to this one. | [optional] | +| **is_chrome_web** | **Boolean** | Indicates whether to send to all Google Chrome, Chrome on Android, and Mozilla Firefox users registered under your Chrome & Firefox web push platform. | [optional] | +| **is_firefox** | **Boolean** | Indicates whether to send to all Mozilla Firefox desktop users registered under your Firefox web push platform. | [optional] | +| **is_safari** | **Boolean** | Does not support iOS Safari. Indicates whether to send to all Apple's Safari desktop users registered under your Safari web push platform. Read more iOS Safari | [optional] | +| **is_wp_wns** | **Boolean** | Indicates whether to send to all devices registered under your app's Windows platform. | [optional] | +| **is_adm** | **Boolean** | Indicates whether to send to all devices registered under your app's Amazon Fire platform. | [optional] | +| **is_chrome** | **Boolean** | This flag is not used for web push Please see isChromeWeb for sending to web push users. This flag only applies to Google Chrome Apps & Extensions. Indicates whether to send to all devices registered under your app's Google Chrome Apps & Extension platform. | [optional] | +| **channel_for_external_user_ids** | **String** | Indicates if the message type when targeting with include_external_user_ids for cases where an email, sms, and/or push subscribers have the same external user id. Example: Use the string \"push\" to indicate you are sending a push notification or the string \"email\"for sending emails or \"sms\"for sending SMS. | [optional] | +| **app_id** | **String** | Required: Your OneSignal Application ID, which can be found in Keys & IDs. It is a UUID and looks similar to 8250eaf6-1a58-489e-b136-7c74a864b434. | | +| **external_id** | **String** | Correlation and idempotency key. A request received with this parameter will first look for another notification with the same external_id. If one exists, a notification will not be sent, and result of the previous operation will instead be returned. Therefore, if you plan on using this feature, it's important to use a good source of randomness to generate the UUID passed here. This key is only idempotent for 30 days. After 30 days, the notification could be removed from our system and a notification with the same external_id will be sent again. See Idempotent Notification Requests for more details writeOnly: true | [optional] | +| **contents** | [**StringMap**](StringMap.md) | | [optional] | +| **headings** | [**StringMap**](StringMap.md) | | [optional] | +| **subtitle** | [**StringMap**](StringMap.md) | | [optional] | +| **data** | **Object** | Channel: Push Notifications Platform: Huawei A custom map of data that is passed back to your app. Same as using Additional Data within the dashboard. Can use up to 2048 bytes of data. Example: {\"abc\": 123, \"foo\": \"bar\", \"event_performed\": true, \"amount\": 12.1} | [optional] | +| **huawei_msg_type** | **String** | Channel: Push Notifications Platform: Huawei Use \"data\" or \"message\" depending on the type of notification you are sending. More details in Data & Background Notifications. | [optional] | +| **url** | **String** | Channel: Push Notifications Platform: All The URL to open in the browser when a user clicks on the notification. Note: iOS needs https or updated NSAppTransportSecurity in plist This field supports inline substitutions. Omit if including web_url or app_url Example: https://onesignal.com | [optional] | +| **web_url** | **String** | Channel: Push Notifications Platform: All Browsers Same as url but only sent to web push platforms. Including Chrome, Firefox, Safari, Opera, etc. Example: https://onesignal.com | [optional] | +| **app_url** | **String** | Channel: Push Notifications Platform: All Browsers Same as url but only sent to web push platforms. Including iOS, Android, macOS, Windows, ChromeApps, etc. Example: https://onesignal.com | [optional] | +| **ios_attachments** | **Object** | Channel: Push Notifications Platform: iOS 10+ Adds media attachments to notifications. Set as JSON object, key as a media id of your choice and the value as a valid local filename or URL. User must press and hold on the notification to view. Do not set mutable_content to download attachments. The OneSignal SDK does this automatically Example: {\"id1\": \"https://domain.com/image.jpg\"} | [optional] | +| **template_id** | **String** | Channel: Push Notifications Platform: All Use a template you setup on our dashboard. The template_id is the UUID found in the URL when viewing a template on our dashboard. Example: be4a8044-bbd6-11e4-a581-000c2940e62c | [optional] | +| **content_available** | **Boolean** | Channel: Push Notifications Platform: iOS Sending true wakes your app from background to run custom native code (Apple interprets this as content-available=1). Note: Not applicable if the app is in the \"force-quit\" state (i.e app was swiped away). Omit the contents field to prevent displaying a visible notification. | [optional] | +| **mutable_content** | **Boolean** | Channel: Push Notifications Platform: iOS 10+ Always defaults to true and cannot be turned off. Allows tracking of notification receives and changing of the notification content in your app before it is displayed. Triggers didReceive(_:withContentHandler:) on your UNNotificationServiceExtension. | [optional] | +| **target_content_identifier** | **String** | Channel: Push Notifications Platform: iOS 13+ Use to target a specific experience in your App Clip, or to target your notification to a specific window in a multi-scene App. | [optional] | +| **big_picture** | **String** | Channel: Push Notifications Platform: Android Picture to display in the expanded view. Can be a drawable resource name or a URL. | [optional] | +| **huawei_big_picture** | **String** | Channel: Push Notifications Platform: Huawei Picture to display in the expanded view. Can be a drawable resource name or a URL. | [optional] | +| **adm_big_picture** | **String** | Channel: Push Notifications Platform: Amazon Picture to display in the expanded view. Can be a drawable resource name or a URL. | [optional] | +| **chrome_big_picture** | **String** | Channel: Push Notifications Platform: ChromeApp Large picture to display below the notification text. Must be a local URL. | [optional] | +| **chrome_web_image** | **String** | Channel: Push Notifications Platform: Chrome 56+ Sets the web push notification's large image to be shown below the notification's title and text. Please see Web Push Notification Icons. | [optional] | +| **buttons** | [**Array<Button>**](Button.md) | Channel: Push Notifications Platform: iOS 8.0+, Android 4.1+, and derivatives like Amazon Buttons to add to the notification. Icon only works for Android. Buttons show in reverse order of array position i.e. Last item in array shows as first button on device. Example: [{\"id\": \"id2\", \"text\": \"second button\", \"icon\": \"ic_menu_share\"}, {\"id\": \"id1\", \"text\": \"first button\", \"icon\": \"ic_menu_send\"}] | [optional] | +| **web_buttons** | [**Array<Button>**](Button.md) | Channel: Push Notifications Platform: Chrome 48+ Add action buttons to the notification. The id field is required. Example: [{\"id\": \"like-button\", \"text\": \"Like\", \"icon\": \"http://i.imgur.com/N8SN8ZS.png\", \"url\": \"https://yoursite.com\"}, {\"id\": \"read-more-button\", \"text\": \"Read more\", \"icon\": \"http://i.imgur.com/MIxJp1L.png\", \"url\": \"https://yoursite.com\"}] | [optional] | +| **ios_category** | **String** | Channel: Push Notifications Platform: iOS Category APS payload, use with registerUserNotificationSettings:categories in your Objective-C / Swift code. Example: calendar category which contains actions like accept and decline iOS 10+ This will trigger your UNNotificationContentExtension whose ID matches this category. | [optional] | +| **android_channel_id** | **String** | Channel: Push Notifications Platform: Android The Android Oreo Notification Category to send the notification under. See the Category documentation on creating one and getting it's id. | [optional] | +| **huawei_channel_id** | **String** | Channel: Push Notifications Platform: Huawei The Android Oreo Notification Category to send the notification under. See the Category documentation on creating one and getting it's id. | [optional] | +| **existing_android_channel_id** | **String** | Channel: Push Notifications Platform: Android Use this if you have client side Android Oreo Channels you have already defined in your app with code. | [optional] | +| **huawei_existing_channel_id** | **String** | Channel: Push Notifications Platform: Huawei Use this if you have client side Android Oreo Channels you have already defined in your app with code. | [optional] | +| **android_background_layout** | [**NotificationAllOfAndroidBackgroundLayout**](NotificationAllOfAndroidBackgroundLayout.md) | | [optional] | +| **small_icon** | **String** | Channel: Push Notifications Platform: Android Icon shown in the status bar and on the top left of the notification. If not set a bell icon will be used or ic_stat_onesignal_default if you have set this resource name. See: How to create small icons | [optional] | +| **huawei_small_icon** | **String** | Channel: Push Notifications Platform: Huawei Icon shown in the status bar and on the top left of the notification. Use an Android resource path (E.g. /drawable/small_icon). Defaults to your app icon if not set. | [optional] | +| **large_icon** | **String** | Channel: Push Notifications Platform: Android Can be a drawable resource name or a URL. See: How to create large icons | [optional] | +| **huawei_large_icon** | **String** | Channel: Push Notifications Platform: Huawei Can be a drawable resource name or a URL. See: How to create large icons | [optional] | +| **adm_small_icon** | **String** | Channel: Push Notifications Platform: Amazon If not set a bell icon will be used or ic_stat_onesignal_default if you have set this resource name. See: How to create small icons | [optional] | +| **adm_large_icon** | **String** | Channel: Push Notifications Platform: Amazon If blank the small_icon is used. Can be a drawable resource name or a URL. See: How to create large icons | [optional] | +| **chrome_web_icon** | **String** | Channel: Push Notifications Platform: Chrome Sets the web push notification's icon. An image URL linking to a valid image. Common image types are supported; GIF will not animate. We recommend 256x256 (at least 80x80) to display well on high DPI devices. Firefox will also use this icon, unless you specify firefox_icon. | [optional] | +| **chrome_web_badge** | **String** | Channel: Push Notifications Platform: Chrome Sets the web push notification icon for Android devices in the notification shade. Please see Web Push Notification Badge. | [optional] | +| **firefox_icon** | **String** | Channel: Push Notifications Platform: Firefox Not recommended Few people need to set Firefox-specific icons. We recommend setting chrome_web_icon instead, which Firefox will also use. Sets the web push notification's icon for Firefox. An image URL linking to a valid image. Common image types are supported; GIF will not animate. We recommend 256x256 (at least 80x80) to display well on high DPI devices. | [optional] | +| **chrome_icon** | **String** | Channel: Push Notifications Platform: ChromeApp This flag is not used for web push For web push, please see chrome_web_icon instead. The local URL to an icon to use. If blank, the app icon will be used. | [optional] | +| **ios_sound** | **String** | Channel: Push Notifications Platform: iOS Sound file that is included in your app to play instead of the default device notification sound. Pass nil to disable vibration and sound for the notification. Example: \"notification.wav\" | [optional] | +| **android_sound** | **String** | Channel: Push Notifications Platform: Android ⚠Deprecated, this field doesn't work on Android 8 (Oreo) and newer devices! Please use Notification Categories / Channels noted above instead to support ALL versions of Android. Sound file that is included in your app to play instead of the default device notification sound. Pass nil to disable sound for the notification. NOTE: Leave off file extension for Android. Example: \"notification\" | [optional] | +| **huawei_sound** | **String** | Channel: Push Notifications Platform: Huawei ⚠Deprecated, this field ONLY works on EMUI 5 (Android 7 based) and older devices. Please also set Notification Categories / Channels noted above to support EMUI 8 (Android 8 based) devices. Sound file that is included in your app to play instead of the default device notification sound. NOTE: Leave off file extension for and include the full path. Example: \"/res/raw/notification\" | [optional] | +| **adm_sound** | **String** | Channel: Push Notifications Platform: Amazon ⚠Deprecated, this field doesn't work on Android 8 (Oreo) and newer devices! Please use Notification Categories / Channels noted above instead to support ALL versions of Android. Sound file that is included in your app to play instead of the default device notification sound. Pass nil to disable sound for the notification. NOTE: Leave off file extension for Android. Example: \"notification\" | [optional] | +| **wp_wns_sound** | **String** | Channel: Push Notifications Platform: Windows Sound file that is included in your app to play instead of the default device notification sound. Example: \"notification.wav\" | [optional] | +| **android_led_color** | **String** | Channel: Push Notifications Platform: Android ⚠Deprecated, this field doesn't work on Android 8 (Oreo) and newer devices! Please use Notification Categories / Channels noted above instead to support ALL versions of Android. Sets the devices LED notification light if the device has one. ARGB Hex format. Example(Blue): \"FF0000FF\" | [optional] | +| **huawei_led_color** | **String** | Channel: Push Notifications Platform: Huawei ⚠Deprecated, this field ONLY works on EMUI 5 (Android 7 based) and older devices. Please also set Notification Categories / Channels noted above to support EMUI 8 (Android 8 based) devices. Sets the devices LED notification light if the device has one. RGB Hex format. Example(Blue): \"0000FF\" | [optional] | +| **android_accent_color** | **String** | Channel: Push Notifications Platform: Android Sets the background color of the notification circle to the left of the notification text. Only applies to apps targeting Android API level 21+ on Android 5.0+ devices. Example(Red): \"FFFF0000\" | [optional] | +| **huawei_accent_color** | **String** | Channel: Push Notifications Platform: Huawei Accent Color used on Action Buttons and Group overflow count. Uses RGB Hex value (E.g. #9900FF). Defaults to device’s theme color if not set. | [optional] | +| **android_visibility** | **Integer** | Channel: Push Notifications Platform: Android 5.0_ ⚠Deprecated, this field doesn't work on Android 8 (Oreo) and newer devices! Please use Notification Categories / Channels noted above instead to support ALL versions of Android. 1 = Public (default) (Shows the full message on the lock screen unless the user has disabled all notifications from showing on the lock screen. Please consider the user and mark private if the contents are.) 0 = Private (Hides message contents on lock screen if the user set \"Hide sensitive notification content\" in the system settings) -1 = Secret (Notification does not show on the lock screen at all) | [optional] | +| **huawei_visibility** | **Integer** | Channel: Push Notifications Platform: Huawei ⚠Deprecated, this field ONLY works on EMUI 5 (Android 7 based) and older devices. Please also set Notification Categories / Channels noted above to support EMUI 8 (Android 8 based) devices. 1 = Public (default) (Shows the full message on the lock screen unless the user has disabled all notifications from showing on the lock screen. Please consider the user and mark private if the contents are.) 0 = Private (Hides message contents on lock screen if the user set \"Hide sensitive notification content\" in the system settings) -1 = Secret (Notification does not show on the lock screen at all) | [optional] | +| **ios_badge_type** | **String** | Channel: Push Notifications Platform: iOS Describes whether to set or increase/decrease your app's iOS badge count by the ios_badgeCount specified count. Can specify None, SetTo, or Increase. `None` leaves the count unaffected. `SetTo` directly sets the badge count to the number specified in ios_badgeCount. `Increase` adds the number specified in ios_badgeCount to the total. Use a negative number to decrease the badge count. | [optional] | +| **ios_badge_count** | **Integer** | Channel: Push Notifications Platform: iOS Used with ios_badgeType, describes the value to set or amount to increase/decrease your app's iOS badge count by. You can use a negative number to decrease the badge count when used with an ios_badgeType of Increase. | [optional] | +| **collapse_id** | **String** | Channel: Push Notifications Platform: iOS 10+, Android Only one notification with the same id will be shown on the device. Use the same id to update an existing notification instead of showing a new one. Limit of 64 characters. | [optional] | +| **web_push_topic** | **String** | Channel: Push Notifications Platform: All Browsers Display multiple notifications at once with different topics. | [optional] | +| **apns_alert** | **Object** | Channel: Push Notifications Platform: iOS 10+ iOS can localize push notification messages on the client using special parameters such as loc-key. When using the Create Notification endpoint, you must include these parameters inside of a field called apns_alert. Please see Apple's guide on localizing push notifications to learn more. | [optional] | +| **send_after** | **String** | Channel: All Schedule notification for future delivery. API defaults to UTC -1100 Examples: All examples are the exact same date & time. \"Thu Sep 24 2015 14:00:00 GMT-0700 (PDT)\" \"September 24th 2015, 2:00:00 pm UTC-07:00\" \"2015-09-24 14:00:00 GMT-0700\" \"Sept 24 2015 14:00:00 GMT-0700\" \"Thu Sep 24 2015 14:00:00 GMT-0700 (Pacific Daylight Time)\" Note: SMS currently only supports send_after parameter. | [optional] | +| **delayed_option** | **String** | Channel: All Possible values are: timezone (Deliver at a specific time-of-day in each users own timezone) last-active Same as Intelligent Delivery . (Deliver at the same time of day as each user last used your app). If send_after is used, this takes effect after the send_after time has elapsed. | [optional] | +| **delivery_time_of_day** | **String** | Channel: All Use with delayed_option=timezone. Examples: \"9:00AM\" \"21:45\" \"9:45:30\" | [optional] | +| **ttl** | **Integer** | Channel: Push Notifications Platform: iOS, Android, Chrome, Firefox, Safari, ChromeWeb Time To Live - In seconds. The notification will be expired if the device does not come back online within this time. The default is 259,200 seconds (3 days). Max value to set is 2419200 seconds (28 days). | [optional] | +| **priority** | **Integer** | Channel: Push Notifications Platform: Android, Chrome, ChromeWeb Delivery priority through the push server (example GCM/FCM). Pass 10 for high priority or any other integer for normal priority. Defaults to normal priority for Android and high for iOS. For Android 6.0+ devices setting priority to high will wake the device out of doze mode. | [optional] | +| **apns_push_type_override** | **String** | Channel: Push Notifications Platform: iOS valid values: voip Set the value to voip for sending VoIP Notifications This field maps to the APNS header apns-push-type. Note: alert and background are automatically set by OneSignal | [optional] | +| **throttle_rate_per_minute** | **String** | Channel: All Apps with throttling enabled: - the parameter value will be used to override the default application throttling value set from the dashboard settings. - parameter value 0 indicates not to apply throttling to the notification. - if the parameter is not passed then the default app throttling value will be applied to the notification. Apps with throttling disabled: - this parameter can be used to throttle delivery for the notification even though throttling is not enabled at the application level. Refer to throttling for more details. | [optional] | +| **android_group** | **String** | Channel: Push Notifications Platform: Android Notifications with the same group will be stacked together using Android's Notification Grouping feature. | [optional] | +| **android_group_message** | **String** | Channel: Push Notifications Platform: Android Note: This only works for Android 6 and older. Android 7+ allows full expansion of all message. Summary message to display when 2+ notifications are stacked together. Default is \"# new messages\". Include $[notif_count] in your message and it will be replaced with the current number. Languages - The value of each key is the message that will be sent to users for that language. \"en\" (English) is required. The key of each hash is either a a 2 character language code or one of zh-Hans/zh-Hant for Simplified or Traditional Chinese. Read more: supported languages. Example: {\"en\": \"You have $[notif_count] new messages\"} | [optional] | +| **adm_group** | **String** | Channel: Push Notifications Platform: Amazon Notifications with the same group will be stacked together using Android's Notification Grouping feature. | [optional] | +| **adm_group_message** | **Object** | Channel: Push Notifications Platform: Amazon Summary message to display when 2+ notifications are stacked together. Default is \"# new messages\". Include $[notif_count] in your message and it will be replaced with the current number. \"en\" (English) is required. The key of each hash is either a a 2 character language code or one of zh-Hans/zh-Hant for Simplified or Traditional Chinese. The value of each key is the message that will be sent to users for that language. Example: {\"en\": \"You have $[notif_count] new messages\"} | [optional] | +| **thread_id** | **String** | Channel: Push Notifications Platform: iOS 12+ This parameter is supported in iOS 12 and above. It allows you to group related notifications together. If two notifications have the same thread-id, they will both be added to the same group. | [optional] | +| **summary_arg** | **String** | Channel: Push Notifications Platform: iOS 12+ When using thread_id to create grouped notifications in iOS 12+, you can also control the summary. For example, a grouped notification can say \"12 more notifications from John Doe\". The summary_arg lets you set the name of the person/thing the notifications are coming from, and will show up as \"X more notifications from summary_arg\" | [optional] | +| **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] | +| **email_subect** | **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] | +| **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] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::Notification.new( + included_segments: null, + excluded_segments: null, + last_session: null, + first_session: null, + session_count: null, + session_time: null, + amount_spent: null, + bought_sku: null, + tag: null, + language: null, + app_version: null, + location: null, + email: null, + country: null, + include_player_ids: null, + include_external_user_ids: null, + include_email_tokens: null, + include_phone_numbers: null, + include_ios_tokens: null, + include_wp_wns_uris: null, + include_amazon_reg_ids: null, + include_chrome_reg_ids: null, + include_chrome_web_reg_ids: null, + include_android_reg_ids: null, + id: null, + value: null, + aggregation: null, + is_ios: null, + is_android: null, + is_huawei: null, + is_any_web: null, + is_chrome_web: null, + is_firefox: null, + is_safari: null, + is_wp_wns: null, + is_adm: null, + is_chrome: null, + channel_for_external_user_ids: null, + app_id: null, + external_id: null, + contents: null, + headings: null, + subtitle: null, + data: null, + huawei_msg_type: null, + url: null, + web_url: null, + app_url: null, + ios_attachments: null, + template_id: null, + content_available: null, + mutable_content: null, + target_content_identifier: null, + big_picture: null, + huawei_big_picture: null, + adm_big_picture: null, + chrome_big_picture: null, + chrome_web_image: null, + buttons: null, + web_buttons: null, + ios_category: null, + android_channel_id: null, + huawei_channel_id: null, + existing_android_channel_id: null, + huawei_existing_channel_id: null, + android_background_layout: null, + small_icon: null, + huawei_small_icon: null, + large_icon: null, + huawei_large_icon: null, + adm_small_icon: null, + adm_large_icon: null, + chrome_web_icon: null, + chrome_web_badge: null, + firefox_icon: null, + chrome_icon: null, + ios_sound: null, + android_sound: null, + huawei_sound: null, + adm_sound: null, + wp_wns_sound: null, + android_led_color: null, + huawei_led_color: null, + android_accent_color: null, + huawei_accent_color: null, + android_visibility: null, + huawei_visibility: null, + ios_badge_type: null, + ios_badge_count: null, + collapse_id: null, + web_push_topic: null, + apns_alert: null, + send_after: null, + delayed_option: null, + delivery_time_of_day: null, + ttl: null, + priority: null, + apns_push_type_override: null, + throttle_rate_per_minute: null, + android_group: null, + android_group_message: null, + adm_group: null, + adm_group_message: null, + thread_id: null, + summary_arg: null, + summary_arg_count: null, + email_subect: null, + email_body: null, + email_from_name: null, + email_from_address: null, + sms_from: null, + sms_media_urls: null +) +``` + diff --git a/docs/NotificationAllOf.md b/docs/NotificationAllOf.md new file mode 100644 index 0000000..45e8b81 --- /dev/null +++ b/docs/NotificationAllOf.md @@ -0,0 +1,192 @@ +# OneSignal::NotificationAllOf + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | | [optional] | +| **value** | **Integer** | | [optional][readonly] | +| **aggregation** | **String** | | [optional][readonly] | +| **is_ios** | **Boolean** | Indicates whether to send to all devices registered under your app's Apple iOS platform. | [optional][default to true] | +| **is_android** | **Boolean** | Indicates whether to send to all devices registered under your app's Google Android platform. | [optional] | +| **is_huawei** | **Boolean** | Indicates whether to send to all devices registered under your app's Huawei Android platform. | [optional] | +| **is_any_web** | **Boolean** | Indicates whether to send to all subscribed web browser users, including Chrome, Firefox, and Safari. You may use this instead as a combined flag instead of separately enabling isChromeWeb, isFirefox, and isSafari, though the three options are equivalent to this one. | [optional] | +| **is_chrome_web** | **Boolean** | Indicates whether to send to all Google Chrome, Chrome on Android, and Mozilla Firefox users registered under your Chrome & Firefox web push platform. | [optional] | +| **is_firefox** | **Boolean** | Indicates whether to send to all Mozilla Firefox desktop users registered under your Firefox web push platform. | [optional] | +| **is_safari** | **Boolean** | Does not support iOS Safari. Indicates whether to send to all Apple's Safari desktop users registered under your Safari web push platform. Read more iOS Safari | [optional] | +| **is_wp_wns** | **Boolean** | Indicates whether to send to all devices registered under your app's Windows platform. | [optional] | +| **is_adm** | **Boolean** | Indicates whether to send to all devices registered under your app's Amazon Fire platform. | [optional] | +| **is_chrome** | **Boolean** | This flag is not used for web push Please see isChromeWeb for sending to web push users. This flag only applies to Google Chrome Apps & Extensions. Indicates whether to send to all devices registered under your app's Google Chrome Apps & Extension platform. | [optional] | +| **channel_for_external_user_ids** | **String** | Indicates if the message type when targeting with include_external_user_ids for cases where an email, sms, and/or push subscribers have the same external user id. Example: Use the string \"push\" to indicate you are sending a push notification or the string \"email\"for sending emails or \"sms\"for sending SMS. | [optional] | +| **app_id** | **String** | Required: Your OneSignal Application ID, which can be found in Keys & IDs. It is a UUID and looks similar to 8250eaf6-1a58-489e-b136-7c74a864b434. | [optional] | +| **external_id** | **String** | Correlation and idempotency key. A request received with this parameter will first look for another notification with the same external_id. If one exists, a notification will not be sent, and result of the previous operation will instead be returned. Therefore, if you plan on using this feature, it's important to use a good source of randomness to generate the UUID passed here. This key is only idempotent for 30 days. After 30 days, the notification could be removed from our system and a notification with the same external_id will be sent again. See Idempotent Notification Requests for more details writeOnly: true | [optional] | +| **contents** | [**StringMap**](StringMap.md) | | [optional] | +| **headings** | [**StringMap**](StringMap.md) | | [optional] | +| **subtitle** | [**StringMap**](StringMap.md) | | [optional] | +| **data** | **Object** | Channel: Push Notifications Platform: Huawei A custom map of data that is passed back to your app. Same as using Additional Data within the dashboard. Can use up to 2048 bytes of data. Example: {\"abc\": 123, \"foo\": \"bar\", \"event_performed\": true, \"amount\": 12.1} | [optional] | +| **huawei_msg_type** | **String** | Channel: Push Notifications Platform: Huawei Use \"data\" or \"message\" depending on the type of notification you are sending. More details in Data & Background Notifications. | [optional] | +| **url** | **String** | Channel: Push Notifications Platform: All The URL to open in the browser when a user clicks on the notification. Note: iOS needs https or updated NSAppTransportSecurity in plist This field supports inline substitutions. Omit if including web_url or app_url Example: https://onesignal.com | [optional] | +| **web_url** | **String** | Channel: Push Notifications Platform: All Browsers Same as url but only sent to web push platforms. Including Chrome, Firefox, Safari, Opera, etc. Example: https://onesignal.com | [optional] | +| **app_url** | **String** | Channel: Push Notifications Platform: All Browsers Same as url but only sent to web push platforms. Including iOS, Android, macOS, Windows, ChromeApps, etc. Example: https://onesignal.com | [optional] | +| **ios_attachments** | **Object** | Channel: Push Notifications Platform: iOS 10+ Adds media attachments to notifications. Set as JSON object, key as a media id of your choice and the value as a valid local filename or URL. User must press and hold on the notification to view. Do not set mutable_content to download attachments. The OneSignal SDK does this automatically Example: {\"id1\": \"https://domain.com/image.jpg\"} | [optional] | +| **template_id** | **String** | Channel: Push Notifications Platform: All Use a template you setup on our dashboard. The template_id is the UUID found in the URL when viewing a template on our dashboard. Example: be4a8044-bbd6-11e4-a581-000c2940e62c | [optional] | +| **content_available** | **Boolean** | Channel: Push Notifications Platform: iOS Sending true wakes your app from background to run custom native code (Apple interprets this as content-available=1). Note: Not applicable if the app is in the \"force-quit\" state (i.e app was swiped away). Omit the contents field to prevent displaying a visible notification. | [optional] | +| **mutable_content** | **Boolean** | Channel: Push Notifications Platform: iOS 10+ Always defaults to true and cannot be turned off. Allows tracking of notification receives and changing of the notification content in your app before it is displayed. Triggers didReceive(_:withContentHandler:) on your UNNotificationServiceExtension. | [optional] | +| **target_content_identifier** | **String** | Channel: Push Notifications Platform: iOS 13+ Use to target a specific experience in your App Clip, or to target your notification to a specific window in a multi-scene App. | [optional] | +| **big_picture** | **String** | Channel: Push Notifications Platform: Android Picture to display in the expanded view. Can be a drawable resource name or a URL. | [optional] | +| **huawei_big_picture** | **String** | Channel: Push Notifications Platform: Huawei Picture to display in the expanded view. Can be a drawable resource name or a URL. | [optional] | +| **adm_big_picture** | **String** | Channel: Push Notifications Platform: Amazon Picture to display in the expanded view. Can be a drawable resource name or a URL. | [optional] | +| **chrome_big_picture** | **String** | Channel: Push Notifications Platform: ChromeApp Large picture to display below the notification text. Must be a local URL. | [optional] | +| **chrome_web_image** | **String** | Channel: Push Notifications Platform: Chrome 56+ Sets the web push notification's large image to be shown below the notification's title and text. Please see Web Push Notification Icons. | [optional] | +| **buttons** | [**Array<Button>**](Button.md) | Channel: Push Notifications Platform: iOS 8.0+, Android 4.1+, and derivatives like Amazon Buttons to add to the notification. Icon only works for Android. Buttons show in reverse order of array position i.e. Last item in array shows as first button on device. Example: [{\"id\": \"id2\", \"text\": \"second button\", \"icon\": \"ic_menu_share\"}, {\"id\": \"id1\", \"text\": \"first button\", \"icon\": \"ic_menu_send\"}] | [optional] | +| **web_buttons** | [**Array<Button>**](Button.md) | Channel: Push Notifications Platform: Chrome 48+ Add action buttons to the notification. The id field is required. Example: [{\"id\": \"like-button\", \"text\": \"Like\", \"icon\": \"http://i.imgur.com/N8SN8ZS.png\", \"url\": \"https://yoursite.com\"}, {\"id\": \"read-more-button\", \"text\": \"Read more\", \"icon\": \"http://i.imgur.com/MIxJp1L.png\", \"url\": \"https://yoursite.com\"}] | [optional] | +| **ios_category** | **String** | Channel: Push Notifications Platform: iOS Category APS payload, use with registerUserNotificationSettings:categories in your Objective-C / Swift code. Example: calendar category which contains actions like accept and decline iOS 10+ This will trigger your UNNotificationContentExtension whose ID matches this category. | [optional] | +| **android_channel_id** | **String** | Channel: Push Notifications Platform: Android The Android Oreo Notification Category to send the notification under. See the Category documentation on creating one and getting it's id. | [optional] | +| **huawei_channel_id** | **String** | Channel: Push Notifications Platform: Huawei The Android Oreo Notification Category to send the notification under. See the Category documentation on creating one and getting it's id. | [optional] | +| **existing_android_channel_id** | **String** | Channel: Push Notifications Platform: Android Use this if you have client side Android Oreo Channels you have already defined in your app with code. | [optional] | +| **huawei_existing_channel_id** | **String** | Channel: Push Notifications Platform: Huawei Use this if you have client side Android Oreo Channels you have already defined in your app with code. | [optional] | +| **android_background_layout** | [**NotificationAllOfAndroidBackgroundLayout**](NotificationAllOfAndroidBackgroundLayout.md) | | [optional] | +| **small_icon** | **String** | Channel: Push Notifications Platform: Android Icon shown in the status bar and on the top left of the notification. If not set a bell icon will be used or ic_stat_onesignal_default if you have set this resource name. See: How to create small icons | [optional] | +| **huawei_small_icon** | **String** | Channel: Push Notifications Platform: Huawei Icon shown in the status bar and on the top left of the notification. Use an Android resource path (E.g. /drawable/small_icon). Defaults to your app icon if not set. | [optional] | +| **large_icon** | **String** | Channel: Push Notifications Platform: Android Can be a drawable resource name or a URL. See: How to create large icons | [optional] | +| **huawei_large_icon** | **String** | Channel: Push Notifications Platform: Huawei Can be a drawable resource name or a URL. See: How to create large icons | [optional] | +| **adm_small_icon** | **String** | Channel: Push Notifications Platform: Amazon If not set a bell icon will be used or ic_stat_onesignal_default if you have set this resource name. See: How to create small icons | [optional] | +| **adm_large_icon** | **String** | Channel: Push Notifications Platform: Amazon If blank the small_icon is used. Can be a drawable resource name or a URL. See: How to create large icons | [optional] | +| **chrome_web_icon** | **String** | Channel: Push Notifications Platform: Chrome Sets the web push notification's icon. An image URL linking to a valid image. Common image types are supported; GIF will not animate. We recommend 256x256 (at least 80x80) to display well on high DPI devices. Firefox will also use this icon, unless you specify firefox_icon. | [optional] | +| **chrome_web_badge** | **String** | Channel: Push Notifications Platform: Chrome Sets the web push notification icon for Android devices in the notification shade. Please see Web Push Notification Badge. | [optional] | +| **firefox_icon** | **String** | Channel: Push Notifications Platform: Firefox Not recommended Few people need to set Firefox-specific icons. We recommend setting chrome_web_icon instead, which Firefox will also use. Sets the web push notification's icon for Firefox. An image URL linking to a valid image. Common image types are supported; GIF will not animate. We recommend 256x256 (at least 80x80) to display well on high DPI devices. | [optional] | +| **chrome_icon** | **String** | Channel: Push Notifications Platform: ChromeApp This flag is not used for web push For web push, please see chrome_web_icon instead. The local URL to an icon to use. If blank, the app icon will be used. | [optional] | +| **ios_sound** | **String** | Channel: Push Notifications Platform: iOS Sound file that is included in your app to play instead of the default device notification sound. Pass nil to disable vibration and sound for the notification. Example: \"notification.wav\" | [optional] | +| **android_sound** | **String** | Channel: Push Notifications Platform: Android ⚠Deprecated, this field doesn't work on Android 8 (Oreo) and newer devices! Please use Notification Categories / Channels noted above instead to support ALL versions of Android. Sound file that is included in your app to play instead of the default device notification sound. Pass nil to disable sound for the notification. NOTE: Leave off file extension for Android. Example: \"notification\" | [optional] | +| **huawei_sound** | **String** | Channel: Push Notifications Platform: Huawei ⚠Deprecated, this field ONLY works on EMUI 5 (Android 7 based) and older devices. Please also set Notification Categories / Channels noted above to support EMUI 8 (Android 8 based) devices. Sound file that is included in your app to play instead of the default device notification sound. NOTE: Leave off file extension for and include the full path. Example: \"/res/raw/notification\" | [optional] | +| **adm_sound** | **String** | Channel: Push Notifications Platform: Amazon ⚠Deprecated, this field doesn't work on Android 8 (Oreo) and newer devices! Please use Notification Categories / Channels noted above instead to support ALL versions of Android. Sound file that is included in your app to play instead of the default device notification sound. Pass nil to disable sound for the notification. NOTE: Leave off file extension for Android. Example: \"notification\" | [optional] | +| **wp_wns_sound** | **String** | Channel: Push Notifications Platform: Windows Sound file that is included in your app to play instead of the default device notification sound. Example: \"notification.wav\" | [optional] | +| **android_led_color** | **String** | Channel: Push Notifications Platform: Android ⚠Deprecated, this field doesn't work on Android 8 (Oreo) and newer devices! Please use Notification Categories / Channels noted above instead to support ALL versions of Android. Sets the devices LED notification light if the device has one. ARGB Hex format. Example(Blue): \"FF0000FF\" | [optional] | +| **huawei_led_color** | **String** | Channel: Push Notifications Platform: Huawei ⚠Deprecated, this field ONLY works on EMUI 5 (Android 7 based) and older devices. Please also set Notification Categories / Channels noted above to support EMUI 8 (Android 8 based) devices. Sets the devices LED notification light if the device has one. RGB Hex format. Example(Blue): \"0000FF\" | [optional] | +| **android_accent_color** | **String** | Channel: Push Notifications Platform: Android Sets the background color of the notification circle to the left of the notification text. Only applies to apps targeting Android API level 21+ on Android 5.0+ devices. Example(Red): \"FFFF0000\" | [optional] | +| **huawei_accent_color** | **String** | Channel: Push Notifications Platform: Huawei Accent Color used on Action Buttons and Group overflow count. Uses RGB Hex value (E.g. #9900FF). Defaults to device’s theme color if not set. | [optional] | +| **android_visibility** | **Integer** | Channel: Push Notifications Platform: Android 5.0_ ⚠Deprecated, this field doesn't work on Android 8 (Oreo) and newer devices! Please use Notification Categories / Channels noted above instead to support ALL versions of Android. 1 = Public (default) (Shows the full message on the lock screen unless the user has disabled all notifications from showing on the lock screen. Please consider the user and mark private if the contents are.) 0 = Private (Hides message contents on lock screen if the user set \"Hide sensitive notification content\" in the system settings) -1 = Secret (Notification does not show on the lock screen at all) | [optional] | +| **huawei_visibility** | **Integer** | Channel: Push Notifications Platform: Huawei ⚠Deprecated, this field ONLY works on EMUI 5 (Android 7 based) and older devices. Please also set Notification Categories / Channels noted above to support EMUI 8 (Android 8 based) devices. 1 = Public (default) (Shows the full message on the lock screen unless the user has disabled all notifications from showing on the lock screen. Please consider the user and mark private if the contents are.) 0 = Private (Hides message contents on lock screen if the user set \"Hide sensitive notification content\" in the system settings) -1 = Secret (Notification does not show on the lock screen at all) | [optional] | +| **ios_badge_type** | **String** | Channel: Push Notifications Platform: iOS Describes whether to set or increase/decrease your app's iOS badge count by the ios_badgeCount specified count. Can specify None, SetTo, or Increase. `None` leaves the count unaffected. `SetTo` directly sets the badge count to the number specified in ios_badgeCount. `Increase` adds the number specified in ios_badgeCount to the total. Use a negative number to decrease the badge count. | [optional] | +| **ios_badge_count** | **Integer** | Channel: Push Notifications Platform: iOS Used with ios_badgeType, describes the value to set or amount to increase/decrease your app's iOS badge count by. You can use a negative number to decrease the badge count when used with an ios_badgeType of Increase. | [optional] | +| **collapse_id** | **String** | Channel: Push Notifications Platform: iOS 10+, Android Only one notification with the same id will be shown on the device. Use the same id to update an existing notification instead of showing a new one. Limit of 64 characters. | [optional] | +| **web_push_topic** | **String** | Channel: Push Notifications Platform: All Browsers Display multiple notifications at once with different topics. | [optional] | +| **apns_alert** | **Object** | Channel: Push Notifications Platform: iOS 10+ iOS can localize push notification messages on the client using special parameters such as loc-key. When using the Create Notification endpoint, you must include these parameters inside of a field called apns_alert. Please see Apple's guide on localizing push notifications to learn more. | [optional] | +| **send_after** | **String** | Channel: All Schedule notification for future delivery. API defaults to UTC -1100 Examples: All examples are the exact same date & time. \"Thu Sep 24 2015 14:00:00 GMT-0700 (PDT)\" \"September 24th 2015, 2:00:00 pm UTC-07:00\" \"2015-09-24 14:00:00 GMT-0700\" \"Sept 24 2015 14:00:00 GMT-0700\" \"Thu Sep 24 2015 14:00:00 GMT-0700 (Pacific Daylight Time)\" Note: SMS currently only supports send_after parameter. | [optional] | +| **delayed_option** | **String** | Channel: All Possible values are: timezone (Deliver at a specific time-of-day in each users own timezone) last-active Same as Intelligent Delivery . (Deliver at the same time of day as each user last used your app). If send_after is used, this takes effect after the send_after time has elapsed. | [optional] | +| **delivery_time_of_day** | **String** | Channel: All Use with delayed_option=timezone. Examples: \"9:00AM\" \"21:45\" \"9:45:30\" | [optional] | +| **ttl** | **Integer** | Channel: Push Notifications Platform: iOS, Android, Chrome, Firefox, Safari, ChromeWeb Time To Live - In seconds. The notification will be expired if the device does not come back online within this time. The default is 259,200 seconds (3 days). Max value to set is 2419200 seconds (28 days). | [optional] | +| **priority** | **Integer** | Channel: Push Notifications Platform: Android, Chrome, ChromeWeb Delivery priority through the push server (example GCM/FCM). Pass 10 for high priority or any other integer for normal priority. Defaults to normal priority for Android and high for iOS. For Android 6.0+ devices setting priority to high will wake the device out of doze mode. | [optional] | +| **apns_push_type_override** | **String** | Channel: Push Notifications Platform: iOS valid values: voip Set the value to voip for sending VoIP Notifications This field maps to the APNS header apns-push-type. Note: alert and background are automatically set by OneSignal | [optional] | +| **throttle_rate_per_minute** | **String** | Channel: All Apps with throttling enabled: - the parameter value will be used to override the default application throttling value set from the dashboard settings. - parameter value 0 indicates not to apply throttling to the notification. - if the parameter is not passed then the default app throttling value will be applied to the notification. Apps with throttling disabled: - this parameter can be used to throttle delivery for the notification even though throttling is not enabled at the application level. Refer to throttling for more details. | [optional] | +| **android_group** | **String** | Channel: Push Notifications Platform: Android Notifications with the same group will be stacked together using Android's Notification Grouping feature. | [optional] | +| **android_group_message** | **String** | Channel: Push Notifications Platform: Android Note: This only works for Android 6 and older. Android 7+ allows full expansion of all message. Summary message to display when 2+ notifications are stacked together. Default is \"# new messages\". Include $[notif_count] in your message and it will be replaced with the current number. Languages - The value of each key is the message that will be sent to users for that language. \"en\" (English) is required. The key of each hash is either a a 2 character language code or one of zh-Hans/zh-Hant for Simplified or Traditional Chinese. Read more: supported languages. Example: {\"en\": \"You have $[notif_count] new messages\"} | [optional] | +| **adm_group** | **String** | Channel: Push Notifications Platform: Amazon Notifications with the same group will be stacked together using Android's Notification Grouping feature. | [optional] | +| **adm_group_message** | **Object** | Channel: Push Notifications Platform: Amazon Summary message to display when 2+ notifications are stacked together. Default is \"# new messages\". Include $[notif_count] in your message and it will be replaced with the current number. \"en\" (English) is required. The key of each hash is either a a 2 character language code or one of zh-Hans/zh-Hant for Simplified or Traditional Chinese. The value of each key is the message that will be sent to users for that language. Example: {\"en\": \"You have $[notif_count] new messages\"} | [optional] | +| **thread_id** | **String** | Channel: Push Notifications Platform: iOS 12+ This parameter is supported in iOS 12 and above. It allows you to group related notifications together. If two notifications have the same thread-id, they will both be added to the same group. | [optional] | +| **summary_arg** | **String** | Channel: Push Notifications Platform: iOS 12+ When using thread_id to create grouped notifications in iOS 12+, you can also control the summary. For example, a grouped notification can say \"12 more notifications from John Doe\". The summary_arg lets you set the name of the person/thing the notifications are coming from, and will show up as \"X more notifications from summary_arg\" | [optional] | +| **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] | +| **email_subect** | **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] | +| **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] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::NotificationAllOf.new( + id: null, + value: null, + aggregation: null, + is_ios: null, + is_android: null, + is_huawei: null, + is_any_web: null, + is_chrome_web: null, + is_firefox: null, + is_safari: null, + is_wp_wns: null, + is_adm: null, + is_chrome: null, + channel_for_external_user_ids: null, + app_id: null, + external_id: null, + contents: null, + headings: null, + subtitle: null, + data: null, + huawei_msg_type: null, + url: null, + web_url: null, + app_url: null, + ios_attachments: null, + template_id: null, + content_available: null, + mutable_content: null, + target_content_identifier: null, + big_picture: null, + huawei_big_picture: null, + adm_big_picture: null, + chrome_big_picture: null, + chrome_web_image: null, + buttons: null, + web_buttons: null, + ios_category: null, + android_channel_id: null, + huawei_channel_id: null, + existing_android_channel_id: null, + huawei_existing_channel_id: null, + android_background_layout: null, + small_icon: null, + huawei_small_icon: null, + large_icon: null, + huawei_large_icon: null, + adm_small_icon: null, + adm_large_icon: null, + chrome_web_icon: null, + chrome_web_badge: null, + firefox_icon: null, + chrome_icon: null, + ios_sound: null, + android_sound: null, + huawei_sound: null, + adm_sound: null, + wp_wns_sound: null, + android_led_color: null, + huawei_led_color: null, + android_accent_color: null, + huawei_accent_color: null, + android_visibility: null, + huawei_visibility: null, + ios_badge_type: null, + ios_badge_count: null, + collapse_id: null, + web_push_topic: null, + apns_alert: null, + send_after: null, + delayed_option: null, + delivery_time_of_day: null, + ttl: null, + priority: null, + apns_push_type_override: null, + throttle_rate_per_minute: null, + android_group: null, + android_group_message: null, + adm_group: null, + adm_group_message: null, + thread_id: null, + summary_arg: null, + summary_arg_count: null, + email_subect: null, + email_body: null, + email_from_name: null, + email_from_address: null, + sms_from: null, + sms_media_urls: null +) +``` + diff --git a/docs/NotificationAllOfAndroidBackgroundLayout.md b/docs/NotificationAllOfAndroidBackgroundLayout.md new file mode 100644 index 0000000..b26210d --- /dev/null +++ b/docs/NotificationAllOfAndroidBackgroundLayout.md @@ -0,0 +1,22 @@ +# OneSignal::NotificationAllOfAndroidBackgroundLayout + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **image** | **String** | Asset file, android resource name, or URL to remote image. | [optional] | +| **headings_color** | **String** | Title text color ARGB Hex format. Example(Blue) \"FF0000FF\". | [optional] | +| **contents_color** | **String** | Body text color ARGB Hex format. Example(Red) \"FFFF0000\". | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::NotificationAllOfAndroidBackgroundLayout.new( + image: null, + headings_color: null, + contents_color: null +) +``` + diff --git a/docs/NotificationSlice.md b/docs/NotificationSlice.md new file mode 100644 index 0000000..aad4200 --- /dev/null +++ b/docs/NotificationSlice.md @@ -0,0 +1,24 @@ +# OneSignal::NotificationSlice + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **total_count** | **Integer** | | [optional] | +| **offset** | **Integer** | | [optional] | +| **limit** | **Integer** | | [optional] | +| **notifications** | [**Array<Notification>**](Notification.md) | | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::NotificationSlice.new( + total_count: null, + offset: null, + limit: null, + notifications: null +) +``` + diff --git a/docs/NotificationTarget.md b/docs/NotificationTarget.md new file mode 100644 index 0000000..523d9ef --- /dev/null +++ b/docs/NotificationTarget.md @@ -0,0 +1,64 @@ +# OneSignal::NotificationTarget + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **included_segments** | **Array<String>** | The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] | [optional] | +| **excluded_segments** | **Array<String>** | Segment that will be excluded when sending. Users in these segments will not receive a notification, even if they were included in included_segments. This targeting parameter is only compatible with included_segments. Example: [\"Active Users\", \"Inactive Users\"] | [optional] | +| **last_session** | **String** | relation = \">\" or \"<\" hours_ago = number of hours before or after the users last session. Example: \"1.1\" | [optional] | +| **first_session** | **String** | relation = \">\" or \"<\" hours_ago = number of hours before or after the users first session. Example: \"1.1\" | [optional] | +| **session_count** | **String** | relation = \">\", \"<\", \"=\" or \"!=\" value = number sessions. Example: \"1\" | [optional] | +| **session_time** | **String** | relation = \">\", \"<\", \"=\" or \"!=\" value = Time in seconds the user has been in your app. Example: \"3600\" | [optional] | +| **amount_spent** | **String** | relation = \">\", \"<\", or \"=\" value = Amount in USD a user has spent on IAP (In App Purchases). Example: \"0.99\" | [optional] | +| **bought_sku** | **String** | relation = \">\", \"<\" or \"=\" key = SKU purchased in your app as an IAP (In App Purchases). Example: \"com.domain.100coinpack\" value = value of SKU to compare to. Example: \"0.99\" | [optional] | +| **tag** | **String** | relation = \">\", \"<\", \"=\", \"!=\", \"exists\", \"not_exists\", \"time_elapsed_gt\" (paid plan only) or \"time_elapsed_lt\" (paid plan only) See Time Operators key = Tag key to compare. value = Tag value to compare. Not required for \"exists\" or \"not_exists\". Example: See Formatting Filters | [optional] | +| **language** | **String** | relation = \"=\" or \"!=\" value = 2 character language code. Example: \"en\". For a list of all language codes see Language & Localization. | [optional] | +| **app_version** | **String** | relation = \">\", \"<\", \"=\" or \"!=\" value = app version. Example: \"1.0.0\" | [optional] | +| **location** | **String** | radius = in meters lat = latitude long = longitude | [optional] | +| **email** | **String** | value = email address Only for sending Push Notifications Use this for targeting push subscribers associated with an email set with all SDK setEmail methods To send emails to specific email addresses use include_email_tokens parameter | [optional] | +| **country** | **String** | relation = \"=\" value = 2-digit Country code Example: \"field\": \"country\", \"relation\": \"=\", \"value\", \"US\" | [optional] | +| **include_player_ids** | **Array<String>** | Specific playerids to send your notification to. _Does not require API Auth Key. Do not combine with other targeting parameters. Not compatible with any other targeting parameters. Example: [\"1dd608f2-c6a1-11e3-851d-000c2940e62c\"] Limit of 2,000 entries per REST API call | [optional] | +| **include_external_user_ids** | **Array<String>** | Target specific devices by custom user IDs assigned via API. Not compatible with any other targeting parameters Example: [“custom-id-assigned-by-api”] REQUIRED: REST API Key Authentication Limit of 2,000 entries per REST API call. Note: If targeting push, email, or sms subscribers with same ids, use with channel_for_external_user_ids to indicate you are sending a push or email or sms. | [optional] | +| **include_email_tokens** | **Array<String>** | Recommended for Sending Emails - Target specific email addresses. If an email does not correspond to an existing user, a new user will be created. Example: nick@catfac.ts Limit of 2,000 entries per REST API call | [optional] | +| **include_phone_numbers** | **Array<String>** | Recommended for Sending SMS - Target specific phone numbers. The phone number should be in the E.164 format. Phone number should be an existing subscriber on OneSignal. Refer our docs to learn how to add phone numbers to OneSignal. Example phone number: +1999999999 Limit of 2,000 entries per REST API call | [optional] | +| **include_ios_tokens** | **Array<String>** | Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using iOS device tokens. Warning: Only works with Production tokens. All non-alphanumeric characters must be removed from each token. If a token does not correspond to an existing user, a new user will be created. Example: ce777617da7f548fe7a9ab6febb56cf39fba6d38203... Limit of 2,000 entries per REST API call | [optional] | +| **include_wp_wns_uris** | **Array<String>** | Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Windows URIs. If a token does not correspond to an existing user, a new user will be created. Example: http://s.notify.live.net/u/1/bn1/HmQAAACPaLDr-... Limit of 2,000 entries per REST API call | [optional] | +| **include_amazon_reg_ids** | **Array<String>** | Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Amazon ADM registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: amzn1.adm-registration.v1.XpvSSUk0Rc3hTVVV... Limit of 2,000 entries per REST API call | [optional] | +| **include_chrome_reg_ids** | **Array<String>** | Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Chrome App registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: APA91bEeiUeSukAAUdnw3O2RB45FWlSpgJ7Ji_... Limit of 2,000 entries per REST API call | [optional] | +| **include_chrome_web_reg_ids** | **Array<String>** | Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Chrome Web Push registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: APA91bEeiUeSukAAUdnw3O2RB45FWlSpgJ7Ji_... Limit of 2,000 entries per REST API call | [optional] | +| **include_android_reg_ids** | **Array<String>** | Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Android device registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: APA91bEeiUeSukAAUdnw3O2RB45FWlSpgJ7Ji_... Limit of 2,000 entries per REST API call | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::NotificationTarget.new( + included_segments: null, + excluded_segments: null, + last_session: null, + first_session: null, + session_count: null, + session_time: null, + amount_spent: null, + bought_sku: null, + tag: null, + language: null, + app_version: null, + location: null, + email: null, + country: null, + include_player_ids: null, + include_external_user_ids: null, + include_email_tokens: null, + include_phone_numbers: null, + include_ios_tokens: null, + include_wp_wns_uris: null, + include_amazon_reg_ids: null, + include_chrome_reg_ids: null, + include_chrome_web_reg_ids: null, + include_android_reg_ids: null +) +``` + diff --git a/docs/Operator.md b/docs/Operator.md new file mode 100644 index 0000000..2ad9402 --- /dev/null +++ b/docs/Operator.md @@ -0,0 +1,18 @@ +# OneSignal::Operator + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **operator** | **String** | Strictly, this must be either `\"OR\"`, or `\"AND\"`. It can be used to compose Filters as part of a Filters object. | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::Operator.new( + operator: null +) +``` + diff --git a/docs/OutcomeData.md b/docs/OutcomeData.md new file mode 100644 index 0000000..f106684 --- /dev/null +++ b/docs/OutcomeData.md @@ -0,0 +1,22 @@ +# OneSignal::OutcomeData + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | | | +| **value** | **Integer** | | | +| **aggregation** | **String** | | | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::OutcomeData.new( + id: null, + value: null, + aggregation: null +) +``` + diff --git a/docs/PlatformDeliveryData.md b/docs/PlatformDeliveryData.md new file mode 100644 index 0000000..6814842 --- /dev/null +++ b/docs/PlatformDeliveryData.md @@ -0,0 +1,28 @@ +# OneSignal::PlatformDeliveryData + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **edge_web_push** | [**DeliveryData**](DeliveryData.md) | | [optional] | +| **chrome_web_push** | [**DeliveryData**](DeliveryData.md) | | [optional] | +| **firefox_web_push** | [**DeliveryData**](DeliveryData.md) | | [optional] | +| **safari_web_push** | [**DeliveryData**](DeliveryData.md) | | [optional] | +| **android** | [**DeliveryData**](DeliveryData.md) | | [optional] | +| **ios** | [**DeliveryData**](DeliveryData.md) | | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::PlatformDeliveryData.new( + edge_web_push: null, + chrome_web_push: null, + firefox_web_push: null, + safari_web_push: null, + android: null, + ios: null +) +``` + diff --git a/docs/Player.md b/docs/Player.md new file mode 100644 index 0000000..ce31d19 --- /dev/null +++ b/docs/Player.md @@ -0,0 +1,70 @@ +# OneSignal::Player + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | The device's OneSignal ID | [readonly] | +| **invalid_identifier** | **Boolean** | If true, this is the equivalent of a user being Unsubscribed | [optional][readonly] | +| **app_id** | **String** | | | +| **device_type** | **Integer** | Required The device's platform: 0 = iOS 1 = Android 2 = Amazon 3 = WindowsPhone (MPNS) 4 = Chrome Apps / Extensions 5 = Chrome Web Push 6 = Windows (WNS) 7 = Safari 8 = Firefox 9 = MacOS 10 = Alexa 11 = Email 13 = For Huawei App Gallery Builds SDK Setup. Not for Huawei Devices using FCM 14 = SMS | | +| **external_user_id** | **String** | a custom user ID | [optional] | +| **external_user_id_auth_hash** | **String** | Only required if you have enabled Identity Verification and device_type is NOT 11 email. | [optional] | +| **email_auth_hash** | **String** | Email - Only required if you have enabled Identity Verification and device_type is email (11). | [optional] | +| **identifier** | **String** | Recommended: For Push Notifications, this is the Push Token Identifier from Google or Apple. For Apple Push identifiers, you must strip all non alphanumeric characters. Examples: iOS: 7abcd558f29d0b1f048083e2834ad8ea4b3d87d8ad9c088b33c132706ff445f0 Android: APA91bHbYHk7aq-Uam_2pyJ2qbZvqllyyh2wjfPRaw5gLEX2SUlQBRvOc6sck1sa7H7nGeLNlDco8lXj83HWWwzV... For Email Addresses, set the full email address email@email.com and make sure to set device_type to 11. | [optional] | +| **language** | **String** | Language code. Typically lower case two letters, except for Chinese where it must be one of zh-Hans or zh-Hant. Example: en | [optional] | +| **timezone** | **Integer** | Number of seconds away from UTC. Example: -28800 | [optional] | +| **game_version** | **String** | Version of your app. Example: 1.1 | [optional] | +| **device_model** | **String** | Device make and model. Example: iPhone5,1 | [optional] | +| **device_os** | **String** | Device operating system version. Example: 7.0.4 | [optional] | +| **ad_id** | **String** | The ad id for the device's platform: Android = Advertising Id iOS = identifierForVendor WP8.0 = DeviceUniqueId WP8.1 = AdvertisingId | [optional] | +| **sdk** | **String** | Name and version of the sdk/plugin that's calling this API method (if any) | [optional] | +| **session_count** | **Integer** | Number of times the user has played the game, defaults to 1 | [optional] | +| **tags** | **Object** | Custom tags for the player. Only support string and integer key value pairs. Does not support arrays or other nested objects. Setting a tag value to null or an empty string will remove the tag. Example: {\"foo\":\"bar\",\"this\":\"that\"} Limitations: - 100 tags per call - Android SDK users: tags cannot be removed or changed via API if set through SDK sendTag methods. Recommended to only tag devices with 1 kilobyte of data Please consider using your own Database to save more than 1 kilobyte of data. See: Internal Database & CRM | [optional] | +| **amount_spent** | **String** | Amount the user has spent in USD, up to two decimal places | [optional] | +| **created_at** | **Integer** | Unixtime when the player joined the game | [optional] | +| **playtime** | **Integer** | Seconds player was running your app. | [optional] | +| **badge_count** | **Integer** | Current iOS badge count displayed on the app icon NOTE: Not supported for apps created after June 2018, since badge count for apps created after this date are handled on the client. | [optional] | +| **last_active** | **Integer** | Unixtime when the player was last active | [optional] | +| **notification_types** | **Integer** | 1 = subscribed -2 = unsubscribed iOS - These values are set each time the user opens the app from the SDK. Use the SDK function set Subscription instead. Android - You may set this but you can no longer use the SDK method setSubscription later in your app as it will create synchronization issues. | [optional] | +| **test_type** | **Integer** | This is used in deciding whether to use your iOS Sandbox or Production push certificate when sending a push when both have been uploaded. Set to the iOS provisioning profile that was used to build your app. 1 = Development 2 = Ad-Hoc Omit this field for App Store builds. | [optional] | +| **long** | **Float** | Longitude of the device, used for geotagging to segment on. | [optional] | +| **lat** | **Float** | Latitude of the device, used for geotagging to segment on. | [optional] | +| **country** | **String** | Country code in the ISO 3166-1 Alpha 2 format | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::Player.new( + id: null, + invalid_identifier: null, + app_id: null, + device_type: null, + external_user_id: null, + external_user_id_auth_hash: null, + email_auth_hash: null, + identifier: null, + language: null, + timezone: null, + game_version: null, + device_model: null, + device_os: null, + ad_id: null, + sdk: null, + session_count: null, + tags: null, + amount_spent: null, + created_at: null, + playtime: null, + badge_count: null, + last_active: null, + notification_types: null, + test_type: null, + long: null, + lat: null, + country: null +) +``` + diff --git a/docs/PlayerNotificationTarget.md b/docs/PlayerNotificationTarget.md new file mode 100644 index 0000000..2fb9e9e --- /dev/null +++ b/docs/PlayerNotificationTarget.md @@ -0,0 +1,36 @@ +# OneSignal::PlayerNotificationTarget + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **include_player_ids** | **Array<String>** | Specific playerids to send your notification to. _Does not require API Auth Key. Do not combine with other targeting parameters. Not compatible with any other targeting parameters. Example: [\"1dd608f2-c6a1-11e3-851d-000c2940e62c\"] Limit of 2,000 entries per REST API call | [optional] | +| **include_external_user_ids** | **Array<String>** | Target specific devices by custom user IDs assigned via API. Not compatible with any other targeting parameters Example: [“custom-id-assigned-by-api”] REQUIRED: REST API Key Authentication Limit of 2,000 entries per REST API call. Note: If targeting push, email, or sms subscribers with same ids, use with channel_for_external_user_ids to indicate you are sending a push or email or sms. | [optional] | +| **include_email_tokens** | **Array<String>** | Recommended for Sending Emails - Target specific email addresses. If an email does not correspond to an existing user, a new user will be created. Example: nick@catfac.ts Limit of 2,000 entries per REST API call | [optional] | +| **include_phone_numbers** | **Array<String>** | Recommended for Sending SMS - Target specific phone numbers. The phone number should be in the E.164 format. Phone number should be an existing subscriber on OneSignal. Refer our docs to learn how to add phone numbers to OneSignal. Example phone number: +1999999999 Limit of 2,000 entries per REST API call | [optional] | +| **include_ios_tokens** | **Array<String>** | Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using iOS device tokens. Warning: Only works with Production tokens. All non-alphanumeric characters must be removed from each token. If a token does not correspond to an existing user, a new user will be created. Example: ce777617da7f548fe7a9ab6febb56cf39fba6d38203... Limit of 2,000 entries per REST API call | [optional] | +| **include_wp_wns_uris** | **Array<String>** | Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Windows URIs. If a token does not correspond to an existing user, a new user will be created. Example: http://s.notify.live.net/u/1/bn1/HmQAAACPaLDr-... Limit of 2,000 entries per REST API call | [optional] | +| **include_amazon_reg_ids** | **Array<String>** | Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Amazon ADM registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: amzn1.adm-registration.v1.XpvSSUk0Rc3hTVVV... Limit of 2,000 entries per REST API call | [optional] | +| **include_chrome_reg_ids** | **Array<String>** | Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Chrome App registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: APA91bEeiUeSukAAUdnw3O2RB45FWlSpgJ7Ji_... Limit of 2,000 entries per REST API call | [optional] | +| **include_chrome_web_reg_ids** | **Array<String>** | Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Chrome Web Push registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: APA91bEeiUeSukAAUdnw3O2RB45FWlSpgJ7Ji_... Limit of 2,000 entries per REST API call | [optional] | +| **include_android_reg_ids** | **Array<String>** | Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Android device registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: APA91bEeiUeSukAAUdnw3O2RB45FWlSpgJ7Ji_... Limit of 2,000 entries per REST API call | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::PlayerNotificationTarget.new( + include_player_ids: null, + include_external_user_ids: null, + include_email_tokens: null, + include_phone_numbers: null, + include_ios_tokens: null, + include_wp_wns_uris: null, + include_amazon_reg_ids: null, + include_chrome_reg_ids: null, + include_chrome_web_reg_ids: null, + include_android_reg_ids: null +) +``` + diff --git a/docs/PlayerSlice.md b/docs/PlayerSlice.md new file mode 100644 index 0000000..6a68b70 --- /dev/null +++ b/docs/PlayerSlice.md @@ -0,0 +1,24 @@ +# OneSignal::PlayerSlice + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **total_count** | **Integer** | | [optional] | +| **offset** | **Integer** | | [optional] | +| **limit** | **Integer** | | [optional] | +| **players** | [**Array<Player>**](Player.md) | | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::PlayerSlice.new( + total_count: null, + offset: null, + limit: null, + players: null +) +``` + diff --git a/docs/Purchase.md b/docs/Purchase.md new file mode 100644 index 0000000..cbcce76 --- /dev/null +++ b/docs/Purchase.md @@ -0,0 +1,22 @@ +# OneSignal::Purchase + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **sku** | **String** | The unique identifier of the purchased item. | | +| **amount** | **Float** | The amount, in USD, spent purchasing the item. | | +| **iso** | **String** | The 3-letter ISO 4217 currency code. Required for correct storage and conversion of amount. | | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::Purchase.new( + sku: null, + amount: null, + iso: null +) +``` + diff --git a/docs/Segment.md b/docs/Segment.md new file mode 100644 index 0000000..95f4829 --- /dev/null +++ b/docs/Segment.md @@ -0,0 +1,22 @@ +# OneSignal::Segment + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | UUID of the segment. If left empty, it will be assigned automaticaly. | [optional] | +| **name** | **String** | Name of the segment. You'll see this name on the Web UI. | | +| **filters** | [**Array<FilterExpressions>**](FilterExpressions.md) | Filter or operators the segment will have. For a list of available filters with details, please see Send to Users Based on Filters. | | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::Segment.new( + id: null, + name: null, + filters: null +) +``` + diff --git a/docs/SegmentNotificationTarget.md b/docs/SegmentNotificationTarget.md new file mode 100644 index 0000000..66ca772 --- /dev/null +++ b/docs/SegmentNotificationTarget.md @@ -0,0 +1,20 @@ +# OneSignal::SegmentNotificationTarget + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **included_segments** | **Array<String>** | The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] | [optional] | +| **excluded_segments** | **Array<String>** | Segment that will be excluded when sending. Users in these segments will not receive a notification, even if they were included in included_segments. This targeting parameter is only compatible with included_segments. Example: [\"Active Users\", \"Inactive Users\"] | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::SegmentNotificationTarget.new( + included_segments: null, + excluded_segments: null +) +``` + diff --git a/docs/StringMap.md b/docs/StringMap.md new file mode 100644 index 0000000..819a653 --- /dev/null +++ b/docs/StringMap.md @@ -0,0 +1,102 @@ +# OneSignal::StringMap + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **en** | **String** | Text in English. Will be used as a fallback | | +| **ar** | **String** | Text in Arabic. | [optional] | +| **bs** | **String** | Text in Bosnian. | [optional] | +| **bg** | **String** | Text in Bulgarian. | [optional] | +| **ca** | **String** | Text in Catalan. | [optional] | +| **zh_hans** | **String** | Text in Chinese (Simplified). | [optional] | +| **zh_hant** | **String** | Text in Chinese (Traditional). | [optional] | +| **zh** | **String** | Alias for zh-Hans. | [optional] | +| **hr** | **String** | Text in Croatian. | [optional] | +| **cs** | **String** | Text in Czech. | [optional] | +| **da** | **String** | Text in Danish. | [optional] | +| **nl** | **String** | Text in Dutch. | [optional] | +| **et** | **String** | Text in Estonian. | [optional] | +| **fi** | **String** | Text in Finnish. | [optional] | +| **fr** | **String** | Text in French. | [optional] | +| **ka** | **String** | Text in Georgian. | [optional] | +| **de** | **String** | Text in German. | [optional] | +| **el** | **String** | Text in Greek. | [optional] | +| **hi** | **String** | Text in Hindi. | [optional] | +| **he** | **String** | Text in Hebrew. | [optional] | +| **hu** | **String** | Text in Hungarian. | [optional] | +| **id** | **String** | Text in Indonesian. | [optional] | +| **it** | **String** | Text in Italian. | [optional] | +| **ja** | **String** | Text in Japanese. | [optional] | +| **ko** | **String** | Text in Korean. | [optional] | +| **lv** | **String** | Text in Latvian. | [optional] | +| **lt** | **String** | Text in Lithuanian. | [optional] | +| **ms** | **String** | Text in Malay. | [optional] | +| **nb** | **String** | Text in Norwegian. | [optional] | +| **pl** | **String** | Text in Polish. | [optional] | +| **fa** | **String** | Text in Persian. | [optional] | +| **pt** | **String** | Text in Portugese. | [optional] | +| **pa** | **String** | Text in Punjabi. | [optional] | +| **ro** | **String** | Text in Romanian. | [optional] | +| **ru** | **String** | Text in Russian. | [optional] | +| **sr** | **String** | Text in Serbian. | [optional] | +| **sk** | **String** | Text in Slovak. | [optional] | +| **es** | **String** | Text in Spanish. | [optional] | +| **sv** | **String** | Text in Swedish. | [optional] | +| **th** | **String** | Text in Thai. | [optional] | +| **tr** | **String** | Text in Turkish. | [optional] | +| **uk** | **String** | Text in Ukrainian. | [optional] | +| **vi** | **String** | Text in Vietnamese. | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::StringMap.new( + en: null, + ar: null, + bs: null, + bg: null, + ca: null, + zh_hans: null, + zh_hant: null, + zh: null, + hr: null, + cs: null, + da: null, + nl: null, + et: null, + fi: null, + fr: null, + ka: null, + de: null, + el: null, + hi: null, + he: null, + hu: null, + id: null, + it: null, + ja: null, + ko: null, + lv: null, + lt: null, + ms: null, + nb: null, + pl: null, + fa: null, + pt: null, + pa: null, + ro: null, + ru: null, + sr: null, + sk: null, + es: null, + sv: null, + th: null, + tr: null, + uk: null, + vi: null +) +``` + diff --git a/docs/UpdatePlayerTagsRequestBody.md b/docs/UpdatePlayerTagsRequestBody.md new file mode 100644 index 0000000..75aac4d --- /dev/null +++ b/docs/UpdatePlayerTagsRequestBody.md @@ -0,0 +1,18 @@ +# OneSignal::UpdatePlayerTagsRequestBody + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **tags** | **Object** | Custom tags for the device record. Only support string key value pairs. Does not support arrays or other nested objects. Example `{\"foo\":\"bar\",\"this\":\"that\"}`. Limitations: - 100 tags per call - Android SDK users: tags cannot be removed or changed via API if set through SDK sendTag methods. Recommended to only tag devices with 1 kilobyte of ata Please consider using your own Database to save more than 1 kilobyte of data. See: Internal Database & CRM | [optional] | + +## Example + +```ruby +require 'onesignal' + +instance = OneSignal::UpdatePlayerTagsRequestBody.new( + tags: null +) +``` + diff --git a/git_push.sh b/git_push.sh new file mode 100644 index 0000000..ced3be2 --- /dev/null +++ b/git_push.sh @@ -0,0 +1,58 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/lib/onesignal.rb b/lib/onesignal.rb index 87fec03..6f5963a 100644 --- a/lib/onesignal.rb +++ b/lib/onesignal.rb @@ -1,23 +1,75 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +The version of the OpenAPI document: 1.0.0 +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 5.2.0-SNAPSHOT + +=end + +# Common files +require 'onesignal/api_client' +require 'onesignal/api_error' require 'onesignal/version' -require 'onesignal/client' -require 'onesignal/request' -require 'onesignal/request_error' -require 'onesignal/app_id_missing_error' -require 'onesignal/models/base_model' +require 'onesignal/configuration' + +# Models require 'onesignal/models/app' -require 'onesignal/models/player' +require 'onesignal/models/button' +require 'onesignal/models/delivery_data' +require 'onesignal/models/export_players_request_body' +require 'onesignal/models/filter' +require 'onesignal/models/filter_expressions' +require 'onesignal/models/filter_notification_target' +require 'onesignal/models/get_notification_request_body' +require 'onesignal/models/inline_response200' +require 'onesignal/models/inline_response2001' +require 'onesignal/models/inline_response2002' +require 'onesignal/models/inline_response2003' +require 'onesignal/models/inline_response2004' +require 'onesignal/models/inline_response2005' +require 'onesignal/models/inline_response201' +require 'onesignal/models/inline_response400' +require 'onesignal/models/inline_response4001' +require 'onesignal/models/inline_response4002' +require 'onesignal/models/inline_response409' require 'onesignal/models/notification' -require 'onesignal/resources/base_resource' -require 'onesignal/resources/app_resource' -require 'onesignal/resources/player_resource' -require 'onesignal/resources/notification_resource' +require 'onesignal/models/notification_all_of' +require 'onesignal/models/notification_all_of_android_background_layout' +require 'onesignal/models/notification_slice' +require 'onesignal/models/notification_target' +require 'onesignal/models/operator' +require 'onesignal/models/outcome_data' +require 'onesignal/models/platform_delivery_data' +require 'onesignal/models/player' +require 'onesignal/models/player_notification_target' +require 'onesignal/models/player_slice' +require 'onesignal/models/purchase' +require 'onesignal/models/segment' +require 'onesignal/models/segment_notification_target' +require 'onesignal/models/string_map' +require 'onesignal/models/update_player_tags_request_body' -module OneSignal - DEVICE_TYPES = %w( - ios android amazon mpns chrome_app chrome_website wns safari firefox - ).freeze +# APIs +require 'onesignal/api/default_api' - def self.device_type_as_integer(device_type) - DEVICE_TYPES.index(device_type) +module OneSignal + class << self + # Customize default settings for the SDK using block. + # OneSignal.configure do |config| + # config.username = "xxx" + # config.password = "xxx" + # end + # If no block given, return the default Configuration object. + def configure + if block_given? + yield(Configuration.default) + else + Configuration.default + end + end end end diff --git a/lib/onesignal/api/default_api.rb b/lib/onesignal/api/default_api.rb new file mode 100644 index 0000000..72e1bbe --- /dev/null +++ b/lib/onesignal/api/default_api.rb @@ -0,0 +1,1338 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +The version of the OpenAPI document: 1.0.0 +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 5.2.0-SNAPSHOT + +=end + +require 'cgi' + +module OneSignal + class DefaultApi + attr_accessor :api_client + + def initialize(api_client = ApiClient.default) + @api_client = api_client + end + # Stop a scheduled or currently outgoing notification + # Used to stop a scheduled or currently outgoing notification + # @param app_id [String] + # @param notification_id [String] + # @param [Hash] opts the optional parameters + # @return [InlineResponse2001] + def cancel_notification(app_id, notification_id, opts = {}) + data, _status_code, _headers = cancel_notification_with_http_info(app_id, notification_id, opts) + data + end + + # Stop a scheduled or currently outgoing notification + # Used to stop a scheduled or currently outgoing notification + # @param app_id [String] + # @param notification_id [String] + # @param [Hash] opts the optional parameters + # @return [Array<(InlineResponse2001, Integer, Hash)>] InlineResponse2001 data, response status code and response headers + def cancel_notification_with_http_info(app_id, notification_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.cancel_notification ...' + end + # verify the required parameter 'app_id' is set + if @api_client.config.client_side_validation && app_id.nil? + fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.cancel_notification" + end + # verify the required parameter 'notification_id' is set + if @api_client.config.client_side_validation && notification_id.nil? + fail ArgumentError, "Missing the required parameter 'notification_id' when calling DefaultApi.cancel_notification" + end + # resource path + local_var_path = '/notifications/{notification_id}'.sub('{' + 'notification_id' + '}', CGI.escape(notification_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'app_id'] = app_id + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'InlineResponse2001' + + # auth_names + auth_names = opts[:debug_auth_names] || ['app_key'] + + new_options = opts.merge( + :operation => :"DefaultApi.cancel_notification", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#cancel_notification\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Create an app + # Creates a new OneSignal app + # @param app [App] + # @param [Hash] opts the optional parameters + # @return [App] + def create_app(app, opts = {}) + data, _status_code, _headers = create_app_with_http_info(app, opts) + data + end + + # Create an app + # Creates a new OneSignal app + # @param app [App] + # @param [Hash] opts the optional parameters + # @return [Array<(App, Integer, Hash)>] App data, response status code and response headers + def create_app_with_http_info(app, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.create_app ...' + end + # verify the required parameter 'app' is set + if @api_client.config.client_side_validation && app.nil? + fail ArgumentError, "Missing the required parameter 'app' when calling DefaultApi.create_app" + end + # resource path + local_var_path = '/apps' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(app) + + # return_type + return_type = opts[:debug_return_type] || 'App' + + # auth_names + auth_names = opts[:debug_auth_names] || ['user_key'] + + new_options = opts.merge( + :operation => :"DefaultApi.create_app", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#create_app\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Create notification + # Sends notifications to your users + # @param notification [Notification] + # @param [Hash] opts the optional parameters + # @return [InlineResponse200] + def create_notification(notification, opts = {}) + data, _status_code, _headers = create_notification_with_http_info(notification, opts) + data + end + + # Create notification + # Sends notifications to your users + # @param notification [Notification] + # @param [Hash] opts the optional parameters + # @return [Array<(InlineResponse200, Integer, Hash)>] InlineResponse200 data, response status code and response headers + def create_notification_with_http_info(notification, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.create_notification ...' + end + # verify the required parameter 'notification' is set + if @api_client.config.client_side_validation && notification.nil? + fail ArgumentError, "Missing the required parameter 'notification' when calling DefaultApi.create_notification" + end + # resource path + local_var_path = '/notifications' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(notification) + + # return_type + return_type = opts[:debug_return_type] || 'InlineResponse200' + + # auth_names + auth_names = opts[:debug_auth_names] || ['app_key'] + + new_options = opts.merge( + :operation => :"DefaultApi.create_notification", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#create_notification\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Add a device + # Register a new device to one of your OneSignal apps 🚧 Don't use this This API endpoint is designed to be used from our open source Mobile and Web Push SDKs. It is not designed for developers to use it directly, unless instructed to do so by OneSignal support. If you use this method instead of our SDKs, many OneSignal features such as conversion tracking, timezone tracking, language detection, and rich-push won't work out of the box. It will also make it harder to identify possible setup issues. This method is used to register a new device with OneSignal. If a device is already registered with the specified identifier, then this will update the existing device record instead of creating a new one. The returned player is a player / user ID. Use the returned ID to send push notifications to this specific user later, or to include this player when sending to a set of users. 🚧 iOS Must set test_type to 1 when building your iOS app as development. Omit this field in your production app builds. + # @param player [Player] + # @param [Hash] opts the optional parameters + # @return [InlineResponse2004] + def create_player(player, opts = {}) + data, _status_code, _headers = create_player_with_http_info(player, opts) + data + end + + # Add a device + # Register a new device to one of your OneSignal apps 🚧 Don't use this This API endpoint is designed to be used from our open source Mobile and Web Push SDKs. It is not designed for developers to use it directly, unless instructed to do so by OneSignal support. If you use this method instead of our SDKs, many OneSignal features such as conversion tracking, timezone tracking, language detection, and rich-push won't work out of the box. It will also make it harder to identify possible setup issues. This method is used to register a new device with OneSignal. If a device is already registered with the specified identifier, then this will update the existing device record instead of creating a new one. The returned player is a player / user ID. Use the returned ID to send push notifications to this specific user later, or to include this player when sending to a set of users. 🚧 iOS Must set test_type to 1 when building your iOS app as development. Omit this field in your production app builds. + # @param player [Player] + # @param [Hash] opts the optional parameters + # @return [Array<(InlineResponse2004, Integer, Hash)>] InlineResponse2004 data, response status code and response headers + def create_player_with_http_info(player, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.create_player ...' + end + # verify the required parameter 'player' is set + if @api_client.config.client_side_validation && player.nil? + fail ArgumentError, "Missing the required parameter 'player' when calling DefaultApi.create_player" + end + # resource path + local_var_path = '/players' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(player) + + # return_type + return_type = opts[:debug_return_type] || 'InlineResponse2004' + + # auth_names + auth_names = opts[:debug_auth_names] || ['app_key'] + + new_options = opts.merge( + :operation => :"DefaultApi.create_player", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#create_player\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Create Segments + # Create segments visible and usable in the dashboard and API - Required: OneSignal Paid Plan The Create Segment method is used when you want your server to programmatically create a segment instead of using the OneSignal Dashboard UI. Just like creating Segments from the dashboard you can pass in filters with multiple \"AND\" or \"OR\" operator's. 🚧 Does Not Update Segments This endpoint will only create segments, it does not edit or update currently created Segments. You will need to use the Delete Segments endpoint and re-create it with this endpoint to edit. + # @param app_id [String] The OneSignal App ID for your app. Available in Keys & IDs. + # @param [Hash] opts the optional parameters + # @option opts [Segment] :segment + # @return [InlineResponse201] + def create_segments(app_id, opts = {}) + data, _status_code, _headers = create_segments_with_http_info(app_id, opts) + data + end + + # Create Segments + # Create segments visible and usable in the dashboard and API - Required: OneSignal Paid Plan The Create Segment method is used when you want your server to programmatically create a segment instead of using the OneSignal Dashboard UI. Just like creating Segments from the dashboard you can pass in filters with multiple \"AND\" or \"OR\" operator's. 🚧 Does Not Update Segments This endpoint will only create segments, it does not edit or update currently created Segments. You will need to use the Delete Segments endpoint and re-create it with this endpoint to edit. + # @param app_id [String] The OneSignal App ID for your app. Available in Keys & IDs. + # @param [Hash] opts the optional parameters + # @option opts [Segment] :segment + # @return [Array<(InlineResponse201, Integer, Hash)>] InlineResponse201 data, response status code and response headers + def create_segments_with_http_info(app_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.create_segments ...' + end + # verify the required parameter 'app_id' is set + if @api_client.config.client_side_validation && app_id.nil? + fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.create_segments" + end + # resource path + local_var_path = '/apps/{app_id}/segments'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'segment']) + + # return_type + return_type = opts[:debug_return_type] || 'InlineResponse201' + + # auth_names + auth_names = opts[:debug_auth_names] || ['app_key'] + + new_options = opts.merge( + :operation => :"DefaultApi.create_segments", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#create_segments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete a user record + # Delete player - Required: Used to delete a single, specific Player ID record from a specific OneSignal app. + # @param app_id [String] The OneSignal App ID for your app. Available in Keys & IDs. + # @param player_id [String] The OneSignal player_id + # @param [Hash] opts the optional parameters + # @return [InlineResponse2001] + def delete_player(app_id, player_id, opts = {}) + data, _status_code, _headers = delete_player_with_http_info(app_id, player_id, opts) + data + end + + # Delete a user record + # Delete player - Required: Used to delete a single, specific Player ID record from a specific OneSignal app. + # @param app_id [String] The OneSignal App ID for your app. Available in Keys & IDs. + # @param player_id [String] The OneSignal player_id + # @param [Hash] opts the optional parameters + # @return [Array<(InlineResponse2001, Integer, Hash)>] InlineResponse2001 data, response status code and response headers + def delete_player_with_http_info(app_id, player_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.delete_player ...' + end + # verify the required parameter 'app_id' is set + if @api_client.config.client_side_validation && app_id.nil? + fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.delete_player" + end + # verify the required parameter 'player_id' is set + if @api_client.config.client_side_validation && player_id.nil? + fail ArgumentError, "Missing the required parameter 'player_id' when calling DefaultApi.delete_player" + end + # resource path + local_var_path = '/players/{player_id}'.sub('{' + 'player_id' + '}', CGI.escape(player_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'app_id'] = app_id + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'InlineResponse2001' + + # auth_names + auth_names = opts[:debug_auth_names] || ['app_key'] + + new_options = opts.merge( + :operation => :"DefaultApi.delete_player", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#delete_player\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Delete Segments + # Delete segments (not user devices) - Required: OneSignal Paid Plan You can delete a segment under your app by calling this API. You must provide an API key in the Authorization header that has admin access on the app. The segment_id can be found in the URL of the segment when viewing it in the dashboard. + # @param app_id [String] The OneSignal App ID for your app. Available in Keys & IDs. + # @param segment_id [String] The segment_id can be found in the URL of the segment when viewing it in the dashboard. + # @param [Hash] opts the optional parameters + # @return [InlineResponse2003] + def delete_segments(app_id, segment_id, opts = {}) + data, _status_code, _headers = delete_segments_with_http_info(app_id, segment_id, opts) + data + end + + # Delete Segments + # Delete segments (not user devices) - Required: OneSignal Paid Plan You can delete a segment under your app by calling this API. You must provide an API key in the Authorization header that has admin access on the app. The segment_id can be found in the URL of the segment when viewing it in the dashboard. + # @param app_id [String] The OneSignal App ID for your app. Available in Keys & IDs. + # @param segment_id [String] The segment_id can be found in the URL of the segment when viewing it in the dashboard. + # @param [Hash] opts the optional parameters + # @return [Array<(InlineResponse2003, Integer, Hash)>] InlineResponse2003 data, response status code and response headers + def delete_segments_with_http_info(app_id, segment_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.delete_segments ...' + end + # verify the required parameter 'app_id' is set + if @api_client.config.client_side_validation && app_id.nil? + fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.delete_segments" + end + # verify the required parameter 'segment_id' is set + if @api_client.config.client_side_validation && segment_id.nil? + fail ArgumentError, "Missing the required parameter 'segment_id' when calling DefaultApi.delete_segments" + end + # resource path + local_var_path = '/apps/{app_id}/segments/{segment_id}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'segment_id' + '}', CGI.escape(segment_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'InlineResponse2003' + + # auth_names + auth_names = opts[:debug_auth_names] || ['app_key'] + + new_options = opts.merge( + :operation => :"DefaultApi.delete_segments", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#delete_segments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # CSV export + # Generate a compressed CSV export of all of your current user data This method can be used to generate a compressed CSV export of all of your current user data. It is a much faster alternative than retrieving this data using the /players API endpoint. The file will be compressed using GZip. The file may take several minutes to generate depending on the number of users in your app. The URL generated will be available for 3 days and includes random v4 uuid as part of the resource name to be unguessable. 🚧 403 Error Responses You can test if it is complete by making a GET request to the csv_file_url value. This file may take time to generate depending on how many device records are being pulled. If the file is not ready, a 403 error will be returned. Otherwise the file itself will be returned. 🚧 Requires Authentication Key Requires your OneSignal App's REST API Key, available in Keys & IDs. 🚧 Concurrent Exports Only one concurrent export is allowed per OneSignal account. Please ensure you have successfully downloaded the .csv.gz file before exporting another app. CSV File Format: - Default Columns: | Field | Details | | --- | --- | | id | OneSignal Player Id | | identifier | Push Token | | session_count | Number of times they visited the app or site | language | Device language code | | timezone | Number of seconds away from UTC. Example: -28800 | | game_version | Version of your mobile app gathered from Android Studio versionCode in your App/build.gradle and iOS uses kCFBundleVersionKey in Xcode. | | device_os | Device Operating System Version. Example: 80 = Chrome 80, 9 = Android 9 | | device_type | Device Operating System Type | | device_model | Device Hardware String Code. Example: Mobile Web Subscribers will have `Linux armv` | | ad_id | Based on the Google Advertising Id for Android, identifierForVendor for iOS. OptedOut means user turned off Advertising tracking on the device. | | tags | Current OneSignal Data Tags on the device. | | last_active | Date and time the user last opened the mobile app or visited the site. | | playtime | Total amount of time in seconds the user had the mobile app open. | | amount_spent | Mobile only - amount spent in USD on In-App Purchases. | | created_at | Date and time the device record was created in OneSignal. Mobile - first time they opened the app with OneSignal SDK. Web - first time the user subscribed to the site. | | invalid_identifier | t = unsubscribed, f = subscibed | | badge_count | Current number of badges on the device | - Extra Columns: | Field | Details | | --- | --- | | external_user_id | Your User Id set on the device | | notification_types | Notification types | | location | Location points (Latitude and Longitude) set on the device. | | country | Country code | | rooted | Android device rooted or not | | ip | IP Address of the device if being tracked. See Handling Personal Data. | | web_auth | Web Only authorization key. | | web_p256 | Web Only p256 key. | + # @param app_id [String] The app ID that you want to export devices from + # @param [Hash] opts the optional parameters + # @option opts [ExportPlayersRequestBody] :export_players_request_body + # @return [InlineResponse2005] + def export_players(app_id, opts = {}) + data, _status_code, _headers = export_players_with_http_info(app_id, opts) + data + end + + # CSV export + # Generate a compressed CSV export of all of your current user data This method can be used to generate a compressed CSV export of all of your current user data. It is a much faster alternative than retrieving this data using the /players API endpoint. The file will be compressed using GZip. The file may take several minutes to generate depending on the number of users in your app. The URL generated will be available for 3 days and includes random v4 uuid as part of the resource name to be unguessable. 🚧 403 Error Responses You can test if it is complete by making a GET request to the csv_file_url value. This file may take time to generate depending on how many device records are being pulled. If the file is not ready, a 403 error will be returned. Otherwise the file itself will be returned. 🚧 Requires Authentication Key Requires your OneSignal App's REST API Key, available in Keys & IDs. 🚧 Concurrent Exports Only one concurrent export is allowed per OneSignal account. Please ensure you have successfully downloaded the .csv.gz file before exporting another app. CSV File Format: - Default Columns: | Field | Details | | --- | --- | | id | OneSignal Player Id | | identifier | Push Token | | session_count | Number of times they visited the app or site | language | Device language code | | timezone | Number of seconds away from UTC. Example: -28800 | | game_version | Version of your mobile app gathered from Android Studio versionCode in your App/build.gradle and iOS uses kCFBundleVersionKey in Xcode. | | device_os | Device Operating System Version. Example: 80 = Chrome 80, 9 = Android 9 | | device_type | Device Operating System Type | | device_model | Device Hardware String Code. Example: Mobile Web Subscribers will have `Linux armv` | | ad_id | Based on the Google Advertising Id for Android, identifierForVendor for iOS. OptedOut means user turned off Advertising tracking on the device. | | tags | Current OneSignal Data Tags on the device. | | last_active | Date and time the user last opened the mobile app or visited the site. | | playtime | Total amount of time in seconds the user had the mobile app open. | | amount_spent | Mobile only - amount spent in USD on In-App Purchases. | | created_at | Date and time the device record was created in OneSignal. Mobile - first time they opened the app with OneSignal SDK. Web - first time the user subscribed to the site. | | invalid_identifier | t = unsubscribed, f = subscibed | | badge_count | Current number of badges on the device | - Extra Columns: | Field | Details | | --- | --- | | external_user_id | Your User Id set on the device | | notification_types | Notification types | | location | Location points (Latitude and Longitude) set on the device. | | country | Country code | | rooted | Android device rooted or not | | ip | IP Address of the device if being tracked. See Handling Personal Data. | | web_auth | Web Only authorization key. | | web_p256 | Web Only p256 key. | + # @param app_id [String] The app ID that you want to export devices from + # @param [Hash] opts the optional parameters + # @option opts [ExportPlayersRequestBody] :export_players_request_body + # @return [Array<(InlineResponse2005, Integer, Hash)>] InlineResponse2005 data, response status code and response headers + def export_players_with_http_info(app_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.export_players ...' + end + # verify the required parameter 'app_id' is set + if @api_client.config.client_side_validation && app_id.nil? + fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.export_players" + end + # resource path + local_var_path = '/players/csv_export?app_id={app_id}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'export_players_request_body']) + + # return_type + return_type = opts[:debug_return_type] || 'InlineResponse2005' + + # auth_names + auth_names = opts[:debug_auth_names] || ['app_key'] + + new_options = opts.merge( + :operation => :"DefaultApi.export_players", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#export_players\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # View an app + # View the details of a single OneSignal app + # @param app_id [String] An app id + # @param [Hash] opts the optional parameters + # @return [App] + def get_app(app_id, opts = {}) + data, _status_code, _headers = get_app_with_http_info(app_id, opts) + data + end + + # View an app + # View the details of a single OneSignal app + # @param app_id [String] An app id + # @param [Hash] opts the optional parameters + # @return [Array<(App, Integer, Hash)>] App data, response status code and response headers + def get_app_with_http_info(app_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.get_app ...' + end + # verify the required parameter 'app_id' is set + if @api_client.config.client_side_validation && app_id.nil? + fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.get_app" + end + # resource path + local_var_path = '/apps/{app_id}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'App' + + # auth_names + auth_names = opts[:debug_auth_names] || ['user_key'] + + new_options = opts.merge( + :operation => :"DefaultApi.get_app", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#get_app\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # View apps + # View the details of all of your current OneSignal apps + # @param [Hash] opts the optional parameters + # @return [String] + def get_apps(opts = {}) + data, _status_code, _headers = get_apps_with_http_info(opts) + data + end + + # View apps + # View the details of all of your current OneSignal apps + # @param [Hash] opts the optional parameters + # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers + def get_apps_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.get_apps ...' + end + # resource path + local_var_path = '/apps' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'String' + + # auth_names + auth_names = opts[:debug_auth_names] || ['user_key'] + + new_options = opts.merge( + :operation => :"DefaultApi.get_apps", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#get_apps\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # View notification + # View the details of a single notification and outcomes associated with it + # @param app_id [String] + # @param notification_id [String] + # @param [Hash] opts the optional parameters + # @return [Notification] + def get_notification(app_id, notification_id, opts = {}) + data, _status_code, _headers = get_notification_with_http_info(app_id, notification_id, opts) + data + end + + # View notification + # View the details of a single notification and outcomes associated with it + # @param app_id [String] + # @param notification_id [String] + # @param [Hash] opts the optional parameters + # @return [Array<(Notification, Integer, Hash)>] Notification data, response status code and response headers + def get_notification_with_http_info(app_id, notification_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.get_notification ...' + end + # verify the required parameter 'app_id' is set + if @api_client.config.client_side_validation && app_id.nil? + fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.get_notification" + end + # verify the required parameter 'notification_id' is set + if @api_client.config.client_side_validation && notification_id.nil? + fail ArgumentError, "Missing the required parameter 'notification_id' when calling DefaultApi.get_notification" + end + # resource path + local_var_path = '/notifications/{notification_id}'.sub('{' + 'notification_id' + '}', CGI.escape(notification_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'app_id'] = app_id + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'Notification' + + # auth_names + auth_names = opts[:debug_auth_names] || ['app_key'] + + new_options = opts.merge( + :operation => :"DefaultApi.get_notification", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#get_notification\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Notification History + # -> View the devices sent a message - OneSignal Paid Plan Required This method will return all devices that were sent the given notification_id of an Email or Push Notification if used within 7 days of the date sent. After 7 days of the sending date, the message history data will be unavailable. After a successful response is received, the destination url may be polled until the file becomes available. Most exports are done in ~1-3 minutes, so setting a poll interval of 10 seconds should be adequate. For use cases that are not meant to be consumed by a script, an email will be sent to the supplied email address. 🚧 Requirements A OneSignal Paid Plan. Turn on Send History via OneSignal API in Settings -> Analytics. Cannot get data before this was turned on. Must be called within 7 days after sending the message. Messages targeting under 1000 recipients will not have \"sent\" events recorded, but will show \"clicked\" events. Requires your OneSignal App's REST API Key, available in Keys & IDs. + # @param notification_id [String] The \"id\" of the message found in the Notification object + # @param get_notification_request_body [GetNotificationRequestBody] + # @param [Hash] opts the optional parameters + # @return [InlineResponse2002] + def get_notification_history(notification_id, get_notification_request_body, opts = {}) + data, _status_code, _headers = get_notification_history_with_http_info(notification_id, get_notification_request_body, opts) + data + end + + # Notification History + # -> View the devices sent a message - OneSignal Paid Plan Required This method will return all devices that were sent the given notification_id of an Email or Push Notification if used within 7 days of the date sent. After 7 days of the sending date, the message history data will be unavailable. After a successful response is received, the destination url may be polled until the file becomes available. Most exports are done in ~1-3 minutes, so setting a poll interval of 10 seconds should be adequate. For use cases that are not meant to be consumed by a script, an email will be sent to the supplied email address. 🚧 Requirements A OneSignal Paid Plan. Turn on Send History via OneSignal API in Settings -> Analytics. Cannot get data before this was turned on. Must be called within 7 days after sending the message. Messages targeting under 1000 recipients will not have \"sent\" events recorded, but will show \"clicked\" events. Requires your OneSignal App's REST API Key, available in Keys & IDs. + # @param notification_id [String] The \"id\" of the message found in the Notification object + # @param get_notification_request_body [GetNotificationRequestBody] + # @param [Hash] opts the optional parameters + # @return [Array<(InlineResponse2002, Integer, Hash)>] InlineResponse2002 data, response status code and response headers + def get_notification_history_with_http_info(notification_id, get_notification_request_body, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.get_notification_history ...' + end + # verify the required parameter 'notification_id' is set + if @api_client.config.client_side_validation && notification_id.nil? + fail ArgumentError, "Missing the required parameter 'notification_id' when calling DefaultApi.get_notification_history" + end + # verify the required parameter 'get_notification_request_body' is set + if @api_client.config.client_side_validation && get_notification_request_body.nil? + fail ArgumentError, "Missing the required parameter 'get_notification_request_body' when calling DefaultApi.get_notification_history" + end + # resource path + local_var_path = '/notifications/{notification_id}/history'.sub('{' + 'notification_id' + '}', CGI.escape(notification_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(get_notification_request_body) + + # return_type + return_type = opts[:debug_return_type] || 'InlineResponse2002' + + # auth_names + auth_names = opts[:debug_auth_names] || ['app_key'] + + new_options = opts.merge( + :operation => :"DefaultApi.get_notification_history", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#get_notification_history\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # View notifications + # View the details of multiple notifications + # @param app_id [String] The app ID that you want to view notifications from + # @param [Hash] opts the optional parameters + # @option opts [String] :limit How many notifications to return. Max is 50. Default is 50. + # @option opts [Integer] :offset Page offset. Default is 0. Results are sorted by queued_at in descending order. queued_at is a representation of the time that the notification was queued at. + # @option opts [Integer] :kind Kind of notifications returned: * unset - All notification types (default) * `0` - Dashboard only * `1` - API only * `3` - Automated only + # @return [NotificationSlice] + def get_notifications(app_id, opts = {}) + data, _status_code, _headers = get_notifications_with_http_info(app_id, opts) + data + end + + # View notifications + # View the details of multiple notifications + # @param app_id [String] The app ID that you want to view notifications from + # @param [Hash] opts the optional parameters + # @option opts [String] :limit How many notifications to return. Max is 50. Default is 50. + # @option opts [Integer] :offset Page offset. Default is 0. Results are sorted by queued_at in descending order. queued_at is a representation of the time that the notification was queued at. + # @option opts [Integer] :kind Kind of notifications returned: * unset - All notification types (default) * `0` - Dashboard only * `1` - API only * `3` - Automated only + # @return [Array<(NotificationSlice, Integer, Hash)>] NotificationSlice data, response status code and response headers + def get_notifications_with_http_info(app_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.get_notifications ...' + end + # verify the required parameter 'app_id' is set + if @api_client.config.client_side_validation && app_id.nil? + fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.get_notifications" + end + allowable_values = [0, 1, 3] + if @api_client.config.client_side_validation && opts[:'kind'] && !allowable_values.include?(opts[:'kind']) + fail ArgumentError, "invalid value for \"kind\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/notifications' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'app_id'] = app_id + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? + query_params[:'kind'] = opts[:'kind'] if !opts[:'kind'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'NotificationSlice' + + # auth_names + auth_names = opts[:debug_auth_names] || ['app_key'] + + new_options = opts.merge( + :operation => :"DefaultApi.get_notifications", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#get_notifications\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # View Outcomes + # View the details of all the outcomes associated with your app 🚧 Requires Authentication Key Requires your OneSignal App's REST API Key, available in Keys & IDs. 🚧 Outcome Data Limitations Outcomes are only accessible for around 30 days before deleted from our servers. You will need to export this data every month if you want to keep it. + # @param app_id [String] The OneSignal App ID for your app. Available in Keys & IDs. + # @param outcome_names [String] Required Comma-separated list of names and the value (sum/count) for the returned outcome data. Note: Clicks only support count aggregation. For out-of-the-box OneSignal outcomes such as click and session duration, please use the “os” prefix with two underscores. For other outcomes, please use the name specified by the user. Example:os__session_duration.count,os__click.count,CustomOutcomeName.sum + # @param [Hash] opts the optional parameters + # @option opts [String] :outcome_names2 Optional If outcome names contain any commas, then please specify only one value at a time. Example: outcome_names[]=os__click.count&outcome_names[]=Sales, Purchase.count where “Sales, Purchase” is the custom outcomes with a comma in the name. + # @option opts [String] :outcome_time_range Optional Time range for the returned data. The values can be 1h (for the last 1 hour data), 1d (for the last 1 day data), or 1mo (for the last 1 month data). Default is 1h if the parameter is omitted. + # @option opts [String] :outcome_platforms Optional Platform id. Refer device's platform ids for values. Example: outcome_platform=0 for iOS outcome_platform=7,8 for Safari and Firefox Default is data from all platforms if the parameter is omitted. + # @option opts [String] :outcome_attribution Optional Attribution type for the outcomes. The values can be direct or influenced or unattributed. Example: outcome_attribution=direct Default is total (returns direct+influenced+unattributed) if the parameter is omitted. + # @return [Array] + def get_outcomes(app_id, outcome_names, opts = {}) + data, _status_code, _headers = get_outcomes_with_http_info(app_id, outcome_names, opts) + data + end + + # View Outcomes + # View the details of all the outcomes associated with your app 🚧 Requires Authentication Key Requires your OneSignal App's REST API Key, available in Keys & IDs. 🚧 Outcome Data Limitations Outcomes are only accessible for around 30 days before deleted from our servers. You will need to export this data every month if you want to keep it. + # @param app_id [String] The OneSignal App ID for your app. Available in Keys & IDs. + # @param outcome_names [String] Required Comma-separated list of names and the value (sum/count) for the returned outcome data. Note: Clicks only support count aggregation. For out-of-the-box OneSignal outcomes such as click and session duration, please use the “os” prefix with two underscores. For other outcomes, please use the name specified by the user. Example:os__session_duration.count,os__click.count,CustomOutcomeName.sum + # @param [Hash] opts the optional parameters + # @option opts [String] :outcome_names2 Optional If outcome names contain any commas, then please specify only one value at a time. Example: outcome_names[]=os__click.count&outcome_names[]=Sales, Purchase.count where “Sales, Purchase” is the custom outcomes with a comma in the name. + # @option opts [String] :outcome_time_range Optional Time range for the returned data. The values can be 1h (for the last 1 hour data), 1d (for the last 1 day data), or 1mo (for the last 1 month data). Default is 1h if the parameter is omitted. + # @option opts [String] :outcome_platforms Optional Platform id. Refer device's platform ids for values. Example: outcome_platform=0 for iOS outcome_platform=7,8 for Safari and Firefox Default is data from all platforms if the parameter is omitted. + # @option opts [String] :outcome_attribution Optional Attribution type for the outcomes. The values can be direct or influenced or unattributed. Example: outcome_attribution=direct Default is total (returns direct+influenced+unattributed) if the parameter is omitted. + # @return [Array<(Array, Integer, Hash)>] Array data, response status code and response headers + def get_outcomes_with_http_info(app_id, outcome_names, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.get_outcomes ...' + end + # verify the required parameter 'app_id' is set + if @api_client.config.client_side_validation && app_id.nil? + fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.get_outcomes" + end + # verify the required parameter 'outcome_names' is set + if @api_client.config.client_side_validation && outcome_names.nil? + fail ArgumentError, "Missing the required parameter 'outcome_names' when calling DefaultApi.get_outcomes" + end + # resource path + local_var_path = '/apps/{app_id}/outcomes'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'outcome_names'] = outcome_names + query_params[:'outcome_names[]'] = opts[:'outcome_names2'] if !opts[:'outcome_names2'].nil? + query_params[:'outcome_time_range'] = opts[:'outcome_time_range'] if !opts[:'outcome_time_range'].nil? + query_params[:'outcome_platforms'] = opts[:'outcome_platforms'] if !opts[:'outcome_platforms'].nil? + query_params[:'outcome_attribution'] = opts[:'outcome_attribution'] if !opts[:'outcome_attribution'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'Array' + + # auth_names + auth_names = opts[:debug_auth_names] || ['app_key'] + + new_options = opts.merge( + :operation => :"DefaultApi.get_outcomes", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#get_outcomes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # View device + # View the details of an existing device in one of your OneSignal apps + # @param app_id [String] Your app_id for this device + # @param player_id [String] Player's OneSignal ID + # @param [Hash] opts the optional parameters + # @option opts [String] :email_auth_hash Email - Only required if you have enabled Identity Verification and device_type is email (11). + # @return [Player] + def get_player(app_id, player_id, opts = {}) + data, _status_code, _headers = get_player_with_http_info(app_id, player_id, opts) + data + end + + # View device + # View the details of an existing device in one of your OneSignal apps + # @param app_id [String] Your app_id for this device + # @param player_id [String] Player's OneSignal ID + # @param [Hash] opts the optional parameters + # @option opts [String] :email_auth_hash Email - Only required if you have enabled Identity Verification and device_type is email (11). + # @return [Array<(Player, Integer, Hash)>] Player data, response status code and response headers + def get_player_with_http_info(app_id, player_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.get_player ...' + end + # verify the required parameter 'app_id' is set + if @api_client.config.client_side_validation && app_id.nil? + fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.get_player" + end + # verify the required parameter 'player_id' is set + if @api_client.config.client_side_validation && player_id.nil? + fail ArgumentError, "Missing the required parameter 'player_id' when calling DefaultApi.get_player" + end + # resource path + local_var_path = '/players/{player_id}'.sub('{' + 'player_id' + '}', CGI.escape(player_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'app_id'] = app_id + query_params[:'email_auth_hash'] = opts[:'email_auth_hash'] if !opts[:'email_auth_hash'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'Player' + + # auth_names + auth_names = opts[:debug_auth_names] || ['app_key'] + + new_options = opts.merge( + :operation => :"DefaultApi.get_player", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#get_player\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # View devices + # View the details of multiple devices in one of your OneSignal apps Unavailable for Apps Over 80,000 Users For performance reasons, this method is not available for larger apps. Larger apps should use the CSV export API endpoint, which is much more performant. + # @param app_id [String] The app ID that you want to view players from + # @param [Hash] opts the optional parameters + # @option opts [String] :limit How many devices to return. Max is 300. Default is 300 + # @option opts [Integer] :offset Result offset. Default is 0. Results are sorted by id; + # @return [PlayerSlice] + def get_players(app_id, opts = {}) + data, _status_code, _headers = get_players_with_http_info(app_id, opts) + data + end + + # View devices + # View the details of multiple devices in one of your OneSignal apps Unavailable for Apps Over 80,000 Users For performance reasons, this method is not available for larger apps. Larger apps should use the CSV export API endpoint, which is much more performant. + # @param app_id [String] The app ID that you want to view players from + # @param [Hash] opts the optional parameters + # @option opts [String] :limit How many devices to return. Max is 300. Default is 300 + # @option opts [Integer] :offset Result offset. Default is 0. Results are sorted by id; + # @return [Array<(PlayerSlice, Integer, Hash)>] PlayerSlice data, response status code and response headers + def get_players_with_http_info(app_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.get_players ...' + end + # verify the required parameter 'app_id' is set + if @api_client.config.client_side_validation && app_id.nil? + fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.get_players" + end + # resource path + local_var_path = '/players' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'app_id'] = app_id + query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? + query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'PlayerSlice' + + # auth_names + auth_names = opts[:debug_auth_names] || ['app_key'] + + new_options = opts.merge( + :operation => :"DefaultApi.get_players", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#get_players\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update an app + # Updates the name or configuration settings of an existing OneSignal app + # @param app_id [String] An app id + # @param app [App] + # @param [Hash] opts the optional parameters + # @return [App] + def update_app(app_id, app, opts = {}) + data, _status_code, _headers = update_app_with_http_info(app_id, app, opts) + data + end + + # Update an app + # Updates the name or configuration settings of an existing OneSignal app + # @param app_id [String] An app id + # @param app [App] + # @param [Hash] opts the optional parameters + # @return [Array<(App, Integer, Hash)>] App data, response status code and response headers + def update_app_with_http_info(app_id, app, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.update_app ...' + end + # verify the required parameter 'app_id' is set + if @api_client.config.client_side_validation && app_id.nil? + fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.update_app" + end + # verify the required parameter 'app' is set + if @api_client.config.client_side_validation && app.nil? + fail ArgumentError, "Missing the required parameter 'app' when calling DefaultApi.update_app" + end + # resource path + local_var_path = '/apps/{app_id}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(app) + + # return_type + return_type = opts[:debug_return_type] || 'App' + + # auth_names + auth_names = opts[:debug_auth_names] || ['user_key'] + + new_options = opts.merge( + :operation => :"DefaultApi.update_app", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#update_app\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Edit device + # Update an existing device in one of your OneSignal apps + # @param player_id [String] Player's OneSignal ID + # @param player [Player] + # @param [Hash] opts the optional parameters + # @return [InlineResponse2001] + def update_player(player_id, player, opts = {}) + data, _status_code, _headers = update_player_with_http_info(player_id, player, opts) + data + end + + # Edit device + # Update an existing device in one of your OneSignal apps + # @param player_id [String] Player's OneSignal ID + # @param player [Player] + # @param [Hash] opts the optional parameters + # @return [Array<(InlineResponse2001, Integer, Hash)>] InlineResponse2001 data, response status code and response headers + def update_player_with_http_info(player_id, player, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.update_player ...' + end + # verify the required parameter 'player_id' is set + if @api_client.config.client_side_validation && player_id.nil? + fail ArgumentError, "Missing the required parameter 'player_id' when calling DefaultApi.update_player" + end + # verify the required parameter 'player' is set + if @api_client.config.client_side_validation && player.nil? + fail ArgumentError, "Missing the required parameter 'player' when calling DefaultApi.update_player" + end + # resource path + local_var_path = '/players/{player_id}'.sub('{' + 'player_id' + '}', CGI.escape(player_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(player) + + # return_type + return_type = opts[:debug_return_type] || 'InlineResponse2001' + + # auth_names + auth_names = opts[:debug_auth_names] || ['app_key'] + + new_options = opts.merge( + :operation => :"DefaultApi.update_player", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#update_player\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Edit tags with external user id + # Update an existing device's tags in one of your OneSignal apps using the External User ID. Warning - Android SDK Data Synchronization Tags added through the Android SDK tagging methods may not update if using the API to change or update the same tag. For example, if you use SDK method sendTag(\"key\", \"value1\") then update the tag value to \"value2\" with this API endpoint. You will not be able to set the value back to \"value1\" through the SDK, you will need to change it to something different through the SDK to be reset. Recommendations if using this Endpoint on Android Mobile Apps: 1 - Do not use the same tag keys for SDK and API updates 2 - If you want to use the same key for both SDK and API updates, call the SDK getTags method first to update the device's tags. This is only applicable on the Android Mobile App SDKs. 📘 Deleting Tags To delete a tag, include its key and set its value to blank. Omitting a key/value will not delete it. For example, if I wanted to delete two existing tags rank and category while simultaneously adding a new tag class, the tags JSON would look like the following: \"tags\": { \"rank\": \"\", \"category\": \"\", \"class\": \"my_new_value\" } + # @param app_id [String] The OneSignal App ID the user record is found under. + # @param external_user_id [String] The External User ID mapped to teh device record in OneSignal. Must be actively set on the device to be updated. + # @param [Hash] opts the optional parameters + # @option opts [UpdatePlayerTagsRequestBody] :update_player_tags_request_body + # @return [InlineResponse2003] + def update_player_tags(app_id, external_user_id, opts = {}) + data, _status_code, _headers = update_player_tags_with_http_info(app_id, external_user_id, opts) + data + end + + # Edit tags with external user id + # Update an existing device's tags in one of your OneSignal apps using the External User ID. Warning - Android SDK Data Synchronization Tags added through the Android SDK tagging methods may not update if using the API to change or update the same tag. For example, if you use SDK method sendTag(\"key\", \"value1\") then update the tag value to \"value2\" with this API endpoint. You will not be able to set the value back to \"value1\" through the SDK, you will need to change it to something different through the SDK to be reset. Recommendations if using this Endpoint on Android Mobile Apps: 1 - Do not use the same tag keys for SDK and API updates 2 - If you want to use the same key for both SDK and API updates, call the SDK getTags method first to update the device's tags. This is only applicable on the Android Mobile App SDKs. 📘 Deleting Tags To delete a tag, include its key and set its value to blank. Omitting a key/value will not delete it. For example, if I wanted to delete two existing tags rank and category while simultaneously adding a new tag class, the tags JSON would look like the following: \"tags\": { \"rank\": \"\", \"category\": \"\", \"class\": \"my_new_value\" } + # @param app_id [String] The OneSignal App ID the user record is found under. + # @param external_user_id [String] The External User ID mapped to teh device record in OneSignal. Must be actively set on the device to be updated. + # @param [Hash] opts the optional parameters + # @option opts [UpdatePlayerTagsRequestBody] :update_player_tags_request_body + # @return [Array<(InlineResponse2003, Integer, Hash)>] InlineResponse2003 data, response status code and response headers + def update_player_tags_with_http_info(app_id, external_user_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: DefaultApi.update_player_tags ...' + end + # verify the required parameter 'app_id' is set + if @api_client.config.client_side_validation && app_id.nil? + fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.update_player_tags" + end + # verify the required parameter 'external_user_id' is set + if @api_client.config.client_side_validation && external_user_id.nil? + fail ArgumentError, "Missing the required parameter 'external_user_id' when calling DefaultApi.update_player_tags" + end + # resource path + local_var_path = '/apps/{app_id}/users/{external_user_id}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'external_user_id' + '}', CGI.escape(external_user_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'update_player_tags_request_body']) + + # return_type + return_type = opts[:debug_return_type] || 'InlineResponse2003' + + # auth_names + auth_names = opts[:debug_auth_names] || ['app_key'] + + new_options = opts.merge( + :operation => :"DefaultApi.update_player_tags", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: DefaultApi#update_player_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/onesignal/api_client.rb b/lib/onesignal/api_client.rb new file mode 100644 index 0000000..17eb9f3 --- /dev/null +++ b/lib/onesignal/api_client.rb @@ -0,0 +1,391 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +The version of the OpenAPI document: 1.0.0 +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 5.2.0-SNAPSHOT + +=end + +require 'date' +require 'json' +require 'logger' +require 'tempfile' +require 'time' +require 'typhoeus' + +module OneSignal + class ApiClient + # The Configuration object holding settings to be used in the API client. + attr_accessor :config + + # Defines the headers to be used in HTTP requests of all API calls by default. + # + # @return [Hash] + attr_accessor :default_headers + + # Initializes the ApiClient + # @option config [Configuration] Configuration for initializing the object, default to Configuration.default + def initialize(config = Configuration.default) + @config = config + @user_agent = "OpenAPI-Generator/#{VERSION}/ruby" + @default_headers = { + 'Content-Type' => 'application/json', + 'User-Agent' => @user_agent + } + end + + def self.default + @@default ||= ApiClient.new + end + + # Call an API with given options. + # + # @return [Array<(Object, Integer, Hash)>] an array of 3 elements: + # the data deserialized from response body (could be nil), response status code and response headers. + def call_api(http_method, path, opts = {}) + request = build_request(http_method, path, opts) + response = request.run + + if @config.debugging + @config.logger.debug "HTTP response body ~BEGIN~\n#{response.body}\n~END~\n" + end + + unless response.success? + if response.timed_out? + fail ApiError.new('Connection timed out') + elsif response.code == 0 + # Errors from libcurl will be made visible here + fail ApiError.new(:code => 0, + :message => response.return_message) + else + fail ApiError.new(:code => response.code, + :response_headers => response.headers, + :response_body => response.body), + response.status_message + end + end + + if opts[:return_type] + data = deserialize(response, opts[:return_type]) + else + data = nil + end + return data, response.code, response.headers + end + + # Builds the HTTP request + # + # @param [String] http_method HTTP method/verb (e.g. POST) + # @param [String] path URL path (e.g. /account/new) + # @option opts [Hash] :header_params Header parameters + # @option opts [Hash] :query_params Query parameters + # @option opts [Hash] :form_params Query parameters + # @option opts [Object] :body HTTP body (JSON/XML) + # @return [Typhoeus::Request] A Typhoeus Request + def build_request(http_method, path, opts = {}) + url = build_request_url(path, opts) + http_method = http_method.to_sym.downcase + + header_params = @default_headers.merge(opts[:header_params] || {}) + header_params['OS-Usage-Data'] = 'kind=sdk, name=onesignal-ruby, version=1.0.0.beta1' + query_params = opts[:query_params] || {} + form_params = opts[:form_params] || {} + + update_params_for_auth! header_params, query_params, opts[:auth_names] + + # set ssl_verifyhosts option based on @config.verify_ssl_host (true/false) + _verify_ssl_host = @config.verify_ssl_host ? 2 : 0 + + req_opts = { + :method => http_method, + :headers => header_params, + :params => query_params, + :params_encoding => @config.params_encoding, + :timeout => @config.timeout, + :ssl_verifypeer => @config.verify_ssl, + :ssl_verifyhost => _verify_ssl_host, + :sslcert => @config.cert_file, + :sslkey => @config.key_file, + :verbose => @config.debugging + } + + # set custom cert, if provided + req_opts[:cainfo] = @config.ssl_ca_cert if @config.ssl_ca_cert + + if [:post, :patch, :put, :delete].include?(http_method) + req_body = build_request_body(header_params, form_params, opts[:body]) + req_opts.update :body => req_body + if @config.debugging + @config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n" + end + end + + request = Typhoeus::Request.new(url, req_opts) + download_file(request) if opts[:return_type] == 'File' + request + end + + # Builds the HTTP request body + # + # @param [Hash] header_params Header parameters + # @param [Hash] form_params Query parameters + # @param [Object] body HTTP body (JSON/XML) + # @return [String] HTTP body data in the form of string + def build_request_body(header_params, form_params, body) + # http form + if header_params['Content-Type'] == 'application/x-www-form-urlencoded' || + header_params['Content-Type'] == 'multipart/form-data' + data = {} + form_params.each do |key, value| + case value + when ::File, ::Array, nil + # let typhoeus handle File, Array and nil parameters + data[key] = value + else + data[key] = value.to_s + end + end + elsif body + data = body.is_a?(String) ? body : body.to_json + else + data = nil + end + data + end + + # Save response body into a file in (the defined) temporary folder, using the filename + # from the "Content-Disposition" header if provided, otherwise a random filename. + # The response body is written to the file in chunks in order to handle files which + # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby + # process can use. + # + # @see Configuration#temp_folder_path + def download_file(request) + tempfile = nil + encoding = nil + request.on_headers do |response| + content_disposition = response.headers['Content-Disposition'] + if content_disposition && content_disposition =~ /filename=/i + filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1] + prefix = sanitize_filename(filename) + else + prefix = 'download-' + end + prefix = prefix + '-' unless prefix.end_with?('-') + encoding = response.body.encoding + tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding) + @tempfile = tempfile + end + request.on_body do |chunk| + chunk.force_encoding(encoding) + tempfile.write(chunk) + end + request.on_complete do |response| + if tempfile + tempfile.close + @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\ + "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\ + "will be deleted automatically with GC. It's also recommended to delete the temp file "\ + "explicitly with `tempfile.delete`" + end + end + end + + # Check if the given MIME is a JSON MIME. + # JSON MIME examples: + # application/json + # application/json; charset=UTF8 + # APPLICATION/JSON + # */* + # @param [String] mime MIME + # @return [Boolean] True if the MIME is application/json + def json_mime?(mime) + (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil? + end + + # Deserialize the response to the given return type. + # + # @param [Response] response HTTP response + # @param [String] return_type some examples: "User", "Array", "Hash" + def deserialize(response, return_type) + body = response.body + + # handle file downloading - return the File instance processed in request callbacks + # note that response body is empty when the file is written in chunks in request on_body callback + return @tempfile if return_type == 'File' + + return nil if body.nil? || body.empty? + + # return response body directly for String return type + return body if return_type == 'String' + + # ensuring a default content type + content_type = response.headers['Content-Type'] || 'application/json' + + fail "Content-Type is not supported: #{content_type}" unless json_mime?(content_type) + + begin + data = JSON.parse("[#{body}]", :symbolize_names => true)[0] + rescue JSON::ParserError => e + if %w(String Date Time).include?(return_type) + data = body + else + raise e + end + end + + convert_to_type data, return_type + end + + # Convert data to the given return type. + # @param [Object] data Data to be converted + # @param [String] return_type Return type + # @return [Mixed] Data in a particular type + def convert_to_type(data, return_type) + return nil if data.nil? + case return_type + when 'String' + data.to_s + when 'Integer' + data.to_i + when 'Float' + data.to_f + when 'Boolean' + data == true + when 'Time' + # parse date time (expecting ISO 8601 format) + Time.parse data + when 'Date' + # parse date time (expecting ISO 8601 format) + Date.parse data + when 'Object' + # generic object (usually a Hash), return directly + data + when /\AArray<(.+)>\z/ + # e.g. Array + sub_type = $1 + data.map { |item| convert_to_type(item, sub_type) } + when /\AHash\\z/ + # e.g. Hash + sub_type = $1 + {}.tap do |hash| + data.each { |k, v| hash[k] = convert_to_type(v, sub_type) } + end + else + # models (e.g. Pet) or oneOf + klass = OneSignal.const_get(return_type) + klass.respond_to?(:openapi_one_of) ? klass.build(data) : klass.build_from_hash(data) + end + end + + # Sanitize filename by removing path. + # e.g. ../../sun.gif becomes sun.gif + # + # @param [String] filename the filename to be sanitized + # @return [String] the sanitized filename + def sanitize_filename(filename) + filename.gsub(/.*[\/\\]/, '') + end + + def build_request_url(path, opts = {}) + # Add leading and trailing slashes to path + path = "/#{path}".gsub(/\/+/, '/') + @config.base_url(opts[:operation]) + path + end + + # Update hearder and query params based on authentication settings. + # + # @param [Hash] header_params Header parameters + # @param [Hash] query_params Query parameters + # @param [String] auth_names Authentication scheme name + def update_params_for_auth!(header_params, query_params, auth_names) + Array(auth_names).each do |auth_name| + auth_setting = @config.auth_settings[auth_name] + next unless auth_setting + case auth_setting[:in] + when 'header' then header_params[auth_setting[:key]] = auth_setting[:value] + when 'query' then query_params[auth_setting[:key]] = auth_setting[:value] + else fail ArgumentError, 'Authentication token must be in `query` or `header`' + end + end + end + + # Sets user agent in HTTP header + # + # @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0) + def user_agent=(user_agent) + @user_agent = user_agent + @default_headers['User-Agent'] = @user_agent + end + + # Return Accept header based on an array of accepts provided. + # @param [Array] accepts array for Accept + # @return [String] the Accept header (e.g. application/json) + def select_header_accept(accepts) + return nil if accepts.nil? || accepts.empty? + # use JSON when present, otherwise use all of the provided + json_accept = accepts.find { |s| json_mime?(s) } + json_accept || accepts.join(',') + end + + # Return Content-Type header based on an array of content types provided. + # @param [Array] content_types array for Content-Type + # @return [String] the Content-Type header (e.g. application/json) + def select_header_content_type(content_types) + # use application/json by default + return 'application/json' if content_types.nil? || content_types.empty? + # use JSON when present, otherwise use the first one + json_content_type = content_types.find { |s| json_mime?(s) } + json_content_type || content_types.first + end + + # Convert object (array, hash, object, etc) to JSON string. + # @param [Object] model object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_http_body(model) + return model if model.nil? || model.is_a?(String) + local_body = nil + if model.is_a?(Array) + local_body = model.map { |m| object_to_hash(m) } + else + local_body = object_to_hash(model) + end + local_body.to_json + end + + # Convert object(non-array) to hash. + # @param [Object] obj object to be converted into JSON string + # @return [String] JSON string representation of the object + def object_to_hash(obj) + if obj.respond_to?(:to_hash) + obj.to_hash + else + obj + end + end + + # Build parameter value according to the given collection format. + # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi + def build_collection_param(param, collection_format) + case collection_format + when :csv + param.join(',') + when :ssv + param.join(' ') + when :tsv + param.join("\t") + when :pipes + param.join('|') + when :multi + # return the array directly as typhoeus will handle it as expected + param + else + fail "unknown collection format: #{collection_format.inspect}" + end + end + end +end diff --git a/lib/onesignal/api_error.rb b/lib/onesignal/api_error.rb new file mode 100644 index 0000000..1f2fdda --- /dev/null +++ b/lib/onesignal/api_error.rb @@ -0,0 +1,57 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +The version of the OpenAPI document: 1.0.0 +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 5.2.0-SNAPSHOT + +=end + +module OneSignal + class ApiError < StandardError + attr_reader :code, :response_headers, :response_body + + # Usage examples: + # ApiError.new + # ApiError.new("message") + # ApiError.new(:code => 500, :response_headers => {}, :response_body => "") + # ApiError.new(:code => 404, :message => "Not Found") + def initialize(arg = nil) + if arg.is_a? Hash + if arg.key?(:message) || arg.key?('message') + super(arg[:message] || arg['message']) + else + super arg + end + + arg.each do |k, v| + instance_variable_set "@#{k}", v + end + else + super arg + end + end + + # Override to_s to display a friendly error message + def to_s + message + end + + def message + if @message.nil? + msg = "Error message: the server returns an error" + else + msg = @message + end + + msg += "\nHTTP status code: #{code}" if code + msg += "\nResponse headers: #{response_headers}" if response_headers + msg += "\nResponse body: #{response_body}" if response_body + + msg + end + end +end diff --git a/lib/onesignal/configuration.rb b/lib/onesignal/configuration.rb new file mode 100644 index 0000000..882e1dc --- /dev/null +++ b/lib/onesignal/configuration.rb @@ -0,0 +1,242 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +The version of the OpenAPI document: 1.0.0 +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 5.2.0-SNAPSHOT + +=end + +module OneSignal + class Configuration + # Defines url scheme + attr_accessor :scheme + + # Defines url host + attr_accessor :host + + # Defines url base path + attr_accessor :base_path + + # Define server configuration index + attr_accessor :server_index + + # Define server operation configuration index + attr_accessor :server_operation_index + + # Default server variables + attr_accessor :server_variables + + # Default server operation variables + attr_accessor :server_operation_variables + + # OneSignal API token for App Authentication + attr_accessor :app_key + + # OneSignal API token for User Authentication + attr_accessor :user_key + + # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response + # details will be logged with `logger.debug` (see the `logger` attribute). + # Default to false. + # + # @return [true, false] + attr_accessor :debugging + + # Defines the logger used for debugging. + # Default to `Rails.logger` (when in Rails) or logging to STDOUT. + # + # @return [#debug] + attr_accessor :logger + + # Defines the temporary folder to store downloaded files + # (for API endpoints that have file response). + # Default to use `Tempfile`. + # + # @return [String] + attr_accessor :temp_folder_path + + # The time limit for HTTP request in seconds. + # Default to 0 (never times out). + attr_accessor :timeout + + # Set this to false to skip client side validation in the operation. + # Default to true. + # @return [true, false] + attr_accessor :client_side_validation + + ### TLS/SSL setting + # Set this to false to skip verifying SSL certificate when calling API from https server. + # Default to true. + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + # @return [true, false] + attr_accessor :verify_ssl + + ### TLS/SSL setting + # Set this to false to skip verifying SSL host name + # Default to true. + # + # @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks. + # + # @return [true, false] + attr_accessor :verify_ssl_host + + ### TLS/SSL setting + # Set this to customize the certificate file to verify the peer. + # + # @return [String] the path to the certificate file + # + # @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code: + # https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145 + attr_accessor :ssl_ca_cert + + ### TLS/SSL setting + # Client certificate file (for client certificate) + attr_accessor :cert_file + + ### TLS/SSL setting + # Client private key file (for client certificate) + attr_accessor :key_file + + # Set this to customize parameters encoding of array parameter with multi collectionFormat. + # Default to nil. + # + # @see The params_encoding option of Ethon. Related source code: + # https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96 + attr_accessor :params_encoding + + attr_accessor :inject_format + + attr_accessor :force_ending_format + + def initialize + @scheme = 'https' + @host = 'onesignal.com' + @base_path = '/api/v1' + @server_index = 0 + @server_operation_index = {} + @server_variables = {} + @server_operation_variables = {} + @timeout = 0 + @client_side_validation = true + @verify_ssl = true + @verify_ssl_host = true + @params_encoding = nil + @cert_file = nil + @key_file = nil + @debugging = false + @inject_format = false + @force_ending_format = false + @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) + + yield(self) if block_given? + end + + # The default Configuration object. + def self.default + @@default ||= Configuration.new + end + + def configure + yield(self) if block_given? + end + + def scheme=(scheme) + # remove :// from scheme + @scheme = scheme.sub(/:\/\//, '') + end + + def host=(host) + # remove http(s):// and anything after a slash + @host = host.sub(/https?:\/\//, '').split('/').first + end + + def base_path=(base_path) + # Add leading and trailing slashes to base_path + @base_path = "/#{base_path}".gsub(/\/+/, '/') + @base_path = '' if @base_path == '/' + end + + # Returns base URL for specified operation based on server settings + def base_url(operation = nil) + index = server_operation_index.fetch(operation, server_index) + return "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') if index == nil + + server_url(index, server_operation_variables.fetch(operation, server_variables), operation_server_settings[operation]) + end + + # Returns Auth Settings hash for api client. + def auth_settings + { + 'app_key' => + { + type: 'bearer', + in: 'header', + key: 'Authorization', + value: "Bearer token=\"#{ app_key }\"" + }, + 'user_key' => + { + type: 'bearer', + in: 'header', + key: 'Authorization', + value: "Bearer token=\"#{ user_key }\"" + }, + } + end + + # Returns an array of Server setting + def server_settings + [ + { + url: "https://onesignal.com/api/v1", + description: "No description provided", + } + ] + end + + def operation_server_settings + { + } + end + + # Returns URL based on server settings + # + # @param index array index of the server settings + # @param variables hash of variable and the corresponding value + def server_url(index, variables = {}, servers = nil) + servers = server_settings if servers == nil + + # check array index out of bound + if (index < 0 || index >= servers.size) + fail ArgumentError, "Invalid index #{index} when selecting the server. Must be less than #{servers.size}" + end + + server = servers[index] + url = server[:url] + + return url unless server.key? :variables + + # go through variable and assign a value + server[:variables].each do |name, variable| + if variables.key?(name) + if (!server[:variables][name].key?(:enum_values) || server[:variables][name][:enum_values].include?(variables[name])) + url.gsub! "{" + name.to_s + "}", variables[name] + else + fail ArgumentError, "The variable `#{name}` in the server URL has invalid value #{variables[name]}. Must be #{server[:variables][name][:enum_values]}." + end + else + # use default value + url.gsub! "{" + name.to_s + "}", server[:variables][name][:default_value] + end + end + + url + end + end +end diff --git a/lib/onesignal/models/app.rb b/lib/onesignal/models/app.rb index 7820bd3..8015686 100644 --- a/lib/onesignal/models/app.rb +++ b/lib/onesignal/models/app.rb @@ -1,29 +1,535 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +The version of the OpenAPI document: 1.0.0 +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 5.2.0-SNAPSHOT + +=end + +require 'date' require 'time' module OneSignal - class App < BaseModel - DATE_REGEX = /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/ + class App + attr_accessor :id + + # The name of your app, as displayed on your apps list on the dashboard. This can be renamed. + attr_accessor :name + + attr_accessor :players + + attr_accessor :messageable_players + + attr_accessor :updated_at + + attr_accessor :created_at + + # Android: Your Google Project number. Also known as Sender ID. + attr_accessor :android_gcm_sender_id + + # Android: Your Google Push Messaging Auth Key + attr_accessor :gcm_key + + # Chrome (All Browsers except Safari) (Recommended): The URL to your website. This field is required if you wish to enable web push and specify other web push parameters. + attr_accessor :chrome_web_origin + + # Not for web push. Your Google Push Messaging Auth Key if you use Chrome Apps / Extensions. + attr_accessor :chrome_key + + # Chrome (All Browsers except Safari): Your default notification icon. Should be 256x256 pixels, min 80x80. + attr_accessor :chrome_web_default_notification_icon + + # Chrome (All Browsers except Safari): A subdomain of your choice in order to support Web Push on non-HTTPS websites. This field must be set in order for the chrome_web_gcm_sender_id property to be processed. + attr_accessor :chrome_web_sub_domain + + # iOS: Either sandbox or production + attr_accessor :apns_env + + # iOS: Your apple push notification p12 certificate file, converted to a string and Base64 encoded. + attr_accessor :apns_p12 + + # iOS: Required if using p12 certificate. Password for the apns_p12 file. + attr_accessor :apns_p12_password - def created_at=(time) - parse_time('created_at', time) + attr_accessor :apns_certificates + + attr_accessor :safari_apns_certificates + + # Safari: Your apple push notification p12 certificate file for Safari Push Notifications, converted to a string and Base64 encoded. + attr_accessor :safari_apns_p12 + + # Safari: Password for safari_apns_p12 file + attr_accessor :safari_apns_p12_password + + # Safari (Recommended): The hostname to your website including http(s):// + attr_accessor :safari_site_origin + + attr_accessor :safari_push_id + + attr_accessor :safari_icon_16_16 + + attr_accessor :safari_icon_32_32 + + attr_accessor :safari_icon_64_64 + + attr_accessor :safari_icon_128_128 + + # Safari: A url for a 256x256 png notification icon. This is the only Safari icon URL you need to provide. + attr_accessor :safari_icon_256_256 + + # All Browsers (Recommended): The Site Name. Requires both chrome_web_origin and safari_site_origin to be set to add or update it. + attr_accessor :site_name + + attr_accessor :basic_auth_key + + # The Id of the Organization you would like to add this app to. + attr_accessor :organization_id + + # iOS: Notification data (additional data) values will be added to the root of the apns payload when sent to the device. Ignore if you're not using any other plugins, or not using OneSignal SDK methods to read the payload. + attr_accessor :additional_data_is_root_payload + + 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 - def updated_at=(time) - parse_time('updated_at', time) + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'name' => :'name', + :'players' => :'players', + :'messageable_players' => :'messageable_players', + :'updated_at' => :'updated_at', + :'created_at' => :'created_at', + :'android_gcm_sender_id' => :'android_gcm_sender_id', + :'gcm_key' => :'gcm_key', + :'chrome_web_origin' => :'chrome_web_origin', + :'chrome_key' => :'chrome_key', + :'chrome_web_default_notification_icon' => :'chrome_web_default_notification_icon', + :'chrome_web_sub_domain' => :'chrome_web_sub_domain', + :'apns_env' => :'apns_env', + :'apns_p12' => :'apns_p12', + :'apns_p12_password' => :'apns_p12_password', + :'apns_certificates' => :'apns_certificates', + :'safari_apns_certificates' => :'safari_apns_certificates', + :'safari_apns_p12' => :'safari_apns_p12', + :'safari_apns_p12_password' => :'safari_apns_p12_password', + :'safari_site_origin' => :'safari_site_origin', + :'safari_push_id' => :'safari_push_id', + :'safari_icon_16_16' => :'safari_icon_16_16', + :'safari_icon_32_32' => :'safari_icon_32_32', + :'safari_icon_64_64' => :'safari_icon_64_64', + :'safari_icon_128_128' => :'safari_icon_128_128', + :'safari_icon_256_256' => :'safari_icon_256_256', + :'site_name' => :'site_name', + :'basic_auth_key' => :'basic_auth_key', + :'organization_id' => :'organization_id', + :'additional_data_is_root_payload' => :'additional_data_is_root_payload' + } end - private + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'id' => :'String', + :'name' => :'String', + :'players' => :'Integer', + :'messageable_players' => :'Integer', + :'updated_at' => :'Time', + :'created_at' => :'Time', + :'android_gcm_sender_id' => :'String', + :'gcm_key' => :'String', + :'chrome_web_origin' => :'String', + :'chrome_key' => :'String', + :'chrome_web_default_notification_icon' => :'String', + :'chrome_web_sub_domain' => :'String', + :'apns_env' => :'String', + :'apns_p12' => :'String', + :'apns_p12_password' => :'String', + :'apns_certificates' => :'String', + :'safari_apns_certificates' => :'String', + :'safari_apns_p12' => :'String', + :'safari_apns_p12_password' => :'String', + :'safari_site_origin' => :'String', + :'safari_push_id' => :'String', + :'safari_icon_16_16' => :'String', + :'safari_icon_32_32' => :'String', + :'safari_icon_64_64' => :'String', + :'safari_icon_128_128' => :'String', + :'safari_icon_256_256' => :'String', + :'site_name' => :'String', + :'basic_auth_key' => :'String', + :'organization_id' => :'String', + :'additional_data_is_root_payload' => :'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::App` 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::App`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'players') + self.players = attributes[:'players'] + end + + if attributes.key?(:'messageable_players') + self.messageable_players = attributes[:'messageable_players'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'android_gcm_sender_id') + self.android_gcm_sender_id = attributes[:'android_gcm_sender_id'] + end + + if attributes.key?(:'gcm_key') + self.gcm_key = attributes[:'gcm_key'] + end + + if attributes.key?(:'chrome_web_origin') + self.chrome_web_origin = attributes[:'chrome_web_origin'] + end + + if attributes.key?(:'chrome_key') + self.chrome_key = attributes[:'chrome_key'] + end + + if attributes.key?(:'chrome_web_default_notification_icon') + self.chrome_web_default_notification_icon = attributes[:'chrome_web_default_notification_icon'] + end + + if attributes.key?(:'chrome_web_sub_domain') + self.chrome_web_sub_domain = attributes[:'chrome_web_sub_domain'] + end - def parse_time(attribute, value) - if string_date?(value) - value = Time.parse(value) + if attributes.key?(:'apns_env') + self.apns_env = attributes[:'apns_env'] end - instance_variable_set("@#{attribute}", value) + if attributes.key?(:'apns_p12') + self.apns_p12 = attributes[:'apns_p12'] + end + + if attributes.key?(:'apns_p12_password') + self.apns_p12_password = attributes[:'apns_p12_password'] + end + + if attributes.key?(:'apns_certificates') + self.apns_certificates = attributes[:'apns_certificates'] + end + + if attributes.key?(:'safari_apns_certificates') + self.safari_apns_certificates = attributes[:'safari_apns_certificates'] + end + + if attributes.key?(:'safari_apns_p12') + self.safari_apns_p12 = attributes[:'safari_apns_p12'] + end + + if attributes.key?(:'safari_apns_p12_password') + self.safari_apns_p12_password = attributes[:'safari_apns_p12_password'] + end + + if attributes.key?(:'safari_site_origin') + self.safari_site_origin = attributes[:'safari_site_origin'] + end + + if attributes.key?(:'safari_push_id') + self.safari_push_id = attributes[:'safari_push_id'] + end + + if attributes.key?(:'safari_icon_16_16') + self.safari_icon_16_16 = attributes[:'safari_icon_16_16'] + end + + if attributes.key?(:'safari_icon_32_32') + self.safari_icon_32_32 = attributes[:'safari_icon_32_32'] + end + + if attributes.key?(:'safari_icon_64_64') + self.safari_icon_64_64 = attributes[:'safari_icon_64_64'] + end + + if attributes.key?(:'safari_icon_128_128') + self.safari_icon_128_128 = attributes[:'safari_icon_128_128'] + end + + if attributes.key?(:'safari_icon_256_256') + self.safari_icon_256_256 = attributes[:'safari_icon_256_256'] + end + + if attributes.key?(:'site_name') + self.site_name = attributes[:'site_name'] + end + + if attributes.key?(:'basic_auth_key') + self.basic_auth_key = attributes[:'basic_auth_key'] + end + + if attributes.key?(:'organization_id') + self.organization_id = attributes[:'organization_id'] + end + + if attributes.key?(:'additional_data_is_root_payload') + self.additional_data_is_root_payload = attributes[:'additional_data_is_root_payload'] + 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 @id.nil? + invalid_properties.push('invalid value for "id", id 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 @id.nil? + apns_env_validator = EnumAttributeValidator.new('String', ["sandbox", "production"]) + return false unless apns_env_validator.valid?(@apns_env) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] apns_env Object to be assigned + def apns_env=(apns_env) + validator = EnumAttributeValidator.new('String', ["sandbox", "production"]) + unless validator.valid?(apns_env) + fail ArgumentError, "invalid value for \"apns_env\", must be one of #{validator.allowable_values}." + end + @apns_env = apns_env + 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 && + id == o.id && + name == o.name && + players == o.players && + messageable_players == o.messageable_players && + updated_at == o.updated_at && + created_at == o.created_at && + android_gcm_sender_id == o.android_gcm_sender_id && + gcm_key == o.gcm_key && + chrome_web_origin == o.chrome_web_origin && + chrome_key == o.chrome_key && + chrome_web_default_notification_icon == o.chrome_web_default_notification_icon && + chrome_web_sub_domain == o.chrome_web_sub_domain && + apns_env == o.apns_env && + apns_p12 == o.apns_p12 && + apns_p12_password == o.apns_p12_password && + apns_certificates == o.apns_certificates && + safari_apns_certificates == o.safari_apns_certificates && + safari_apns_p12 == o.safari_apns_p12 && + safari_apns_p12_password == o.safari_apns_p12_password && + safari_site_origin == o.safari_site_origin && + safari_push_id == o.safari_push_id && + safari_icon_16_16 == o.safari_icon_16_16 && + safari_icon_32_32 == o.safari_icon_32_32 && + safari_icon_64_64 == o.safari_icon_64_64 && + safari_icon_128_128 == o.safari_icon_128_128 && + safari_icon_256_256 == o.safari_icon_256_256 && + site_name == o.site_name && + basic_auth_key == o.basic_auth_key && + organization_id == o.organization_id && + additional_data_is_root_payload == o.additional_data_is_root_payload + 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 + [id, name, players, messageable_players, updated_at, created_at, android_gcm_sender_id, gcm_key, chrome_web_origin, chrome_key, chrome_web_default_notification_icon, chrome_web_sub_domain, apns_env, apns_p12, apns_p12_password, apns_certificates, safari_apns_certificates, safari_apns_p12, safari_apns_p12_password, safari_site_origin, safari_push_id, safari_icon_16_16, safari_icon_32_32, safari_icon_64_64, safari_icon_128_128, safari_icon_256_256, site_name, basic_auth_key, organization_id, additional_data_is_root_payload].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) + 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 - def string_date?(date) - date.is_a?(String) && date.match(DATE_REGEX) + # 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/button.rb b/lib/onesignal/models/button.rb new file mode 100644 index 0000000..be792b4 --- /dev/null +++ b/lib/onesignal/models/button.rb @@ -0,0 +1,241 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +The version of the OpenAPI document: 1.0.0 +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 5.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + class Button + attr_accessor :id + + attr_accessor :text + + attr_accessor :icon + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'text' => :'text', + :'icon' => :'icon' + } + 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 + { + :'id' => :'String', + :'text' => :'String', + :'icon' => :'String' + } + 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::Button` 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::Button`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'text') + self.text = attributes[:'text'] + end + + if attributes.key?(:'icon') + self.icon = attributes[:'icon'] + 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 @id.nil? + invalid_properties.push('invalid value for "id", id 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 @id.nil? + true + 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 && + id == o.id && + text == o.text && + icon == o.icon + 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 + [id, text, icon].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) + 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/delivery_data.rb b/lib/onesignal/models/delivery_data.rb new file mode 100644 index 0000000..130d94a --- /dev/null +++ b/lib/onesignal/models/delivery_data.rb @@ -0,0 +1,254 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +The version of the OpenAPI document: 1.0.0 +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 5.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + class DeliveryData + attr_accessor :successful + + attr_accessor :failed + + attr_accessor :errored + + attr_accessor :converted + + attr_accessor :received + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'successful' => :'successful', + :'failed' => :'failed', + :'errored' => :'errored', + :'converted' => :'converted', + :'received' => :'received' + } + 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 + { + :'successful' => :'Integer', + :'failed' => :'Integer', + :'errored' => :'Integer', + :'converted' => :'Integer', + :'received' => :'Integer' + } + 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::DeliveryData` 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::DeliveryData`. 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?(:'successful') + self.successful = attributes[:'successful'] + end + + if attributes.key?(:'failed') + self.failed = attributes[:'failed'] + end + + if attributes.key?(:'errored') + self.errored = attributes[:'errored'] + end + + if attributes.key?(:'converted') + self.converted = attributes[:'converted'] + end + + if attributes.key?(:'received') + self.received = attributes[:'received'] + 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? + true + 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 && + successful == o.successful && + failed == o.failed && + errored == o.errored && + converted == o.converted && + received == o.received + 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 + [successful, failed, errored, converted, received].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) + 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/export_players_request_body.rb b/lib/onesignal/models/export_players_request_body.rb new file mode 100644 index 0000000..03e7233 --- /dev/null +++ b/lib/onesignal/models/export_players_request_body.rb @@ -0,0 +1,241 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +The version of the OpenAPI document: 1.0.0 +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 5.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + class ExportPlayersRequestBody + # Additional fields that you wish to include. Currently supports location, country, rooted, notification_types, ip, external_user_id, web_auth, and web_p256. + attr_accessor :extra_fields + + # Export all devices with a last_active timestamp greater than this time. Unixtime in seconds. + attr_accessor :last_active_since + + # Export al ldevices belonging to the segment. + attr_accessor :segment_name + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'extra_fields' => :'extra_fields', + :'last_active_since' => :'last_active_since', + :'segment_name' => :'segment_name' + } + 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 + { + :'extra_fields' => :'Array', + :'last_active_since' => :'Integer', + :'segment_name' => :'String' + } + 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::ExportPlayersRequestBody` 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::ExportPlayersRequestBody`. 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?(:'extra_fields') + if (value = attributes[:'extra_fields']).is_a?(Array) + self.extra_fields = value + end + end + + if attributes.key?(:'last_active_since') + self.last_active_since = attributes[:'last_active_since'] + end + + if attributes.key?(:'segment_name') + self.segment_name = attributes[:'segment_name'] + 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? + true + 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 && + extra_fields == o.extra_fields && + last_active_since == o.last_active_since && + segment_name == o.segment_name + 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 + [extra_fields, last_active_since, segment_name].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) + 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/filter.rb b/lib/onesignal/models/filter.rb new file mode 100644 index 0000000..e6ea0b3 --- /dev/null +++ b/lib/onesignal/models/filter.rb @@ -0,0 +1,293 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +The version of the OpenAPI document: 1.0.0 +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 5.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + class Filter + # Name of the field to use as the first operand in the filter expression. + attr_accessor :field + + # If `field` is `tag`, this field is *required* to specify `key` inside the tags. + attr_accessor :key + + # Constant value to use as the second operand in the filter expression. This value is *required* when the relation operator is a binary operator. + attr_accessor :value + + # Operator of a filter expression. + attr_accessor :relation + + 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 + { + :'field' => :'field', + :'key' => :'key', + :'value' => :'value', + :'relation' => :'relation' + } + 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 + { + :'field' => :'String', + :'key' => :'String', + :'value' => :'String', + :'relation' => :'String' + } + 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::Filter` 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::Filter`. 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?(:'field') + self.field = attributes[:'field'] + end + + if attributes.key?(:'key') + self.key = attributes[:'key'] + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + + if attributes.key?(:'relation') + self.relation = attributes[:'relation'] + 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 @field.nil? + invalid_properties.push('invalid value for "field", field cannot be nil.') + end + + if @relation.nil? + invalid_properties.push('invalid value for "relation", relation 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 @field.nil? + return false if @relation.nil? + relation_validator = EnumAttributeValidator.new('String', [">", "<", "=", "!=", "exists", "not_exists", "time_elapsed_gt", "time_elapsed_lt"]) + return false unless relation_validator.valid?(@relation) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] relation Object to be assigned + def relation=(relation) + validator = EnumAttributeValidator.new('String', [">", "<", "=", "!=", "exists", "not_exists", "time_elapsed_gt", "time_elapsed_lt"]) + unless validator.valid?(relation) + fail ArgumentError, "invalid value for \"relation\", must be one of #{validator.allowable_values}." + end + @relation = relation + 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 && + field == o.field && + key == o.key && + value == o.value && + relation == o.relation + 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 + [field, key, value, relation].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) + 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/filter_expressions.rb b/lib/onesignal/models/filter_expressions.rb new file mode 100644 index 0000000..8afd3a6 --- /dev/null +++ b/lib/onesignal/models/filter_expressions.rb @@ -0,0 +1,335 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +The version of the OpenAPI document: 1.0.0 +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 5.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + class FilterExpressions + # Name of the field to use as the first operand in the filter expression. + attr_accessor :field + + # If `field` is `tag`, this field is *required* to specify `key` inside the tags. + attr_accessor :key + + # Constant value to use as the second operand in the filter expression. This value is *required* when the relation operator is a binary operator. + attr_accessor :value + + # Operator of a filter expression. + attr_accessor :relation + + # Strictly, this must be either `\"OR\"`, or `\"AND\"`. It can be used to compose Filters as part of a Filters object. + attr_accessor :operator + + 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 + { + :'field' => :'field', + :'key' => :'key', + :'value' => :'value', + :'relation' => :'relation', + :'operator' => :'operator' + } + 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 + { + :'field' => :'String', + :'key' => :'String', + :'value' => :'String', + :'relation' => :'String', + :'operator' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in anyOf (OpenAPI v3) + def self.openapi_any_of + [ + :'Filter', + :'Operator' + ] + 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::FilterExpressions` 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::FilterExpressions`. 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?(:'field') + self.field = attributes[:'field'] + end + + if attributes.key?(:'key') + self.key = attributes[:'key'] + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + + if attributes.key?(:'relation') + self.relation = attributes[:'relation'] + end + + if attributes.key?(:'operator') + self.operator = attributes[:'operator'] + 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 @field.nil? + invalid_properties.push('invalid value for "field", field cannot be nil.') + end + + if @relation.nil? + invalid_properties.push('invalid value for "relation", relation 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 @field.nil? + return false if @relation.nil? + relation_validator = EnumAttributeValidator.new('String', [">", "<", "=", "!=", "exists", "not_exists", "time_elapsed_gt", "time_elapsed_lt"]) + return false unless relation_validator.valid?(@relation) + operator_validator = EnumAttributeValidator.new('String', ["OR", "AND"]) + return false unless operator_validator.valid?(@operator) + _any_of_found = false + self.class.openapi_any_of.each do |_class| + _any_of = OneSignal.const_get(_class).build_from_hash(self.to_hash) + if _any_of.valid? + _any_of_found = true + end + end + + if !_any_of_found + return false + end + + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] relation Object to be assigned + def relation=(relation) + validator = EnumAttributeValidator.new('String', [">", "<", "=", "!=", "exists", "not_exists", "time_elapsed_gt", "time_elapsed_lt"]) + unless validator.valid?(relation) + fail ArgumentError, "invalid value for \"relation\", must be one of #{validator.allowable_values}." + end + @relation = relation + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] operator Object to be assigned + def operator=(operator) + validator = EnumAttributeValidator.new('String', ["OR", "AND"]) + unless validator.valid?(operator) + fail ArgumentError, "invalid value for \"operator\", must be one of #{validator.allowable_values}." + end + @operator = operator + 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 && + field == o.field && + key == o.key && + value == o.value && + relation == o.relation && + operator == o.operator + 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 + [field, key, value, relation, operator].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) + 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/filter_notification_target.rb b/lib/onesignal/models/filter_notification_target.rb new file mode 100644 index 0000000..c62110b --- /dev/null +++ b/lib/onesignal/models/filter_notification_target.rb @@ -0,0 +1,329 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +The version of the OpenAPI document: 1.0.0 +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 5.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + class FilterNotificationTarget + # relation = \">\" or \"<\" hours_ago = number of hours before or after the users last session. Example: \"1.1\" + attr_accessor :last_session + + # relation = \">\" or \"<\" hours_ago = number of hours before or after the users first session. Example: \"1.1\" + attr_accessor :first_session + + # relation = \">\", \"<\", \"=\" or \"!=\" value = number sessions. Example: \"1\" + attr_accessor :session_count + + # relation = \">\", \"<\", \"=\" or \"!=\" value = Time in seconds the user has been in your app. Example: \"3600\" + attr_accessor :session_time + + # relation = \">\", \"<\", or \"=\" value = Amount in USD a user has spent on IAP (In App Purchases). Example: \"0.99\" + attr_accessor :amount_spent + + # relation = \">\", \"<\" or \"=\" key = SKU purchased in your app as an IAP (In App Purchases). Example: \"com.domain.100coinpack\" value = value of SKU to compare to. Example: \"0.99\" + attr_accessor :bought_sku + + # relation = \">\", \"<\", \"=\", \"!=\", \"exists\", \"not_exists\", \"time_elapsed_gt\" (paid plan only) or \"time_elapsed_lt\" (paid plan only) See Time Operators key = Tag key to compare. value = Tag value to compare. Not required for \"exists\" or \"not_exists\". Example: See Formatting Filters + attr_accessor :tag + + # relation = \"=\" or \"!=\" value = 2 character language code. Example: \"en\". For a list of all language codes see Language & Localization. + attr_accessor :language + + # relation = \">\", \"<\", \"=\" or \"!=\" value = app version. Example: \"1.0.0\" + attr_accessor :app_version + + # radius = in meters lat = latitude long = longitude + attr_accessor :location + + # value = email address Only for sending Push Notifications Use this for targeting push subscribers associated with an email set with all SDK setEmail methods To send emails to specific email addresses use include_email_tokens parameter + attr_accessor :email + + # relation = \"=\" value = 2-digit Country code Example: \"field\": \"country\", \"relation\": \"=\", \"value\", \"US\" + attr_accessor :country + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'last_session' => :'last_session', + :'first_session' => :'first_session', + :'session_count' => :'session_count', + :'session_time' => :'session_time', + :'amount_spent' => :'amount_spent', + :'bought_sku' => :'bought_sku', + :'tag' => :'tag', + :'language' => :'language', + :'app_version' => :'app_version', + :'location' => :'location', + :'email' => :'email', + :'country' => :'country' + } + 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 + { + :'last_session' => :'String', + :'first_session' => :'String', + :'session_count' => :'String', + :'session_time' => :'String', + :'amount_spent' => :'String', + :'bought_sku' => :'String', + :'tag' => :'String', + :'language' => :'String', + :'app_version' => :'String', + :'location' => :'String', + :'email' => :'String', + :'country' => :'String' + } + 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::FilterNotificationTarget` 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::FilterNotificationTarget`. 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?(:'last_session') + self.last_session = attributes[:'last_session'] + end + + if attributes.key?(:'first_session') + self.first_session = attributes[:'first_session'] + end + + if attributes.key?(:'session_count') + self.session_count = attributes[:'session_count'] + end + + if attributes.key?(:'session_time') + self.session_time = attributes[:'session_time'] + end + + if attributes.key?(:'amount_spent') + self.amount_spent = attributes[:'amount_spent'] + end + + if attributes.key?(:'bought_sku') + self.bought_sku = attributes[:'bought_sku'] + end + + if attributes.key?(:'tag') + self.tag = attributes[:'tag'] + end + + if attributes.key?(:'language') + self.language = attributes[:'language'] + end + + if attributes.key?(:'app_version') + self.app_version = attributes[:'app_version'] + end + + if attributes.key?(:'location') + self.location = attributes[:'location'] + end + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'country') + self.country = attributes[:'country'] + 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? + true + 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 && + last_session == o.last_session && + first_session == o.first_session && + session_count == o.session_count && + session_time == o.session_time && + amount_spent == o.amount_spent && + bought_sku == o.bought_sku && + tag == o.tag && + language == o.language && + app_version == o.app_version && + location == o.location && + email == o.email && + country == o.country + 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 + [last_session, first_session, session_count, session_time, amount_spent, bought_sku, tag, language, app_version, location, email, country].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) + 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/get_notification_request_body.rb b/lib/onesignal/models/get_notification_request_body.rb new file mode 100644 index 0000000..610acea --- /dev/null +++ b/lib/onesignal/models/get_notification_request_body.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 + +The version of the OpenAPI document: 1.0.0 +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 5.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + class GetNotificationRequestBody + # -> \"sent\" - All the devices by player_id that were sent the specified notification_id. Notifications targeting under 1000 recipients will not have \"sent\" events recorded, but will show \"clicked\" events. \"clicked\" - All the devices by `player_id` that clicked the specified notification_id. + attr_accessor :events + + # The email address you would like the report sent. + attr_accessor :email + + attr_accessor :app_id + + 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 + { + :'events' => :'events', + :'email' => :'email', + :'app_id' => :'app_id' + } + 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 + { + :'events' => :'String', + :'email' => :'String', + :'app_id' => :'String' + } + 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::GetNotificationRequestBody` 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::GetNotificationRequestBody`. 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?(:'events') + self.events = attributes[:'events'] + end + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'app_id') + self.app_id = attributes[:'app_id'] + 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? + events_validator = EnumAttributeValidator.new('String', ["sent", "clicked"]) + return false unless events_validator.valid?(@events) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] events Object to be assigned + def events=(events) + validator = EnumAttributeValidator.new('String', ["sent", "clicked"]) + unless validator.valid?(events) + fail ArgumentError, "invalid value for \"events\", must be one of #{validator.allowable_values}." + end + @events = events + 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 && + events == o.events && + email == o.email && + app_id == o.app_id + 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 + [events, email, app_id].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) + 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/inline_response200.rb b/lib/onesignal/models/inline_response200.rb new file mode 100644 index 0000000..802a553 --- /dev/null +++ b/lib/onesignal/models/inline_response200.rb @@ -0,0 +1,256 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +The version of the OpenAPI document: 1.0.0 +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 5.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + class InlineResponse200 + attr_accessor :id + + # Estimated number of subscribers targetted by notification. + attr_accessor :recipients + + attr_accessor :external_id + + attr_accessor :errors + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'id' => :'id', + :'recipients' => :'recipients', + :'external_id' => :'external_id', + :'errors' => :'errors' + } + 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 + { + :'id' => :'String', + :'recipients' => :'Integer', + :'external_id' => :'String', + :'errors' => :'OneOfobjectarray' + } + 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::InlineResponse200` 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::InlineResponse200`. 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?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'recipients') + self.recipients = attributes[:'recipients'] + end + + if attributes.key?(:'external_id') + self.external_id = attributes[:'external_id'] + end + + if attributes.key?(:'errors') + self.errors = attributes[:'errors'] + 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 @id.nil? + invalid_properties.push('invalid value for "id", id cannot be nil.') + end + + if @recipients.nil? + invalid_properties.push('invalid value for "recipients", recipients 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 @id.nil? + return false if @recipients.nil? + true + 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 && + id == o.id && + recipients == o.recipients && + external_id == o.external_id && + errors == o.errors + 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 + [id, recipients, external_id, errors].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) + 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/inline_response2001.rb b/lib/onesignal/models/inline_response2001.rb new file mode 100644 index 0000000..04470be --- /dev/null +++ b/lib/onesignal/models/inline_response2001.rb @@ -0,0 +1,218 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +The version of the OpenAPI document: 1.0.0 +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 5.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + class InlineResponse2001 + attr_accessor :success + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'success' => :'success' + } + 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 + { + :'success' => :'String' + } + 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::InlineResponse2001` 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::InlineResponse2001`. 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?(:'success') + self.success = attributes[:'success'] + 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? + true + 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 && + success == o.success + 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 + [success].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) + 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/inline_response2002.rb b/lib/onesignal/models/inline_response2002.rb new file mode 100644 index 0000000..7f6947f --- /dev/null +++ b/lib/onesignal/models/inline_response2002.rb @@ -0,0 +1,227 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +The version of the OpenAPI document: 1.0.0 +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 5.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + class InlineResponse2002 + attr_accessor :success + + attr_accessor :destination_url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'success' => :'success', + :'destination_url' => :'destination_url' + } + 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 + { + :'success' => :'String', + :'destination_url' => :'String' + } + 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::InlineResponse2002` 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::InlineResponse2002`. 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?(:'success') + self.success = attributes[:'success'] + end + + if attributes.key?(:'destination_url') + self.destination_url = attributes[:'destination_url'] + 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? + true + 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 && + success == o.success && + destination_url == o.destination_url + 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 + [success, destination_url].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) + 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/inline_response2003.rb b/lib/onesignal/models/inline_response2003.rb new file mode 100644 index 0000000..09bd219 --- /dev/null +++ b/lib/onesignal/models/inline_response2003.rb @@ -0,0 +1,218 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +The version of the OpenAPI document: 1.0.0 +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 5.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + class InlineResponse2003 + attr_accessor :success + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'success' => :'success' + } + 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 + { + :'success' => :'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::InlineResponse2003` 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::InlineResponse2003`. 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?(:'success') + self.success = attributes[:'success'] + 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? + true + 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 && + success == o.success + 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 + [success].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) + 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/inline_response2004.rb b/lib/onesignal/models/inline_response2004.rb new file mode 100644 index 0000000..02a12ed --- /dev/null +++ b/lib/onesignal/models/inline_response2004.rb @@ -0,0 +1,227 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +The version of the OpenAPI document: 1.0.0 +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 5.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + class InlineResponse2004 + attr_accessor :success + + attr_accessor :id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'success' => :'success', + :'id' => :'id' + } + 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 + { + :'success' => :'Boolean', + :'id' => :'String' + } + 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::InlineResponse2004` 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::InlineResponse2004`. 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?(:'success') + self.success = attributes[:'success'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + 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? + true + 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 && + success == o.success && + id == o.id + 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 + [success, id].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) + 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/inline_response2005.rb b/lib/onesignal/models/inline_response2005.rb new file mode 100644 index 0000000..0199fd9 --- /dev/null +++ b/lib/onesignal/models/inline_response2005.rb @@ -0,0 +1,218 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +The version of the OpenAPI document: 1.0.0 +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 5.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + class InlineResponse2005 + attr_accessor :csv_file_url + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'csv_file_url' => :'csv_file_url' + } + 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 + { + :'csv_file_url' => :'String' + } + 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::InlineResponse2005` 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::InlineResponse2005`. 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?(:'csv_file_url') + self.csv_file_url = attributes[:'csv_file_url'] + 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? + true + 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 && + csv_file_url == o.csv_file_url + 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 + [csv_file_url].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) + 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/inline_response201.rb b/lib/onesignal/models/inline_response201.rb new file mode 100644 index 0000000..eef0e6e --- /dev/null +++ b/lib/onesignal/models/inline_response201.rb @@ -0,0 +1,228 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +The version of the OpenAPI document: 1.0.0 +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 5.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + class InlineResponse201 + attr_accessor :success + + # UUID of created segment + attr_accessor :id + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'success' => :'success', + :'id' => :'id' + } + 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 + { + :'success' => :'Boolean', + :'id' => :'String' + } + 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::InlineResponse201` 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::InlineResponse201`. 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?(:'success') + self.success = attributes[:'success'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + 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? + true + 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 && + success == o.success && + id == o.id + 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 + [success, id].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) + 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/inline_response400.rb b/lib/onesignal/models/inline_response400.rb new file mode 100644 index 0000000..ed0f76c --- /dev/null +++ b/lib/onesignal/models/inline_response400.rb @@ -0,0 +1,220 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +The version of the OpenAPI document: 1.0.0 +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 5.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + class InlineResponse400 + attr_accessor :errors + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'errors' => :'errors' + } + 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 + { + :'errors' => :'Array' + } + 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::InlineResponse400` 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::InlineResponse400`. 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?(:'errors') + if (value = attributes[:'errors']).is_a?(Array) + self.errors = value + end + 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? + true + 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 && + errors == o.errors + 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 + [errors].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) + 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/inline_response4001.rb b/lib/onesignal/models/inline_response4001.rb new file mode 100644 index 0000000..c919d7d --- /dev/null +++ b/lib/onesignal/models/inline_response4001.rb @@ -0,0 +1,229 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +The version of the OpenAPI document: 1.0.0 +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 5.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + class InlineResponse4001 + attr_accessor :success + + attr_accessor :errors + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'success' => :'success', + :'errors' => :'errors' + } + 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 + { + :'success' => :'String', + :'errors' => :'Array' + } + 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::InlineResponse4001` 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::InlineResponse4001`. 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?(:'success') + self.success = attributes[:'success'] + end + + if attributes.key?(:'errors') + if (value = attributes[:'errors']).is_a?(Array) + self.errors = value + end + 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? + true + 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 && + success == o.success && + errors == o.errors + 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 + [success, errors].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) + 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/inline_response4002.rb b/lib/onesignal/models/inline_response4002.rb new file mode 100644 index 0000000..0c0a713 --- /dev/null +++ b/lib/onesignal/models/inline_response4002.rb @@ -0,0 +1,220 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +The version of the OpenAPI document: 1.0.0 +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 5.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + class InlineResponse4002 + attr_accessor :erorrs + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'erorrs' => :'erorrs' + } + 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 + { + :'erorrs' => :'Array' + } + 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::InlineResponse4002` 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::InlineResponse4002`. 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?(:'erorrs') + if (value = attributes[:'erorrs']).is_a?(Array) + self.erorrs = value + end + 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? + true + 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 && + erorrs == o.erorrs + 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 + [erorrs].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) + 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/inline_response409.rb b/lib/onesignal/models/inline_response409.rb new file mode 100644 index 0000000..1c59d45 --- /dev/null +++ b/lib/onesignal/models/inline_response409.rb @@ -0,0 +1,229 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +The version of the OpenAPI document: 1.0.0 +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 5.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + +module OneSignal + class InlineResponse409 + attr_accessor :success + + attr_accessor :errors + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'success' => :'success', + :'errors' => :'errors' + } + 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 + { + :'success' => :'Boolean', + :'errors' => :'Array' + } + 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::InlineResponse409` 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::InlineResponse409`. 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?(:'success') + self.success = attributes[:'success'] + end + + if attributes.key?(:'errors') + if (value = attributes[:'errors']).is_a?(Array) + self.errors = value + end + 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? + true + 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 && + success == o.success && + errors == o.errors + 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 + [success, errors].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) + 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 c503a94..727a26a 100644 --- a/lib/onesignal/models/notification.rb +++ b/lib/onesignal/models/notification.rb @@ -1,11 +1,1401 @@ +=begin +#OneSignal + +#A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com + +The version of the OpenAPI document: 1.0.0 +Contact: devrel@onesignal.com +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 5.2.0-SNAPSHOT + +=end + +require 'date' +require 'time' + module OneSignal - class Notification < BaseModel - def queued_at=(time) - @queued_at = Time.at(time) + class Notification + # The segment names you want to target. Users in these segments will receive a notification. This targeting parameter is only compatible with excluded_segments. Example: [\"Active Users\", \"Inactive Users\"] + attr_accessor :included_segments + + # Segment that will be excluded when sending. Users in these segments will not receive a notification, even if they were included in included_segments. This targeting parameter is only compatible with included_segments. Example: [\"Active Users\", \"Inactive Users\"] + attr_accessor :excluded_segments + + # relation = \">\" or \"<\" hours_ago = number of hours before or after the users last session. Example: \"1.1\" + attr_accessor :last_session + + # relation = \">\" or \"<\" hours_ago = number of hours before or after the users first session. Example: \"1.1\" + attr_accessor :first_session + + # relation = \">\", \"<\", \"=\" or \"!=\" value = number sessions. Example: \"1\" + attr_accessor :session_count + + # relation = \">\", \"<\", \"=\" or \"!=\" value = Time in seconds the user has been in your app. Example: \"3600\" + attr_accessor :session_time + + # relation = \">\", \"<\", or \"=\" value = Amount in USD a user has spent on IAP (In App Purchases). Example: \"0.99\" + attr_accessor :amount_spent + + # relation = \">\", \"<\" or \"=\" key = SKU purchased in your app as an IAP (In App Purchases). Example: \"com.domain.100coinpack\" value = value of SKU to compare to. Example: \"0.99\" + attr_accessor :bought_sku + + # relation = \">\", \"<\", \"=\", \"!=\", \"exists\", \"not_exists\", \"time_elapsed_gt\" (paid plan only) or \"time_elapsed_lt\" (paid plan only) See Time Operators key = Tag key to compare. value = Tag value to compare. Not required for \"exists\" or \"not_exists\". Example: See Formatting Filters + attr_accessor :tag + + # relation = \"=\" or \"!=\" value = 2 character language code. Example: \"en\". For a list of all language codes see Language & Localization. + attr_accessor :language + + # relation = \">\", \"<\", \"=\" or \"!=\" value = app version. Example: \"1.0.0\" + attr_accessor :app_version + + # radius = in meters lat = latitude long = longitude + attr_accessor :location + + # value = email address Only for sending Push Notifications Use this for targeting push subscribers associated with an email set with all SDK setEmail methods To send emails to specific email addresses use include_email_tokens parameter + attr_accessor :email + + # relation = \"=\" value = 2-digit Country code Example: \"field\": \"country\", \"relation\": \"=\", \"value\", \"US\" + attr_accessor :country + + # Specific playerids to send your notification to. _Does not require API Auth Key. Do not combine with other targeting parameters. Not compatible with any other targeting parameters. Example: [\"1dd608f2-c6a1-11e3-851d-000c2940e62c\"] Limit of 2,000 entries per REST API call + attr_accessor :include_player_ids + + # Target specific devices by custom user IDs assigned via API. Not compatible with any other targeting parameters Example: [“custom-id-assigned-by-api”] REQUIRED: REST API Key Authentication Limit of 2,000 entries per REST API call. Note: If targeting push, email, or sms subscribers with same ids, use with channel_for_external_user_ids to indicate you are sending a push or email or sms. + attr_accessor :include_external_user_ids + + # Recommended for Sending Emails - Target specific email addresses. If an email does not correspond to an existing user, a new user will be created. Example: nick@catfac.ts Limit of 2,000 entries per REST API call + attr_accessor :include_email_tokens + + # Recommended for Sending SMS - Target specific phone numbers. The phone number should be in the E.164 format. Phone number should be an existing subscriber on OneSignal. Refer our docs to learn how to add phone numbers to OneSignal. Example phone number: +1999999999 Limit of 2,000 entries per REST API call + attr_accessor :include_phone_numbers + + # Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using iOS device tokens. Warning: Only works with Production tokens. All non-alphanumeric characters must be removed from each token. If a token does not correspond to an existing user, a new user will be created. Example: ce777617da7f548fe7a9ab6febb56cf39fba6d38203... Limit of 2,000 entries per REST API call + attr_accessor :include_ios_tokens + + # Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Windows URIs. If a token does not correspond to an existing user, a new user will be created. Example: http://s.notify.live.net/u/1/bn1/HmQAAACPaLDr-... Limit of 2,000 entries per REST API call + attr_accessor :include_wp_wns_uris + + # Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Amazon ADM registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: amzn1.adm-registration.v1.XpvSSUk0Rc3hTVVV... Limit of 2,000 entries per REST API call + attr_accessor :include_amazon_reg_ids + + # Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Chrome App registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: APA91bEeiUeSukAAUdnw3O2RB45FWlSpgJ7Ji_... Limit of 2,000 entries per REST API call + attr_accessor :include_chrome_reg_ids + + # Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Chrome Web Push registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: APA91bEeiUeSukAAUdnw3O2RB45FWlSpgJ7Ji_... Limit of 2,000 entries per REST API call + attr_accessor :include_chrome_web_reg_ids + + # Not Recommended: Please consider using include_player_ids or include_external_user_ids instead. Target using Android device registration IDs. If a token does not correspond to an existing user, a new user will be created. Example: APA91bEeiUeSukAAUdnw3O2RB45FWlSpgJ7Ji_... Limit of 2,000 entries per REST API call + attr_accessor :include_android_reg_ids + + attr_accessor :id + + attr_accessor :value + + attr_accessor :aggregation + + # Indicates whether to send to all devices registered under your app's Apple iOS platform. + attr_accessor :is_ios + + # Indicates whether to send to all devices registered under your app's Google Android platform. + attr_accessor :is_android + + # Indicates whether to send to all devices registered under your app's Huawei Android platform. + attr_accessor :is_huawei + + # Indicates whether to send to all subscribed web browser users, including Chrome, Firefox, and Safari. You may use this instead as a combined flag instead of separately enabling isChromeWeb, isFirefox, and isSafari, though the three options are equivalent to this one. + attr_accessor :is_any_web + + # Indicates whether to send to all Google Chrome, Chrome on Android, and Mozilla Firefox users registered under your Chrome & Firefox web push platform. + attr_accessor :is_chrome_web + + # Indicates whether to send to all Mozilla Firefox desktop users registered under your Firefox web push platform. + attr_accessor :is_firefox + + # Does not support iOS Safari. Indicates whether to send to all Apple's Safari desktop users registered under your Safari web push platform. Read more iOS Safari + attr_accessor :is_safari + + # Indicates whether to send to all devices registered under your app's Windows platform. + attr_accessor :is_wp_wns + + # Indicates whether to send to all devices registered under your app's Amazon Fire platform. + attr_accessor :is_adm + + # This flag is not used for web push Please see isChromeWeb for sending to web push users. This flag only applies to Google Chrome Apps & Extensions. Indicates whether to send to all devices registered under your app's Google Chrome Apps & Extension platform. + attr_accessor :is_chrome + + # Indicates if the message type when targeting with include_external_user_ids for cases where an email, sms, and/or push subscribers have the same external user id. Example: Use the string \"push\" to indicate you are sending a push notification or the string \"email\"for sending emails or \"sms\"for sending SMS. + attr_accessor :channel_for_external_user_ids + + # Required: Your OneSignal Application ID, which can be found in Keys & IDs. It is a UUID and looks similar to 8250eaf6-1a58-489e-b136-7c74a864b434. + attr_accessor :app_id + + # Correlation and idempotency key. A request received with this parameter will first look for another notification with the same external_id. If one exists, a notification will not be sent, and result of the previous operation will instead be returned. Therefore, if you plan on using this feature, it's important to use a good source of randomness to generate the UUID passed here. This key is only idempotent for 30 days. After 30 days, the notification could be removed from our system and a notification with the same external_id will be sent again. See Idempotent Notification Requests for more details writeOnly: true + attr_accessor :external_id + + attr_accessor :contents + + attr_accessor :headings + + attr_accessor :subtitle + + # Channel: Push Notifications Platform: Huawei A custom map of data that is passed back to your app. Same as using Additional Data within the dashboard. Can use up to 2048 bytes of data. Example: {\"abc\": 123, \"foo\": \"bar\", \"event_performed\": true, \"amount\": 12.1} + attr_accessor :data + + # Channel: Push Notifications Platform: Huawei Use \"data\" or \"message\" depending on the type of notification you are sending. More details in Data & Background Notifications. + attr_accessor :huawei_msg_type + + # Channel: Push Notifications Platform: All The URL to open in the browser when a user clicks on the notification. Note: iOS needs https or updated NSAppTransportSecurity in plist This field supports inline substitutions. Omit if including web_url or app_url Example: https://onesignal.com + attr_accessor :url + + # Channel: Push Notifications Platform: All Browsers Same as url but only sent to web push platforms. Including Chrome, Firefox, Safari, Opera, etc. Example: https://onesignal.com + attr_accessor :web_url + + # Channel: Push Notifications Platform: All Browsers Same as url but only sent to web push platforms. Including iOS, Android, macOS, Windows, ChromeApps, etc. Example: https://onesignal.com + attr_accessor :app_url + + # Channel: Push Notifications Platform: iOS 10+ Adds media attachments to notifications. Set as JSON object, key as a media id of your choice and the value as a valid local filename or URL. User must press and hold on the notification to view. Do not set mutable_content to download attachments. The OneSignal SDK does this automatically Example: {\"id1\": \"https://domain.com/image.jpg\"} + attr_accessor :ios_attachments + + # Channel: Push Notifications Platform: All Use a template you setup on our dashboard. The template_id is the UUID found in the URL when viewing a template on our dashboard. Example: be4a8044-bbd6-11e4-a581-000c2940e62c + attr_accessor :template_id + + # Channel: Push Notifications Platform: iOS Sending true wakes your app from background to run custom native code (Apple interprets this as content-available=1). Note: Not applicable if the app is in the \"force-quit\" state (i.e app was swiped away). Omit the contents field to prevent displaying a visible notification. + attr_accessor :content_available + + # Channel: Push Notifications Platform: iOS 10+ Always defaults to true and cannot be turned off. Allows tracking of notification receives and changing of the notification content in your app before it is displayed. Triggers didReceive(_:withContentHandler:) on your UNNotificationServiceExtension. + attr_accessor :mutable_content + + # Channel: Push Notifications Platform: iOS 13+ Use to target a specific experience in your App Clip, or to target your notification to a specific window in a multi-scene App. + attr_accessor :target_content_identifier + + # Channel: Push Notifications Platform: Android Picture to display in the expanded view. Can be a drawable resource name or a URL. + attr_accessor :big_picture + + # Channel: Push Notifications Platform: Huawei Picture to display in the expanded view. Can be a drawable resource name or a URL. + attr_accessor :huawei_big_picture + + # Channel: Push Notifications Platform: Amazon Picture to display in the expanded view. Can be a drawable resource name or a URL. + attr_accessor :adm_big_picture + + # Channel: Push Notifications Platform: ChromeApp Large picture to display below the notification text. Must be a local URL. + attr_accessor :chrome_big_picture + + # Channel: Push Notifications Platform: Chrome 56+ Sets the web push notification's large image to be shown below the notification's title and text. Please see Web Push Notification Icons. + attr_accessor :chrome_web_image + + # Channel: Push Notifications Platform: iOS 8.0+, Android 4.1+, and derivatives like Amazon Buttons to add to the notification. Icon only works for Android. Buttons show in reverse order of array position i.e. Last item in array shows as first button on device. Example: [{\"id\": \"id2\", \"text\": \"second button\", \"icon\": \"ic_menu_share\"}, {\"id\": \"id1\", \"text\": \"first button\", \"icon\": \"ic_menu_send\"}] + attr_accessor :buttons + + # Channel: Push Notifications Platform: Chrome 48+ Add action buttons to the notification. The id field is required. Example: [{\"id\": \"like-button\", \"text\": \"Like\", \"icon\": \"http://i.imgur.com/N8SN8ZS.png\", \"url\": \"https://yoursite.com\"}, {\"id\": \"read-more-button\", \"text\": \"Read more\", \"icon\": \"http://i.imgur.com/MIxJp1L.png\", \"url\": \"https://yoursite.com\"}] + attr_accessor :web_buttons + + # Channel: Push Notifications Platform: iOS Category APS payload, use with registerUserNotificationSettings:categories in your Objective-C / Swift code. Example: calendar category which contains actions like accept and decline iOS 10+ This will trigger your UNNotificationContentExtension whose ID matches this category. + attr_accessor :ios_category + + # Channel: Push Notifications Platform: Android The Android Oreo Notification Category to send the notification under. See the Category documentation on creating one and getting it's id. + attr_accessor :android_channel_id + + # Channel: Push Notifications Platform: Huawei The Android Oreo Notification Category to send the notification under. See the Category documentation on creating one and getting it's id. + attr_accessor :huawei_channel_id + + # Channel: Push Notifications Platform: Android Use this if you have client side Android Oreo Channels you have already defined in your app with code. + attr_accessor :existing_android_channel_id + + # Channel: Push Notifications Platform: Huawei Use this if you have client side Android Oreo Channels you have already defined in your app with code. + attr_accessor :huawei_existing_channel_id + + attr_accessor :android_background_layout + + # Channel: Push Notifications Platform: Android Icon shown in the status bar and on the top left of the notification. If not set a bell icon will be used or ic_stat_onesignal_default if you have set this resource name. See: How to create small icons + attr_accessor :small_icon + + # Channel: Push Notifications Platform: Huawei Icon shown in the status bar and on the top left of the notification. Use an Android resource path (E.g. /drawable/small_icon). Defaults to your app icon if not set. + attr_accessor :huawei_small_icon + + # Channel: Push Notifications Platform: Android Can be a drawable resource name or a URL. See: How to create large icons + attr_accessor :large_icon + + # Channel: Push Notifications Platform: Huawei Can be a drawable resource name or a URL. See: How to create large icons + attr_accessor :huawei_large_icon + + # Channel: Push Notifications Platform: Amazon If not set a bell icon will be used or ic_stat_onesignal_default if you have set this resource name. See: How to create small icons + attr_accessor :adm_small_icon + + # Channel: Push Notifications Platform: Amazon If blank the small_icon is used. Can be a drawable resource name or a URL. See: How to create large icons + attr_accessor :adm_large_icon + + # Channel: Push Notifications Platform: Chrome Sets the web push notification's icon. An image URL linking to a valid image. Common image types are supported; GIF will not animate. We recommend 256x256 (at least 80x80) to display well on high DPI devices. Firefox will also use this icon, unless you specify firefox_icon. + attr_accessor :chrome_web_icon + + # Channel: Push Notifications Platform: Chrome Sets the web push notification icon for Android devices in the notification shade. Please see Web Push Notification Badge. + attr_accessor :chrome_web_badge + + # Channel: Push Notifications Platform: Firefox Not recommended Few people need to set Firefox-specific icons. We recommend setting chrome_web_icon instead, which Firefox will also use. Sets the web push notification's icon for Firefox. An image URL linking to a valid image. Common image types are supported; GIF will not animate. We recommend 256x256 (at least 80x80) to display well on high DPI devices. + attr_accessor :firefox_icon + + # Channel: Push Notifications Platform: ChromeApp This flag is not used for web push For web push, please see chrome_web_icon instead. The local URL to an icon to use. If blank, the app icon will be used. + attr_accessor :chrome_icon + + # Channel: Push Notifications Platform: iOS Sound file that is included in your app to play instead of the default device notification sound. Pass nil to disable vibration and sound for the notification. Example: \"notification.wav\" + attr_accessor :ios_sound + + # Channel: Push Notifications Platform: Android ⚠Deprecated, this field doesn't work on Android 8 (Oreo) and newer devices! Please use Notification Categories / Channels noted above instead to support ALL versions of Android. Sound file that is included in your app to play instead of the default device notification sound. Pass nil to disable sound for the notification. NOTE: Leave off file extension for Android. Example: \"notification\" + attr_accessor :android_sound + + # Channel: Push Notifications Platform: Huawei ⚠Deprecated, this field ONLY works on EMUI 5 (Android 7 based) and older devices. Please also set Notification Categories / Channels noted above to support EMUI 8 (Android 8 based) devices. Sound file that is included in your app to play instead of the default device notification sound. NOTE: Leave off file extension for and include the full path. Example: \"/res/raw/notification\" + attr_accessor :huawei_sound + + # Channel: Push Notifications Platform: Amazon ⚠Deprecated, this field doesn't work on Android 8 (Oreo) and newer devices! Please use Notification Categories / Channels noted above instead to support ALL versions of Android. Sound file that is included in your app to play instead of the default device notification sound. Pass nil to disable sound for the notification. NOTE: Leave off file extension for Android. Example: \"notification\" + attr_accessor :adm_sound + + # Channel: Push Notifications Platform: Windows Sound file that is included in your app to play instead of the default device notification sound. Example: \"notification.wav\" + attr_accessor :wp_wns_sound + + # Channel: Push Notifications Platform: Android ⚠Deprecated, this field doesn't work on Android 8 (Oreo) and newer devices! Please use Notification Categories / Channels noted above instead to support ALL versions of Android. Sets the devices LED notification light if the device has one. ARGB Hex format. Example(Blue): \"FF0000FF\" + attr_accessor :android_led_color + + # Channel: Push Notifications Platform: Huawei ⚠Deprecated, this field ONLY works on EMUI 5 (Android 7 based) and older devices. Please also set Notification Categories / Channels noted above to support EMUI 8 (Android 8 based) devices. Sets the devices LED notification light if the device has one. RGB Hex format. Example(Blue): \"0000FF\" + attr_accessor :huawei_led_color + + # Channel: Push Notifications Platform: Android Sets the background color of the notification circle to the left of the notification text. Only applies to apps targeting Android API level 21+ on Android 5.0+ devices. Example(Red): \"FFFF0000\" + attr_accessor :android_accent_color + + # Channel: Push Notifications Platform: Huawei Accent Color used on Action Buttons and Group overflow count. Uses RGB Hex value (E.g. #9900FF). Defaults to device’s theme color if not set. + attr_accessor :huawei_accent_color + + # Channel: Push Notifications Platform: Android 5.0_ ⚠Deprecated, this field doesn't work on Android 8 (Oreo) and newer devices! Please use Notification Categories / Channels noted above instead to support ALL versions of Android. 1 = Public (default) (Shows the full message on the lock screen unless the user has disabled all notifications from showing on the lock screen. Please consider the user and mark private if the contents are.) 0 = Private (Hides message contents on lock screen if the user set \"Hide sensitive notification content\" in the system settings) -1 = Secret (Notification does not show on the lock screen at all) + attr_accessor :android_visibility + + # Channel: Push Notifications Platform: Huawei ⚠Deprecated, this field ONLY works on EMUI 5 (Android 7 based) and older devices. Please also set Notification Categories / Channels noted above to support EMUI 8 (Android 8 based) devices. 1 = Public (default) (Shows the full message on the lock screen unless the user has disabled all notifications from showing on the lock screen. Please consider the user and mark private if the contents are.) 0 = Private (Hides message contents on lock screen if the user set \"Hide sensitive notification content\" in the system settings) -1 = Secret (Notification does not show on the lock screen at all) + attr_accessor :huawei_visibility + + # Channel: Push Notifications Platform: iOS Describes whether to set or increase/decrease your app's iOS badge count by the ios_badgeCount specified count. Can specify None, SetTo, or Increase. `None` leaves the count unaffected. `SetTo` directly sets the badge count to the number specified in ios_badgeCount. `Increase` adds the number specified in ios_badgeCount to the total. Use a negative number to decrease the badge count. + attr_accessor :ios_badge_type + + # Channel: Push Notifications Platform: iOS Used with ios_badgeType, describes the value to set or amount to increase/decrease your app's iOS badge count by. You can use a negative number to decrease the badge count when used with an ios_badgeType of Increase. + attr_accessor :ios_badge_count + + # Channel: Push Notifications Platform: iOS 10+, Android Only one notification with the same id will be shown on the device. Use the same id to update an existing notification instead of showing a new one. Limit of 64 characters. + attr_accessor :collapse_id + + # Channel: Push Notifications Platform: All Browsers Display multiple notifications at once with different topics. + attr_accessor :web_push_topic + + # Channel: Push Notifications Platform: iOS 10+ iOS can localize push notification messages on the client using special parameters such as loc-key. When using the Create Notification endpoint, you must include these parameters inside of a field called apns_alert. Please see Apple's guide on localizing push notifications to learn more. + attr_accessor :apns_alert + + # Channel: All Schedule notification for future delivery. API defaults to UTC -1100 Examples: All examples are the exact same date & time. \"Thu Sep 24 2015 14:00:00 GMT-0700 (PDT)\" \"September 24th 2015, 2:00:00 pm UTC-07:00\" \"2015-09-24 14:00:00 GMT-0700\" \"Sept 24 2015 14:00:00 GMT-0700\" \"Thu Sep 24 2015 14:00:00 GMT-0700 (Pacific Daylight Time)\" Note: SMS currently only supports send_after parameter. + attr_accessor :send_after + + # Channel: All Possible values are: timezone (Deliver at a specific time-of-day in each users own timezone) last-active Same as Intelligent Delivery . (Deliver at the same time of day as each user last used your app). If send_after is used, this takes effect after the send_after time has elapsed. + attr_accessor :delayed_option + + # Channel: All Use with delayed_option=timezone. Examples: \"9:00AM\" \"21:45\" \"9:45:30\" + attr_accessor :delivery_time_of_day + + # Channel: Push Notifications Platform: iOS, Android, Chrome, Firefox, Safari, ChromeWeb Time To Live - In seconds. The notification will be expired if the device does not come back online within this time. The default is 259,200 seconds (3 days). Max value to set is 2419200 seconds (28 days). + attr_accessor :ttl + + # Channel: Push Notifications Platform: Android, Chrome, ChromeWeb Delivery priority through the push server (example GCM/FCM). Pass 10 for high priority or any other integer for normal priority. Defaults to normal priority for Android and high for iOS. For Android 6.0+ devices setting priority to high will wake the device out of doze mode. + attr_accessor :priority + + # Channel: Push Notifications Platform: iOS valid values: voip Set the value to voip for sending VoIP Notifications This field maps to the APNS header apns-push-type. Note: alert and background are automatically set by OneSignal + attr_accessor :apns_push_type_override + + # Channel: All Apps with throttling enabled: - the parameter value will be used to override the default application throttling value set from the dashboard settings. - parameter value 0 indicates not to apply throttling to the notification. - if the parameter is not passed then the default app throttling value will be applied to the notification. Apps with throttling disabled: - this parameter can be used to throttle delivery for the notification even though throttling is not enabled at the application level. Refer to throttling for more details. + attr_accessor :throttle_rate_per_minute + + # Channel: Push Notifications Platform: Android Notifications with the same group will be stacked together using Android's Notification Grouping feature. + attr_accessor :android_group + + # Channel: Push Notifications Platform: Android Note: This only works for Android 6 and older. Android 7+ allows full expansion of all message. Summary message to display when 2+ notifications are stacked together. Default is \"# new messages\". Include $[notif_count] in your message and it will be replaced with the current number. Languages - The value of each key is the message that will be sent to users for that language. \"en\" (English) is required. The key of each hash is either a a 2 character language code or one of zh-Hans/zh-Hant for Simplified or Traditional Chinese. Read more: supported languages. Example: {\"en\": \"You have $[notif_count] new messages\"} + attr_accessor :android_group_message + + # Channel: Push Notifications Platform: Amazon Notifications with the same group will be stacked together using Android's Notification Grouping feature. + attr_accessor :adm_group + + # Channel: Push Notifications Platform: Amazon Summary message to display when 2+ notifications are stacked together. Default is \"# new messages\". Include $[notif_count] in your message and it will be replaced with the current number. \"en\" (English) is required. The key of each hash is either a a 2 character language code or one of zh-Hans/zh-Hant for Simplified or Traditional Chinese. The value of each key is the message that will be sent to users for that language. Example: {\"en\": \"You have $[notif_count] new messages\"} + attr_accessor :adm_group_message + + # Channel: Push Notifications Platform: iOS 12+ This parameter is supported in iOS 12 and above. It allows you to group related notifications together. If two notifications have the same thread-id, they will both be added to the same group. + attr_accessor :thread_id + + # Channel: Push Notifications Platform: iOS 12+ When using thread_id to create grouped notifications in iOS 12+, you can also control the summary. For example, a grouped notification can say \"12 more notifications from John Doe\". The summary_arg lets you set the name of the person/thing the notifications are coming from, and will show up as \"X more notifications from summary_arg\" + attr_accessor :summary_arg + + # 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\" + attr_accessor :summary_arg_count + + # Channel: Email Required. The subject of the email. + attr_accessor :email_subect + + # 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. + attr_accessor :email_body + + # Channel: Email The name the email is from. If not specified, will default to \"from name\" set in the OneSignal Dashboard Email Settings. + attr_accessor :email_from_name + + # Channel: Email The email address the email is from. If not specified, will default to \"from email\" set in the OneSignal Dashboard Email Settings. + attr_accessor :email_from_address + + # Channel: SMS Phone Number used to send SMS. Should be a registered Twilio phone number in E.164 format. + attr_accessor :sms_from + + # 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. + attr_accessor :sms_media_urls + + 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 + { + :'included_segments' => :'included_segments', + :'excluded_segments' => :'excluded_segments', + :'last_session' => :'last_session', + :'first_session' => :'first_session', + :'session_count' => :'session_count', + :'session_time' => :'session_time', + :'amount_spent' => :'amount_spent', + :'bought_sku' => :'bought_sku', + :'tag' => :'tag', + :'language' => :'language', + :'app_version' => :'app_version', + :'location' => :'location', + :'email' => :'email', + :'country' => :'country', + :'include_player_ids' => :'include_player_ids', + :'include_external_user_ids' => :'include_external_user_ids', + :'include_email_tokens' => :'include_email_tokens', + :'include_phone_numbers' => :'include_phone_numbers', + :'include_ios_tokens' => :'include_ios_tokens', + :'include_wp_wns_uris' => :'include_wp_wns_uris', + :'include_amazon_reg_ids' => :'include_amazon_reg_ids', + :'include_chrome_reg_ids' => :'include_chrome_reg_ids', + :'include_chrome_web_reg_ids' => :'include_chrome_web_reg_ids', + :'include_android_reg_ids' => :'include_android_reg_ids', + :'id' => :'id', + :'value' => :'value', + :'aggregation' => :'aggregation', + :'is_ios' => :'isIos', + :'is_android' => :'isAndroid', + :'is_huawei' => :'isHuawei', + :'is_any_web' => :'isAnyWeb', + :'is_chrome_web' => :'isChromeWeb', + :'is_firefox' => :'isFirefox', + :'is_safari' => :'isSafari', + :'is_wp_wns' => :'isWP_WNS', + :'is_adm' => :'isAdm', + :'is_chrome' => :'isChrome', + :'channel_for_external_user_ids' => :'channel_for_external_user_ids', + :'app_id' => :'app_id', + :'external_id' => :'external_id', + :'contents' => :'contents', + :'headings' => :'headings', + :'subtitle' => :'subtitle', + :'data' => :'data', + :'huawei_msg_type' => :'huawei_msg_type', + :'url' => :'url', + :'web_url' => :'web_url', + :'app_url' => :'app_url', + :'ios_attachments' => :'ios_attachments', + :'template_id' => :'template_id', + :'content_available' => :'content_available', + :'mutable_content' => :'mutable_content', + :'target_content_identifier' => :'target_content_identifier', + :'big_picture' => :'big_picture', + :'huawei_big_picture' => :'huawei_big_picture', + :'adm_big_picture' => :'adm_big_picture', + :'chrome_big_picture' => :'chrome_big_picture', + :'chrome_web_image' => :'chrome_web_image', + :'buttons' => :'buttons', + :'web_buttons' => :'web_buttons', + :'ios_category' => :'ios_category', + :'android_channel_id' => :'android_channel_id', + :'huawei_channel_id' => :'huawei_channel_id', + :'existing_android_channel_id' => :'existing_android_channel_id', + :'huawei_existing_channel_id' => :'huawei_existing_channel_id', + :'android_background_layout' => :'android_background_layout', + :'small_icon' => :'small_icon', + :'huawei_small_icon' => :'huawei_small_icon', + :'large_icon' => :'large_icon', + :'huawei_large_icon' => :'huawei_large_icon', + :'adm_small_icon' => :'adm_small_icon', + :'adm_large_icon' => :'adm_large_icon', + :'chrome_web_icon' => :'chrome_web_icon', + :'chrome_web_badge' => :'chrome_web_badge', + :'firefox_icon' => :'firefox_icon', + :'chrome_icon' => :'chrome_icon', + :'ios_sound' => :'ios_sound', + :'android_sound' => :'android_sound', + :'huawei_sound' => :'huawei_sound', + :'adm_sound' => :'adm_sound', + :'wp_wns_sound' => :'wp_wns_sound', + :'android_led_color' => :'android_led_color', + :'huawei_led_color' => :'huawei_led_color', + :'android_accent_color' => :'android_accent_color', + :'huawei_accent_color' => :'huawei_accent_color', + :'android_visibility' => :'android_visibility', + :'huawei_visibility' => :'huawei_visibility', + :'ios_badge_type' => :'ios_badgeType', + :'ios_badge_count' => :'ios_badgeCount', + :'collapse_id' => :'collapse_id', + :'web_push_topic' => :'web_push_topic', + :'apns_alert' => :'apns_alert', + :'send_after' => :'send_after', + :'delayed_option' => :'delayed_option', + :'delivery_time_of_day' => :'delivery_time_of_day', + :'ttl' => :'ttl', + :'priority' => :'priority', + :'apns_push_type_override' => :'apns_push_type_override', + :'throttle_rate_per_minute' => :'throttle_rate_per_minute', + :'android_group' => :'android_group', + :'android_group_message' => :'android_group_message', + :'adm_group' => :'adm_group', + :'adm_group_message' => :'adm_group_message', + :'thread_id' => :'thread_id', + :'summary_arg' => :'summary_arg', + :'summary_arg_count' => :'summary_arg_count', + :'email_subect' => :'email_subect', + :'email_body' => :'email_body', + :'email_from_name' => :'email_from_name', + :'email_from_address' => :'email_from_address', + :'sms_from' => :'sms_from', + :'sms_media_urls' => :'sms_media_urls' + } + 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 + { + :'included_segments' => :'Array', + :'excluded_segments' => :'Array', + :'last_session' => :'String', + :'first_session' => :'String', + :'session_count' => :'String', + :'session_time' => :'String', + :'amount_spent' => :'String', + :'bought_sku' => :'String', + :'tag' => :'String', + :'language' => :'String', + :'app_version' => :'String', + :'location' => :'String', + :'email' => :'String', + :'country' => :'String', + :'include_player_ids' => :'Array', + :'include_external_user_ids' => :'Array', + :'include_email_tokens' => :'Array', + :'include_phone_numbers' => :'Array', + :'include_ios_tokens' => :'Array', + :'include_wp_wns_uris' => :'Array', + :'include_amazon_reg_ids' => :'Array', + :'include_chrome_reg_ids' => :'Array', + :'include_chrome_web_reg_ids' => :'Array', + :'include_android_reg_ids' => :'Array', + :'id' => :'String', + :'value' => :'Integer', + :'aggregation' => :'String', + :'is_ios' => :'Boolean', + :'is_android' => :'Boolean', + :'is_huawei' => :'Boolean', + :'is_any_web' => :'Boolean', + :'is_chrome_web' => :'Boolean', + :'is_firefox' => :'Boolean', + :'is_safari' => :'Boolean', + :'is_wp_wns' => :'Boolean', + :'is_adm' => :'Boolean', + :'is_chrome' => :'Boolean', + :'channel_for_external_user_ids' => :'String', + :'app_id' => :'String', + :'external_id' => :'String', + :'contents' => :'StringMap', + :'headings' => :'StringMap', + :'subtitle' => :'StringMap', + :'data' => :'Object', + :'huawei_msg_type' => :'String', + :'url' => :'String', + :'web_url' => :'String', + :'app_url' => :'String', + :'ios_attachments' => :'Object', + :'template_id' => :'String', + :'content_available' => :'Boolean', + :'mutable_content' => :'Boolean', + :'target_content_identifier' => :'String', + :'big_picture' => :'String', + :'huawei_big_picture' => :'String', + :'adm_big_picture' => :'String', + :'chrome_big_picture' => :'String', + :'chrome_web_image' => :'String', + :'buttons' => :'Array