onesignal 5.2.1.pre.beta1 → 5.3.0.pre.beta1

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.
Files changed (163) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +33 -5
  3. data/docs/ApiKeyToken.md +28 -0
  4. data/docs/ApiKeyTokensListResponse.md +18 -0
  5. data/docs/CopyTemplateRequest.md +18 -0
  6. data/docs/CreateApiKeyRequest.md +22 -0
  7. data/docs/CreateApiKeyResponse.md +20 -0
  8. data/docs/CreateTemplateRequest.md +32 -0
  9. data/docs/CustomEvent.md +26 -0
  10. data/docs/CustomEventsRequest.md +18 -0
  11. data/docs/DefaultApi.md +1132 -110
  12. data/docs/StartLiveActivityRequest.md +48 -0
  13. data/docs/StartLiveActivitySuccessResponse.md +18 -0
  14. data/docs/TemplateResource.md +28 -0
  15. data/docs/TemplatesListResponse.md +18 -0
  16. data/docs/UpdateApiKeyRequest.md +22 -0
  17. data/docs/UpdateTemplateRequest.md +30 -0
  18. data/lib/onesignal/api/default_api.rb +1043 -1
  19. data/lib/onesignal/api_client.rb +2 -2
  20. data/lib/onesignal/api_error.rb +1 -1
  21. data/lib/onesignal/configuration.rb +1 -1
  22. data/lib/onesignal/models/api_key_token.rb +300 -0
  23. data/lib/onesignal/models/api_key_tokens_list_response.rb +221 -0
  24. data/lib/onesignal/models/app.rb +1 -1
  25. data/lib/onesignal/models/basic_notification.rb +1 -1
  26. data/lib/onesignal/models/basic_notification_all_of.rb +1 -1
  27. data/lib/onesignal/models/basic_notification_all_of_android_background_layout.rb +1 -1
  28. data/lib/onesignal/models/button.rb +1 -1
  29. data/lib/onesignal/models/copy_template_request.rb +225 -0
  30. data/lib/onesignal/models/create_api_key_request.rb +273 -0
  31. data/lib/onesignal/models/create_api_key_response.rb +228 -0
  32. data/lib/onesignal/models/create_notification_success_response.rb +1 -1
  33. data/lib/onesignal/models/create_segment_conflict_response.rb +1 -1
  34. data/lib/onesignal/models/create_segment_success_response.rb +1 -1
  35. data/lib/onesignal/models/create_template_request.rb +307 -0
  36. data/lib/onesignal/models/create_user_conflict_response.rb +1 -1
  37. data/lib/onesignal/models/create_user_conflict_response_errors_inner.rb +1 -1
  38. data/lib/onesignal/models/create_user_conflict_response_errors_items_meta.rb +1 -1
  39. data/lib/onesignal/models/custom_event.rb +269 -0
  40. data/lib/onesignal/models/custom_events_request.rb +226 -0
  41. data/lib/onesignal/models/delivery_data.rb +1 -1
  42. data/lib/onesignal/models/export_events_success_response.rb +1 -1
  43. data/lib/onesignal/models/export_subscriptions_request_body.rb +1 -1
  44. data/lib/onesignal/models/export_subscriptions_success_response.rb +1 -1
  45. data/lib/onesignal/models/filter.rb +1 -1
  46. data/lib/onesignal/models/filter_expression.rb +1 -1
  47. data/lib/onesignal/models/generic_error.rb +1 -1
  48. data/lib/onesignal/models/generic_success_bool_response.rb +1 -1
  49. data/lib/onesignal/models/get_notification_history_request_body.rb +1 -1
  50. data/lib/onesignal/models/get_segments_success_response.rb +1 -1
  51. data/lib/onesignal/models/language_string_map.rb +1 -1
  52. data/lib/onesignal/models/notification.rb +1 -1
  53. data/lib/onesignal/models/notification_all_of.rb +1 -1
  54. data/lib/onesignal/models/notification_history_success_response.rb +1 -1
  55. data/lib/onesignal/models/notification_slice.rb +1 -1
  56. data/lib/onesignal/models/notification_target.rb +1 -1
  57. data/lib/onesignal/models/notification_with_meta.rb +1 -1
  58. data/lib/onesignal/models/notification_with_meta_all_of.rb +1 -1
  59. data/lib/onesignal/models/operator.rb +1 -1
  60. data/lib/onesignal/models/outcome_data.rb +1 -1
  61. data/lib/onesignal/models/outcomes_data.rb +1 -1
  62. data/lib/onesignal/models/platform_delivery_data.rb +1 -1
  63. data/lib/onesignal/models/platform_delivery_data_email_all_of.rb +1 -1
  64. data/lib/onesignal/models/platform_delivery_data_sms_all_of.rb +1 -1
  65. data/lib/onesignal/models/properties_body.rb +1 -1
  66. data/lib/onesignal/models/properties_deltas.rb +1 -1
  67. data/lib/onesignal/models/properties_object.rb +1 -1
  68. data/lib/onesignal/models/purchase.rb +1 -1
  69. data/lib/onesignal/models/rate_limit_error.rb +1 -1
  70. data/lib/onesignal/models/segment.rb +1 -1
  71. data/lib/onesignal/models/segment_data.rb +1 -1
  72. data/lib/onesignal/models/segment_notification_target.rb +1 -1
  73. data/lib/onesignal/models/start_live_activity_request.rb +454 -0
  74. data/lib/onesignal/models/start_live_activity_success_response.rb +219 -0
  75. data/lib/onesignal/models/subscription.rb +1 -1
  76. data/lib/onesignal/models/subscription_body.rb +1 -1
  77. data/lib/onesignal/models/subscription_notification_target.rb +1 -1
  78. data/lib/onesignal/models/template_resource.rb +302 -0
  79. data/lib/onesignal/models/templates_list_response.rb +221 -0
  80. data/lib/onesignal/models/transfer_subscription_request_body.rb +1 -1
  81. data/lib/onesignal/models/update_api_key_request.rb +273 -0
  82. data/lib/onesignal/models/update_live_activity_request.rb +1 -1
  83. data/lib/onesignal/models/update_live_activity_success_response.rb +1 -1
  84. data/lib/onesignal/models/update_template_request.rb +282 -0
  85. data/lib/onesignal/models/update_user_request.rb +1 -1
  86. data/lib/onesignal/models/user.rb +1 -1
  87. data/lib/onesignal/models/user_identity_body.rb +1 -1
  88. data/lib/onesignal/models/web_button.rb +1 -1
  89. data/lib/onesignal/version.rb +2 -2
  90. data/lib/onesignal.rb +15 -1
  91. data/onesignal.gemspec +1 -1
  92. data/spec/api/default_api_spec.rb +189 -1
  93. data/spec/api_client_spec.rb +1 -1
  94. data/spec/configuration_spec.rb +1 -1
  95. data/spec/models/api_key_token_spec.rb +68 -0
  96. data/spec/models/api_key_tokens_list_response_spec.rb +34 -0
  97. data/spec/models/app_spec.rb +1 -1
  98. data/spec/models/basic_notification_all_of_android_background_layout_spec.rb +1 -1
  99. data/spec/models/basic_notification_all_of_spec.rb +1 -1
  100. data/spec/models/basic_notification_spec.rb +1 -1
  101. data/spec/models/button_spec.rb +1 -1
  102. data/spec/models/copy_template_request_spec.rb +34 -0
  103. data/spec/models/create_api_key_request_spec.rb +50 -0
  104. data/spec/models/create_api_key_response_spec.rb +40 -0
  105. data/spec/models/create_notification_success_response_spec.rb +1 -1
  106. data/spec/models/create_segment_conflict_response_spec.rb +1 -1
  107. data/spec/models/create_segment_success_response_spec.rb +1 -1
  108. data/spec/models/create_template_request_spec.rb +76 -0
  109. data/spec/models/create_user_conflict_response_errors_inner_spec.rb +1 -1
  110. data/spec/models/create_user_conflict_response_errors_items_meta_spec.rb +1 -1
  111. data/spec/models/create_user_conflict_response_spec.rb +1 -1
  112. data/spec/models/custom_event_spec.rb +58 -0
  113. data/spec/models/custom_events_request_spec.rb +34 -0
  114. data/spec/models/delivery_data_spec.rb +1 -1
  115. data/spec/models/export_events_success_response_spec.rb +1 -1
  116. data/spec/models/export_subscriptions_request_body_spec.rb +1 -1
  117. data/spec/models/export_subscriptions_success_response_spec.rb +1 -1
  118. data/spec/models/filter_expression_spec.rb +1 -1
  119. data/spec/models/filter_spec.rb +1 -1
  120. data/spec/models/generic_error_spec.rb +1 -1
  121. data/spec/models/generic_success_bool_response_spec.rb +1 -1
  122. data/spec/models/get_notification_history_request_body_spec.rb +1 -1
  123. data/spec/models/get_segments_success_response_spec.rb +1 -1
  124. data/spec/models/language_string_map_spec.rb +1 -1
  125. data/spec/models/notification_all_of_spec.rb +1 -1
  126. data/spec/models/notification_history_success_response_spec.rb +1 -1
  127. data/spec/models/notification_slice_spec.rb +1 -1
  128. data/spec/models/notification_spec.rb +1 -1
  129. data/spec/models/notification_target_spec.rb +1 -1
  130. data/spec/models/notification_with_meta_all_of_spec.rb +1 -1
  131. data/spec/models/notification_with_meta_spec.rb +1 -1
  132. data/spec/models/operator_spec.rb +1 -1
  133. data/spec/models/outcome_data_spec.rb +1 -1
  134. data/spec/models/outcomes_data_spec.rb +1 -1
  135. data/spec/models/platform_delivery_data_email_all_of_spec.rb +1 -1
  136. data/spec/models/platform_delivery_data_sms_all_of_spec.rb +1 -1
  137. data/spec/models/platform_delivery_data_spec.rb +1 -1
  138. data/spec/models/properties_body_spec.rb +1 -1
  139. data/spec/models/properties_deltas_spec.rb +1 -1
  140. data/spec/models/properties_object_spec.rb +1 -1
  141. data/spec/models/purchase_spec.rb +1 -1
  142. data/spec/models/rate_limit_error_spec.rb +1 -1
  143. data/spec/models/segment_data_spec.rb +1 -1
  144. data/spec/models/segment_notification_target_spec.rb +1 -1
  145. data/spec/models/segment_spec.rb +1 -1
  146. data/spec/models/start_live_activity_request_spec.rb +128 -0
  147. data/spec/models/start_live_activity_success_response_spec.rb +34 -0
  148. data/spec/models/subscription_body_spec.rb +1 -1
  149. data/spec/models/subscription_notification_target_spec.rb +1 -1
  150. data/spec/models/subscription_spec.rb +1 -1
  151. data/spec/models/template_resource_spec.rb +68 -0
  152. data/spec/models/templates_list_response_spec.rb +34 -0
  153. data/spec/models/transfer_subscription_request_body_spec.rb +1 -1
  154. data/spec/models/update_api_key_request_spec.rb +50 -0
  155. data/spec/models/update_live_activity_request_spec.rb +1 -1
  156. data/spec/models/update_live_activity_success_response_spec.rb +1 -1
  157. data/spec/models/update_template_request_spec.rb +70 -0
  158. data/spec/models/update_user_request_spec.rb +1 -1
  159. data/spec/models/user_identity_body_spec.rb +1 -1
  160. data/spec/models/user_spec.rb +1 -1
  161. data/spec/models/web_button_spec.rb +1 -1
  162. data/spec/spec_helper.rb +1 -1
  163. metadata +57 -1
