onesignal 5.6.0 → 5.7.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 +6 -0
- data/Gemfile.lock +2 -2
- data/README.md +3 -3
- data/docs/DefaultApi.md +496 -89
- data/lib/onesignal/api/default_api.rb +1 -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 +92 -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 +1 -1
- 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 +1 -1
- 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 +1 -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 +1 -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,10 +2210,10 @@ 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:
|
|
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.
|
|
1936
2217
|
kind: 0 # Integer | Kind of notifications returned: * unset - All notification types (default) * `0` - Dashboard only * `1` - API only * `3` - Automated only
|
|
1937
2218
|
}
|
|
1938
2219
|
|
|
@@ -1942,6 +2223,11 @@ begin
|
|
|
1942
2223
|
p result
|
|
1943
2224
|
rescue OneSignal::ApiError => e
|
|
1944
2225
|
puts "Error when calling DefaultApi->get_notifications: #{e}"
|
|
2226
|
+
puts "Status Code: #{e.code}"
|
|
2227
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
2228
|
+
# the raw body remains on `e.response_body`.
|
|
2229
|
+
puts "Error Messages: #{e.error_messages}"
|
|
2230
|
+
puts "Response Body: #{e.response_body}"
|
|
1945
2231
|
end
|
|
1946
2232
|
```
|
|
1947
2233
|
|
|
@@ -1960,6 +2246,8 @@ begin
|
|
|
1960
2246
|
p data # => <NotificationSlice>
|
|
1961
2247
|
rescue OneSignal::ApiError => e
|
|
1962
2248
|
puts "Error when calling DefaultApi->get_notifications_with_http_info: #{e}"
|
|
2249
|
+
puts "Status Code: #{e.code}"
|
|
2250
|
+
puts "Response Body: #{e.response_body}"
|
|
1963
2251
|
end
|
|
1964
2252
|
```
|
|
1965
2253
|
|
|
@@ -2006,13 +2294,13 @@ OneSignal.configure do |config|
|
|
|
2006
2294
|
end
|
|
2007
2295
|
|
|
2008
2296
|
api_instance = OneSignal::DefaultApi.new
|
|
2009
|
-
app_id = '
|
|
2010
|
-
outcome_names = '
|
|
2297
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String | The OneSignal App ID for your app. Available in Keys & IDs.
|
|
2298
|
+
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
2299
|
opts = {
|
|
2012
|
-
outcome_names2: '
|
|
2013
|
-
outcome_time_range: '
|
|
2014
|
-
outcome_platforms: '
|
|
2015
|
-
outcome_attribution: '
|
|
2300
|
+
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.
|
|
2301
|
+
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.
|
|
2302
|
+
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.
|
|
2303
|
+
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
2304
|
}
|
|
2017
2305
|
|
|
2018
2306
|
begin
|
|
@@ -2021,6 +2309,11 @@ begin
|
|
|
2021
2309
|
p result
|
|
2022
2310
|
rescue OneSignal::ApiError => e
|
|
2023
2311
|
puts "Error when calling DefaultApi->get_outcomes: #{e}"
|
|
2312
|
+
puts "Status Code: #{e.code}"
|
|
2313
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
2314
|
+
# the raw body remains on `e.response_body`.
|
|
2315
|
+
puts "Error Messages: #{e.error_messages}"
|
|
2316
|
+
puts "Response Body: #{e.response_body}"
|
|
2024
2317
|
end
|
|
2025
2318
|
```
|
|
2026
2319
|
|
|
@@ -2039,6 +2332,8 @@ begin
|
|
|
2039
2332
|
p data # => <OutcomesData>
|
|
2040
2333
|
rescue OneSignal::ApiError => e
|
|
2041
2334
|
puts "Error when calling DefaultApi->get_outcomes_with_http_info: #{e}"
|
|
2335
|
+
puts "Status Code: #{e.code}"
|
|
2336
|
+
puts "Response Body: #{e.response_body}"
|
|
2042
2337
|
end
|
|
2043
2338
|
```
|
|
2044
2339
|
|
|
@@ -2087,10 +2382,10 @@ OneSignal.configure do |config|
|
|
|
2087
2382
|
end
|
|
2088
2383
|
|
|
2089
2384
|
api_instance = OneSignal::DefaultApi.new
|
|
2090
|
-
app_id = '
|
|
2385
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String | The OneSignal App ID for your app. Available in Keys & IDs.
|
|
2091
2386
|
opts = {
|
|
2092
|
-
offset:
|
|
2093
|
-
limit:
|
|
2387
|
+
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.
|
|
2388
|
+
limit: 10 # Integer | The amount of Segments in the response. Maximum 300.
|
|
2094
2389
|
}
|
|
2095
2390
|
|
|
2096
2391
|
begin
|
|
@@ -2099,6 +2394,11 @@ begin
|
|
|
2099
2394
|
p result
|
|
2100
2395
|
rescue OneSignal::ApiError => e
|
|
2101
2396
|
puts "Error when calling DefaultApi->get_segments: #{e}"
|
|
2397
|
+
puts "Status Code: #{e.code}"
|
|
2398
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
2399
|
+
# the raw body remains on `e.response_body`.
|
|
2400
|
+
puts "Error Messages: #{e.error_messages}"
|
|
2401
|
+
puts "Response Body: #{e.response_body}"
|
|
2102
2402
|
end
|
|
2103
2403
|
```
|
|
2104
2404
|
|
|
@@ -2117,6 +2417,8 @@ begin
|
|
|
2117
2417
|
p data # => <GetSegmentsSuccessResponse>
|
|
2118
2418
|
rescue OneSignal::ApiError => e
|
|
2119
2419
|
puts "Error when calling DefaultApi->get_segments_with_http_info: #{e}"
|
|
2420
|
+
puts "Status Code: #{e.code}"
|
|
2421
|
+
puts "Response Body: #{e.response_body}"
|
|
2120
2422
|
end
|
|
2121
2423
|
```
|
|
2122
2424
|
|
|
@@ -2162,9 +2464,9 @@ OneSignal.configure do |config|
|
|
|
2162
2464
|
end
|
|
2163
2465
|
|
|
2164
2466
|
api_instance = OneSignal::DefaultApi.new
|
|
2165
|
-
app_id = '
|
|
2166
|
-
alias_label = '
|
|
2167
|
-
alias_id = '
|
|
2467
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String |
|
|
2468
|
+
alias_label = 'external_id' # String |
|
|
2469
|
+
alias_id = 'YOUR_USER_EXTERNAL_ID' # String |
|
|
2168
2470
|
|
|
2169
2471
|
begin
|
|
2170
2472
|
|
|
@@ -2172,6 +2474,11 @@ begin
|
|
|
2172
2474
|
p result
|
|
2173
2475
|
rescue OneSignal::ApiError => e
|
|
2174
2476
|
puts "Error when calling DefaultApi->get_user: #{e}"
|
|
2477
|
+
puts "Status Code: #{e.code}"
|
|
2478
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
2479
|
+
# the raw body remains on `e.response_body`.
|
|
2480
|
+
puts "Error Messages: #{e.error_messages}"
|
|
2481
|
+
puts "Response Body: #{e.response_body}"
|
|
2175
2482
|
end
|
|
2176
2483
|
```
|
|
2177
2484
|
|
|
@@ -2190,6 +2497,8 @@ begin
|
|
|
2190
2497
|
p data # => <User>
|
|
2191
2498
|
rescue OneSignal::ApiError => e
|
|
2192
2499
|
puts "Error when calling DefaultApi->get_user_with_http_info: #{e}"
|
|
2500
|
+
puts "Status Code: #{e.code}"
|
|
2501
|
+
puts "Response Body: #{e.response_body}"
|
|
2193
2502
|
end
|
|
2194
2503
|
```
|
|
2195
2504
|
|
|
@@ -2235,8 +2544,8 @@ OneSignal.configure do |config|
|
|
|
2235
2544
|
end
|
|
2236
2545
|
|
|
2237
2546
|
api_instance = OneSignal::DefaultApi.new
|
|
2238
|
-
app_id = '
|
|
2239
|
-
token_id = '
|
|
2547
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String |
|
|
2548
|
+
token_id = '0aa1b2c3-d4e5-46f7-8899-aabbccddeeff' # String |
|
|
2240
2549
|
|
|
2241
2550
|
begin
|
|
2242
2551
|
# Rotate API key
|
|
@@ -2244,6 +2553,11 @@ begin
|
|
|
2244
2553
|
p result
|
|
2245
2554
|
rescue OneSignal::ApiError => e
|
|
2246
2555
|
puts "Error when calling DefaultApi->rotate_api_key: #{e}"
|
|
2556
|
+
puts "Status Code: #{e.code}"
|
|
2557
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
2558
|
+
# the raw body remains on `e.response_body`.
|
|
2559
|
+
puts "Error Messages: #{e.error_messages}"
|
|
2560
|
+
puts "Response Body: #{e.response_body}"
|
|
2247
2561
|
end
|
|
2248
2562
|
```
|
|
2249
2563
|
|
|
@@ -2262,6 +2576,8 @@ begin
|
|
|
2262
2576
|
p data # => <CreateApiKeyResponse>
|
|
2263
2577
|
rescue OneSignal::ApiError => e
|
|
2264
2578
|
puts "Error when calling DefaultApi->rotate_api_key_with_http_info: #{e}"
|
|
2579
|
+
puts "Status Code: #{e.code}"
|
|
2580
|
+
puts "Response Body: #{e.response_body}"
|
|
2265
2581
|
end
|
|
2266
2582
|
```
|
|
2267
2583
|
|
|
@@ -2306,8 +2622,8 @@ OneSignal.configure do |config|
|
|
|
2306
2622
|
end
|
|
2307
2623
|
|
|
2308
2624
|
api_instance = OneSignal::DefaultApi.new
|
|
2309
|
-
app_id = '
|
|
2310
|
-
activity_type = '
|
|
2625
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String | Your OneSignal App ID in UUID v4 format.
|
|
2626
|
+
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
2627
|
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
2628
|
|
|
2313
2629
|
begin
|
|
@@ -2316,6 +2632,11 @@ begin
|
|
|
2316
2632
|
p result
|
|
2317
2633
|
rescue OneSignal::ApiError => e
|
|
2318
2634
|
puts "Error when calling DefaultApi->start_live_activity: #{e}"
|
|
2635
|
+
puts "Status Code: #{e.code}"
|
|
2636
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
2637
|
+
# the raw body remains on `e.response_body`.
|
|
2638
|
+
puts "Error Messages: #{e.error_messages}"
|
|
2639
|
+
puts "Response Body: #{e.response_body}"
|
|
2319
2640
|
end
|
|
2320
2641
|
```
|
|
2321
2642
|
|
|
@@ -2334,6 +2655,8 @@ begin
|
|
|
2334
2655
|
p data # => <StartLiveActivitySuccessResponse>
|
|
2335
2656
|
rescue OneSignal::ApiError => e
|
|
2336
2657
|
puts "Error when calling DefaultApi->start_live_activity_with_http_info: #{e}"
|
|
2658
|
+
puts "Status Code: #{e.code}"
|
|
2659
|
+
puts "Response Body: #{e.response_body}"
|
|
2337
2660
|
end
|
|
2338
2661
|
```
|
|
2339
2662
|
|
|
@@ -2379,8 +2702,8 @@ OneSignal.configure do |config|
|
|
|
2379
2702
|
end
|
|
2380
2703
|
|
|
2381
2704
|
api_instance = OneSignal::DefaultApi.new
|
|
2382
|
-
app_id = '
|
|
2383
|
-
subscription_id = '
|
|
2705
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String |
|
|
2706
|
+
subscription_id = '7e4c5b9a-1f60-4d07-9b1a-2e8c8d2cae51' # String |
|
|
2384
2707
|
transfer_subscription_request_body = OneSignal::TransferSubscriptionRequestBody.new # TransferSubscriptionRequestBody |
|
|
2385
2708
|
|
|
2386
2709
|
begin
|
|
@@ -2389,6 +2712,11 @@ begin
|
|
|
2389
2712
|
p result
|
|
2390
2713
|
rescue OneSignal::ApiError => e
|
|
2391
2714
|
puts "Error when calling DefaultApi->transfer_subscription: #{e}"
|
|
2715
|
+
puts "Status Code: #{e.code}"
|
|
2716
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
2717
|
+
# the raw body remains on `e.response_body`.
|
|
2718
|
+
puts "Error Messages: #{e.error_messages}"
|
|
2719
|
+
puts "Response Body: #{e.response_body}"
|
|
2392
2720
|
end
|
|
2393
2721
|
```
|
|
2394
2722
|
|
|
@@ -2407,6 +2735,8 @@ begin
|
|
|
2407
2735
|
p data # => <UserIdentityBody>
|
|
2408
2736
|
rescue OneSignal::ApiError => e
|
|
2409
2737
|
puts "Error when calling DefaultApi->transfer_subscription_with_http_info: #{e}"
|
|
2738
|
+
puts "Status Code: #{e.code}"
|
|
2739
|
+
puts "Response Body: #{e.response_body}"
|
|
2410
2740
|
end
|
|
2411
2741
|
```
|
|
2412
2742
|
|
|
@@ -2452,9 +2782,9 @@ OneSignal.configure do |config|
|
|
|
2452
2782
|
end
|
|
2453
2783
|
|
|
2454
2784
|
api_instance = OneSignal::DefaultApi.new
|
|
2455
|
-
app_id = '
|
|
2456
|
-
notification_id = '
|
|
2457
|
-
token = '
|
|
2785
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String | The OneSignal App ID for your app. Available in Keys & IDs.
|
|
2786
|
+
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.
|
|
2787
|
+
token = 'YOUR_TOKEN_ID' # String | The unsubscribe token that is generated via liquid syntax in {{subscription.unsubscribe_token}} when personalizing an email.
|
|
2458
2788
|
|
|
2459
2789
|
begin
|
|
2460
2790
|
# Unsubscribe with token
|
|
@@ -2462,6 +2792,11 @@ begin
|
|
|
2462
2792
|
p result
|
|
2463
2793
|
rescue OneSignal::ApiError => e
|
|
2464
2794
|
puts "Error when calling DefaultApi->unsubscribe_email_with_token: #{e}"
|
|
2795
|
+
puts "Status Code: #{e.code}"
|
|
2796
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
2797
|
+
# the raw body remains on `e.response_body`.
|
|
2798
|
+
puts "Error Messages: #{e.error_messages}"
|
|
2799
|
+
puts "Response Body: #{e.response_body}"
|
|
2465
2800
|
end
|
|
2466
2801
|
```
|
|
2467
2802
|
|
|
@@ -2480,6 +2815,8 @@ begin
|
|
|
2480
2815
|
p data # => <GenericSuccessBoolResponse>
|
|
2481
2816
|
rescue OneSignal::ApiError => e
|
|
2482
2817
|
puts "Error when calling DefaultApi->unsubscribe_email_with_token_with_http_info: #{e}"
|
|
2818
|
+
puts "Status Code: #{e.code}"
|
|
2819
|
+
puts "Response Body: #{e.response_body}"
|
|
2483
2820
|
end
|
|
2484
2821
|
```
|
|
2485
2822
|
|
|
@@ -2525,8 +2862,8 @@ OneSignal.configure do |config|
|
|
|
2525
2862
|
end
|
|
2526
2863
|
|
|
2527
2864
|
api_instance = OneSignal::DefaultApi.new
|
|
2528
|
-
app_id = '
|
|
2529
|
-
token_id = '
|
|
2865
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String |
|
|
2866
|
+
token_id = '0aa1b2c3-d4e5-46f7-8899-aabbccddeeff' # String |
|
|
2530
2867
|
update_api_key_request = OneSignal::UpdateApiKeyRequest.new # UpdateApiKeyRequest |
|
|
2531
2868
|
|
|
2532
2869
|
begin
|
|
@@ -2535,6 +2872,11 @@ begin
|
|
|
2535
2872
|
p result
|
|
2536
2873
|
rescue OneSignal::ApiError => e
|
|
2537
2874
|
puts "Error when calling DefaultApi->update_api_key: #{e}"
|
|
2875
|
+
puts "Status Code: #{e.code}"
|
|
2876
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
2877
|
+
# the raw body remains on `e.response_body`.
|
|
2878
|
+
puts "Error Messages: #{e.error_messages}"
|
|
2879
|
+
puts "Response Body: #{e.response_body}"
|
|
2538
2880
|
end
|
|
2539
2881
|
```
|
|
2540
2882
|
|
|
@@ -2553,6 +2895,8 @@ begin
|
|
|
2553
2895
|
p data # => Object
|
|
2554
2896
|
rescue OneSignal::ApiError => e
|
|
2555
2897
|
puts "Error when calling DefaultApi->update_api_key_with_http_info: #{e}"
|
|
2898
|
+
puts "Status Code: #{e.code}"
|
|
2899
|
+
puts "Response Body: #{e.response_body}"
|
|
2556
2900
|
end
|
|
2557
2901
|
```
|
|
2558
2902
|
|
|
@@ -2598,7 +2942,7 @@ OneSignal.configure do |config|
|
|
|
2598
2942
|
end
|
|
2599
2943
|
|
|
2600
2944
|
api_instance = OneSignal::DefaultApi.new
|
|
2601
|
-
app_id = '
|
|
2945
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String | An app id
|
|
2602
2946
|
app = OneSignal::App.new # App |
|
|
2603
2947
|
|
|
2604
2948
|
begin
|
|
@@ -2607,6 +2951,11 @@ begin
|
|
|
2607
2951
|
p result
|
|
2608
2952
|
rescue OneSignal::ApiError => e
|
|
2609
2953
|
puts "Error when calling DefaultApi->update_app: #{e}"
|
|
2954
|
+
puts "Status Code: #{e.code}"
|
|
2955
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
2956
|
+
# the raw body remains on `e.response_body`.
|
|
2957
|
+
puts "Error Messages: #{e.error_messages}"
|
|
2958
|
+
puts "Response Body: #{e.response_body}"
|
|
2610
2959
|
end
|
|
2611
2960
|
```
|
|
2612
2961
|
|
|
@@ -2625,6 +2974,8 @@ begin
|
|
|
2625
2974
|
p data # => <App>
|
|
2626
2975
|
rescue OneSignal::ApiError => e
|
|
2627
2976
|
puts "Error when calling DefaultApi->update_app_with_http_info: #{e}"
|
|
2977
|
+
puts "Status Code: #{e.code}"
|
|
2978
|
+
puts "Response Body: #{e.response_body}"
|
|
2628
2979
|
end
|
|
2629
2980
|
```
|
|
2630
2981
|
|
|
@@ -2669,8 +3020,8 @@ OneSignal.configure do |config|
|
|
|
2669
3020
|
end
|
|
2670
3021
|
|
|
2671
3022
|
api_instance = OneSignal::DefaultApi.new
|
|
2672
|
-
app_id = '
|
|
2673
|
-
activity_id = '
|
|
3023
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String | The OneSignal App ID for your app. Available in Keys & IDs.
|
|
3024
|
+
activity_id = '12345' # String | Live Activity record ID
|
|
2674
3025
|
update_live_activity_request = OneSignal::UpdateLiveActivityRequest.new({name: 'name_example', event: 'update', event_updates: 3.56}) # UpdateLiveActivityRequest |
|
|
2675
3026
|
|
|
2676
3027
|
begin
|
|
@@ -2679,6 +3030,11 @@ begin
|
|
|
2679
3030
|
p result
|
|
2680
3031
|
rescue OneSignal::ApiError => e
|
|
2681
3032
|
puts "Error when calling DefaultApi->update_live_activity: #{e}"
|
|
3033
|
+
puts "Status Code: #{e.code}"
|
|
3034
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
3035
|
+
# the raw body remains on `e.response_body`.
|
|
3036
|
+
puts "Error Messages: #{e.error_messages}"
|
|
3037
|
+
puts "Response Body: #{e.response_body}"
|
|
2682
3038
|
end
|
|
2683
3039
|
```
|
|
2684
3040
|
|
|
@@ -2697,6 +3053,8 @@ begin
|
|
|
2697
3053
|
p data # => <UpdateLiveActivitySuccessResponse>
|
|
2698
3054
|
rescue OneSignal::ApiError => e
|
|
2699
3055
|
puts "Error when calling DefaultApi->update_live_activity_with_http_info: #{e}"
|
|
3056
|
+
puts "Status Code: #{e.code}"
|
|
3057
|
+
puts "Response Body: #{e.response_body}"
|
|
2700
3058
|
end
|
|
2701
3059
|
```
|
|
2702
3060
|
|
|
@@ -2742,8 +3100,8 @@ OneSignal.configure do |config|
|
|
|
2742
3100
|
end
|
|
2743
3101
|
|
|
2744
3102
|
api_instance = OneSignal::DefaultApi.new
|
|
2745
|
-
app_id = '
|
|
2746
|
-
subscription_id = '
|
|
3103
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String |
|
|
3104
|
+
subscription_id = '7e4c5b9a-1f60-4d07-9b1a-2e8c8d2cae51' # String |
|
|
2747
3105
|
subscription_body = OneSignal::SubscriptionBody.new # SubscriptionBody |
|
|
2748
3106
|
|
|
2749
3107
|
begin
|
|
@@ -2751,6 +3109,11 @@ begin
|
|
|
2751
3109
|
api_instance.update_subscription(app_id, subscription_id, subscription_body)
|
|
2752
3110
|
rescue OneSignal::ApiError => e
|
|
2753
3111
|
puts "Error when calling DefaultApi->update_subscription: #{e}"
|
|
3112
|
+
puts "Status Code: #{e.code}"
|
|
3113
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
3114
|
+
# the raw body remains on `e.response_body`.
|
|
3115
|
+
puts "Error Messages: #{e.error_messages}"
|
|
3116
|
+
puts "Response Body: #{e.response_body}"
|
|
2754
3117
|
end
|
|
2755
3118
|
```
|
|
2756
3119
|
|
|
@@ -2769,6 +3132,8 @@ begin
|
|
|
2769
3132
|
p data # => nil
|
|
2770
3133
|
rescue OneSignal::ApiError => e
|
|
2771
3134
|
puts "Error when calling DefaultApi->update_subscription_with_http_info: #{e}"
|
|
3135
|
+
puts "Status Code: #{e.code}"
|
|
3136
|
+
puts "Response Body: #{e.response_body}"
|
|
2772
3137
|
end
|
|
2773
3138
|
```
|
|
2774
3139
|
|
|
@@ -2814,9 +3179,9 @@ OneSignal.configure do |config|
|
|
|
2814
3179
|
end
|
|
2815
3180
|
|
|
2816
3181
|
api_instance = OneSignal::DefaultApi.new
|
|
2817
|
-
app_id = '
|
|
2818
|
-
token_type = '
|
|
2819
|
-
token = '
|
|
3182
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String | Your OneSignal App ID in UUID v4 format.
|
|
3183
|
+
token_type = 'Email' # String | The type of token to use when looking up the subscription. See Subscription Types.
|
|
3184
|
+
token = 'user@example.com' # String | The value of the token to lookup by (e.g., email address, phone number).
|
|
2820
3185
|
subscription_body = OneSignal::SubscriptionBody.new # SubscriptionBody |
|
|
2821
3186
|
|
|
2822
3187
|
begin
|
|
@@ -2825,6 +3190,11 @@ begin
|
|
|
2825
3190
|
p result
|
|
2826
3191
|
rescue OneSignal::ApiError => e
|
|
2827
3192
|
puts "Error when calling DefaultApi->update_subscription_by_token: #{e}"
|
|
3193
|
+
puts "Status Code: #{e.code}"
|
|
3194
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
3195
|
+
# the raw body remains on `e.response_body`.
|
|
3196
|
+
puts "Error Messages: #{e.error_messages}"
|
|
3197
|
+
puts "Response Body: #{e.response_body}"
|
|
2828
3198
|
end
|
|
2829
3199
|
```
|
|
2830
3200
|
|
|
@@ -2843,6 +3213,8 @@ begin
|
|
|
2843
3213
|
p data # => Object
|
|
2844
3214
|
rescue OneSignal::ApiError => e
|
|
2845
3215
|
puts "Error when calling DefaultApi->update_subscription_by_token_with_http_info: #{e}"
|
|
3216
|
+
puts "Status Code: #{e.code}"
|
|
3217
|
+
puts "Response Body: #{e.response_body}"
|
|
2846
3218
|
end
|
|
2847
3219
|
```
|
|
2848
3220
|
|
|
@@ -2889,8 +3261,8 @@ OneSignal.configure do |config|
|
|
|
2889
3261
|
end
|
|
2890
3262
|
|
|
2891
3263
|
api_instance = OneSignal::DefaultApi.new
|
|
2892
|
-
template_id = '
|
|
2893
|
-
app_id = '
|
|
3264
|
+
template_id = 'e4d3c2b1-a09f-4f1e-8d7c-6b5a4f3e2d1c' # String |
|
|
3265
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String |
|
|
2894
3266
|
update_template_request = OneSignal::UpdateTemplateRequest.new # UpdateTemplateRequest |
|
|
2895
3267
|
|
|
2896
3268
|
begin
|
|
@@ -2899,6 +3271,11 @@ begin
|
|
|
2899
3271
|
p result
|
|
2900
3272
|
rescue OneSignal::ApiError => e
|
|
2901
3273
|
puts "Error when calling DefaultApi->update_template: #{e}"
|
|
3274
|
+
puts "Status Code: #{e.code}"
|
|
3275
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
3276
|
+
# the raw body remains on `e.response_body`.
|
|
3277
|
+
puts "Error Messages: #{e.error_messages}"
|
|
3278
|
+
puts "Response Body: #{e.response_body}"
|
|
2902
3279
|
end
|
|
2903
3280
|
```
|
|
2904
3281
|
|
|
@@ -2917,6 +3294,8 @@ begin
|
|
|
2917
3294
|
p data # => <TemplateResource>
|
|
2918
3295
|
rescue OneSignal::ApiError => e
|
|
2919
3296
|
puts "Error when calling DefaultApi->update_template_with_http_info: #{e}"
|
|
3297
|
+
puts "Status Code: #{e.code}"
|
|
3298
|
+
puts "Response Body: #{e.response_body}"
|
|
2920
3299
|
end
|
|
2921
3300
|
```
|
|
2922
3301
|
|
|
@@ -2962,9 +3341,9 @@ OneSignal.configure do |config|
|
|
|
2962
3341
|
end
|
|
2963
3342
|
|
|
2964
3343
|
api_instance = OneSignal::DefaultApi.new
|
|
2965
|
-
app_id = '
|
|
2966
|
-
alias_label = '
|
|
2967
|
-
alias_id = '
|
|
3344
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String |
|
|
3345
|
+
alias_label = 'external_id' # String |
|
|
3346
|
+
alias_id = 'YOUR_USER_EXTERNAL_ID' # String |
|
|
2968
3347
|
update_user_request = OneSignal::UpdateUserRequest.new # UpdateUserRequest |
|
|
2969
3348
|
|
|
2970
3349
|
begin
|
|
@@ -2973,6 +3352,11 @@ begin
|
|
|
2973
3352
|
p result
|
|
2974
3353
|
rescue OneSignal::ApiError => e
|
|
2975
3354
|
puts "Error when calling DefaultApi->update_user: #{e}"
|
|
3355
|
+
puts "Status Code: #{e.code}"
|
|
3356
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
3357
|
+
# the raw body remains on `e.response_body`.
|
|
3358
|
+
puts "Error Messages: #{e.error_messages}"
|
|
3359
|
+
puts "Response Body: #{e.response_body}"
|
|
2976
3360
|
end
|
|
2977
3361
|
```
|
|
2978
3362
|
|
|
@@ -2991,6 +3375,8 @@ begin
|
|
|
2991
3375
|
p data # => <PropertiesBody>
|
|
2992
3376
|
rescue OneSignal::ApiError => e
|
|
2993
3377
|
puts "Error when calling DefaultApi->update_user_with_http_info: #{e}"
|
|
3378
|
+
puts "Status Code: #{e.code}"
|
|
3379
|
+
puts "Response Body: #{e.response_body}"
|
|
2994
3380
|
end
|
|
2995
3381
|
```
|
|
2996
3382
|
|
|
@@ -3037,7 +3423,7 @@ OneSignal.configure do |config|
|
|
|
3037
3423
|
end
|
|
3038
3424
|
|
|
3039
3425
|
api_instance = OneSignal::DefaultApi.new
|
|
3040
|
-
app_id = '
|
|
3426
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String |
|
|
3041
3427
|
|
|
3042
3428
|
begin
|
|
3043
3429
|
# View API keys
|
|
@@ -3045,6 +3431,11 @@ begin
|
|
|
3045
3431
|
p result
|
|
3046
3432
|
rescue OneSignal::ApiError => e
|
|
3047
3433
|
puts "Error when calling DefaultApi->view_api_keys: #{e}"
|
|
3434
|
+
puts "Status Code: #{e.code}"
|
|
3435
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
3436
|
+
# the raw body remains on `e.response_body`.
|
|
3437
|
+
puts "Error Messages: #{e.error_messages}"
|
|
3438
|
+
puts "Response Body: #{e.response_body}"
|
|
3048
3439
|
end
|
|
3049
3440
|
```
|
|
3050
3441
|
|
|
@@ -3063,6 +3454,8 @@ begin
|
|
|
3063
3454
|
p data # => <ApiKeyTokensListResponse>
|
|
3064
3455
|
rescue OneSignal::ApiError => e
|
|
3065
3456
|
puts "Error when calling DefaultApi->view_api_keys_with_http_info: #{e}"
|
|
3457
|
+
puts "Status Code: #{e.code}"
|
|
3458
|
+
puts "Response Body: #{e.response_body}"
|
|
3066
3459
|
end
|
|
3067
3460
|
```
|
|
3068
3461
|
|
|
@@ -3106,8 +3499,8 @@ OneSignal.configure do |config|
|
|
|
3106
3499
|
end
|
|
3107
3500
|
|
|
3108
3501
|
api_instance = OneSignal::DefaultApi.new
|
|
3109
|
-
template_id = '
|
|
3110
|
-
app_id = '
|
|
3502
|
+
template_id = 'e4d3c2b1-a09f-4f1e-8d7c-6b5a4f3e2d1c' # String |
|
|
3503
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String |
|
|
3111
3504
|
|
|
3112
3505
|
begin
|
|
3113
3506
|
# View template
|
|
@@ -3115,6 +3508,11 @@ begin
|
|
|
3115
3508
|
p result
|
|
3116
3509
|
rescue OneSignal::ApiError => e
|
|
3117
3510
|
puts "Error when calling DefaultApi->view_template: #{e}"
|
|
3511
|
+
puts "Status Code: #{e.code}"
|
|
3512
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
3513
|
+
# the raw body remains on `e.response_body`.
|
|
3514
|
+
puts "Error Messages: #{e.error_messages}"
|
|
3515
|
+
puts "Response Body: #{e.response_body}"
|
|
3118
3516
|
end
|
|
3119
3517
|
```
|
|
3120
3518
|
|
|
@@ -3133,6 +3531,8 @@ begin
|
|
|
3133
3531
|
p data # => <TemplateResource>
|
|
3134
3532
|
rescue OneSignal::ApiError => e
|
|
3135
3533
|
puts "Error when calling DefaultApi->view_template_with_http_info: #{e}"
|
|
3534
|
+
puts "Status Code: #{e.code}"
|
|
3535
|
+
puts "Response Body: #{e.response_body}"
|
|
3136
3536
|
end
|
|
3137
3537
|
```
|
|
3138
3538
|
|
|
@@ -3177,10 +3577,10 @@ OneSignal.configure do |config|
|
|
|
3177
3577
|
end
|
|
3178
3578
|
|
|
3179
3579
|
api_instance = OneSignal::DefaultApi.new
|
|
3180
|
-
app_id = '
|
|
3580
|
+
app_id = '00000000-0000-0000-0000-000000000000' # String | Your OneSignal App ID in UUID v4 format.
|
|
3181
3581
|
opts = {
|
|
3182
|
-
limit:
|
|
3183
|
-
offset:
|
|
3582
|
+
limit: 10, # Integer | Maximum number of templates. Default and max is 50.
|
|
3583
|
+
offset: 0, # Integer | Pagination offset.
|
|
3184
3584
|
channel: 'push' # String | Filter by delivery channel.
|
|
3185
3585
|
}
|
|
3186
3586
|
|
|
@@ -3190,6 +3590,11 @@ begin
|
|
|
3190
3590
|
p result
|
|
3191
3591
|
rescue OneSignal::ApiError => e
|
|
3192
3592
|
puts "Error when calling DefaultApi->view_templates: #{e}"
|
|
3593
|
+
puts "Status Code: #{e.code}"
|
|
3594
|
+
# `e.error_messages` flattens any error-envelope shape to an Array<String>;
|
|
3595
|
+
# the raw body remains on `e.response_body`.
|
|
3596
|
+
puts "Error Messages: #{e.error_messages}"
|
|
3597
|
+
puts "Response Body: #{e.response_body}"
|
|
3193
3598
|
end
|
|
3194
3599
|
```
|
|
3195
3600
|
|
|
@@ -3208,6 +3613,8 @@ begin
|
|
|
3208
3613
|
p data # => <TemplatesListResponse>
|
|
3209
3614
|
rescue OneSignal::ApiError => e
|
|
3210
3615
|
puts "Error when calling DefaultApi->view_templates_with_http_info: #{e}"
|
|
3616
|
+
puts "Status Code: #{e.code}"
|
|
3617
|
+
puts "Response Body: #{e.response_body}"
|
|
3211
3618
|
end
|
|
3212
3619
|
```
|
|
3213
3620
|
|