polar-accesslink-api-gem 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +182 -0
  4. data/Rakefile +10 -0
  5. data/docs/Activity.md +34 -0
  6. data/docs/ActivityLog.md +18 -0
  7. data/docs/ActivityStepSample.md +20 -0
  8. data/docs/ActivityStepSamples.md +20 -0
  9. data/docs/ActivityZoneSample.md +20 -0
  10. data/docs/ActivityZoneSamples.md +20 -0
  11. data/docs/AvailableSleep.md +22 -0
  12. data/docs/AvailableSleeps.md +18 -0
  13. data/docs/AvailableUserData.md +22 -0
  14. data/docs/AvailableUserDatas.md +18 -0
  15. data/docs/CreatedWebhook.md +18 -0
  16. data/docs/CreatedWebhookData.md +24 -0
  17. data/docs/DailyActivityApi.md +440 -0
  18. data/docs/DurationZone.md +20 -0
  19. data/docs/Error.md +26 -0
  20. data/docs/Exercise.md +54 -0
  21. data/docs/ExerciseHashId.md +52 -0
  22. data/docs/Exercises.md +18 -0
  23. data/docs/ExercisesApi.md +214 -0
  24. data/docs/HeartRate.md +20 -0
  25. data/docs/NightlyRecharge.md +38 -0
  26. data/docs/NightlyRechargeApi.md +144 -0
  27. data/docs/Nights.md +18 -0
  28. data/docs/PhysicalInfoApi.md +294 -0
  29. data/docs/PhysicalInformation.md +40 -0
  30. data/docs/PhysicalInformations.md +18 -0
  31. data/docs/PullNotificationsApi.md +75 -0
  32. data/docs/Recharges.md +18 -0
  33. data/docs/Register.md +18 -0
  34. data/docs/Sample.md +22 -0
  35. data/docs/Samples.md +18 -0
  36. data/docs/Sleep.md +64 -0
  37. data/docs/SleepApi.md +211 -0
  38. data/docs/TrainingDataApi.md +744 -0
  39. data/docs/TransactionLocation.md +20 -0
  40. data/docs/User.md +36 -0
  41. data/docs/UserExtraInfo.md +22 -0
  42. data/docs/UsersApi.md +216 -0
  43. data/docs/WebhookInfo.md +18 -0
  44. data/docs/WebhookInfoData.md +22 -0
  45. data/docs/WebhookPatch.md +20 -0
  46. data/docs/WebhookPayloadExercise.md +26 -0
  47. data/docs/WebhookPayloadSleep.md +26 -0
  48. data/docs/WebhookPing.md +20 -0
  49. data/docs/WebhookRequest.md +20 -0
  50. data/docs/WebhookType.md +15 -0
  51. data/docs/WebhooksApi.md +289 -0
  52. data/docs/Zone.md +24 -0
  53. data/docs/Zones.md +18 -0
  54. data/git_push.sh +58 -0
  55. data/lib/polar-accesslink-api-gem/api/daily_activity_api.rb +469 -0
  56. data/lib/polar-accesslink-api-gem/api/exercises_api.rb +205 -0
  57. data/lib/polar-accesslink-api-gem/api/nightly_recharge_api.rb +142 -0
  58. data/lib/polar-accesslink-api-gem/api/physical_info_api.rb +296 -0
  59. data/lib/polar-accesslink-api-gem/api/pull_notifications_api.rb +79 -0
  60. data/lib/polar-accesslink-api-gem/api/sleep_api.rb +199 -0
  61. data/lib/polar-accesslink-api-gem/api/training_data_api.rb +785 -0
  62. data/lib/polar-accesslink-api-gem/api/users_api.rb +221 -0
  63. data/lib/polar-accesslink-api-gem/api/webhooks_api.rb +278 -0
  64. data/lib/polar-accesslink-api-gem/api_client.rb +390 -0
  65. data/lib/polar-accesslink-api-gem/api_error.rb +57 -0
  66. data/lib/polar-accesslink-api-gem/configuration.rb +284 -0
  67. data/lib/polar-accesslink-api-gem/models/activity.rb +300 -0
  68. data/lib/polar-accesslink-api-gem/models/activity_log.rb +222 -0
  69. data/lib/polar-accesslink-api-gem/models/activity_step_sample.rb +230 -0
  70. data/lib/polar-accesslink-api-gem/models/activity_step_samples.rb +232 -0
  71. data/lib/polar-accesslink-api-gem/models/activity_zone_sample.rb +232 -0
  72. data/lib/polar-accesslink-api-gem/models/activity_zone_samples.rb +232 -0
  73. data/lib/polar-accesslink-api-gem/models/available_sleep.rb +239 -0
  74. data/lib/polar-accesslink-api-gem/models/available_sleeps.rb +221 -0
  75. data/lib/polar-accesslink-api-gem/models/available_user_data.rb +274 -0
  76. data/lib/polar-accesslink-api-gem/models/available_user_datas.rb +222 -0
  77. data/lib/polar-accesslink-api-gem/models/created_webhook.rb +218 -0
  78. data/lib/polar-accesslink-api-gem/models/created_webhook_data.rb +248 -0
  79. data/lib/polar-accesslink-api-gem/models/duration_zone.rb +230 -0
  80. data/lib/polar-accesslink-api-gem/models/error.rb +260 -0
  81. data/lib/polar-accesslink-api-gem/models/exercise.rb +399 -0
  82. data/lib/polar-accesslink-api-gem/models/exercise_hash_id.rb +389 -0
  83. data/lib/polar-accesslink-api-gem/models/exercises.rb +222 -0
  84. data/lib/polar-accesslink-api-gem/models/heart_rate.rb +230 -0
  85. data/lib/polar-accesslink-api-gem/models/nightly_recharge.rb +319 -0
  86. data/lib/polar-accesslink-api-gem/models/nights.rb +222 -0
  87. data/lib/polar-accesslink-api-gem/models/physical_information.rb +364 -0
  88. data/lib/polar-accesslink-api-gem/models/physical_informations.rb +222 -0
  89. data/lib/polar-accesslink-api-gem/models/recharges.rb +222 -0
  90. data/lib/polar-accesslink-api-gem/models/register.rb +225 -0
  91. data/lib/polar-accesslink-api-gem/models/sample.rb +240 -0
  92. data/lib/polar-accesslink-api-gem/models/samples.rb +222 -0
  93. data/lib/polar-accesslink-api-gem/models/sleep.rb +449 -0
  94. data/lib/polar-accesslink-api-gem/models/transaction_location.rb +230 -0
  95. data/lib/polar-accesslink-api-gem/models/user.rb +346 -0
  96. data/lib/polar-accesslink-api-gem/models/user_extra_info.rb +240 -0
  97. data/lib/polar-accesslink-api-gem/models/webhook_info.rb +218 -0
  98. data/lib/polar-accesslink-api-gem/models/webhook_info_data.rb +238 -0
  99. data/lib/polar-accesslink-api-gem/models/webhook_patch.rb +231 -0
  100. data/lib/polar-accesslink-api-gem/models/webhook_payload_exercise.rb +260 -0
  101. data/lib/polar-accesslink-api-gem/models/webhook_payload_sleep.rb +260 -0
  102. data/lib/polar-accesslink-api-gem/models/webhook_ping.rb +264 -0
  103. data/lib/polar-accesslink-api-gem/models/webhook_request.rb +241 -0
  104. data/lib/polar-accesslink-api-gem/models/webhook_type.rb +36 -0
  105. data/lib/polar-accesslink-api-gem/models/zone.rb +250 -0
  106. data/lib/polar-accesslink-api-gem/models/zones.rb +222 -0
  107. data/lib/polar-accesslink-api-gem/version.rb +15 -0
  108. data/lib/polar-accesslink-api-gem.rb +88 -0
  109. data/polar-accesslink-api-gem.gemspec +38 -0
  110. data/spec/api/daily_activity_api_spec.rb +114 -0
  111. data/spec/api/exercises_api_spec.rb +70 -0
  112. data/spec/api/nightly_recharge_api_spec.rb +58 -0
  113. data/spec/api/physical_info_api_spec.rb +87 -0
  114. data/spec/api/pull_notifications_api_spec.rb +46 -0
  115. data/spec/api/sleep_api_spec.rb +69 -0
  116. data/spec/api/training_data_api_spec.rb +173 -0
  117. data/spec/api/users_api_spec.rb +71 -0
  118. data/spec/api/webhooks_api_spec.rb +83 -0
  119. data/spec/api_client_spec.rb +226 -0
  120. data/spec/configuration_spec.rb +42 -0
  121. data/spec/models/activity_log_spec.rb +34 -0
  122. data/spec/models/activity_spec.rb +82 -0
  123. data/spec/models/activity_step_sample_spec.rb +40 -0
  124. data/spec/models/activity_step_samples_spec.rb +40 -0
  125. data/spec/models/activity_zone_sample_spec.rb +40 -0
  126. data/spec/models/activity_zone_samples_spec.rb +40 -0
  127. data/spec/models/available_sleep_spec.rb +46 -0
  128. data/spec/models/available_sleeps_spec.rb +34 -0
  129. data/spec/models/available_user_data_spec.rb +50 -0
  130. data/spec/models/available_user_datas_spec.rb +34 -0
  131. data/spec/models/created_webhook_data_spec.rb +52 -0
  132. data/spec/models/created_webhook_spec.rb +34 -0
  133. data/spec/models/duration_zone_spec.rb +40 -0
  134. data/spec/models/error_spec.rb +58 -0
  135. data/spec/models/exercise_hash_id_spec.rb +136 -0
  136. data/spec/models/exercise_spec.rb +142 -0
  137. data/spec/models/exercises_spec.rb +34 -0
  138. data/spec/models/heart_rate_spec.rb +40 -0
  139. data/spec/models/nightly_recharge_spec.rb +94 -0
  140. data/spec/models/nights_spec.rb +34 -0
  141. data/spec/models/physical_information_spec.rb +104 -0
  142. data/spec/models/physical_informations_spec.rb +34 -0
  143. data/spec/models/recharges_spec.rb +34 -0
  144. data/spec/models/register_spec.rb +34 -0
  145. data/spec/models/sample_spec.rb +46 -0
  146. data/spec/models/samples_spec.rb +34 -0
  147. data/spec/models/sleep_spec.rb +172 -0
  148. data/spec/models/transaction_location_spec.rb +40 -0
  149. data/spec/models/user_extra_info_spec.rb +46 -0
  150. data/spec/models/user_spec.rb +92 -0
  151. data/spec/models/webhook_info_data_spec.rb +46 -0
  152. data/spec/models/webhook_info_spec.rb +34 -0
  153. data/spec/models/webhook_patch_spec.rb +40 -0
  154. data/spec/models/webhook_payload_exercise_spec.rb +58 -0
  155. data/spec/models/webhook_payload_sleep_spec.rb +58 -0
  156. data/spec/models/webhook_ping_spec.rb +44 -0
  157. data/spec/models/webhook_request_spec.rb +40 -0
  158. data/spec/models/webhook_type_spec.rb +28 -0
  159. data/spec/models/zone_spec.rb +52 -0
  160. data/spec/models/zones_spec.rb +34 -0
  161. data/spec/spec_helper.rb +111 -0
  162. metadata +295 -0
