onesignal_sdk 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (233) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +31 -0
  3. data/Gemfile +9 -0
  4. data/LICENSE +24 -0
  5. data/README.md +210 -0
  6. data/RELEASE_INSTRUCTIONS.md +11 -0
  7. data/Rakefile +10 -0
  8. data/docs/App.md +84 -0
  9. data/docs/BasicNotification.md +228 -0
  10. data/docs/BasicNotificationAllOf.md +200 -0
  11. data/docs/BasicNotificationAllOfAndroidBackgroundLayout.md +22 -0
  12. data/docs/BeginLiveActivityRequest.md +20 -0
  13. data/docs/Button.md +22 -0
  14. data/docs/CancelNotificationSuccessResponse.md +18 -0
  15. data/docs/CreateNotificationSuccessResponse.md +24 -0
  16. data/docs/CreatePlayerSuccessResponse.md +20 -0
  17. data/docs/CreateSegmentConflictResponse.md +20 -0
  18. data/docs/CreateSegmentSuccessResponse.md +20 -0
  19. data/docs/CreateSubscriptionRequestBody.md +20 -0
  20. data/docs/CreateUserConflictResponse.md +18 -0
  21. data/docs/CreateUserConflictResponseErrorsInner.md +22 -0
  22. data/docs/CreateUserConflictResponseErrorsItemsMeta.md +18 -0
  23. data/docs/DefaultApi.md +2713 -0
  24. data/docs/DeletePlayerNotFoundResponse.md +18 -0
  25. data/docs/DeletePlayerSuccessResponse.md +18 -0
  26. data/docs/DeleteSegmentNotFoundResponse.md +18 -0
  27. data/docs/DeleteSegmentSuccessResponse.md +18 -0
  28. data/docs/DeliveryData.md +26 -0
  29. data/docs/ExportEventsSuccessResponse.md +18 -0
  30. data/docs/ExportPlayersRequestBody.md +22 -0
  31. data/docs/ExportPlayersSuccessResponse.md +18 -0
  32. data/docs/Filter.md +24 -0
  33. data/docs/FilterExpressions.md +26 -0
  34. data/docs/GenericError.md +18 -0
  35. data/docs/GenericErrorErrorsInner.md +20 -0
  36. data/docs/GetNotificationRequestBody.md +22 -0
  37. data/docs/InlineResponse200.md +18 -0
  38. data/docs/InlineResponse2003.md +18 -0
  39. data/docs/InlineResponse201.md +18 -0
  40. data/docs/InlineResponse202.md +18 -0
  41. data/docs/InvalidIdentifierError.md +20 -0
  42. data/docs/Notification.md +230 -0
  43. data/docs/Notification200Errors.md +49 -0
  44. data/docs/NotificationAllOf.md +18 -0
  45. data/docs/NotificationHistorySuccessResponse.md +20 -0
  46. data/docs/NotificationSlice.md +24 -0
  47. data/docs/NotificationTarget.md +44 -0
  48. data/docs/NotificationWithMeta.md +250 -0
  49. data/docs/NotificationWithMetaAllOf.md +38 -0
  50. data/docs/Operator.md +18 -0
  51. data/docs/OutcomeData.md +22 -0
  52. data/docs/OutcomesData.md +18 -0
  53. data/docs/PlatformDeliveryData.md +32 -0
  54. data/docs/PlatformDeliveryDataEmailAllOf.md +30 -0
  55. data/docs/PlatformDeliveryDataSmsAllOf.md +22 -0
  56. data/docs/Player.md +70 -0
  57. data/docs/PlayerNotificationTarget.md +40 -0
  58. data/docs/PlayerNotificationTargetIncludeAliases.md +18 -0
  59. data/docs/PlayerSlice.md +24 -0
  60. data/docs/PropertiesDeltas.md +22 -0
  61. data/docs/PropertiesObject.md +38 -0
  62. data/docs/Purchase.md +24 -0
  63. data/docs/RateLimiterError.md +18 -0
  64. data/docs/Segment.md +22 -0
  65. data/docs/SegmentNotificationTarget.md +20 -0
  66. data/docs/StringMap.md +102 -0
  67. data/docs/SubscriptionObject.md +50 -0
  68. data/docs/TransferSubscriptionRequestBody.md +18 -0
  69. data/docs/UpdateLiveActivityRequest.md +24 -0
  70. data/docs/UpdateLiveActivitySuccessResponse.md +20 -0
  71. data/docs/UpdatePlayerSuccessResponse.md +18 -0
  72. data/docs/UpdatePlayerTagsRequestBody.md +18 -0
  73. data/docs/UpdatePlayerTagsSuccessResponse.md +18 -0
  74. data/docs/UpdateSubscriptionRequestBody.md +18 -0
  75. data/docs/UpdateUserRequest.md +22 -0
  76. data/docs/User.md +24 -0
  77. data/docs/UserIdentityRequestBody.md +18 -0
  78. data/docs/UserIdentityResponse.md +18 -0
  79. data/docs/UserSubscriptionOptions.md +18 -0
  80. data/lib/onesignal/api/default_api.rb +2727 -0
  81. data/lib/onesignal/api_client.rb +393 -0
  82. data/lib/onesignal/api_error.rb +57 -0
  83. data/lib/onesignal/configuration.rb +245 -0
  84. data/lib/onesignal/models/app.rb +586 -0
  85. data/lib/onesignal/models/basic_notification.rb +1431 -0
  86. data/lib/onesignal/models/basic_notification_all_of.rb +1241 -0
  87. data/lib/onesignal/models/basic_notification_all_of_android_background_layout.rb +241 -0
  88. data/lib/onesignal/models/begin_live_activity_request.rb +238 -0
  89. data/lib/onesignal/models/button.rb +242 -0
  90. data/lib/onesignal/models/cancel_notification_success_response.rb +219 -0
  91. data/lib/onesignal/models/create_notification_success_response.rb +248 -0
  92. data/lib/onesignal/models/create_player_success_response.rb +228 -0
  93. data/lib/onesignal/models/create_segment_conflict_response.rb +230 -0
  94. data/lib/onesignal/models/create_segment_success_response.rb +229 -0
  95. data/lib/onesignal/models/create_subscription_request_body.rb +228 -0
  96. data/lib/onesignal/models/create_user_conflict_response.rb +221 -0
  97. data/lib/onesignal/models/create_user_conflict_response_errors_inner.rb +237 -0
  98. data/lib/onesignal/models/create_user_conflict_response_errors_items_meta.rb +219 -0
  99. data/lib/onesignal/models/delete_player_not_found_response.rb +219 -0
  100. data/lib/onesignal/models/delete_player_success_response.rb +219 -0
  101. data/lib/onesignal/models/delete_segment_not_found_response.rb +219 -0
  102. data/lib/onesignal/models/delete_segment_success_response.rb +219 -0
  103. data/lib/onesignal/models/delivery_data.rb +265 -0
  104. data/lib/onesignal/models/export_events_success_response.rb +219 -0
  105. data/lib/onesignal/models/export_players_request_body.rb +242 -0
  106. data/lib/onesignal/models/export_players_success_response.rb +219 -0
  107. data/lib/onesignal/models/filter.rb +294 -0
  108. data/lib/onesignal/models/filter_expressions.rb +336 -0
  109. data/lib/onesignal/models/generic_error.rb +221 -0
  110. data/lib/onesignal/models/generic_error_errors_inner.rb +228 -0
  111. data/lib/onesignal/models/get_notification_request_body.rb +273 -0
  112. data/lib/onesignal/models/inline_response200.rb +221 -0
  113. data/lib/onesignal/models/inline_response2003.rb +221 -0
  114. data/lib/onesignal/models/inline_response201.rb +219 -0
  115. data/lib/onesignal/models/inline_response202.rb +219 -0
  116. data/lib/onesignal/models/invalid_identifier_error.rb +234 -0
  117. data/lib/onesignal/models/notification.rb +1442 -0
  118. data/lib/onesignal/models/notification200_errors.rb +105 -0
  119. data/lib/onesignal/models/notification_all_of.rb +221 -0
  120. data/lib/onesignal/models/notification_history_success_response.rb +228 -0
  121. data/lib/onesignal/models/notification_slice.rb +248 -0
  122. data/lib/onesignal/models/notification_target.rb +429 -0
  123. data/lib/onesignal/models/notification_with_meta.rb +1546 -0
  124. data/lib/onesignal/models/notification_with_meta_all_of.rb +323 -0
  125. data/lib/onesignal/models/operator.rb +254 -0
  126. data/lib/onesignal/models/outcome_data.rb +286 -0
  127. data/lib/onesignal/models/outcomes_data.rb +221 -0
  128. data/lib/onesignal/models/platform_delivery_data.rb +285 -0
  129. data/lib/onesignal/models/platform_delivery_data_email_all_of.rb +287 -0
  130. data/lib/onesignal/models/platform_delivery_data_sms_all_of.rb +243 -0
  131. data/lib/onesignal/models/player.rb +494 -0
  132. data/lib/onesignal/models/player_notification_target.rb +385 -0
  133. data/lib/onesignal/models/player_notification_target_include_aliases.rb +221 -0
  134. data/lib/onesignal/models/player_slice.rb +248 -0
  135. data/lib/onesignal/models/properties_deltas.rb +239 -0
  136. data/lib/onesignal/models/properties_object.rb +313 -0
  137. data/lib/onesignal/models/purchase.rb +264 -0
  138. data/lib/onesignal/models/rate_limiter_error.rb +221 -0
  139. data/lib/onesignal/models/segment.rb +252 -0
  140. data/lib/onesignal/models/segment_notification_target.rb +234 -0
  141. data/lib/onesignal/models/string_map.rb +640 -0
  142. data/lib/onesignal/models/subscription_object.rb +397 -0
  143. data/lib/onesignal/models/transfer_subscription_request_body.rb +221 -0
  144. data/lib/onesignal/models/update_live_activity_request.rb +309 -0
  145. data/lib/onesignal/models/update_live_activity_success_response.rb +228 -0
  146. data/lib/onesignal/models/update_player_success_response.rb +219 -0
  147. data/lib/onesignal/models/update_player_tags_request_body.rb +220 -0
  148. data/lib/onesignal/models/update_player_tags_success_response.rb +219 -0
  149. data/lib/onesignal/models/update_subscription_request_body.rb +219 -0
  150. data/lib/onesignal/models/update_user_request.rb +239 -0
  151. data/lib/onesignal/models/user.rb +250 -0
  152. data/lib/onesignal/models/user_identity_request_body.rb +221 -0
  153. data/lib/onesignal/models/user_identity_response.rb +221 -0
  154. data/lib/onesignal/models/user_subscription_options.rb +219 -0
  155. data/lib/onesignal/version.rb +15 -0
  156. data/lib/onesignal.rb +111 -0
  157. data/onesignal.gemspec +38 -0
  158. data/spec/api/default_api_spec.rb +522 -0
  159. data/spec/api_client_spec.rb +226 -0
  160. data/spec/configuration_spec.rb +42 -0
  161. data/spec/models/app_spec.rb +236 -0
  162. data/spec/models/basic_notification_all_of_android_background_layout_spec.rb +46 -0
  163. data/spec/models/basic_notification_all_of_spec.rb +584 -0
  164. data/spec/models/basic_notification_spec.rb +672 -0
  165. data/spec/models/begin_live_activity_request_spec.rb +40 -0
  166. data/spec/models/button_spec.rb +46 -0
  167. data/spec/models/cancel_notification_success_response_spec.rb +34 -0
  168. data/spec/models/create_notification_success_response_spec.rb +52 -0
  169. data/spec/models/create_player_success_response_spec.rb +40 -0
  170. data/spec/models/create_segment_conflict_response_spec.rb +40 -0
  171. data/spec/models/create_segment_success_response_spec.rb +40 -0
  172. data/spec/models/create_subscription_request_body_spec.rb +40 -0
  173. data/spec/models/create_user_conflict_response_errors_inner_spec.rb +46 -0
  174. data/spec/models/create_user_conflict_response_errors_items_meta_spec.rb +34 -0
  175. data/spec/models/create_user_conflict_response_spec.rb +34 -0
  176. data/spec/models/delete_player_not_found_response_spec.rb +34 -0
  177. data/spec/models/delete_player_success_response_spec.rb +34 -0
  178. data/spec/models/delete_segment_not_found_response_spec.rb +34 -0
  179. data/spec/models/delete_segment_success_response_spec.rb +34 -0
  180. data/spec/models/delivery_data_spec.rb +58 -0
  181. data/spec/models/export_events_success_response_spec.rb +34 -0
  182. data/spec/models/export_players_request_body_spec.rb +46 -0
  183. data/spec/models/export_players_success_response_spec.rb +34 -0
  184. data/spec/models/filter_expressions_spec.rb +66 -0
  185. data/spec/models/filter_spec.rb +56 -0
  186. data/spec/models/generic_error_errors_inner_spec.rb +40 -0
  187. data/spec/models/generic_error_spec.rb +34 -0
  188. data/spec/models/get_notification_request_body_spec.rb +50 -0
  189. data/spec/models/inline_response2003_spec.rb +34 -0
  190. data/spec/models/inline_response200_spec.rb +34 -0
  191. data/spec/models/inline_response201_spec.rb +34 -0
  192. data/spec/models/inline_response202_spec.rb +34 -0
  193. data/spec/models/invalid_identifier_error_spec.rb +40 -0
  194. data/spec/models/notification200_errors_spec.rb +31 -0
  195. data/spec/models/notification_all_of_spec.rb +34 -0
  196. data/spec/models/notification_history_success_response_spec.rb +40 -0
  197. data/spec/models/notification_slice_spec.rb +52 -0
  198. data/spec/models/notification_spec.rb +678 -0
  199. data/spec/models/notification_target_spec.rb +116 -0
  200. data/spec/models/notification_with_meta_all_of_spec.rb +94 -0
  201. data/spec/models/notification_with_meta_spec.rb +738 -0
  202. data/spec/models/operator_spec.rb +38 -0
  203. data/spec/models/outcome_data_spec.rb +50 -0
  204. data/spec/models/outcomes_data_spec.rb +34 -0
  205. data/spec/models/platform_delivery_data_email_all_of_spec.rb +70 -0
  206. data/spec/models/platform_delivery_data_sms_all_of_spec.rb +46 -0
  207. data/spec/models/platform_delivery_data_spec.rb +76 -0
  208. data/spec/models/player_notification_target_include_aliases_spec.rb +34 -0
  209. data/spec/models/player_notification_target_spec.rb +104 -0
  210. data/spec/models/player_slice_spec.rb +52 -0
  211. data/spec/models/player_spec.rb +190 -0
  212. data/spec/models/properties_deltas_spec.rb +46 -0
  213. data/spec/models/properties_object_spec.rb +94 -0
  214. data/spec/models/purchase_spec.rb +52 -0
  215. data/spec/models/rate_limiter_error_spec.rb +34 -0
  216. data/spec/models/segment_notification_target_spec.rb +40 -0
  217. data/spec/models/segment_spec.rb +46 -0
  218. data/spec/models/string_map_spec.rb +286 -0
  219. data/spec/models/subscription_object_spec.rb +134 -0
  220. data/spec/models/transfer_subscription_request_body_spec.rb +34 -0
  221. data/spec/models/update_live_activity_request_spec.rb +60 -0
  222. data/spec/models/update_live_activity_success_response_spec.rb +40 -0
  223. data/spec/models/update_player_success_response_spec.rb +34 -0
  224. data/spec/models/update_player_tags_request_body_spec.rb +34 -0
  225. data/spec/models/update_player_tags_success_response_spec.rb +34 -0
  226. data/spec/models/update_subscription_request_body_spec.rb +34 -0
  227. data/spec/models/update_user_request_spec.rb +46 -0
  228. data/spec/models/user_identity_request_body_spec.rb +34 -0
  229. data/spec/models/user_identity_response_spec.rb +34 -0
  230. data/spec/models/user_spec.rb +52 -0
  231. data/spec/models/user_subscription_options_spec.rb +34 -0
  232. data/spec/spec_helper.rb +111 -0
  233. metadata +389 -0
