onesignal 0.2.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +14 -0
  3. data/Gemfile +6 -1
  4. data/LICENSE +6 -3
  5. data/README.md +144 -99
  6. data/RELEASE_INSTRUCTIONS.md +11 -0
  7. data/Rakefile +8 -8
  8. data/docs/App.md +76 -0
  9. data/docs/Button.md +22 -0
  10. data/docs/DefaultApi.md +1394 -0
  11. data/docs/DeliveryData.md +26 -0
  12. data/docs/ExportPlayersRequestBody.md +22 -0
  13. data/docs/Filter.md +24 -0
  14. data/docs/FilterExpressions.md +26 -0
  15. data/docs/FilterNotificationTarget.md +40 -0
  16. data/docs/GetNotificationRequestBody.md +22 -0
  17. data/docs/InlineResponse200.md +24 -0
  18. data/docs/InlineResponse2001.md +18 -0
  19. data/docs/InlineResponse2002.md +20 -0
  20. data/docs/InlineResponse2005.md +20 -0
  21. data/docs/InlineResponse2007.md +18 -0
  22. data/docs/InlineResponse2008.md +18 -0
  23. data/docs/InlineResponse201.md +20 -0
  24. data/docs/InlineResponse400.md +18 -0
  25. data/docs/InlineResponse4001.md +20 -0
  26. data/docs/InlineResponse4002.md +20 -0
  27. data/docs/InlineResponse4003.md +18 -0
  28. data/docs/InvalidIdentifierError.md +20 -0
  29. data/docs/Notification.md +240 -0
  30. data/docs/Notification200Errors.md +49 -0
  31. data/docs/NotificationAllOf.md +192 -0
  32. data/docs/NotificationAllOfAndroidBackgroundLayout.md +22 -0
  33. data/docs/NotificationSlice.md +24 -0
  34. data/docs/NotificationTarget.md +64 -0
  35. data/docs/NotificationWithMeta.md +260 -0
  36. data/docs/NotificationWithMetaAllOf.md +38 -0
  37. data/docs/Operator.md +18 -0
  38. data/docs/OutcomeData.md +22 -0
  39. data/docs/OutcomesData.md +18 -0
  40. data/docs/PlatformDeliveryData.md +28 -0
  41. data/docs/Player.md +70 -0
  42. data/docs/PlayerNotificationTarget.md +36 -0
  43. data/docs/PlayerSlice.md +24 -0
  44. data/docs/Purchase.md +22 -0
  45. data/docs/Segment.md +22 -0
  46. data/docs/SegmentNotificationTarget.md +20 -0
  47. data/docs/StringMap.md +102 -0
  48. data/docs/UpdatePlayerTagsRequestBody.md +18 -0
  49. data/lib/onesignal/api/default_api.rb +1365 -0
  50. data/lib/onesignal/api_client.rb +393 -0
  51. data/lib/onesignal/api_error.rb +57 -0
  52. data/lib/onesignal/configuration.rb +245 -0
  53. data/lib/onesignal/models/app.rb +519 -20
  54. data/lib/onesignal/models/button.rb +242 -0
  55. data/lib/onesignal/models/delivery_data.rb +260 -0
  56. data/lib/onesignal/models/export_players_request_body.rb +242 -0
  57. data/lib/onesignal/models/filter.rb +294 -0
  58. data/lib/onesignal/models/filter_expressions.rb +336 -0
  59. data/lib/onesignal/models/filter_notification_target.rb +330 -0
  60. data/lib/onesignal/models/get_notification_request_body.rb +273 -0
  61. data/lib/onesignal/models/inline_response200.rb +257 -0
  62. data/lib/onesignal/models/inline_response2001.rb +219 -0
  63. data/lib/onesignal/models/inline_response2002.rb +228 -0
  64. data/lib/onesignal/models/inline_response2005.rb +228 -0
  65. data/lib/onesignal/models/inline_response2007.rb +219 -0
  66. data/lib/onesignal/models/inline_response2008.rb +219 -0
  67. data/lib/onesignal/models/inline_response201.rb +229 -0
  68. data/lib/onesignal/models/inline_response400.rb +221 -0
  69. data/lib/onesignal/models/inline_response4001.rb +230 -0
  70. data/lib/onesignal/models/inline_response4002.rb +230 -0
  71. data/lib/onesignal/models/inline_response4003.rb +221 -0
  72. data/lib/onesignal/models/invalid_identifier_error.rb +234 -0
  73. data/lib/onesignal/models/notification.rb +1414 -9
  74. data/lib/onesignal/models/notification200_errors.rb +105 -0
  75. data/lib/onesignal/models/notification_all_of.rb +1144 -0
  76. data/lib/onesignal/models/notification_all_of_android_background_layout.rb +241 -0
  77. data/lib/onesignal/models/notification_slice.rb +248 -0
  78. data/lib/onesignal/models/notification_target.rb +495 -0
  79. data/lib/onesignal/models/notification_with_meta.rb +1526 -0
  80. data/lib/onesignal/models/notification_with_meta_all_of.rb +322 -0
  81. data/lib/onesignal/models/operator.rb +254 -0
  82. data/lib/onesignal/models/outcome_data.rb +286 -0
  83. data/lib/onesignal/models/outcomes_data.rb +221 -0
  84. data/lib/onesignal/models/platform_delivery_data.rb +265 -0
  85. data/lib/onesignal/models/player.rb +480 -13
  86. data/lib/onesignal/models/player_notification_target.rb +330 -0
  87. data/lib/onesignal/models/player_slice.rb +248 -0
  88. data/lib/onesignal/models/purchase.rb +255 -0
  89. data/lib/onesignal/models/segment.rb +252 -0
  90. data/lib/onesignal/models/segment_notification_target.rb +234 -0
  91. data/lib/onesignal/models/string_map.rb +640 -0
  92. data/lib/onesignal/models/update_player_tags_request_body.rb +220 -0
  93. data/lib/onesignal/version.rb +13 -1
  94. data/lib/onesignal.rb +73 -16
  95. data/onesignal.gemspec +37 -27
  96. data/spec/api/default_api_spec.rb +285 -0
  97. data/spec/api_client_spec.rb +226 -0
  98. data/spec/configuration_spec.rb +42 -0
  99. data/spec/models/app_spec.rb +212 -0
  100. data/spec/models/button_spec.rb +46 -0
  101. data/spec/models/delivery_data_spec.rb +58 -0
  102. data/spec/models/export_players_request_body_spec.rb +46 -0
  103. data/spec/models/filter_expressions_spec.rb +66 -0
  104. data/spec/models/filter_notification_target_spec.rb +100 -0
  105. data/spec/models/filter_spec.rb +56 -0
  106. data/spec/models/get_notification_request_body_spec.rb +50 -0
  107. data/spec/models/inline_response2001_spec.rb +34 -0
  108. data/spec/models/inline_response2002_spec.rb +40 -0
  109. data/spec/models/inline_response2005_spec.rb +40 -0
  110. data/spec/models/inline_response2007_spec.rb +34 -0
  111. data/spec/models/inline_response2008_spec.rb +34 -0
  112. data/spec/models/inline_response200_spec.rb +52 -0
  113. data/spec/models/inline_response201_spec.rb +40 -0
  114. data/spec/models/inline_response4001_spec.rb +40 -0
  115. data/spec/models/inline_response4002_spec.rb +40 -0
  116. data/spec/models/inline_response4003_spec.rb +34 -0
  117. data/spec/models/inline_response400_spec.rb +34 -0
  118. data/spec/models/invalid_identifier_error_spec.rb +40 -0
  119. data/spec/models/notification200_errors_spec.rb +31 -0
  120. data/spec/models/notification_all_of_android_background_layout_spec.rb +46 -0
  121. data/spec/models/notification_all_of_spec.rb +560 -0
  122. data/spec/models/notification_slice_spec.rb +52 -0
  123. data/spec/models/notification_spec.rb +704 -0
  124. data/spec/models/notification_target_spec.rb +172 -0
  125. data/spec/models/notification_with_meta_all_of_spec.rb +94 -0
  126. data/spec/models/notification_with_meta_spec.rb +764 -0
  127. data/spec/models/operator_spec.rb +38 -0
  128. data/spec/models/outcome_data_spec.rb +50 -0
  129. data/spec/models/outcomes_data_spec.rb +34 -0
  130. data/spec/models/platform_delivery_data_spec.rb +64 -0
  131. data/spec/models/player_notification_target_spec.rb +88 -0
  132. data/spec/models/player_slice_spec.rb +52 -0
  133. data/spec/models/player_spec.rb +190 -0
  134. data/spec/models/purchase_spec.rb +46 -0
  135. data/spec/models/segment_notification_target_spec.rb +40 -0
  136. data/spec/models/segment_spec.rb +46 -0
  137. data/spec/models/string_map_spec.rb +286 -0
  138. data/spec/models/update_player_tags_request_body_spec.rb +34 -0
  139. data/spec/spec_helper.rb +111 -0
  140. metadata +203 -64
  141. data/.gitignore +0 -10
  142. data/.rubocop.yml +0 -17
  143. data/.travis.yml +0 -16
  144. data/CODE_OF_CONDUCT.md +0 -49
  145. data/bin/console +0 -14
  146. data/bin/setup +0 -8
  147. data/lib/onesignal/app_id_missing_error.rb +0 -7
  148. data/lib/onesignal/client.rb +0 -44
  149. data/lib/onesignal/models/base_model.rb +0 -19
  150. data/lib/onesignal/request.rb +0 -94
  151. data/lib/onesignal/request_error.rb +0 -21
  152. data/lib/onesignal/resources/app_resource.rb +0 -27
  153. data/lib/onesignal/resources/base_resource.rb +0 -35
  154. data/lib/onesignal/resources/notification_resource.rb +0 -33
  155. data/lib/onesignal/resources/player_resource.rb +0 -53
