onesignal 5.6.0 → 5.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/Gemfile.lock +2 -2
- data/README.md +3 -3
- data/docs/CreateNotificationSuccessResponse.md +1 -1
- data/docs/DefaultApi.md +499 -90
- data/docs/NotificationSlice.md +4 -0
- data/lib/onesignal/api/default_api.rb +4 -1
- data/lib/onesignal/api_client.rb +2 -2
- data/lib/onesignal/api_error.rb +50 -1
- data/lib/onesignal/configuration.rb +1 -1
- data/lib/onesignal/errors.rb +23 -0
- data/lib/onesignal/helpers.rb +116 -0
- data/lib/onesignal/models/api_key_token.rb +1 -1
- data/lib/onesignal/models/api_key_tokens_list_response.rb +1 -1
- data/lib/onesignal/models/app.rb +1 -1
- data/lib/onesignal/models/basic_notification.rb +1 -1
- data/lib/onesignal/models/basic_notification_all_of.rb +1 -1
- data/lib/onesignal/models/basic_notification_all_of_android_background_layout.rb +1 -1
- data/lib/onesignal/models/button.rb +1 -1
- data/lib/onesignal/models/copy_template_request.rb +1 -1
- data/lib/onesignal/models/create_api_key_request.rb +1 -1
- data/lib/onesignal/models/create_api_key_response.rb +1 -1
- data/lib/onesignal/models/create_notification_success_response.rb +2 -2
- data/lib/onesignal/models/create_segment_conflict_response.rb +1 -1
- data/lib/onesignal/models/create_segment_success_response.rb +1 -1
- data/lib/onesignal/models/create_template_request.rb +1 -1
- data/lib/onesignal/models/create_user_conflict_response.rb +1 -1
- data/lib/onesignal/models/create_user_conflict_response_errors_inner.rb +1 -1
- data/lib/onesignal/models/create_user_conflict_response_errors_items_meta.rb +1 -1
- data/lib/onesignal/models/custom_event.rb +1 -1
- data/lib/onesignal/models/custom_events_request.rb +1 -1
- data/lib/onesignal/models/delivery_data.rb +1 -1
- data/lib/onesignal/models/export_events_success_response.rb +1 -1
- data/lib/onesignal/models/export_subscriptions_request_body.rb +1 -1
- data/lib/onesignal/models/export_subscriptions_success_response.rb +1 -1
- data/lib/onesignal/models/filter.rb +1 -1
- data/lib/onesignal/models/filter_expression.rb +1 -1
- data/lib/onesignal/models/generic_error.rb +1 -1
- data/lib/onesignal/models/generic_success_bool_response.rb +1 -1
- data/lib/onesignal/models/get_notification_history_request_body.rb +1 -1
- data/lib/onesignal/models/get_segments_success_response.rb +1 -1
- data/lib/onesignal/models/language_string_map.rb +1 -1
- data/lib/onesignal/models/notification.rb +1 -1
- data/lib/onesignal/models/notification_all_of.rb +1 -1
- data/lib/onesignal/models/notification_history_success_response.rb +1 -1
- data/lib/onesignal/models/notification_slice.rb +22 -2
- data/lib/onesignal/models/notification_target.rb +1 -1
- data/lib/onesignal/models/notification_with_meta.rb +1 -1
- data/lib/onesignal/models/notification_with_meta_all_of.rb +1 -1
- data/lib/onesignal/models/operator.rb +1 -1
- data/lib/onesignal/models/outcome_data.rb +1 -1
- data/lib/onesignal/models/outcomes_data.rb +1 -1
- data/lib/onesignal/models/platform_delivery_data.rb +1 -1
- data/lib/onesignal/models/platform_delivery_data_email_all_of.rb +1 -1
- data/lib/onesignal/models/platform_delivery_data_sms_all_of.rb +1 -1
- data/lib/onesignal/models/properties_body.rb +1 -1
- data/lib/onesignal/models/properties_deltas.rb +1 -1
- data/lib/onesignal/models/properties_object.rb +1 -1
- data/lib/onesignal/models/purchase.rb +1 -1
- data/lib/onesignal/models/rate_limit_error.rb +1 -1
- data/lib/onesignal/models/segment.rb +1 -1
- data/lib/onesignal/models/segment_data.rb +1 -1
- data/lib/onesignal/models/segment_notification_target.rb +1 -1
- data/lib/onesignal/models/start_live_activity_request.rb +1 -1
- data/lib/onesignal/models/start_live_activity_success_response.rb +1 -1
- data/lib/onesignal/models/subscription.rb +1 -1
- data/lib/onesignal/models/subscription_body.rb +1 -1
- data/lib/onesignal/models/subscription_notification_target.rb +1 -1
- data/lib/onesignal/models/template_resource.rb +1 -1
- data/lib/onesignal/models/templates_list_response.rb +1 -1
- data/lib/onesignal/models/transfer_subscription_request_body.rb +1 -1
- data/lib/onesignal/models/update_api_key_request.rb +1 -1
- data/lib/onesignal/models/update_live_activity_request.rb +1 -1
- data/lib/onesignal/models/update_live_activity_success_response.rb +1 -1
- data/lib/onesignal/models/update_template_request.rb +1 -1
- data/lib/onesignal/models/update_user_request.rb +1 -1
- data/lib/onesignal/models/user.rb +1 -1
- data/lib/onesignal/models/user_identity_body.rb +1 -1
- data/lib/onesignal/models/web_button.rb +1 -1
- data/lib/onesignal/version.rb +2 -2
- data/lib/onesignal.rb +3 -1
- data/onesignal.gemspec +1 -1
- data/spec/api/default_api_spec.rb +2 -1
- data/spec/api_client_spec.rb +1 -1
- data/spec/configuration_spec.rb +1 -1
- data/spec/models/api_key_token_spec.rb +1 -1
- data/spec/models/api_key_tokens_list_response_spec.rb +1 -1
- data/spec/models/app_spec.rb +1 -1
- data/spec/models/basic_notification_all_of_android_background_layout_spec.rb +1 -1
- data/spec/models/basic_notification_all_of_spec.rb +1 -1
- data/spec/models/basic_notification_spec.rb +1 -1
- data/spec/models/button_spec.rb +1 -1
- data/spec/models/copy_template_request_spec.rb +1 -1
- data/spec/models/create_api_key_request_spec.rb +1 -1
- data/spec/models/create_api_key_response_spec.rb +1 -1
- data/spec/models/create_notification_success_response_spec.rb +1 -1
- data/spec/models/create_segment_conflict_response_spec.rb +1 -1
- data/spec/models/create_segment_success_response_spec.rb +1 -1
- data/spec/models/create_template_request_spec.rb +1 -1
- data/spec/models/create_user_conflict_response_errors_inner_spec.rb +1 -1
- data/spec/models/create_user_conflict_response_errors_items_meta_spec.rb +1 -1
- data/spec/models/create_user_conflict_response_spec.rb +1 -1
- data/spec/models/custom_event_spec.rb +1 -1
- data/spec/models/custom_events_request_spec.rb +1 -1
- data/spec/models/delivery_data_spec.rb +1 -1
- data/spec/models/export_events_success_response_spec.rb +1 -1
- data/spec/models/export_subscriptions_request_body_spec.rb +1 -1
- data/spec/models/export_subscriptions_success_response_spec.rb +1 -1
- data/spec/models/filter_expression_spec.rb +1 -1
- data/spec/models/filter_spec.rb +1 -1
- data/spec/models/generic_error_spec.rb +1 -1
- data/spec/models/generic_success_bool_response_spec.rb +1 -1
- data/spec/models/get_notification_history_request_body_spec.rb +1 -1
- data/spec/models/get_segments_success_response_spec.rb +1 -1
- data/spec/models/language_string_map_spec.rb +1 -1
- data/spec/models/notification_all_of_spec.rb +1 -1
- data/spec/models/notification_history_success_response_spec.rb +1 -1
- data/spec/models/notification_slice_spec.rb +13 -1
- data/spec/models/notification_spec.rb +1 -1
- data/spec/models/notification_target_spec.rb +1 -1
- data/spec/models/notification_with_meta_all_of_spec.rb +1 -1
- data/spec/models/notification_with_meta_spec.rb +1 -1
- data/spec/models/operator_spec.rb +1 -1
- data/spec/models/outcome_data_spec.rb +1 -1
- data/spec/models/outcomes_data_spec.rb +1 -1
- data/spec/models/platform_delivery_data_email_all_of_spec.rb +1 -1
- data/spec/models/platform_delivery_data_sms_all_of_spec.rb +1 -1
- data/spec/models/platform_delivery_data_spec.rb +1 -1
- data/spec/models/properties_body_spec.rb +1 -1
- data/spec/models/properties_deltas_spec.rb +1 -1
- data/spec/models/properties_object_spec.rb +1 -1
- data/spec/models/purchase_spec.rb +1 -1
- data/spec/models/rate_limit_error_spec.rb +1 -1
- data/spec/models/segment_data_spec.rb +1 -1
- data/spec/models/segment_notification_target_spec.rb +1 -1
- data/spec/models/segment_spec.rb +1 -1
- data/spec/models/start_live_activity_request_spec.rb +1 -1
- data/spec/models/start_live_activity_success_response_spec.rb +1 -1
- data/spec/models/subscription_body_spec.rb +1 -1
- data/spec/models/subscription_notification_target_spec.rb +1 -1
- data/spec/models/subscription_spec.rb +1 -1
- data/spec/models/template_resource_spec.rb +1 -1
- data/spec/models/templates_list_response_spec.rb +1 -1
- data/spec/models/transfer_subscription_request_body_spec.rb +1 -1
- data/spec/models/update_api_key_request_spec.rb +1 -1
- data/spec/models/update_live_activity_request_spec.rb +1 -1
- data/spec/models/update_live_activity_success_response_spec.rb +1 -1
- data/spec/models/update_template_request_spec.rb +1 -1
- data/spec/models/update_user_request_spec.rb +1 -1
- data/spec/models/user_identity_body_spec.rb +1 -1
- data/spec/models/user_spec.rb +1 -1
- data/spec/models/web_button_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- data/vendor/bundle/ruby/3.2.0/cache/psych-5.4.0.gem +0 -0
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/byebug-13.0.0/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/date-3.5.1/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/io-console-0.8.2/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/io-console-0.8.2/mkmf.log +3 -3
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/jaro_winkler-1.5.6/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.4.0/gem_make.out +28 -0
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/{psych-5.3.1 → psych-5.4.0}/psych.so +0 -0
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.8.1/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.2.0/gem_make.out +5 -5
- data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/README.md +2 -2
- data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/ext/psych/psych_parser.c +14 -3
- data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/versions.rb +1 -1
- data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych.so +0 -0
- data/vendor/bundle/ruby/3.2.0/specifications/{psych-5.3.1.gemspec → psych-5.4.0.gemspec} +2 -2
- metadata +114 -112
- data/vendor/bundle/ruby/3.2.0/cache/psych-5.3.1.gem +0 -0
- data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.3.1/gem_make.out +0 -28
- /data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/{psych-5.3.1 → psych-5.4.0}/gem.build_complete +0 -0
- /data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/{psych-5.3.1 → psych-5.4.0}/mkmf.log +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/CONTRIBUTING.md +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/LICENSE +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/ext/psych/Makefile +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/ext/psych/depend +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/ext/psych/extconf.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/ext/psych/psych.c +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/ext/psych/psych.h +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/ext/psych/psych_emitter.c +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/ext/psych/psych_emitter.h +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/ext/psych/psych_parser.h +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/ext/psych/psych_to_ruby.c +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/ext/psych/psych_to_ruby.h +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/ext/psych/psych_yaml_tree.c +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/ext/psych/psych_yaml_tree.h +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/class_loader.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/coder.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/core_ext.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/exception.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/handler.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/handlers/document_stream.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/handlers/recorder.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/json/ruby_events.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/json/stream.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/json/tree_builder.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/json/yaml_events.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/nodes/alias.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/nodes/document.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/nodes/mapping.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/nodes/node.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/nodes/scalar.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/nodes/sequence.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/nodes/stream.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/nodes.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/omap.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/parser.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/scalar_scanner.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/set.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/stream.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/streaming.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/syntax_error.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/tree_builder.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/visitors/depth_first.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/visitors/emitter.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/visitors/json_tree.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/visitors/to_ruby.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/visitors/visitor.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/visitors/yaml_tree.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/visitors.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych/y.rb +0 -0
- /data/vendor/bundle/ruby/3.2.0/gems/{psych-5.3.1 → psych-5.4.0}/lib/psych.rb +0 -0
data/docs/DefaultApi.md
CHANGED
|
@@ -49,6 +49,41 @@ All URIs are relative to *https://api.onesignal.com*
|
|
|
49
49
|
| [**view_template**](DefaultApi.md#view_template) | **GET** /templates/{template_id} | View template |
|
|
50
50
|
| [**view_templates**](DefaultApi.md#view_templates) | **GET** /templates | View templates |
|
|
51
51
|
|
|
52
|
+
## Common patterns
|
|
53
|
+
|
|
54
|
+
The per-endpoint examples below illustrate one specific call each. This section covers patterns that apply to most operations.
|
|
55
|
+
|
|
56
|
+
### Authentication
|
|
57
|
+
|
|
58
|
+
Every operation requires either a **REST API Key** (App-scoped, used by ~77% of endpoints) or an **Organization API Key** (used by the remaining ~23% — the app-management endpoints `get_apps` / `create_app` / `get_app` / `update_app` / `copy_template_to_app`, plus the API-key administration endpoints `view_api_keys` / `create_api_key` / `delete_api_key` / `update_api_key` / `rotate_api_key`). The two are not interchangeable. The "Authorization" row on each endpoint below lists the exact scheme.
|
|
59
|
+
|
|
60
|
+
### Idempotency
|
|
61
|
+
|
|
62
|
+
`POST /notifications` accepts a top-level `idempotency_key` (UUIDv4) that the server uses for request dedup within a **30-day window**. Pass a freshly-generated UUID per logical send so that network-level retries are safe. Never reuse a key across distinct sends — the server returns the original response instead of acting on the new payload. The hero `create_notification` example below demonstrates the call.
|
|
63
|
+
|
|
64
|
+
Prefer the bundled `create_notification_with_retry` helper over wiring this up by hand: it generates the key when absent (a caller-provided key is respected), retries 429 / 503 / connection errors with the **same** key (honoring `Retry-After`, exponential backoff otherwise; `max_retries` / `base_delay` configurable), fails fast on other errors, and reports via `was_replayed` whether the server answered from a previously completed request (`Idempotent-Replayed` response header). It is available as a `DefaultApi` method so the call mirrors `create_notification`:
|
|
65
|
+
|
|
66
|
+
```ruby
|
|
67
|
+
result = api_instance.create_notification_with_retry(notification)
|
|
68
|
+
puts "#{result.response.id} replayed=#{result.was_replayed}"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Error handling
|
|
72
|
+
|
|
73
|
+
When a request fails, the SDK raises `OneSignal::ApiError`. The HTTP status code is `e.code` (Integer); the parsed error body is `e.response_body` (String — the raw JSON envelope). Response headers are available via `e.response_headers`. Most envelopes match `{ "errors": ["..."] }` (an array of strings) but a few endpoints return `{ "errors": [{"code": ..., "title": ..., "meta": {...}}] }` (an array of structured error objects — used by `POST /apps/{app_id}/users` 409 conflict, see `CreateUserConflictResponse`), `{ "errors": "..." }` (string), or `{ "success": false }` (no `errors` field at all). Robust error-handling code should tolerate all four shapes. The `e.error_messages` method does this for you, normalizing every shape to a flat `Array<String>` (empty when the body carries no `errors`). To branch on a specific error without hard-coding message strings, test membership against the generated [`OneSignal::Errors`](https://github.com/OneSignal/onesignal-ruby-api/blob/master/lib/onesignal/errors.rb) catalog — e.g. `e.error_messages.include?(OneSignal::Errors::NO_TARGETING_SPECIFIED)`.
|
|
74
|
+
|
|
75
|
+
### Polymorphic 200 from POST /notifications
|
|
76
|
+
|
|
77
|
+
`CreateNotificationSuccessResponse` has two distinct shapes that share the same schema; branch on `id`:
|
|
78
|
+
- **Success** — `id` is a non-empty UUID. `errors`, if present, is an object keyed by recipient-identifier type (`invalid_player_ids`, `invalid_external_user_ids`, `invalid_aliases`, ...) listing recipients that were skipped (partial-success path).
|
|
79
|
+
- **No-send** — `id` is the empty string `""`. `errors` is a string array with the sentinel reason, typically `["All included players are not subscribed"]`.
|
|
80
|
+
|
|
81
|
+
The hero `create_notification` example below demonstrates the branch pattern explicitly.
|
|
82
|
+
|
|
83
|
+
### Targeting users by External ID
|
|
84
|
+
|
|
85
|
+
Set `include_aliases.external_id` to a list of External IDs and set `target_channel` to `push` / `email` / `sms`. The alias label must be the literal string `external_id` — camelCase variants such as `externalId` are silently ignored and yield zero recipients. **Do not confuse** this with the deprecated top-level `external_id` notification field — a separate correlation/idempotency field with its own 30-day dedup keyspace (parallel to `idempotency_key`, not an alias) and no targeting effect.
|
|
86
|
+
|
|
52
87
|
|
|
53
88
|
## cancel_notification
|
|
54
89
|
|
|
@@ -70,8 +105,8 @@ OneSignal.configure do |config|
|
|
|
70
105
|
end
|
|
71
106
|
|
|
72
107
|
api_instance = OneSignal::DefaultApi.new
|
|
73
|
-
app_id = '
|
|
74
|
-
notification_id = '
|
|
108
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String |
|
|
109
|
+
notification_id = 'b3a0c8bd-3a4c-4b22-9a73-3f1a8c2d1b88' # String |
|
|
75
110
|
|
|
76
111
|
begin
|
|
77
112
|
# Stop a scheduled or currently outgoing notification
|
|
@@ -79,6 +114,11 @@ begin
|
|
|
79
114
|
p result
|
|
80
115
|
rescue OneSignal::ApiError => e
|
|
81
116
|
puts "Error when calling DefaultApi->cancel_notification: #{e}"
|
|
117
|
+
puts "Status Code: #{e.code}"
|
|
118
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
119
|
+
# the raw body remains on `e.response_body`.
|
|
120
|
+
puts "Error Messages: #{e.error_messages}"
|
|
121
|
+
puts "Response Body: #{e.response_body}"
|
|
82
122
|
end
|
|
83
123
|
```
|
|
84
124
|
|
|
@@ -97,6 +137,8 @@ begin
|
|
|
97
137
|
p data # => <GenericSuccessBoolResponse>
|
|
98
138
|
rescue OneSignal::ApiError => e
|
|
99
139
|
puts "Error when calling DefaultApi->cancel_notification_with_http_info: #{e}"
|
|
140
|
+
puts "Status Code: #{e.code}"
|
|
141
|
+
puts "Response Body: #{e.response_body}"
|
|
100
142
|
end
|
|
101
143
|
```
|
|
102
144
|
|
|
@@ -141,8 +183,8 @@ OneSignal.configure do |config|
|
|
|
141
183
|
end
|
|
142
184
|
|
|
143
185
|
api_instance = OneSignal::DefaultApi.new
|
|
144
|
-
template_id = '
|
|
145
|
-
app_id = '
|
|
186
|
+
template_id = 'e4d3c2b1-a09f-4f1e-8d7c-6b5a4f3e2d1c' # String |
|
|
187
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String |
|
|
146
188
|
copy_template_request = OneSignal::CopyTemplateRequest.new({target_app_id: 'target_app_id_example'}) # CopyTemplateRequest |
|
|
147
189
|
|
|
148
190
|
begin
|
|
@@ -151,6 +193,11 @@ begin
|
|
|
151
193
|
p result
|
|
152
194
|
rescue OneSignal::ApiError => e
|
|
153
195
|
puts "Error when calling DefaultApi->copy_template_to_app: #{e}"
|
|
196
|
+
puts "Status Code: #{e.code}"
|
|
197
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
198
|
+
# the raw body remains on `e.response_body`.
|
|
199
|
+
puts "Error Messages: #{e.error_messages}"
|
|
200
|
+
puts "Response Body: #{e.response_body}"
|
|
154
201
|
end
|
|
155
202
|
```
|
|
156
203
|
|
|
@@ -169,6 +216,8 @@ begin
|
|
|
169
216
|
p data # => <TemplateResource>
|
|
170
217
|
rescue OneSignal::ApiError => e
|
|
171
218
|
puts "Error when calling DefaultApi->copy_template_to_app_with_http_info: #{e}"
|
|
219
|
+
puts "Status Code: #{e.code}"
|
|
220
|
+
puts "Response Body: #{e.response_body}"
|
|
172
221
|
end
|
|
173
222
|
```
|
|
174
223
|
|
|
@@ -214,9 +263,9 @@ OneSignal.configure do |config|
|
|
|
214
263
|
end
|
|
215
264
|
|
|
216
265
|
api_instance = OneSignal::DefaultApi.new
|
|
217
|
-
app_id = '
|
|
218
|
-
alias_label = '
|
|
219
|
-
alias_id = '
|
|
266
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String |
|
|
267
|
+
alias_label = 'external_id' # String |
|
|
268
|
+
alias_id = 'YOUR_USER_EXTERNAL_ID' # String |
|
|
220
269
|
user_identity_body = OneSignal::UserIdentityBody.new # UserIdentityBody |
|
|
221
270
|
|
|
222
271
|
begin
|
|
@@ -225,6 +274,11 @@ begin
|
|
|
225
274
|
p result
|
|
226
275
|
rescue OneSignal::ApiError => e
|
|
227
276
|
puts "Error when calling DefaultApi->create_alias: #{e}"
|
|
277
|
+
puts "Status Code: #{e.code}"
|
|
278
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
279
|
+
# the raw body remains on `e.response_body`.
|
|
280
|
+
puts "Error Messages: #{e.error_messages}"
|
|
281
|
+
puts "Response Body: #{e.response_body}"
|
|
228
282
|
end
|
|
229
283
|
```
|
|
230
284
|
|
|
@@ -243,6 +297,8 @@ begin
|
|
|
243
297
|
p data # => <UserIdentityBody>
|
|
244
298
|
rescue OneSignal::ApiError => e
|
|
245
299
|
puts "Error when calling DefaultApi->create_alias_with_http_info: #{e}"
|
|
300
|
+
puts "Status Code: #{e.code}"
|
|
301
|
+
puts "Response Body: #{e.response_body}"
|
|
246
302
|
end
|
|
247
303
|
```
|
|
248
304
|
|
|
@@ -289,8 +345,8 @@ OneSignal.configure do |config|
|
|
|
289
345
|
end
|
|
290
346
|
|
|
291
347
|
api_instance = OneSignal::DefaultApi.new
|
|
292
|
-
app_id = '
|
|
293
|
-
subscription_id = '
|
|
348
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String |
|
|
349
|
+
subscription_id = '7e4c5b9a-1f60-4d07-9b1a-2e8c8d2cae51' # String |
|
|
294
350
|
user_identity_body = OneSignal::UserIdentityBody.new # UserIdentityBody |
|
|
295
351
|
|
|
296
352
|
begin
|
|
@@ -299,6 +355,11 @@ begin
|
|
|
299
355
|
p result
|
|
300
356
|
rescue OneSignal::ApiError => e
|
|
301
357
|
puts "Error when calling DefaultApi->create_alias_by_subscription: #{e}"
|
|
358
|
+
puts "Status Code: #{e.code}"
|
|
359
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
360
|
+
# the raw body remains on `e.response_body`.
|
|
361
|
+
puts "Error Messages: #{e.error_messages}"
|
|
362
|
+
puts "Response Body: #{e.response_body}"
|
|
302
363
|
end
|
|
303
364
|
```
|
|
304
365
|
|
|
@@ -317,6 +378,8 @@ begin
|
|
|
317
378
|
p data # => <UserIdentityBody>
|
|
318
379
|
rescue OneSignal::ApiError => e
|
|
319
380
|
puts "Error when calling DefaultApi->create_alias_by_subscription_with_http_info: #{e}"
|
|
381
|
+
puts "Status Code: #{e.code}"
|
|
382
|
+
puts "Response Body: #{e.response_body}"
|
|
320
383
|
end
|
|
321
384
|
```
|
|
322
385
|
|
|
@@ -362,7 +425,7 @@ OneSignal.configure do |config|
|
|
|
362
425
|
end
|
|
363
426
|
|
|
364
427
|
api_instance = OneSignal::DefaultApi.new
|
|
365
|
-
app_id = '
|
|
428
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String |
|
|
366
429
|
create_api_key_request = OneSignal::CreateApiKeyRequest.new # CreateApiKeyRequest |
|
|
367
430
|
|
|
368
431
|
begin
|
|
@@ -371,6 +434,11 @@ begin
|
|
|
371
434
|
p result
|
|
372
435
|
rescue OneSignal::ApiError => e
|
|
373
436
|
puts "Error when calling DefaultApi->create_api_key: #{e}"
|
|
437
|
+
puts "Status Code: #{e.code}"
|
|
438
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
439
|
+
# the raw body remains on `e.response_body`.
|
|
440
|
+
puts "Error Messages: #{e.error_messages}"
|
|
441
|
+
puts "Response Body: #{e.response_body}"
|
|
374
442
|
end
|
|
375
443
|
```
|
|
376
444
|
|
|
@@ -389,6 +457,8 @@ begin
|
|
|
389
457
|
p data # => <CreateApiKeyResponse>
|
|
390
458
|
rescue OneSignal::ApiError => e
|
|
391
459
|
puts "Error when calling DefaultApi->create_api_key_with_http_info: #{e}"
|
|
460
|
+
puts "Status Code: #{e.code}"
|
|
461
|
+
puts "Response Body: #{e.response_body}"
|
|
392
462
|
end
|
|
393
463
|
```
|
|
394
464
|
|
|
@@ -441,6 +511,11 @@ begin
|
|
|
441
511
|
p result
|
|
442
512
|
rescue OneSignal::ApiError => e
|
|
443
513
|
puts "Error when calling DefaultApi->create_app: #{e}"
|
|
514
|
+
puts "Status Code: #{e.code}"
|
|
515
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
516
|
+
# the raw body remains on `e.response_body`.
|
|
517
|
+
puts "Error Messages: #{e.error_messages}"
|
|
518
|
+
puts "Response Body: #{e.response_body}"
|
|
444
519
|
end
|
|
445
520
|
```
|
|
446
521
|
|
|
@@ -459,6 +534,8 @@ begin
|
|
|
459
534
|
p data # => <App>
|
|
460
535
|
rescue OneSignal::ApiError => e
|
|
461
536
|
puts "Error when calling DefaultApi->create_app_with_http_info: #{e}"
|
|
537
|
+
puts "Status Code: #{e.code}"
|
|
538
|
+
puts "Response Body: #{e.response_body}"
|
|
462
539
|
end
|
|
463
540
|
```
|
|
464
541
|
|
|
@@ -502,7 +579,7 @@ OneSignal.configure do |config|
|
|
|
502
579
|
end
|
|
503
580
|
|
|
504
581
|
api_instance = OneSignal::DefaultApi.new
|
|
505
|
-
app_id = '
|
|
582
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String | Your OneSignal App ID in UUID v4 format.
|
|
506
583
|
custom_events_request = OneSignal::CustomEventsRequest.new({events: [OneSignal::CustomEvent.new({name: 'name_example'})]}) # CustomEventsRequest |
|
|
507
584
|
|
|
508
585
|
begin
|
|
@@ -511,6 +588,11 @@ begin
|
|
|
511
588
|
p result
|
|
512
589
|
rescue OneSignal::ApiError => e
|
|
513
590
|
puts "Error when calling DefaultApi->create_custom_events: #{e}"
|
|
591
|
+
puts "Status Code: #{e.code}"
|
|
592
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
593
|
+
# the raw body remains on `e.response_body`.
|
|
594
|
+
puts "Error Messages: #{e.error_messages}"
|
|
595
|
+
puts "Response Body: #{e.response_body}"
|
|
514
596
|
end
|
|
515
597
|
```
|
|
516
598
|
|
|
@@ -529,6 +611,8 @@ begin
|
|
|
529
611
|
p data # => Object
|
|
530
612
|
rescue OneSignal::ApiError => e
|
|
531
613
|
puts "Error when calling DefaultApi->create_custom_events_with_http_info: #{e}"
|
|
614
|
+
puts "Status Code: #{e.code}"
|
|
615
|
+
puts "Response Body: #{e.response_body}"
|
|
532
616
|
end
|
|
533
617
|
```
|
|
534
618
|
|
|
@@ -573,18 +657,75 @@ OneSignal.configure do |config|
|
|
|
573
657
|
end
|
|
574
658
|
|
|
575
659
|
api_instance = OneSignal::DefaultApi.new
|
|
660
|
+
require 'securerandom'
|
|
661
|
+
|
|
576
662
|
notification = OneSignal::Notification.new
|
|
577
663
|
notification.app_id = 'YOUR_APP_ID'
|
|
578
664
|
notification.contents = OneSignal::LanguageStringMap.new({ en: 'Hello from OneSignal!' })
|
|
579
665
|
notification.include_aliases = { 'external_id' => ['YOUR_USER_EXTERNAL_ID'] }
|
|
580
666
|
notification.target_channel = 'push'
|
|
667
|
+
# Idempotency key: a client-generated UUID that lets you safely retry on network failure.
|
|
668
|
+
# If two requests arrive with the same key inside the 30-day window, only the first is sent
|
|
669
|
+
# and the second returns the original response. Use SecureRandom.uuid — DO NOT reuse keys
|
|
670
|
+
# across logically distinct sends.
|
|
671
|
+
notification.idempotency_key = SecureRandom.uuid
|
|
581
672
|
|
|
582
673
|
begin
|
|
583
674
|
# Create notification
|
|
584
675
|
result = api_instance.create_notification(notification)
|
|
585
|
-
|
|
676
|
+
# `result.id` discriminates the two HTTP 200 shapes. An empty string means no
|
|
677
|
+
# notification was created (e.g. all targets were unreachable / not subscribed).
|
|
678
|
+
# `result.errors` is polymorphic: an `Array<String>` in the no-subscribers case, or
|
|
679
|
+
# a Hash keyed by recipient-identifier type (`invalid_player_ids`,
|
|
680
|
+
# `invalid_external_user_ids`, `invalid_aliases`, ...) when the notification WAS
|
|
681
|
+
# created but some recipients were skipped.
|
|
682
|
+
if result.id.to_s.empty?
|
|
683
|
+
puts "Notification was not sent: #{result.errors}"
|
|
684
|
+
elsif result.errors
|
|
685
|
+
puts "Notification created: #{result.id} (partial failures: #{result.errors})"
|
|
686
|
+
else
|
|
687
|
+
puts "Notification created: #{result.id}"
|
|
688
|
+
end
|
|
586
689
|
rescue OneSignal::ApiError => e
|
|
587
690
|
puts "Error when calling DefaultApi->create_notification: #{e}"
|
|
691
|
+
puts "Status Code: #{e.code}"
|
|
692
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
693
|
+
# the raw body remains on `e.response_body`.
|
|
694
|
+
puts "Error Messages: #{e.error_messages}"
|
|
695
|
+
puts "Response Body: #{e.response_body}"
|
|
696
|
+
end
|
|
697
|
+
```
|
|
698
|
+
|
|
699
|
+
#### Using `create_notification_with_retry` (preferred for safe, idempotent retries)
|
|
700
|
+
|
|
701
|
+
The `create_notification_with_retry` method mirrors `create_notification` but generates the `idempotency_key` for you, transparently retries transient failures (HTTP 429 / 503 / connection errors) with the **same** key, and reports via `was_replayed` whether the server answered from a previously-completed request.
|
|
702
|
+
|
|
703
|
+
```ruby
|
|
704
|
+
require 'onesignal'
|
|
705
|
+
|
|
706
|
+
OneSignal.configure do |config|
|
|
707
|
+
config.rest_api_key = 'YOUR_BEARER_TOKEN'
|
|
708
|
+
end
|
|
709
|
+
|
|
710
|
+
api_instance = OneSignal::DefaultApi.new
|
|
711
|
+
notification = OneSignal::Notification.new
|
|
712
|
+
notification.app_id = 'YOUR_APP_ID'
|
|
713
|
+
notification.contents = OneSignal::LanguageStringMap.new({ en: 'Hello from OneSignal!' })
|
|
714
|
+
notification.include_aliases = { 'external_id' => ['YOUR_USER_EXTERNAL_ID'] }
|
|
715
|
+
notification.target_channel = 'push'
|
|
716
|
+
# No idempotency_key set: the helper generates a UUIDv4 and reuses it across retries.
|
|
717
|
+
|
|
718
|
+
begin
|
|
719
|
+
# max_retries / base_delay are optional (defaults: 3 retries, 1.0s backoff base).
|
|
720
|
+
result = api_instance.create_notification_with_retry(notification, max_retries: 5, base_delay: 0.5)
|
|
721
|
+
if result.was_replayed
|
|
722
|
+
puts "Server replayed a prior send (no duplicate): #{result.response.id}"
|
|
723
|
+
else
|
|
724
|
+
puts "Notification created: #{result.response.id}"
|
|
725
|
+
end
|
|
726
|
+
rescue OneSignal::ApiError => e
|
|
727
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>.
|
|
728
|
+
puts "create_notification_with_retry failed: HTTP #{e.code} #{e.error_messages}"
|
|
588
729
|
end
|
|
589
730
|
```
|
|
590
731
|
|
|
@@ -603,6 +744,8 @@ begin
|
|
|
603
744
|
p data # => <CreateNotificationSuccessResponse>
|
|
604
745
|
rescue OneSignal::ApiError => e
|
|
605
746
|
puts "Error when calling DefaultApi->create_notification_with_http_info: #{e}"
|
|
747
|
+
puts "Status Code: #{e.code}"
|
|
748
|
+
puts "Response Body: #{e.response_body}"
|
|
606
749
|
end
|
|
607
750
|
```
|
|
608
751
|
|
|
@@ -646,7 +789,7 @@ OneSignal.configure do |config|
|
|
|
646
789
|
end
|
|
647
790
|
|
|
648
791
|
api_instance = OneSignal::DefaultApi.new
|
|
649
|
-
app_id = '
|
|
792
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String | The OneSignal App ID for your app. Available in Keys & IDs.
|
|
650
793
|
opts = {
|
|
651
794
|
segment: OneSignal::Segment.new({name: 'name_example', filters: [OneSignal::Filter.new]}) # Segment |
|
|
652
795
|
}
|
|
@@ -657,6 +800,11 @@ begin
|
|
|
657
800
|
p result
|
|
658
801
|
rescue OneSignal::ApiError => e
|
|
659
802
|
puts "Error when calling DefaultApi->create_segment: #{e}"
|
|
803
|
+
puts "Status Code: #{e.code}"
|
|
804
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
805
|
+
# the raw body remains on `e.response_body`.
|
|
806
|
+
puts "Error Messages: #{e.error_messages}"
|
|
807
|
+
puts "Response Body: #{e.response_body}"
|
|
660
808
|
end
|
|
661
809
|
```
|
|
662
810
|
|
|
@@ -675,6 +823,8 @@ begin
|
|
|
675
823
|
p data # => <CreateSegmentSuccessResponse>
|
|
676
824
|
rescue OneSignal::ApiError => e
|
|
677
825
|
puts "Error when calling DefaultApi->create_segment_with_http_info: #{e}"
|
|
826
|
+
puts "Status Code: #{e.code}"
|
|
827
|
+
puts "Response Body: #{e.response_body}"
|
|
678
828
|
end
|
|
679
829
|
```
|
|
680
830
|
|
|
@@ -719,9 +869,9 @@ OneSignal.configure do |config|
|
|
|
719
869
|
end
|
|
720
870
|
|
|
721
871
|
api_instance = OneSignal::DefaultApi.new
|
|
722
|
-
app_id = '
|
|
723
|
-
alias_label = '
|
|
724
|
-
alias_id = '
|
|
872
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String |
|
|
873
|
+
alias_label = 'external_id' # String |
|
|
874
|
+
alias_id = 'YOUR_USER_EXTERNAL_ID' # String |
|
|
725
875
|
subscription_body = OneSignal::SubscriptionBody.new # SubscriptionBody |
|
|
726
876
|
|
|
727
877
|
begin
|
|
@@ -730,6 +880,11 @@ begin
|
|
|
730
880
|
p result
|
|
731
881
|
rescue OneSignal::ApiError => e
|
|
732
882
|
puts "Error when calling DefaultApi->create_subscription: #{e}"
|
|
883
|
+
puts "Status Code: #{e.code}"
|
|
884
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
885
|
+
# the raw body remains on `e.response_body`.
|
|
886
|
+
puts "Error Messages: #{e.error_messages}"
|
|
887
|
+
puts "Response Body: #{e.response_body}"
|
|
733
888
|
end
|
|
734
889
|
```
|
|
735
890
|
|
|
@@ -748,6 +903,8 @@ begin
|
|
|
748
903
|
p data # => <SubscriptionBody>
|
|
749
904
|
rescue OneSignal::ApiError => e
|
|
750
905
|
puts "Error when calling DefaultApi->create_subscription_with_http_info: #{e}"
|
|
906
|
+
puts "Status Code: #{e.code}"
|
|
907
|
+
puts "Response Body: #{e.response_body}"
|
|
751
908
|
end
|
|
752
909
|
```
|
|
753
910
|
|
|
@@ -802,6 +959,11 @@ begin
|
|
|
802
959
|
p result
|
|
803
960
|
rescue OneSignal::ApiError => e
|
|
804
961
|
puts "Error when calling DefaultApi->create_template: #{e}"
|
|
962
|
+
puts "Status Code: #{e.code}"
|
|
963
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
964
|
+
# the raw body remains on `e.response_body`.
|
|
965
|
+
puts "Error Messages: #{e.error_messages}"
|
|
966
|
+
puts "Response Body: #{e.response_body}"
|
|
805
967
|
end
|
|
806
968
|
```
|
|
807
969
|
|
|
@@ -820,6 +982,8 @@ begin
|
|
|
820
982
|
p data # => <TemplateResource>
|
|
821
983
|
rescue OneSignal::ApiError => e
|
|
822
984
|
puts "Error when calling DefaultApi->create_template_with_http_info: #{e}"
|
|
985
|
+
puts "Status Code: #{e.code}"
|
|
986
|
+
puts "Response Body: #{e.response_body}"
|
|
823
987
|
end
|
|
824
988
|
```
|
|
825
989
|
|
|
@@ -863,7 +1027,7 @@ OneSignal.configure do |config|
|
|
|
863
1027
|
end
|
|
864
1028
|
|
|
865
1029
|
api_instance = OneSignal::DefaultApi.new
|
|
866
|
-
app_id = '
|
|
1030
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String |
|
|
867
1031
|
user = OneSignal::User.new # User |
|
|
868
1032
|
|
|
869
1033
|
begin
|
|
@@ -872,6 +1036,11 @@ begin
|
|
|
872
1036
|
p result
|
|
873
1037
|
rescue OneSignal::ApiError => e
|
|
874
1038
|
puts "Error when calling DefaultApi->create_user: #{e}"
|
|
1039
|
+
puts "Status Code: #{e.code}"
|
|
1040
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
1041
|
+
# the raw body remains on `e.response_body`.
|
|
1042
|
+
puts "Error Messages: #{e.error_messages}"
|
|
1043
|
+
puts "Response Body: #{e.response_body}"
|
|
875
1044
|
end
|
|
876
1045
|
```
|
|
877
1046
|
|
|
@@ -890,6 +1059,20 @@ begin
|
|
|
890
1059
|
p data # => <User>
|
|
891
1060
|
rescue OneSignal::ApiError => e
|
|
892
1061
|
puts "Error when calling DefaultApi->create_user_with_http_info: #{e}"
|
|
1062
|
+
puts "Status Code: #{e.code}"
|
|
1063
|
+
puts "Response Body: #{e.response_body}"
|
|
1064
|
+
end
|
|
1065
|
+
```
|
|
1066
|
+
|
|
1067
|
+
### Reading the 409 conflict metadata
|
|
1068
|
+
|
|
1069
|
+
A `409` from this endpoint returns a `CreateUserConflictResponse` envelope. The `e.error_messages` method flattens each error to its `title`/`code` and omits the structured `meta` object (currently `conflicting_aliases`); parse it from the raw body when you need it:
|
|
1070
|
+
|
|
1071
|
+
```ruby
|
|
1072
|
+
if e.code == 409
|
|
1073
|
+
JSON.parse(e.response_body)['errors'].each do |err|
|
|
1074
|
+
puts "#{err['title']} #{err.dig('meta', 'conflicting_aliases')}"
|
|
1075
|
+
end
|
|
893
1076
|
end
|
|
894
1077
|
```
|
|
895
1078
|
|
|
@@ -934,10 +1117,10 @@ OneSignal.configure do |config|
|
|
|
934
1117
|
end
|
|
935
1118
|
|
|
936
1119
|
api_instance = OneSignal::DefaultApi.new
|
|
937
|
-
app_id = '
|
|
938
|
-
alias_label = '
|
|
939
|
-
alias_id = '
|
|
940
|
-
alias_label_to_delete = '
|
|
1120
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String |
|
|
1121
|
+
alias_label = 'external_id' # String |
|
|
1122
|
+
alias_id = 'YOUR_USER_EXTERNAL_ID' # String |
|
|
1123
|
+
alias_label_to_delete = 'external_id' # String |
|
|
941
1124
|
|
|
942
1125
|
begin
|
|
943
1126
|
|
|
@@ -945,6 +1128,11 @@ begin
|
|
|
945
1128
|
p result
|
|
946
1129
|
rescue OneSignal::ApiError => e
|
|
947
1130
|
puts "Error when calling DefaultApi->delete_alias: #{e}"
|
|
1131
|
+
puts "Status Code: #{e.code}"
|
|
1132
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
1133
|
+
# the raw body remains on `e.response_body`.
|
|
1134
|
+
puts "Error Messages: #{e.error_messages}"
|
|
1135
|
+
puts "Response Body: #{e.response_body}"
|
|
948
1136
|
end
|
|
949
1137
|
```
|
|
950
1138
|
|
|
@@ -963,6 +1151,8 @@ begin
|
|
|
963
1151
|
p data # => <UserIdentityBody>
|
|
964
1152
|
rescue OneSignal::ApiError => e
|
|
965
1153
|
puts "Error when calling DefaultApi->delete_alias_with_http_info: #{e}"
|
|
1154
|
+
puts "Status Code: #{e.code}"
|
|
1155
|
+
puts "Response Body: #{e.response_body}"
|
|
966
1156
|
end
|
|
967
1157
|
```
|
|
968
1158
|
|
|
@@ -1009,8 +1199,8 @@ OneSignal.configure do |config|
|
|
|
1009
1199
|
end
|
|
1010
1200
|
|
|
1011
1201
|
api_instance = OneSignal::DefaultApi.new
|
|
1012
|
-
app_id = '
|
|
1013
|
-
token_id = '
|
|
1202
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String |
|
|
1203
|
+
token_id = '0aa1b2c3-d4e5-46f7-8899-aabbccddeeff' # String |
|
|
1014
1204
|
|
|
1015
1205
|
begin
|
|
1016
1206
|
# Delete API key
|
|
@@ -1018,6 +1208,11 @@ begin
|
|
|
1018
1208
|
p result
|
|
1019
1209
|
rescue OneSignal::ApiError => e
|
|
1020
1210
|
puts "Error when calling DefaultApi->delete_api_key: #{e}"
|
|
1211
|
+
puts "Status Code: #{e.code}"
|
|
1212
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
1213
|
+
# the raw body remains on `e.response_body`.
|
|
1214
|
+
puts "Error Messages: #{e.error_messages}"
|
|
1215
|
+
puts "Response Body: #{e.response_body}"
|
|
1021
1216
|
end
|
|
1022
1217
|
```
|
|
1023
1218
|
|
|
@@ -1036,6 +1231,8 @@ begin
|
|
|
1036
1231
|
p data # => Object
|
|
1037
1232
|
rescue OneSignal::ApiError => e
|
|
1038
1233
|
puts "Error when calling DefaultApi->delete_api_key_with_http_info: #{e}"
|
|
1234
|
+
puts "Status Code: #{e.code}"
|
|
1235
|
+
puts "Response Body: #{e.response_body}"
|
|
1039
1236
|
end
|
|
1040
1237
|
```
|
|
1041
1238
|
|
|
@@ -1080,8 +1277,8 @@ OneSignal.configure do |config|
|
|
|
1080
1277
|
end
|
|
1081
1278
|
|
|
1082
1279
|
api_instance = OneSignal::DefaultApi.new
|
|
1083
|
-
app_id = '
|
|
1084
|
-
segment_id = '
|
|
1280
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String | The OneSignal App ID for your app. Available in Keys & IDs.
|
|
1281
|
+
segment_id = 'd6c5a3e1-9f17-44a1-9d10-7c0e4a2b1c8e' # String | The segment_id can be found in the URL of the segment when viewing it in the dashboard.
|
|
1085
1282
|
|
|
1086
1283
|
begin
|
|
1087
1284
|
# Delete Segment
|
|
@@ -1089,6 +1286,11 @@ begin
|
|
|
1089
1286
|
p result
|
|
1090
1287
|
rescue OneSignal::ApiError => e
|
|
1091
1288
|
puts "Error when calling DefaultApi->delete_segment: #{e}"
|
|
1289
|
+
puts "Status Code: #{e.code}"
|
|
1290
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
1291
|
+
# the raw body remains on `e.response_body`.
|
|
1292
|
+
puts "Error Messages: #{e.error_messages}"
|
|
1293
|
+
puts "Response Body: #{e.response_body}"
|
|
1092
1294
|
end
|
|
1093
1295
|
```
|
|
1094
1296
|
|
|
@@ -1107,6 +1309,8 @@ begin
|
|
|
1107
1309
|
p data # => <GenericSuccessBoolResponse>
|
|
1108
1310
|
rescue OneSignal::ApiError => e
|
|
1109
1311
|
puts "Error when calling DefaultApi->delete_segment_with_http_info: #{e}"
|
|
1312
|
+
puts "Status Code: #{e.code}"
|
|
1313
|
+
puts "Response Body: #{e.response_body}"
|
|
1110
1314
|
end
|
|
1111
1315
|
```
|
|
1112
1316
|
|
|
@@ -1151,14 +1355,19 @@ OneSignal.configure do |config|
|
|
|
1151
1355
|
end
|
|
1152
1356
|
|
|
1153
1357
|
api_instance = OneSignal::DefaultApi.new
|
|
1154
|
-
app_id = '
|
|
1155
|
-
subscription_id = '
|
|
1358
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String |
|
|
1359
|
+
subscription_id = '7e4c5b9a-1f60-4d07-9b1a-2e8c8d2cae51' # String |
|
|
1156
1360
|
|
|
1157
1361
|
begin
|
|
1158
1362
|
|
|
1159
1363
|
api_instance.delete_subscription(app_id, subscription_id)
|
|
1160
1364
|
rescue OneSignal::ApiError => e
|
|
1161
1365
|
puts "Error when calling DefaultApi->delete_subscription: #{e}"
|
|
1366
|
+
puts "Status Code: #{e.code}"
|
|
1367
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
1368
|
+
# the raw body remains on `e.response_body`.
|
|
1369
|
+
puts "Error Messages: #{e.error_messages}"
|
|
1370
|
+
puts "Response Body: #{e.response_body}"
|
|
1162
1371
|
end
|
|
1163
1372
|
```
|
|
1164
1373
|
|
|
@@ -1177,6 +1386,8 @@ begin
|
|
|
1177
1386
|
p data # => nil
|
|
1178
1387
|
rescue OneSignal::ApiError => e
|
|
1179
1388
|
puts "Error when calling DefaultApi->delete_subscription_with_http_info: #{e}"
|
|
1389
|
+
puts "Status Code: #{e.code}"
|
|
1390
|
+
puts "Response Body: #{e.response_body}"
|
|
1180
1391
|
end
|
|
1181
1392
|
```
|
|
1182
1393
|
|
|
@@ -1221,8 +1432,8 @@ OneSignal.configure do |config|
|
|
|
1221
1432
|
end
|
|
1222
1433
|
|
|
1223
1434
|
api_instance = OneSignal::DefaultApi.new
|
|
1224
|
-
template_id = '
|
|
1225
|
-
app_id = '
|
|
1435
|
+
template_id = 'e4d3c2b1-a09f-4f1e-8d7c-6b5a4f3e2d1c' # String |
|
|
1436
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String |
|
|
1226
1437
|
|
|
1227
1438
|
begin
|
|
1228
1439
|
# Delete template
|
|
@@ -1230,6 +1441,11 @@ begin
|
|
|
1230
1441
|
p result
|
|
1231
1442
|
rescue OneSignal::ApiError => e
|
|
1232
1443
|
puts "Error when calling DefaultApi->delete_template: #{e}"
|
|
1444
|
+
puts "Status Code: #{e.code}"
|
|
1445
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
1446
|
+
# the raw body remains on `e.response_body`.
|
|
1447
|
+
puts "Error Messages: #{e.error_messages}"
|
|
1448
|
+
puts "Response Body: #{e.response_body}"
|
|
1233
1449
|
end
|
|
1234
1450
|
```
|
|
1235
1451
|
|
|
@@ -1248,6 +1464,8 @@ begin
|
|
|
1248
1464
|
p data # => <GenericSuccessBoolResponse>
|
|
1249
1465
|
rescue OneSignal::ApiError => e
|
|
1250
1466
|
puts "Error when calling DefaultApi->delete_template_with_http_info: #{e}"
|
|
1467
|
+
puts "Status Code: #{e.code}"
|
|
1468
|
+
puts "Response Body: #{e.response_body}"
|
|
1251
1469
|
end
|
|
1252
1470
|
```
|
|
1253
1471
|
|
|
@@ -1292,15 +1510,20 @@ OneSignal.configure do |config|
|
|
|
1292
1510
|
end
|
|
1293
1511
|
|
|
1294
1512
|
api_instance = OneSignal::DefaultApi.new
|
|
1295
|
-
app_id = '
|
|
1296
|
-
alias_label = '
|
|
1297
|
-
alias_id = '
|
|
1513
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String |
|
|
1514
|
+
alias_label = 'external_id' # String |
|
|
1515
|
+
alias_id = 'YOUR_USER_EXTERNAL_ID' # String |
|
|
1298
1516
|
|
|
1299
1517
|
begin
|
|
1300
1518
|
|
|
1301
1519
|
api_instance.delete_user(app_id, alias_label, alias_id)
|
|
1302
1520
|
rescue OneSignal::ApiError => e
|
|
1303
1521
|
puts "Error when calling DefaultApi->delete_user: #{e}"
|
|
1522
|
+
puts "Status Code: #{e.code}"
|
|
1523
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
1524
|
+
# the raw body remains on `e.response_body`.
|
|
1525
|
+
puts "Error Messages: #{e.error_messages}"
|
|
1526
|
+
puts "Response Body: #{e.response_body}"
|
|
1304
1527
|
end
|
|
1305
1528
|
```
|
|
1306
1529
|
|
|
@@ -1319,6 +1542,8 @@ begin
|
|
|
1319
1542
|
p data # => nil
|
|
1320
1543
|
rescue OneSignal::ApiError => e
|
|
1321
1544
|
puts "Error when calling DefaultApi->delete_user_with_http_info: #{e}"
|
|
1545
|
+
puts "Status Code: #{e.code}"
|
|
1546
|
+
puts "Response Body: #{e.response_body}"
|
|
1322
1547
|
end
|
|
1323
1548
|
```
|
|
1324
1549
|
|
|
@@ -1364,8 +1589,8 @@ OneSignal.configure do |config|
|
|
|
1364
1589
|
end
|
|
1365
1590
|
|
|
1366
1591
|
api_instance = OneSignal::DefaultApi.new
|
|
1367
|
-
notification_id = '
|
|
1368
|
-
app_id = '
|
|
1592
|
+
notification_id = 'b3a0c8bd-3a4c-4b22-9a73-3f1a8c2d1b88' # String | The ID of the notification to export events from.
|
|
1593
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String | The ID of the app that the notification belongs to.
|
|
1369
1594
|
|
|
1370
1595
|
begin
|
|
1371
1596
|
# Export CSV of Events
|
|
@@ -1373,6 +1598,11 @@ begin
|
|
|
1373
1598
|
p result
|
|
1374
1599
|
rescue OneSignal::ApiError => e
|
|
1375
1600
|
puts "Error when calling DefaultApi->export_events: #{e}"
|
|
1601
|
+
puts "Status Code: #{e.code}"
|
|
1602
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
1603
|
+
# the raw body remains on `e.response_body`.
|
|
1604
|
+
puts "Error Messages: #{e.error_messages}"
|
|
1605
|
+
puts "Response Body: #{e.response_body}"
|
|
1376
1606
|
end
|
|
1377
1607
|
```
|
|
1378
1608
|
|
|
@@ -1391,6 +1621,8 @@ begin
|
|
|
1391
1621
|
p data # => <ExportEventsSuccessResponse>
|
|
1392
1622
|
rescue OneSignal::ApiError => e
|
|
1393
1623
|
puts "Error when calling DefaultApi->export_events_with_http_info: #{e}"
|
|
1624
|
+
puts "Status Code: #{e.code}"
|
|
1625
|
+
puts "Response Body: #{e.response_body}"
|
|
1394
1626
|
end
|
|
1395
1627
|
```
|
|
1396
1628
|
|
|
@@ -1435,7 +1667,7 @@ OneSignal.configure do |config|
|
|
|
1435
1667
|
end
|
|
1436
1668
|
|
|
1437
1669
|
api_instance = OneSignal::DefaultApi.new
|
|
1438
|
-
app_id = '
|
|
1670
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String | The app ID that you want to export devices from
|
|
1439
1671
|
opts = {
|
|
1440
1672
|
export_subscriptions_request_body: OneSignal::ExportSubscriptionsRequestBody.new # ExportSubscriptionsRequestBody |
|
|
1441
1673
|
}
|
|
@@ -1446,6 +1678,11 @@ begin
|
|
|
1446
1678
|
p result
|
|
1447
1679
|
rescue OneSignal::ApiError => e
|
|
1448
1680
|
puts "Error when calling DefaultApi->export_subscriptions: #{e}"
|
|
1681
|
+
puts "Status Code: #{e.code}"
|
|
1682
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
1683
|
+
# the raw body remains on `e.response_body`.
|
|
1684
|
+
puts "Error Messages: #{e.error_messages}"
|
|
1685
|
+
puts "Response Body: #{e.response_body}"
|
|
1449
1686
|
end
|
|
1450
1687
|
```
|
|
1451
1688
|
|
|
@@ -1464,6 +1701,8 @@ begin
|
|
|
1464
1701
|
p data # => <ExportSubscriptionsSuccessResponse>
|
|
1465
1702
|
rescue OneSignal::ApiError => e
|
|
1466
1703
|
puts "Error when calling DefaultApi->export_subscriptions_with_http_info: #{e}"
|
|
1704
|
+
puts "Status Code: #{e.code}"
|
|
1705
|
+
puts "Response Body: #{e.response_body}"
|
|
1467
1706
|
end
|
|
1468
1707
|
```
|
|
1469
1708
|
|
|
@@ -1508,9 +1747,9 @@ OneSignal.configure do |config|
|
|
|
1508
1747
|
end
|
|
1509
1748
|
|
|
1510
1749
|
api_instance = OneSignal::DefaultApi.new
|
|
1511
|
-
app_id = '
|
|
1512
|
-
alias_label = '
|
|
1513
|
-
alias_id = '
|
|
1750
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String |
|
|
1751
|
+
alias_label = 'external_id' # String |
|
|
1752
|
+
alias_id = 'YOUR_USER_EXTERNAL_ID' # String |
|
|
1514
1753
|
|
|
1515
1754
|
begin
|
|
1516
1755
|
|
|
@@ -1518,6 +1757,11 @@ begin
|
|
|
1518
1757
|
p result
|
|
1519
1758
|
rescue OneSignal::ApiError => e
|
|
1520
1759
|
puts "Error when calling DefaultApi->get_aliases: #{e}"
|
|
1760
|
+
puts "Status Code: #{e.code}"
|
|
1761
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
1762
|
+
# the raw body remains on `e.response_body`.
|
|
1763
|
+
puts "Error Messages: #{e.error_messages}"
|
|
1764
|
+
puts "Response Body: #{e.response_body}"
|
|
1521
1765
|
end
|
|
1522
1766
|
```
|
|
1523
1767
|
|
|
@@ -1536,6 +1780,8 @@ begin
|
|
|
1536
1780
|
p data # => <UserIdentityBody>
|
|
1537
1781
|
rescue OneSignal::ApiError => e
|
|
1538
1782
|
puts "Error when calling DefaultApi->get_aliases_with_http_info: #{e}"
|
|
1783
|
+
puts "Status Code: #{e.code}"
|
|
1784
|
+
puts "Response Body: #{e.response_body}"
|
|
1539
1785
|
end
|
|
1540
1786
|
```
|
|
1541
1787
|
|
|
@@ -1581,8 +1827,8 @@ OneSignal.configure do |config|
|
|
|
1581
1827
|
end
|
|
1582
1828
|
|
|
1583
1829
|
api_instance = OneSignal::DefaultApi.new
|
|
1584
|
-
app_id = '
|
|
1585
|
-
subscription_id = '
|
|
1830
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String |
|
|
1831
|
+
subscription_id = '7e4c5b9a-1f60-4d07-9b1a-2e8c8d2cae51' # String |
|
|
1586
1832
|
|
|
1587
1833
|
begin
|
|
1588
1834
|
|
|
@@ -1590,6 +1836,11 @@ begin
|
|
|
1590
1836
|
p result
|
|
1591
1837
|
rescue OneSignal::ApiError => e
|
|
1592
1838
|
puts "Error when calling DefaultApi->get_aliases_by_subscription: #{e}"
|
|
1839
|
+
puts "Status Code: #{e.code}"
|
|
1840
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
1841
|
+
# the raw body remains on `e.response_body`.
|
|
1842
|
+
puts "Error Messages: #{e.error_messages}"
|
|
1843
|
+
puts "Response Body: #{e.response_body}"
|
|
1593
1844
|
end
|
|
1594
1845
|
```
|
|
1595
1846
|
|
|
@@ -1608,6 +1859,8 @@ begin
|
|
|
1608
1859
|
p data # => <UserIdentityBody>
|
|
1609
1860
|
rescue OneSignal::ApiError => e
|
|
1610
1861
|
puts "Error when calling DefaultApi->get_aliases_by_subscription_with_http_info: #{e}"
|
|
1862
|
+
puts "Status Code: #{e.code}"
|
|
1863
|
+
puts "Response Body: #{e.response_body}"
|
|
1611
1864
|
end
|
|
1612
1865
|
```
|
|
1613
1866
|
|
|
@@ -1652,7 +1905,7 @@ OneSignal.configure do |config|
|
|
|
1652
1905
|
end
|
|
1653
1906
|
|
|
1654
1907
|
api_instance = OneSignal::DefaultApi.new
|
|
1655
|
-
app_id = '
|
|
1908
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String | An app id
|
|
1656
1909
|
|
|
1657
1910
|
begin
|
|
1658
1911
|
# View an app
|
|
@@ -1660,6 +1913,11 @@ begin
|
|
|
1660
1913
|
p result
|
|
1661
1914
|
rescue OneSignal::ApiError => e
|
|
1662
1915
|
puts "Error when calling DefaultApi->get_app: #{e}"
|
|
1916
|
+
puts "Status Code: #{e.code}"
|
|
1917
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
1918
|
+
# the raw body remains on `e.response_body`.
|
|
1919
|
+
puts "Error Messages: #{e.error_messages}"
|
|
1920
|
+
puts "Response Body: #{e.response_body}"
|
|
1663
1921
|
end
|
|
1664
1922
|
```
|
|
1665
1923
|
|
|
@@ -1678,6 +1936,8 @@ begin
|
|
|
1678
1936
|
p data # => <App>
|
|
1679
1937
|
rescue OneSignal::ApiError => e
|
|
1680
1938
|
puts "Error when calling DefaultApi->get_app_with_http_info: #{e}"
|
|
1939
|
+
puts "Status Code: #{e.code}"
|
|
1940
|
+
puts "Response Body: #{e.response_body}"
|
|
1681
1941
|
end
|
|
1682
1942
|
```
|
|
1683
1943
|
|
|
@@ -1728,6 +1988,11 @@ begin
|
|
|
1728
1988
|
p result
|
|
1729
1989
|
rescue OneSignal::ApiError => e
|
|
1730
1990
|
puts "Error when calling DefaultApi->get_apps: #{e}"
|
|
1991
|
+
puts "Status Code: #{e.code}"
|
|
1992
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
1993
|
+
# the raw body remains on `e.response_body`.
|
|
1994
|
+
puts "Error Messages: #{e.error_messages}"
|
|
1995
|
+
puts "Response Body: #{e.response_body}"
|
|
1731
1996
|
end
|
|
1732
1997
|
```
|
|
1733
1998
|
|
|
@@ -1746,6 +2011,8 @@ begin
|
|
|
1746
2011
|
p data # => <Array<App>>
|
|
1747
2012
|
rescue OneSignal::ApiError => e
|
|
1748
2013
|
puts "Error when calling DefaultApi->get_apps_with_http_info: #{e}"
|
|
2014
|
+
puts "Status Code: #{e.code}"
|
|
2015
|
+
puts "Response Body: #{e.response_body}"
|
|
1749
2016
|
end
|
|
1750
2017
|
```
|
|
1751
2018
|
|
|
@@ -1787,8 +2054,8 @@ OneSignal.configure do |config|
|
|
|
1787
2054
|
end
|
|
1788
2055
|
|
|
1789
2056
|
api_instance = OneSignal::DefaultApi.new
|
|
1790
|
-
app_id = '
|
|
1791
|
-
notification_id = '
|
|
2057
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String |
|
|
2058
|
+
notification_id = 'b3a0c8bd-3a4c-4b22-9a73-3f1a8c2d1b88' # String |
|
|
1792
2059
|
|
|
1793
2060
|
begin
|
|
1794
2061
|
# View notification
|
|
@@ -1796,6 +2063,11 @@ begin
|
|
|
1796
2063
|
p result
|
|
1797
2064
|
rescue OneSignal::ApiError => e
|
|
1798
2065
|
puts "Error when calling DefaultApi->get_notification: #{e}"
|
|
2066
|
+
puts "Status Code: #{e.code}"
|
|
2067
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
2068
|
+
# the raw body remains on `e.response_body`.
|
|
2069
|
+
puts "Error Messages: #{e.error_messages}"
|
|
2070
|
+
puts "Response Body: #{e.response_body}"
|
|
1799
2071
|
end
|
|
1800
2072
|
```
|
|
1801
2073
|
|
|
@@ -1814,6 +2086,8 @@ begin
|
|
|
1814
2086
|
p data # => <NotificationWithMeta>
|
|
1815
2087
|
rescue OneSignal::ApiError => e
|
|
1816
2088
|
puts "Error when calling DefaultApi->get_notification_with_http_info: #{e}"
|
|
2089
|
+
puts "Status Code: #{e.code}"
|
|
2090
|
+
puts "Response Body: #{e.response_body}"
|
|
1817
2091
|
end
|
|
1818
2092
|
```
|
|
1819
2093
|
|
|
@@ -1858,7 +2132,7 @@ OneSignal.configure do |config|
|
|
|
1858
2132
|
end
|
|
1859
2133
|
|
|
1860
2134
|
api_instance = OneSignal::DefaultApi.new
|
|
1861
|
-
notification_id = '
|
|
2135
|
+
notification_id = 'b3a0c8bd-3a4c-4b22-9a73-3f1a8c2d1b88' # String | The \"id\" of the message found in the Notification object
|
|
1862
2136
|
get_notification_history_request_body = OneSignal::GetNotificationHistoryRequestBody.new # GetNotificationHistoryRequestBody |
|
|
1863
2137
|
|
|
1864
2138
|
begin
|
|
@@ -1867,6 +2141,11 @@ begin
|
|
|
1867
2141
|
p result
|
|
1868
2142
|
rescue OneSignal::ApiError => e
|
|
1869
2143
|
puts "Error when calling DefaultApi->get_notification_history: #{e}"
|
|
2144
|
+
puts "Status Code: #{e.code}"
|
|
2145
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
2146
|
+
# the raw body remains on `e.response_body`.
|
|
2147
|
+
puts "Error Messages: #{e.error_messages}"
|
|
2148
|
+
puts "Response Body: #{e.response_body}"
|
|
1870
2149
|
end
|
|
1871
2150
|
```
|
|
1872
2151
|
|
|
@@ -1885,6 +2164,8 @@ begin
|
|
|
1885
2164
|
p data # => <NotificationHistorySuccessResponse>
|
|
1886
2165
|
rescue OneSignal::ApiError => e
|
|
1887
2166
|
puts "Error when calling DefaultApi->get_notification_history_with_http_info: #{e}"
|
|
2167
|
+
puts "Status Code: #{e.code}"
|
|
2168
|
+
puts "Response Body: #{e.response_body}"
|
|
1888
2169
|
end
|
|
1889
2170
|
```
|
|
1890
2171
|
|
|
@@ -1929,11 +2210,12 @@ OneSignal.configure do |config|
|
|
|
1929
2210
|
end
|
|
1930
2211
|
|
|
1931
2212
|
api_instance = OneSignal::DefaultApi.new
|
|
1932
|
-
app_id = '
|
|
2213
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String | The app ID that you want to view notifications from
|
|
1933
2214
|
opts = {
|
|
1934
|
-
limit:
|
|
1935
|
-
offset:
|
|
1936
|
-
kind: 0 # Integer | Kind of notifications returned: * unset - All notification types (default) * `0` - Dashboard only * `1` - API only * `3` - Automated only
|
|
2215
|
+
limit: 10, # Integer | How many notifications to return. Max is 50. Default is 50.
|
|
2216
|
+
offset: 0, # 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.
|
|
2217
|
+
kind: 0, # Integer | Kind of notifications returned: * unset - All notification types (default) * `0` - Dashboard only * `1` - API only * `3` - Automated only
|
|
2218
|
+
time_offset: '2025-01-01T00:00:00.000Z' # String | Time-offset pagination cursor for sequential pulls of all messages. Accepts either an ISO 8601 formatted timestamp (e.g. `2025-01-01T00:00:00.000Z`) or the opaque Base64 cursor token returned as `next_time_offset` in a prior response. When set, results are sorted ascending by send_after and the standard `offset` parameter cannot be used. Repeat the request with each `next_time_offset` until an empty notifications array is returned.
|
|
1937
2219
|
}
|
|
1938
2220
|
|
|
1939
2221
|
begin
|
|
@@ -1942,6 +2224,11 @@ begin
|
|
|
1942
2224
|
p result
|
|
1943
2225
|
rescue OneSignal::ApiError => e
|
|
1944
2226
|
puts "Error when calling DefaultApi->get_notifications: #{e}"
|
|
2227
|
+
puts "Status Code: #{e.code}"
|
|
2228
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
2229
|
+
# the raw body remains on `e.response_body`.
|
|
2230
|
+
puts "Error Messages: #{e.error_messages}"
|
|
2231
|
+
puts "Response Body: #{e.response_body}"
|
|
1945
2232
|
end
|
|
1946
2233
|
```
|
|
1947
2234
|
|
|
@@ -1960,6 +2247,8 @@ begin
|
|
|
1960
2247
|
p data # => <NotificationSlice>
|
|
1961
2248
|
rescue OneSignal::ApiError => e
|
|
1962
2249
|
puts "Error when calling DefaultApi->get_notifications_with_http_info: #{e}"
|
|
2250
|
+
puts "Status Code: #{e.code}"
|
|
2251
|
+
puts "Response Body: #{e.response_body}"
|
|
1963
2252
|
end
|
|
1964
2253
|
```
|
|
1965
2254
|
|
|
@@ -1971,6 +2260,7 @@ end
|
|
|
1971
2260
|
| **limit** | **Integer** | How many notifications to return. Max is 50. Default is 50. | [optional] |
|
|
1972
2261
|
| **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] |
|
|
1973
2262
|
| **kind** | **Integer** | Kind of notifications returned: * unset - All notification types (default) * `0` - Dashboard only * `1` - API only * `3` - Automated only | [optional] |
|
|
2263
|
+
| **time_offset** | **String** | Time-offset pagination cursor for sequential pulls of all messages. Accepts either an ISO 8601 formatted timestamp (e.g. `2025-01-01T00:00:00.000Z`) or the opaque Base64 cursor token returned as `next_time_offset` in a prior response. When set, results are sorted ascending by send_after and the standard `offset` parameter cannot be used. Repeat the request with each `next_time_offset` until an empty notifications array is returned. | [optional] |
|
|
1974
2264
|
|
|
1975
2265
|
### Return type
|
|
1976
2266
|
|
|
@@ -2006,13 +2296,13 @@ OneSignal.configure do |config|
|
|
|
2006
2296
|
end
|
|
2007
2297
|
|
|
2008
2298
|
api_instance = OneSignal::DefaultApi.new
|
|
2009
|
-
app_id = '
|
|
2010
|
-
outcome_names = '
|
|
2299
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String | The OneSignal App ID for your app. Available in Keys & IDs.
|
|
2300
|
+
outcome_names = 'os__session_duration.count,os__click.count' # 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
|
|
2011
2301
|
opts = {
|
|
2012
|
-
outcome_names2: '
|
|
2013
|
-
outcome_time_range: '
|
|
2014
|
-
outcome_platforms: '
|
|
2015
|
-
outcome_attribution: '
|
|
2302
|
+
outcome_names2: 'os__session_duration.count', # 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.
|
|
2303
|
+
outcome_time_range: '1d', # 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.
|
|
2304
|
+
outcome_platforms: '0,1', # 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.
|
|
2305
|
+
outcome_attribution: 'direct' # 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.
|
|
2016
2306
|
}
|
|
2017
2307
|
|
|
2018
2308
|
begin
|
|
@@ -2021,6 +2311,11 @@ begin
|
|
|
2021
2311
|
p result
|
|
2022
2312
|
rescue OneSignal::ApiError => e
|
|
2023
2313
|
puts "Error when calling DefaultApi->get_outcomes: #{e}"
|
|
2314
|
+
puts "Status Code: #{e.code}"
|
|
2315
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
2316
|
+
# the raw body remains on `e.response_body`.
|
|
2317
|
+
puts "Error Messages: #{e.error_messages}"
|
|
2318
|
+
puts "Response Body: #{e.response_body}"
|
|
2024
2319
|
end
|
|
2025
2320
|
```
|
|
2026
2321
|
|
|
@@ -2039,6 +2334,8 @@ begin
|
|
|
2039
2334
|
p data # => <OutcomesData>
|
|
2040
2335
|
rescue OneSignal::ApiError => e
|
|
2041
2336
|
puts "Error when calling DefaultApi->get_outcomes_with_http_info: #{e}"
|
|
2337
|
+
puts "Status Code: #{e.code}"
|
|
2338
|
+
puts "Response Body: #{e.response_body}"
|
|
2042
2339
|
end
|
|
2043
2340
|
```
|
|
2044
2341
|
|
|
@@ -2087,10 +2384,10 @@ OneSignal.configure do |config|
|
|
|
2087
2384
|
end
|
|
2088
2385
|
|
|
2089
2386
|
api_instance = OneSignal::DefaultApi.new
|
|
2090
|
-
app_id = '
|
|
2387
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String | The OneSignal App ID for your app. Available in Keys & IDs.
|
|
2091
2388
|
opts = {
|
|
2092
|
-
offset:
|
|
2093
|
-
limit:
|
|
2389
|
+
offset: 0, # Integer | Segments are listed in ascending order of created_at date. offset will omit that number of segments from the beginning of the list. Eg offset 5, will remove the 5 earliest created Segments.
|
|
2390
|
+
limit: 10 # Integer | The amount of Segments in the response. Maximum 300.
|
|
2094
2391
|
}
|
|
2095
2392
|
|
|
2096
2393
|
begin
|
|
@@ -2099,6 +2396,11 @@ begin
|
|
|
2099
2396
|
p result
|
|
2100
2397
|
rescue OneSignal::ApiError => e
|
|
2101
2398
|
puts "Error when calling DefaultApi->get_segments: #{e}"
|
|
2399
|
+
puts "Status Code: #{e.code}"
|
|
2400
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
2401
|
+
# the raw body remains on `e.response_body`.
|
|
2402
|
+
puts "Error Messages: #{e.error_messages}"
|
|
2403
|
+
puts "Response Body: #{e.response_body}"
|
|
2102
2404
|
end
|
|
2103
2405
|
```
|
|
2104
2406
|
|
|
@@ -2117,6 +2419,8 @@ begin
|
|
|
2117
2419
|
p data # => <GetSegmentsSuccessResponse>
|
|
2118
2420
|
rescue OneSignal::ApiError => e
|
|
2119
2421
|
puts "Error when calling DefaultApi->get_segments_with_http_info: #{e}"
|
|
2422
|
+
puts "Status Code: #{e.code}"
|
|
2423
|
+
puts "Response Body: #{e.response_body}"
|
|
2120
2424
|
end
|
|
2121
2425
|
```
|
|
2122
2426
|
|
|
@@ -2162,9 +2466,9 @@ OneSignal.configure do |config|
|
|
|
2162
2466
|
end
|
|
2163
2467
|
|
|
2164
2468
|
api_instance = OneSignal::DefaultApi.new
|
|
2165
|
-
app_id = '
|
|
2166
|
-
alias_label = '
|
|
2167
|
-
alias_id = '
|
|
2469
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String |
|
|
2470
|
+
alias_label = 'external_id' # String |
|
|
2471
|
+
alias_id = 'YOUR_USER_EXTERNAL_ID' # String |
|
|
2168
2472
|
|
|
2169
2473
|
begin
|
|
2170
2474
|
|
|
@@ -2172,6 +2476,11 @@ begin
|
|
|
2172
2476
|
p result
|
|
2173
2477
|
rescue OneSignal::ApiError => e
|
|
2174
2478
|
puts "Error when calling DefaultApi->get_user: #{e}"
|
|
2479
|
+
puts "Status Code: #{e.code}"
|
|
2480
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
2481
|
+
# the raw body remains on `e.response_body`.
|
|
2482
|
+
puts "Error Messages: #{e.error_messages}"
|
|
2483
|
+
puts "Response Body: #{e.response_body}"
|
|
2175
2484
|
end
|
|
2176
2485
|
```
|
|
2177
2486
|
|
|
@@ -2190,6 +2499,8 @@ begin
|
|
|
2190
2499
|
p data # => <User>
|
|
2191
2500
|
rescue OneSignal::ApiError => e
|
|
2192
2501
|
puts "Error when calling DefaultApi->get_user_with_http_info: #{e}"
|
|
2502
|
+
puts "Status Code: #{e.code}"
|
|
2503
|
+
puts "Response Body: #{e.response_body}"
|
|
2193
2504
|
end
|
|
2194
2505
|
```
|
|
2195
2506
|
|
|
@@ -2235,8 +2546,8 @@ OneSignal.configure do |config|
|
|
|
2235
2546
|
end
|
|
2236
2547
|
|
|
2237
2548
|
api_instance = OneSignal::DefaultApi.new
|
|
2238
|
-
app_id = '
|
|
2239
|
-
token_id = '
|
|
2549
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String |
|
|
2550
|
+
token_id = '0aa1b2c3-d4e5-46f7-8899-aabbccddeeff' # String |
|
|
2240
2551
|
|
|
2241
2552
|
begin
|
|
2242
2553
|
# Rotate API key
|
|
@@ -2244,6 +2555,11 @@ begin
|
|
|
2244
2555
|
p result
|
|
2245
2556
|
rescue OneSignal::ApiError => e
|
|
2246
2557
|
puts "Error when calling DefaultApi->rotate_api_key: #{e}"
|
|
2558
|
+
puts "Status Code: #{e.code}"
|
|
2559
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
2560
|
+
# the raw body remains on `e.response_body`.
|
|
2561
|
+
puts "Error Messages: #{e.error_messages}"
|
|
2562
|
+
puts "Response Body: #{e.response_body}"
|
|
2247
2563
|
end
|
|
2248
2564
|
```
|
|
2249
2565
|
|
|
@@ -2262,6 +2578,8 @@ begin
|
|
|
2262
2578
|
p data # => <CreateApiKeyResponse>
|
|
2263
2579
|
rescue OneSignal::ApiError => e
|
|
2264
2580
|
puts "Error when calling DefaultApi->rotate_api_key_with_http_info: #{e}"
|
|
2581
|
+
puts "Status Code: #{e.code}"
|
|
2582
|
+
puts "Response Body: #{e.response_body}"
|
|
2265
2583
|
end
|
|
2266
2584
|
```
|
|
2267
2585
|
|
|
@@ -2306,8 +2624,8 @@ OneSignal.configure do |config|
|
|
|
2306
2624
|
end
|
|
2307
2625
|
|
|
2308
2626
|
api_instance = OneSignal::DefaultApi.new
|
|
2309
|
-
app_id = '
|
|
2310
|
-
activity_type = '
|
|
2627
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String | Your OneSignal App ID in UUID v4 format.
|
|
2628
|
+
activity_type = 'order_status' # String | The name of the Live Activity defined in your app. This should match the attributes struct used in your app's Live Activity implementation.
|
|
2311
2629
|
start_live_activity_request = OneSignal::StartLiveActivityRequest.new({name: 'name_example', event: 'start', activity_id: 'activity_id_example', event_attributes: 3.56, event_updates: 3.56, contents: OneSignal::LanguageStringMap.new, headings: OneSignal::LanguageStringMap.new}) # StartLiveActivityRequest |
|
|
2312
2630
|
|
|
2313
2631
|
begin
|
|
@@ -2316,6 +2634,11 @@ begin
|
|
|
2316
2634
|
p result
|
|
2317
2635
|
rescue OneSignal::ApiError => e
|
|
2318
2636
|
puts "Error when calling DefaultApi->start_live_activity: #{e}"
|
|
2637
|
+
puts "Status Code: #{e.code}"
|
|
2638
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
2639
|
+
# the raw body remains on `e.response_body`.
|
|
2640
|
+
puts "Error Messages: #{e.error_messages}"
|
|
2641
|
+
puts "Response Body: #{e.response_body}"
|
|
2319
2642
|
end
|
|
2320
2643
|
```
|
|
2321
2644
|
|
|
@@ -2334,6 +2657,8 @@ begin
|
|
|
2334
2657
|
p data # => <StartLiveActivitySuccessResponse>
|
|
2335
2658
|
rescue OneSignal::ApiError => e
|
|
2336
2659
|
puts "Error when calling DefaultApi->start_live_activity_with_http_info: #{e}"
|
|
2660
|
+
puts "Status Code: #{e.code}"
|
|
2661
|
+
puts "Response Body: #{e.response_body}"
|
|
2337
2662
|
end
|
|
2338
2663
|
```
|
|
2339
2664
|
|
|
@@ -2379,8 +2704,8 @@ OneSignal.configure do |config|
|
|
|
2379
2704
|
end
|
|
2380
2705
|
|
|
2381
2706
|
api_instance = OneSignal::DefaultApi.new
|
|
2382
|
-
app_id = '
|
|
2383
|
-
subscription_id = '
|
|
2707
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String |
|
|
2708
|
+
subscription_id = '7e4c5b9a-1f60-4d07-9b1a-2e8c8d2cae51' # String |
|
|
2384
2709
|
transfer_subscription_request_body = OneSignal::TransferSubscriptionRequestBody.new # TransferSubscriptionRequestBody |
|
|
2385
2710
|
|
|
2386
2711
|
begin
|
|
@@ -2389,6 +2714,11 @@ begin
|
|
|
2389
2714
|
p result
|
|
2390
2715
|
rescue OneSignal::ApiError => e
|
|
2391
2716
|
puts "Error when calling DefaultApi->transfer_subscription: #{e}"
|
|
2717
|
+
puts "Status Code: #{e.code}"
|
|
2718
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
2719
|
+
# the raw body remains on `e.response_body`.
|
|
2720
|
+
puts "Error Messages: #{e.error_messages}"
|
|
2721
|
+
puts "Response Body: #{e.response_body}"
|
|
2392
2722
|
end
|
|
2393
2723
|
```
|
|
2394
2724
|
|
|
@@ -2407,6 +2737,8 @@ begin
|
|
|
2407
2737
|
p data # => <UserIdentityBody>
|
|
2408
2738
|
rescue OneSignal::ApiError => e
|
|
2409
2739
|
puts "Error when calling DefaultApi->transfer_subscription_with_http_info: #{e}"
|
|
2740
|
+
puts "Status Code: #{e.code}"
|
|
2741
|
+
puts "Response Body: #{e.response_body}"
|
|
2410
2742
|
end
|
|
2411
2743
|
```
|
|
2412
2744
|
|
|
@@ -2452,9 +2784,9 @@ OneSignal.configure do |config|
|
|
|
2452
2784
|
end
|
|
2453
2785
|
|
|
2454
2786
|
api_instance = OneSignal::DefaultApi.new
|
|
2455
|
-
app_id = '
|
|
2456
|
-
notification_id = '
|
|
2457
|
-
token = '
|
|
2787
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String | The OneSignal App ID for your app. Available in Keys & IDs.
|
|
2788
|
+
notification_id = 'b3a0c8bd-3a4c-4b22-9a73-3f1a8c2d1b88' # String | The id of the message found in the creation notification POST response, View Notifications GET response, or URL within the Message Report.
|
|
2789
|
+
token = 'YOUR_TOKEN_ID' # String | The unsubscribe token that is generated via liquid syntax in {{subscription.unsubscribe_token}} when personalizing an email.
|
|
2458
2790
|
|
|
2459
2791
|
begin
|
|
2460
2792
|
# Unsubscribe with token
|
|
@@ -2462,6 +2794,11 @@ begin
|
|
|
2462
2794
|
p result
|
|
2463
2795
|
rescue OneSignal::ApiError => e
|
|
2464
2796
|
puts "Error when calling DefaultApi->unsubscribe_email_with_token: #{e}"
|
|
2797
|
+
puts "Status Code: #{e.code}"
|
|
2798
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
2799
|
+
# the raw body remains on `e.response_body`.
|
|
2800
|
+
puts "Error Messages: #{e.error_messages}"
|
|
2801
|
+
puts "Response Body: #{e.response_body}"
|
|
2465
2802
|
end
|
|
2466
2803
|
```
|
|
2467
2804
|
|
|
@@ -2480,6 +2817,8 @@ begin
|
|
|
2480
2817
|
p data # => <GenericSuccessBoolResponse>
|
|
2481
2818
|
rescue OneSignal::ApiError => e
|
|
2482
2819
|
puts "Error when calling DefaultApi->unsubscribe_email_with_token_with_http_info: #{e}"
|
|
2820
|
+
puts "Status Code: #{e.code}"
|
|
2821
|
+
puts "Response Body: #{e.response_body}"
|
|
2483
2822
|
end
|
|
2484
2823
|
```
|
|
2485
2824
|
|
|
@@ -2525,8 +2864,8 @@ OneSignal.configure do |config|
|
|
|
2525
2864
|
end
|
|
2526
2865
|
|
|
2527
2866
|
api_instance = OneSignal::DefaultApi.new
|
|
2528
|
-
app_id = '
|
|
2529
|
-
token_id = '
|
|
2867
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String |
|
|
2868
|
+
token_id = '0aa1b2c3-d4e5-46f7-8899-aabbccddeeff' # String |
|
|
2530
2869
|
update_api_key_request = OneSignal::UpdateApiKeyRequest.new # UpdateApiKeyRequest |
|
|
2531
2870
|
|
|
2532
2871
|
begin
|
|
@@ -2535,6 +2874,11 @@ begin
|
|
|
2535
2874
|
p result
|
|
2536
2875
|
rescue OneSignal::ApiError => e
|
|
2537
2876
|
puts "Error when calling DefaultApi->update_api_key: #{e}"
|
|
2877
|
+
puts "Status Code: #{e.code}"
|
|
2878
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
2879
|
+
# the raw body remains on `e.response_body`.
|
|
2880
|
+
puts "Error Messages: #{e.error_messages}"
|
|
2881
|
+
puts "Response Body: #{e.response_body}"
|
|
2538
2882
|
end
|
|
2539
2883
|
```
|
|
2540
2884
|
|
|
@@ -2553,6 +2897,8 @@ begin
|
|
|
2553
2897
|
p data # => Object
|
|
2554
2898
|
rescue OneSignal::ApiError => e
|
|
2555
2899
|
puts "Error when calling DefaultApi->update_api_key_with_http_info: #{e}"
|
|
2900
|
+
puts "Status Code: #{e.code}"
|
|
2901
|
+
puts "Response Body: #{e.response_body}"
|
|
2556
2902
|
end
|
|
2557
2903
|
```
|
|
2558
2904
|
|
|
@@ -2598,7 +2944,7 @@ OneSignal.configure do |config|
|
|
|
2598
2944
|
end
|
|
2599
2945
|
|
|
2600
2946
|
api_instance = OneSignal::DefaultApi.new
|
|
2601
|
-
app_id = '
|
|
2947
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String | An app id
|
|
2602
2948
|
app = OneSignal::App.new # App |
|
|
2603
2949
|
|
|
2604
2950
|
begin
|
|
@@ -2607,6 +2953,11 @@ begin
|
|
|
2607
2953
|
p result
|
|
2608
2954
|
rescue OneSignal::ApiError => e
|
|
2609
2955
|
puts "Error when calling DefaultApi->update_app: #{e}"
|
|
2956
|
+
puts "Status Code: #{e.code}"
|
|
2957
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
2958
|
+
# the raw body remains on `e.response_body`.
|
|
2959
|
+
puts "Error Messages: #{e.error_messages}"
|
|
2960
|
+
puts "Response Body: #{e.response_body}"
|
|
2610
2961
|
end
|
|
2611
2962
|
```
|
|
2612
2963
|
|
|
@@ -2625,6 +2976,8 @@ begin
|
|
|
2625
2976
|
p data # => <App>
|
|
2626
2977
|
rescue OneSignal::ApiError => e
|
|
2627
2978
|
puts "Error when calling DefaultApi->update_app_with_http_info: #{e}"
|
|
2979
|
+
puts "Status Code: #{e.code}"
|
|
2980
|
+
puts "Response Body: #{e.response_body}"
|
|
2628
2981
|
end
|
|
2629
2982
|
```
|
|
2630
2983
|
|
|
@@ -2669,8 +3022,8 @@ OneSignal.configure do |config|
|
|
|
2669
3022
|
end
|
|
2670
3023
|
|
|
2671
3024
|
api_instance = OneSignal::DefaultApi.new
|
|
2672
|
-
app_id = '
|
|
2673
|
-
activity_id = '
|
|
3025
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String | The OneSignal App ID for your app. Available in Keys & IDs.
|
|
3026
|
+
activity_id = '12345' # String | Live Activity record ID
|
|
2674
3027
|
update_live_activity_request = OneSignal::UpdateLiveActivityRequest.new({name: 'name_example', event: 'update', event_updates: 3.56}) # UpdateLiveActivityRequest |
|
|
2675
3028
|
|
|
2676
3029
|
begin
|
|
@@ -2679,6 +3032,11 @@ begin
|
|
|
2679
3032
|
p result
|
|
2680
3033
|
rescue OneSignal::ApiError => e
|
|
2681
3034
|
puts "Error when calling DefaultApi->update_live_activity: #{e}"
|
|
3035
|
+
puts "Status Code: #{e.code}"
|
|
3036
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
3037
|
+
# the raw body remains on `e.response_body`.
|
|
3038
|
+
puts "Error Messages: #{e.error_messages}"
|
|
3039
|
+
puts "Response Body: #{e.response_body}"
|
|
2682
3040
|
end
|
|
2683
3041
|
```
|
|
2684
3042
|
|
|
@@ -2697,6 +3055,8 @@ begin
|
|
|
2697
3055
|
p data # => <UpdateLiveActivitySuccessResponse>
|
|
2698
3056
|
rescue OneSignal::ApiError => e
|
|
2699
3057
|
puts "Error when calling DefaultApi->update_live_activity_with_http_info: #{e}"
|
|
3058
|
+
puts "Status Code: #{e.code}"
|
|
3059
|
+
puts "Response Body: #{e.response_body}"
|
|
2700
3060
|
end
|
|
2701
3061
|
```
|
|
2702
3062
|
|
|
@@ -2742,8 +3102,8 @@ OneSignal.configure do |config|
|
|
|
2742
3102
|
end
|
|
2743
3103
|
|
|
2744
3104
|
api_instance = OneSignal::DefaultApi.new
|
|
2745
|
-
app_id = '
|
|
2746
|
-
subscription_id = '
|
|
3105
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String |
|
|
3106
|
+
subscription_id = '7e4c5b9a-1f60-4d07-9b1a-2e8c8d2cae51' # String |
|
|
2747
3107
|
subscription_body = OneSignal::SubscriptionBody.new # SubscriptionBody |
|
|
2748
3108
|
|
|
2749
3109
|
begin
|
|
@@ -2751,6 +3111,11 @@ begin
|
|
|
2751
3111
|
api_instance.update_subscription(app_id, subscription_id, subscription_body)
|
|
2752
3112
|
rescue OneSignal::ApiError => e
|
|
2753
3113
|
puts "Error when calling DefaultApi->update_subscription: #{e}"
|
|
3114
|
+
puts "Status Code: #{e.code}"
|
|
3115
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
3116
|
+
# the raw body remains on `e.response_body`.
|
|
3117
|
+
puts "Error Messages: #{e.error_messages}"
|
|
3118
|
+
puts "Response Body: #{e.response_body}"
|
|
2754
3119
|
end
|
|
2755
3120
|
```
|
|
2756
3121
|
|
|
@@ -2769,6 +3134,8 @@ begin
|
|
|
2769
3134
|
p data # => nil
|
|
2770
3135
|
rescue OneSignal::ApiError => e
|
|
2771
3136
|
puts "Error when calling DefaultApi->update_subscription_with_http_info: #{e}"
|
|
3137
|
+
puts "Status Code: #{e.code}"
|
|
3138
|
+
puts "Response Body: #{e.response_body}"
|
|
2772
3139
|
end
|
|
2773
3140
|
```
|
|
2774
3141
|
|
|
@@ -2814,9 +3181,9 @@ OneSignal.configure do |config|
|
|
|
2814
3181
|
end
|
|
2815
3182
|
|
|
2816
3183
|
api_instance = OneSignal::DefaultApi.new
|
|
2817
|
-
app_id = '
|
|
2818
|
-
token_type = '
|
|
2819
|
-
token = '
|
|
3184
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String | Your OneSignal App ID in UUID v4 format.
|
|
3185
|
+
token_type = 'Email' # String | The type of token to use when looking up the subscription. See Subscription Types.
|
|
3186
|
+
token = 'user@example.com' # String | The value of the token to lookup by (e.g., email address, phone number).
|
|
2820
3187
|
subscription_body = OneSignal::SubscriptionBody.new # SubscriptionBody |
|
|
2821
3188
|
|
|
2822
3189
|
begin
|
|
@@ -2825,6 +3192,11 @@ begin
|
|
|
2825
3192
|
p result
|
|
2826
3193
|
rescue OneSignal::ApiError => e
|
|
2827
3194
|
puts "Error when calling DefaultApi->update_subscription_by_token: #{e}"
|
|
3195
|
+
puts "Status Code: #{e.code}"
|
|
3196
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
3197
|
+
# the raw body remains on `e.response_body`.
|
|
3198
|
+
puts "Error Messages: #{e.error_messages}"
|
|
3199
|
+
puts "Response Body: #{e.response_body}"
|
|
2828
3200
|
end
|
|
2829
3201
|
```
|
|
2830
3202
|
|
|
@@ -2843,6 +3215,8 @@ begin
|
|
|
2843
3215
|
p data # => Object
|
|
2844
3216
|
rescue OneSignal::ApiError => e
|
|
2845
3217
|
puts "Error when calling DefaultApi->update_subscription_by_token_with_http_info: #{e}"
|
|
3218
|
+
puts "Status Code: #{e.code}"
|
|
3219
|
+
puts "Response Body: #{e.response_body}"
|
|
2846
3220
|
end
|
|
2847
3221
|
```
|
|
2848
3222
|
|
|
@@ -2889,8 +3263,8 @@ OneSignal.configure do |config|
|
|
|
2889
3263
|
end
|
|
2890
3264
|
|
|
2891
3265
|
api_instance = OneSignal::DefaultApi.new
|
|
2892
|
-
template_id = '
|
|
2893
|
-
app_id = '
|
|
3266
|
+
template_id = 'e4d3c2b1-a09f-4f1e-8d7c-6b5a4f3e2d1c' # String |
|
|
3267
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String |
|
|
2894
3268
|
update_template_request = OneSignal::UpdateTemplateRequest.new # UpdateTemplateRequest |
|
|
2895
3269
|
|
|
2896
3270
|
begin
|
|
@@ -2899,6 +3273,11 @@ begin
|
|
|
2899
3273
|
p result
|
|
2900
3274
|
rescue OneSignal::ApiError => e
|
|
2901
3275
|
puts "Error when calling DefaultApi->update_template: #{e}"
|
|
3276
|
+
puts "Status Code: #{e.code}"
|
|
3277
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
3278
|
+
# the raw body remains on `e.response_body`.
|
|
3279
|
+
puts "Error Messages: #{e.error_messages}"
|
|
3280
|
+
puts "Response Body: #{e.response_body}"
|
|
2902
3281
|
end
|
|
2903
3282
|
```
|
|
2904
3283
|
|
|
@@ -2917,6 +3296,8 @@ begin
|
|
|
2917
3296
|
p data # => <TemplateResource>
|
|
2918
3297
|
rescue OneSignal::ApiError => e
|
|
2919
3298
|
puts "Error when calling DefaultApi->update_template_with_http_info: #{e}"
|
|
3299
|
+
puts "Status Code: #{e.code}"
|
|
3300
|
+
puts "Response Body: #{e.response_body}"
|
|
2920
3301
|
end
|
|
2921
3302
|
```
|
|
2922
3303
|
|
|
@@ -2962,9 +3343,9 @@ OneSignal.configure do |config|
|
|
|
2962
3343
|
end
|
|
2963
3344
|
|
|
2964
3345
|
api_instance = OneSignal::DefaultApi.new
|
|
2965
|
-
app_id = '
|
|
2966
|
-
alias_label = '
|
|
2967
|
-
alias_id = '
|
|
3346
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String |
|
|
3347
|
+
alias_label = 'external_id' # String |
|
|
3348
|
+
alias_id = 'YOUR_USER_EXTERNAL_ID' # String |
|
|
2968
3349
|
update_user_request = OneSignal::UpdateUserRequest.new # UpdateUserRequest |
|
|
2969
3350
|
|
|
2970
3351
|
begin
|
|
@@ -2973,6 +3354,11 @@ begin
|
|
|
2973
3354
|
p result
|
|
2974
3355
|
rescue OneSignal::ApiError => e
|
|
2975
3356
|
puts "Error when calling DefaultApi->update_user: #{e}"
|
|
3357
|
+
puts "Status Code: #{e.code}"
|
|
3358
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
3359
|
+
# the raw body remains on `e.response_body`.
|
|
3360
|
+
puts "Error Messages: #{e.error_messages}"
|
|
3361
|
+
puts "Response Body: #{e.response_body}"
|
|
2976
3362
|
end
|
|
2977
3363
|
```
|
|
2978
3364
|
|
|
@@ -2991,6 +3377,8 @@ begin
|
|
|
2991
3377
|
p data # => <PropertiesBody>
|
|
2992
3378
|
rescue OneSignal::ApiError => e
|
|
2993
3379
|
puts "Error when calling DefaultApi->update_user_with_http_info: #{e}"
|
|
3380
|
+
puts "Status Code: #{e.code}"
|
|
3381
|
+
puts "Response Body: #{e.response_body}"
|
|
2994
3382
|
end
|
|
2995
3383
|
```
|
|
2996
3384
|
|
|
@@ -3037,7 +3425,7 @@ OneSignal.configure do |config|
|
|
|
3037
3425
|
end
|
|
3038
3426
|
|
|
3039
3427
|
api_instance = OneSignal::DefaultApi.new
|
|
3040
|
-
app_id = '
|
|
3428
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String |
|
|
3041
3429
|
|
|
3042
3430
|
begin
|
|
3043
3431
|
# View API keys
|
|
@@ -3045,6 +3433,11 @@ begin
|
|
|
3045
3433
|
p result
|
|
3046
3434
|
rescue OneSignal::ApiError => e
|
|
3047
3435
|
puts "Error when calling DefaultApi->view_api_keys: #{e}"
|
|
3436
|
+
puts "Status Code: #{e.code}"
|
|
3437
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
3438
|
+
# the raw body remains on `e.response_body`.
|
|
3439
|
+
puts "Error Messages: #{e.error_messages}"
|
|
3440
|
+
puts "Response Body: #{e.response_body}"
|
|
3048
3441
|
end
|
|
3049
3442
|
```
|
|
3050
3443
|
|
|
@@ -3063,6 +3456,8 @@ begin
|
|
|
3063
3456
|
p data # => <ApiKeyTokensListResponse>
|
|
3064
3457
|
rescue OneSignal::ApiError => e
|
|
3065
3458
|
puts "Error when calling DefaultApi->view_api_keys_with_http_info: #{e}"
|
|
3459
|
+
puts "Status Code: #{e.code}"
|
|
3460
|
+
puts "Response Body: #{e.response_body}"
|
|
3066
3461
|
end
|
|
3067
3462
|
```
|
|
3068
3463
|
|
|
@@ -3106,8 +3501,8 @@ OneSignal.configure do |config|
|
|
|
3106
3501
|
end
|
|
3107
3502
|
|
|
3108
3503
|
api_instance = OneSignal::DefaultApi.new
|
|
3109
|
-
template_id = '
|
|
3110
|
-
app_id = '
|
|
3504
|
+
template_id = 'e4d3c2b1-a09f-4f1e-8d7c-6b5a4f3e2d1c' # String |
|
|
3505
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String |
|
|
3111
3506
|
|
|
3112
3507
|
begin
|
|
3113
3508
|
# View template
|
|
@@ -3115,6 +3510,11 @@ begin
|
|
|
3115
3510
|
p result
|
|
3116
3511
|
rescue OneSignal::ApiError => e
|
|
3117
3512
|
puts "Error when calling DefaultApi->view_template: #{e}"
|
|
3513
|
+
puts "Status Code: #{e.code}"
|
|
3514
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
3515
|
+
# the raw body remains on `e.response_body`.
|
|
3516
|
+
puts "Error Messages: #{e.error_messages}"
|
|
3517
|
+
puts "Response Body: #{e.response_body}"
|
|
3118
3518
|
end
|
|
3119
3519
|
```
|
|
3120
3520
|
|
|
@@ -3133,6 +3533,8 @@ begin
|
|
|
3133
3533
|
p data # => <TemplateResource>
|
|
3134
3534
|
rescue OneSignal::ApiError => e
|
|
3135
3535
|
puts "Error when calling DefaultApi->view_template_with_http_info: #{e}"
|
|
3536
|
+
puts "Status Code: #{e.code}"
|
|
3537
|
+
puts "Response Body: #{e.response_body}"
|
|
3136
3538
|
end
|
|
3137
3539
|
```
|
|
3138
3540
|
|
|
@@ -3177,10 +3579,10 @@ OneSignal.configure do |config|
|
|
|
3177
3579
|
end
|
|
3178
3580
|
|
|
3179
3581
|
api_instance = OneSignal::DefaultApi.new
|
|
3180
|
-
app_id = '
|
|
3582
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String | Your OneSignal App ID in UUID v4 format.
|
|
3181
3583
|
opts = {
|
|
3182
|
-
limit:
|
|
3183
|
-
offset:
|
|
3584
|
+
limit: 10, # Integer | Maximum number of templates. Default and max is 50.
|
|
3585
|
+
offset: 0, # Integer | Pagination offset.
|
|
3184
3586
|
channel: 'push' # String | Filter by delivery channel.
|
|
3185
3587
|
}
|
|
3186
3588
|
|
|
@@ -3190,6 +3592,11 @@ begin
|
|
|
3190
3592
|
p result
|
|
3191
3593
|
rescue OneSignal::ApiError => e
|
|
3192
3594
|
puts "Error when calling DefaultApi->view_templates: #{e}"
|
|
3595
|
+
puts "Status Code: #{e.code}"
|
|
3596
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
3597
|
+
# the raw body remains on `e.response_body`.
|
|
3598
|
+
puts "Error Messages: #{e.error_messages}"
|
|
3599
|
+
puts "Response Body: #{e.response_body}"
|
|
3193
3600
|
end
|
|
3194
3601
|
```
|
|
3195
3602
|
|
|
@@ -3208,6 +3615,8 @@ begin
|
|
|
3208
3615
|
p data # => <TemplatesListResponse>
|
|
3209
3616
|
rescue OneSignal::ApiError => e
|
|
3210
3617
|
puts "Error when calling DefaultApi->view_templates_with_http_info: #{e}"
|
|
3618
|
+
puts "Status Code: #{e.code}"
|
|
3619
|
+
puts "Response Body: #{e.response_body}"
|
|
3211
3620
|
end
|
|
3212
3621
|
```
|
|
3213
3622
|
|