onesignal 0.3.0 → 1.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +6 -1
  3. data/README.md +126 -111
  4. data/Rakefile +8 -8
  5. data/docs/App.md +76 -0
  6. data/docs/Button.md +22 -0
  7. data/docs/DefaultApi.md +1394 -0
  8. data/docs/DeliveryData.md +26 -0
  9. data/docs/ExportPlayersRequestBody.md +22 -0
  10. data/docs/Filter.md +24 -0
  11. data/docs/FilterExpressions.md +26 -0
  12. data/docs/FilterNotificationTarget.md +40 -0
  13. data/docs/GetNotificationRequestBody.md +22 -0
  14. data/docs/InlineResponse200.md +24 -0
  15. data/docs/InlineResponse2001.md +18 -0
  16. data/docs/InlineResponse2002.md +20 -0
  17. data/docs/InlineResponse2003.md +18 -0
  18. data/docs/InlineResponse2004.md +20 -0
  19. data/docs/InlineResponse2005.md +18 -0
  20. data/docs/InlineResponse201.md +20 -0
  21. data/docs/InlineResponse400.md +18 -0
  22. data/docs/InlineResponse4001.md +20 -0
  23. data/docs/InlineResponse4002.md +18 -0
  24. data/docs/InlineResponse409.md +20 -0
  25. data/docs/Notification.md +240 -0
  26. data/docs/NotificationAllOf.md +192 -0
  27. data/docs/NotificationAllOfAndroidBackgroundLayout.md +22 -0
  28. data/docs/NotificationSlice.md +24 -0
  29. data/docs/NotificationTarget.md +64 -0
  30. data/docs/Operator.md +18 -0
  31. data/docs/OutcomeData.md +22 -0
  32. data/docs/PlatformDeliveryData.md +28 -0
  33. data/docs/Player.md +70 -0
  34. data/docs/PlayerNotificationTarget.md +36 -0
  35. data/docs/PlayerSlice.md +24 -0
  36. data/docs/Purchase.md +22 -0
  37. data/docs/Segment.md +22 -0
  38. data/docs/SegmentNotificationTarget.md +20 -0
  39. data/docs/StringMap.md +102 -0
  40. data/docs/UpdatePlayerTagsRequestBody.md +18 -0
  41. data/git_push.sh +58 -0
  42. data/lib/OneSignal.rb +75 -0
  43. data/lib/onesignal/api/default_api.rb +1338 -0
  44. data/lib/onesignal/api_client.rb +391 -0
  45. data/lib/onesignal/api_error.rb +57 -0
  46. data/lib/onesignal/configuration.rb +242 -0
  47. data/lib/onesignal/models/app.rb +519 -13
  48. data/lib/onesignal/models/button.rb +241 -0
  49. data/lib/onesignal/models/delivery_data.rb +254 -0
  50. data/lib/onesignal/models/export_players_request_body.rb +241 -0
  51. data/lib/onesignal/models/filter.rb +293 -0
  52. data/lib/onesignal/models/filter_expressions.rb +335 -0
  53. data/lib/onesignal/models/filter_notification_target.rb +329 -0
  54. data/lib/onesignal/models/get_notification_request_body.rb +272 -0
  55. data/lib/onesignal/models/inline_response200.rb +256 -0
  56. data/lib/onesignal/models/inline_response2001.rb +218 -0
  57. data/lib/onesignal/models/inline_response2002.rb +227 -0
  58. data/lib/onesignal/models/inline_response2003.rb +218 -0
  59. data/lib/onesignal/models/inline_response2004.rb +227 -0
  60. data/lib/onesignal/models/inline_response2005.rb +218 -0
  61. data/lib/onesignal/models/inline_response201.rb +228 -0
  62. data/lib/onesignal/models/inline_response400.rb +220 -0
  63. data/lib/onesignal/models/inline_response4001.rb +229 -0
  64. data/lib/onesignal/models/inline_response4002.rb +220 -0
  65. data/lib/onesignal/models/inline_response409.rb +229 -0
  66. data/lib/onesignal/models/notification.rb +1395 -5
  67. data/lib/onesignal/models/notification_all_of.rb +1124 -0
  68. data/lib/onesignal/models/notification_all_of_android_background_layout.rb +240 -0
  69. data/lib/onesignal/models/notification_slice.rb +247 -0
  70. data/lib/onesignal/models/notification_target.rb +494 -0
  71. data/lib/onesignal/models/operator.rb +253 -0
  72. data/lib/onesignal/models/outcome_data.rb +285 -0
  73. data/lib/onesignal/models/platform_delivery_data.rb +264 -0
  74. data/lib/onesignal/models/player.rb +483 -9
  75. data/lib/onesignal/models/player_notification_target.rb +329 -0
  76. data/lib/onesignal/models/player_slice.rb +247 -0
  77. data/lib/onesignal/models/purchase.rb +254 -0
  78. data/lib/onesignal/models/segment.rb +251 -0
  79. data/lib/onesignal/models/segment_notification_target.rb +233 -0
  80. data/lib/onesignal/models/string_map.rb +644 -0
  81. data/lib/onesignal/models/update_player_tags_request_body.rb +219 -0
  82. data/lib/onesignal/version.rb +13 -1
  83. data/onesignal.gemspec +36 -27
  84. data/spec/api/default_api_spec.rb +285 -0
  85. data/spec/api_client_spec.rb +226 -0
  86. data/spec/configuration_spec.rb +42 -0
  87. data/spec/models/app_spec.rb +212 -0
  88. data/spec/models/button_spec.rb +46 -0
  89. data/spec/models/delivery_data_spec.rb +58 -0
  90. data/spec/models/export_players_request_body_spec.rb +46 -0
  91. data/spec/models/filter_expressions_spec.rb +66 -0
  92. data/spec/models/filter_notification_target_spec.rb +100 -0
  93. data/spec/models/filter_spec.rb +56 -0
  94. data/spec/models/get_notification_request_body_spec.rb +50 -0
  95. data/spec/models/inline_response2001_spec.rb +34 -0
  96. data/spec/models/inline_response2002_spec.rb +40 -0
  97. data/spec/models/inline_response2003_spec.rb +34 -0
  98. data/spec/models/inline_response2004_spec.rb +40 -0
  99. data/spec/models/inline_response2005_spec.rb +34 -0
  100. data/spec/models/inline_response200_spec.rb +52 -0
  101. data/spec/models/inline_response201_spec.rb +40 -0
  102. data/spec/models/inline_response4001_spec.rb +40 -0
  103. data/spec/models/inline_response4002_spec.rb +34 -0
  104. data/spec/models/inline_response400_spec.rb +34 -0
  105. data/spec/models/inline_response409_spec.rb +40 -0
  106. data/spec/models/notification_all_of_android_background_layout_spec.rb +46 -0
  107. data/spec/models/notification_all_of_spec.rb +560 -0
  108. data/spec/models/notification_slice_spec.rb +52 -0
  109. data/spec/models/notification_spec.rb +704 -0
  110. data/spec/models/notification_target_spec.rb +172 -0
  111. data/spec/models/operator_spec.rb +38 -0
  112. data/spec/models/outcome_data_spec.rb +50 -0
  113. data/spec/models/platform_delivery_data_spec.rb +64 -0
  114. data/spec/models/player_notification_target_spec.rb +88 -0
  115. data/spec/models/player_slice_spec.rb +52 -0
  116. data/spec/models/player_spec.rb +190 -0
  117. data/spec/models/purchase_spec.rb +46 -0
  118. data/spec/models/segment_notification_target_spec.rb +40 -0
  119. data/spec/models/segment_spec.rb +46 -0
  120. data/spec/models/string_map_spec.rb +286 -0
  121. data/spec/models/update_player_tags_request_body_spec.rb +34 -0
  122. data/spec/spec_helper.rb +111 -0
  123. metadata +182 -65
  124. data/.gitignore +0 -10
  125. data/.rubocop.yml +0 -17
  126. data/.travis.yml +0 -16
  127. data/CHANGELOG.md +0 -22
  128. data/CODE_OF_CONDUCT.md +0 -49
  129. data/LICENSE +0 -21
  130. data/bin/console +0 -14
  131. data/bin/setup +0 -8
  132. data/lib/onesignal/app_id_missing_error.rb +0 -7
  133. data/lib/onesignal/client.rb +0 -44
  134. data/lib/onesignal/models/base_model.rb +0 -40
  135. data/lib/onesignal/request.rb +0 -94
  136. data/lib/onesignal/request_error.rb +0 -21
  137. data/lib/onesignal/resources/app_resource.rb +0 -27
  138. data/lib/onesignal/resources/base_resource.rb +0 -35
  139. data/lib/onesignal/resources/notification_resource.rb +0 -33
  140. data/lib/onesignal/resources/player_resource.rb +0 -53
  141. data/lib/onesignal.rb +0 -23