@@ -3,7 +3,7 @@
3
3
 
4
4
  #A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
5
5
 
6
- The version of the OpenAPI document: 5.2.1
6
+ The version of the OpenAPI document: 5.3.0
7
7
  Contact: devrel@onesignal.com
8
8
  Generated by: https://openapi-generator.tech
9
9
  OpenAPI Generator version: 6.0.0-SNAPSHOT
@@ -89,6 +89,87 @@ module OneSignal
89
89
  return data, status_code, headers
90
90
  end
91
91
 
92
+ # Copy template to another app
93
+ # Copy a template to a destination app.
94
+ # @param template_id [String]
95
+ # @param app_id [String]
96
+ # @param copy_template_request [CopyTemplateRequest]
97
+ # @param [Hash] opts the optional parameters
98
+ # @return [TemplateResource]
99
+ def copy_template_to_app(template_id, app_id, copy_template_request, opts = {})
100
+ data, _status_code, _headers = copy_template_to_app_with_http_info(template_id, app_id, copy_template_request, opts)
101
+ data
102
+ end
103
+
104
+ # Copy template to another app
105
+ # Copy a template to a destination app.
106
+ # @param template_id [String]
107
+ # @param app_id [String]
108
+ # @param copy_template_request [CopyTemplateRequest]
109
+ # @param [Hash] opts the optional parameters
110
+ # @return [Array<(TemplateResource, Integer, Hash)>] TemplateResource data, response status code and response headers
111
+ def copy_template_to_app_with_http_info(template_id, app_id, copy_template_request, opts = {})
112
+ if @api_client.config.debugging
113
+ @api_client.config.logger.debug 'Calling API: DefaultApi.copy_template_to_app ...'
114
+ end
115
+ # verify the required parameter 'template_id' is set
116
+ if @api_client.config.client_side_validation && template_id.nil?
117
+ fail ArgumentError, "Missing the required parameter 'template_id' when calling DefaultApi.copy_template_to_app"
118
+ end
119
+ # verify the required parameter 'app_id' is set
120
+ if @api_client.config.client_side_validation && app_id.nil?
121
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.copy_template_to_app"
122
+ end
123
+ # verify the required parameter 'copy_template_request' is set
124
+ if @api_client.config.client_side_validation && copy_template_request.nil?
125
+ fail ArgumentError, "Missing the required parameter 'copy_template_request' when calling DefaultApi.copy_template_to_app"
126
+ end
127
+ # resource path
128
+ local_var_path = '/templates/{template_id}/copy_to_app'.sub('{' + 'template_id' + '}', CGI.escape(template_id.to_s))
129
+
130
+ # query parameters
131
+ query_params = opts[:query_params] || {}
132
+ query_params[:'app_id'] = app_id
133
+
134
+ # header parameters
135
+ header_params = opts[:header_params] || {}
136
+ # HTTP header 'Accept' (if needed)
137
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
138
+ # HTTP header 'Content-Type'
139
+ content_type = @api_client.select_header_content_type(['application/json'])
140
+ if !content_type.nil?
141
+ header_params['Content-Type'] = content_type
142
+ end
143
+
144
+ # form parameters
145
+ form_params = opts[:form_params] || {}
146
+
147
+ # http body (model)
148
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(copy_template_request)
149
+
150
+ # return_type
151
+ return_type = opts[:debug_return_type] || 'TemplateResource'
152
+
153
+ # auth_names
154
+ auth_names = opts[:debug_auth_names] || ['organization_api_key']
155
+
156
+ new_options = opts.merge(
157
+ :operation => :"DefaultApi.copy_template_to_app",
158
+ :header_params => header_params,
159
+ :query_params => query_params,
160
+ :form_params => form_params,
161
+ :body => post_body,
162
+ :auth_names => auth_names,
163
+ :return_type => return_type
164
+ )
165
+
166
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
167
+ if @api_client.config.debugging
168
+ @api_client.config.logger.debug "API called: DefaultApi#copy_template_to_app\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
169
+ end
170
+ return data, status_code, headers
171
+ end
172
+
92
173
  # Upserts one or more Aliases to an existing User identified by (:alias_label, :alias_id).