@@ -0,0 +1,1365 @@
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.1
7
+ Contact: devrel@onesignal.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.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
+ content_type = @api_client.select_header_content_type(['application/json'])
127
+ if !content_type.nil?
128
+ header_params['Content-Type'] = content_type
129
+ end
130
+
131
+ # form parameters
132
+ form_params = opts[:form_params] || {}
133
+
134
+ # http body (model)
135
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(app)
136
+
137
+ # return_type
138
+ return_type = opts[:debug_return_type] || 'App'
139
+
140
+ # auth_names
141
+ auth_names = opts[:debug_auth_names] || ['user_key']
142
+
143
+ new_options = opts.merge(
144
+ :operation => :"DefaultApi.create_app",
145
+ :header_params => header_params,
146
+ :query_params => query_params,
147
+ :form_params => form_params,
148
+ :body => post_body,
149
+ :auth_names => auth_names,
150
+ :return_type => return_type
151
+ )
152
+
153
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
154
+ if @api_client.config.debugging
155
+ @api_client.config.logger.debug "API called: DefaultApi#create_app\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
156
+ end
157
+ return data, status_code, headers
158
+ end
159
+
160
+ # Create notification
161
+ # Sends notifications to your users
162
+ # @param notification [Notification]
163
+ # @param [Hash] opts the optional parameters
164
+ # @return [InlineResponse200]
165
+ def create_notification(notification, opts = {})
166
+ data, _status_code, _headers = create_notification_with_http_info(notification, opts)
167
+ data
168
+ end
169
+
170
+ # Create notification
171
+ # Sends notifications to your users
172
+ # @param notification [Notification]
173
+ # @param [Hash] opts the optional parameters
174
+ # @return [Array<(InlineResponse200, Integer, Hash)>] InlineResponse200 data, response status code and response headers
175
+ def create_notification_with_http_info(notification, opts = {})
176
+ if @api_client.config.debugging
177
+ @api_client.config.logger.debug 'Calling API: DefaultApi.create_notification ...'
178
+ end
179
+ # verify the required parameter 'notification' is set
180
+ if @api_client.config.client_side_validation && notification.nil?
181
+ fail ArgumentError, "Missing the required parameter 'notification' when calling DefaultApi.create_notification"
182
+ end
183
+ # resource path
184
+ local_var_path = '/notifications'
185
+
186
+ # query parameters
187
+ query_params = opts[:query_params] || {}
188
+
189
+ # header parameters
190
+ header_params = opts[:header_params] || {}
191
+ # HTTP header 'Accept' (if needed)
192
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
193
+ # HTTP header 'Content-Type'
194
+ content_type = @api_client.select_header_content_type(['application/json'])
195
+ if !content_type.nil?
196
+ header_params['Content-Type'] = content_type
197
+ end
198
+
199
+ # form parameters
200
+ form_params = opts[:form_params] || {}
201
+
202
+ # http body (model)
203
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(notification)
204
+
205
+ # return_type
206
+ return_type = opts[:debug_return_type] || 'InlineResponse200'
207
+
208
+ # auth_names
209
+ auth_names = opts[:debug_auth_names] || ['app_key']
210
+
211
+ new_options = opts.merge(
212
+ :operation => :"DefaultApi.create_notification",
213
+ :header_params => header_params,
214
+ :query_params => query_params,
215
+ :form_params => form_params,
216
+ :body => post_body,
217
+ :auth_names => auth_names,
218
+ :return_type => return_type
219
+ )
220
+
221
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
222
+ if @api_client.config.debugging
223
+ @api_client.config.logger.debug "API called: DefaultApi#create_notification\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
224
+ end
225
+ return data, status_code, headers
226
+ end
227
+
228
+ # Add a device
229
+ # Register a new device to one of your OneSignal apps &#x1F6A7; 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. &#x1F6A7; iOS Must set test_type to 1 when building your iOS app as development. Omit this field in your production app builds.
230
+ # @param player [Player]
231
+ # @param [Hash] opts the optional parameters
232
+ # @return [InlineResponse2005]
233
+ def create_player(player, opts = {})
234
+ data, _status_code, _headers = create_player_with_http_info(player, opts)
235
+ data
236
+ end
237
+
238
+ # Add a device
239
+ # Register a new device to one of your OneSignal apps &amp;#x1F6A7; 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. &amp;#x1F6A7; iOS Must set test_type to 1 when building your iOS app as development. Omit this field in your production app builds.
240
+ # @param player [Player]
241
+ # @param [Hash] opts the optional parameters
242
+ # @return [Array<(InlineResponse2005, Integer, Hash)>] InlineResponse2005 data, response status code and response headers
243
+ def create_player_with_http_info(player, opts = {})
244
+ if @api_client.config.debugging
245
+ @api_client.config.logger.debug 'Calling API: DefaultApi.create_player ...'
246
+ end
247
+ # verify the required parameter 'player' is set
248
+ if @api_client.config.client_side_validation && player.nil?
249
+ fail ArgumentError, "Missing the required parameter 'player' when calling DefaultApi.create_player"
250
+ end
251
+ # resource path
252
+ local_var_path = '/players'
253
+
254
+ # query parameters
255
+ query_params = opts[:query_params] || {}
256
+
257
+ # header parameters
258
+ header_params = opts[:header_params] || {}
259
+ # HTTP header 'Accept' (if needed)
260
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
261
+ # HTTP header 'Content-Type'
262
+ content_type = @api_client.select_header_content_type(['application/json'])
263
+ if !content_type.nil?
264
+ header_params['Content-Type'] = content_type
265
+ end
266
+
267
+ # form parameters
268
+ form_params = opts[:form_params] || {}
269
+
270
+ # http body (model)
271
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(player)
272
+
273
+ # return_type
274
+ return_type = opts[:debug_return_type] || 'InlineResponse2005'
275
+
276
+ # auth_names
277
+ auth_names = opts[:debug_auth_names] || ['app_key']
278
+
279
+ new_options = opts.merge(
280
+ :operation => :"DefaultApi.create_player",
281
+ :header_params => header_params,
282
+ :query_params => query_params,
283
+ :form_params => form_params,
284
+ :body => post_body,
285
+ :auth_names => auth_names,
286
+ :return_type => return_type
287
+ )
288
+
289
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
290
+ if @api_client.config.debugging
291
+ @api_client.config.logger.debug "API called: DefaultApi#create_player\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
292
+ end
293
+ return data, status_code, headers
294
+ end
295
+
296
+ # Create Segments
297
+ # 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. &#x1F6A7; 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.
298
+ # @param app_id [String] The OneSignal App ID for your app. Available in Keys &amp; IDs.
299
+ # @param [Hash] opts the optional parameters
300
+ # @option opts [Segment] :segment
301
+ # @return [InlineResponse201]
302
+ def create_segments(app_id, opts = {})
303
+ data, _status_code, _headers = create_segments_with_http_info(app_id, opts)
304
+ data
305
+ end
306
+
307
+ # Create Segments
308
+ # 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. &amp;#x1F6A7; 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.
309
+ # @param app_id [String] The OneSignal App ID for your app. Available in Keys &amp; IDs.
310
+ # @param [Hash] opts the optional parameters
311
+ # @option opts [Segment] :segment
312
+ # @return [Array<(InlineResponse201, Integer, Hash)>] InlineResponse201 data, response status code and response headers
313
+ def create_segments_with_http_info(app_id, opts = {})
314
+ if @api_client.config.debugging
315
+ @api_client.config.logger.debug 'Calling API: DefaultApi.create_segments ...'
316
+ end
317
+ # verify the required parameter 'app_id' is set
318
+ if @api_client.config.client_side_validation && app_id.nil?
319
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.create_segments"
320
+ end
321
+ # resource path
322
+ local_var_path = '/apps/{app_id}/segments'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s))
323
+
324
+ # query parameters
325
+ query_params = opts[:query_params] || {}
326
+
327
+ # header parameters
328
+ header_params = opts[:header_params] || {}
329
+ # HTTP header 'Accept' (if needed)
330
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
331
+ # HTTP header 'Content-Type'
332
+ content_type = @api_client.select_header_content_type(['application/json'])
333
+ if !content_type.nil?
334
+ header_params['Content-Type'] = content_type
335
+ end
336
+
337
+ # form parameters
338
+ form_params = opts[:form_params] || {}
339
+
340
+ # http body (model)
341
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'segment'])
342
+
343
+ # return_type
344
+ return_type = opts[:debug_return_type] || 'InlineResponse201'
345
+
346
+ # auth_names
347
+ auth_names = opts[:debug_auth_names] || ['app_key']
348
+
349
+ new_options = opts.merge(
350
+ :operation => :"DefaultApi.create_segments",
351
+ :header_params => header_params,
352
+ :query_params => query_params,
353
+ :form_params => form_params,
354
+ :body => post_body,
355
+ :auth_names => auth_names,
356
+ :return_type => return_type
357
+ )
358
+
359
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
360
+ if @api_client.config.debugging
361
+ @api_client.config.logger.debug "API called: DefaultApi#create_segments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
362
+ end
363
+ return data, status_code, headers
364
+ end
365
+
366
+ # Delete a user record
367
+ # Delete player - Required: Used to delete a single, specific Player ID record from a specific OneSignal app.
368
+ # @param app_id [String] The OneSignal App ID for your app. Available in Keys &amp; IDs.
369
+ # @param player_id [String] The OneSignal player_id
370
+ # @param [Hash] opts the optional parameters
371
+ # @return [InlineResponse2007]
372
+ def delete_player(app_id, player_id, opts = {})
373
+ data, _status_code, _headers = delete_player_with_http_info(app_id, player_id, opts)
374
+ data
375
+ end
376
+
377
+ # Delete a user record
378
+ # Delete player - Required: Used to delete a single, specific Player ID record from a specific OneSignal app.
379
+ # @param app_id [String] The OneSignal App ID for your app. Available in Keys &amp; IDs.
380
+ # @param player_id [String] The OneSignal player_id
381
+ # @param [Hash] opts the optional parameters
382
+ # @return [Array<(InlineResponse2007, Integer, Hash)>] InlineResponse2007 data, response status code and response headers
383
+ def delete_player_with_http_info(app_id, player_id, opts = {})
384
+ if @api_client.config.debugging
385
+ @api_client.config.logger.debug 'Calling API: DefaultApi.delete_player ...'
386
+ end
387
+ # verify the required parameter 'app_id' is set
388
+ if @api_client.config.client_side_validation && app_id.nil?
389
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.delete_player"
390
+ end
391
+ # verify the required parameter 'player_id' is set
392
+ if @api_client.config.client_side_validation && player_id.nil?
393
+ fail ArgumentError, "Missing the required parameter 'player_id' when calling DefaultApi.delete_player"
394
+ end
395
+ # resource path
396
+ local_var_path = '/players/{player_id}'.sub('{' + 'player_id' + '}', CGI.escape(player_id.to_s))
397
+
398
+ # query parameters
399
+ query_params = opts[:query_params] || {}
400
+ query_params[:'app_id'] = app_id
401
+
402
+ # header parameters
403
+ header_params = opts[:header_params] || {}
404
+ # HTTP header 'Accept' (if needed)
405
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
406
+
407
+ # form parameters
408
+ form_params = opts[:form_params] || {}
409
+
410
+ # http body (model)
411
+ post_body = opts[:debug_body]
412
+
413
+ # return_type
414
+ return_type = opts[:debug_return_type] || 'InlineResponse2007'
415
+
416
+ # auth_names
417
+ auth_names = opts[:debug_auth_names] || ['app_key']
418
+
419
+ new_options = opts.merge(
420
+ :operation => :"DefaultApi.delete_player",
421
+ :header_params => header_params,
422
+ :query_params => query_params,
423
+ :form_params => form_params,
424
+ :body => post_body,
425
+ :auth_names => auth_names,
426
+ :return_type => return_type
427
+ )
428
+
429
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
430
+ if @api_client.config.debugging
431
+ @api_client.config.logger.debug "API called: DefaultApi#delete_player\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
432
+ end
433
+ return data, status_code, headers
434
+ end
435
+
436
+ # Delete Segments
437
+ # 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.
438
+ # @param app_id [String] The OneSignal App ID for your app. Available in Keys &amp; IDs.
439
+ # @param segment_id [String] The segment_id can be found in the URL of the segment when viewing it in the dashboard.
440
+ # @param [Hash] opts the optional parameters
441
+ # @return [InlineResponse2001]
442
+ def delete_segments(app_id, segment_id, opts = {})
443
+ data, _status_code, _headers = delete_segments_with_http_info(app_id, segment_id, opts)
444
+ data
445
+ end
446
+
447
+ # Delete Segments
448
+ # 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.
449
+ # @param app_id [String] The OneSignal App ID for your app. Available in Keys &amp; IDs.
450
+ # @param segment_id [String] The segment_id can be found in the URL of the segment when viewing it in the dashboard.
451
+ # @param [Hash] opts the optional parameters
452
+ # @return [Array<(InlineResponse2001, Integer, Hash)>] InlineResponse2001 data, response status code and response headers
453
+ def delete_segments_with_http_info(app_id, segment_id, opts = {})
454
+ if @api_client.config.debugging
455
+ @api_client.config.logger.debug 'Calling API: DefaultApi.delete_segments ...'
456
+ end
457
+ # verify the required parameter 'app_id' is set
458
+ if @api_client.config.client_side_validation && app_id.nil?
459
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.delete_segments"
460
+ end
461
+ # verify the required parameter 'segment_id' is set
462
+ if @api_client.config.client_side_validation && segment_id.nil?
463
+ fail ArgumentError, "Missing the required parameter 'segment_id' when calling DefaultApi.delete_segments"
464
+ end
465
+ # resource path
466
+ 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))
467
+
468
+ # query parameters
469
+ query_params = opts[:query_params] || {}
470
+
471
+ # header parameters
472
+ header_params = opts[:header_params] || {}
473
+ # HTTP header 'Accept' (if needed)
474
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
475
+
476
+ # form parameters
477
+ form_params = opts[:form_params] || {}
478
+
479
+ # http body (model)
480
+ post_body = opts[:debug_body]
481
+
482
+ # return_type
483
+ return_type = opts[:debug_return_type] || 'InlineResponse2001'
484
+
485
+ # auth_names
486
+ auth_names = opts[:debug_auth_names] || ['app_key']
487
+
488
+ new_options = opts.merge(
489
+ :operation => :"DefaultApi.delete_segments",
490
+ :header_params => header_params,
491
+ :query_params => query_params,
492
+ :form_params => form_params,
493
+ :body => post_body,
494
+ :auth_names => auth_names,
495
+ :return_type => return_type
496
+ )
497
+
498
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
499
+ if @api_client.config.debugging
500
+ @api_client.config.logger.debug "API called: DefaultApi#delete_segments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
501
+ end
502
+ return data, status_code, headers
503
+ end
504
+
505
+ # CSV export
506
+ # 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. &#x1F6A7; 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. &#x1F6A7; Requires Authentication Key Requires your OneSignal App's REST API Key, available in Keys & IDs. &#x1F6A7; 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. |
507
+ # @param app_id [String] The app ID that you want to export devices from
508
+ # @param [Hash] opts the optional parameters
509
+ # @option opts [ExportPlayersRequestBody] :export_players_request_body
510
+ # @return [InlineResponse2008]
511
+ def export_players(app_id, opts = {})
512
+ data, _status_code, _headers = export_players_with_http_info(app_id, opts)
513
+ data
514
+ end
515
+
516
+ # CSV export
517
+ # 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. &amp;#x1F6A7; 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. &amp;#x1F6A7; Requires Authentication Key Requires your OneSignal App&#39;s REST API Key, available in Keys &amp; IDs. &amp;#x1F6A7; 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. |
518
+ # @param app_id [String] The app ID that you want to export devices from
519
+ # @param [Hash] opts the optional parameters
520
+ # @option opts [ExportPlayersRequestBody] :export_players_request_body
521
+ # @return [Array<(InlineResponse2008, Integer, Hash)>] InlineResponse2008 data, response status code and response headers
522
+ def export_players_with_http_info(app_id, opts = {})
523
+ if @api_client.config.debugging
524
+ @api_client.config.logger.debug 'Calling API: DefaultApi.export_players ...'
525
+ end
526
+ # verify the required parameter 'app_id' is set
527
+ if @api_client.config.client_side_validation && app_id.nil?
528
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.export_players"
529
+ end
530
+ # resource path
531
+ local_var_path = '/players/csv_export?app_id={app_id}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s))
532
+
533
+ # query parameters
534
+ query_params = opts[:query_params] || {}
535
+
536
+ # header parameters
537
+ header_params = opts[:header_params] || {}
538
+ # HTTP header 'Accept' (if needed)
539
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
540
+ # HTTP header 'Content-Type'
541
+ content_type = @api_client.select_header_content_type(['application/json'])
542
+ if !content_type.nil?
543
+ header_params['Content-Type'] = content_type
544
+ end
545
+
546
+ # form parameters
547
+ form_params = opts[:form_params] || {}
548
+
549
+ # http body (model)
550
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'export_players_request_body'])
551
+
552
+ # return_type
553
+ return_type = opts[:debug_return_type] || 'InlineResponse2008'
554
+
555
+ # auth_names
556
+ auth_names = opts[:debug_auth_names] || ['app_key']
557
+
558
+ new_options = opts.merge(
559
+ :operation => :"DefaultApi.export_players",
560
+ :header_params => header_params,
561
+ :query_params => query_params,
562
+ :form_params => form_params,
563
+ :body => post_body,
564
+ :auth_names => auth_names,
565
+ :return_type => return_type
566
+ )
567
+
568
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
569
+ if @api_client.config.debugging
570
+ @api_client.config.logger.debug "API called: DefaultApi#export_players\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
571
+ end
572
+ return data, status_code, headers
573
+ end
574
+
575
+ # View an app
576
+ # View the details of a single OneSignal app
577
+ # @param app_id [String] An app id
578
+ # @param [Hash] opts the optional parameters
579
+ # @return [App]
580
+ def get_app(app_id, opts = {})
581
+ data, _status_code, _headers = get_app_with_http_info(app_id, opts)
582
+ data
583
+ end
584
+
585
+ # View an app
586
+ # View the details of a single OneSignal app
587
+ # @param app_id [String] An app id
588
+ # @param [Hash] opts the optional parameters
589
+ # @return [Array<(App, Integer, Hash)>] App data, response status code and response headers
590
+ def get_app_with_http_info(app_id, opts = {})
591
+ if @api_client.config.debugging
592
+ @api_client.config.logger.debug 'Calling API: DefaultApi.get_app ...'
593
+ end
594
+ # verify the required parameter 'app_id' is set
595
+ if @api_client.config.client_side_validation && app_id.nil?
596
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.get_app"
597
+ end
598
+ # resource path
599
+ local_var_path = '/apps/{app_id}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s))
600
+
601
+ # query parameters
602
+ query_params = opts[:query_params] || {}
603
+
604
+ # header parameters
605
+ header_params = opts[:header_params] || {}
606
+ # HTTP header 'Accept' (if needed)
607
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
608
+
609
+ # form parameters
610
+ form_params = opts[:form_params] || {}
611
+
612
+ # http body (model)
613
+ post_body = opts[:debug_body]
614
+
615
+ # return_type
616
+ return_type = opts[:debug_return_type] || 'App'
617
+
618
+ # auth_names
619
+ auth_names = opts[:debug_auth_names] || ['user_key']
620
+
621
+ new_options = opts.merge(
622
+ :operation => :"DefaultApi.get_app",
623
+ :header_params => header_params,
624
+ :query_params => query_params,
625
+ :form_params => form_params,
626
+ :body => post_body,
627
+ :auth_names => auth_names,
628
+ :return_type => return_type
629
+ )
630
+
631
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
632
+ if @api_client.config.debugging
633
+ @api_client.config.logger.debug "API called: DefaultApi#get_app\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
634
+ end
635
+ return data, status_code, headers
636
+ end
637
+
638
+ # View apps
639
+ # View the details of all of your current OneSignal apps
640
+ # @param [Hash] opts the optional parameters
641
+ # @return [Array<App>]
642
+ def get_apps(opts = {})
643
+ data, _status_code, _headers = get_apps_with_http_info(opts)
644
+ data
645
+ end
646
+
647
+ # View apps
648
+ # View the details of all of your current OneSignal apps
649
+ # @param [Hash] opts the optional parameters
650
+ # @return [Array<(Array<App>, Integer, Hash)>] Array<App> data, response status code and response headers
651
+ def get_apps_with_http_info(opts = {})
652
+ if @api_client.config.debugging
653
+ @api_client.config.logger.debug 'Calling API: DefaultApi.get_apps ...'
654
+ end
655
+ # resource path
656
+ local_var_path = '/apps'
657
+
658
+ # query parameters
659
+ query_params = opts[:query_params] || {}
660
+
661
+ # header parameters
662
+ header_params = opts[:header_params] || {}
663
+ # HTTP header 'Accept' (if needed)
664
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
665
+
666
+ # form parameters
667
+ form_params = opts[:form_params] || {}
668
+
669
+ # http body (model)
670
+ post_body = opts[:debug_body]
671
+
672
+ # return_type
673
+ return_type = opts[:debug_return_type] || 'Array<App>'
674
+
675
+ # auth_names
676
+ auth_names = opts[:debug_auth_names] || ['user_key']
677
+
678
+ new_options = opts.merge(
679
+ :operation => :"DefaultApi.get_apps",
680
+ :header_params => header_params,
681
+ :query_params => query_params,
682
+ :form_params => form_params,
683
+ :body => post_body,
684
+ :auth_names => auth_names,
685
+ :return_type => return_type
686
+ )
687
+
688
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
689
+ if @api_client.config.debugging
690
+ @api_client.config.logger.debug "API called: DefaultApi#get_apps\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
691
+ end
692
+ return data, status_code, headers
693
+ end
694
+
695
+ # View notification
696
+ # View the details of a single notification and outcomes associated with it
697
+ # @param app_id [String]
698
+ # @param notification_id [String]
699
+ # @param [Hash] opts the optional parameters
700
+ # @return [NotificationWithMeta]
701
+ def get_notification(app_id, notification_id, opts = {})
702
+ data, _status_code, _headers = get_notification_with_http_info(app_id, notification_id, opts)
703
+ data
704
+ end
705
+
706
+ # View notification
707
+ # View the details of a single notification and outcomes associated with it
708
+ # @param app_id [String]
709
+ # @param notification_id [String]
710
+ # @param [Hash] opts the optional parameters
711
+ # @return [Array<(NotificationWithMeta, Integer, Hash)>] NotificationWithMeta data, response status code and response headers
712
+ def get_notification_with_http_info(app_id, notification_id, opts = {})
713
+ if @api_client.config.debugging
714
+ @api_client.config.logger.debug 'Calling API: DefaultApi.get_notification ...'
715
+ end
716
+ # verify the required parameter 'app_id' is set
717
+ if @api_client.config.client_side_validation && app_id.nil?
718
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.get_notification"
719
+ end
720
+ # verify the required parameter 'notification_id' is set
721
+ if @api_client.config.client_side_validation && notification_id.nil?
722
+ fail ArgumentError, "Missing the required parameter 'notification_id' when calling DefaultApi.get_notification"
723
+ end
724
+ # resource path
725
+ local_var_path = '/notifications/{notification_id}'.sub('{' + 'notification_id' + '}', CGI.escape(notification_id.to_s))
726
+
727
+ # query parameters
728
+ query_params = opts[:query_params] || {}
729
+ query_params[:'app_id'] = app_id
730
+
731
+ # header parameters
732
+ header_params = opts[:header_params] || {}
733
+ # HTTP header 'Accept' (if needed)
734
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
735
+
736
+ # form parameters
737
+ form_params = opts[:form_params] || {}
738
+
739
+ # http body (model)
740
+ post_body = opts[:debug_body]
741
+
742
+ # return_type
743
+ return_type = opts[:debug_return_type] || 'NotificationWithMeta'
744
+
745
+ # auth_names
746
+ auth_names = opts[:debug_auth_names] || ['app_key']
747
+
748
+ new_options = opts.merge(
749
+ :operation => :"DefaultApi.get_notification",
750
+ :header_params => header_params,
751
+ :query_params => query_params,
752
+ :form_params => form_params,
753
+ :body => post_body,
754
+ :auth_names => auth_names,
755
+ :return_type => return_type
756
+ )
757
+
758
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
759
+ if @api_client.config.debugging
760
+ @api_client.config.logger.debug "API called: DefaultApi#get_notification\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
761
+ end
762
+ return data, status_code, headers
763
+ end
764
+
765
+ # Notification History
766
+ # -> 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. &#x1F6A7; 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.
767
+ # @param notification_id [String] The \&quot;id\&quot; of the message found in the Notification object
768
+ # @param get_notification_request_body [GetNotificationRequestBody]
769
+ # @param [Hash] opts the optional parameters
770
+ # @return [InlineResponse2002]
771
+ def get_notification_history(notification_id, get_notification_request_body, opts = {})
772
+ data, _status_code, _headers = get_notification_history_with_http_info(notification_id, get_notification_request_body, opts)
773
+ data
774
+ end
775
+
776
+ # Notification History
777
+ # -&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. &amp;#x1F6A7; 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.
778
+ # @param notification_id [String] The \&quot;id\&quot; of the message found in the Notification object
779
+ # @param get_notification_request_body [GetNotificationRequestBody]
780
+ # @param [Hash] opts the optional parameters
781
+ # @return [Array<(InlineResponse2002, Integer, Hash)>] InlineResponse2002 data, response status code and response headers
782
+ def get_notification_history_with_http_info(notification_id, get_notification_request_body, opts = {})
783
+ if @api_client.config.debugging
784
+ @api_client.config.logger.debug 'Calling API: DefaultApi.get_notification_history ...'
785
+ end
786
+ # verify the required parameter 'notification_id' is set
787
+ if @api_client.config.client_side_validation && notification_id.nil?
788
+ fail ArgumentError, "Missing the required parameter 'notification_id' when calling DefaultApi.get_notification_history"
789
+ end
790
+ # verify the required parameter 'get_notification_request_body' is set
791
+ if @api_client.config.client_side_validation && get_notification_request_body.nil?
792
+ fail ArgumentError, "Missing the required parameter 'get_notification_request_body' when calling DefaultApi.get_notification_history"
793
+ end
794
+ # resource path
795
+ local_var_path = '/notifications/{notification_id}/history'.sub('{' + 'notification_id' + '}', CGI.escape(notification_id.to_s))
796
+
797
+ # query parameters
798
+ query_params = opts[:query_params] || {}
799
+
800
+ # header parameters
801
+ header_params = opts[:header_params] || {}
802
+ # HTTP header 'Accept' (if needed)
803
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
804
+ # HTTP header 'Content-Type'
805
+ content_type = @api_client.select_header_content_type(['application/json'])
806
+ if !content_type.nil?
807
+ header_params['Content-Type'] = content_type
808
+ end
809
+
810
+ # form parameters
811
+ form_params = opts[:form_params] || {}
812
+
813
+ # http body (model)
814
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(get_notification_request_body)
815
+
816
+ # return_type
817
+ return_type = opts[:debug_return_type] || 'InlineResponse2002'
818
+
819
+ # auth_names
820
+ auth_names = opts[:debug_auth_names] || ['app_key']
821
+
822
+ new_options = opts.merge(
823
+ :operation => :"DefaultApi.get_notification_history",
824
+ :header_params => header_params,
825
+ :query_params => query_params,
826
+ :form_params => form_params,
827
+ :body => post_body,
828
+ :auth_names => auth_names,
829
+ :return_type => return_type
830
+ )
831
+
832
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
833
+ if @api_client.config.debugging
834
+ @api_client.config.logger.debug "API called: DefaultApi#get_notification_history\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
835
+ end
836
+ return data, status_code, headers
837
+ end
838
+
839
+ # View notifications
840
+ # View the details of multiple notifications
841
+ # @param app_id [String] The app ID that you want to view notifications from
842
+ # @param [Hash] opts the optional parameters
843
+ # @option opts [Integer] :limit How many notifications to return. Max is 50. Default is 50.
844
+ # @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.
845
+ # @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
846
+ # @return [NotificationSlice]
847
+ def get_notifications(app_id, opts = {})
848
+ data, _status_code, _headers = get_notifications_with_http_info(app_id, opts)
849
+ data
850
+ end
851
+
852
+ # View notifications
853
+ # View the details of multiple notifications
854
+ # @param app_id [String] The app ID that you want to view notifications from
855
+ # @param [Hash] opts the optional parameters
856
+ # @option opts [Integer] :limit How many notifications to return. Max is 50. Default is 50.
857
+ # @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.
858
+ # @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
859
+ # @return [Array<(NotificationSlice, Integer, Hash)>] NotificationSlice data, response status code and response headers
860
+ def get_notifications_with_http_info(app_id, opts = {})
861
+ if @api_client.config.debugging
862
+ @api_client.config.logger.debug 'Calling API: DefaultApi.get_notifications ...'
863
+ end
864
+ # verify the required parameter 'app_id' is set
865
+ if @api_client.config.client_side_validation && app_id.nil?
866
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.get_notifications"
867
+ end
868
+ allowable_values = [0, 1, 3]
869
+ if @api_client.config.client_side_validation && opts[:'kind'] && !allowable_values.include?(opts[:'kind'])
870
+ fail ArgumentError, "invalid value for \"kind\", must be one of #{allowable_values}"
871
+ end
872
+ # resource path
873
+ local_var_path = '/notifications'
874
+
875
+ # query parameters
876
+ query_params = opts[:query_params] || {}
877
+ query_params[:'app_id'] = app_id
878
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
879
+ query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
880
+ query_params[:'kind'] = opts[:'kind'] if !opts[:'kind'].nil?
881
+
882
+ # header parameters
883
+ header_params = opts[:header_params] || {}
884
+ # HTTP header 'Accept' (if needed)
885
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
886
+
887
+ # form parameters
888
+ form_params = opts[:form_params] || {}
889
+
890
+ # http body (model)
891
+ post_body = opts[:debug_body]
892
+
893
+ # return_type
894
+ return_type = opts[:debug_return_type] || 'NotificationSlice'
895
+
896
+ # auth_names
897
+ auth_names = opts[:debug_auth_names] || ['app_key']
898
+
899
+ new_options = opts.merge(
900
+ :operation => :"DefaultApi.get_notifications",
901
+ :header_params => header_params,
902
+ :query_params => query_params,
903
+ :form_params => form_params,
904
+ :body => post_body,
905
+ :auth_names => auth_names,
906
+ :return_type => return_type
907
+ )
908
+
909
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
910
+ if @api_client.config.debugging
911
+ @api_client.config.logger.debug "API called: DefaultApi#get_notifications\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
912
+ end
913
+ return data, status_code, headers
914
+ end
915
+
916
+ # View Outcomes
917
+ # View the details of all the outcomes associated with your app &#x1F6A7; Requires Authentication Key Requires your OneSignal App's REST API Key, available in Keys & IDs. &#x1F6A7; 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.
918
+ # @param app_id [String] The OneSignal App ID for your app. Available in Keys &amp; IDs.
919
+ # @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 \&quot;os\&quot; 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
920
+ # @param [Hash] opts the optional parameters
921
+ # @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 \&quot;Sales, Purchase\&quot; is the custom outcomes with a comma in the name.
922
+ # @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.
923
+ # @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.
924
+ # @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.
925
+ # @return [OutcomesData]
926
+ def get_outcomes(app_id, outcome_names, opts = {})
927
+ data, _status_code, _headers = get_outcomes_with_http_info(app_id, outcome_names, opts)
928
+ data
929
+ end
930
+
931
+ # View Outcomes
932
+ # View the details of all the outcomes associated with your app &amp;#x1F6A7; Requires Authentication Key Requires your OneSignal App&#39;s REST API Key, available in Keys &amp; IDs. &amp;#x1F6A7; 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.
933
+ # @param app_id [String] The OneSignal App ID for your app. Available in Keys &amp; IDs.
934
+ # @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 \&quot;os\&quot; 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
935
+ # @param [Hash] opts the optional parameters
936
+ # @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 \&quot;Sales, Purchase\&quot; is the custom outcomes with a comma in the name.
937
+ # @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.
938
+ # @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.
939
+ # @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.
940
+ # @return [Array<(OutcomesData, Integer, Hash)>] OutcomesData data, response status code and response headers
941
+ def get_outcomes_with_http_info(app_id, outcome_names, opts = {})
942
+ if @api_client.config.debugging
943
+ @api_client.config.logger.debug 'Calling API: DefaultApi.get_outcomes ...'
944
+ end
945
+ # verify the required parameter 'app_id' is set
946
+ if @api_client.config.client_side_validation && app_id.nil?
947
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.get_outcomes"
948
+ end
949
+ # verify the required parameter 'outcome_names' is set
950
+ if @api_client.config.client_side_validation && outcome_names.nil?
951
+ fail ArgumentError, "Missing the required parameter 'outcome_names' when calling DefaultApi.get_outcomes"
952
+ end
953
+ # resource path
954
+ local_var_path = '/apps/{app_id}/outcomes'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s))
955
+
956
+ # query parameters
957
+ query_params = opts[:query_params] || {}
958
+ query_params[:'outcome_names'] = outcome_names
959
+ query_params[:'outcome_names[]'] = opts[:'outcome_names2'] if !opts[:'outcome_names2'].nil?
960
+ query_params[:'outcome_time_range'] = opts[:'outcome_time_range'] if !opts[:'outcome_time_range'].nil?
961
+ query_params[:'outcome_platforms'] = opts[:'outcome_platforms'] if !opts[:'outcome_platforms'].nil?
962
+ query_params[:'outcome_attribution'] = opts[:'outcome_attribution'] if !opts[:'outcome_attribution'].nil?
963
+
964
+ # header parameters
965
+ header_params = opts[:header_params] || {}
966
+ # HTTP header 'Accept' (if needed)
967
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
968
+
969
+ # form parameters
970
+ form_params = opts[:form_params] || {}
971
+
972
+ # http body (model)
973
+ post_body = opts[:debug_body]
974
+
975
+ # return_type
976
+ return_type = opts[:debug_return_type] || 'OutcomesData'
977
+
978
+ # auth_names
979
+ auth_names = opts[:debug_auth_names] || ['app_key']
980
+
981
+ new_options = opts.merge(
982
+ :operation => :"DefaultApi.get_outcomes",
983
+ :header_params => header_params,
984
+ :query_params => query_params,
985
+ :form_params => form_params,
986
+ :body => post_body,
987
+ :auth_names => auth_names,
988
+ :return_type => return_type
989
+ )
990
+
991
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
992
+ if @api_client.config.debugging
993
+ @api_client.config.logger.debug "API called: DefaultApi#get_outcomes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
994
+ end
995
+ return data, status_code, headers
996
+ end
997
+
998
+ # View device
999
+ # View the details of an existing device in one of your OneSignal apps
1000
+ # @param app_id [String] Your app_id for this device
1001
+ # @param player_id [String] Player&#39;s OneSignal ID
1002
+ # @param [Hash] opts the optional parameters
1003
+ # @option opts [String] :email_auth_hash Email - Only required if you have enabled Identity Verification and device_type is email (11).
1004
+ # @return [Player]
1005
+ def get_player(app_id, player_id, opts = {})
1006
+ data, _status_code, _headers = get_player_with_http_info(app_id, player_id, opts)
1007
+ data
1008
+ end
1009
+
1010
+ # View device
1011
+ # View the details of an existing device in one of your OneSignal apps
1012
+ # @param app_id [String] Your app_id for this device
1013
+ # @param player_id [String] Player&#39;s OneSignal ID
1014
+ # @param [Hash] opts the optional parameters
1015
+ # @option opts [String] :email_auth_hash Email - Only required if you have enabled Identity Verification and device_type is email (11).
1016
+ # @return [Array<(Player, Integer, Hash)>] Player data, response status code and response headers
1017
+ def get_player_with_http_info(app_id, player_id, opts = {})
1018
+ if @api_client.config.debugging
1019
+ @api_client.config.logger.debug 'Calling API: DefaultApi.get_player ...'
1020
+ end
1021
+ # verify the required parameter 'app_id' is set
1022
+ if @api_client.config.client_side_validation && app_id.nil?
1023
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.get_player"
1024
+ end
1025
+ # verify the required parameter 'player_id' is set
1026
+ if @api_client.config.client_side_validation && player_id.nil?
1027
+ fail ArgumentError, "Missing the required parameter 'player_id' when calling DefaultApi.get_player"
1028
+ end
1029
+ # resource path
1030
+ local_var_path = '/players/{player_id}'.sub('{' + 'player_id' + '}', CGI.escape(player_id.to_s))
1031
+
1032
+ # query parameters
1033
+ query_params = opts[:query_params] || {}
1034
+ query_params[:'app_id'] = app_id
1035
+ query_params[:'email_auth_hash'] = opts[:'email_auth_hash'] if !opts[:'email_auth_hash'].nil?
1036
+
1037
+ # header parameters
1038
+ header_params = opts[:header_params] || {}
1039
+ # HTTP header 'Accept' (if needed)
1040
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1041
+
1042
+ # form parameters
1043
+ form_params = opts[:form_params] || {}
1044
+
1045
+ # http body (model)
1046
+ post_body = opts[:debug_body]
1047
+
1048
+ # return_type
1049
+ return_type = opts[:debug_return_type] || 'Player'
1050
+
1051
+ # auth_names
1052
+ auth_names = opts[:debug_auth_names] || ['app_key']
1053
+
1054
+ new_options = opts.merge(
1055
+ :operation => :"DefaultApi.get_player",
1056
+ :header_params => header_params,
1057
+ :query_params => query_params,
1058
+ :form_params => form_params,
1059
+ :body => post_body,
1060
+ :auth_names => auth_names,
1061
+ :return_type => return_type
1062
+ )
1063
+
1064
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1065
+ if @api_client.config.debugging
1066
+ @api_client.config.logger.debug "API called: DefaultApi#get_player\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1067
+ end
1068
+ return data, status_code, headers
1069
+ end
1070
+
1071
+ # View devices
1072
+ # 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.
1073
+ # @param app_id [String] The app ID that you want to view players from
1074
+ # @param [Hash] opts the optional parameters
1075
+ # @option opts [Integer] :limit How many devices to return. Max is 300. Default is 300
1076
+ # @option opts [Integer] :offset Result offset. Default is 0. Results are sorted by id;
1077
+ # @return [PlayerSlice]
1078
+ def get_players(app_id, opts = {})
1079
+ data, _status_code, _headers = get_players_with_http_info(app_id, opts)
1080
+ data
1081
+ end
1082
+
1083
+ # View devices
1084
+ # 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.
1085
+ # @param app_id [String] The app ID that you want to view players from
1086
+ # @param [Hash] opts the optional parameters
1087
+ # @option opts [Integer] :limit How many devices to return. Max is 300. Default is 300
1088
+ # @option opts [Integer] :offset Result offset. Default is 0. Results are sorted by id;
1089
+ # @return [Array<(PlayerSlice, Integer, Hash)>] PlayerSlice data, response status code and response headers
1090
+ def get_players_with_http_info(app_id, opts = {})
1091
+ if @api_client.config.debugging
1092
+ @api_client.config.logger.debug 'Calling API: DefaultApi.get_players ...'
1093
+ end
1094
+ # verify the required parameter 'app_id' is set
1095
+ if @api_client.config.client_side_validation && app_id.nil?
1096
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.get_players"
1097
+ end
1098
+ # resource path
1099
+ local_var_path = '/players'
1100
+
1101
+ # query parameters
1102
+ query_params = opts[:query_params] || {}
1103
+ query_params[:'app_id'] = app_id
1104
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
1105
+ query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
1106
+
1107
+ # header parameters
1108
+ header_params = opts[:header_params] || {}
1109
+ # HTTP header 'Accept' (if needed)
1110
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1111
+
1112
+ # form parameters
1113
+ form_params = opts[:form_params] || {}
1114
+
1115
+ # http body (model)
1116
+ post_body = opts[:debug_body]
1117
+
1118
+ # return_type
1119
+ return_type = opts[:debug_return_type] || 'PlayerSlice'
1120
+
1121
+ # auth_names
1122
+ auth_names = opts[:debug_auth_names] || ['app_key']
1123
+
1124
+ new_options = opts.merge(
1125
+ :operation => :"DefaultApi.get_players",
1126
+ :header_params => header_params,
1127
+ :query_params => query_params,
1128
+ :form_params => form_params,
1129
+ :body => post_body,
1130
+ :auth_names => auth_names,
1131
+ :return_type => return_type
1132
+ )
1133
+
1134
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1135
+ if @api_client.config.debugging
1136
+ @api_client.config.logger.debug "API called: DefaultApi#get_players\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1137
+ end
1138
+ return data, status_code, headers
1139
+ end
1140
+
1141
+ # Update an app
1142
+ # Updates the name or configuration settings of an existing OneSignal app
1143
+ # @param app_id [String] An app id
1144
+ # @param app [App]
1145
+ # @param [Hash] opts the optional parameters
1146
+ # @return [App]
1147
+ def update_app(app_id, app, opts = {})
1148
+ data, _status_code, _headers = update_app_with_http_info(app_id, app, opts)
1149
+ data
1150
+ end
1151
+
1152
+ # Update an app
1153
+ # Updates the name or configuration settings of an existing OneSignal app
1154
+ # @param app_id [String] An app id
1155
+ # @param app [App]
1156
+ # @param [Hash] opts the optional parameters
1157
+ # @return [Array<(App, Integer, Hash)>] App data, response status code and response headers
1158
+ def update_app_with_http_info(app_id, app, opts = {})
1159
+ if @api_client.config.debugging
1160
+ @api_client.config.logger.debug 'Calling API: DefaultApi.update_app ...'
1161
+ end
1162
+ # verify the required parameter 'app_id' is set
1163
+ if @api_client.config.client_side_validation && app_id.nil?
1164
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.update_app"
1165
+ end
1166
+ # verify the required parameter 'app' is set
1167
+ if @api_client.config.client_side_validation && app.nil?
1168
+ fail ArgumentError, "Missing the required parameter 'app' when calling DefaultApi.update_app"
1169
+ end
1170
+ # resource path
1171
+ local_var_path = '/apps/{app_id}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s))
1172
+
1173
+ # query parameters
1174
+ query_params = opts[:query_params] || {}
1175
+
1176
+ # header parameters
1177
+ header_params = opts[:header_params] || {}
1178
+ # HTTP header 'Accept' (if needed)
1179
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1180
+ # HTTP header 'Content-Type'
1181
+ content_type = @api_client.select_header_content_type(['application/json'])
1182
+ if !content_type.nil?
1183
+ header_params['Content-Type'] = content_type
1184
+ end
1185
+
1186
+ # form parameters
1187
+ form_params = opts[:form_params] || {}
1188
+
1189
+ # http body (model)
1190
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(app)
1191
+
1192
+ # return_type
1193
+ return_type = opts[:debug_return_type] || 'App'
1194
+
1195
+ # auth_names
1196
+ auth_names = opts[:debug_auth_names] || ['user_key']
1197
+
1198
+ new_options = opts.merge(
1199
+ :operation => :"DefaultApi.update_app",
1200
+ :header_params => header_params,
1201
+ :query_params => query_params,
1202
+ :form_params => form_params,
1203
+ :body => post_body,
1204
+ :auth_names => auth_names,
1205
+ :return_type => return_type
1206
+ )
1207
+
1208
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
1209
+ if @api_client.config.debugging
1210
+ @api_client.config.logger.debug "API called: DefaultApi#update_app\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1211
+ end
1212
+ return data, status_code, headers
1213
+ end
1214
+
1215
+ # Edit device
1216
+ # Update an existing device in one of your OneSignal apps
1217
+ # @param player_id [String] Player&#39;s OneSignal ID
1218
+ # @param player [Player]
1219
+ # @param [Hash] opts the optional parameters
1220
+ # @return [InlineResponse2001]
1221
+ def update_player(player_id, player, opts = {})
1222
+ data, _status_code, _headers = update_player_with_http_info(player_id, player, opts)
1223
+ data
1224
+ end
1225
+
1226
+ # Edit device
1227
+ # Update an existing device in one of your OneSignal apps
1228
+ # @param player_id [String] Player&#39;s OneSignal ID
1229
+ # @param player [Player]
1230
+ # @param [Hash] opts the optional parameters
1231
+ # @return [Array<(InlineResponse2001, Integer, Hash)>] InlineResponse2001 data, response status code and response headers
1232
+ def update_player_with_http_info(player_id, player, opts = {})
1233
+ if @api_client.config.debugging
1234
+ @api_client.config.logger.debug 'Calling API: DefaultApi.update_player ...'
1235
+ end
1236
+ # verify the required parameter 'player_id' is set
1237
+ if @api_client.config.client_side_validation && player_id.nil?
1238
+ fail ArgumentError, "Missing the required parameter 'player_id' when calling DefaultApi.update_player"
1239
+ end
1240
+ # verify the required parameter 'player' is set
1241
+ if @api_client.config.client_side_validation && player.nil?
1242
+ fail ArgumentError, "Missing the required parameter 'player' when calling DefaultApi.update_player"
1243
+ end
1244
+ # resource path
1245
+ local_var_path = '/players/{player_id}'.sub('{' + 'player_id' + '}', CGI.escape(player_id.to_s))
1246
+
1247
+ # query parameters
1248
+ query_params = opts[:query_params] || {}
1249
+
1250
+ # header parameters
1251
+ header_params = opts[:header_params] || {}
1252
+ # HTTP header 'Accept' (if needed)
1253
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1254
+ # HTTP header 'Content-Type'
1255
+ content_type = @api_client.select_header_content_type(['application/json'])
1256
+ if !content_type.nil?
1257
+ header_params['Content-Type'] = content_type
1258
+ end
1259
+
1260
+ # form parameters
1261
+ form_params = opts[:form_params] || {}
1262
+
1263
+ # http body (model)
1264
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(player)
1265
+
1266
+ # return_type
1267
+ return_type = opts[:debug_return_type] || 'InlineResponse2001'
1268
+
1269
+ # auth_names
1270
+ auth_names = opts[:debug_auth_names] || ['app_key']
1271
+
1272
+ new_options = opts.merge(
1273
+ :operation => :"DefaultApi.update_player",
1274
+ :header_params => header_params,
1275
+ :query_params => query_params,
1276
+ :form_params => form_params,
1277
+ :body => post_body,
1278
+ :auth_names => auth_names,
1279
+ :return_type => return_type
1280
+ )
1281
+
1282
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
1283
+ if @api_client.config.debugging
1284
+ @api_client.config.logger.debug "API called: DefaultApi#update_player\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1285
+ end
1286
+ return data, status_code, headers
1287
+ end
1288
+
1289
+ # Edit tags with external user id
1290
+ # 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. &#128216; 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\" }
1291
+ # @param app_id [String] The OneSignal App ID the user record is found under.
1292
+ # @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.
1293
+ # @param [Hash] opts the optional parameters
1294
+ # @option opts [UpdatePlayerTagsRequestBody] :update_player_tags_request_body
1295
+ # @return [InlineResponse2001]
1296
+ def update_player_tags(app_id, external_user_id, opts = {})
1297
+ data, _status_code, _headers = update_player_tags_with_http_info(app_id, external_user_id, opts)
1298
+ data
1299
+ end
1300
+
1301
+ # Edit tags with external user id
1302
+ # 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. &amp;#128216; 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; }
1303
+ # @param app_id [String] The OneSignal App ID the user record is found under.
1304
+ # @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.
1305
+ # @param [Hash] opts the optional parameters
1306
+ # @option opts [UpdatePlayerTagsRequestBody] :update_player_tags_request_body
1307
+ # @return [Array<(InlineResponse2001, Integer, Hash)>] InlineResponse2001 data, response status code and response headers
1308
+ def update_player_tags_with_http_info(app_id, external_user_id, opts = {})
1309
+ if @api_client.config.debugging
1310
+ @api_client.config.logger.debug 'Calling API: DefaultApi.update_player_tags ...'
1311
+ end
1312
+ # verify the required parameter 'app_id' is set
1313
+ if @api_client.config.client_side_validation && app_id.nil?
1314
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.update_player_tags"
1315
+ end
1316
+ # verify the required parameter 'external_user_id' is set
1317
+ if @api_client.config.client_side_validation && external_user_id.nil?
1318
+ fail ArgumentError, "Missing the required parameter 'external_user_id' when calling DefaultApi.update_player_tags"
1319
+ end
1320
+ # resource path
1321
+ 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))
1322
+
1323
+ # query parameters
1324
+ query_params = opts[:query_params] || {}
1325
+
1326
+ # header parameters
1327
+ header_params = opts[:header_params] || {}
1328
+ # HTTP header 'Accept' (if needed)
1329
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1330
+ # HTTP header 'Content-Type'
1331
+ content_type = @api_client.select_header_content_type(['application/json'])
1332
+ if !content_type.nil?
1333
+ header_params['Content-Type'] = content_type
1334
+ end
1335
+
1336
+ # form parameters
1337
+ form_params = opts[:form_params] || {}
1338
+
1339
+ # http body (model)
1340
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'update_player_tags_request_body'])
1341
+
1342
+ # return_type
1343
+ return_type = opts[:debug_return_type] || 'InlineResponse2001'
1344
+
1345
+ # auth_names
1346
+ auth_names = opts[:debug_auth_names] || ['app_key']
1347
+
1348
+ new_options = opts.merge(
1349
+ :operation => :"DefaultApi.update_player_tags",
1350
+ :header_params => header_params,
1351
+ :query_params => query_params,
1352
+ :form_params => form_params,
1353
+ :body => post_body,
1354
+ :auth_names => auth_names,
1355
+ :return_type => return_type
1356
+ )
1357
+
1358
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
1359
+ if @api_client.config.debugging
1360
+ @api_client.config.logger.debug "API called: DefaultApi#update_player_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1361
+ end
1362
+ return data, status_code, headers
1363
+ end
1364
+ end
1365
+ end