@@ -0,0 +1,1338 @@
1
+ =begin
2
+ #OneSignal
3
+
4
+ #A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: devrel@onesignal.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.2.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module OneSignal
16
+ class DefaultApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Stop a scheduled or currently outgoing notification
23
+ # Used to stop a scheduled or currently outgoing notification
24
+ # @param app_id [String]
25
+ # @param notification_id [String]
26
+ # @param [Hash] opts the optional parameters
27
+ # @return [InlineResponse2001]
28
+ def cancel_notification(app_id, notification_id, opts = {})
29
+ data, _status_code, _headers = cancel_notification_with_http_info(app_id, notification_id, opts)
30
+ data
31
+ end
32
+
33
+ # Stop a scheduled or currently outgoing notification
34
+ # Used to stop a scheduled or currently outgoing notification
35
+ # @param app_id [String]
36
+ # @param notification_id [String]
37
+ # @param [Hash] opts the optional parameters
38
+ # @return [Array<(InlineResponse2001, Integer, Hash)>] InlineResponse2001 data, response status code and response headers
39
+ def cancel_notification_with_http_info(app_id, notification_id, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: DefaultApi.cancel_notification ...'
42
+ end
43
+ # verify the required parameter 'app_id' is set
44
+ if @api_client.config.client_side_validation && app_id.nil?
45
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.cancel_notification"
46
+ end
47
+ # verify the required parameter 'notification_id' is set
48
+ if @api_client.config.client_side_validation && notification_id.nil?
49
+ fail ArgumentError, "Missing the required parameter 'notification_id' when calling DefaultApi.cancel_notification"
50
+ end
51
+ # resource path
52
+ local_var_path = '/notifications/{notification_id}'.sub('{' + 'notification_id' + '}', CGI.escape(notification_id.to_s))
53
+
54
+ # query parameters
55
+ query_params = opts[:query_params] || {}
56
+ query_params[:'app_id'] = app_id
57
+
58
+ # header parameters
59
+ header_params = opts[:header_params] || {}
60
+ # HTTP header 'Accept' (if needed)
61
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
62
+
63
+ # form parameters
64
+ form_params = opts[:form_params] || {}
65
+
66
+ # http body (model)
67
+ post_body = opts[:debug_body]
68
+
69
+ # return_type
70
+ return_type = opts[:debug_return_type] || 'InlineResponse2001'
71
+
72
+ # auth_names
73
+ auth_names = opts[:debug_auth_names] || ['app_key']
74
+
75
+ new_options = opts.merge(
76
+ :operation => :"DefaultApi.cancel_notification",
77
+ :header_params => header_params,
78
+ :query_params => query_params,
79
+ :form_params => form_params,
80
+ :body => post_body,
81
+ :auth_names => auth_names,
82
+ :return_type => return_type
83
+ )
84
+
85
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
86
+ if @api_client.config.debugging
87
+ @api_client.config.logger.debug "API called: DefaultApi#cancel_notification\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
88
+ end
89
+ return data, status_code, headers
90
+ end
91
+
92
+ # Create an app
93
+ # Creates a new OneSignal app
94
+ # @param app [App]
95
+ # @param [Hash] opts the optional parameters
96
+ # @return [App]
97
+ def create_app(app, opts = {})
98
+ data, _status_code, _headers = create_app_with_http_info(app, opts)
99
+ data
100
+ end
101
+
102
+ # Create an app
103
+ # Creates a new OneSignal app
104
+ # @param app [App]
105
+ # @param [Hash] opts the optional parameters
106
+ # @return [Array<(App, Integer, Hash)>] App data, response status code and response headers
107
+ def create_app_with_http_info(app, opts = {})
108
+ if @api_client.config.debugging
109
+ @api_client.config.logger.debug 'Calling API: DefaultApi.create_app ...'
110
+ end
111
+ # verify the required parameter 'app' is set
112
+ if @api_client.config.client_side_validation && app.nil?
113
+ fail ArgumentError, "Missing the required parameter 'app' when calling DefaultApi.create_app"
114
+ end
115
+ # resource path
116
+ local_var_path = '/apps'
117
+
118
+ # query parameters
119
+ query_params = opts[:query_params] || {}
120
+
121
+ # header parameters
122
+ header_params = opts[:header_params] || {}
123
+ # HTTP header 'Accept' (if needed)
124
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
125
+ # HTTP header 'Content-Type'
126
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
127
+
128
+ # form parameters
129
+ form_params = opts[:form_params] || {}
130
+
131
+ # http body (model)
132
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(app)
133
+
134
+ # return_type
135
+ return_type = opts[:debug_return_type] || 'App'
136
+
137
+ # auth_names
138
+ auth_names = opts[:debug_auth_names] || ['user_key']
139
+
140
+ new_options = opts.merge(
141
+ :operation => :"DefaultApi.create_app",
142
+ :header_params => header_params,
143
+ :query_params => query_params,
144
+ :form_params => form_params,
145
+ :body => post_body,
146
+ :auth_names => auth_names,
147
+ :return_type => return_type
148
+ )
149
+
150
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
151
+ if @api_client.config.debugging
152
+ @api_client.config.logger.debug "API called: DefaultApi#create_app\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
153
+ end
154
+ return data, status_code, headers
155
+ end
156
+
157
+ # Create notification
158
+ # Sends notifications to your users
159
+ # @param notification [Notification]
160
+ # @param [Hash] opts the optional parameters
161
+ # @return [InlineResponse200]
162
+ def create_notification(notification, opts = {})
163
+ data, _status_code, _headers = create_notification_with_http_info(notification, opts)
164
+ data
165
+ end
166
+
167
+ # Create notification
168
+ # Sends notifications to your users
169
+ # @param notification [Notification]
170
+ # @param [Hash] opts the optional parameters
171
+ # @return [Array<(InlineResponse200, Integer, Hash)>] InlineResponse200 data, response status code and response headers
172
+ def create_notification_with_http_info(notification, opts = {})
173
+ if @api_client.config.debugging
174
+ @api_client.config.logger.debug 'Calling API: DefaultApi.create_notification ...'
175
+ end
176
+ # verify the required parameter 'notification' is set
177
+ if @api_client.config.client_side_validation && notification.nil?
178
+ fail ArgumentError, "Missing the required parameter 'notification' when calling DefaultApi.create_notification"
179
+ end
180
+ # resource path
181
+ local_var_path = '/notifications'
182
+
183
+ # query parameters
184
+ query_params = opts[:query_params] || {}
185
+
186
+ # header parameters
187
+ header_params = opts[:header_params] || {}
188
+ # HTTP header 'Accept' (if needed)
189
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
190
+ # HTTP header 'Content-Type'
191
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
192
+
193
+ # form parameters
194
+ form_params = opts[:form_params] || {}
195
+
196
+ # http body (model)
197
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(notification)
198
+
199
+ # return_type
200
+ return_type = opts[:debug_return_type] || 'InlineResponse200'
201
+
202
+ # auth_names
203
+ auth_names = opts[:debug_auth_names] || ['app_key']
204
+
205
+ new_options = opts.merge(
206
+ :operation => :"DefaultApi.create_notification",
207
+ :header_params => header_params,
208
+ :query_params => query_params,
209
+ :form_params => form_params,
210
+ :body => post_body,
211
+ :auth_names => auth_names,
212
+ :return_type => return_type
213
+ )
214
+
215
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
216
+ if @api_client.config.debugging
217
+ @api_client.config.logger.debug "API called: DefaultApi#create_notification\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
218
+ end
219
+ return data, status_code, headers
220
+ end
221
+
222
+ # Add a device
223
+ # Register a new device to one of your OneSignal apps 🚧 Don't use this This API endpoint is designed to be used from our open source Mobile and Web Push SDKs. It is not designed for developers to use it directly, unless instructed to do so by OneSignal support. If you use this method instead of our SDKs, many OneSignal features such as conversion tracking, timezone tracking, language detection, and rich-push won't work out of the box. It will also make it harder to identify possible setup issues. This method is used to register a new device with OneSignal. If a device is already registered with the specified identifier, then this will update the existing device record instead of creating a new one. The returned player is a player / user ID. Use the returned ID to send push notifications to this specific user later, or to include this player when sending to a set of users. 🚧 iOS Must set test_type to 1 when building your iOS app as development. Omit this field in your production app builds.
224
+ # @param player [Player]
225
+ # @param [Hash] opts the optional parameters
226
+ # @return [InlineResponse2004]
227
+ def create_player(player, opts = {})
228
+ data, _status_code, _headers = create_player_with_http_info(player, opts)
229
+ data
230
+ end
231
+
232
+ # Add a device
233
+ # Register a new device to one of your OneSignal apps 🚧 Don&#39;t use this This API endpoint is designed to be used from our open source Mobile and Web Push SDKs. It is not designed for developers to use it directly, unless instructed to do so by OneSignal support. If you use this method instead of our SDKs, many OneSignal features such as conversion tracking, timezone tracking, language detection, and rich-push won&#39;t work out of the box. It will also make it harder to identify possible setup issues. This method is used to register a new device with OneSignal. If a device is already registered with the specified identifier, then this will update the existing device record instead of creating a new one. The returned player is a player / user ID. Use the returned ID to send push notifications to this specific user later, or to include this player when sending to a set of users. 🚧 iOS Must set test_type to 1 when building your iOS app as development. Omit this field in your production app builds.
234
+ # @param player [Player]
235
+ # @param [Hash] opts the optional parameters
236
+ # @return [Array<(InlineResponse2004, Integer, Hash)>] InlineResponse2004 data, response status code and response headers
237
+ def create_player_with_http_info(player, opts = {})
238
+ if @api_client.config.debugging
239
+ @api_client.config.logger.debug 'Calling API: DefaultApi.create_player ...'
240
+ end
241
+ # verify the required parameter 'player' is set
242
+ if @api_client.config.client_side_validation && player.nil?
243
+ fail ArgumentError, "Missing the required parameter 'player' when calling DefaultApi.create_player"
244
+ end
245
+ # resource path
246
+ local_var_path = '/players'
247
+
248
+ # query parameters
249
+ query_params = opts[:query_params] || {}
250
+
251
+ # header parameters
252
+ header_params = opts[:header_params] || {}
253
+ # HTTP header 'Accept' (if needed)
254
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
255
+ # HTTP header 'Content-Type'
256
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
257
+
258
+ # form parameters
259
+ form_params = opts[:form_params] || {}
260
+
261
+ # http body (model)
262
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(player)
263
+
264
+ # return_type
265
+ return_type = opts[:debug_return_type] || 'InlineResponse2004'
266
+
267
+ # auth_names
268
+ auth_names = opts[:debug_auth_names] || ['app_key']
269
+
270
+ new_options = opts.merge(
271
+ :operation => :"DefaultApi.create_player",
272
+ :header_params => header_params,
273
+ :query_params => query_params,
274
+ :form_params => form_params,
275
+ :body => post_body,
276
+ :auth_names => auth_names,
277
+ :return_type => return_type
278
+ )
279
+
280
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
281
+ if @api_client.config.debugging
282
+ @api_client.config.logger.debug "API called: DefaultApi#create_player\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
283
+ end
284
+ return data, status_code, headers
285
+ end
286
+
287
+ # Create Segments
288
+ # Create segments visible and usable in the dashboard and API - Required: OneSignal Paid Plan The Create Segment method is used when you want your server to programmatically create a segment instead of using the OneSignal Dashboard UI. Just like creating Segments from the dashboard you can pass in filters with multiple \"AND\" or \"OR\" operator's. 🚧 Does Not Update Segments This endpoint will only create segments, it does not edit or update currently created Segments. You will need to use the Delete Segments endpoint and re-create it with this endpoint to edit.
289
+ # @param app_id [String] The OneSignal App ID for your app. Available in Keys &amp; IDs.
290
+ # @param [Hash] opts the optional parameters
291
+ # @option opts [Segment] :segment
292
+ # @return [InlineResponse201]
293
+ def create_segments(app_id, opts = {})
294
+ data, _status_code, _headers = create_segments_with_http_info(app_id, opts)
295
+ data
296
+ end
297
+
298
+ # Create Segments
299
+ # Create segments visible and usable in the dashboard and API - Required: OneSignal Paid Plan The Create Segment method is used when you want your server to programmatically create a segment instead of using the OneSignal Dashboard UI. Just like creating Segments from the dashboard you can pass in filters with multiple \&quot;AND\&quot; or \&quot;OR\&quot; operator&#39;s. 🚧 Does Not Update Segments This endpoint will only create segments, it does not edit or update currently created Segments. You will need to use the Delete Segments endpoint and re-create it with this endpoint to edit.
300
+ # @param app_id [String] The OneSignal App ID for your app. Available in Keys &amp; IDs.
301
+ # @param [Hash] opts the optional parameters
302
+ # @option opts [Segment] :segment
303
+ # @return [Array<(InlineResponse201, Integer, Hash)>] InlineResponse201 data, response status code and response headers
304
+ def create_segments_with_http_info(app_id, opts = {})
305
+ if @api_client.config.debugging
306
+ @api_client.config.logger.debug 'Calling API: DefaultApi.create_segments ...'
307
+ end
308
+ # verify the required parameter 'app_id' is set
309
+ if @api_client.config.client_side_validation && app_id.nil?
310
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.create_segments"
311
+ end
312
+ # resource path
313
+ local_var_path = '/apps/{app_id}/segments'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s))
314
+
315
+ # query parameters
316
+ query_params = opts[:query_params] || {}
317
+
318
+ # header parameters
319
+ header_params = opts[:header_params] || {}
320
+ # HTTP header 'Accept' (if needed)
321
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
322
+ # HTTP header 'Content-Type'
323
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
324
+
325
+ # form parameters
326
+ form_params = opts[:form_params] || {}
327
+
328
+ # http body (model)
329
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'segment'])
330
+
331
+ # return_type
332
+ return_type = opts[:debug_return_type] || 'InlineResponse201'
333
+
334
+ # auth_names
335
+ auth_names = opts[:debug_auth_names] || ['app_key']
336
+
337
+ new_options = opts.merge(
338
+ :operation => :"DefaultApi.create_segments",
339
+ :header_params => header_params,
340
+ :query_params => query_params,
341
+ :form_params => form_params,
342
+ :body => post_body,
343
+ :auth_names => auth_names,
344
+ :return_type => return_type
345
+ )
346
+
347
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
348
+ if @api_client.config.debugging
349
+ @api_client.config.logger.debug "API called: DefaultApi#create_segments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
350
+ end
351
+ return data, status_code, headers
352
+ end
353
+
354
+ # Delete a user record
355
+ # Delete player - Required: Used to delete a single, specific Player ID record from a specific OneSignal app.
356
+ # @param app_id [String] The OneSignal App ID for your app. Available in Keys &amp; IDs.
357
+ # @param player_id [String] The OneSignal player_id
358
+ # @param [Hash] opts the optional parameters
359
+ # @return [InlineResponse2001]
360
+ def delete_player(app_id, player_id, opts = {})
361
+ data, _status_code, _headers = delete_player_with_http_info(app_id, player_id, opts)
362
+ data
363
+ end
364
+
365
+ # Delete a user record
366
+ # Delete player - Required: Used to delete a single, specific Player ID record from a specific OneSignal app.
367
+ # @param app_id [String] The OneSignal App ID for your app. Available in Keys &amp; IDs.
368
+ # @param player_id [String] The OneSignal player_id
369
+ # @param [Hash] opts the optional parameters
370
+ # @return [Array<(InlineResponse2001, Integer, Hash)>] InlineResponse2001 data, response status code and response headers
371
+ def delete_player_with_http_info(app_id, player_id, opts = {})
372
+ if @api_client.config.debugging
373
+ @api_client.config.logger.debug 'Calling API: DefaultApi.delete_player ...'
374
+ end
375
+ # verify the required parameter 'app_id' is set
376
+ if @api_client.config.client_side_validation && app_id.nil?
377
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.delete_player"
378
+ end
379
+ # verify the required parameter 'player_id' is set
380
+ if @api_client.config.client_side_validation && player_id.nil?
381
+ fail ArgumentError, "Missing the required parameter 'player_id' when calling DefaultApi.delete_player"
382
+ end
383
+ # resource path
384
+ local_var_path = '/players/{player_id}'.sub('{' + 'player_id' + '}', CGI.escape(player_id.to_s))
385
+
386
+ # query parameters
387
+ query_params = opts[:query_params] || {}
388
+ query_params[:'app_id'] = app_id
389
+
390
+ # header parameters
391
+ header_params = opts[:header_params] || {}
392
+ # HTTP header 'Accept' (if needed)
393
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
394
+
395
+ # form parameters
396
+ form_params = opts[:form_params] || {}
397
+
398
+ # http body (model)
399
+ post_body = opts[:debug_body]
400
+
401
+ # return_type
402
+ return_type = opts[:debug_return_type] || 'InlineResponse2001'
403
+
404
+ # auth_names
405
+ auth_names = opts[:debug_auth_names] || ['app_key']
406
+
407
+ new_options = opts.merge(
408
+ :operation => :"DefaultApi.delete_player",
409
+ :header_params => header_params,
410
+ :query_params => query_params,
411
+ :form_params => form_params,
412
+ :body => post_body,
413
+ :auth_names => auth_names,
414
+ :return_type => return_type
415
+ )
416
+
417
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
418
+ if @api_client.config.debugging
419
+ @api_client.config.logger.debug "API called: DefaultApi#delete_player\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
420
+ end
421
+ return data, status_code, headers
422
+ end
423
+
424
+ # Delete Segments
425
+ # Delete segments (not user devices) - Required: OneSignal Paid Plan You can delete a segment under your app by calling this API. You must provide an API key in the Authorization header that has admin access on the app. The segment_id can be found in the URL of the segment when viewing it in the dashboard.
426
+ # @param app_id [String] The OneSignal App ID for your app. Available in Keys &amp; IDs.
427
+ # @param segment_id [String] The segment_id can be found in the URL of the segment when viewing it in the dashboard.
428
+ # @param [Hash] opts the optional parameters
429
+ # @return [InlineResponse2003]
430
+ def delete_segments(app_id, segment_id, opts = {})
431
+ data, _status_code, _headers = delete_segments_with_http_info(app_id, segment_id, opts)
432
+ data
433
+ end
434
+
435
+ # Delete Segments
436
+ # Delete segments (not user devices) - Required: OneSignal Paid Plan You can delete a segment under your app by calling this API. You must provide an API key in the Authorization header that has admin access on the app. The segment_id can be found in the URL of the segment when viewing it in the dashboard.
437
+ # @param app_id [String] The OneSignal App ID for your app. Available in Keys &amp; IDs.
438
+ # @param segment_id [String] The segment_id can be found in the URL of the segment when viewing it in the dashboard.
439
+ # @param [Hash] opts the optional parameters
440
+ # @return [Array<(InlineResponse2003, Integer, Hash)>] InlineResponse2003 data, response status code and response headers
441
+ def delete_segments_with_http_info(app_id, segment_id, opts = {})
442
+ if @api_client.config.debugging
443
+ @api_client.config.logger.debug 'Calling API: DefaultApi.delete_segments ...'
444
+ end
445
+ # verify the required parameter 'app_id' is set
446
+ if @api_client.config.client_side_validation && app_id.nil?
447
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.delete_segments"
448
+ end
449
+ # verify the required parameter 'segment_id' is set
450
+ if @api_client.config.client_side_validation && segment_id.nil?
451
+ fail ArgumentError, "Missing the required parameter 'segment_id' when calling DefaultApi.delete_segments"
452
+ end
453
+ # resource path
454
+ local_var_path = '/apps/{app_id}/segments/{segment_id}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'segment_id' + '}', CGI.escape(segment_id.to_s))
455
+
456
+ # query parameters
457
+ query_params = opts[:query_params] || {}
458
+
459
+ # header parameters
460
+ header_params = opts[:header_params] || {}
461
+ # HTTP header 'Accept' (if needed)
462
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
463
+
464
+ # form parameters
465
+ form_params = opts[:form_params] || {}
466
+
467
+ # http body (model)
468
+ post_body = opts[:debug_body]
469
+
470
+ # return_type
471
+ return_type = opts[:debug_return_type] || 'InlineResponse2003'
472
+
473
+ # auth_names
474
+ auth_names = opts[:debug_auth_names] || ['app_key']
475
+
476
+ new_options = opts.merge(
477
+ :operation => :"DefaultApi.delete_segments",
478
+ :header_params => header_params,
479
+ :query_params => query_params,
480
+ :form_params => form_params,
481
+ :body => post_body,
482
+ :auth_names => auth_names,
483
+ :return_type => return_type
484
+ )
485
+
486
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
487
+ if @api_client.config.debugging
488
+ @api_client.config.logger.debug "API called: DefaultApi#delete_segments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
489
+ end
490
+ return data, status_code, headers
491
+ end
492
+
493
+ # CSV export
494
+ # Generate a compressed CSV export of all of your current user data This method can be used to generate a compressed CSV export of all of your current user data. It is a much faster alternative than retrieving this data using the /players API endpoint. The file will be compressed using GZip. The file may take several minutes to generate depending on the number of users in your app. The URL generated will be available for 3 days and includes random v4 uuid as part of the resource name to be unguessable. 🚧 403 Error Responses You can test if it is complete by making a GET request to the csv_file_url value. This file may take time to generate depending on how many device records are being pulled. If the file is not ready, a 403 error will be returned. Otherwise the file itself will be returned. 🚧 Requires Authentication Key Requires your OneSignal App's REST API Key, available in Keys & IDs. 🚧 Concurrent Exports Only one concurrent export is allowed per OneSignal account. Please ensure you have successfully downloaded the .csv.gz file before exporting another app. CSV File Format: - Default Columns: | Field | Details | | --- | --- | | id | OneSignal Player Id | | identifier | Push Token | | session_count | Number of times they visited the app or site | language | Device language code | | timezone | Number of seconds away from UTC. Example: -28800 | | game_version | Version of your mobile app gathered from Android Studio versionCode in your App/build.gradle and iOS uses kCFBundleVersionKey in Xcode. | | device_os | Device Operating System Version. Example: 80 = Chrome 80, 9 = Android 9 | | device_type | Device Operating System Type | | device_model | Device Hardware String Code. Example: Mobile Web Subscribers will have `Linux armv` | | ad_id | Based on the Google Advertising Id for Android, identifierForVendor for iOS. OptedOut means user turned off Advertising tracking on the device. | | tags | Current OneSignal Data Tags on the device. | | last_active | Date and time the user last opened the mobile app or visited the site. | | playtime | Total amount of time in seconds the user had the mobile app open. | | amount_spent | Mobile only - amount spent in USD on In-App Purchases. | | created_at | Date and time the device record was created in OneSignal. Mobile - first time they opened the app with OneSignal SDK. Web - first time the user subscribed to the site. | | invalid_identifier | t = unsubscribed, f = subscibed | | badge_count | Current number of badges on the device | - Extra Columns: | Field | Details | | --- | --- | | external_user_id | Your User Id set on the device | | notification_types | Notification types | | location | Location points (Latitude and Longitude) set on the device. | | country | Country code | | rooted | Android device rooted or not | | ip | IP Address of the device if being tracked. See Handling Personal Data. | | web_auth | Web Only authorization key. | | web_p256 | Web Only p256 key. |
495
+ # @param app_id [String] The app ID that you want to export devices from
496
+ # @param [Hash] opts the optional parameters
497
+ # @option opts [ExportPlayersRequestBody] :export_players_request_body
498
+ # @return [InlineResponse2005]
499
+ def export_players(app_id, opts = {})
500
+ data, _status_code, _headers = export_players_with_http_info(app_id, opts)
501
+ data
502
+ end
503
+
504
+ # CSV export
505
+ # Generate a compressed CSV export of all of your current user data This method can be used to generate a compressed CSV export of all of your current user data. It is a much faster alternative than retrieving this data using the /players API endpoint. The file will be compressed using GZip. The file may take several minutes to generate depending on the number of users in your app. The URL generated will be available for 3 days and includes random v4 uuid as part of the resource name to be unguessable. 🚧 403 Error Responses You can test if it is complete by making a GET request to the csv_file_url value. This file may take time to generate depending on how many device records are being pulled. If the file is not ready, a 403 error will be returned. Otherwise the file itself will be returned. 🚧 Requires Authentication Key Requires your OneSignal App&#39;s REST API Key, available in Keys &amp; IDs. 🚧 Concurrent Exports Only one concurrent export is allowed per OneSignal account. Please ensure you have successfully downloaded the .csv.gz file before exporting another app. CSV File Format: - Default Columns: | Field | Details | | --- | --- | | id | OneSignal Player Id | | identifier | Push Token | | session_count | Number of times they visited the app or site | language | Device language code | | timezone | Number of seconds away from UTC. Example: -28800 | | game_version | Version of your mobile app gathered from Android Studio versionCode in your App/build.gradle and iOS uses kCFBundleVersionKey in Xcode. | | device_os | Device Operating System Version. Example: 80 &#x3D; Chrome 80, 9 &#x3D; Android 9 | | device_type | Device Operating System Type | | device_model | Device Hardware String Code. Example: Mobile Web Subscribers will have &#x60;Linux armv&#x60; | | ad_id | Based on the Google Advertising Id for Android, identifierForVendor for iOS. OptedOut means user turned off Advertising tracking on the device. | | tags | Current OneSignal Data Tags on the device. | | last_active | Date and time the user last opened the mobile app or visited the site. | | playtime | Total amount of time in seconds the user had the mobile app open. | | amount_spent | Mobile only - amount spent in USD on In-App Purchases. | | created_at | Date and time the device record was created in OneSignal. Mobile - first time they opened the app with OneSignal SDK. Web - first time the user subscribed to the site. | | invalid_identifier | t &#x3D; unsubscribed, f &#x3D; subscibed | | badge_count | Current number of badges on the device | - Extra Columns: | Field | Details | | --- | --- | | external_user_id | Your User Id set on the device | | notification_types | Notification types | | location | Location points (Latitude and Longitude) set on the device. | | country | Country code | | rooted | Android device rooted or not | | ip | IP Address of the device if being tracked. See Handling Personal Data. | | web_auth | Web Only authorization key. | | web_p256 | Web Only p256 key. |
506
+ # @param app_id [String] The app ID that you want to export devices from
507
+ # @param [Hash] opts the optional parameters
508
+ # @option opts [ExportPlayersRequestBody] :export_players_request_body
509
+ # @return [Array<(InlineResponse2005, Integer, Hash)>] InlineResponse2005 data, response status code and response headers
510
+ def export_players_with_http_info(app_id, opts = {})
511
+ if @api_client.config.debugging
512
+ @api_client.config.logger.debug 'Calling API: DefaultApi.export_players ...'
513
+ end
514
+ # verify the required parameter 'app_id' is set
515
+ if @api_client.config.client_side_validation && app_id.nil?
516
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.export_players"
517
+ end
518
+ # resource path
519
+ local_var_path = '/players/csv_export?app_id={app_id}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s))
520
+
521
+ # query parameters
522
+ query_params = opts[:query_params] || {}
523
+
524
+ # header parameters
525
+ header_params = opts[:header_params] || {}
526
+ # HTTP header 'Accept' (if needed)
527
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
528
+ # HTTP header 'Content-Type'
529
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
530
+
531
+ # form parameters
532
+ form_params = opts[:form_params] || {}
533
+
534
+ # http body (model)
535
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'export_players_request_body'])
536
+
537
+ # return_type
538
+ return_type = opts[:debug_return_type] || 'InlineResponse2005'
539
+
540
+ # auth_names
541
+ auth_names = opts[:debug_auth_names] || ['app_key']
542
+
543
+ new_options = opts.merge(
544
+ :operation => :"DefaultApi.export_players",
545
+ :header_params => header_params,
546
+ :query_params => query_params,
547
+ :form_params => form_params,
548
+ :body => post_body,
549
+ :auth_names => auth_names,
550
+ :return_type => return_type
551
+ )
552
+
553
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
554
+ if @api_client.config.debugging
555
+ @api_client.config.logger.debug "API called: DefaultApi#export_players\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
556
+ end
557
+ return data, status_code, headers
558
+ end
559
+
560
+ # View an app
561
+ # View the details of a single OneSignal app
562
+ # @param app_id [String] An app id
563
+ # @param [Hash] opts the optional parameters
564
+ # @return [App]
565
+ def get_app(app_id, opts = {})
566
+ data, _status_code, _headers = get_app_with_http_info(app_id, opts)
567
+ data
568
+ end
569
+
570
+ # View an app
571
+ # View the details of a single OneSignal app
572
+ # @param app_id [String] An app id
573
+ # @param [Hash] opts the optional parameters
574
+ # @return [Array<(App, Integer, Hash)>] App data, response status code and response headers
575
+ def get_app_with_http_info(app_id, opts = {})
576
+ if @api_client.config.debugging
577
+ @api_client.config.logger.debug 'Calling API: DefaultApi.get_app ...'
578
+ end
579
+ # verify the required parameter 'app_id' is set
580
+ if @api_client.config.client_side_validation && app_id.nil?
581
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.get_app"
582
+ end
583
+ # resource path
584
+ local_var_path = '/apps/{app_id}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s))
585
+
586
+ # query parameters
587
+ query_params = opts[:query_params] || {}
588
+
589
+ # header parameters
590
+ header_params = opts[:header_params] || {}
591
+ # HTTP header 'Accept' (if needed)
592
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
593
+
594
+ # form parameters
595
+ form_params = opts[:form_params] || {}
596
+
597
+ # http body (model)
598
+ post_body = opts[:debug_body]
599
+
600
+ # return_type
601
+ return_type = opts[:debug_return_type] || 'App'
602
+
603
+ # auth_names
604
+ auth_names = opts[:debug_auth_names] || ['user_key']
605
+
606
+ new_options = opts.merge(
607
+ :operation => :"DefaultApi.get_app",
608
+ :header_params => header_params,
609
+ :query_params => query_params,
610
+ :form_params => form_params,
611
+ :body => post_body,
612
+ :auth_names => auth_names,
613
+ :return_type => return_type
614
+ )
615
+
616
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
617
+ if @api_client.config.debugging
618
+ @api_client.config.logger.debug "API called: DefaultApi#get_app\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
619
+ end
620
+ return data, status_code, headers
621
+ end
622
+
623
+ # View apps
624
+ # View the details of all of your current OneSignal apps
625
+ # @param [Hash] opts the optional parameters
626
+ # @return [String]
627
+ def get_apps(opts = {})
628
+ data, _status_code, _headers = get_apps_with_http_info(opts)
629
+ data
630
+ end
631
+
632
+ # View apps
633
+ # View the details of all of your current OneSignal apps
634
+ # @param [Hash] opts the optional parameters
635
+ # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
636
+ def get_apps_with_http_info(opts = {})
637
+ if @api_client.config.debugging
638
+ @api_client.config.logger.debug 'Calling API: DefaultApi.get_apps ...'
639
+ end
640
+ # resource path
641
+ local_var_path = '/apps'
642
+
643
+ # query parameters
644
+ query_params = opts[:query_params] || {}
645
+
646
+ # header parameters
647
+ header_params = opts[:header_params] || {}
648
+ # HTTP header 'Accept' (if needed)
649
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
650
+
651
+ # form parameters
652
+ form_params = opts[:form_params] || {}
653
+
654
+ # http body (model)
655
+ post_body = opts[:debug_body]
656
+
657
+ # return_type
658
+ return_type = opts[:debug_return_type] || 'String'
659
+
660
+ # auth_names
661
+ auth_names = opts[:debug_auth_names] || ['user_key']
662
+
663
+ new_options = opts.merge(
664
+ :operation => :"DefaultApi.get_apps",
665
+ :header_params => header_params,
666
+ :query_params => query_params,
667
+ :form_params => form_params,
668
+ :body => post_body,
669
+ :auth_names => auth_names,
670
+ :return_type => return_type
671
+ )
672
+
673
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
674
+ if @api_client.config.debugging
675
+ @api_client.config.logger.debug "API called: DefaultApi#get_apps\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
676
+ end
677
+ return data, status_code, headers
678
+ end
679
+
680
+ # View notification
681
+ # View the details of a single notification and outcomes associated with it
682
+ # @param app_id [String]
683
+ # @param notification_id [String]
684
+ # @param [Hash] opts the optional parameters
685
+ # @return [Notification]
686
+ def get_notification(app_id, notification_id, opts = {})
687
+ data, _status_code, _headers = get_notification_with_http_info(app_id, notification_id, opts)
688
+ data
689
+ end
690
+
691
+ # View notification
692
+ # View the details of a single notification and outcomes associated with it
693
+ # @param app_id [String]
694
+ # @param notification_id [String]
695
+ # @param [Hash] opts the optional parameters
696
+ # @return [Array<(Notification, Integer, Hash)>] Notification data, response status code and response headers
697
+ def get_notification_with_http_info(app_id, notification_id, opts = {})
698
+ if @api_client.config.debugging
699
+ @api_client.config.logger.debug 'Calling API: DefaultApi.get_notification ...'
700
+ end
701
+ # verify the required parameter 'app_id' is set
702
+ if @api_client.config.client_side_validation && app_id.nil?
703
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.get_notification"
704
+ end
705
+ # verify the required parameter 'notification_id' is set
706
+ if @api_client.config.client_side_validation && notification_id.nil?
707
+ fail ArgumentError, "Missing the required parameter 'notification_id' when calling DefaultApi.get_notification"
708
+ end
709
+ # resource path
710
+ local_var_path = '/notifications/{notification_id}'.sub('{' + 'notification_id' + '}', CGI.escape(notification_id.to_s))
711
+
712
+ # query parameters
713
+ query_params = opts[:query_params] || {}
714
+ query_params[:'app_id'] = app_id
715
+
716
+ # header parameters
717
+ header_params = opts[:header_params] || {}
718
+ # HTTP header 'Accept' (if needed)
719
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
720
+
721
+ # form parameters
722
+ form_params = opts[:form_params] || {}
723
+
724
+ # http body (model)
725
+ post_body = opts[:debug_body]
726
+
727
+ # return_type
728
+ return_type = opts[:debug_return_type] || 'Notification'
729
+
730
+ # auth_names
731
+ auth_names = opts[:debug_auth_names] || ['app_key']
732
+
733
+ new_options = opts.merge(
734
+ :operation => :"DefaultApi.get_notification",
735
+ :header_params => header_params,
736
+ :query_params => query_params,
737
+ :form_params => form_params,
738
+ :body => post_body,
739
+ :auth_names => auth_names,
740
+ :return_type => return_type
741
+ )
742
+
743
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
744
+ if @api_client.config.debugging
745
+ @api_client.config.logger.debug "API called: DefaultApi#get_notification\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
746
+ end
747
+ return data, status_code, headers
748
+ end
749
+
750
+ # Notification History
751
+ # -> View the devices sent a message - OneSignal Paid Plan Required This method will return all devices that were sent the given notification_id of an Email or Push Notification if used within 7 days of the date sent. After 7 days of the sending date, the message history data will be unavailable. After a successful response is received, the destination url may be polled until the file becomes available. Most exports are done in ~1-3 minutes, so setting a poll interval of 10 seconds should be adequate. For use cases that are not meant to be consumed by a script, an email will be sent to the supplied email address. 🚧 Requirements A OneSignal Paid Plan. Turn on Send History via OneSignal API in Settings -> Analytics. Cannot get data before this was turned on. Must be called within 7 days after sending the message. Messages targeting under 1000 recipients will not have \"sent\" events recorded, but will show \"clicked\" events. Requires your OneSignal App's REST API Key, available in Keys & IDs.
752
+ # @param notification_id [String] The \&quot;id\&quot; of the message found in the Notification object
753
+ # @param get_notification_request_body [GetNotificationRequestBody]
754
+ # @param [Hash] opts the optional parameters
755
+ # @return [InlineResponse2002]
756
+ def get_notification_history(notification_id, get_notification_request_body, opts = {})
757
+ data, _status_code, _headers = get_notification_history_with_http_info(notification_id, get_notification_request_body, opts)
758
+ data
759
+ end
760
+
761
+ # Notification History
762
+ # -&gt; View the devices sent a message - OneSignal Paid Plan Required This method will return all devices that were sent the given notification_id of an Email or Push Notification if used within 7 days of the date sent. After 7 days of the sending date, the message history data will be unavailable. After a successful response is received, the destination url may be polled until the file becomes available. Most exports are done in ~1-3 minutes, so setting a poll interval of 10 seconds should be adequate. For use cases that are not meant to be consumed by a script, an email will be sent to the supplied email address. 🚧 Requirements A OneSignal Paid Plan. Turn on Send History via OneSignal API in Settings -&gt; Analytics. Cannot get data before this was turned on. Must be called within 7 days after sending the message. Messages targeting under 1000 recipients will not have \&quot;sent\&quot; events recorded, but will show \&quot;clicked\&quot; events. Requires your OneSignal App&#39;s REST API Key, available in Keys &amp; IDs.
763
+ # @param notification_id [String] The \&quot;id\&quot; of the message found in the Notification object
764
+ # @param get_notification_request_body [GetNotificationRequestBody]
765
+ # @param [Hash] opts the optional parameters
766
+ # @return [Array<(InlineResponse2002, Integer, Hash)>] InlineResponse2002 data, response status code and response headers
767
+ def get_notification_history_with_http_info(notification_id, get_notification_request_body, opts = {})
768
+ if @api_client.config.debugging
769
+ @api_client.config.logger.debug 'Calling API: DefaultApi.get_notification_history ...'
770
+ end
771
+ # verify the required parameter 'notification_id' is set
772
+ if @api_client.config.client_side_validation && notification_id.nil?
773
+ fail ArgumentError, "Missing the required parameter 'notification_id' when calling DefaultApi.get_notification_history"
774
+ end
775
+ # verify the required parameter 'get_notification_request_body' is set
776
+ if @api_client.config.client_side_validation && get_notification_request_body.nil?
777
+ fail ArgumentError, "Missing the required parameter 'get_notification_request_body' when calling DefaultApi.get_notification_history"
778
+ end
779
+ # resource path
780
+ local_var_path = '/notifications/{notification_id}/history'.sub('{' + 'notification_id' + '}', CGI.escape(notification_id.to_s))
781
+
782
+ # query parameters
783
+ query_params = opts[:query_params] || {}
784
+
785
+ # header parameters
786
+ header_params = opts[:header_params] || {}
787
+ # HTTP header 'Accept' (if needed)
788
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
789
+ # HTTP header 'Content-Type'
790
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
791
+
792
+ # form parameters
793
+ form_params = opts[:form_params] || {}
794
+
795
+ # http body (model)
796
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(get_notification_request_body)
797
+
798
+ # return_type
799
+ return_type = opts[:debug_return_type] || 'InlineResponse2002'
800
+
801
+ # auth_names
802
+ auth_names = opts[:debug_auth_names] || ['app_key']
803
+
804
+ new_options = opts.merge(
805
+ :operation => :"DefaultApi.get_notification_history",
806
+ :header_params => header_params,
807
+ :query_params => query_params,
808
+ :form_params => form_params,
809
+ :body => post_body,
810
+ :auth_names => auth_names,
811
+ :return_type => return_type
812
+ )
813
+
814
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
815
+ if @api_client.config.debugging
816
+ @api_client.config.logger.debug "API called: DefaultApi#get_notification_history\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
817
+ end
818
+ return data, status_code, headers
819
+ end
820
+
821
+ # View notifications
822
+ # View the details of multiple notifications
823
+ # @param app_id [String] The app ID that you want to view notifications from
824
+ # @param [Hash] opts the optional parameters
825
+ # @option opts [String] :limit How many notifications to return. Max is 50. Default is 50.
826
+ # @option opts [Integer] :offset Page offset. Default is 0. Results are sorted by queued_at in descending order. queued_at is a representation of the time that the notification was queued at.
827
+ # @option opts [Integer] :kind Kind of notifications returned: * unset - All notification types (default) * &#x60;0&#x60; - Dashboard only * &#x60;1&#x60; - API only * &#x60;3&#x60; - Automated only
828
+ # @return [NotificationSlice]
829
+ def get_notifications(app_id, opts = {})
830
+ data, _status_code, _headers = get_notifications_with_http_info(app_id, opts)
831
+ data
832
+ end
833
+
834
+ # View notifications
835
+ # View the details of multiple notifications
836
+ # @param app_id [String] The app ID that you want to view notifications from
837
+ # @param [Hash] opts the optional parameters
838
+ # @option opts [String] :limit How many notifications to return. Max is 50. Default is 50.
839
+ # @option opts [Integer] :offset Page offset. Default is 0. Results are sorted by queued_at in descending order. queued_at is a representation of the time that the notification was queued at.
840
+ # @option opts [Integer] :kind Kind of notifications returned: * unset - All notification types (default) * &#x60;0&#x60; - Dashboard only * &#x60;1&#x60; - API only * &#x60;3&#x60; - Automated only
841
+ # @return [Array<(NotificationSlice, Integer, Hash)>] NotificationSlice data, response status code and response headers
842
+ def get_notifications_with_http_info(app_id, opts = {})
843
+ if @api_client.config.debugging
844
+ @api_client.config.logger.debug 'Calling API: DefaultApi.get_notifications ...'
845
+ end
846
+ # verify the required parameter 'app_id' is set
847
+ if @api_client.config.client_side_validation && app_id.nil?
848
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.get_notifications"
849
+ end
850
+ allowable_values = [0, 1, 3]
851
+ if @api_client.config.client_side_validation && opts[:'kind'] && !allowable_values.include?(opts[:'kind'])
852
+ fail ArgumentError, "invalid value for \"kind\", must be one of #{allowable_values}"
853
+ end
854
+ # resource path
855
+ local_var_path = '/notifications'
856
+
857
+ # query parameters
858
+ query_params = opts[:query_params] || {}
859
+ query_params[:'app_id'] = app_id
860
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
861
+ query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
862
+ query_params[:'kind'] = opts[:'kind'] if !opts[:'kind'].nil?
863
+
864
+ # header parameters
865
+ header_params = opts[:header_params] || {}
866
+ # HTTP header 'Accept' (if needed)
867
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
868
+
869
+ # form parameters
870
+ form_params = opts[:form_params] || {}
871
+
872
+ # http body (model)
873
+ post_body = opts[:debug_body]
874
+
875
+ # return_type
876
+ return_type = opts[:debug_return_type] || 'NotificationSlice'
877
+
878
+ # auth_names
879
+ auth_names = opts[:debug_auth_names] || ['app_key']
880
+
881
+ new_options = opts.merge(
882
+ :operation => :"DefaultApi.get_notifications",
883
+ :header_params => header_params,
884
+ :query_params => query_params,
885
+ :form_params => form_params,
886
+ :body => post_body,
887
+ :auth_names => auth_names,
888
+ :return_type => return_type
889
+ )
890
+
891
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
892
+ if @api_client.config.debugging
893
+ @api_client.config.logger.debug "API called: DefaultApi#get_notifications\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
894
+ end
895
+ return data, status_code, headers
896
+ end
897
+
898
+ # View Outcomes
899
+ # View the details of all the outcomes associated with your app 🚧 Requires Authentication Key Requires your OneSignal App's REST API Key, available in Keys & IDs. 🚧 Outcome Data Limitations Outcomes are only accessible for around 30 days before deleted from our servers. You will need to export this data every month if you want to keep it.
900
+ # @param app_id [String] The OneSignal App ID for your app. Available in Keys &amp; IDs.
901
+ # @param outcome_names [String] Required Comma-separated list of names and the value (sum/count) for the returned outcome data. Note: Clicks only support count aggregation. For out-of-the-box OneSignal outcomes such as click and session duration, please use the “os” prefix with two underscores. For other outcomes, please use the name specified by the user. Example:os__session_duration.count,os__click.count,CustomOutcomeName.sum
902
+ # @param [Hash] opts the optional parameters
903
+ # @option opts [String] :outcome_names2 Optional If outcome names contain any commas, then please specify only one value at a time. Example: outcome_names[]&#x3D;os__click.count&amp;outcome_names[]&#x3D;Sales, Purchase.count where “Sales, Purchase” is the custom outcomes with a comma in the name.
904
+ # @option opts [String] :outcome_time_range Optional Time range for the returned data. The values can be 1h (for the last 1 hour data), 1d (for the last 1 day data), or 1mo (for the last 1 month data). Default is 1h if the parameter is omitted.
905
+ # @option opts [String] :outcome_platforms Optional Platform id. Refer device&#39;s platform ids for values. Example: outcome_platform&#x3D;0 for iOS outcome_platform&#x3D;7,8 for Safari and Firefox Default is data from all platforms if the parameter is omitted.
906
+ # @option opts [String] :outcome_attribution Optional Attribution type for the outcomes. The values can be direct or influenced or unattributed. Example: outcome_attribution&#x3D;direct Default is total (returns direct+influenced+unattributed) if the parameter is omitted.
907
+ # @return [Array<OutcomeData>]
908
+ def get_outcomes(app_id, outcome_names, opts = {})
909
+ data, _status_code, _headers = get_outcomes_with_http_info(app_id, outcome_names, opts)
910
+ data
911
+ end
912
+
913
+ # View Outcomes
914
+ # View the details of all the outcomes associated with your app 🚧 Requires Authentication Key Requires your OneSignal App&#39;s REST API Key, available in Keys &amp; IDs. 🚧 Outcome Data Limitations Outcomes are only accessible for around 30 days before deleted from our servers. You will need to export this data every month if you want to keep it.
915
+ # @param app_id [String] The OneSignal App ID for your app. Available in Keys &amp; IDs.
916
+ # @param outcome_names [String] Required Comma-separated list of names and the value (sum/count) for the returned outcome data. Note: Clicks only support count aggregation. For out-of-the-box OneSignal outcomes such as click and session duration, please use the “os” prefix with two underscores. For other outcomes, please use the name specified by the user. Example:os__session_duration.count,os__click.count,CustomOutcomeName.sum
917
+ # @param [Hash] opts the optional parameters
918
+ # @option opts [String] :outcome_names2 Optional If outcome names contain any commas, then please specify only one value at a time. Example: outcome_names[]&#x3D;os__click.count&amp;outcome_names[]&#x3D;Sales, Purchase.count where “Sales, Purchase” is the custom outcomes with a comma in the name.
919
+ # @option opts [String] :outcome_time_range Optional Time range for the returned data. The values can be 1h (for the last 1 hour data), 1d (for the last 1 day data), or 1mo (for the last 1 month data). Default is 1h if the parameter is omitted.
920
+ # @option opts [String] :outcome_platforms Optional Platform id. Refer device&#39;s platform ids for values. Example: outcome_platform&#x3D;0 for iOS outcome_platform&#x3D;7,8 for Safari and Firefox Default is data from all platforms if the parameter is omitted.
921
+ # @option opts [String] :outcome_attribution Optional Attribution type for the outcomes. The values can be direct or influenced or unattributed. Example: outcome_attribution&#x3D;direct Default is total (returns direct+influenced+unattributed) if the parameter is omitted.
922
+ # @return [Array<(Array<OutcomeData>, Integer, Hash)>] Array<OutcomeData> data, response status code and response headers
923
+ def get_outcomes_with_http_info(app_id, outcome_names, opts = {})
924
+ if @api_client.config.debugging
925
+ @api_client.config.logger.debug 'Calling API: DefaultApi.get_outcomes ...'
926
+ end
927
+ # verify the required parameter 'app_id' is set
928
+ if @api_client.config.client_side_validation && app_id.nil?
929
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.get_outcomes"
930
+ end
931
+ # verify the required parameter 'outcome_names' is set
932
+ if @api_client.config.client_side_validation && outcome_names.nil?
933
+ fail ArgumentError, "Missing the required parameter 'outcome_names' when calling DefaultApi.get_outcomes"
934
+ end
935
+ # resource path
936
+ local_var_path = '/apps/{app_id}/outcomes'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s))
937
+
938
+ # query parameters
939
+ query_params = opts[:query_params] || {}
940
+ query_params[:'outcome_names'] = outcome_names
941
+ query_params[:'outcome_names[]'] = opts[:'outcome_names2'] if !opts[:'outcome_names2'].nil?
942
+ query_params[:'outcome_time_range'] = opts[:'outcome_time_range'] if !opts[:'outcome_time_range'].nil?
943
+ query_params[:'outcome_platforms'] = opts[:'outcome_platforms'] if !opts[:'outcome_platforms'].nil?
944
+ query_params[:'outcome_attribution'] = opts[:'outcome_attribution'] if !opts[:'outcome_attribution'].nil?
945
+
946
+ # header parameters
947
+ header_params = opts[:header_params] || {}
948
+ # HTTP header 'Accept' (if needed)
949
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
950
+
951
+ # form parameters
952
+ form_params = opts[:form_params] || {}
953
+
954
+ # http body (model)
955
+ post_body = opts[:debug_body]
956
+
957
+ # return_type
958
+ return_type = opts[:debug_return_type] || 'Array<OutcomeData>'
959
+
960
+ # auth_names
961
+ auth_names = opts[:debug_auth_names] || ['app_key']
962
+
963
+ new_options = opts.merge(
964
+ :operation => :"DefaultApi.get_outcomes",
965
+ :header_params => header_params,
966
+ :query_params => query_params,
967
+ :form_params => form_params,
968
+ :body => post_body,
969
+ :auth_names => auth_names,
970
+ :return_type => return_type
971
+ )
972
+
973
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
974
+ if @api_client.config.debugging
975
+ @api_client.config.logger.debug "API called: DefaultApi#get_outcomes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
976
+ end
977
+ return data, status_code, headers
978
+ end
979
+
980
+ # View device
981
+ # View the details of an existing device in one of your OneSignal apps
982
+ # @param app_id [String] Your app_id for this device
983
+ # @param player_id [String] Player&#39;s OneSignal ID
984
+ # @param [Hash] opts the optional parameters
985
+ # @option opts [String] :email_auth_hash Email - Only required if you have enabled Identity Verification and device_type is email (11).
986
+ # @return [Player]
987
+ def get_player(app_id, player_id, opts = {})
988
+ data, _status_code, _headers = get_player_with_http_info(app_id, player_id, opts)
989
+ data
990
+ end
991
+
992
+ # View device
993
+ # View the details of an existing device in one of your OneSignal apps
994
+ # @param app_id [String] Your app_id for this device
995
+ # @param player_id [String] Player&#39;s OneSignal ID
996
+ # @param [Hash] opts the optional parameters
997
+ # @option opts [String] :email_auth_hash Email - Only required if you have enabled Identity Verification and device_type is email (11).
998
+ # @return [Array<(Player, Integer, Hash)>] Player data, response status code and response headers
999
+ def get_player_with_http_info(app_id, player_id, opts = {})
1000
+ if @api_client.config.debugging
1001
+ @api_client.config.logger.debug 'Calling API: DefaultApi.get_player ...'
1002
+ end
1003
+ # verify the required parameter 'app_id' is set
1004
+ if @api_client.config.client_side_validation && app_id.nil?
1005
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.get_player"
1006
+ end
1007
+ # verify the required parameter 'player_id' is set
1008
+ if @api_client.config.client_side_validation && player_id.nil?
1009
+ fail ArgumentError, "Missing the required parameter 'player_id' when calling DefaultApi.get_player"
1010
+ end
1011
+ # resource path
1012
+ local_var_path = '/players/{player_id}'.sub('{' + 'player_id' + '}', CGI.escape(player_id.to_s))
1013
+
1014
+ # query parameters
1015
+ query_params = opts[:query_params] || {}
1016
+ query_params[:'app_id'] = app_id
1017
+ query_params[:'email_auth_hash'] = opts[:'email_auth_hash'] if !opts[:'email_auth_hash'].nil?
1018
+
1019
+ # header parameters
1020
+ header_params = opts[:header_params] || {}
1021
+ # HTTP header 'Accept' (if needed)
1022
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1023
+
1024
+ # form parameters
1025
+ form_params = opts[:form_params] || {}
1026
+
1027
+ # http body (model)
1028
+ post_body = opts[:debug_body]
1029
+
1030
+ # return_type
1031
+ return_type = opts[:debug_return_type] || 'Player'
1032
+
1033
+ # auth_names
1034
+ auth_names = opts[:debug_auth_names] || ['app_key']
1035
+
1036
+ new_options = opts.merge(
1037
+ :operation => :"DefaultApi.get_player",
1038
+ :header_params => header_params,
1039
+ :query_params => query_params,
1040
+ :form_params => form_params,
1041
+ :body => post_body,
1042
+ :auth_names => auth_names,
1043
+ :return_type => return_type
1044
+ )
1045
+
1046
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1047
+ if @api_client.config.debugging
1048
+ @api_client.config.logger.debug "API called: DefaultApi#get_player\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1049
+ end
1050
+ return data, status_code, headers
1051
+ end
1052
+
1053
+ # View devices
1054
+ # View the details of multiple devices in one of your OneSignal apps Unavailable for Apps Over 80,000 Users For performance reasons, this method is not available for larger apps. Larger apps should use the CSV export API endpoint, which is much more performant.
1055
+ # @param app_id [String] The app ID that you want to view players from
1056
+ # @param [Hash] opts the optional parameters
1057
+ # @option opts [String] :limit How many devices to return. Max is 300. Default is 300
1058
+ # @option opts [Integer] :offset Result offset. Default is 0. Results are sorted by id;
1059
+ # @return [PlayerSlice]
1060
+ def get_players(app_id, opts = {})
1061
+ data, _status_code, _headers = get_players_with_http_info(app_id, opts)
1062
+ data
1063
+ end
1064
+
1065
+ # View devices
1066
+ # View the details of multiple devices in one of your OneSignal apps Unavailable for Apps Over 80,000 Users For performance reasons, this method is not available for larger apps. Larger apps should use the CSV export API endpoint, which is much more performant.
1067
+ # @param app_id [String] The app ID that you want to view players from
1068
+ # @param [Hash] opts the optional parameters
1069
+ # @option opts [String] :limit How many devices to return. Max is 300. Default is 300
1070
+ # @option opts [Integer] :offset Result offset. Default is 0. Results are sorted by id;
1071
+ # @return [Array<(PlayerSlice, Integer, Hash)>] PlayerSlice data, response status code and response headers
1072
+ def get_players_with_http_info(app_id, opts = {})
1073
+ if @api_client.config.debugging
1074
+ @api_client.config.logger.debug 'Calling API: DefaultApi.get_players ...'
1075
+ end
1076
+ # verify the required parameter 'app_id' is set
1077
+ if @api_client.config.client_side_validation && app_id.nil?
1078
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.get_players"
1079
+ end
1080
+ # resource path
1081
+ local_var_path = '/players'
1082
+
1083
+ # query parameters
1084
+ query_params = opts[:query_params] || {}
1085
+ query_params[:'app_id'] = app_id
1086
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
1087
+ query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
1088
+
1089
+ # header parameters
1090
+ header_params = opts[:header_params] || {}
1091
+ # HTTP header 'Accept' (if needed)
1092
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1093
+
1094
+ # form parameters
1095
+ form_params = opts[:form_params] || {}
1096
+
1097
+ # http body (model)
1098
+ post_body = opts[:debug_body]
1099
+
1100
+ # return_type
1101
+ return_type = opts[:debug_return_type] || 'PlayerSlice'
1102
+
1103
+ # auth_names
1104
+ auth_names = opts[:debug_auth_names] || ['app_key']
1105
+
1106
+ new_options = opts.merge(
1107
+ :operation => :"DefaultApi.get_players",
1108
+ :header_params => header_params,
1109
+ :query_params => query_params,
1110
+ :form_params => form_params,
1111
+ :body => post_body,
1112
+ :auth_names => auth_names,
1113
+ :return_type => return_type
1114
+ )
1115
+
1116
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1117
+ if @api_client.config.debugging
1118
+ @api_client.config.logger.debug "API called: DefaultApi#get_players\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1119
+ end
1120
+ return data, status_code, headers
1121
+ end
1122
+
1123
+ # Update an app
1124
+ # Updates the name or configuration settings of an existing OneSignal app
1125
+ # @param app_id [String] An app id
1126
+ # @param app [App]
1127
+ # @param [Hash] opts the optional parameters
1128
+ # @return [App]
1129
+ def update_app(app_id, app, opts = {})
1130
+ data, _status_code, _headers = update_app_with_http_info(app_id, app, opts)
1131
+ data
1132
+ end
1133
+
1134
+ # Update an app
1135
+ # Updates the name or configuration settings of an existing OneSignal app
1136
+ # @param app_id [String] An app id
1137
+ # @param app [App]
1138
+ # @param [Hash] opts the optional parameters
1139
+ # @return [Array<(App, Integer, Hash)>] App data, response status code and response headers
1140
+ def update_app_with_http_info(app_id, app, opts = {})
1141
+ if @api_client.config.debugging
1142
+ @api_client.config.logger.debug 'Calling API: DefaultApi.update_app ...'
1143
+ end
1144
+ # verify the required parameter 'app_id' is set
1145
+ if @api_client.config.client_side_validation && app_id.nil?
1146
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.update_app"
1147
+ end
1148
+ # verify the required parameter 'app' is set
1149
+ if @api_client.config.client_side_validation && app.nil?
1150
+ fail ArgumentError, "Missing the required parameter 'app' when calling DefaultApi.update_app"
1151
+ end
1152
+ # resource path
1153
+ local_var_path = '/apps/{app_id}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s))
1154
+
1155
+ # query parameters
1156
+ query_params = opts[:query_params] || {}
1157
+
1158
+ # header parameters
1159
+ header_params = opts[:header_params] || {}
1160
+ # HTTP header 'Accept' (if needed)
1161
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1162
+ # HTTP header 'Content-Type'
1163
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
1164
+
1165
+ # form parameters
1166
+ form_params = opts[:form_params] || {}
1167
+
1168
+ # http body (model)
1169
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(app)
1170
+
1171
+ # return_type
1172
+ return_type = opts[:debug_return_type] || 'App'
1173
+
1174
+ # auth_names
1175
+ auth_names = opts[:debug_auth_names] || ['user_key']
1176
+
1177
+ new_options = opts.merge(
1178
+ :operation => :"DefaultApi.update_app",
1179
+ :header_params => header_params,
1180
+ :query_params => query_params,
1181
+ :form_params => form_params,
1182
+ :body => post_body,
1183
+ :auth_names => auth_names,
1184
+ :return_type => return_type
1185
+ )
1186
+
1187
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
1188
+ if @api_client.config.debugging
1189
+ @api_client.config.logger.debug "API called: DefaultApi#update_app\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1190
+ end
1191
+ return data, status_code, headers
1192
+ end
1193
+
1194
+ # Edit device
1195
+ # Update an existing device in one of your OneSignal apps
1196
+ # @param player_id [String] Player&#39;s OneSignal ID
1197
+ # @param player [Player]
1198
+ # @param [Hash] opts the optional parameters
1199
+ # @return [InlineResponse2001]
1200
+ def update_player(player_id, player, opts = {})
1201
+ data, _status_code, _headers = update_player_with_http_info(player_id, player, opts)
1202
+ data
1203
+ end
1204
+
1205
+ # Edit device
1206
+ # Update an existing device in one of your OneSignal apps
1207
+ # @param player_id [String] Player&#39;s OneSignal ID
1208
+ # @param player [Player]
1209
+ # @param [Hash] opts the optional parameters
1210
+ # @return [Array<(InlineResponse2001, Integer, Hash)>] InlineResponse2001 data, response status code and response headers
1211
+ def update_player_with_http_info(player_id, player, opts = {})
1212
+ if @api_client.config.debugging
1213
+ @api_client.config.logger.debug 'Calling API: DefaultApi.update_player ...'
1214
+ end
1215
+ # verify the required parameter 'player_id' is set
1216
+ if @api_client.config.client_side_validation && player_id.nil?
1217
+ fail ArgumentError, "Missing the required parameter 'player_id' when calling DefaultApi.update_player"
1218
+ end
1219
+ # verify the required parameter 'player' is set
1220
+ if @api_client.config.client_side_validation && player.nil?
1221
+ fail ArgumentError, "Missing the required parameter 'player' when calling DefaultApi.update_player"
1222
+ end
1223
+ # resource path
1224
+ local_var_path = '/players/{player_id}'.sub('{' + 'player_id' + '}', CGI.escape(player_id.to_s))
1225
+
1226
+ # query parameters
1227
+ query_params = opts[:query_params] || {}
1228
+
1229
+ # header parameters
1230
+ header_params = opts[:header_params] || {}
1231
+ # HTTP header 'Accept' (if needed)
1232
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1233
+ # HTTP header 'Content-Type'
1234
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
1235
+
1236
+ # form parameters
1237
+ form_params = opts[:form_params] || {}
1238
+
1239
+ # http body (model)
1240
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(player)
1241
+
1242
+ # return_type
1243
+ return_type = opts[:debug_return_type] || 'InlineResponse2001'
1244
+
1245
+ # auth_names
1246
+ auth_names = opts[:debug_auth_names] || ['app_key']
1247
+
1248
+ new_options = opts.merge(
1249
+ :operation => :"DefaultApi.update_player",
1250
+ :header_params => header_params,
1251
+ :query_params => query_params,
1252
+ :form_params => form_params,
1253
+ :body => post_body,
1254
+ :auth_names => auth_names,
1255
+ :return_type => return_type
1256
+ )
1257
+
1258
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
1259
+ if @api_client.config.debugging
1260
+ @api_client.config.logger.debug "API called: DefaultApi#update_player\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1261
+ end
1262
+ return data, status_code, headers
1263
+ end
1264
+
1265
+ # Edit tags with external user id
1266
+ # Update an existing device's tags in one of your OneSignal apps using the External User ID. Warning - Android SDK Data Synchronization Tags added through the Android SDK tagging methods may not update if using the API to change or update the same tag. For example, if you use SDK method sendTag(\"key\", \"value1\") then update the tag value to \"value2\" with this API endpoint. You will not be able to set the value back to \"value1\" through the SDK, you will need to change it to something different through the SDK to be reset. Recommendations if using this Endpoint on Android Mobile Apps: 1 - Do not use the same tag keys for SDK and API updates 2 - If you want to use the same key for both SDK and API updates, call the SDK getTags method first to update the device's tags. This is only applicable on the Android Mobile App SDKs. 📘 Deleting Tags To delete a tag, include its key and set its value to blank. Omitting a key/value will not delete it. For example, if I wanted to delete two existing tags rank and category while simultaneously adding a new tag class, the tags JSON would look like the following: \"tags\": { \"rank\": \"\", \"category\": \"\", \"class\": \"my_new_value\" }
1267
+ # @param app_id [String] The OneSignal App ID the user record is found under.
1268
+ # @param external_user_id [String] The External User ID mapped to teh device record in OneSignal. Must be actively set on the device to be updated.
1269
+ # @param [Hash] opts the optional parameters
1270
+ # @option opts [UpdatePlayerTagsRequestBody] :update_player_tags_request_body
1271
+ # @return [InlineResponse2003]
1272
+ def update_player_tags(app_id, external_user_id, opts = {})
1273
+ data, _status_code, _headers = update_player_tags_with_http_info(app_id, external_user_id, opts)
1274
+ data
1275
+ end
1276
+
1277
+ # Edit tags with external user id
1278
+ # Update an existing device&#39;s tags in one of your OneSignal apps using the External User ID. Warning - Android SDK Data Synchronization Tags added through the Android SDK tagging methods may not update if using the API to change or update the same tag. For example, if you use SDK method sendTag(\&quot;key\&quot;, \&quot;value1\&quot;) then update the tag value to \&quot;value2\&quot; with this API endpoint. You will not be able to set the value back to \&quot;value1\&quot; through the SDK, you will need to change it to something different through the SDK to be reset. Recommendations if using this Endpoint on Android Mobile Apps: 1 - Do not use the same tag keys for SDK and API updates 2 - If you want to use the same key for both SDK and API updates, call the SDK getTags method first to update the device&#39;s tags. This is only applicable on the Android Mobile App SDKs. 📘 Deleting Tags To delete a tag, include its key and set its value to blank. Omitting a key/value will not delete it. For example, if I wanted to delete two existing tags rank and category while simultaneously adding a new tag class, the tags JSON would look like the following: \&quot;tags\&quot;: { \&quot;rank\&quot;: \&quot;\&quot;, \&quot;category\&quot;: \&quot;\&quot;, \&quot;class\&quot;: \&quot;my_new_value\&quot; }
1279
+ # @param app_id [String] The OneSignal App ID the user record is found under.
1280
+ # @param external_user_id [String] The External User ID mapped to teh device record in OneSignal. Must be actively set on the device to be updated.
1281
+ # @param [Hash] opts the optional parameters
1282
+ # @option opts [UpdatePlayerTagsRequestBody] :update_player_tags_request_body
1283
+ # @return [Array<(InlineResponse2003, Integer, Hash)>] InlineResponse2003 data, response status code and response headers
1284
+ def update_player_tags_with_http_info(app_id, external_user_id, opts = {})
1285
+ if @api_client.config.debugging
1286
+ @api_client.config.logger.debug 'Calling API: DefaultApi.update_player_tags ...'
1287
+ end
1288
+ # verify the required parameter 'app_id' is set
1289
+ if @api_client.config.client_side_validation && app_id.nil?
1290
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.update_player_tags"
1291
+ end
1292
+ # verify the required parameter 'external_user_id' is set
1293
+ if @api_client.config.client_side_validation && external_user_id.nil?
1294
+ fail ArgumentError, "Missing the required parameter 'external_user_id' when calling DefaultApi.update_player_tags"
1295
+ end
1296
+ # resource path
1297
+ local_var_path = '/apps/{app_id}/users/{external_user_id}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'external_user_id' + '}', CGI.escape(external_user_id.to_s))
1298
+
1299
+ # query parameters
1300
+ query_params = opts[:query_params] || {}
1301
+
1302
+ # header parameters
1303
+ header_params = opts[:header_params] || {}
1304
+ # HTTP header 'Accept' (if needed)
1305
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1306
+ # HTTP header 'Content-Type'
1307
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
1308
+
1309
+ # form parameters
1310
+ form_params = opts[:form_params] || {}
1311
+
1312
+ # http body (model)
1313
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'update_player_tags_request_body'])
1314
+
1315
+ # return_type
1316
+ return_type = opts[:debug_return_type] || 'InlineResponse2003'
1317
+
1318
+ # auth_names
1319
+ auth_names = opts[:debug_auth_names] || ['app_key']
1320
+
1321
+ new_options = opts.merge(
1322
+ :operation => :"DefaultApi.update_player_tags",
1323
+ :header_params => header_params,
1324
+ :query_params => query_params,
1325
+ :form_params => form_params,
1326
+ :body => post_body,
1327
+ :auth_names => auth_names,
1328
+ :return_type => return_type
1329
+ )
1330
+
1331
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
1332
+ if @api_client.config.debugging
1333
+ @api_client.config.logger.debug "API called: DefaultApi#update_player_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1334
+ end
1335
+ return data, status_code, headers
1336
+ end
1337
+ end
1338
+ end