93
174
  # @param app_id [String]
94
175
  # @param alias_label [String]
@@ -251,6 +332,80 @@ module OneSignal
251
332
  return data, status_code, headers
252
333
  end
253
334
 
335
+ # Create API key
336
+ # Use this API to create a new App API Key (also called a Rich Authentication Token) for a specific OneSignal app. These keys are used to authenticate API requests at the app level and offer enhanced security features, including optional IP allowlisting.
337
+ # @param app_id [String]
338
+ # @param create_api_key_request [CreateApiKeyRequest]
339
+ # @param [Hash] opts the optional parameters
340
+ # @return [CreateApiKeyResponse]
341
+ def create_api_key(app_id, create_api_key_request, opts = {})
342
+ data, _status_code, _headers = create_api_key_with_http_info(app_id, create_api_key_request, opts)
343
+ data
344
+ end
345
+
346
+ # Create API key
347
+ # Use this API to create a new App API Key (also called a Rich Authentication Token) for a specific OneSignal app. These keys are used to authenticate API requests at the app level and offer enhanced security features, including optional IP allowlisting.
348
+ # @param app_id [String]
349
+ # @param create_api_key_request [CreateApiKeyRequest]
350
+ # @param [Hash] opts the optional parameters
351
+ # @return [Array<(CreateApiKeyResponse, Integer, Hash)>] CreateApiKeyResponse data, response status code and response headers
352
+ def create_api_key_with_http_info(app_id, create_api_key_request, opts = {})
353
+ if @api_client.config.debugging
354
+ @api_client.config.logger.debug 'Calling API: DefaultApi.create_api_key ...'
355
+ end
356
+ # verify the required parameter 'app_id' is set
357
+ if @api_client.config.client_side_validation && app_id.nil?
358
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.create_api_key"
359
+ end
360
+ # verify the required parameter 'create_api_key_request' is set
361
+ if @api_client.config.client_side_validation && create_api_key_request.nil?
362
+ fail ArgumentError, "Missing the required parameter 'create_api_key_request' when calling DefaultApi.create_api_key"
363
+ end
364
+ # resource path
365
+ local_var_path = '/apps/{app_id}/auth/tokens'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s))
366
+
367
+ # query parameters
368
+ query_params = opts[:query_params] || {}
369
+
370
+ # header parameters
371
+ header_params = opts[:header_params] || {}
372
+ # HTTP header 'Accept' (if needed)
373
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
374
+ # HTTP header 'Content-Type'
375
+ content_type = @api_client.select_header_content_type(['application/json'])
376
+ if !content_type.nil?
377
+ header_params['Content-Type'] = content_type
378
+ end
379
+
380
+ # form parameters
381
+ form_params = opts[:form_params] || {}
382
+
383
+ # http body (model)
384
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_api_key_request)
385
+
386
+ # return_type
387
+ return_type = opts[:debug_return_type] || 'CreateApiKeyResponse'
388
+
389
+ # auth_names
390
+ auth_names = opts[:debug_auth_names] || ['organization_api_key']
391
+
392
+ new_options = opts.merge(
393
+ :operation => :"DefaultApi.create_api_key",
394
+ :header_params => header_params,
395
+ :query_params => query_params,
396
+ :form_params => form_params,
397
+ :body => post_body,
398
+ :auth_names => auth_names,
399
+ :return_type => return_type
400
+ )
401
+
402
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
403
+ if @api_client.config.debugging
404
+ @api_client.config.logger.debug "API called: DefaultApi#create_api_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
405
+ end
406
+ return data, status_code, headers
407
+ end
408
+
254
409
  # Create an app
255
410
  # Creates a new OneSignal app
256
411
  # @param app [App]
@@ -319,6 +474,80 @@ module OneSignal
319
474
  return data, status_code, headers
320
475
  end
321
476
 
477
+ # Create custom events
478
+ # The Custom Events API allows you to record user events. Custom events can represent any action users take in your application, such as completing a purchase, viewing content, or achieving milestones.
479
+ # @param app_id [String] Your OneSignal App ID in UUID v4 format.
480
+ # @param custom_events_request [CustomEventsRequest]
481
+ # @param [Hash] opts the optional parameters
482
+ # @return [Object]
483
+ def create_custom_events(app_id, custom_events_request, opts = {})
484
+ data, _status_code, _headers = create_custom_events_with_http_info(app_id, custom_events_request, opts)
485
+ data
486
+ end
487
+
488
+ # Create custom events
489
+ # The Custom Events API allows you to record user events. Custom events can represent any action users take in your application, such as completing a purchase, viewing content, or achieving milestones.
490
+ # @param app_id [String] Your OneSignal App ID in UUID v4 format.
491
+ # @param custom_events_request [CustomEventsRequest]
492
+ # @param [Hash] opts the optional parameters
493
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
494
+ def create_custom_events_with_http_info(app_id, custom_events_request, opts = {})
495
+ if @api_client.config.debugging
496
+ @api_client.config.logger.debug 'Calling API: DefaultApi.create_custom_events ...'
497
+ end
498
+ # verify the required parameter 'app_id' is set
499
+ if @api_client.config.client_side_validation && app_id.nil?
500
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.create_custom_events"
501
+ end
502
+ # verify the required parameter 'custom_events_request' is set
503
+ if @api_client.config.client_side_validation && custom_events_request.nil?
504
+ fail ArgumentError, "Missing the required parameter 'custom_events_request' when calling DefaultApi.create_custom_events"
505
+ end
506
+ # resource path
507
+ local_var_path = '/apps/{app_id}/integrations/custom_events'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s))
508
+
509
+ # query parameters
510
+ query_params = opts[:query_params] || {}
511
+
512
+ # header parameters
513
+ header_params = opts[:header_params] || {}
514
+ # HTTP header 'Accept' (if needed)
515
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
516
+ # HTTP header 'Content-Type'
517
+ content_type = @api_client.select_header_content_type(['application/json'])
518
+ if !content_type.nil?
519
+ header_params['Content-Type'] = content_type
520
+ end
521
+
522
+ # form parameters
523
+ form_params = opts[:form_params] || {}
524
+
525
+ # http body (model)
526
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(custom_events_request)
527
+
528
+ # return_type
529
+ return_type = opts[:debug_return_type] || 'Object'
530
+
531
+ # auth_names
532
+ auth_names = opts[:debug_auth_names] || ['rest_api_key']
533
+
534
+ new_options = opts.merge(
535
+ :operation => :"DefaultApi.create_custom_events",
536
+ :header_params => header_params,
537
+ :query_params => query_params,
538
+ :form_params => form_params,
539
+ :body => post_body,
540
+ :auth_names => auth_names,
541
+ :return_type => return_type
542
+ )
543
+
544
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
545
+ if @api_client.config.debugging
546
+ @api_client.config.logger.debug "API called: DefaultApi#create_custom_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
547
+ end
548
+ return data, status_code, headers
549
+ end
550
+
322
551
  # Create notification
323
552
  # Sends notifications to your users
324
553
  # @param notification [Notification]
@@ -541,6 +770,74 @@ module OneSignal
541
770
  return data, status_code, headers
542
771
  end
543
772
 