@@ -0,0 +1,221 @@
1
+ =begin
2
+ #Polar Accesslink API
3
+
4
+ #Polar Accesslink API documentation
5
+
6
+ The version of the OpenAPI document: 3.78.0
7
+ Contact: b2bhelpdesk@polar.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.2.1
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module PolarAccesslinkApiGem
16
+ class UsersApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Delete user
23
+ # When partner wishes no longer to receive user data, user can be de-registered.This will revoke the access token authorized by user.
24
+ # @param user_id [Integer] User identifier
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [nil]
27
+ def delete_user(user_id, opts = {})
28
+ delete_user_with_http_info(user_id, opts)
29
+ nil
30
+ end
31
+
32
+ # Delete user
33
+ # When partner wishes no longer to receive user data, user can be de-registered.This will revoke the access token authorized by user.
34
+ # @param user_id [Integer] User identifier
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
37
+ def delete_user_with_http_info(user_id, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: UsersApi.delete_user ...'
40
+ end
41
+ # verify the required parameter 'user_id' is set
42
+ if @api_client.config.client_side_validation && user_id.nil?
43
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling UsersApi.delete_user"
44
+ end
45
+ pattern = Regexp.new(/[0-9]+/)
46
+ if @api_client.config.client_side_validation && user_id !~ pattern
47
+ fail ArgumentError, "invalid value for 'user_id' when calling UsersApi.delete_user, must conform to the pattern #{pattern}."
48
+ end
49
+
50
+ # resource path
51
+ local_var_path = '/v3/users/{user-id}'.sub('{' + 'user-id' + '}', CGI.escape(user_id.to_s))
52
+
53
+ # query parameters
54
+ query_params = opts[:query_params] || {}
55
+
56
+ # header parameters
57
+ header_params = opts[:header_params] || {}
58
+
59
+ # form parameters
60
+ form_params = opts[:form_params] || {}
61
+
62
+ # http body (model)
63
+ post_body = opts[:debug_body]
64
+
65
+ # return_type
66
+ return_type = opts[:debug_return_type]
67
+
68
+ # auth_names
69
+ auth_names = opts[:debug_auth_names] || ['OAuth2']
70
+
71
+ new_options = opts.merge(
72
+ :operation => :"UsersApi.delete_user",
73
+ :header_params => header_params,
74
+ :query_params => query_params,
75
+ :form_params => form_params,
76
+ :body => post_body,
77
+ :auth_names => auth_names,
78
+ :return_type => return_type
79
+ )
80
+
81
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
82
+ if @api_client.config.debugging
83
+ @api_client.config.logger.debug "API called: UsersApi#delete_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
84
+ end
85
+ return data, status_code, headers
86
+ end
87
+
88
+ # Get user information
89
+ # List user basic information. Note: Although it is possible to get users weight and height from this resource, the [get physical info](#get-physical-info) should be used instead.
90
+ # @param user_id [Integer] User identifier
91
+ # @param [Hash] opts the optional parameters
92
+ # @return [User]
93
+ def get_user_information(user_id, opts = {})
94
+ data, _status_code, _headers = get_user_information_with_http_info(user_id, opts)
95
+ data
96
+ end
97
+
98
+ # Get user information
99
+ # List user basic information. Note: Although it is possible to get users weight and height from this resource, the [get physical info](#get-physical-info) should be used instead.
100
+ # @param user_id [Integer] User identifier
101
+ # @param [Hash] opts the optional parameters
102
+ # @return [Array<(User, Integer, Hash)>] User data, response status code and response headers
103
+ def get_user_information_with_http_info(user_id, opts = {})
104
+ if @api_client.config.debugging
105
+ @api_client.config.logger.debug 'Calling API: UsersApi.get_user_information ...'
106
+ end
107
+ # verify the required parameter 'user_id' is set
108
+ if @api_client.config.client_side_validation && user_id.nil?
109
+ fail ArgumentError, "Missing the required parameter 'user_id' when calling UsersApi.get_user_information"
110
+ end
111
+ pattern = Regexp.new(/[0-9]+/)
112
+ if @api_client.config.client_side_validation && user_id !~ pattern
113
+ fail ArgumentError, "invalid value for 'user_id' when calling UsersApi.get_user_information, must conform to the pattern #{pattern}."
114
+ end
115
+
116
+ # resource path
117
+ local_var_path = '/v3/users/{user-id}'.sub('{' + 'user-id' + '}', CGI.escape(user_id.to_s))
118
+
119
+ # query parameters
120
+ query_params = opts[:query_params] || {}
121
+
122
+ # header parameters
123
+ header_params = opts[:header_params] || {}
124
+ # HTTP header 'Accept' (if needed)
125
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])
126
+
127
+ # form parameters
128
+ form_params = opts[:form_params] || {}
129
+
130
+ # http body (model)
131
+ post_body = opts[:debug_body]
132
+
133
+ # return_type
134
+ return_type = opts[:debug_return_type] || 'User'
135
+
136
+ # auth_names
137
+ auth_names = opts[:debug_auth_names] || ['OAuth2']
138
+
139
+ new_options = opts.merge(
140
+ :operation => :"UsersApi.get_user_information",
141
+ :header_params => header_params,
142
+ :query_params => query_params,
143
+ :form_params => form_params,
144
+ :body => post_body,
145
+ :auth_names => auth_names,
146
+ :return_type => return_type
147
+ )
148
+
149
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
150
+ if @api_client.config.debugging
151
+ @api_client.config.logger.debug "API called: UsersApi#get_user_information\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
152
+ end
153
+ return data, status_code, headers
154
+ end
155
+
156
+ # Register user
157
+ # Once partner has been authorized by user, partner must register the user before being able to access its data. API user-id and Polar User Id (polar-user-id) are interchangeable terms.
158
+ # @param register [Register]
159
+ # @param [Hash] opts the optional parameters
160
+ # @return [User]
161
+ def register_user(register, opts = {})
162
+ data, _status_code, _headers = register_user_with_http_info(register, opts)
163
+ data
164
+ end
165
+
166
+ # Register user
167
+ # Once partner has been authorized by user, partner must register the user before being able to access its data. API user-id and Polar User Id (polar-user-id) are interchangeable terms.
168
+ # @param register [Register]
169
+ # @param [Hash] opts the optional parameters
170
+ # @return [Array<(User, Integer, Hash)>] User data, response status code and response headers
171
+ def register_user_with_http_info(register, opts = {})
172
+ if @api_client.config.debugging
173
+ @api_client.config.logger.debug 'Calling API: UsersApi.register_user ...'
174
+ end
175
+ # verify the required parameter 'register' is set
176
+ if @api_client.config.client_side_validation && register.nil?
177
+ fail ArgumentError, "Missing the required parameter 'register' when calling UsersApi.register_user"
178
+ end
179
+ # resource path
180
+ local_var_path = '/v3/users'
181
+
182
+ # query parameters
183
+ query_params = opts[:query_params] || {}
184
+
185
+ # header parameters
186
+ header_params = opts[:header_params] || {}
187
+ # HTTP header 'Accept' (if needed)
188
+ header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])
189
+ # HTTP header 'Content-Type'
190
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/xml', 'application/json'])
191
+
192
+ # form parameters
193
+ form_params = opts[:form_params] || {}
194
+
195
+ # http body (model)
196
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(register)
197
+
198
+ # return_type
199
+ return_type = opts[:debug_return_type] || 'User'
200
+
201
+ # auth_names
202
+ auth_names = opts[:debug_auth_names] || ['OAuth2']
203
+
204
+ new_options = opts.merge(
205
+ :operation => :"UsersApi.register_user",
206
+ :header_params => header_params,
207
+ :query_params => query_params,
208
+ :form_params => form_params,
209
+ :body => post_body,
210
+ :auth_names => auth_names,
211
+ :return_type => return_type
212
+ )
213
+
214
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
215
+ if @api_client.config.debugging
216
+ @api_client.config.logger.debug "API called: UsersApi#register_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
217
+ end
218
+ return data, status_code, headers
219
+ end
220
+ end
221
+ end
@@ -0,0 +1,278 @@
1
+ =begin
2
+ #Polar Accesslink API
3
+
4
+ #Polar Accesslink API documentation
5
+
6
+ The version of the OpenAPI document: 3.78.0
7
+ Contact: b2bhelpdesk@polar.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.2.1
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module PolarAccesslinkApiGem
16
+ class WebhooksApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create webhook
23
+ # Create new webhook. When creating webhook the Accesslink sends a ping message to the url in request body. The ping message must be answered with 200 OK or otherwise the webhook is not created. **Note!** Save the *signature_secret_key* from response since this is the only chance to get it.
24
+ # @param webhook_request [WebhookRequest] Webhook to create.
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [CreatedWebhook]
27
+ def create_webhook(webhook_request, opts = {})
28
+ data, _status_code, _headers = create_webhook_with_http_info(webhook_request, opts)
29
+ data
30
+ end
31
+
32
+ # Create webhook
33
+ # Create new webhook. When creating webhook the Accesslink sends a ping message to the url in request body. The ping message must be answered with 200 OK or otherwise the webhook is not created. **Note!** Save the *signature_secret_key* from response since this is the only chance to get it.
34
+ # @param webhook_request [WebhookRequest] Webhook to create.
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(CreatedWebhook, Integer, Hash)>] CreatedWebhook data, response status code and response headers
37
+ def create_webhook_with_http_info(webhook_request, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: WebhooksApi.create_webhook ...'
40
+ end
41
+ # verify the required parameter 'webhook_request' is set
42
+ if @api_client.config.client_side_validation && webhook_request.nil?
43
+ fail ArgumentError, "Missing the required parameter 'webhook_request' when calling WebhooksApi.create_webhook"
44
+ end
45
+ # resource path
46
+ local_var_path = '/v3/webhooks'
47
+
48
+ # query parameters
49
+ query_params = opts[:query_params] || {}
50
+
51
+ # header parameters
52
+ header_params = opts[:header_params] || {}
53
+ # HTTP header 'Accept' (if needed)
54
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
55
+ # HTTP header 'Content-Type'
56
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
57
+
58
+ # form parameters
59
+ form_params = opts[:form_params] || {}
60
+
61
+ # http body (model)
62
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(webhook_request)
63
+
64
+ # return_type
65
+ return_type = opts[:debug_return_type] || 'CreatedWebhook'
66
+
67
+ # auth_names
68
+ auth_names = opts[:debug_auth_names] || ['Basic']
69
+
70
+ new_options = opts.merge(
71
+ :operation => :"WebhooksApi.create_webhook",
72
+ :header_params => header_params,
73
+ :query_params => query_params,
74
+ :form_params => form_params,
75
+ :body => post_body,
76
+ :auth_names => auth_names,
77
+ :return_type => return_type
78
+ )
79
+
80
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
81
+ if @api_client.config.debugging
82
+ @api_client.config.logger.debug "API called: WebhooksApi#create_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
83
+ end
84
+ return data, status_code, headers
85
+ end
86
+
87
+ # Delete webhook
88
+ # Delete webhook by id.
89
+ # @param webhook_id [Integer] Webhook id to delete
90
+ # @param [Hash] opts the optional parameters
91
+ # @return [nil]
92
+ def delete_webhook(webhook_id, opts = {})
93
+ delete_webhook_with_http_info(webhook_id, opts)
94
+ nil
95
+ end
96
+
97
+ # Delete webhook
98
+ # Delete webhook by id.
99
+ # @param webhook_id [Integer] Webhook id to delete
100
+ # @param [Hash] opts the optional parameters
101
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
102
+ def delete_webhook_with_http_info(webhook_id, opts = {})
103
+ if @api_client.config.debugging
104
+ @api_client.config.logger.debug 'Calling API: WebhooksApi.delete_webhook ...'
105
+ end
106
+ # verify the required parameter 'webhook_id' is set
107
+ if @api_client.config.client_side_validation && webhook_id.nil?
108
+ fail ArgumentError, "Missing the required parameter 'webhook_id' when calling WebhooksApi.delete_webhook"
109
+ end
110
+ # resource path
111
+ local_var_path = '/v3/webhooks/{webhook-id}'.sub('{' + 'webhook-id' + '}', CGI.escape(webhook_id.to_s))
112
+
113
+ # query parameters
114
+ query_params = opts[:query_params] || {}
115
+
116
+ # header parameters
117
+ header_params = opts[:header_params] || {}
118
+ # HTTP header 'Accept' (if needed)
119
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
120
+
121
+ # form parameters
122
+ form_params = opts[:form_params] || {}
123
+
124
+ # http body (model)
125
+ post_body = opts[:debug_body]
126
+
127
+ # return_type
128
+ return_type = opts[:debug_return_type]
129
+
130
+ # auth_names
131
+ auth_names = opts[:debug_auth_names] || ['Basic']
132
+
133
+ new_options = opts.merge(
134
+ :operation => :"WebhooksApi.delete_webhook",
135
+ :header_params => header_params,
136
+ :query_params => query_params,
137
+ :form_params => form_params,
138
+ :body => post_body,
139
+ :auth_names => auth_names,
140
+ :return_type => return_type
141
+ )
142
+
143
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
144
+ if @api_client.config.debugging
145
+ @api_client.config.logger.debug "API called: WebhooksApi#delete_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
146
+ end
147
+ return data, status_code, headers
148
+ end
149
+
150
+ # Get webhook
151
+ # Returns created webhook if exists.
152
+ # @param [Hash] opts the optional parameters
153
+ # @return [WebhookInfo]
154
+ def get_webhook(opts = {})
155
+ data, _status_code, _headers = get_webhook_with_http_info(opts)
156
+ data
157
+ end
158
+
159
+ # Get webhook
160
+ # Returns created webhook if exists.
161
+ # @param [Hash] opts the optional parameters
162
+ # @return [Array<(WebhookInfo, Integer, Hash)>] WebhookInfo data, response status code and response headers
163
+ def get_webhook_with_http_info(opts = {})
164
+ if @api_client.config.debugging
165
+ @api_client.config.logger.debug 'Calling API: WebhooksApi.get_webhook ...'
166
+ end
167
+ # resource path
168
+ local_var_path = '/v3/webhooks'
169
+
170
+ # query parameters
171
+ query_params = opts[:query_params] || {}
172
+
173
+ # header parameters
174
+ header_params = opts[:header_params] || {}
175
+ # HTTP header 'Accept' (if needed)
176
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
177
+
178
+ # form parameters
179
+ form_params = opts[:form_params] || {}
180
+
181
+ # http body (model)
182
+ post_body = opts[:debug_body]
183
+
184
+ # return_type
185
+ return_type = opts[:debug_return_type] || 'WebhookInfo'
186
+
187
+ # auth_names
188
+ auth_names = opts[:debug_auth_names] || ['Basic']
189
+
190
+ new_options = opts.merge(
191
+ :operation => :"WebhooksApi.get_webhook",
192
+ :header_params => header_params,
193
+ :query_params => query_params,
194
+ :form_params => form_params,
195
+ :body => post_body,
196
+ :auth_names => auth_names,
197
+ :return_type => return_type
198
+ )
199
+
200
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
201
+ if @api_client.config.debugging
202
+ @api_client.config.logger.debug "API called: WebhooksApi#get_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
203
+ end
204
+ return data, status_code, headers
205
+ end
206
+
207
+ # Update webhook
208
+ # Edit webhook event types and/or url. When updating webhook url the Accesslink sends a ping message to the new address. The ping message must be answered with 200 OK or otherwise the webhook is not updated.
209
+ # @param webhook_id [Integer] Webhook id to update
210
+ # @param webhook_patch [WebhookPatch] New value(s) for events and/or url.
211
+ # @param [Hash] opts the optional parameters
212
+ # @return [WebhookInfo]
213
+ def update_webhook(webhook_id, webhook_patch, opts = {})
214
+ data, _status_code, _headers = update_webhook_with_http_info(webhook_id, webhook_patch, opts)
215
+ data
216
+ end
217
+
218
+ # Update webhook
219
+ # Edit webhook event types and/or url. When updating webhook url the Accesslink sends a ping message to the new address. The ping message must be answered with 200 OK or otherwise the webhook is not updated.
220
+ # @param webhook_id [Integer] Webhook id to update
221
+ # @param webhook_patch [WebhookPatch] New value(s) for events and/or url.
222
+ # @param [Hash] opts the optional parameters
223
+ # @return [Array<(WebhookInfo, Integer, Hash)>] WebhookInfo data, response status code and response headers
224
+ def update_webhook_with_http_info(webhook_id, webhook_patch, opts = {})
225
+ if @api_client.config.debugging
226
+ @api_client.config.logger.debug 'Calling API: WebhooksApi.update_webhook ...'
227
+ end
228
+ # verify the required parameter 'webhook_id' is set
229
+ if @api_client.config.client_side_validation && webhook_id.nil?
230
+ fail ArgumentError, "Missing the required parameter 'webhook_id' when calling WebhooksApi.update_webhook"
231
+ end
232
+ # verify the required parameter 'webhook_patch' is set
233
+ if @api_client.config.client_side_validation && webhook_patch.nil?
234
+ fail ArgumentError, "Missing the required parameter 'webhook_patch' when calling WebhooksApi.update_webhook"
235
+ end
236
+ # resource path
237
+ local_var_path = '/v3/webhooks/{webhook-id}'.sub('{' + 'webhook-id' + '}', CGI.escape(webhook_id.to_s))
238
+
239
+ # query parameters
240
+ query_params = opts[:query_params] || {}
241
+
242
+ # header parameters
243
+ header_params = opts[:header_params] || {}
244
+ # HTTP header 'Accept' (if needed)
245
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
246
+ # HTTP header 'Content-Type'
247
+ header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
248
+
249
+ # form parameters
250
+ form_params = opts[:form_params] || {}
251
+
252
+ # http body (model)
253
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(webhook_patch)
254
+
255
+ # return_type
256
+ return_type = opts[:debug_return_type] || 'WebhookInfo'
257
+
258
+ # auth_names
259
+ auth_names = opts[:debug_auth_names] || ['Basic']
260
+
261
+ new_options = opts.merge(
262
+ :operation => :"WebhooksApi.update_webhook",
263
+ :header_params => header_params,
264
+ :query_params => query_params,
265
+ :form_params => form_params,
266
+ :body => post_body,
267
+ :auth_names => auth_names,
268
+ :return_type => return_type
269
+ )
270
+
271
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
272
+ if @api_client.config.debugging
273
+ @api_client.config.logger.debug "API called: WebhooksApi#update_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
274
+ end
275
+ return data, status_code, headers
276
+ end
277
+ end
278
+ end