@@ -0,0 +1,2727 @@
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.2.2
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
+ # Start Live Activity
23
+ # Starts a Live Activity
24
+ # @param app_id [String] The OneSignal App ID for your app. Available in Keys & IDs.
25
+ # @param activity_id [String] Live Activity record ID
26
+ # @param begin_live_activity_request [BeginLiveActivityRequest]
27
+ # @param [Hash] opts the optional parameters
28
+ # @return [nil]
29
+ def begin_live_activity(app_id, activity_id, begin_live_activity_request, opts = {})
30
+ begin_live_activity_with_http_info(app_id, activity_id, begin_live_activity_request, opts)
31
+ nil
32
+ end
33
+
34
+ # Start Live Activity
35
+ # Starts a Live Activity
36
+ # @param app_id [String] The OneSignal App ID for your app. Available in Keys & IDs.
37
+ # @param activity_id [String] Live Activity record ID
38
+ # @param begin_live_activity_request [BeginLiveActivityRequest]
39
+ # @param [Hash] opts the optional parameters
40
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
41
+ def begin_live_activity_with_http_info(app_id, activity_id, begin_live_activity_request, opts = {})
42
+ if @api_client.config.debugging
43
+ @api_client.config.logger.debug 'Calling API: DefaultApi.begin_live_activity ...'
44
+ end
45
+ # verify the required parameter 'app_id' is set
46
+ if @api_client.config.client_side_validation && app_id.nil?
47
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.begin_live_activity"
48
+ end
49
+ # verify the required parameter 'activity_id' is set
50
+ if @api_client.config.client_side_validation && activity_id.nil?
51
+ fail ArgumentError, "Missing the required parameter 'activity_id' when calling DefaultApi.begin_live_activity"
52
+ end
53
+ # verify the required parameter 'begin_live_activity_request' is set
54
+ if @api_client.config.client_side_validation && begin_live_activity_request.nil?
55
+ fail ArgumentError, "Missing the required parameter 'begin_live_activity_request' when calling DefaultApi.begin_live_activity"
56
+ end
57
+ # resource path
58
+ local_var_path = '/apps/{app_id}/live_activities/{activity_id}/token'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'activity_id' + '}', CGI.escape(activity_id.to_s))
59
+
60
+ # query parameters
61
+ query_params = opts[:query_params] || {}
62
+
63
+ # header parameters
64
+ header_params = opts[:header_params] || {}
65
+ # HTTP header 'Accept' (if needed)
66
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
67
+ # HTTP header 'Content-Type'
68
+ content_type = @api_client.select_header_content_type(['application/json'])
69
+ if !content_type.nil?
70
+ header_params['Content-Type'] = content_type
71
+ end
72
+
73
+ # form parameters
74
+ form_params = opts[:form_params] || {}
75
+
76
+ # http body (model)
77
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(begin_live_activity_request)
78
+
79
+ # return_type
80
+ return_type = opts[:debug_return_type]
81
+
82
+ # auth_names
83
+ auth_names = opts[:debug_auth_names] || ['app_key']
84
+
85
+ new_options = opts.merge(
86
+ :operation => :"DefaultApi.begin_live_activity",
87
+ :header_params => header_params,
88
+ :query_params => query_params,
89
+ :form_params => form_params,
90
+ :body => post_body,
91
+ :auth_names => auth_names,
92
+ :return_type => return_type
93
+ )
94
+
95
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
96
+ if @api_client.config.debugging
97
+ @api_client.config.logger.debug "API called: DefaultApi#begin_live_activity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
98
+ end
99
+ return data, status_code, headers
100
+ end
101
+
102
+ # Stop a scheduled or currently outgoing notification
103
+ # Used to stop a scheduled or currently outgoing notification
104
+ # @param app_id [String]
105
+ # @param notification_id [String]
106
+ # @param [Hash] opts the optional parameters
107
+ # @return [CancelNotificationSuccessResponse]
108
+ def cancel_notification(app_id, notification_id, opts = {})
109
+ data, _status_code, _headers = cancel_notification_with_http_info(app_id, notification_id, opts)
110
+ data
111
+ end
112
+
113
+ # Stop a scheduled or currently outgoing notification
114
+ # Used to stop a scheduled or currently outgoing notification
115
+ # @param app_id [String]
116
+ # @param notification_id [String]
117
+ # @param [Hash] opts the optional parameters
118
+ # @return [Array<(CancelNotificationSuccessResponse, Integer, Hash)>] CancelNotificationSuccessResponse data, response status code and response headers
119
+ def cancel_notification_with_http_info(app_id, notification_id, opts = {})
120
+ if @api_client.config.debugging
121
+ @api_client.config.logger.debug 'Calling API: DefaultApi.cancel_notification ...'
122
+ end
123
+ # verify the required parameter 'app_id' is set
124
+ if @api_client.config.client_side_validation && app_id.nil?
125
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.cancel_notification"
126
+ end
127
+ # verify the required parameter 'notification_id' is set
128
+ if @api_client.config.client_side_validation && notification_id.nil?
129
+ fail ArgumentError, "Missing the required parameter 'notification_id' when calling DefaultApi.cancel_notification"
130
+ end
131
+ # resource path
132
+ local_var_path = '/notifications/{notification_id}'.sub('{' + 'notification_id' + '}', CGI.escape(notification_id.to_s))
133
+
134
+ # query parameters
135
+ query_params = opts[:query_params] || {}
136
+ query_params[:'app_id'] = app_id
137
+
138
+ # header parameters
139
+ header_params = opts[:header_params] || {}
140
+ # HTTP header 'Accept' (if needed)
141
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
142
+
143
+ # form parameters
144
+ form_params = opts[:form_params] || {}
145
+
146
+ # http body (model)
147
+ post_body = opts[:debug_body]
148
+
149
+ # return_type
150
+ return_type = opts[:debug_return_type] || 'CancelNotificationSuccessResponse'
151
+
152
+ # auth_names
153
+ auth_names = opts[:debug_auth_names] || ['app_key']
154
+
155
+ new_options = opts.merge(
156
+ :operation => :"DefaultApi.cancel_notification",
157
+ :header_params => header_params,
158
+ :query_params => query_params,
159
+ :form_params => form_params,
160
+ :body => post_body,
161
+ :auth_names => auth_names,
162
+ :return_type => return_type
163
+ )
164
+
165
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
166
+ if @api_client.config.debugging
167
+ @api_client.config.logger.debug "API called: DefaultApi#cancel_notification\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
168
+ end
169
+ return data, status_code, headers
170
+ end
171
+
172
+ # Create an app
173
+ # Creates a new OneSignal app
174
+ # @param app [App]
175
+ # @param [Hash] opts the optional parameters
176
+ # @return [App]
177
+ def create_app(app, opts = {})
178
+ data, _status_code, _headers = create_app_with_http_info(app, opts)
179
+ data
180
+ end
181
+
182
+ # Create an app
183
+ # Creates a new OneSignal app
184
+ # @param app [App]
185
+ # @param [Hash] opts the optional parameters
186
+ # @return [Array<(App, Integer, Hash)>] App data, response status code and response headers
187
+ def create_app_with_http_info(app, opts = {})
188
+ if @api_client.config.debugging
189
+ @api_client.config.logger.debug 'Calling API: DefaultApi.create_app ...'
190
+ end
191
+ # verify the required parameter 'app' is set
192
+ if @api_client.config.client_side_validation && app.nil?
193
+ fail ArgumentError, "Missing the required parameter 'app' when calling DefaultApi.create_app"
194
+ end
195
+ # resource path
196
+ local_var_path = '/apps'
197
+
198
+ # query parameters
199
+ query_params = opts[:query_params] || {}
200
+
201
+ # header parameters
202
+ header_params = opts[:header_params] || {}
203
+ # HTTP header 'Accept' (if needed)
204
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
205
+ # HTTP header 'Content-Type'
206
+ content_type = @api_client.select_header_content_type(['application/json'])
207
+ if !content_type.nil?
208
+ header_params['Content-Type'] = content_type
209
+ end
210
+
211
+ # form parameters
212
+ form_params = opts[:form_params] || {}
213
+
214
+ # http body (model)
215
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(app)
216
+
217
+ # return_type
218
+ return_type = opts[:debug_return_type] || 'App'
219
+
220
+ # auth_names
221
+ auth_names = opts[:debug_auth_names] || ['user_key']
222
+
223
+ new_options = opts.merge(
224
+ :operation => :"DefaultApi.create_app",
225
+ :header_params => header_params,
226
+ :query_params => query_params,
227
+ :form_params => form_params,
228
+ :body => post_body,
229
+ :auth_names => auth_names,
230
+ :return_type => return_type
231
+ )
232
+
233
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
234
+ if @api_client.config.debugging
235
+ @api_client.config.logger.debug "API called: DefaultApi#create_app\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
236
+ end
237
+ return data, status_code, headers
238
+ end
239
+
240
+ # Create notification
241
+ # Sends notifications to your users
242
+ # @param notification [Notification]
243
+ # @param [Hash] opts the optional parameters
244
+ # @return [CreateNotificationSuccessResponse]
245
+ def create_notification(notification, opts = {})
246
+ data, _status_code, _headers = create_notification_with_http_info(notification, opts)
247
+ data
248
+ end
249
+
250
+ # Create notification
251
+ # Sends notifications to your users
252
+ # @param notification [Notification]
253
+ # @param [Hash] opts the optional parameters
254
+ # @return [Array<(CreateNotificationSuccessResponse, Integer, Hash)>] CreateNotificationSuccessResponse data, response status code and response headers
255
+ def create_notification_with_http_info(notification, opts = {})
256
+ if @api_client.config.debugging
257
+ @api_client.config.logger.debug 'Calling API: DefaultApi.create_notification ...'
258
+ end
259
+ # verify the required parameter 'notification' is set
260
+ if @api_client.config.client_side_validation && notification.nil?
261
+ fail ArgumentError, "Missing the required parameter 'notification' when calling DefaultApi.create_notification"
262
+ end
263
+ # resource path
264
+ local_var_path = '/notifications'
265
+
266
+ # query parameters
267
+ query_params = opts[:query_params] || {}
268
+
269
+ # header parameters
270
+ header_params = opts[:header_params] || {}
271
+ # HTTP header 'Accept' (if needed)
272
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
273
+ # HTTP header 'Content-Type'
274
+ content_type = @api_client.select_header_content_type(['application/json'])
275
+ if !content_type.nil?
276
+ header_params['Content-Type'] = content_type
277
+ end
278
+
279
+ # form parameters
280
+ form_params = opts[:form_params] || {}
281
+
282
+ # http body (model)
283
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(notification)
284
+
285
+ # return_type
286
+ return_type = opts[:debug_return_type] || 'CreateNotificationSuccessResponse'
287
+
288
+ # auth_names
289
+ auth_names = opts[:debug_auth_names] || ['app_key']
290
+
291
+ new_options = opts.merge(
292
+ :operation => :"DefaultApi.create_notification",
293
+ :header_params => header_params,
294
+ :query_params => query_params,
295
+ :form_params => form_params,
296
+ :body => post_body,
297
+ :auth_names => auth_names,
298
+ :return_type => return_type
299
+ )
300
+
301
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
302
+ if @api_client.config.debugging
303
+ @api_client.config.logger.debug "API called: DefaultApi#create_notification\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
304
+ end
305
+ return data, status_code, headers
306
+ end
307
+
308
+ # Add a device
309
+ # 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.
310
+ # @param player [Player]
311
+ # @param [Hash] opts the optional parameters
312
+ # @return [CreatePlayerSuccessResponse]
313
+ def create_player(player, opts = {})
314
+ data, _status_code, _headers = create_player_with_http_info(player, opts)
315
+ data
316
+ end
317
+
318
+ # Add a device
319
+ # 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.
320
+ # @param player [Player]
321
+ # @param [Hash] opts the optional parameters
322
+ # @return [Array<(CreatePlayerSuccessResponse, Integer, Hash)>] CreatePlayerSuccessResponse data, response status code and response headers
323
+ def create_player_with_http_info(player, opts = {})
324
+ if @api_client.config.debugging
325
+ @api_client.config.logger.debug 'Calling API: DefaultApi.create_player ...'
326
+ end
327
+ # verify the required parameter 'player' is set
328
+ if @api_client.config.client_side_validation && player.nil?
329
+ fail ArgumentError, "Missing the required parameter 'player' when calling DefaultApi.create_player"
330
+ end
331
+ # resource path
332
+ local_var_path = '/players'
333
+
334
+ # query parameters
335
+ query_params = opts[:query_params] || {}
336
+
337
+ # header parameters
338
+ header_params = opts[:header_params] || {}
339
+ # HTTP header 'Accept' (if needed)
340
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
341
+ # HTTP header 'Content-Type'
342
+ content_type = @api_client.select_header_content_type(['application/json'])
343
+ if !content_type.nil?
344
+ header_params['Content-Type'] = content_type
345
+ end
346
+
347
+ # form parameters
348
+ form_params = opts[:form_params] || {}
349
+
350
+ # http body (model)
351
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(player)
352
+
353
+ # return_type
354
+ return_type = opts[:debug_return_type] || 'CreatePlayerSuccessResponse'
355
+
356
+ # auth_names
357
+ auth_names = opts[:debug_auth_names] || ['app_key']
358
+
359
+ new_options = opts.merge(
360
+ :operation => :"DefaultApi.create_player",
361
+ :header_params => header_params,
362
+ :query_params => query_params,
363
+ :form_params => form_params,
364
+ :body => post_body,
365
+ :auth_names => auth_names,
366
+ :return_type => return_type
367
+ )
368
+
369
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
370
+ if @api_client.config.debugging
371
+ @api_client.config.logger.debug "API called: DefaultApi#create_player\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
372
+ end
373
+ return data, status_code, headers
374
+ end
375
+
376
+ # Create Segments
377
+ # 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.
378
+ # @param app_id [String] The OneSignal App ID for your app. Available in Keys &amp; IDs.
379
+ # @param [Hash] opts the optional parameters
380
+ # @option opts [Segment] :segment
381
+ # @return [CreateSegmentSuccessResponse]
382
+ def create_segments(app_id, opts = {})
383
+ data, _status_code, _headers = create_segments_with_http_info(app_id, opts)
384
+ data
385
+ end
386
+
387
+ # Create Segments
388
+ # 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.
389
+ # @param app_id [String] The OneSignal App ID for your app. Available in Keys &amp; IDs.
390
+ # @param [Hash] opts the optional parameters
391
+ # @option opts [Segment] :segment
392
+ # @return [Array<(CreateSegmentSuccessResponse, Integer, Hash)>] CreateSegmentSuccessResponse data, response status code and response headers
393
+ def create_segments_with_http_info(app_id, opts = {})
394
+ if @api_client.config.debugging
395
+ @api_client.config.logger.debug 'Calling API: DefaultApi.create_segments ...'
396
+ end
397
+ # verify the required parameter 'app_id' is set
398
+ if @api_client.config.client_side_validation && app_id.nil?
399
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.create_segments"
400
+ end
401
+ # resource path
402
+ local_var_path = '/apps/{app_id}/segments'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s))
403
+
404
+ # query parameters
405
+ query_params = opts[:query_params] || {}
406
+
407
+ # header parameters
408
+ header_params = opts[:header_params] || {}
409
+ # HTTP header 'Accept' (if needed)
410
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
411
+ # HTTP header 'Content-Type'
412
+ content_type = @api_client.select_header_content_type(['application/json'])
413
+ if !content_type.nil?
414
+ header_params['Content-Type'] = content_type
415
+ end
416
+
417
+ # form parameters
418
+ form_params = opts[:form_params] || {}
419
+
420
+ # http body (model)
421
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'segment'])
422
+
423
+ # return_type
424
+ return_type = opts[:debug_return_type] || 'CreateSegmentSuccessResponse'
425
+
426
+ # auth_names
427
+ auth_names = opts[:debug_auth_names] || ['app_key']
428
+
429
+ new_options = opts.merge(
430
+ :operation => :"DefaultApi.create_segments",
431
+ :header_params => header_params,
432
+ :query_params => query_params,
433
+ :form_params => form_params,
434
+ :body => post_body,
435
+ :auth_names => auth_names,
436
+ :return_type => return_type
437
+ )
438
+
439
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
440
+ if @api_client.config.debugging
441
+ @api_client.config.logger.debug "API called: DefaultApi#create_segments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
442
+ end
443
+ return data, status_code, headers
444
+ end
445
+
446
+ # Creates a new Subscription under the User provided. Useful to add email addresses and SMS numbers to the User.
447
+ # @param app_id [String]
448
+ # @param alias_label [String]
449
+ # @param alias_id [String]
450
+ # @param create_subscription_request_body [CreateSubscriptionRequestBody]
451
+ # @param [Hash] opts the optional parameters
452
+ # @return [InlineResponse201]
453
+ def create_subscription(app_id, alias_label, alias_id, create_subscription_request_body, opts = {})
454
+ data, _status_code, _headers = create_subscription_with_http_info(app_id, alias_label, alias_id, create_subscription_request_body, opts)
455
+ data
456
+ end
457
+
458
+ # Creates a new Subscription under the User provided. Useful to add email addresses and SMS numbers to the User.
459
+ # @param app_id [String]
460
+ # @param alias_label [String]
461
+ # @param alias_id [String]
462
+ # @param create_subscription_request_body [CreateSubscriptionRequestBody]
463
+ # @param [Hash] opts the optional parameters
464
+ # @return [Array<(InlineResponse201, Integer, Hash)>] InlineResponse201 data, response status code and response headers
465
+ def create_subscription_with_http_info(app_id, alias_label, alias_id, create_subscription_request_body, opts = {})
466
+ if @api_client.config.debugging
467
+ @api_client.config.logger.debug 'Calling API: DefaultApi.create_subscription ...'
468
+ end
469
+ # verify the required parameter 'app_id' is set
470
+ if @api_client.config.client_side_validation && app_id.nil?
471
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.create_subscription"
472
+ end
473
+ # verify the required parameter 'alias_label' is set
474
+ if @api_client.config.client_side_validation && alias_label.nil?
475
+ fail ArgumentError, "Missing the required parameter 'alias_label' when calling DefaultApi.create_subscription"
476
+ end
477
+ # verify the required parameter 'alias_id' is set
478
+ if @api_client.config.client_side_validation && alias_id.nil?
479
+ fail ArgumentError, "Missing the required parameter 'alias_id' when calling DefaultApi.create_subscription"
480
+ end
481
+ # verify the required parameter 'create_subscription_request_body' is set
482
+ if @api_client.config.client_side_validation && create_subscription_request_body.nil?
483
+ fail ArgumentError, "Missing the required parameter 'create_subscription_request_body' when calling DefaultApi.create_subscription"
484
+ end
485
+ # resource path
486
+ local_var_path = '/apps/{app_id}/users/by/{alias_label}/{alias_id}/subscriptions'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'alias_label' + '}', CGI.escape(alias_label.to_s)).sub('{' + 'alias_id' + '}', CGI.escape(alias_id.to_s))
487
+
488
+ # query parameters
489
+ query_params = opts[:query_params] || {}
490
+
491
+ # header parameters
492
+ header_params = opts[:header_params] || {}
493
+ # HTTP header 'Accept' (if needed)
494
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
495
+ # HTTP header 'Content-Type'
496
+ content_type = @api_client.select_header_content_type(['application/json'])
497
+ if !content_type.nil?
498
+ header_params['Content-Type'] = content_type
499
+ end
500
+
501
+ # form parameters
502
+ form_params = opts[:form_params] || {}
503
+
504
+ # http body (model)
505
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_subscription_request_body)
506
+
507
+ # return_type
508
+ return_type = opts[:debug_return_type] || 'InlineResponse201'
509
+
510
+ # auth_names
511
+ auth_names = opts[:debug_auth_names] || ['app_key']
512
+
513
+ new_options = opts.merge(
514
+ :operation => :"DefaultApi.create_subscription",
515
+ :header_params => header_params,
516
+ :query_params => query_params,
517
+ :form_params => form_params,
518
+ :body => post_body,
519
+ :auth_names => auth_names,
520
+ :return_type => return_type
521
+ )
522
+
523
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
524
+ if @api_client.config.debugging
525
+ @api_client.config.logger.debug "API called: DefaultApi#create_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
526
+ end
527
+ return data, status_code, headers
528
+ end
529
+
530
+ # Creates a User, optionally Subscriptions owned by the User as well as Aliases. Aliases provided in the payload will be used to look up an existing User.
531
+ # @param app_id [String]
532
+ # @param user [User]
533
+ # @param [Hash] opts the optional parameters
534
+ # @return [User]
535
+ def create_user(app_id, user, opts = {})
536
+ data, _status_code, _headers = create_user_with_http_info(app_id, user, opts)
537
+ data
538
+ end
539
+
540
+ # Creates a User, optionally Subscriptions owned by the User as well as Aliases. Aliases provided in the payload will be used to look up an existing User.
541
+ # @param app_id [String]
542
+ # @param user [User]
543
+ # @param [Hash] opts the optional parameters
544
+ # @return [Array<(User, Integer, Hash)>] User data, response status code and response headers
545
+ def create_user_with_http_info(app_id, user, opts = {})
546
+ if @api_client.config.debugging
547
+ @api_client.config.logger.debug 'Calling API: DefaultApi.create_user ...'
548
+ end
549
+ # verify the required parameter 'app_id' is set
550
+ if @api_client.config.client_side_validation && app_id.nil?
551
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.create_user"
552
+ end
553
+ # verify the required parameter 'user' is set
554
+ if @api_client.config.client_side_validation && user.nil?
555
+ fail ArgumentError, "Missing the required parameter 'user' when calling DefaultApi.create_user"
556
+ end
557
+ # resource path
558
+ local_var_path = '/apps/{app_id}/users'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s))
559
+
560
+ # query parameters
561
+ query_params = opts[:query_params] || {}
562
+
563
+ # header parameters
564
+ header_params = opts[:header_params] || {}
565
+ # HTTP header 'Accept' (if needed)
566
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
567
+ # HTTP header 'Content-Type'
568
+ content_type = @api_client.select_header_content_type(['application/json'])
569
+ if !content_type.nil?
570
+ header_params['Content-Type'] = content_type
571
+ end
572
+
573
+ # form parameters
574
+ form_params = opts[:form_params] || {}
575
+
576
+ # http body (model)
577
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(user)
578
+
579
+ # return_type
580
+ return_type = opts[:debug_return_type] || 'User'
581
+
582
+ # auth_names
583
+ auth_names = opts[:debug_auth_names] || ['app_key']
584
+
585
+ new_options = opts.merge(
586
+ :operation => :"DefaultApi.create_user",
587
+ :header_params => header_params,
588
+ :query_params => query_params,
589
+ :form_params => form_params,
590
+ :body => post_body,
591
+ :auth_names => auth_names,
592
+ :return_type => return_type
593
+ )
594
+
595
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
596
+ if @api_client.config.debugging
597
+ @api_client.config.logger.debug "API called: DefaultApi#create_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
598
+ end
599
+ return data, status_code, headers
600
+ end
601
+
602
+ # Deletes an alias by alias label
603
+ # @param app_id [String]
604
+ # @param alias_label [String]
605
+ # @param alias_id [String]
606
+ # @param alias_label_to_delete [String]
607
+ # @param [Hash] opts the optional parameters
608
+ # @return [InlineResponse200]
609
+ def delete_alias(app_id, alias_label, alias_id, alias_label_to_delete, opts = {})
610
+ data, _status_code, _headers = delete_alias_with_http_info(app_id, alias_label, alias_id, alias_label_to_delete, opts)
611
+ data
612
+ end
613
+
614
+ # Deletes an alias by alias label
615
+ # @param app_id [String]
616
+ # @param alias_label [String]
617
+ # @param alias_id [String]
618
+ # @param alias_label_to_delete [String]
619
+ # @param [Hash] opts the optional parameters
620
+ # @return [Array<(InlineResponse200, Integer, Hash)>] InlineResponse200 data, response status code and response headers
621
+ def delete_alias_with_http_info(app_id, alias_label, alias_id, alias_label_to_delete, opts = {})
622
+ if @api_client.config.debugging
623
+ @api_client.config.logger.debug 'Calling API: DefaultApi.delete_alias ...'
624
+ end
625
+ # verify the required parameter 'app_id' is set
626
+ if @api_client.config.client_side_validation && app_id.nil?
627
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.delete_alias"
628
+ end
629
+ # verify the required parameter 'alias_label' is set
630
+ if @api_client.config.client_side_validation && alias_label.nil?
631
+ fail ArgumentError, "Missing the required parameter 'alias_label' when calling DefaultApi.delete_alias"
632
+ end
633
+ # verify the required parameter 'alias_id' is set
634
+ if @api_client.config.client_side_validation && alias_id.nil?
635
+ fail ArgumentError, "Missing the required parameter 'alias_id' when calling DefaultApi.delete_alias"
636
+ end
637
+ # verify the required parameter 'alias_label_to_delete' is set
638
+ if @api_client.config.client_side_validation && alias_label_to_delete.nil?
639
+ fail ArgumentError, "Missing the required parameter 'alias_label_to_delete' when calling DefaultApi.delete_alias"
640
+ end
641
+ # resource path
642
+ local_var_path = '/apps/{app_id}/users/by/{alias_label}/{alias_id}/identity/{alias_label_to_delete}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'alias_label' + '}', CGI.escape(alias_label.to_s)).sub('{' + 'alias_id' + '}', CGI.escape(alias_id.to_s)).sub('{' + 'alias_label_to_delete' + '}', CGI.escape(alias_label_to_delete.to_s))
643
+
644
+ # query parameters
645
+ query_params = opts[:query_params] || {}
646
+
647
+ # header parameters
648
+ header_params = opts[:header_params] || {}
649
+ # HTTP header 'Accept' (if needed)
650
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
651
+
652
+ # form parameters
653
+ form_params = opts[:form_params] || {}
654
+
655
+ # http body (model)
656
+ post_body = opts[:debug_body]
657
+
658
+ # return_type
659
+ return_type = opts[:debug_return_type] || 'InlineResponse200'
660
+
661
+ # auth_names
662
+ auth_names = opts[:debug_auth_names] || ['app_key']
663
+
664
+ new_options = opts.merge(
665
+ :operation => :"DefaultApi.delete_alias",
666
+ :header_params => header_params,
667
+ :query_params => query_params,
668
+ :form_params => form_params,
669
+ :body => post_body,
670
+ :auth_names => auth_names,
671
+ :return_type => return_type
672
+ )
673
+
674
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
675
+ if @api_client.config.debugging
676
+ @api_client.config.logger.debug "API called: DefaultApi#delete_alias\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
677
+ end
678
+ return data, status_code, headers
679
+ end
680
+
681
+ # Delete a user record
682
+ # Delete player - Required: Used to delete a single, specific Player ID record from a specific OneSignal app.
683
+ # @param app_id [String] The OneSignal App ID for your app. Available in Keys &amp; IDs.
684
+ # @param player_id [String] The OneSignal player_id
685
+ # @param [Hash] opts the optional parameters
686
+ # @return [DeletePlayerSuccessResponse]
687
+ def delete_player(app_id, player_id, opts = {})
688
+ data, _status_code, _headers = delete_player_with_http_info(app_id, player_id, opts)
689
+ data
690
+ end
691
+
692
+ # Delete a user record
693
+ # Delete player - Required: Used to delete a single, specific Player ID record from a specific OneSignal app.
694
+ # @param app_id [String] The OneSignal App ID for your app. Available in Keys &amp; IDs.
695
+ # @param player_id [String] The OneSignal player_id
696
+ # @param [Hash] opts the optional parameters
697
+ # @return [Array<(DeletePlayerSuccessResponse, Integer, Hash)>] DeletePlayerSuccessResponse data, response status code and response headers
698
+ def delete_player_with_http_info(app_id, player_id, opts = {})
699
+ if @api_client.config.debugging
700
+ @api_client.config.logger.debug 'Calling API: DefaultApi.delete_player ...'
701
+ end
702
+ # verify the required parameter 'app_id' is set
703
+ if @api_client.config.client_side_validation && app_id.nil?
704
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.delete_player"
705
+ end
706
+ # verify the required parameter 'player_id' is set
707
+ if @api_client.config.client_side_validation && player_id.nil?
708
+ fail ArgumentError, "Missing the required parameter 'player_id' when calling DefaultApi.delete_player"
709
+ end
710
+ # resource path
711
+ local_var_path = '/players/{player_id}'.sub('{' + 'player_id' + '}', CGI.escape(player_id.to_s))
712
+
713
+ # query parameters
714
+ query_params = opts[:query_params] || {}
715
+ query_params[:'app_id'] = app_id
716
+
717
+ # header parameters
718
+ header_params = opts[:header_params] || {}
719
+ # HTTP header 'Accept' (if needed)
720
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
721
+
722
+ # form parameters
723
+ form_params = opts[:form_params] || {}
724
+
725
+ # http body (model)
726
+ post_body = opts[:debug_body]
727
+
728
+ # return_type
729
+ return_type = opts[:debug_return_type] || 'DeletePlayerSuccessResponse'
730
+
731
+ # auth_names
732
+ auth_names = opts[:debug_auth_names] || ['app_key']
733
+
734
+ new_options = opts.merge(
735
+ :operation => :"DefaultApi.delete_player",
736
+ :header_params => header_params,
737
+ :query_params => query_params,
738
+ :form_params => form_params,
739
+ :body => post_body,
740
+ :auth_names => auth_names,
741
+ :return_type => return_type
742
+ )
743
+
744
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
745
+ if @api_client.config.debugging
746
+ @api_client.config.logger.debug "API called: DefaultApi#delete_player\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
747
+ end
748
+ return data, status_code, headers
749
+ end
750
+
751
+ # Delete Segments
752
+ # 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.
753
+ # @param app_id [String] The OneSignal App ID for your app. Available in Keys &amp; IDs.
754
+ # @param segment_id [String] The segment_id can be found in the URL of the segment when viewing it in the dashboard.
755
+ # @param [Hash] opts the optional parameters
756
+ # @return [DeleteSegmentSuccessResponse]
757
+ def delete_segments(app_id, segment_id, opts = {})
758
+ data, _status_code, _headers = delete_segments_with_http_info(app_id, segment_id, opts)
759
+ data
760
+ end
761
+
762
+ # Delete Segments
763
+ # 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.
764
+ # @param app_id [String] The OneSignal App ID for your app. Available in Keys &amp; IDs.
765
+ # @param segment_id [String] The segment_id can be found in the URL of the segment when viewing it in the dashboard.
766
+ # @param [Hash] opts the optional parameters
767
+ # @return [Array<(DeleteSegmentSuccessResponse, Integer, Hash)>] DeleteSegmentSuccessResponse data, response status code and response headers
768
+ def delete_segments_with_http_info(app_id, segment_id, opts = {})
769
+ if @api_client.config.debugging
770
+ @api_client.config.logger.debug 'Calling API: DefaultApi.delete_segments ...'
771
+ end
772
+ # verify the required parameter 'app_id' is set
773
+ if @api_client.config.client_side_validation && app_id.nil?
774
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.delete_segments"
775
+ end
776
+ # verify the required parameter 'segment_id' is set
777
+ if @api_client.config.client_side_validation && segment_id.nil?
778
+ fail ArgumentError, "Missing the required parameter 'segment_id' when calling DefaultApi.delete_segments"
779
+ end
780
+ # resource path
781
+ 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))
782
+
783
+ # query parameters
784
+ query_params = opts[:query_params] || {}
785
+
786
+ # header parameters
787
+ header_params = opts[:header_params] || {}
788
+ # HTTP header 'Accept' (if needed)
789
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
790
+
791
+ # form parameters
792
+ form_params = opts[:form_params] || {}
793
+
794
+ # http body (model)
795
+ post_body = opts[:debug_body]
796
+
797
+ # return_type
798
+ return_type = opts[:debug_return_type] || 'DeleteSegmentSuccessResponse'
799
+
800
+ # auth_names
801
+ auth_names = opts[:debug_auth_names] || ['app_key']
802
+
803
+ new_options = opts.merge(
804
+ :operation => :"DefaultApi.delete_segments",
805
+ :header_params => header_params,
806
+ :query_params => query_params,
807
+ :form_params => form_params,
808
+ :body => post_body,
809
+ :auth_names => auth_names,
810
+ :return_type => return_type
811
+ )
812
+
813
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
814
+ if @api_client.config.debugging
815
+ @api_client.config.logger.debug "API called: DefaultApi#delete_segments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
816
+ end
817
+ return data, status_code, headers
818
+ end
819
+
820
+ # Deletes the Subscription.
821
+ # @param app_id [String]
822
+ # @param subscription_id [String]
823
+ # @param [Hash] opts the optional parameters
824
+ # @return [nil]
825
+ def delete_subscription(app_id, subscription_id, opts = {})
826
+ delete_subscription_with_http_info(app_id, subscription_id, opts)
827
+ nil
828
+ end
829
+
830
+ # Deletes the Subscription.
831
+ # @param app_id [String]
832
+ # @param subscription_id [String]
833
+ # @param [Hash] opts the optional parameters
834
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
835
+ def delete_subscription_with_http_info(app_id, subscription_id, opts = {})
836
+ if @api_client.config.debugging
837
+ @api_client.config.logger.debug 'Calling API: DefaultApi.delete_subscription ...'
838
+ end
839
+ # verify the required parameter 'app_id' is set
840
+ if @api_client.config.client_side_validation && app_id.nil?
841
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.delete_subscription"
842
+ end
843
+ # verify the required parameter 'subscription_id' is set
844
+ if @api_client.config.client_side_validation && subscription_id.nil?
845
+ fail ArgumentError, "Missing the required parameter 'subscription_id' when calling DefaultApi.delete_subscription"
846
+ end
847
+ # resource path
848
+ local_var_path = '/apps/{app_id}/subscriptions/{subscription_id}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'subscription_id' + '}', CGI.escape(subscription_id.to_s))
849
+
850
+ # query parameters
851
+ query_params = opts[:query_params] || {}
852
+
853
+ # header parameters
854
+ header_params = opts[:header_params] || {}
855
+ # HTTP header 'Accept' (if needed)
856
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
857
+
858
+ # form parameters
859
+ form_params = opts[:form_params] || {}
860
+
861
+ # http body (model)
862
+ post_body = opts[:debug_body]
863
+
864
+ # return_type
865
+ return_type = opts[:debug_return_type]
866
+
867
+ # auth_names
868
+ auth_names = opts[:debug_auth_names] || ['app_key']
869
+
870
+ new_options = opts.merge(
871
+ :operation => :"DefaultApi.delete_subscription",
872
+ :header_params => header_params,
873
+ :query_params => query_params,
874
+ :form_params => form_params,
875
+ :body => post_body,
876
+ :auth_names => auth_names,
877
+ :return_type => return_type
878
+ )
879
+
880
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
881
+ if @api_client.config.debugging
882
+ @api_client.config.logger.debug "API called: DefaultApi#delete_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
883
+ end
884
+ return data, status_code, headers
885
+ end
886
+
887
+ # Removes the User identified by (:alias_label, :alias_id), and all Subscriptions and Aliases
888
+ # @param app_id [String]
889
+ # @param alias_label [String]
890
+ # @param alias_id [String]
891
+ # @param [Hash] opts the optional parameters
892
+ # @return [nil]
893
+ def delete_user(app_id, alias_label, alias_id, opts = {})
894
+ delete_user_with_http_info(app_id, alias_label, alias_id, opts)
895
+ nil
896
+ end
897
+
898
+ # Removes the User identified by (:alias_label, :alias_id), and all Subscriptions and Aliases
899
+ # @param app_id [String]
900
+ # @param alias_label [String]
901
+ # @param alias_id [String]
902
+ # @param [Hash] opts the optional parameters
903
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
904
+ def delete_user_with_http_info(app_id, alias_label, alias_id, opts = {})
905
+ if @api_client.config.debugging
906
+ @api_client.config.logger.debug 'Calling API: DefaultApi.delete_user ...'
907
+ end
908
+ # verify the required parameter 'app_id' is set
909
+ if @api_client.config.client_side_validation && app_id.nil?
910
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.delete_user"
911
+ end
912
+ # verify the required parameter 'alias_label' is set
913
+ if @api_client.config.client_side_validation && alias_label.nil?
914
+ fail ArgumentError, "Missing the required parameter 'alias_label' when calling DefaultApi.delete_user"
915
+ end
916
+ # verify the required parameter 'alias_id' is set
917
+ if @api_client.config.client_side_validation && alias_id.nil?
918
+ fail ArgumentError, "Missing the required parameter 'alias_id' when calling DefaultApi.delete_user"
919
+ end
920
+ # resource path
921
+ local_var_path = '/apps/{app_id}/users/by/{alias_label}/{alias_id}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'alias_label' + '}', CGI.escape(alias_label.to_s)).sub('{' + 'alias_id' + '}', CGI.escape(alias_id.to_s))
922
+
923
+ # query parameters
924
+ query_params = opts[:query_params] || {}
925
+
926
+ # header parameters
927
+ header_params = opts[:header_params] || {}
928
+ # HTTP header 'Accept' (if needed)
929
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
930
+
931
+ # form parameters
932
+ form_params = opts[:form_params] || {}
933
+
934
+ # http body (model)
935
+ post_body = opts[:debug_body]
936
+
937
+ # return_type
938
+ return_type = opts[:debug_return_type]
939
+
940
+ # auth_names
941
+ auth_names = opts[:debug_auth_names] || []
942
+
943
+ new_options = opts.merge(
944
+ :operation => :"DefaultApi.delete_user",
945
+ :header_params => header_params,
946
+ :query_params => query_params,
947
+ :form_params => form_params,
948
+ :body => post_body,
949
+ :auth_names => auth_names,
950
+ :return_type => return_type
951
+ )
952
+
953
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
954
+ if @api_client.config.debugging
955
+ @api_client.config.logger.debug "API called: DefaultApi#delete_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
956
+ end
957
+ return data, status_code, headers
958
+ end
959
+
960
+ # Stop Live Activity
961
+ # Stops a Live Activity
962
+ # @param app_id [String] The OneSignal App ID for your app. Available in Keys &amp; IDs.
963
+ # @param activity_id [String] Live Activity record ID
964
+ # @param subscription_id [String] Subscription ID
965
+ # @param [Hash] opts the optional parameters
966
+ # @return [nil]
967
+ def end_live_activity(app_id, activity_id, subscription_id, opts = {})
968
+ end_live_activity_with_http_info(app_id, activity_id, subscription_id, opts)
969
+ nil
970
+ end
971
+
972
+ # Stop Live Activity
973
+ # Stops a Live Activity
974
+ # @param app_id [String] The OneSignal App ID for your app. Available in Keys &amp; IDs.
975
+ # @param activity_id [String] Live Activity record ID
976
+ # @param subscription_id [String] Subscription ID
977
+ # @param [Hash] opts the optional parameters
978
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
979
+ def end_live_activity_with_http_info(app_id, activity_id, subscription_id, opts = {})
980
+ if @api_client.config.debugging
981
+ @api_client.config.logger.debug 'Calling API: DefaultApi.end_live_activity ...'
982
+ end
983
+ # verify the required parameter 'app_id' is set
984
+ if @api_client.config.client_side_validation && app_id.nil?
985
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.end_live_activity"
986
+ end
987
+ # verify the required parameter 'activity_id' is set
988
+ if @api_client.config.client_side_validation && activity_id.nil?
989
+ fail ArgumentError, "Missing the required parameter 'activity_id' when calling DefaultApi.end_live_activity"
990
+ end
991
+ # verify the required parameter 'subscription_id' is set
992
+ if @api_client.config.client_side_validation && subscription_id.nil?
993
+ fail ArgumentError, "Missing the required parameter 'subscription_id' when calling DefaultApi.end_live_activity"
994
+ end
995
+ # resource path
996
+ local_var_path = '/apps/{app_id}/live_activities/{activity_id}/token/{subscription_id}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'activity_id' + '}', CGI.escape(activity_id.to_s)).sub('{' + 'subscription_id' + '}', CGI.escape(subscription_id.to_s))
997
+
998
+ # query parameters
999
+ query_params = opts[:query_params] || {}
1000
+
1001
+ # header parameters
1002
+ header_params = opts[:header_params] || {}
1003
+ # HTTP header 'Accept' (if needed)
1004
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1005
+
1006
+ # form parameters
1007
+ form_params = opts[:form_params] || {}
1008
+
1009
+ # http body (model)
1010
+ post_body = opts[:debug_body]
1011
+
1012
+ # return_type
1013
+ return_type = opts[:debug_return_type]
1014
+
1015
+ # auth_names
1016
+ auth_names = opts[:debug_auth_names] || ['app_key']
1017
+
1018
+ new_options = opts.merge(
1019
+ :operation => :"DefaultApi.end_live_activity",
1020
+ :header_params => header_params,
1021
+ :query_params => query_params,
1022
+ :form_params => form_params,
1023
+ :body => post_body,
1024
+ :auth_names => auth_names,
1025
+ :return_type => return_type
1026
+ )
1027
+
1028
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
1029
+ if @api_client.config.debugging
1030
+ @api_client.config.logger.debug "API called: DefaultApi#end_live_activity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1031
+ end
1032
+ return data, status_code, headers
1033
+ end
1034
+
1035
+ # Export CSV of Events
1036
+ # Generate a compressed CSV report of all of the events data for a notification. This will return a URL immediately upon success but it may take several minutes for the CSV to become available at that URL depending on the volume of data. Only one export can be in-progress per OneSignal account at any given time.
1037
+ # @param notification_id [String] The ID of the notification to export events from.
1038
+ # @param app_id [String] The ID of the app that the notification belongs to.
1039
+ # @param [Hash] opts the optional parameters
1040
+ # @return [ExportEventsSuccessResponse]
1041
+ def export_events(notification_id, app_id, opts = {})
1042
+ data, _status_code, _headers = export_events_with_http_info(notification_id, app_id, opts)
1043
+ data
1044
+ end
1045
+
1046
+ # Export CSV of Events
1047
+ # Generate a compressed CSV report of all of the events data for a notification. This will return a URL immediately upon success but it may take several minutes for the CSV to become available at that URL depending on the volume of data. Only one export can be in-progress per OneSignal account at any given time.
1048
+ # @param notification_id [String] The ID of the notification to export events from.
1049
+ # @param app_id [String] The ID of the app that the notification belongs to.
1050
+ # @param [Hash] opts the optional parameters
1051
+ # @return [Array<(ExportEventsSuccessResponse, Integer, Hash)>] ExportEventsSuccessResponse data, response status code and response headers
1052
+ def export_events_with_http_info(notification_id, app_id, opts = {})
1053
+ if @api_client.config.debugging
1054
+ @api_client.config.logger.debug 'Calling API: DefaultApi.export_events ...'
1055
+ end
1056
+ # verify the required parameter 'notification_id' is set
1057
+ if @api_client.config.client_side_validation && notification_id.nil?
1058
+ fail ArgumentError, "Missing the required parameter 'notification_id' when calling DefaultApi.export_events"
1059
+ end
1060
+ # verify the required parameter 'app_id' is set
1061
+ if @api_client.config.client_side_validation && app_id.nil?
1062
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.export_events"
1063
+ end
1064
+ # resource path
1065
+ local_var_path = '/notifications/{notification_id}/export_events?app_id={app_id}'.sub('{' + 'notification_id' + '}', CGI.escape(notification_id.to_s))
1066
+
1067
+ # query parameters
1068
+ query_params = opts[:query_params] || {}
1069
+ query_params[:'app_id'] = app_id
1070
+
1071
+ # header parameters
1072
+ header_params = opts[:header_params] || {}
1073
+ # HTTP header 'Accept' (if needed)
1074
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1075
+
1076
+ # form parameters
1077
+ form_params = opts[:form_params] || {}
1078
+
1079
+ # http body (model)
1080
+ post_body = opts[:debug_body]
1081
+
1082
+ # return_type
1083
+ return_type = opts[:debug_return_type] || 'ExportEventsSuccessResponse'
1084
+
1085
+ # auth_names
1086
+ auth_names = opts[:debug_auth_names] || ['app_key']
1087
+
1088
+ new_options = opts.merge(
1089
+ :operation => :"DefaultApi.export_events",
1090
+ :header_params => header_params,
1091
+ :query_params => query_params,
1092
+ :form_params => form_params,
1093
+ :body => post_body,
1094
+ :auth_names => auth_names,
1095
+ :return_type => return_type
1096
+ )
1097
+
1098
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
1099
+ if @api_client.config.debugging
1100
+ @api_client.config.logger.debug "API called: DefaultApi#export_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1101
+ end
1102
+ return data, status_code, headers
1103
+ end
1104
+
1105
+ # Export CSV of Players
1106
+ # 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. |
1107
+ # @param app_id [String] The app ID that you want to export devices from
1108
+ # @param [Hash] opts the optional parameters
1109
+ # @option opts [ExportPlayersRequestBody] :export_players_request_body
1110
+ # @return [ExportPlayersSuccessResponse]
1111
+ def export_players(app_id, opts = {})
1112
+ data, _status_code, _headers = export_players_with_http_info(app_id, opts)
1113
+ data
1114
+ end
1115
+
1116
+ # Export CSV of Players
1117
+ # 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. |
1118
+ # @param app_id [String] The app ID that you want to export devices from
1119
+ # @param [Hash] opts the optional parameters
1120
+ # @option opts [ExportPlayersRequestBody] :export_players_request_body
1121
+ # @return [Array<(ExportPlayersSuccessResponse, Integer, Hash)>] ExportPlayersSuccessResponse data, response status code and response headers
1122
+ def export_players_with_http_info(app_id, opts = {})
1123
+ if @api_client.config.debugging
1124
+ @api_client.config.logger.debug 'Calling API: DefaultApi.export_players ...'
1125
+ end
1126
+ # verify the required parameter 'app_id' is set
1127
+ if @api_client.config.client_side_validation && app_id.nil?
1128
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.export_players"
1129
+ end
1130
+ # resource path
1131
+ local_var_path = '/players/csv_export?app_id={app_id}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s))
1132
+
1133
+ # query parameters
1134
+ query_params = opts[:query_params] || {}
1135
+
1136
+ # header parameters
1137
+ header_params = opts[:header_params] || {}
1138
+ # HTTP header 'Accept' (if needed)
1139
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1140
+ # HTTP header 'Content-Type'
1141
+ content_type = @api_client.select_header_content_type(['application/json'])
1142
+ if !content_type.nil?
1143
+ header_params['Content-Type'] = content_type
1144
+ end
1145
+
1146
+ # form parameters
1147
+ form_params = opts[:form_params] || {}
1148
+
1149
+ # http body (model)
1150
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'export_players_request_body'])
1151
+
1152
+ # return_type
1153
+ return_type = opts[:debug_return_type] || 'ExportPlayersSuccessResponse'
1154
+
1155
+ # auth_names
1156
+ auth_names = opts[:debug_auth_names] || ['app_key']
1157
+
1158
+ new_options = opts.merge(
1159
+ :operation => :"DefaultApi.export_players",
1160
+ :header_params => header_params,
1161
+ :query_params => query_params,
1162
+ :form_params => form_params,
1163
+ :body => post_body,
1164
+ :auth_names => auth_names,
1165
+ :return_type => return_type
1166
+ )
1167
+
1168
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
1169
+ if @api_client.config.debugging
1170
+ @api_client.config.logger.debug "API called: DefaultApi#export_players\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1171
+ end
1172
+ return data, status_code, headers
1173
+ end
1174
+
1175
+ # Lists all Aliases for the User identified by :subscription_id.
1176
+ # @param app_id [String]
1177
+ # @param subscription_id [String]
1178
+ # @param [Hash] opts the optional parameters
1179
+ # @return [UserIdentityResponse]
1180
+ def fetch_aliases(app_id, subscription_id, opts = {})
1181
+ data, _status_code, _headers = fetch_aliases_with_http_info(app_id, subscription_id, opts)
1182
+ data
1183
+ end
1184
+
1185
+ # Lists all Aliases for the User identified by :subscription_id.
1186
+ # @param app_id [String]
1187
+ # @param subscription_id [String]
1188
+ # @param [Hash] opts the optional parameters
1189
+ # @return [Array<(UserIdentityResponse, Integer, Hash)>] UserIdentityResponse data, response status code and response headers
1190
+ def fetch_aliases_with_http_info(app_id, subscription_id, opts = {})
1191
+ if @api_client.config.debugging
1192
+ @api_client.config.logger.debug 'Calling API: DefaultApi.fetch_aliases ...'
1193
+ end
1194
+ # verify the required parameter 'app_id' is set
1195
+ if @api_client.config.client_side_validation && app_id.nil?
1196
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.fetch_aliases"
1197
+ end
1198
+ # verify the required parameter 'subscription_id' is set
1199
+ if @api_client.config.client_side_validation && subscription_id.nil?
1200
+ fail ArgumentError, "Missing the required parameter 'subscription_id' when calling DefaultApi.fetch_aliases"
1201
+ end
1202
+ # resource path
1203
+ local_var_path = '/apps/{app_id}/subscriptions/{subscription_id}/user/identity'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'subscription_id' + '}', CGI.escape(subscription_id.to_s))
1204
+
1205
+ # query parameters
1206
+ query_params = opts[:query_params] || {}
1207
+
1208
+ # header parameters
1209
+ header_params = opts[:header_params] || {}
1210
+ # HTTP header 'Accept' (if needed)
1211
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1212
+
1213
+ # form parameters
1214
+ form_params = opts[:form_params] || {}
1215
+
1216
+ # http body (model)
1217
+ post_body = opts[:debug_body]
1218
+
1219
+ # return_type
1220
+ return_type = opts[:debug_return_type] || 'UserIdentityResponse'
1221
+
1222
+ # auth_names
1223
+ auth_names = opts[:debug_auth_names] || ['app_key']
1224
+
1225
+ new_options = opts.merge(
1226
+ :operation => :"DefaultApi.fetch_aliases",
1227
+ :header_params => header_params,
1228
+ :query_params => query_params,
1229
+ :form_params => form_params,
1230
+ :body => post_body,
1231
+ :auth_names => auth_names,
1232
+ :return_type => return_type
1233
+ )
1234
+
1235
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1236
+ if @api_client.config.debugging
1237
+ @api_client.config.logger.debug "API called: DefaultApi#fetch_aliases\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1238
+ end
1239
+ return data, status_code, headers
1240
+ end
1241
+
1242
+ # Returns the User’s properties, Aliases, and Subscriptions.
1243
+ # @param app_id [String]
1244
+ # @param alias_label [String]
1245
+ # @param alias_id [String]
1246
+ # @param [Hash] opts the optional parameters
1247
+ # @return [User]
1248
+ def fetch_user(app_id, alias_label, alias_id, opts = {})
1249
+ data, _status_code, _headers = fetch_user_with_http_info(app_id, alias_label, alias_id, opts)
1250
+ data
1251
+ end
1252
+
1253
+ # Returns the User’s properties, Aliases, and Subscriptions.
1254
+ # @param app_id [String]
1255
+ # @param alias_label [String]
1256
+ # @param alias_id [String]
1257
+ # @param [Hash] opts the optional parameters
1258
+ # @return [Array<(User, Integer, Hash)>] User data, response status code and response headers
1259
+ def fetch_user_with_http_info(app_id, alias_label, alias_id, opts = {})
1260
+ if @api_client.config.debugging
1261
+ @api_client.config.logger.debug 'Calling API: DefaultApi.fetch_user ...'
1262
+ end
1263
+ # verify the required parameter 'app_id' is set
1264
+ if @api_client.config.client_side_validation && app_id.nil?
1265
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.fetch_user"
1266
+ end
1267
+ # verify the required parameter 'alias_label' is set
1268
+ if @api_client.config.client_side_validation && alias_label.nil?
1269
+ fail ArgumentError, "Missing the required parameter 'alias_label' when calling DefaultApi.fetch_user"
1270
+ end
1271
+ # verify the required parameter 'alias_id' is set
1272
+ if @api_client.config.client_side_validation && alias_id.nil?
1273
+ fail ArgumentError, "Missing the required parameter 'alias_id' when calling DefaultApi.fetch_user"
1274
+ end
1275
+ # resource path
1276
+ local_var_path = '/apps/{app_id}/users/by/{alias_label}/{alias_id}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'alias_label' + '}', CGI.escape(alias_label.to_s)).sub('{' + 'alias_id' + '}', CGI.escape(alias_id.to_s))
1277
+
1278
+ # query parameters
1279
+ query_params = opts[:query_params] || {}
1280
+
1281
+ # header parameters
1282
+ header_params = opts[:header_params] || {}
1283
+ # HTTP header 'Accept' (if needed)
1284
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1285
+
1286
+ # form parameters
1287
+ form_params = opts[:form_params] || {}
1288
+
1289
+ # http body (model)
1290
+ post_body = opts[:debug_body]
1291
+
1292
+ # return_type
1293
+ return_type = opts[:debug_return_type] || 'User'
1294
+
1295
+ # auth_names
1296
+ auth_names = opts[:debug_auth_names] || ['app_key']
1297
+
1298
+ new_options = opts.merge(
1299
+ :operation => :"DefaultApi.fetch_user",
1300
+ :header_params => header_params,
1301
+ :query_params => query_params,
1302
+ :form_params => form_params,
1303
+ :body => post_body,
1304
+ :auth_names => auth_names,
1305
+ :return_type => return_type
1306
+ )
1307
+
1308
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1309
+ if @api_client.config.debugging
1310
+ @api_client.config.logger.debug "API called: DefaultApi#fetch_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1311
+ end
1312
+ return data, status_code, headers
1313
+ end
1314
+
1315
+ # Lists all Aliases for the User identified by (:alias_label, :alias_id).
1316
+ # @param app_id [String]
1317
+ # @param alias_label [String]
1318
+ # @param alias_id [String]
1319
+ # @param [Hash] opts the optional parameters
1320
+ # @return [InlineResponse200]
1321
+ def fetch_user_identity(app_id, alias_label, alias_id, opts = {})
1322
+ data, _status_code, _headers = fetch_user_identity_with_http_info(app_id, alias_label, alias_id, opts)
1323
+ data
1324
+ end
1325
+
1326
+ # Lists all Aliases for the User identified by (:alias_label, :alias_id).
1327
+ # @param app_id [String]
1328
+ # @param alias_label [String]
1329
+ # @param alias_id [String]
1330
+ # @param [Hash] opts the optional parameters
1331
+ # @return [Array<(InlineResponse200, Integer, Hash)>] InlineResponse200 data, response status code and response headers
1332
+ def fetch_user_identity_with_http_info(app_id, alias_label, alias_id, opts = {})
1333
+ if @api_client.config.debugging
1334
+ @api_client.config.logger.debug 'Calling API: DefaultApi.fetch_user_identity ...'
1335
+ end
1336
+ # verify the required parameter 'app_id' is set
1337
+ if @api_client.config.client_side_validation && app_id.nil?
1338
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.fetch_user_identity"
1339
+ end
1340
+ # verify the required parameter 'alias_label' is set
1341
+ if @api_client.config.client_side_validation && alias_label.nil?
1342
+ fail ArgumentError, "Missing the required parameter 'alias_label' when calling DefaultApi.fetch_user_identity"
1343
+ end
1344
+ # verify the required parameter 'alias_id' is set
1345
+ if @api_client.config.client_side_validation && alias_id.nil?
1346
+ fail ArgumentError, "Missing the required parameter 'alias_id' when calling DefaultApi.fetch_user_identity"
1347
+ end
1348
+ # resource path
1349
+ local_var_path = '/apps/{app_id}/users/by/{alias_label}/{alias_id}/identity'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'alias_label' + '}', CGI.escape(alias_label.to_s)).sub('{' + 'alias_id' + '}', CGI.escape(alias_id.to_s))
1350
+
1351
+ # query parameters
1352
+ query_params = opts[:query_params] || {}
1353
+
1354
+ # header parameters
1355
+ header_params = opts[:header_params] || {}
1356
+ # HTTP header 'Accept' (if needed)
1357
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1358
+
1359
+ # form parameters
1360
+ form_params = opts[:form_params] || {}
1361
+
1362
+ # http body (model)
1363
+ post_body = opts[:debug_body]
1364
+
1365
+ # return_type
1366
+ return_type = opts[:debug_return_type] || 'InlineResponse200'
1367
+
1368
+ # auth_names
1369
+ auth_names = opts[:debug_auth_names] || ['app_key']
1370
+
1371
+ new_options = opts.merge(
1372
+ :operation => :"DefaultApi.fetch_user_identity",
1373
+ :header_params => header_params,
1374
+ :query_params => query_params,
1375
+ :form_params => form_params,
1376
+ :body => post_body,
1377
+ :auth_names => auth_names,
1378
+ :return_type => return_type
1379
+ )
1380
+
1381
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1382
+ if @api_client.config.debugging
1383
+ @api_client.config.logger.debug "API called: DefaultApi#fetch_user_identity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1384
+ end
1385
+ return data, status_code, headers
1386
+ end
1387
+
1388
+ # View an app
1389
+ # View the details of a single OneSignal app
1390
+ # @param app_id [String] An app id
1391
+ # @param [Hash] opts the optional parameters
1392
+ # @return [App]
1393
+ def get_app(app_id, opts = {})
1394
+ data, _status_code, _headers = get_app_with_http_info(app_id, opts)
1395
+ data
1396
+ end
1397
+
1398
+ # View an app
1399
+ # View the details of a single OneSignal app
1400
+ # @param app_id [String] An app id
1401
+ # @param [Hash] opts the optional parameters
1402
+ # @return [Array<(App, Integer, Hash)>] App data, response status code and response headers
1403
+ def get_app_with_http_info(app_id, opts = {})
1404
+ if @api_client.config.debugging
1405
+ @api_client.config.logger.debug 'Calling API: DefaultApi.get_app ...'
1406
+ end
1407
+ # verify the required parameter 'app_id' is set
1408
+ if @api_client.config.client_side_validation && app_id.nil?
1409
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.get_app"
1410
+ end
1411
+ # resource path
1412
+ local_var_path = '/apps/{app_id}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s))
1413
+
1414
+ # query parameters
1415
+ query_params = opts[:query_params] || {}
1416
+
1417
+ # header parameters
1418
+ header_params = opts[:header_params] || {}
1419
+ # HTTP header 'Accept' (if needed)
1420
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1421
+
1422
+ # form parameters
1423
+ form_params = opts[:form_params] || {}
1424
+
1425
+ # http body (model)
1426
+ post_body = opts[:debug_body]
1427
+
1428
+ # return_type
1429
+ return_type = opts[:debug_return_type] || 'App'
1430
+
1431
+ # auth_names
1432
+ auth_names = opts[:debug_auth_names] || ['user_key']
1433
+
1434
+ new_options = opts.merge(
1435
+ :operation => :"DefaultApi.get_app",
1436
+ :header_params => header_params,
1437
+ :query_params => query_params,
1438
+ :form_params => form_params,
1439
+ :body => post_body,
1440
+ :auth_names => auth_names,
1441
+ :return_type => return_type
1442
+ )
1443
+
1444
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1445
+ if @api_client.config.debugging
1446
+ @api_client.config.logger.debug "API called: DefaultApi#get_app\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1447
+ end
1448
+ return data, status_code, headers
1449
+ end
1450
+
1451
+ # View apps
1452
+ # View the details of all of your current OneSignal apps
1453
+ # @param [Hash] opts the optional parameters
1454
+ # @return [Array<App>]
1455
+ def get_apps(opts = {})
1456
+ data, _status_code, _headers = get_apps_with_http_info(opts)
1457
+ data
1458
+ end
1459
+
1460
+ # View apps
1461
+ # View the details of all of your current OneSignal apps
1462
+ # @param [Hash] opts the optional parameters
1463
+ # @return [Array<(Array<App>, Integer, Hash)>] Array<App> data, response status code and response headers
1464
+ def get_apps_with_http_info(opts = {})
1465
+ if @api_client.config.debugging
1466
+ @api_client.config.logger.debug 'Calling API: DefaultApi.get_apps ...'
1467
+ end
1468
+ # resource path
1469
+ local_var_path = '/apps'
1470
+
1471
+ # query parameters
1472
+ query_params = opts[:query_params] || {}
1473
+
1474
+ # header parameters
1475
+ header_params = opts[:header_params] || {}
1476
+ # HTTP header 'Accept' (if needed)
1477
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1478
+
1479
+ # form parameters
1480
+ form_params = opts[:form_params] || {}
1481
+
1482
+ # http body (model)
1483
+ post_body = opts[:debug_body]
1484
+
1485
+ # return_type
1486
+ return_type = opts[:debug_return_type] || 'Array<App>'
1487
+
1488
+ # auth_names
1489
+ auth_names = opts[:debug_auth_names] || ['user_key']
1490
+
1491
+ new_options = opts.merge(
1492
+ :operation => :"DefaultApi.get_apps",
1493
+ :header_params => header_params,
1494
+ :query_params => query_params,
1495
+ :form_params => form_params,
1496
+ :body => post_body,
1497
+ :auth_names => auth_names,
1498
+ :return_type => return_type
1499
+ )
1500
+
1501
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1502
+ if @api_client.config.debugging
1503
+ @api_client.config.logger.debug "API called: DefaultApi#get_apps\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1504
+ end
1505
+ return data, status_code, headers
1506
+ end
1507
+
1508
+ # Manifest of In-App Messages the Subscription is eligible to display by the SDK.
1509
+ # @param app_id [String]
1510
+ # @param subscription_id [String]
1511
+ # @param [Hash] opts the optional parameters
1512
+ # @return [InlineResponse2003]
1513
+ def get_eligible_iams(app_id, subscription_id, opts = {})
1514
+ data, _status_code, _headers = get_eligible_iams_with_http_info(app_id, subscription_id, opts)
1515
+ data
1516
+ end
1517
+
1518
+ # Manifest of In-App Messages the Subscription is eligible to display by the SDK.
1519
+ # @param app_id [String]
1520
+ # @param subscription_id [String]
1521
+ # @param [Hash] opts the optional parameters
1522
+ # @return [Array<(InlineResponse2003, Integer, Hash)>] InlineResponse2003 data, response status code and response headers
1523
+ def get_eligible_iams_with_http_info(app_id, subscription_id, opts = {})
1524
+ if @api_client.config.debugging
1525
+ @api_client.config.logger.debug 'Calling API: DefaultApi.get_eligible_iams ...'
1526
+ end
1527
+ # verify the required parameter 'app_id' is set
1528
+ if @api_client.config.client_side_validation && app_id.nil?
1529
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.get_eligible_iams"
1530
+ end
1531
+ # verify the required parameter 'subscription_id' is set
1532
+ if @api_client.config.client_side_validation && subscription_id.nil?
1533
+ fail ArgumentError, "Missing the required parameter 'subscription_id' when calling DefaultApi.get_eligible_iams"
1534
+ end
1535
+ # resource path
1536
+ local_var_path = '/apps/{app_id}/subscriptions/{subscription_id}/iams'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'subscription_id' + '}', CGI.escape(subscription_id.to_s))
1537
+
1538
+ # query parameters
1539
+ query_params = opts[:query_params] || {}
1540
+
1541
+ # header parameters
1542
+ header_params = opts[:header_params] || {}
1543
+ # HTTP header 'Accept' (if needed)
1544
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1545
+
1546
+ # form parameters
1547
+ form_params = opts[:form_params] || {}
1548
+
1549
+ # http body (model)
1550
+ post_body = opts[:debug_body]
1551
+
1552
+ # return_type
1553
+ return_type = opts[:debug_return_type] || 'InlineResponse2003'
1554
+
1555
+ # auth_names
1556
+ auth_names = opts[:debug_auth_names] || ['app_key']
1557
+
1558
+ new_options = opts.merge(
1559
+ :operation => :"DefaultApi.get_eligible_iams",
1560
+ :header_params => header_params,
1561
+ :query_params => query_params,
1562
+ :form_params => form_params,
1563
+ :body => post_body,
1564
+ :auth_names => auth_names,
1565
+ :return_type => return_type
1566
+ )
1567
+
1568
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1569
+ if @api_client.config.debugging
1570
+ @api_client.config.logger.debug "API called: DefaultApi#get_eligible_iams\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1571
+ end
1572
+ return data, status_code, headers
1573
+ end
1574
+
1575
+ # View notification
1576
+ # View the details of a single notification and outcomes associated with it
1577
+ # @param app_id [String]
1578
+ # @param notification_id [String]
1579
+ # @param [Hash] opts the optional parameters
1580
+ # @return [NotificationWithMeta]
1581
+ def get_notification(app_id, notification_id, opts = {})
1582
+ data, _status_code, _headers = get_notification_with_http_info(app_id, notification_id, opts)
1583
+ data
1584
+ end
1585
+
1586
+ # View notification
1587
+ # View the details of a single notification and outcomes associated with it
1588
+ # @param app_id [String]
1589
+ # @param notification_id [String]
1590
+ # @param [Hash] opts the optional parameters
1591
+ # @return [Array<(NotificationWithMeta, Integer, Hash)>] NotificationWithMeta data, response status code and response headers
1592
+ def get_notification_with_http_info(app_id, notification_id, opts = {})
1593
+ if @api_client.config.debugging
1594
+ @api_client.config.logger.debug 'Calling API: DefaultApi.get_notification ...'
1595
+ end
1596
+ # verify the required parameter 'app_id' is set
1597
+ if @api_client.config.client_side_validation && app_id.nil?
1598
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.get_notification"
1599
+ end
1600
+ # verify the required parameter 'notification_id' is set
1601
+ if @api_client.config.client_side_validation && notification_id.nil?
1602
+ fail ArgumentError, "Missing the required parameter 'notification_id' when calling DefaultApi.get_notification"
1603
+ end
1604
+ # resource path
1605
+ local_var_path = '/notifications/{notification_id}'.sub('{' + 'notification_id' + '}', CGI.escape(notification_id.to_s))
1606
+
1607
+ # query parameters
1608
+ query_params = opts[:query_params] || {}
1609
+ query_params[:'app_id'] = app_id
1610
+
1611
+ # header parameters
1612
+ header_params = opts[:header_params] || {}
1613
+ # HTTP header 'Accept' (if needed)
1614
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1615
+
1616
+ # form parameters
1617
+ form_params = opts[:form_params] || {}
1618
+
1619
+ # http body (model)
1620
+ post_body = opts[:debug_body]
1621
+
1622
+ # return_type
1623
+ return_type = opts[:debug_return_type] || 'NotificationWithMeta'
1624
+
1625
+ # auth_names
1626
+ auth_names = opts[:debug_auth_names] || ['app_key']
1627
+
1628
+ new_options = opts.merge(
1629
+ :operation => :"DefaultApi.get_notification",
1630
+ :header_params => header_params,
1631
+ :query_params => query_params,
1632
+ :form_params => form_params,
1633
+ :body => post_body,
1634
+ :auth_names => auth_names,
1635
+ :return_type => return_type
1636
+ )
1637
+
1638
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1639
+ if @api_client.config.debugging
1640
+ @api_client.config.logger.debug "API called: DefaultApi#get_notification\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1641
+ end
1642
+ return data, status_code, headers
1643
+ end
1644
+
1645
+ # Notification History
1646
+ # -> 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.
1647
+ # @param notification_id [String] The \&quot;id\&quot; of the message found in the Notification object
1648
+ # @param get_notification_request_body [GetNotificationRequestBody]
1649
+ # @param [Hash] opts the optional parameters
1650
+ # @return [NotificationHistorySuccessResponse]
1651
+ def get_notification_history(notification_id, get_notification_request_body, opts = {})
1652
+ data, _status_code, _headers = get_notification_history_with_http_info(notification_id, get_notification_request_body, opts)
1653
+ data
1654
+ end
1655
+
1656
+ # Notification History
1657
+ # -&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.
1658
+ # @param notification_id [String] The \&quot;id\&quot; of the message found in the Notification object
1659
+ # @param get_notification_request_body [GetNotificationRequestBody]
1660
+ # @param [Hash] opts the optional parameters
1661
+ # @return [Array<(NotificationHistorySuccessResponse, Integer, Hash)>] NotificationHistorySuccessResponse data, response status code and response headers
1662
+ def get_notification_history_with_http_info(notification_id, get_notification_request_body, opts = {})
1663
+ if @api_client.config.debugging
1664
+ @api_client.config.logger.debug 'Calling API: DefaultApi.get_notification_history ...'
1665
+ end
1666
+ # verify the required parameter 'notification_id' is set
1667
+ if @api_client.config.client_side_validation && notification_id.nil?
1668
+ fail ArgumentError, "Missing the required parameter 'notification_id' when calling DefaultApi.get_notification_history"
1669
+ end
1670
+ # verify the required parameter 'get_notification_request_body' is set
1671
+ if @api_client.config.client_side_validation && get_notification_request_body.nil?
1672
+ fail ArgumentError, "Missing the required parameter 'get_notification_request_body' when calling DefaultApi.get_notification_history"
1673
+ end
1674
+ # resource path
1675
+ local_var_path = '/notifications/{notification_id}/history'.sub('{' + 'notification_id' + '}', CGI.escape(notification_id.to_s))
1676
+
1677
+ # query parameters
1678
+ query_params = opts[:query_params] || {}
1679
+
1680
+ # header parameters
1681
+ header_params = opts[:header_params] || {}
1682
+ # HTTP header 'Accept' (if needed)
1683
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1684
+ # HTTP header 'Content-Type'
1685
+ content_type = @api_client.select_header_content_type(['application/json'])
1686
+ if !content_type.nil?
1687
+ header_params['Content-Type'] = content_type
1688
+ end
1689
+
1690
+ # form parameters
1691
+ form_params = opts[:form_params] || {}
1692
+
1693
+ # http body (model)
1694
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(get_notification_request_body)
1695
+
1696
+ # return_type
1697
+ return_type = opts[:debug_return_type] || 'NotificationHistorySuccessResponse'
1698
+
1699
+ # auth_names
1700
+ auth_names = opts[:debug_auth_names] || ['app_key']
1701
+
1702
+ new_options = opts.merge(
1703
+ :operation => :"DefaultApi.get_notification_history",
1704
+ :header_params => header_params,
1705
+ :query_params => query_params,
1706
+ :form_params => form_params,
1707
+ :body => post_body,
1708
+ :auth_names => auth_names,
1709
+ :return_type => return_type
1710
+ )
1711
+
1712
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
1713
+ if @api_client.config.debugging
1714
+ @api_client.config.logger.debug "API called: DefaultApi#get_notification_history\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1715
+ end
1716
+ return data, status_code, headers
1717
+ end
1718
+
1719
+ # View notifications
1720
+ # View the details of multiple notifications
1721
+ # @param app_id [String] The app ID that you want to view notifications from
1722
+ # @param [Hash] opts the optional parameters
1723
+ # @option opts [Integer] :limit How many notifications to return. Max is 50. Default is 50.
1724
+ # @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.
1725
+ # @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
1726
+ # @return [NotificationSlice]
1727
+ def get_notifications(app_id, opts = {})
1728
+ data, _status_code, _headers = get_notifications_with_http_info(app_id, opts)
1729
+ data
1730
+ end
1731
+
1732
+ # View notifications
1733
+ # View the details of multiple notifications
1734
+ # @param app_id [String] The app ID that you want to view notifications from
1735
+ # @param [Hash] opts the optional parameters
1736
+ # @option opts [Integer] :limit How many notifications to return. Max is 50. Default is 50.
1737
+ # @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.
1738
+ # @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
1739
+ # @return [Array<(NotificationSlice, Integer, Hash)>] NotificationSlice data, response status code and response headers
1740
+ def get_notifications_with_http_info(app_id, opts = {})
1741
+ if @api_client.config.debugging
1742
+ @api_client.config.logger.debug 'Calling API: DefaultApi.get_notifications ...'
1743
+ end
1744
+ # verify the required parameter 'app_id' is set
1745
+ if @api_client.config.client_side_validation && app_id.nil?
1746
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.get_notifications"
1747
+ end
1748
+ allowable_values = [0, 1, 3]
1749
+ if @api_client.config.client_side_validation && opts[:'kind'] && !allowable_values.include?(opts[:'kind'])
1750
+ fail ArgumentError, "invalid value for \"kind\", must be one of #{allowable_values}"
1751
+ end
1752
+ # resource path
1753
+ local_var_path = '/notifications'
1754
+
1755
+ # query parameters
1756
+ query_params = opts[:query_params] || {}
1757
+ query_params[:'app_id'] = app_id
1758
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
1759
+ query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
1760
+ query_params[:'kind'] = opts[:'kind'] if !opts[:'kind'].nil?
1761
+
1762
+ # header parameters
1763
+ header_params = opts[:header_params] || {}
1764
+ # HTTP header 'Accept' (if needed)
1765
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1766
+
1767
+ # form parameters
1768
+ form_params = opts[:form_params] || {}
1769
+
1770
+ # http body (model)
1771
+ post_body = opts[:debug_body]
1772
+
1773
+ # return_type
1774
+ return_type = opts[:debug_return_type] || 'NotificationSlice'
1775
+
1776
+ # auth_names
1777
+ auth_names = opts[:debug_auth_names] || ['app_key']
1778
+
1779
+ new_options = opts.merge(
1780
+ :operation => :"DefaultApi.get_notifications",
1781
+ :header_params => header_params,
1782
+ :query_params => query_params,
1783
+ :form_params => form_params,
1784
+ :body => post_body,
1785
+ :auth_names => auth_names,
1786
+ :return_type => return_type
1787
+ )
1788
+
1789
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1790
+ if @api_client.config.debugging
1791
+ @api_client.config.logger.debug "API called: DefaultApi#get_notifications\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1792
+ end
1793
+ return data, status_code, headers
1794
+ end
1795
+
1796
+ # View Outcomes
1797
+ # 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.
1798
+ # @param app_id [String] The OneSignal App ID for your app. Available in Keys &amp; IDs.
1799
+ # @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
1800
+ # @param [Hash] opts the optional parameters
1801
+ # @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.
1802
+ # @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.
1803
+ # @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.
1804
+ # @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.
1805
+ # @return [OutcomesData]
1806
+ def get_outcomes(app_id, outcome_names, opts = {})
1807
+ data, _status_code, _headers = get_outcomes_with_http_info(app_id, outcome_names, opts)
1808
+ data
1809
+ end
1810
+
1811
+ # View Outcomes
1812
+ # 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.
1813
+ # @param app_id [String] The OneSignal App ID for your app. Available in Keys &amp; IDs.
1814
+ # @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
1815
+ # @param [Hash] opts the optional parameters
1816
+ # @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.
1817
+ # @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.
1818
+ # @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.
1819
+ # @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.
1820
+ # @return [Array<(OutcomesData, Integer, Hash)>] OutcomesData data, response status code and response headers
1821
+ def get_outcomes_with_http_info(app_id, outcome_names, opts = {})
1822
+ if @api_client.config.debugging
1823
+ @api_client.config.logger.debug 'Calling API: DefaultApi.get_outcomes ...'
1824
+ end
1825
+ # verify the required parameter 'app_id' is set
1826
+ if @api_client.config.client_side_validation && app_id.nil?
1827
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.get_outcomes"
1828
+ end
1829
+ # verify the required parameter 'outcome_names' is set
1830
+ if @api_client.config.client_side_validation && outcome_names.nil?
1831
+ fail ArgumentError, "Missing the required parameter 'outcome_names' when calling DefaultApi.get_outcomes"
1832
+ end
1833
+ # resource path
1834
+ local_var_path = '/apps/{app_id}/outcomes'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s))
1835
+
1836
+ # query parameters
1837
+ query_params = opts[:query_params] || {}
1838
+ query_params[:'outcome_names'] = outcome_names
1839
+ query_params[:'outcome_names[]'] = opts[:'outcome_names2'] if !opts[:'outcome_names2'].nil?
1840
+ query_params[:'outcome_time_range'] = opts[:'outcome_time_range'] if !opts[:'outcome_time_range'].nil?
1841
+ query_params[:'outcome_platforms'] = opts[:'outcome_platforms'] if !opts[:'outcome_platforms'].nil?
1842
+ query_params[:'outcome_attribution'] = opts[:'outcome_attribution'] if !opts[:'outcome_attribution'].nil?
1843
+
1844
+ # header parameters
1845
+ header_params = opts[:header_params] || {}
1846
+ # HTTP header 'Accept' (if needed)
1847
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1848
+
1849
+ # form parameters
1850
+ form_params = opts[:form_params] || {}
1851
+
1852
+ # http body (model)
1853
+ post_body = opts[:debug_body]
1854
+
1855
+ # return_type
1856
+ return_type = opts[:debug_return_type] || 'OutcomesData'
1857
+
1858
+ # auth_names
1859
+ auth_names = opts[:debug_auth_names] || ['app_key']
1860
+
1861
+ new_options = opts.merge(
1862
+ :operation => :"DefaultApi.get_outcomes",
1863
+ :header_params => header_params,
1864
+ :query_params => query_params,
1865
+ :form_params => form_params,
1866
+ :body => post_body,
1867
+ :auth_names => auth_names,
1868
+ :return_type => return_type
1869
+ )
1870
+
1871
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1872
+ if @api_client.config.debugging
1873
+ @api_client.config.logger.debug "API called: DefaultApi#get_outcomes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1874
+ end
1875
+ return data, status_code, headers
1876
+ end
1877
+
1878
+ # View device
1879
+ # View the details of an existing device in one of your OneSignal apps
1880
+ # @param app_id [String] Your app_id for this device
1881
+ # @param player_id [String] Player&#39;s OneSignal ID
1882
+ # @param [Hash] opts the optional parameters
1883
+ # @option opts [String] :email_auth_hash Email - Only required if you have enabled Identity Verification and device_type is email (11).
1884
+ # @return [Player]
1885
+ def get_player(app_id, player_id, opts = {})
1886
+ data, _status_code, _headers = get_player_with_http_info(app_id, player_id, opts)
1887
+ data
1888
+ end
1889
+
1890
+ # View device
1891
+ # View the details of an existing device in one of your OneSignal apps
1892
+ # @param app_id [String] Your app_id for this device
1893
+ # @param player_id [String] Player&#39;s OneSignal ID
1894
+ # @param [Hash] opts the optional parameters
1895
+ # @option opts [String] :email_auth_hash Email - Only required if you have enabled Identity Verification and device_type is email (11).
1896
+ # @return [Array<(Player, Integer, Hash)>] Player data, response status code and response headers
1897
+ def get_player_with_http_info(app_id, player_id, opts = {})
1898
+ if @api_client.config.debugging
1899
+ @api_client.config.logger.debug 'Calling API: DefaultApi.get_player ...'
1900
+ end
1901
+ # verify the required parameter 'app_id' is set
1902
+ if @api_client.config.client_side_validation && app_id.nil?
1903
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.get_player"
1904
+ end
1905
+ # verify the required parameter 'player_id' is set
1906
+ if @api_client.config.client_side_validation && player_id.nil?
1907
+ fail ArgumentError, "Missing the required parameter 'player_id' when calling DefaultApi.get_player"
1908
+ end
1909
+ # resource path
1910
+ local_var_path = '/players/{player_id}'.sub('{' + 'player_id' + '}', CGI.escape(player_id.to_s))
1911
+
1912
+ # query parameters
1913
+ query_params = opts[:query_params] || {}
1914
+ query_params[:'app_id'] = app_id
1915
+ query_params[:'email_auth_hash'] = opts[:'email_auth_hash'] if !opts[:'email_auth_hash'].nil?
1916
+
1917
+ # header parameters
1918
+ header_params = opts[:header_params] || {}
1919
+ # HTTP header 'Accept' (if needed)
1920
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1921
+
1922
+ # form parameters
1923
+ form_params = opts[:form_params] || {}
1924
+
1925
+ # http body (model)
1926
+ post_body = opts[:debug_body]
1927
+
1928
+ # return_type
1929
+ return_type = opts[:debug_return_type] || 'Player'
1930
+
1931
+ # auth_names
1932
+ auth_names = opts[:debug_auth_names] || ['app_key']
1933
+
1934
+ new_options = opts.merge(
1935
+ :operation => :"DefaultApi.get_player",
1936
+ :header_params => header_params,
1937
+ :query_params => query_params,
1938
+ :form_params => form_params,
1939
+ :body => post_body,
1940
+ :auth_names => auth_names,
1941
+ :return_type => return_type
1942
+ )
1943
+
1944
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1945
+ if @api_client.config.debugging
1946
+ @api_client.config.logger.debug "API called: DefaultApi#get_player\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1947
+ end
1948
+ return data, status_code, headers
1949
+ end
1950
+
1951
+ # View devices
1952
+ # 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.
1953
+ # @param app_id [String] The app ID that you want to view players from
1954
+ # @param [Hash] opts the optional parameters
1955
+ # @option opts [Integer] :limit How many devices to return. Max is 300. Default is 300
1956
+ # @option opts [Integer] :offset Result offset. Default is 0. Results are sorted by id;
1957
+ # @return [PlayerSlice]
1958
+ def get_players(app_id, opts = {})
1959
+ data, _status_code, _headers = get_players_with_http_info(app_id, opts)
1960
+ data
1961
+ end
1962
+
1963
+ # View devices
1964
+ # 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.
1965
+ # @param app_id [String] The app ID that you want to view players from
1966
+ # @param [Hash] opts the optional parameters
1967
+ # @option opts [Integer] :limit How many devices to return. Max is 300. Default is 300
1968
+ # @option opts [Integer] :offset Result offset. Default is 0. Results are sorted by id;
1969
+ # @return [Array<(PlayerSlice, Integer, Hash)>] PlayerSlice data, response status code and response headers
1970
+ def get_players_with_http_info(app_id, opts = {})
1971
+ if @api_client.config.debugging
1972
+ @api_client.config.logger.debug 'Calling API: DefaultApi.get_players ...'
1973
+ end
1974
+ # verify the required parameter 'app_id' is set
1975
+ if @api_client.config.client_side_validation && app_id.nil?
1976
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.get_players"
1977
+ end
1978
+ # resource path
1979
+ local_var_path = '/players'
1980
+
1981
+ # query parameters
1982
+ query_params = opts[:query_params] || {}
1983
+ query_params[:'app_id'] = app_id
1984
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
1985
+ query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
1986
+
1987
+ # header parameters
1988
+ header_params = opts[:header_params] || {}
1989
+ # HTTP header 'Accept' (if needed)
1990
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1991
+
1992
+ # form parameters
1993
+ form_params = opts[:form_params] || {}
1994
+
1995
+ # http body (model)
1996
+ post_body = opts[:debug_body]
1997
+
1998
+ # return_type
1999
+ return_type = opts[:debug_return_type] || 'PlayerSlice'
2000
+
2001
+ # auth_names
2002
+ auth_names = opts[:debug_auth_names] || ['app_key']
2003
+
2004
+ new_options = opts.merge(
2005
+ :operation => :"DefaultApi.get_players",
2006
+ :header_params => header_params,
2007
+ :query_params => query_params,
2008
+ :form_params => form_params,
2009
+ :body => post_body,
2010
+ :auth_names => auth_names,
2011
+ :return_type => return_type
2012
+ )
2013
+
2014
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
2015
+ if @api_client.config.debugging
2016
+ @api_client.config.logger.debug "API called: DefaultApi#get_players\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2017
+ end
2018
+ return data, status_code, headers
2019
+ end
2020
+
2021
+ # Upserts one or more Aliases to an existing User identified by (:alias_label, :alias_id).
2022
+ # @param app_id [String]
2023
+ # @param alias_label [String]
2024
+ # @param alias_id [String]
2025
+ # @param user_identity_request_body [UserIdentityRequestBody]
2026
+ # @param [Hash] opts the optional parameters
2027
+ # @return [InlineResponse200]
2028
+ def identify_user_by_alias(app_id, alias_label, alias_id, user_identity_request_body, opts = {})
2029
+ data, _status_code, _headers = identify_user_by_alias_with_http_info(app_id, alias_label, alias_id, user_identity_request_body, opts)
2030
+ data
2031
+ end
2032
+
2033
+ # Upserts one or more Aliases to an existing User identified by (:alias_label, :alias_id).
2034
+ # @param app_id [String]
2035
+ # @param alias_label [String]
2036
+ # @param alias_id [String]
2037
+ # @param user_identity_request_body [UserIdentityRequestBody]
2038
+ # @param [Hash] opts the optional parameters
2039
+ # @return [Array<(InlineResponse200, Integer, Hash)>] InlineResponse200 data, response status code and response headers
2040
+ def identify_user_by_alias_with_http_info(app_id, alias_label, alias_id, user_identity_request_body, opts = {})
2041
+ if @api_client.config.debugging
2042
+ @api_client.config.logger.debug 'Calling API: DefaultApi.identify_user_by_alias ...'
2043
+ end
2044
+ # verify the required parameter 'app_id' is set
2045
+ if @api_client.config.client_side_validation && app_id.nil?
2046
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.identify_user_by_alias"
2047
+ end
2048
+ # verify the required parameter 'alias_label' is set
2049
+ if @api_client.config.client_side_validation && alias_label.nil?
2050
+ fail ArgumentError, "Missing the required parameter 'alias_label' when calling DefaultApi.identify_user_by_alias"
2051
+ end
2052
+ # verify the required parameter 'alias_id' is set
2053
+ if @api_client.config.client_side_validation && alias_id.nil?
2054
+ fail ArgumentError, "Missing the required parameter 'alias_id' when calling DefaultApi.identify_user_by_alias"
2055
+ end
2056
+ # verify the required parameter 'user_identity_request_body' is set
2057
+ if @api_client.config.client_side_validation && user_identity_request_body.nil?
2058
+ fail ArgumentError, "Missing the required parameter 'user_identity_request_body' when calling DefaultApi.identify_user_by_alias"
2059
+ end
2060
+ # resource path
2061
+ local_var_path = '/apps/{app_id}/users/by/{alias_label}/{alias_id}/identity'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'alias_label' + '}', CGI.escape(alias_label.to_s)).sub('{' + 'alias_id' + '}', CGI.escape(alias_id.to_s))
2062
+
2063
+ # query parameters
2064
+ query_params = opts[:query_params] || {}
2065
+
2066
+ # header parameters
2067
+ header_params = opts[:header_params] || {}
2068
+ # HTTP header 'Accept' (if needed)
2069
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
2070
+ # HTTP header 'Content-Type'
2071
+ content_type = @api_client.select_header_content_type(['application/json'])
2072
+ if !content_type.nil?
2073
+ header_params['Content-Type'] = content_type
2074
+ end
2075
+
2076
+ # form parameters
2077
+ form_params = opts[:form_params] || {}
2078
+
2079
+ # http body (model)
2080
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(user_identity_request_body)
2081
+
2082
+ # return_type
2083
+ return_type = opts[:debug_return_type] || 'InlineResponse200'
2084
+
2085
+ # auth_names
2086
+ auth_names = opts[:debug_auth_names] || ['app_key']
2087
+
2088
+ new_options = opts.merge(
2089
+ :operation => :"DefaultApi.identify_user_by_alias",
2090
+ :header_params => header_params,
2091
+ :query_params => query_params,
2092
+ :form_params => form_params,
2093
+ :body => post_body,
2094
+ :auth_names => auth_names,
2095
+ :return_type => return_type
2096
+ )
2097
+
2098
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
2099
+ if @api_client.config.debugging
2100
+ @api_client.config.logger.debug "API called: DefaultApi#identify_user_by_alias\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2101
+ end
2102
+ return data, status_code, headers
2103
+ end
2104
+
2105
+ # Upserts one or more Aliases for the User identified by :subscription_id.
2106
+ # @param app_id [String]
2107
+ # @param subscription_id [String]
2108
+ # @param user_identity_request_body [UserIdentityRequestBody]
2109
+ # @param [Hash] opts the optional parameters
2110
+ # @return [UserIdentityResponse]
2111
+ def identify_user_by_subscription_id(app_id, subscription_id, user_identity_request_body, opts = {})
2112
+ data, _status_code, _headers = identify_user_by_subscription_id_with_http_info(app_id, subscription_id, user_identity_request_body, opts)
2113
+ data
2114
+ end
2115
+
2116
+ # Upserts one or more Aliases for the User identified by :subscription_id.
2117
+ # @param app_id [String]
2118
+ # @param subscription_id [String]
2119
+ # @param user_identity_request_body [UserIdentityRequestBody]
2120
+ # @param [Hash] opts the optional parameters
2121
+ # @return [Array<(UserIdentityResponse, Integer, Hash)>] UserIdentityResponse data, response status code and response headers
2122
+ def identify_user_by_subscription_id_with_http_info(app_id, subscription_id, user_identity_request_body, opts = {})
2123
+ if @api_client.config.debugging
2124
+ @api_client.config.logger.debug 'Calling API: DefaultApi.identify_user_by_subscription_id ...'
2125
+ end
2126
+ # verify the required parameter 'app_id' is set
2127
+ if @api_client.config.client_side_validation && app_id.nil?
2128
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.identify_user_by_subscription_id"
2129
+ end
2130
+ # verify the required parameter 'subscription_id' is set
2131
+ if @api_client.config.client_side_validation && subscription_id.nil?
2132
+ fail ArgumentError, "Missing the required parameter 'subscription_id' when calling DefaultApi.identify_user_by_subscription_id"
2133
+ end
2134
+ # verify the required parameter 'user_identity_request_body' is set
2135
+ if @api_client.config.client_side_validation && user_identity_request_body.nil?
2136
+ fail ArgumentError, "Missing the required parameter 'user_identity_request_body' when calling DefaultApi.identify_user_by_subscription_id"
2137
+ end
2138
+ # resource path
2139
+ local_var_path = '/apps/{app_id}/subscriptions/{subscription_id}/user/identity'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'subscription_id' + '}', CGI.escape(subscription_id.to_s))
2140
+
2141
+ # query parameters
2142
+ query_params = opts[:query_params] || {}
2143
+
2144
+ # header parameters
2145
+ header_params = opts[:header_params] || {}
2146
+ # HTTP header 'Accept' (if needed)
2147
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
2148
+ # HTTP header 'Content-Type'
2149
+ content_type = @api_client.select_header_content_type(['application/json'])
2150
+ if !content_type.nil?
2151
+ header_params['Content-Type'] = content_type
2152
+ end
2153
+
2154
+ # form parameters
2155
+ form_params = opts[:form_params] || {}
2156
+
2157
+ # http body (model)
2158
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(user_identity_request_body)
2159
+
2160
+ # return_type
2161
+ return_type = opts[:debug_return_type] || 'UserIdentityResponse'
2162
+
2163
+ # auth_names
2164
+ auth_names = opts[:debug_auth_names] || ['app_key']
2165
+
2166
+ new_options = opts.merge(
2167
+ :operation => :"DefaultApi.identify_user_by_subscription_id",
2168
+ :header_params => header_params,
2169
+ :query_params => query_params,
2170
+ :form_params => form_params,
2171
+ :body => post_body,
2172
+ :auth_names => auth_names,
2173
+ :return_type => return_type
2174
+ )
2175
+
2176
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
2177
+ if @api_client.config.debugging
2178
+ @api_client.config.logger.debug "API called: DefaultApi#identify_user_by_subscription_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2179
+ end
2180
+ return data, status_code, headers
2181
+ end
2182
+
2183
+ # Transfers this Subscription to the User identified by the identity in the payload.
2184
+ # @param app_id [String]
2185
+ # @param subscription_id [String]
2186
+ # @param transfer_subscription_request_body [TransferSubscriptionRequestBody]
2187
+ # @param [Hash] opts the optional parameters
2188
+ # @return [UserIdentityResponse]
2189
+ def transfer_subscription(app_id, subscription_id, transfer_subscription_request_body, opts = {})
2190
+ data, _status_code, _headers = transfer_subscription_with_http_info(app_id, subscription_id, transfer_subscription_request_body, opts)
2191
+ data
2192
+ end
2193
+
2194
+ # Transfers this Subscription to the User identified by the identity in the payload.
2195
+ # @param app_id [String]
2196
+ # @param subscription_id [String]
2197
+ # @param transfer_subscription_request_body [TransferSubscriptionRequestBody]
2198
+ # @param [Hash] opts the optional parameters
2199
+ # @return [Array<(UserIdentityResponse, Integer, Hash)>] UserIdentityResponse data, response status code and response headers
2200
+ def transfer_subscription_with_http_info(app_id, subscription_id, transfer_subscription_request_body, opts = {})
2201
+ if @api_client.config.debugging
2202
+ @api_client.config.logger.debug 'Calling API: DefaultApi.transfer_subscription ...'
2203
+ end
2204
+ # verify the required parameter 'app_id' is set
2205
+ if @api_client.config.client_side_validation && app_id.nil?
2206
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.transfer_subscription"
2207
+ end
2208
+ # verify the required parameter 'subscription_id' is set
2209
+ if @api_client.config.client_side_validation && subscription_id.nil?
2210
+ fail ArgumentError, "Missing the required parameter 'subscription_id' when calling DefaultApi.transfer_subscription"
2211
+ end
2212
+ # verify the required parameter 'transfer_subscription_request_body' is set
2213
+ if @api_client.config.client_side_validation && transfer_subscription_request_body.nil?
2214
+ fail ArgumentError, "Missing the required parameter 'transfer_subscription_request_body' when calling DefaultApi.transfer_subscription"
2215
+ end
2216
+ # resource path
2217
+ local_var_path = '/apps/{app_id}/subscriptions/{subscription_id}/owner'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'subscription_id' + '}', CGI.escape(subscription_id.to_s))
2218
+
2219
+ # query parameters
2220
+ query_params = opts[:query_params] || {}
2221
+
2222
+ # header parameters
2223
+ header_params = opts[:header_params] || {}
2224
+ # HTTP header 'Accept' (if needed)
2225
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
2226
+ # HTTP header 'Content-Type'
2227
+ content_type = @api_client.select_header_content_type(['application/json'])
2228
+ if !content_type.nil?
2229
+ header_params['Content-Type'] = content_type
2230
+ end
2231
+
2232
+ # form parameters
2233
+ form_params = opts[:form_params] || {}
2234
+
2235
+ # http body (model)
2236
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(transfer_subscription_request_body)
2237
+
2238
+ # return_type
2239
+ return_type = opts[:debug_return_type] || 'UserIdentityResponse'
2240
+
2241
+ # auth_names
2242
+ auth_names = opts[:debug_auth_names] || ['app_key']
2243
+
2244
+ new_options = opts.merge(
2245
+ :operation => :"DefaultApi.transfer_subscription",
2246
+ :header_params => header_params,
2247
+ :query_params => query_params,
2248
+ :form_params => form_params,
2249
+ :body => post_body,
2250
+ :auth_names => auth_names,
2251
+ :return_type => return_type
2252
+ )
2253
+
2254
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
2255
+ if @api_client.config.debugging
2256
+ @api_client.config.logger.debug "API called: DefaultApi#transfer_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2257
+ end
2258
+ return data, status_code, headers
2259
+ end
2260
+
2261
+ # Update an app
2262
+ # Updates the name or configuration settings of an existing OneSignal app
2263
+ # @param app_id [String] An app id
2264
+ # @param app [App]
2265
+ # @param [Hash] opts the optional parameters
2266
+ # @return [App]
2267
+ def update_app(app_id, app, opts = {})
2268
+ data, _status_code, _headers = update_app_with_http_info(app_id, app, opts)
2269
+ data
2270
+ end
2271
+
2272
+ # Update an app
2273
+ # Updates the name or configuration settings of an existing OneSignal app
2274
+ # @param app_id [String] An app id
2275
+ # @param app [App]
2276
+ # @param [Hash] opts the optional parameters
2277
+ # @return [Array<(App, Integer, Hash)>] App data, response status code and response headers
2278
+ def update_app_with_http_info(app_id, app, opts = {})
2279
+ if @api_client.config.debugging
2280
+ @api_client.config.logger.debug 'Calling API: DefaultApi.update_app ...'
2281
+ end
2282
+ # verify the required parameter 'app_id' is set
2283
+ if @api_client.config.client_side_validation && app_id.nil?
2284
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.update_app"
2285
+ end
2286
+ # verify the required parameter 'app' is set
2287
+ if @api_client.config.client_side_validation && app.nil?
2288
+ fail ArgumentError, "Missing the required parameter 'app' when calling DefaultApi.update_app"
2289
+ end
2290
+ # resource path
2291
+ local_var_path = '/apps/{app_id}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s))
2292
+
2293
+ # query parameters
2294
+ query_params = opts[:query_params] || {}
2295
+
2296
+ # header parameters
2297
+ header_params = opts[:header_params] || {}
2298
+ # HTTP header 'Accept' (if needed)
2299
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
2300
+ # HTTP header 'Content-Type'
2301
+ content_type = @api_client.select_header_content_type(['application/json'])
2302
+ if !content_type.nil?
2303
+ header_params['Content-Type'] = content_type
2304
+ end
2305
+
2306
+ # form parameters
2307
+ form_params = opts[:form_params] || {}
2308
+
2309
+ # http body (model)
2310
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(app)
2311
+
2312
+ # return_type
2313
+ return_type = opts[:debug_return_type] || 'App'
2314
+
2315
+ # auth_names
2316
+ auth_names = opts[:debug_auth_names] || ['user_key']
2317
+
2318
+ new_options = opts.merge(
2319
+ :operation => :"DefaultApi.update_app",
2320
+ :header_params => header_params,
2321
+ :query_params => query_params,
2322
+ :form_params => form_params,
2323
+ :body => post_body,
2324
+ :auth_names => auth_names,
2325
+ :return_type => return_type
2326
+ )
2327
+
2328
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
2329
+ if @api_client.config.debugging
2330
+ @api_client.config.logger.debug "API called: DefaultApi#update_app\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2331
+ end
2332
+ return data, status_code, headers
2333
+ end
2334
+
2335
+ # Update a Live Activity via Push
2336
+ # Updates a specified live activity.
2337
+ # @param app_id [String] The OneSignal App ID for your app. Available in Keys &amp; IDs.
2338
+ # @param activity_id [String] Live Activity record ID
2339
+ # @param update_live_activity_request [UpdateLiveActivityRequest]
2340
+ # @param [Hash] opts the optional parameters
2341
+ # @return [UpdateLiveActivitySuccessResponse]
2342
+ def update_live_activity(app_id, activity_id, update_live_activity_request, opts = {})
2343
+ data, _status_code, _headers = update_live_activity_with_http_info(app_id, activity_id, update_live_activity_request, opts)
2344
+ data
2345
+ end
2346
+
2347
+ # Update a Live Activity via Push
2348
+ # Updates a specified live activity.
2349
+ # @param app_id [String] The OneSignal App ID for your app. Available in Keys &amp; IDs.
2350
+ # @param activity_id [String] Live Activity record ID
2351
+ # @param update_live_activity_request [UpdateLiveActivityRequest]
2352
+ # @param [Hash] opts the optional parameters
2353
+ # @return [Array<(UpdateLiveActivitySuccessResponse, Integer, Hash)>] UpdateLiveActivitySuccessResponse data, response status code and response headers
2354
+ def update_live_activity_with_http_info(app_id, activity_id, update_live_activity_request, opts = {})
2355
+ if @api_client.config.debugging
2356
+ @api_client.config.logger.debug 'Calling API: DefaultApi.update_live_activity ...'
2357
+ end
2358
+ # verify the required parameter 'app_id' is set
2359
+ if @api_client.config.client_side_validation && app_id.nil?
2360
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.update_live_activity"
2361
+ end
2362
+ # verify the required parameter 'activity_id' is set
2363
+ if @api_client.config.client_side_validation && activity_id.nil?
2364
+ fail ArgumentError, "Missing the required parameter 'activity_id' when calling DefaultApi.update_live_activity"
2365
+ end
2366
+ # verify the required parameter 'update_live_activity_request' is set
2367
+ if @api_client.config.client_side_validation && update_live_activity_request.nil?
2368
+ fail ArgumentError, "Missing the required parameter 'update_live_activity_request' when calling DefaultApi.update_live_activity"
2369
+ end
2370
+ # resource path
2371
+ local_var_path = '/apps/{app_id}/live_activities/{activity_id}/notifications'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'activity_id' + '}', CGI.escape(activity_id.to_s))
2372
+
2373
+ # query parameters
2374
+ query_params = opts[:query_params] || {}
2375
+
2376
+ # header parameters
2377
+ header_params = opts[:header_params] || {}
2378
+ # HTTP header 'Accept' (if needed)
2379
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
2380
+ # HTTP header 'Content-Type'
2381
+ content_type = @api_client.select_header_content_type(['application/json'])
2382
+ if !content_type.nil?
2383
+ header_params['Content-Type'] = content_type
2384
+ end
2385
+
2386
+ # form parameters
2387
+ form_params = opts[:form_params] || {}
2388
+
2389
+ # http body (model)
2390
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(update_live_activity_request)
2391
+
2392
+ # return_type
2393
+ return_type = opts[:debug_return_type] || 'UpdateLiveActivitySuccessResponse'
2394
+
2395
+ # auth_names
2396
+ auth_names = opts[:debug_auth_names] || ['app_key']
2397
+
2398
+ new_options = opts.merge(
2399
+ :operation => :"DefaultApi.update_live_activity",
2400
+ :header_params => header_params,
2401
+ :query_params => query_params,
2402
+ :form_params => form_params,
2403
+ :body => post_body,
2404
+ :auth_names => auth_names,
2405
+ :return_type => return_type
2406
+ )
2407
+
2408
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
2409
+ if @api_client.config.debugging
2410
+ @api_client.config.logger.debug "API called: DefaultApi#update_live_activity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2411
+ end
2412
+ return data, status_code, headers
2413
+ end
2414
+
2415
+ # Edit device
2416
+ # Update an existing device in one of your OneSignal apps
2417
+ # @param player_id [String] Player&#39;s OneSignal ID
2418
+ # @param player [Player]
2419
+ # @param [Hash] opts the optional parameters
2420
+ # @return [UpdatePlayerSuccessResponse]
2421
+ def update_player(player_id, player, opts = {})
2422
+ data, _status_code, _headers = update_player_with_http_info(player_id, player, opts)
2423
+ data
2424
+ end
2425
+
2426
+ # Edit device
2427
+ # Update an existing device in one of your OneSignal apps
2428
+ # @param player_id [String] Player&#39;s OneSignal ID
2429
+ # @param player [Player]
2430
+ # @param [Hash] opts the optional parameters
2431
+ # @return [Array<(UpdatePlayerSuccessResponse, Integer, Hash)>] UpdatePlayerSuccessResponse data, response status code and response headers
2432
+ def update_player_with_http_info(player_id, player, opts = {})
2433
+ if @api_client.config.debugging
2434
+ @api_client.config.logger.debug 'Calling API: DefaultApi.update_player ...'
2435
+ end
2436
+ # verify the required parameter 'player_id' is set
2437
+ if @api_client.config.client_side_validation && player_id.nil?
2438
+ fail ArgumentError, "Missing the required parameter 'player_id' when calling DefaultApi.update_player"
2439
+ end
2440
+ # verify the required parameter 'player' is set
2441
+ if @api_client.config.client_side_validation && player.nil?
2442
+ fail ArgumentError, "Missing the required parameter 'player' when calling DefaultApi.update_player"
2443
+ end
2444
+ # resource path
2445
+ local_var_path = '/players/{player_id}'.sub('{' + 'player_id' + '}', CGI.escape(player_id.to_s))
2446
+
2447
+ # query parameters
2448
+ query_params = opts[:query_params] || {}
2449
+
2450
+ # header parameters
2451
+ header_params = opts[:header_params] || {}
2452
+ # HTTP header 'Accept' (if needed)
2453
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
2454
+ # HTTP header 'Content-Type'
2455
+ content_type = @api_client.select_header_content_type(['application/json'])
2456
+ if !content_type.nil?
2457
+ header_params['Content-Type'] = content_type
2458
+ end
2459
+
2460
+ # form parameters
2461
+ form_params = opts[:form_params] || {}
2462
+
2463
+ # http body (model)
2464
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(player)
2465
+
2466
+ # return_type
2467
+ return_type = opts[:debug_return_type] || 'UpdatePlayerSuccessResponse'
2468
+
2469
+ # auth_names
2470
+ auth_names = opts[:debug_auth_names] || ['app_key']
2471
+
2472
+ new_options = opts.merge(
2473
+ :operation => :"DefaultApi.update_player",
2474
+ :header_params => header_params,
2475
+ :query_params => query_params,
2476
+ :form_params => form_params,
2477
+ :body => post_body,
2478
+ :auth_names => auth_names,
2479
+ :return_type => return_type
2480
+ )
2481
+
2482
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
2483
+ if @api_client.config.debugging
2484
+ @api_client.config.logger.debug "API called: DefaultApi#update_player\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2485
+ end
2486
+ return data, status_code, headers
2487
+ end
2488
+
2489
+ # Edit tags with external user id
2490
+ # 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\" }
2491
+ # @param app_id [String] The OneSignal App ID the user record is found under.
2492
+ # @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.
2493
+ # @param [Hash] opts the optional parameters
2494
+ # @option opts [UpdatePlayerTagsRequestBody] :update_player_tags_request_body
2495
+ # @return [UpdatePlayerTagsSuccessResponse]
2496
+ def update_player_tags(app_id, external_user_id, opts = {})
2497
+ data, _status_code, _headers = update_player_tags_with_http_info(app_id, external_user_id, opts)
2498
+ data
2499
+ end
2500
+
2501
+ # Edit tags with external user id
2502
+ # 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; }
2503
+ # @param app_id [String] The OneSignal App ID the user record is found under.
2504
+ # @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.
2505
+ # @param [Hash] opts the optional parameters
2506
+ # @option opts [UpdatePlayerTagsRequestBody] :update_player_tags_request_body
2507
+ # @return [Array<(UpdatePlayerTagsSuccessResponse, Integer, Hash)>] UpdatePlayerTagsSuccessResponse data, response status code and response headers
2508
+ def update_player_tags_with_http_info(app_id, external_user_id, opts = {})
2509
+ if @api_client.config.debugging
2510
+ @api_client.config.logger.debug 'Calling API: DefaultApi.update_player_tags ...'
2511
+ end
2512
+ # verify the required parameter 'app_id' is set
2513
+ if @api_client.config.client_side_validation && app_id.nil?
2514
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.update_player_tags"
2515
+ end
2516
+ # verify the required parameter 'external_user_id' is set
2517
+ if @api_client.config.client_side_validation && external_user_id.nil?
2518
+ fail ArgumentError, "Missing the required parameter 'external_user_id' when calling DefaultApi.update_player_tags"
2519
+ end
2520
+ # resource path
2521
+ 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))
2522
+
2523
+ # query parameters
2524
+ query_params = opts[:query_params] || {}
2525
+
2526
+ # header parameters
2527
+ header_params = opts[:header_params] || {}
2528
+ # HTTP header 'Accept' (if needed)
2529
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
2530
+ # HTTP header 'Content-Type'
2531
+ content_type = @api_client.select_header_content_type(['application/json'])
2532
+ if !content_type.nil?
2533
+ header_params['Content-Type'] = content_type
2534
+ end
2535
+
2536
+ # form parameters
2537
+ form_params = opts[:form_params] || {}
2538
+
2539
+ # http body (model)
2540
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'update_player_tags_request_body'])
2541
+
2542
+ # return_type
2543
+ return_type = opts[:debug_return_type] || 'UpdatePlayerTagsSuccessResponse'
2544
+
2545
+ # auth_names
2546
+ auth_names = opts[:debug_auth_names] || ['app_key']
2547
+
2548
+ new_options = opts.merge(
2549
+ :operation => :"DefaultApi.update_player_tags",
2550
+ :header_params => header_params,
2551
+ :query_params => query_params,
2552
+ :form_params => form_params,
2553
+ :body => post_body,
2554
+ :auth_names => auth_names,
2555
+ :return_type => return_type
2556
+ )
2557
+
2558
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
2559
+ if @api_client.config.debugging
2560
+ @api_client.config.logger.debug "API called: DefaultApi#update_player_tags\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2561
+ end
2562
+ return data, status_code, headers
2563
+ end
2564
+
2565
+ # Updates an existing Subscription’s properties.
2566
+ # @param app_id [String]
2567
+ # @param subscription_id [String]
2568
+ # @param update_subscription_request_body [UpdateSubscriptionRequestBody]
2569
+ # @param [Hash] opts the optional parameters
2570
+ # @return [nil]
2571
+ def update_subscription(app_id, subscription_id, update_subscription_request_body, opts = {})
2572
+ update_subscription_with_http_info(app_id, subscription_id, update_subscription_request_body, opts)
2573
+ nil
2574
+ end
2575
+
2576
+ # Updates an existing Subscription’s properties.
2577
+ # @param app_id [String]
2578
+ # @param subscription_id [String]
2579
+ # @param update_subscription_request_body [UpdateSubscriptionRequestBody]
2580
+ # @param [Hash] opts the optional parameters
2581
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
2582
+ def update_subscription_with_http_info(app_id, subscription_id, update_subscription_request_body, opts = {})
2583
+ if @api_client.config.debugging
2584
+ @api_client.config.logger.debug 'Calling API: DefaultApi.update_subscription ...'
2585
+ end
2586
+ # verify the required parameter 'app_id' is set
2587
+ if @api_client.config.client_side_validation && app_id.nil?
2588
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.update_subscription"
2589
+ end
2590
+ # verify the required parameter 'subscription_id' is set
2591
+ if @api_client.config.client_side_validation && subscription_id.nil?
2592
+ fail ArgumentError, "Missing the required parameter 'subscription_id' when calling DefaultApi.update_subscription"
2593
+ end
2594
+ # verify the required parameter 'update_subscription_request_body' is set
2595
+ if @api_client.config.client_side_validation && update_subscription_request_body.nil?
2596
+ fail ArgumentError, "Missing the required parameter 'update_subscription_request_body' when calling DefaultApi.update_subscription"
2597
+ end
2598
+ # resource path
2599
+ local_var_path = '/apps/{app_id}/subscriptions/{subscription_id}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'subscription_id' + '}', CGI.escape(subscription_id.to_s))
2600
+
2601
+ # query parameters
2602
+ query_params = opts[:query_params] || {}
2603
+
2604
+ # header parameters
2605
+ header_params = opts[:header_params] || {}
2606
+ # HTTP header 'Accept' (if needed)
2607
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
2608
+ # HTTP header 'Content-Type'
2609
+ content_type = @api_client.select_header_content_type(['application/json'])
2610
+ if !content_type.nil?
2611
+ header_params['Content-Type'] = content_type
2612
+ end
2613
+
2614
+ # form parameters
2615
+ form_params = opts[:form_params] || {}
2616
+
2617
+ # http body (model)
2618
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(update_subscription_request_body)
2619
+
2620
+ # return_type
2621
+ return_type = opts[:debug_return_type]
2622
+
2623
+ # auth_names
2624
+ auth_names = opts[:debug_auth_names] || ['app_key']
2625
+
2626
+ new_options = opts.merge(
2627
+ :operation => :"DefaultApi.update_subscription",
2628
+ :header_params => header_params,
2629
+ :query_params => query_params,
2630
+ :form_params => form_params,
2631
+ :body => post_body,
2632
+ :auth_names => auth_names,
2633
+ :return_type => return_type
2634
+ )
2635
+
2636
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
2637
+ if @api_client.config.debugging
2638
+ @api_client.config.logger.debug "API called: DefaultApi#update_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2639
+ end
2640
+ return data, status_code, headers
2641
+ end
2642
+
2643
+ # Updates an existing User’s properties.
2644
+ # @param app_id [String]
2645
+ # @param alias_label [String]
2646
+ # @param alias_id [String]
2647
+ # @param update_user_request [UpdateUserRequest]
2648
+ # @param [Hash] opts the optional parameters
2649
+ # @return [InlineResponse202]
2650
+ def update_user(app_id, alias_label, alias_id, update_user_request, opts = {})
2651
+ data, _status_code, _headers = update_user_with_http_info(app_id, alias_label, alias_id, update_user_request, opts)
2652
+ data
2653
+ end
2654
+
2655
+ # Updates an existing User’s properties.
2656
+ # @param app_id [String]
2657
+ # @param alias_label [String]
2658
+ # @param alias_id [String]
2659
+ # @param update_user_request [UpdateUserRequest]
2660
+ # @param [Hash] opts the optional parameters
2661
+ # @return [Array<(InlineResponse202, Integer, Hash)>] InlineResponse202 data, response status code and response headers
2662
+ def update_user_with_http_info(app_id, alias_label, alias_id, update_user_request, opts = {})
2663
+ if @api_client.config.debugging
2664
+ @api_client.config.logger.debug 'Calling API: DefaultApi.update_user ...'
2665
+ end
2666
+ # verify the required parameter 'app_id' is set
2667
+ if @api_client.config.client_side_validation && app_id.nil?
2668
+ fail ArgumentError, "Missing the required parameter 'app_id' when calling DefaultApi.update_user"
2669
+ end
2670
+ # verify the required parameter 'alias_label' is set
2671
+ if @api_client.config.client_side_validation && alias_label.nil?
2672
+ fail ArgumentError, "Missing the required parameter 'alias_label' when calling DefaultApi.update_user"
2673
+ end
2674
+ # verify the required parameter 'alias_id' is set
2675
+ if @api_client.config.client_side_validation && alias_id.nil?
2676
+ fail ArgumentError, "Missing the required parameter 'alias_id' when calling DefaultApi.update_user"
2677
+ end
2678
+ # verify the required parameter 'update_user_request' is set
2679
+ if @api_client.config.client_side_validation && update_user_request.nil?
2680
+ fail ArgumentError, "Missing the required parameter 'update_user_request' when calling DefaultApi.update_user"
2681
+ end
2682
+ # resource path
2683
+ local_var_path = '/apps/{app_id}/users/by/{alias_label}/{alias_id}'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'alias_label' + '}', CGI.escape(alias_label.to_s)).sub('{' + 'alias_id' + '}', CGI.escape(alias_id.to_s))
2684
+
2685
+ # query parameters
2686
+ query_params = opts[:query_params] || {}
2687
+
2688
+ # header parameters
2689
+ header_params = opts[:header_params] || {}
2690
+ # HTTP header 'Accept' (if needed)
2691
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
2692
+ # HTTP header 'Content-Type'
2693
+ content_type = @api_client.select_header_content_type(['application/json'])
2694
+ if !content_type.nil?
2695
+ header_params['Content-Type'] = content_type
2696
+ end
2697
+
2698
+ # form parameters
2699
+ form_params = opts[:form_params] || {}
2700
+
2701
+ # http body (model)
2702
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(update_user_request)
2703
+
2704
+ # return_type
2705
+ return_type = opts[:debug_return_type] || 'InlineResponse202'
2706
+
2707
+ # auth_names
2708
+ auth_names = opts[:debug_auth_names] || ['app_key']
2709
+
2710
+ new_options = opts.merge(
2711
+ :operation => :"DefaultApi.update_user",
2712
+ :header_params => header_params,
2713
+ :query_params => query_params,
2714
+ :form_params => form_params,
2715
+ :body => post_body,
2716
+ :auth_names => auth_names,
2717
+ :return_type => return_type
2718
+ )
2719
+
2720
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
2721
+ if @api_client.config.debugging
2722
+ @api_client.config.logger.debug "API called: DefaultApi#update_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2723
+ end
2724
+ return data, status_code, headers
2725
+ end
2726
+ end
2727
+ end