773
+ # Create template
774
+ # Create reusable message templates for push, email, and SMS channels.
775
+ # @param create_template_request [CreateTemplateRequest]
776
+ # @param [Hash] opts the optional parameters
777
+ # @return [TemplateResource]
778
+ def create_template(create_template_request, opts = {})
779
+ data, _status_code, _headers = create_template_with_http_info(create_template_request, opts)
780
+ data
781
+ end
782
+
783
+ # Create template
784
+ # Create reusable message templates for push, email, and SMS channels.
785
+ # @param create_template_request [CreateTemplateRequest]
786
+ # @param [Hash] opts the optional parameters
787
+ # @return [Array<(TemplateResource, Integer, Hash)>] TemplateResource data, response status code and response headers
788
+ def create_template_with_http_info(create_template_request, opts = {})
789
+ if @api_client.config.debugging
790
+ @api_client.config.logger.debug 'Calling API: DefaultApi.create_template ...'
791
+ end
792
+ # verify the required parameter 'create_template_request' is set
793
+ if @api_client.config.client_side_validation && create_template_request.nil?
794
+ fail ArgumentError, "Missing the required parameter 'create_template_request' when calling DefaultApi.create_template"
795
+ end
796
+ # resource path
797
+ local_var_path = '/templates'
798
+
799
+ # query parameters
800
+ query_params = opts[:query_params] || {}
801
+
802
+ # header parameters
803
+ header_params = opts[:header_params] || {}
804
+ # HTTP header 'Accept' (if needed)
805
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
806
+ # HTTP header 'Content-Type'
807
+ content_type = @api_client.select_header_content_type(['application/json'])
808
+ if !content_type.nil?
809
+ header_params['Content-Type'] = content_type
810
+ end
811
+
812
+ # form parameters
813
+ form_params = opts[:form_params] || {}
814
+
815
+ # http body (model)
816
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_template_request)
817
+
818
+ # return_type
819
+ return_type = opts[:debug_return_type] || 'TemplateResource'
820
+
821
+ # auth_names
822
+ auth_names = opts[:debug_auth_names] || ['rest_api_key']
823
+
824
+ new_options = opts.merge(
825
+ :operation => :"DefaultApi.create_template",
826
+ :header_params => header_params,
827
+ :query_params => query_params,
828
+ :form_params => form_params,
829
+ :body => post_body,
830
+ :auth_names => auth_names,
831
+ :return_type => return_type
832
+ )
833
+
834
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
835
+ if @api_client.config.debugging
836
+ @api_client.config.logger.debug "API called: DefaultApi#create_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
837
+ end
838
+ return data, status_code, headers
839
+ end
840
+
544
841
  # Creates a User, optionally Subscriptions owned by the User as well as Aliases. Aliases provided in the payload will be used to look up an existing User.
545
842
  # @param app_id [String]
546
843
  # @param user [User]
@@ -692,6 +989,75 @@ module OneSignal
692
989
  return data, status_code, headers
693
990
  end
694
991
 
992
+ # Delete API key
993
+ # Delete a specific Rich Authentication Token (App API Key) for a OneSignal app. Requires your Organization API Key and the token’s unique ID, not the token value itself.
994
+ # @param app_id [String]
995
+ # @param token_id [String]
996
+ # @param [Hash] opts the optional parameters
997
+ # @return [Object]
998
+ def delete_api_key(app_id, token_id, opts = {})
999
+ data, _status_code, _headers = delete_api_key_with_http_info(app_id, token_id, opts)
1000
+ data
1001
+ end
1002
+
1003
+ # Delete API key
1004
+ # Delete a specific Rich Authentication Token (App API Key) for a OneSignal app. Requires your Organization API Key and the token’s unique ID, not the token value itself.
1005
+ # @param app_id [String]
1006
+ # @param token_id [String]
1007
+ # @param [Hash] opts the optional parameters
1008
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
1009
+ def delete_api_key_with_http_info(app_id, token_id, opts = {})
1010
+ if @api_client.config.debugging
1011
+ @api_client.config.logger.debug 'Calling API: DefaultApi.delete_api_key ...'
1012
+ end
1013
+ # verify the required parameter 'app_id' is set
1014
+ if @api_client.config.client_side_validation && app_id.nil?
1015
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.delete_api_key"
1016
+ end
1017
+ # verify the required parameter 'token_id' is set
1018
+ if @api_client.config.client_side_validation && token_id.nil?
1019
+ fail ArgumentError, "Missing the required parameter 'token_id' when calling DefaultApi.delete_api_key"
1020
+ end
1021
+ # resource path
1022
+ local_var_path = '/apps/{app_id}/auth/tokens/{token_id}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'token_id' + '}', CGI.escape(token_id.to_s))
1023
+
1024
+ # query parameters
1025
+ query_params = opts[:query_params] || {}
1026
+
1027
+ # header parameters
1028
+ header_params = opts[:header_params] || {}
1029
+ # HTTP header 'Accept' (if needed)
1030
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1031
+
1032
+ # form parameters
1033
+ form_params = opts[:form_params] || {}
1034
+
1035
+ # http body (model)
1036
+ post_body = opts[:debug_body]
1037
+
1038
+ # return_type
1039
+ return_type = opts[:debug_return_type] || 'Object'
1040
+
1041
+ # auth_names
1042
+ auth_names = opts[:debug_auth_names] || ['organization_api_key']
1043
+
1044
+ new_options = opts.merge(
1045
+ :operation => :"DefaultApi.delete_api_key",
1046
+ :header_params => header_params,
1047
+ :query_params => query_params,
1048
+ :form_params => form_params,
1049
+ :body => post_body,
1050
+ :auth_names => auth_names,
1051
+ :return_type => return_type
1052
+ )
1053
+
1054
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
1055
+ if @api_client.config.debugging
1056
+ @api_client.config.logger.debug "API called: DefaultApi#delete_api_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1057
+ end
1058
+ return data, status_code, headers
1059
+ end
1060
+
695
1061
  # Delete Segment
696
1062
  # Delete a segment (not user devices) - Required: OneSignal Paid Plan You can delete a segment under your app by calling this API. You must provide an API key in the Authorization header that has admin access on the app. The segment_id can be found in the URL of the segment when viewing it in the dashboard.
697
1063
  # @param app_id [String] The OneSignal App ID for your app. Available in Keys &amp; IDs.
@@ -828,6 +1194,76 @@ module OneSignal
828
1194
  return data, status_code, headers
829
1195
  end
830
1196
 
