Class: OneSignal::DefaultApi

Inherits:
Object
  • Object
show all
Defined in:
lib/onesignal/api/default_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ DefaultApi

Returns a new instance of DefaultApi.



19
20
21
# File 'lib/onesignal/api/default_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/onesignal/api/default_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#cancel_notification(app_id, notification_id, opts = {}) ⇒ InlineResponse2001

Stop a scheduled or currently outgoing notification Used to stop a scheduled or currently outgoing notification

Parameters:

  • app_id (String)
  • notification_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



28
29
30
31
# File 'lib/onesignal/api/default_api.rb', line 28

def cancel_notification(app_id, notification_id, opts = {})
  data, _status_code, _headers = cancel_notification_with_http_info(app_id, notification_id, opts)
  data
end

#cancel_notification_with_http_info(app_id, notification_id, opts = {}) ⇒ Array<(InlineResponse2001, Integer, Hash)>

Stop a scheduled or currently outgoing notification Used to stop a scheduled or currently outgoing notification

Parameters:

  • app_id (String)
  • notification_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(InlineResponse2001, Integer, Hash)>)

    InlineResponse2001 data, response status code and response headers



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/onesignal/api/default_api.rb', line 39

def cancel_notification_with_http_info(app_id, notification_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.cancel_notification ...'
  end
  # verify the required parameter 'app_id' is set
  if @api_client.config.client_side_validation && app_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.cancel_notification"
  end
  # verify the required parameter 'notification_id' is set
  if @api_client.config.client_side_validation && notification_id.nil?
    fail ArgumentError, "Missing the required parameter 'notification_id' when calling DefaultApi.cancel_notification"
  end
  # resource path
  local_var_path = '/notifications/{notification_id}'.sub('{' + 'notification_id' + '}', CGI.escape(notification_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'app_id'] = app_id

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'InlineResponse2001'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['app_key']

  new_options = opts.merge(
    :operation => :"DefaultApi.cancel_notification",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DefaultApi#cancel_notification\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_app(app, opts = {}) ⇒ App

Create an app Creates a new OneSignal app

Parameters:

  • app (App)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



97
98
99
100
# File 'lib/onesignal/api/default_api.rb', line 97

def create_app(app, opts = {})
  data, _status_code, _headers = create_app_with_http_info(app, opts)
  data
end

#create_app_with_http_info(app, opts = {}) ⇒ Array<(App, Integer, Hash)>

Create an app Creates a new OneSignal app

Parameters:

  • app (App)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(App, Integer, Hash)>)

    App data, response status code and response headers



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/onesignal/api/default_api.rb', line 107

def create_app_with_http_info(app, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.create_app ...'
  end
  # verify the required parameter 'app' is set
  if @api_client.config.client_side_validation && app.nil?
    fail ArgumentError, "Missing the required parameter 'app' when calling DefaultApi.create_app"
  end
  # resource path
  local_var_path = '/apps'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(app)

  # return_type
  return_type = opts[:debug_return_type] || 'App'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['user_key']

  new_options = opts.merge(
    :operation => :"DefaultApi.create_app",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DefaultApi#create_app\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_notification(notification, opts = {}) ⇒ InlineResponse200

Create notification Sends notifications to your users

Parameters:

  • notification (Notification)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



165
166
167
168
# File 'lib/onesignal/api/default_api.rb', line 165

def create_notification(notification, opts = {})
  data, _status_code, _headers = create_notification_with_http_info(notification, opts)
  data
end

#create_notification_with_http_info(notification, opts = {}) ⇒ Array<(InlineResponse200, Integer, Hash)>

Create notification Sends notifications to your users

Parameters:

  • notification (Notification)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(InlineResponse200, Integer, Hash)>)

    InlineResponse200 data, response status code and response headers



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/onesignal/api/default_api.rb', line 175

def create_notification_with_http_info(notification, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.create_notification ...'
  end
  # verify the required parameter 'notification' is set
  if @api_client.config.client_side_validation && notification.nil?
    fail ArgumentError, "Missing the required parameter 'notification' when calling DefaultApi.create_notification"
  end
  # resource path
  local_var_path = '/notifications'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(notification)

  # return_type
  return_type = opts[:debug_return_type] || 'InlineResponse200'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['app_key']

  new_options = opts.merge(
    :operation => :"DefaultApi.create_notification",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DefaultApi#create_notification\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_player(player, opts = {}) ⇒ InlineResponse2005

Add a device 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.

Parameters:

  • player (Player)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



233
234
235
236
# File 'lib/onesignal/api/default_api.rb', line 233

def create_player(player, opts = {})
  data, _status_code, _headers = create_player_with_http_info(player, opts)
  data
end

#create_player_with_http_info(player, opts = {}) ⇒ Array<(InlineResponse2005, Integer, Hash)>

Add a device 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.

Parameters:

  • player (Player)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(InlineResponse2005, Integer, Hash)>)

    InlineResponse2005 data, response status code and response headers



243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
# File 'lib/onesignal/api/default_api.rb', line 243

def create_player_with_http_info(player, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.create_player ...'
  end
  # verify the required parameter 'player' is set
  if @api_client.config.client_side_validation && player.nil?
    fail ArgumentError, "Missing the required parameter 'player' when calling DefaultApi.create_player"
  end
  # resource path
  local_var_path = '/players'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(player)

  # return_type
  return_type = opts[:debug_return_type] || 'InlineResponse2005'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['app_key']

  new_options = opts.merge(
    :operation => :"DefaultApi.create_player",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DefaultApi#create_player\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_segments(app_id, opts = {}) ⇒ InlineResponse201

Create Segments 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.

Parameters:

  • app_id (String)

    The OneSignal App ID for your app. Available in Keys &amp; IDs.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



302
303
304
305
# File 'lib/onesignal/api/default_api.rb', line 302

def create_segments(app_id, opts = {})
  data, _status_code, _headers = create_segments_with_http_info(app_id, opts)
  data
end

#create_segments_with_http_info(app_id, opts = {}) ⇒ Array<(InlineResponse201, Integer, Hash)>

Create Segments 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.

Parameters:

  • app_id (String)

    The OneSignal App ID for your app. Available in Keys &amp; IDs.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(InlineResponse201, Integer, Hash)>)

    InlineResponse201 data, response status code and response headers



313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
# File 'lib/onesignal/api/default_api.rb', line 313

def create_segments_with_http_info(app_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.create_segments ...'
  end
  # verify the required parameter 'app_id' is set
  if @api_client.config.client_side_validation && app_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.create_segments"
  end
  # resource path
  local_var_path = '/apps/{app_id}/segments'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'segment'])

  # return_type
  return_type = opts[:debug_return_type] || 'InlineResponse201'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['app_key']

  new_options = opts.merge(
    :operation => :"DefaultApi.create_segments",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DefaultApi#create_segments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_player(app_id, player_id, opts = {}) ⇒ InlineResponse2007

Delete a user record Delete player - Required: Used to delete a single, specific Player ID record from a specific OneSignal app.

Parameters:

  • app_id (String)

    The OneSignal App ID for your app. Available in Keys &amp; IDs.

  • player_id (String)

    The OneSignal player_id

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



372
373
374
375
# File 'lib/onesignal/api/default_api.rb', line 372

def delete_player(app_id, player_id, opts = {})
  data, _status_code, _headers = delete_player_with_http_info(app_id, player_id, opts)
  data
end

#delete_player_with_http_info(app_id, player_id, opts = {}) ⇒ Array<(InlineResponse2007, Integer, Hash)>

Delete a user record Delete player - Required: Used to delete a single, specific Player ID record from a specific OneSignal app.

Parameters:

  • app_id (String)

    The OneSignal App ID for your app. Available in Keys &amp; IDs.

  • player_id (String)

    The OneSignal player_id

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(InlineResponse2007, Integer, Hash)>)

    InlineResponse2007 data, response status code and response headers



383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
# File 'lib/onesignal/api/default_api.rb', line 383

def delete_player_with_http_info(app_id, player_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.delete_player ...'
  end
  # verify the required parameter 'app_id' is set
  if @api_client.config.client_side_validation && app_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.delete_player"
  end
  # verify the required parameter 'player_id' is set
  if @api_client.config.client_side_validation && player_id.nil?
    fail ArgumentError, "Missing the required parameter 'player_id' when calling DefaultApi.delete_player"
  end
  # resource path
  local_var_path = '/players/{player_id}'.sub('{' + 'player_id' + '}', CGI.escape(player_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'app_id'] = app_id

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'InlineResponse2007'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['app_key']

  new_options = opts.merge(
    :operation => :"DefaultApi.delete_player",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DefaultApi#delete_player\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_segments(app_id, segment_id, opts = {}) ⇒ InlineResponse2001

Delete Segments 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.

Parameters:

  • app_id (String)

    The OneSignal App ID for your app. Available in Keys &amp; IDs.

  • segment_id (String)

    The segment_id can be found in the URL of the segment when viewing it in the dashboard.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



442
443
444
445
# File 'lib/onesignal/api/default_api.rb', line 442

def delete_segments(app_id, segment_id, opts = {})
  data, _status_code, _headers = delete_segments_with_http_info(app_id, segment_id, opts)
  data
end

#delete_segments_with_http_info(app_id, segment_id, opts = {}) ⇒ Array<(InlineResponse2001, Integer, Hash)>

Delete Segments 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.

Parameters:

  • app_id (String)

    The OneSignal App ID for your app. Available in Keys &amp; IDs.

  • segment_id (String)

    The segment_id can be found in the URL of the segment when viewing it in the dashboard.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(InlineResponse2001, Integer, Hash)>)

    InlineResponse2001 data, response status code and response headers



453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
# File 'lib/onesignal/api/default_api.rb', line 453

def delete_segments_with_http_info(app_id, segment_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.delete_segments ...'
  end
  # verify the required parameter 'app_id' is set
  if @api_client.config.client_side_validation && app_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.delete_segments"
  end
  # verify the required parameter 'segment_id' is set
  if @api_client.config.client_side_validation && segment_id.nil?
    fail ArgumentError, "Missing the required parameter 'segment_id' when calling DefaultApi.delete_segments"
  end
  # resource path
  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))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'InlineResponse2001'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['app_key']

  new_options = opts.merge(
    :operation => :"DefaultApi.delete_segments",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DefaultApi#delete_segments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#export_players(app_id, opts = {}) ⇒ InlineResponse2008

CSV export 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. |

Parameters:

  • app_id (String)

    The app ID that you want to export devices from

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



511
512
513
514
# File 'lib/onesignal/api/default_api.rb', line 511

def export_players(app_id, opts = {})
  data, _status_code, _headers = export_players_with_http_info(app_id, opts)
  data
end

#export_players_with_http_info(app_id, opts = {}) ⇒ Array<(InlineResponse2008, Integer, Hash)>

CSV export 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. |

Parameters:

  • app_id (String)

    The app ID that you want to export devices from

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(InlineResponse2008, Integer, Hash)>)

    InlineResponse2008 data, response status code and response headers



522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
# File 'lib/onesignal/api/default_api.rb', line 522

def export_players_with_http_info(app_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.export_players ...'
  end
  # verify the required parameter 'app_id' is set
  if @api_client.config.client_side_validation && app_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.export_players"
  end
  # resource path
  local_var_path = '/players/csv_export?app_id={app_id}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'export_players_request_body'])

  # return_type
  return_type = opts[:debug_return_type] || 'InlineResponse2008'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['app_key']

  new_options = opts.merge(
    :operation => :"DefaultApi.export_players",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DefaultApi#export_players\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_app(app_id, opts = {}) ⇒ App

View an app View the details of a single OneSignal app

Parameters:

  • app_id (String)

    An app id

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



580
581
582
583
# File 'lib/onesignal/api/default_api.rb', line 580

def get_app(app_id, opts = {})
  data, _status_code, _headers = get_app_with_http_info(app_id, opts)
  data
end

#get_app_with_http_info(app_id, opts = {}) ⇒ Array<(App, Integer, Hash)>

View an app View the details of a single OneSignal app

Parameters:

  • app_id (String)

    An app id

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(App, Integer, Hash)>)

    App data, response status code and response headers



590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
# File 'lib/onesignal/api/default_api.rb', line 590

def get_app_with_http_info(app_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.get_app ...'
  end
  # verify the required parameter 'app_id' is set
  if @api_client.config.client_side_validation && app_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.get_app"
  end
  # resource path
  local_var_path = '/apps/{app_id}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'App'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['user_key']

  new_options = opts.merge(
    :operation => :"DefaultApi.get_app",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DefaultApi#get_app\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_apps(opts = {}) ⇒ Array<App>

View apps View the details of all of your current OneSignal apps

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



642
643
644
645
# File 'lib/onesignal/api/default_api.rb', line 642

def get_apps(opts = {})
  data, _status_code, _headers = get_apps_with_http_info(opts)
  data
end

#get_apps_with_http_info(opts = {}) ⇒ Array<(Array<App>, Integer, Hash)>

View apps View the details of all of your current OneSignal apps

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Array<App>, Integer, Hash)>)

    Array<App> data, response status code and response headers



651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
# File 'lib/onesignal/api/default_api.rb', line 651

def get_apps_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.get_apps ...'
  end
  # resource path
  local_var_path = '/apps'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Array<App>'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['user_key']

  new_options = opts.merge(
    :operation => :"DefaultApi.get_apps",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DefaultApi#get_apps\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_notification(app_id, notification_id, opts = {}) ⇒ NotificationWithMeta

View notification View the details of a single notification and outcomes associated with it

Parameters:

  • app_id (String)
  • notification_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



701
702
703
704
# File 'lib/onesignal/api/default_api.rb', line 701

def get_notification(app_id, notification_id, opts = {})
  data, _status_code, _headers = get_notification_with_http_info(app_id, notification_id, opts)
  data
end

#get_notification_history(notification_id, get_notification_request_body, opts = {}) ⇒ InlineResponse2002

Notification History -> 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.

Parameters:

  • notification_id (String)

    The &quot;id&quot; of the message found in the Notification object

  • get_notification_request_body (GetNotificationRequestBody)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



771
772
773
774
# File 'lib/onesignal/api/default_api.rb', line 771

def get_notification_history(notification_id, get_notification_request_body, opts = {})
  data, _status_code, _headers = get_notification_history_with_http_info(notification_id, get_notification_request_body, opts)
  data
end

#get_notification_history_with_http_info(notification_id, get_notification_request_body, opts = {}) ⇒ Array<(InlineResponse2002, Integer, Hash)>

Notification History -&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.

Parameters:

  • notification_id (String)

    The &quot;id&quot; of the message found in the Notification object

  • get_notification_request_body (GetNotificationRequestBody)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(InlineResponse2002, Integer, Hash)>)

    InlineResponse2002 data, response status code and response headers



782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
# File 'lib/onesignal/api/default_api.rb', line 782

def get_notification_history_with_http_info(notification_id, get_notification_request_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.get_notification_history ...'
  end
  # verify the required parameter 'notification_id' is set
  if @api_client.config.client_side_validation && notification_id.nil?
    fail ArgumentError, "Missing the required parameter 'notification_id' when calling DefaultApi.get_notification_history"
  end
  # verify the required parameter 'get_notification_request_body' is set
  if @api_client.config.client_side_validation && get_notification_request_body.nil?
    fail ArgumentError, "Missing the required parameter 'get_notification_request_body' when calling DefaultApi.get_notification_history"
  end
  # resource path
  local_var_path = '/notifications/{notification_id}/history'.sub('{' + 'notification_id' + '}', CGI.escape(notification_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(get_notification_request_body)

  # return_type
  return_type = opts[:debug_return_type] || 'InlineResponse2002'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['app_key']

  new_options = opts.merge(
    :operation => :"DefaultApi.get_notification_history",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DefaultApi#get_notification_history\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_notification_with_http_info(app_id, notification_id, opts = {}) ⇒ Array<(NotificationWithMeta, Integer, Hash)>

View notification View the details of a single notification and outcomes associated with it

Parameters:

  • app_id (String)
  • notification_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(NotificationWithMeta, Integer, Hash)>)

    NotificationWithMeta data, response status code and response headers



712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
# File 'lib/onesignal/api/default_api.rb', line 712

def get_notification_with_http_info(app_id, notification_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.get_notification ...'
  end
  # verify the required parameter 'app_id' is set
  if @api_client.config.client_side_validation && app_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.get_notification"
  end
  # verify the required parameter 'notification_id' is set
  if @api_client.config.client_side_validation && notification_id.nil?
    fail ArgumentError, "Missing the required parameter 'notification_id' when calling DefaultApi.get_notification"
  end
  # resource path
  local_var_path = '/notifications/{notification_id}'.sub('{' + 'notification_id' + '}', CGI.escape(notification_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'app_id'] = app_id

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'NotificationWithMeta'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['app_key']

  new_options = opts.merge(
    :operation => :"DefaultApi.get_notification",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DefaultApi#get_notification\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_notifications(app_id, opts = {}) ⇒ NotificationSlice

View notifications View the details of multiple notifications

Parameters:

  • app_id (String)

    The app ID that you want to view notifications from

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    How many notifications to return. Max is 50. Default is 50.

  • :offset (Integer)

    Page offset. Default is 0. Results are sorted by queued_at in descending order. queued_at is a representation of the time that the notification was queued at.

  • :kind (Integer)

    Kind of notifications returned: * unset - All notification types (default) * &#x60;0&#x60; - Dashboard only * &#x60;1&#x60; - API only * &#x60;3&#x60; - Automated only

Returns:



847
848
849
850
# File 'lib/onesignal/api/default_api.rb', line 847

def get_notifications(app_id, opts = {})
  data, _status_code, _headers = get_notifications_with_http_info(app_id, opts)
  data
end

#get_notifications_with_http_info(app_id, opts = {}) ⇒ Array<(NotificationSlice, Integer, Hash)>

View notifications View the details of multiple notifications

Parameters:

  • app_id (String)

    The app ID that you want to view notifications from

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    How many notifications to return. Max is 50. Default is 50.

  • :offset (Integer)

    Page offset. Default is 0. Results are sorted by queued_at in descending order. queued_at is a representation of the time that the notification was queued at.

  • :kind (Integer)

    Kind of notifications returned: * unset - All notification types (default) * &#x60;0&#x60; - Dashboard only * &#x60;1&#x60; - API only * &#x60;3&#x60; - Automated only

Returns:

  • (Array<(NotificationSlice, Integer, Hash)>)

    NotificationSlice data, response status code and response headers



860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
# File 'lib/onesignal/api/default_api.rb', line 860

def get_notifications_with_http_info(app_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.get_notifications ...'
  end
  # verify the required parameter 'app_id' is set
  if @api_client.config.client_side_validation && app_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.get_notifications"
  end
  allowable_values = [0, 1, 3]
  if @api_client.config.client_side_validation && opts[:'kind'] && !allowable_values.include?(opts[:'kind'])
    fail ArgumentError, "invalid value for \"kind\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/notifications'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'app_id'] = app_id
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'kind'] = opts[:'kind'] if !opts[:'kind'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'NotificationSlice'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['app_key']

  new_options = opts.merge(
    :operation => :"DefaultApi.get_notifications",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DefaultApi#get_notifications\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_outcomes(app_id, outcome_names, opts = {}) ⇒ OutcomesData

View Outcomes 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.

Parameters:

  • app_id (String)

    The OneSignal App ID for your app. Available in Keys &amp; IDs.

  • 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

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :outcome_names2 (String)

    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.

  • :outcome_time_range (String)

    Optional Time range for the returned data. The values can be 1h (for the last 1 hour data), 1d (for the last 1 day data), or 1mo (for the last 1 month data). Default is 1h if the parameter is omitted.

  • :outcome_platforms (String)

    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.

  • :outcome_attribution (String)

    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.

Returns:



926
927
928
929
# File 'lib/onesignal/api/default_api.rb', line 926

def get_outcomes(app_id, outcome_names, opts = {})
  data, _status_code, _headers = get_outcomes_with_http_info(app_id, outcome_names, opts)
  data
end

#get_outcomes_with_http_info(app_id, outcome_names, opts = {}) ⇒ Array<(OutcomesData, Integer, Hash)>

View Outcomes 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.

Parameters:

  • app_id (String)

    The OneSignal App ID for your app. Available in Keys &amp; IDs.

  • 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

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :outcome_names2 (String)

    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.

  • :outcome_time_range (String)

    Optional Time range for the returned data. The values can be 1h (for the last 1 hour data), 1d (for the last 1 day data), or 1mo (for the last 1 month data). Default is 1h if the parameter is omitted.

  • :outcome_platforms (String)

    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.

  • :outcome_attribution (String)

    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.

Returns:

  • (Array<(OutcomesData, Integer, Hash)>)

    OutcomesData data, response status code and response headers



941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
# File 'lib/onesignal/api/default_api.rb', line 941

def get_outcomes_with_http_info(app_id, outcome_names, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.get_outcomes ...'
  end
  # verify the required parameter 'app_id' is set
  if @api_client.config.client_side_validation && app_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.get_outcomes"
  end
  # verify the required parameter 'outcome_names' is set
  if @api_client.config.client_side_validation && outcome_names.nil?
    fail ArgumentError, "Missing the required parameter 'outcome_names' when calling DefaultApi.get_outcomes"
  end
  # resource path
  local_var_path = '/apps/{app_id}/outcomes'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'outcome_names'] = outcome_names
  query_params[:'outcome_names[]'] = opts[:'outcome_names2'] if !opts[:'outcome_names2'].nil?
  query_params[:'outcome_time_range'] = opts[:'outcome_time_range'] if !opts[:'outcome_time_range'].nil?
  query_params[:'outcome_platforms'] = opts[:'outcome_platforms'] if !opts[:'outcome_platforms'].nil?
  query_params[:'outcome_attribution'] = opts[:'outcome_attribution'] if !opts[:'outcome_attribution'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'OutcomesData'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['app_key']

  new_options = opts.merge(
    :operation => :"DefaultApi.get_outcomes",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DefaultApi#get_outcomes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_player(app_id, player_id, opts = {}) ⇒ Player

View device View the details of an existing device in one of your OneSignal apps

Parameters:

  • app_id (String)

    Your app_id for this device

  • player_id (String)

    Player&#39;s OneSignal ID

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :email_auth_hash (String)

    Email - Only required if you have enabled Identity Verification and device_type is email (11).

Returns:



1005
1006
1007
1008
# File 'lib/onesignal/api/default_api.rb', line 1005

def get_player(app_id, player_id, opts = {})
  data, _status_code, _headers = get_player_with_http_info(app_id, player_id, opts)
  data
end

#get_player_with_http_info(app_id, player_id, opts = {}) ⇒ Array<(Player, Integer, Hash)>

View device View the details of an existing device in one of your OneSignal apps

Parameters:

  • app_id (String)

    Your app_id for this device

  • player_id (String)

    Player&#39;s OneSignal ID

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :email_auth_hash (String)

    Email - Only required if you have enabled Identity Verification and device_type is email (11).

Returns:

  • (Array<(Player, Integer, Hash)>)

    Player data, response status code and response headers



1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
# File 'lib/onesignal/api/default_api.rb', line 1017

def get_player_with_http_info(app_id, player_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.get_player ...'
  end
  # verify the required parameter 'app_id' is set
  if @api_client.config.client_side_validation && app_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.get_player"
  end
  # verify the required parameter 'player_id' is set
  if @api_client.config.client_side_validation && player_id.nil?
    fail ArgumentError, "Missing the required parameter 'player_id' when calling DefaultApi.get_player"
  end
  # resource path
  local_var_path = '/players/{player_id}'.sub('{' + 'player_id' + '}', CGI.escape(player_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'app_id'] = app_id
  query_params[:'email_auth_hash'] = opts[:'email_auth_hash'] if !opts[:'email_auth_hash'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Player'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['app_key']

  new_options = opts.merge(
    :operation => :"DefaultApi.get_player",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DefaultApi#get_player\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_players(app_id, opts = {}) ⇒ PlayerSlice

View devices 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.

Parameters:

  • app_id (String)

    The app ID that you want to view players from

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    How many devices to return. Max is 300. Default is 300

  • :offset (Integer)

    Result offset. Default is 0. Results are sorted by id;

Returns:



1078
1079
1080
1081
# File 'lib/onesignal/api/default_api.rb', line 1078

def get_players(app_id, opts = {})
  data, _status_code, _headers = get_players_with_http_info(app_id, opts)
  data
end

#get_players_with_http_info(app_id, opts = {}) ⇒ Array<(PlayerSlice, Integer, Hash)>

View devices 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.

Parameters:

  • app_id (String)

    The app ID that you want to view players from

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    How many devices to return. Max is 300. Default is 300

  • :offset (Integer)

    Result offset. Default is 0. Results are sorted by id;

Returns:

  • (Array<(PlayerSlice, Integer, Hash)>)

    PlayerSlice data, response status code and response headers



1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
# File 'lib/onesignal/api/default_api.rb', line 1090

def get_players_with_http_info(app_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.get_players ...'
  end
  # verify the required parameter 'app_id' is set
  if @api_client.config.client_side_validation && app_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.get_players"
  end
  # resource path
  local_var_path = '/players'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'app_id'] = app_id
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'PlayerSlice'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['app_key']

  new_options = opts.merge(
    :operation => :"DefaultApi.get_players",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DefaultApi#get_players\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_app(app_id, app, opts = {}) ⇒ App

Update an app Updates the name or configuration settings of an existing OneSignal app

Parameters:

  • app_id (String)

    An app id

  • app (App)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



1147
1148
1149
1150
# File 'lib/onesignal/api/default_api.rb', line 1147

def update_app(app_id, app, opts = {})
  data, _status_code, _headers = update_app_with_http_info(app_id, app, opts)
  data
end

#update_app_with_http_info(app_id, app, opts = {}) ⇒ Array<(App, Integer, Hash)>

Update an app Updates the name or configuration settings of an existing OneSignal app

Parameters:

  • app_id (String)

    An app id

  • app (App)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(App, Integer, Hash)>)

    App data, response status code and response headers



1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
# File 'lib/onesignal/api/default_api.rb', line 1158

def update_app_with_http_info(app_id, app, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.update_app ...'
  end
  # verify the required parameter 'app_id' is set
  if @api_client.config.client_side_validation && app_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.update_app"
  end
  # verify the required parameter 'app' is set
  if @api_client.config.client_side_validation && app.nil?
    fail ArgumentError, "Missing the required parameter 'app' when calling DefaultApi.update_app"
  end
  # resource path
  local_var_path = '/apps/{app_id}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(app)

  # return_type
  return_type = opts[:debug_return_type] || 'App'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['user_key']

  new_options = opts.merge(
    :operation => :"DefaultApi.update_app",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DefaultApi#update_app\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_player(player_id, player, opts = {}) ⇒ InlineResponse2001

Edit device Update an existing device in one of your OneSignal apps

Parameters:

  • player_id (String)

    Player&#39;s OneSignal ID

  • player (Player)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



1221
1222
1223
1224
# File 'lib/onesignal/api/default_api.rb', line 1221

def update_player(player_id, player, opts = {})
  data, _status_code, _headers = update_player_with_http_info(player_id, player, opts)
  data
end

#update_player_tags(app_id, external_user_id, opts = {}) ⇒ InlineResponse2001

Edit tags with external user id 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" }

Parameters:

  • app_id (String)

    The OneSignal App ID the user record is found under.

  • 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.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



1296
1297
1298
1299
# File 'lib/onesignal/api/default_api.rb', line 1296

def update_player_tags(app_id, external_user_id, opts = {})
  data, _status_code, _headers = update_player_tags_with_http_info(app_id, external_user_id, opts)
  data
end

#update_player_tags_with_http_info(app_id, external_user_id, opts = {}) ⇒ Array<(InlineResponse2001, Integer, Hash)>

Edit tags with external user id 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; }

Parameters:

  • app_id (String)

    The OneSignal App ID the user record is found under.

  • 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.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:

  • (Array<(InlineResponse2001, Integer, Hash)>)

    InlineResponse2001 data, response status code and response headers



1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
# File 'lib/onesignal/api/default_api.rb', line 1308

def update_player_tags_with_http_info(app_id, external_user_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.update_player_tags ...'
  end
  # verify the required parameter 'app_id' is set
  if @api_client.config.client_side_validation && app_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.update_player_tags"
  end
  # verify the required parameter 'external_user_id' is set
  if @api_client.config.client_side_validation && external_user_id.nil?
    fail ArgumentError, "Missing the required parameter 'external_user_id' when calling DefaultApi.update_player_tags"
  end
  # resource path
  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))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'update_player_tags_request_body'])

  # return_type
  return_type = opts[:debug_return_type] || 'InlineResponse2001'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['app_key']

  new_options = opts.merge(
    :operation => :"DefaultApi.update_player_tags",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DefaultApi#update_player_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_player_with_http_info(player_id, player, opts = {}) ⇒ Array<(InlineResponse2001, Integer, Hash)>

Edit device Update an existing device in one of your OneSignal apps

Parameters:

  • player_id (String)

    Player&#39;s OneSignal ID

  • player (Player)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(InlineResponse2001, Integer, Hash)>)

    InlineResponse2001 data, response status code and response headers



1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
# File 'lib/onesignal/api/default_api.rb', line 1232

def update_player_with_http_info(player_id, player, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DefaultApi.update_player ...'
  end
  # verify the required parameter 'player_id' is set
  if @api_client.config.client_side_validation && player_id.nil?
    fail ArgumentError, "Missing the required parameter 'player_id' when calling DefaultApi.update_player"
  end
  # verify the required parameter 'player' is set
  if @api_client.config.client_side_validation && player.nil?
    fail ArgumentError, "Missing the required parameter 'player' when calling DefaultApi.update_player"
  end
  # resource path
  local_var_path = '/players/{player_id}'.sub('{' + 'player_id' + '}', CGI.escape(player_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(player)

  # return_type
  return_type = opts[:debug_return_type] || 'InlineResponse2001'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['app_key']

  new_options = opts.merge(
    :operation => :"DefaultApi.update_player",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: DefaultApi#update_player\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end