1197
+ # Delete template
1198
+ # Delete a template by id.
1199
+ # @param template_id [String]
1200
+ # @param app_id [String]
1201
+ # @param [Hash] opts the optional parameters
1202
+ # @return [GenericSuccessBoolResponse]
1203
+ def delete_template(template_id, app_id, opts = {})
1204
+ data, _status_code, _headers = delete_template_with_http_info(template_id, app_id, opts)
1205
+ data
1206
+ end
1207
+
1208
+ # Delete template
1209
+ # Delete a template by id.
1210
+ # @param template_id [String]
1211
+ # @param app_id [String]
1212
+ # @param [Hash] opts the optional parameters
1213
+ # @return [Array<(GenericSuccessBoolResponse, Integer, Hash)>] GenericSuccessBoolResponse data, response status code and response headers
1214
+ def delete_template_with_http_info(template_id, app_id, opts = {})
1215
+ if @api_client.config.debugging
1216
+ @api_client.config.logger.debug 'Calling API: DefaultApi.delete_template ...'
1217
+ end
1218
+ # verify the required parameter 'template_id' is set
1219
+ if @api_client.config.client_side_validation && template_id.nil?
1220
+ fail ArgumentError, "Missing the required parameter 'template_id' when calling DefaultApi.delete_template"
1221
+ end
1222
+ # verify the required parameter 'app_id' is set
1223
+ if @api_client.config.client_side_validation && app_id.nil?
1224
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.delete_template"
1225
+ end
1226
+ # resource path
1227
+ local_var_path = '/templates/{template_id}'.sub('{' + 'template_id' + '}', CGI.escape(template_id.to_s))
1228
+
1229
+ # query parameters
1230
+ query_params = opts[:query_params] || {}
1231
+ query_params[:'app_id'] = app_id
1232
+
1233
+ # header parameters
1234
+ header_params = opts[:header_params] || {}
1235
+ # HTTP header 'Accept' (if needed)
1236
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1237
+
1238
+ # form parameters
1239
+ form_params = opts[:form_params] || {}
1240
+
1241
+ # http body (model)
1242
+ post_body = opts[:debug_body]
1243
+
1244
+ # return_type
1245
+ return_type = opts[:debug_return_type] || 'GenericSuccessBoolResponse'
1246
+
1247
+ # auth_names
1248
+ auth_names = opts[:debug_auth_names] || ['rest_api_key']
1249
+
1250
+ new_options = opts.merge(
1251
+ :operation => :"DefaultApi.delete_template",
1252
+ :header_params => header_params,
1253
+ :query_params => query_params,
1254
+ :form_params => form_params,
1255
+ :body => post_body,
1256
+ :auth_names => auth_names,
1257
+ :return_type => return_type
1258
+ )
1259
+
1260
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
1261
+ if @api_client.config.debugging
1262
+ @api_client.config.logger.debug "API called: DefaultApi#delete_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1263
+ end
1264
+ return data, status_code, headers
1265
+ end
1266
+
831
1267
  # Removes the User identified by (:alias_label, :alias_id), and all Subscriptions and Aliases
832
1268
  # @param app_id [String]
833
1269
  # @param alias_label [String]
@@ -1746,6 +2182,155 @@ module OneSignal
1746
2182
  return data, status_code, headers
1747
2183
  end
1748
2184
 
2185
+ # Rotate API key
2186
+ # Rotate a Rich Authentication Token (App API Key) for a OneSignal app. Rotating a key revokes the current token and generates a new one under the same configuration—ideal when a token is lost or compromised but you don’t want to recreate and reconfigure it from scratch.
2187
+ # @param app_id [String]
2188
+ # @param token_id [String]
2189
+ # @param [Hash] opts the optional parameters
2190
+ # @return [CreateApiKeyResponse]
2191
+ def rotate_api_key(app_id, token_id, opts = {})
2192
+ data, _status_code, _headers = rotate_api_key_with_http_info(app_id, token_id, opts)
2193
+ data
2194
+ end
2195
+
2196
+ # Rotate API key
2197
+ # Rotate a Rich Authentication Token (App API Key) for a OneSignal app. Rotating a key revokes the current token and generates a new one under the same configuration—ideal when a token is lost or compromised but you don’t want to recreate and reconfigure it from scratch.
2198
+ # @param app_id [String]
2199
+ # @param token_id [String]
2200
+ # @param [Hash] opts the optional parameters
2201
+ # @return [Array<(CreateApiKeyResponse, Integer, Hash)>] CreateApiKeyResponse data, response status code and response headers
2202
+ def rotate_api_key_with_http_info(app_id, token_id, opts = {})
2203
+ if @api_client.config.debugging
2204
+ @api_client.config.logger.debug 'Calling API: DefaultApi.rotate_api_key ...'
2205
+ end
2206
+ # verify the required parameter 'app_id' is set
2207
+ if @api_client.config.client_side_validation && app_id.nil?
2208
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.rotate_api_key"
2209
+ end
2210
+ # verify the required parameter 'token_id' is set
2211
+ if @api_client.config.client_side_validation && token_id.nil?
2212
+ fail ArgumentError, "Missing the required parameter 'token_id' when calling DefaultApi.rotate_api_key"
2213
+ end
2214
+ # resource path
2215
+ local_var_path = '/apps/{app_id}/auth/tokens/{token_id}/rotate'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'token_id' + '}', CGI.escape(token_id.to_s))
2216
+
2217
+ # query parameters
2218
+ query_params = opts[:query_params] || {}
2219
+
2220
+ # header parameters
2221
+ header_params = opts[:header_params] || {}
2222
+ # HTTP header 'Accept' (if needed)
2223
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
2224
+
2225
+ # form parameters
2226
+ form_params = opts[:form_params] || {}
2227
+
2228
+ # http body (model)
2229
+ post_body = opts[:debug_body]
2230
+
2231
+ # return_type
2232
+ return_type = opts[:debug_return_type] || 'CreateApiKeyResponse'
2233
+
2234
+ # auth_names
2235
+ auth_names = opts[:debug_auth_names] || ['organization_api_key']
2236
+
2237
+ new_options = opts.merge(
2238
+ :operation => :"DefaultApi.rotate_api_key",
2239
+ :header_params => header_params,
2240
+ :query_params => query_params,
2241
+ :form_params => form_params,
2242
+ :body => post_body,
2243
+ :auth_names => auth_names,
2244
+ :return_type => return_type
2245
+ )
2246
+
2247
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
2248
+ if @api_client.config.debugging
2249
+ @api_client.config.logger.debug "API called: DefaultApi#rotate_api_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2250
+ end
2251
+ return data, status_code, headers
2252
+ end
2253
+
2254
+ # Start Live Activity
2255
+ # Remotely start a Live Activity on iOS devices via OneSignal’s REST API.
2256
+ # @param app_id [String] Your OneSignal App ID in UUID v4 format.
2257
+ # @param activity_type [String] The name of the Live Activity defined in your app. This should match the attributes struct used in your app&#39;s Live Activity implementation.
2258
+ # @param start_live_activity_request [StartLiveActivityRequest]
2259
+ # @param [Hash] opts the optional parameters
2260
+ # @return [StartLiveActivitySuccessResponse]
2261
+ def start_live_activity(app_id, activity_type, start_live_activity_request, opts = {})
2262
+ data, _status_code, _headers = start_live_activity_with_http_info(app_id, activity_type, start_live_activity_request, opts)
2263
+ data
2264
+ end
2265
+
2266
+ # Start Live Activity
2267
+ # Remotely start a Live Activity on iOS devices via OneSignal’s REST API.
2268
+ # @param app_id [String] Your OneSignal App ID in UUID v4 format.
2269
+ # @param activity_type [String] The name of the Live Activity defined in your app. This should match the attributes struct used in your app&#39;s Live Activity implementation.
2270
+ # @param start_live_activity_request [StartLiveActivityRequest]
2271
+ # @param [Hash] opts the optional parameters
2272
+ # @return [Array<(StartLiveActivitySuccessResponse, Integer, Hash)>] StartLiveActivitySuccessResponse data, response status code and response headers
2273
+ def start_live_activity_with_http_info(app_id, activity_type, start_live_activity_request, opts = {})
2274
+ if @api_client.config.debugging
2275
+ @api_client.config.logger.debug 'Calling API: DefaultApi.start_live_activity ...'
2276
+ end
2277
+ # verify the required parameter 'app_id' is set
2278
+ if @api_client.config.client_side_validation && app_id.nil?
2279
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.start_live_activity"
2280
+ end
2281
+ # verify the required parameter 'activity_type' is set
2282
+ if @api_client.config.client_side_validation && activity_type.nil?
2283
+ fail ArgumentError, "Missing the required parameter 'activity_type' when calling DefaultApi.start_live_activity"
2284
+ end
2285
+ # verify the required parameter 'start_live_activity_request' is set
2286
+ if @api_client.config.client_side_validation && start_live_activity_request.nil?
2287
+ fail ArgumentError, "Missing the required parameter 'start_live_activity_request' when calling DefaultApi.start_live_activity"
2288
+ end
2289
+ # resource path
2290
+ local_var_path = '/apps/{app_id}/activities/activity/{activity_type}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'activity_type' + '}', CGI.escape(activity_type.to_s))
2291
+
2292
+ # query parameters
2293
+ query_params = opts[:query_params] || {}
2294
+
2295
+ # header parameters
2296
+ header_params = opts[:header_params] || {}
2297
+ # HTTP header 'Accept' (if needed)
2298
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
2299
+ # HTTP header 'Content-Type'
2300
+ content_type = @api_client.select_header_content_type(['application/json'])
2301
+ if !content_type.nil?
2302
+ header_params['Content-Type'] = content_type
2303
+ end
2304
+
2305
+ # form parameters
2306
+ form_params = opts[:form_params] || {}
2307
+
2308
+ # http body (model)
2309
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(start_live_activity_request)
2310
+
2311
+ # return_type
2312
+ return_type = opts[:debug_return_type] || 'StartLiveActivitySuccessResponse'
2313
+
2314
+ # auth_names
2315
+ auth_names = opts[:debug_auth_names] || ['rest_api_key']
2316
+
2317
+ new_options = opts.merge(
2318
+ :operation => :"DefaultApi.start_live_activity",
2319
+ :header_params => header_params,
2320
+ :query_params => query_params,
2321
+ :form_params => form_params,
2322
+ :body => post_body,
2323
+ :auth_names => auth_names,
2324
+ :return_type => return_type
2325
+ )
2326
+
2327
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
2328
+ if @api_client.config.debugging
2329
+ @api_client.config.logger.debug "API called: DefaultApi#start_live_activity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2330
+ end
2331
+ return data, status_code, headers
2332
+ end
2333
+
1749
2334
  # Transfers this Subscription to the User identified by the identity in the payload.
1750
2335
  # @param app_id [String]
1751
2336
  # @param subscription_id [String]
@@ -1900,6 +2485,86 @@ module OneSignal
1900
2485
  return data, status_code, headers
1901
2486
  end
1902
2487
 
2488
+ # Update API key
2489
+ # Update a Rich Authentication Token (App API Key) for a OneSignal app.
2490
+ # @param app_id [String]
2491
+ # @param token_id [String]
2492
+ # @param update_api_key_request [UpdateApiKeyRequest]
2493
+ # @param [Hash] opts the optional parameters
2494
+ # @return [Object]
2495
+ def update_api_key(app_id, token_id, update_api_key_request, opts = {})
2496
+ data, _status_code, _headers = update_api_key_with_http_info(app_id, token_id, update_api_key_request, opts)
2497
+ data
2498
+ end
2499
+
2500
+ # Update API key
2501
+ # Update a Rich Authentication Token (App API Key) for a OneSignal app.
2502
+ # @param app_id [String]
2503
+ # @param token_id [String]
2504
+ # @param update_api_key_request [UpdateApiKeyRequest]
2505
+ # @param [Hash] opts the optional parameters
2506
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
2507
+ def update_api_key_with_http_info(app_id, token_id, update_api_key_request, opts = {})
2508
+ if @api_client.config.debugging
2509
+ @api_client.config.logger.debug 'Calling API: DefaultApi.update_api_key ...'
2510
+ end
2511
+ # verify the required parameter 'app_id' is set
2512
+ if @api_client.config.client_side_validation && app_id.nil?
2513
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.update_api_key"
2514
+ end
2515
+ # verify the required parameter 'token_id' is set
2516
+ if @api_client.config.client_side_validation && token_id.nil?
2517
+ fail ArgumentError, "Missing the required parameter 'token_id' when calling DefaultApi.update_api_key"
2518
+ end
2519
+ # verify the required parameter 'update_api_key_request' is set
2520
+ if @api_client.config.client_side_validation && update_api_key_request.nil?
2521
+ fail ArgumentError, "Missing the required parameter 'update_api_key_request' when calling DefaultApi.update_api_key"
2522
+ end
2523
+ # resource path
2524
+ local_var_path = '/apps/{app_id}/auth/tokens/{token_id}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'token_id' + '}', CGI.escape(token_id.to_s))
2525
+
2526
+ # query parameters
2527
+ query_params = opts[:query_params] || {}
2528
+
2529
+ # header parameters
2530
+ header_params = opts[:header_params] || {}
2531
+ # HTTP header 'Accept' (if needed)
2532
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
2533
+ # HTTP header 'Content-Type'
2534
+ content_type = @api_client.select_header_content_type(['application/json'])
2535
+ if !content_type.nil?
2536
+ header_params['Content-Type'] = content_type
2537
+ end
2538
+
2539
+ # form parameters
2540
+ form_params = opts[:form_params] || {}
2541
+
2542
+ # http body (model)
2543
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(update_api_key_request)
2544
+
2545
+ # return_type
2546
+ return_type = opts[:debug_return_type] || 'Object'
2547
+
2548
+ # auth_names
2549
+ auth_names = opts[:debug_auth_names] || ['organization_api_key']
2550
+
2551
+ new_options = opts.merge(
2552
+ :operation => :"DefaultApi.update_api_key",
2553
+ :header_params => header_params,
2554
+ :query_params => query_params,
2555
+ :form_params => form_params,
2556
+ :body => post_body,
2557
+ :auth_names => auth_names,
2558
+ :return_type => return_type
2559
+ )
2560
+
2561
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
2562
+ if @api_client.config.debugging
2563
+ @api_client.config.logger.debug "API called: DefaultApi#update_api_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2564
+ end
2565
+ return data, status_code, headers
2566
+ end
2567
+
1903
2568
  # Update an app
1904
2569
  # Updates the name or configuration settings of an existing OneSignal app
1905
2570
  # @param app_id [String] An app id
@@ -2132,6 +2797,173 @@ module OneSignal
2132
2797
  return data, status_code, headers
2133
2798
  end
2134
2799
 
2800
+ # Update subscription by token
2801
+ # Update properties on an existing OneSignal subscription using its token.
2802
+ # @param app_id [String] Your OneSignal App ID in UUID v4 format.
2803
+ # @param token_type [String] The type of token to use when looking up the subscription. See Subscription Types.
2804
+ # @param token [String] The value of the token to lookup by (e.g., email address, phone number).
2805
+ # @param subscription_body [SubscriptionBody]
2806
+ # @param [Hash] opts the optional parameters
2807
+ # @return [Object]
2808
+ def update_subscription_by_token(app_id, token_type, token, subscription_body, opts = {})
2809
+ data, _status_code, _headers = update_subscription_by_token_with_http_info(app_id, token_type, token, subscription_body, opts)
2810
+ data
2811
+ end
2812
+
2813
+ # Update subscription by token
2814
+ # Update properties on an existing OneSignal subscription using its token.
2815
+ # @param app_id [String] Your OneSignal App ID in UUID v4 format.
2816
+ # @param token_type [String] The type of token to use when looking up the subscription. See Subscription Types.
2817
+ # @param token [String] The value of the token to lookup by (e.g., email address, phone number).
2818
+ # @param subscription_body [SubscriptionBody]
2819
+ # @param [Hash] opts the optional parameters
2820
+ # @return [Array<(Object, Integer, Hash)>] Object data, response status code and response headers
2821
+ def update_subscription_by_token_with_http_info(app_id, token_type, token, subscription_body, opts = {})
2822
+ if @api_client.config.debugging
2823
+ @api_client.config.logger.debug 'Calling API: DefaultApi.update_subscription_by_token ...'
2824
+ end
2825
+ # verify the required parameter 'app_id' is set
2826
+ if @api_client.config.client_side_validation && app_id.nil?
2827
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.update_subscription_by_token"
2828
+ end
2829
+ # verify the required parameter 'token_type' is set
2830
+ if @api_client.config.client_side_validation && token_type.nil?
2831
+ fail ArgumentError, "Missing the required parameter 'token_type' when calling DefaultApi.update_subscription_by_token"
2832
+ end
2833
+ # verify the required parameter 'token' is set
2834
+ if @api_client.config.client_side_validation && token.nil?
2835
+ fail ArgumentError, "Missing the required parameter 'token' when calling DefaultApi.update_subscription_by_token"
2836
+ end
2837
+ # verify the required parameter 'subscription_body' is set
2838
+ if @api_client.config.client_side_validation && subscription_body.nil?
2839
+ fail ArgumentError, "Missing the required parameter 'subscription_body' when calling DefaultApi.update_subscription_by_token"
2840
+ end
2841
+ # resource path
2842
+ local_var_path = '/apps/{app_id}/subscriptions_by_token/{token_type}/{token}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'token_type' + '}', CGI.escape(token_type.to_s)).sub('{' + 'token' + '}', CGI.escape(token.to_s))
2843
+
2844
+ # query parameters
2845
+ query_params = opts[:query_params] || {}
2846
+
2847
+ # header parameters
2848
+ header_params = opts[:header_params] || {}
2849
+ # HTTP header 'Accept' (if needed)
2850
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
2851
+ # HTTP header 'Content-Type'
2852
+ content_type = @api_client.select_header_content_type(['application/json'])
2853
+ if !content_type.nil?
2854
+ header_params['Content-Type'] = content_type
2855
+ end
2856
+
2857
+ # form parameters
2858
+ form_params = opts[:form_params] || {}
2859
+
2860
+ # http body (model)
2861
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(subscription_body)
2862
+
2863
+ # return_type
2864
+ return_type = opts[:debug_return_type] || 'Object'
2865
+
2866
+ # auth_names
2867
+ auth_names = opts[:debug_auth_names] || ['rest_api_key']
2868
+
2869
+ new_options = opts.merge(
2870
+ :operation => :"DefaultApi.update_subscription_by_token",
2871
+ :header_params => header_params,
2872
+ :query_params => query_params,
2873
+ :form_params => form_params,
2874
+ :body => post_body,
2875
+ :auth_names => auth_names,
2876
+ :return_type => return_type
2877
+ )
2878
+
2879
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
2880
+ if @api_client.config.debugging
2881
+ @api_client.config.logger.debug "API called: DefaultApi#update_subscription_by_token\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2882
+ end
2883
+ return data, status_code, headers
2884
+ end
2885
+
2886
+ # Update template
2887
+ # Update an existing template.
2888
+ # @param template_id [String]
2889
+ # @param app_id [String]
2890
+ # @param update_template_request [UpdateTemplateRequest]
2891
+ # @param [Hash] opts the optional parameters
2892
+ # @return [TemplateResource]
2893
+ def update_template(template_id, app_id, update_template_request, opts = {})
2894
+ data, _status_code, _headers = update_template_with_http_info(template_id, app_id, update_template_request, opts)
2895
+ data
2896
+ end
2897
+
2898
+ # Update template
2899
+ # Update an existing template.
2900
+ # @param template_id [String]
2901
+ # @param app_id [String]
2902
+ # @param update_template_request [UpdateTemplateRequest]
2903
+ # @param [Hash] opts the optional parameters
2904
+ # @return [Array<(TemplateResource, Integer, Hash)>] TemplateResource data, response status code and response headers
2905
+ def update_template_with_http_info(template_id, app_id, update_template_request, opts = {})
2906
+ if @api_client.config.debugging
2907
+ @api_client.config.logger.debug 'Calling API: DefaultApi.update_template ...'
2908
+ end
2909
+ # verify the required parameter 'template_id' is set
2910
+ if @api_client.config.client_side_validation && template_id.nil?
2911
+ fail ArgumentError, "Missing the required parameter 'template_id' when calling DefaultApi.update_template"
2912
+ end
2913
+ # verify the required parameter 'app_id' is set
2914
+ if @api_client.config.client_side_validation && app_id.nil?
2915
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.update_template"
2916
+ end
2917
+ # verify the required parameter 'update_template_request' is set
2918
+ if @api_client.config.client_side_validation && update_template_request.nil?
2919
+ fail ArgumentError, "Missing the required parameter 'update_template_request' when calling DefaultApi.update_template"
2920
+ end
2921
+ # resource path
2922
+ local_var_path = '/templates/{template_id}'.sub('{' + 'template_id' + '}', CGI.escape(template_id.to_s))
2923
+
2924
+ # query parameters
2925
+ query_params = opts[:query_params] || {}
2926
+ query_params[:'app_id'] = app_id
2927
+
2928
+ # header parameters
2929
+ header_params = opts[:header_params] || {}
2930
+ # HTTP header 'Accept' (if needed)
2931
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
2932
+ # HTTP header 'Content-Type'
2933
+ content_type = @api_client.select_header_content_type(['application/json'])
2934
+ if !content_type.nil?
2935
+ header_params['Content-Type'] = content_type
2936
+ end
2937
+
2938
+ # form parameters
2939
+ form_params = opts[:form_params] || {}
2940
+
2941
+ # http body (model)
2942
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(update_template_request)
2943
+
2944
+ # return_type
2945
+ return_type = opts[:debug_return_type] || 'TemplateResource'
2946
+
2947
+ # auth_names
2948
+ auth_names = opts[:debug_auth_names] || ['rest_api_key']
2949
+
2950
+ new_options = opts.merge(
2951
+ :operation => :"DefaultApi.update_template",
2952
+ :header_params => header_params,
2953
+ :query_params => query_params,
2954
+ :form_params => form_params,
2955
+ :body => post_body,
2956
+ :auth_names => auth_names,
2957
+ :return_type => return_type
2958
+ )
2959
+
2960
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
2961
+ if @api_client.config.debugging
2962
+ @api_client.config.logger.debug "API called: DefaultApi#update_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2963
+ end
2964
+ return data, status_code, headers
2965
+ end
2966
+
2135
2967
  # Updates an existing User’s properties.
2136
2968
  # @param app_id [String]
2137
2969
  # @param alias_label [String]
@@ -2215,5 +3047,215 @@ module OneSignal
2215
3047
  end
2216
3048
  return data, status_code, headers
2217
3049
  end
3050
+
3051
+ # View API keys
3052
+ # View the details of all of your current app API keys (Rich Authentication Token) for a single OneSignal app.
3053
+ # @param app_id [String]
3054
+ # @param [Hash] opts the optional parameters
3055
+ # @return [ApiKeyTokensListResponse]
3056
+ def view_api_keys(app_id, opts = {})
3057
+ data, _status_code, _headers = view_api_keys_with_http_info(app_id, opts)
3058
+ data
3059
+ end
3060
+
3061
+ # View API keys
3062
+ # View the details of all of your current app API keys (Rich Authentication Token) for a single OneSignal app.
3063
+ # @param app_id [String]
3064
+ # @param [Hash] opts the optional parameters
3065
+ # @return [Array<(ApiKeyTokensListResponse, Integer, Hash)>] ApiKeyTokensListResponse data, response status code and response headers
3066
+ def view_api_keys_with_http_info(app_id, opts = {})
3067
+ if @api_client.config.debugging
3068
+ @api_client.config.logger.debug 'Calling API: DefaultApi.view_api_keys ...'
3069
+ end
3070
+ # verify the required parameter 'app_id' is set
3071
+ if @api_client.config.client_side_validation && app_id.nil?
3072
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.view_api_keys"
3073
+ end
3074
+ # resource path
3075
+ local_var_path = '/apps/{app_id}/auth/tokens'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s))
3076
+
3077
+ # query parameters
3078
+ query_params = opts[:query_params] || {}
3079
+
3080
+ # header parameters
3081
+ header_params = opts[:header_params] || {}
3082
+ # HTTP header 'Accept' (if needed)
3083
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
3084
+
3085
+ # form parameters
3086
+ form_params = opts[:form_params] || {}
3087
+
3088
+ # http body (model)
3089
+ post_body = opts[:debug_body]
3090
+
3091
+ # return_type
3092
+ return_type = opts[:debug_return_type] || 'ApiKeyTokensListResponse'
3093
+
3094
+ # auth_names
3095
+ auth_names = opts[:debug_auth_names] || ['organization_api_key']
3096
+
3097
+ new_options = opts.merge(
3098
+ :operation => :"DefaultApi.view_api_keys",
3099
+ :header_params => header_params,
3100
+ :query_params => query_params,
3101
+ :form_params => form_params,
3102
+ :body => post_body,
3103
+ :auth_names => auth_names,
3104
+ :return_type => return_type
3105
+ )
3106
+
3107
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
3108
+ if @api_client.config.debugging
3109
+ @api_client.config.logger.debug "API called: DefaultApi#view_api_keys\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
3110
+ end
3111
+ return data, status_code, headers
3112
+ end
3113
+
3114
+ # View template
3115
+ # Fetch a single template by id.
3116
+ # @param template_id [String]
3117
+ # @param app_id [String]
3118
+ # @param [Hash] opts the optional parameters
3119
+ # @return [TemplateResource]
3120
+ def view_template(template_id, app_id, opts = {})
3121
+ data, _status_code, _headers = view_template_with_http_info(template_id, app_id, opts)
3122
+ data
3123
+ end
3124
+
3125
+ # View template
3126
+ # Fetch a single template by id.
3127
+ # @param template_id [String]
3128
+ # @param app_id [String]
3129
+ # @param [Hash] opts the optional parameters
3130
+ # @return [Array<(TemplateResource, Integer, Hash)>] TemplateResource data, response status code and response headers
3131
+ def view_template_with_http_info(template_id, app_id, opts = {})
3132
+ if @api_client.config.debugging
3133
+ @api_client.config.logger.debug 'Calling API: DefaultApi.view_template ...'
3134
+ end
3135
+ # verify the required parameter 'template_id' is set
3136
+ if @api_client.config.client_side_validation && template_id.nil?
3137
+ fail ArgumentError, "Missing the required parameter 'template_id' when calling DefaultApi.view_template"
3138
+ end
3139
+ # verify the required parameter 'app_id' is set
3140
+ if @api_client.config.client_side_validation && app_id.nil?
3141
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.view_template"
3142
+ end
3143
+ # resource path
3144
+ local_var_path = '/templates/{template_id}'.sub('{' + 'template_id' + '}', CGI.escape(template_id.to_s))
3145
+
3146
+ # query parameters
3147
+ query_params = opts[:query_params] || {}
3148
+ query_params[:'app_id'] = app_id
3149
+
3150
+ # header parameters
3151
+ header_params = opts[:header_params] || {}
3152
+ # HTTP header 'Accept' (if needed)
3153
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
3154
+
3155
+ # form parameters
3156
+ form_params = opts[:form_params] || {}
3157
+
3158
+ # http body (model)
3159
+ post_body = opts[:debug_body]
3160
+
3161
+ # return_type
3162
+ return_type = opts[:debug_return_type] || 'TemplateResource'
3163
+
3164
+ # auth_names
3165
+ auth_names = opts[:debug_auth_names] || ['rest_api_key']
3166
+
3167
+ new_options = opts.merge(
3168
+ :operation => :"DefaultApi.view_template",
3169
+ :header_params => header_params,
3170
+ :query_params => query_params,
3171
+ :form_params => form_params,
3172
+ :body => post_body,
3173
+ :auth_names => auth_names,
3174
+ :return_type => return_type
3175
+ )
3176
+
3177
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
3178
+ if @api_client.config.debugging
3179
+ @api_client.config.logger.debug "API called: DefaultApi#view_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
3180
+ end
3181
+ return data, status_code, headers
3182
+ end
3183
+
3184
+ # View templates
3185
+ # List templates for an app.
3186
+ # @param app_id [String] Your OneSignal App ID in UUID v4 format.
3187
+ # @param [Hash] opts the optional parameters
3188
+ # @option opts [Integer] :limit Maximum number of templates. Default and max is 50. (default to 50)
3189
+ # @option opts [Integer] :offset Pagination offset. (default to 0)
3190
+ # @option opts [String] :channel Filter by delivery channel.
3191
+ # @return [TemplatesListResponse]
3192
+ def view_templates(app_id, opts = {})
3193
+ data, _status_code, _headers = view_templates_with_http_info(app_id, opts)
3194
+ data
3195
+ end
3196
+
3197
+ # View templates
3198
+ # List templates for an app.
3199
+ # @param app_id [String] Your OneSignal App ID in UUID v4 format.
3200
+ # @param [Hash] opts the optional parameters
3201
+ # @option opts [Integer] :limit Maximum number of templates. Default and max is 50. (default to 50)
3202
+ # @option opts [Integer] :offset Pagination offset. (default to 0)
3203
+ # @option opts [String] :channel Filter by delivery channel.
3204
+ # @return [Array<(TemplatesListResponse, Integer, Hash)>] TemplatesListResponse data, response status code and response headers
3205
+ def view_templates_with_http_info(app_id, opts = {})
3206
+ if @api_client.config.debugging
3207
+ @api_client.config.logger.debug 'Calling API: DefaultApi.view_templates ...'
3208
+ end
3209
+ # verify the required parameter 'app_id' is set
3210
+ if @api_client.config.client_side_validation && app_id.nil?
3211
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.view_templates"
3212
+ end
3213
+ allowable_values = ["push", "email", "sms"]
3214
+ if @api_client.config.client_side_validation && opts[:'channel'] && !allowable_values.include?(opts[:'channel'])
3215
+ fail ArgumentError, "invalid value for \"channel\", must be one of #{allowable_values}"
3216
+ end
3217
+ # resource path
3218
+ local_var_path = '/templates'
3219
+
3220
+ # query parameters
3221
+ query_params = opts[:query_params] || {}
3222
+ query_params[:'app_id'] = app_id
3223
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
3224
+ query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
3225
+ query_params[:'channel'] = opts[:'channel'] if !opts[:'channel'].nil?
3226
+
3227
+ # header parameters
3228
+ header_params = opts[:header_params] || {}
3229
+ # HTTP header 'Accept' (if needed)
3230
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
3231
+
3232
+ # form parameters
3233
+ form_params = opts[:form_params] || {}
3234
+
3235
+ # http body (model)
3236
+ post_body = opts[:debug_body]
3237
+
3238
+ # return_type
3239
+ return_type = opts[:debug_return_type] || 'TemplatesListResponse'
3240
+
3241
+ # auth_names
3242
+ auth_names = opts[:debug_auth_names] || ['rest_api_key']
3243
+
3244
+ new_options = opts.merge(
3245
+ :operation => :"DefaultApi.view_templates",
3246
+ :header_params => header_params,
3247
+ :query_params => query_params,
3248
+ :form_params => form_params,
3249
+ :body => post_body,
3250
+ :auth_names => auth_names,
3251
+ :return_type => return_type
3252
+ )
3253
+
3254
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
3255
+ if @api_client.config.debugging
3256
+ @api_client.config.logger.debug "API called: DefaultApi#view_templates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
3257
+ end
3258
+ return data, status_code, headers
3259
+ end
2218
3260
  end
2219
3261
  end