cbox_billing 0.1.0 → 0.2.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 (48) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cbox_billing/api/checkout_portal_api.rb +214 -0
  3. data/lib/cbox_billing/api/coupons_api.rb +55 -55
  4. data/lib/cbox_billing/api/experiments_api.rb +526 -0
  5. data/lib/cbox_billing/api/organizations_api.rb +554 -0
  6. data/lib/cbox_billing/api/pricing_tables_api.rb +519 -0
  7. data/lib/cbox_billing/api/retention_api.rb +884 -0
  8. data/lib/cbox_billing/api/sellers_api.rb +590 -0
  9. data/lib/cbox_billing/models/checkout_link.rb +283 -0
  10. data/lib/cbox_billing/models/conclude_experiment_request.rb +161 -0
  11. data/lib/cbox_billing/models/create_checkout_link_request.rb +178 -0
  12. data/lib/cbox_billing/models/customer_lifecycle_refusal.rb +238 -0
  13. data/lib/cbox_billing/models/customer_lifecycle_state.rb +268 -0
  14. data/lib/cbox_billing/models/delete_experiment200_response.rb +227 -0
  15. data/lib/cbox_billing/models/delete_organization200_response.rb +227 -0
  16. data/lib/cbox_billing/models/experiment.rb +387 -0
  17. data/lib/cbox_billing/models/experiment_input.rb +410 -0
  18. data/lib/cbox_billing/models/experiment_input_variants_inner.rb +233 -0
  19. data/lib/cbox_billing/models/experiment_variant.rb +266 -0
  20. data/lib/cbox_billing/models/list_checkout_links200_response.rb +179 -0
  21. data/lib/cbox_billing/models/list_checkout_links200_response_data_inner.rb +223 -0
  22. data/lib/cbox_billing/models/list_experiments200_response.rb +179 -0
  23. data/lib/cbox_billing/models/list_pricing_tables200_response.rb +179 -0
  24. data/lib/cbox_billing/models/list_retention_offers200_response.rb +179 -0
  25. data/lib/cbox_billing/models/list_retention_reasons200_response.rb +179 -0
  26. data/lib/cbox_billing/models/list_sellers200_response.rb +179 -0
  27. data/lib/cbox_billing/models/merge_organization_request.rb +221 -0
  28. data/lib/cbox_billing/models/merge_organization_request_fields.rb +279 -0
  29. data/lib/cbox_billing/models/preview_organization_merge200_response.rb +343 -0
  30. data/lib/cbox_billing/models/preview_organization_merge_request.rb +177 -0
  31. data/lib/cbox_billing/models/pricing_table.rb +426 -0
  32. data/lib/cbox_billing/models/pricing_table_column.rb +248 -0
  33. data/lib/cbox_billing/models/pricing_table_input.rb +388 -0
  34. data/lib/cbox_billing/models/retention_offer.rb +389 -0
  35. data/lib/cbox_billing/models/retention_offer_input.rb +447 -0
  36. data/lib/cbox_billing/models/retention_reason.rb +282 -0
  37. data/lib/cbox_billing/models/retention_reason_input.rb +195 -0
  38. data/lib/cbox_billing/models/revoke_checkout_link200_response.rb +227 -0
  39. data/lib/cbox_billing/models/seller.rb +551 -0
  40. data/lib/cbox_billing/models/seller_address.rb +201 -0
  41. data/lib/cbox_billing/models/seller_bank.rb +191 -0
  42. data/lib/cbox_billing/models/seller_input.rb +633 -0
  43. data/lib/cbox_billing/models/seller_input_registrations_inner.rb +188 -0
  44. data/lib/cbox_billing/models/seller_registrations_inner.rb +189 -0
  45. data/lib/cbox_billing/models/suspend_organization_request.rb +179 -0
  46. data/lib/cbox_billing/version.rb +1 -1
  47. data/lib/cbox_billing.rb +41 -0
  48. metadata +42 -1
@@ -0,0 +1,884 @@
1
+ =begin
2
+ #Cbox Billing API
3
+
4
+ #The HTTP API of Cbox Billing. Reference: https://github.com/cboxdk/cbox-billing/tree/main/docs/api
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.26.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module CboxBilling
16
+ class RetentionApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Turn on a save offer
23
+ # Cancelling subscribers are shown it. Operator token only. 404 without the retention licence; 403 `plugin_not_in_plan` when the plan leaves the plugin out.
24
+ # @param id [String] The save offer's id, such as `roff_2Kp8`.
25
+ # @param [Hash] opts the optional parameters
26
+ # @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is `409`.
27
+ # @return [RetentionOffer]
28
+ def activate_retention_offer(id, opts = {})
29
+ data, _status_code, _headers = activate_retention_offer_with_http_info(id, opts)
30
+ data
31
+ end
32
+
33
+ # Turn on a save offer
34
+ # Cancelling subscribers are shown it. Operator token only. 404 without the retention licence; 403 `plugin_not_in_plan` when the plan leaves the plugin out.
35
+ # @param id [String] The save offer's id, such as `roff_2Kp8`.
36
+ # @param [Hash] opts the optional parameters
37
+ # @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is `409`.
38
+ # @return [Array<(RetentionOffer, Integer, Hash)>] RetentionOffer data, response status code and response headers
39
+ def activate_retention_offer_with_http_info(id, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: RetentionApi.activate_retention_offer ...'
42
+ end
43
+ # verify the required parameter 'id' is set
44
+ if @api_client.config.client_side_validation && id.nil?
45
+ fail ArgumentError, "Missing the required parameter 'id' when calling RetentionApi.activate_retention_offer"
46
+ end
47
+ pattern = Regexp.new(/^roff_[A-Za-z0-9]+$/)
48
+ if @api_client.config.client_side_validation && id !~ pattern
49
+ fail ArgumentError, "invalid value for 'id' when calling RetentionApi.activate_retention_offer, must conform to the pattern #{pattern}."
50
+ end
51
+
52
+ # resource path
53
+ local_var_path = '/retention/offers/{id}/activate'.sub('{id}', CGI.escape(id.to_s))
54
+
55
+ # query parameters
56
+ query_params = opts[:query_params] || {}
57
+
58
+ # header parameters
59
+ header_params = opts[:header_params] || {}
60
+ # HTTP header 'Accept' (if needed)
61
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
62
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
63
+
64
+ # form parameters
65
+ form_params = opts[:form_params] || {}
66
+
67
+ # http body (model)
68
+ post_body = opts[:debug_body]
69
+
70
+ # return_type
71
+ return_type = opts[:debug_return_type] || 'RetentionOffer'
72
+
73
+ # auth_names
74
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
75
+
76
+ new_options = opts.merge(
77
+ :operation => :"RetentionApi.activate_retention_offer",
78
+ :header_params => header_params,
79
+ :query_params => query_params,
80
+ :form_params => form_params,
81
+ :body => post_body,
82
+ :auth_names => auth_names,
83
+ :return_type => return_type
84
+ )
85
+
86
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
87
+ if @api_client.config.debugging
88
+ @api_client.config.logger.debug "API called: RetentionApi#activate_retention_offer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
89
+ end
90
+ return data, status_code, headers
91
+ end
92
+
93
+ # Turn on a cancellation reason
94
+ # The survey lists it. Operator token only. 404 without the retention licence; 403 `plugin_not_in_plan` when the plan leaves the plugin out.
95
+ # @param id [String] The cancellation reason&#39;s id, such as &#x60;rrsn_6Tn3&#x60;.
96
+ # @param [Hash] opts the optional parameters
97
+ # @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is &#x60;409&#x60;.
98
+ # @return [RetentionReason]
99
+ def activate_retention_reason(id, opts = {})
100
+ data, _status_code, _headers = activate_retention_reason_with_http_info(id, opts)
101
+ data
102
+ end
103
+
104
+ # Turn on a cancellation reason
105
+ # The survey lists it. Operator token only. 404 without the retention licence; 403 &#x60;plugin_not_in_plan&#x60; when the plan leaves the plugin out.
106
+ # @param id [String] The cancellation reason&#39;s id, such as &#x60;rrsn_6Tn3&#x60;.
107
+ # @param [Hash] opts the optional parameters
108
+ # @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is &#x60;409&#x60;.
109
+ # @return [Array<(RetentionReason, Integer, Hash)>] RetentionReason data, response status code and response headers
110
+ def activate_retention_reason_with_http_info(id, opts = {})
111
+ if @api_client.config.debugging
112
+ @api_client.config.logger.debug 'Calling API: RetentionApi.activate_retention_reason ...'
113
+ end
114
+ # verify the required parameter 'id' is set
115
+ if @api_client.config.client_side_validation && id.nil?
116
+ fail ArgumentError, "Missing the required parameter 'id' when calling RetentionApi.activate_retention_reason"
117
+ end
118
+ pattern = Regexp.new(/^rrsn_[A-Za-z0-9]+$/)
119
+ if @api_client.config.client_side_validation && id !~ pattern
120
+ fail ArgumentError, "invalid value for 'id' when calling RetentionApi.activate_retention_reason, must conform to the pattern #{pattern}."
121
+ end
122
+
123
+ # resource path
124
+ local_var_path = '/retention/reasons/{id}/activate'.sub('{id}', CGI.escape(id.to_s))
125
+
126
+ # query parameters
127
+ query_params = opts[:query_params] || {}
128
+
129
+ # header parameters
130
+ header_params = opts[:header_params] || {}
131
+ # HTTP header 'Accept' (if needed)
132
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
133
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
134
+
135
+ # form parameters
136
+ form_params = opts[:form_params] || {}
137
+
138
+ # http body (model)
139
+ post_body = opts[:debug_body]
140
+
141
+ # return_type
142
+ return_type = opts[:debug_return_type] || 'RetentionReason'
143
+
144
+ # auth_names
145
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
146
+
147
+ new_options = opts.merge(
148
+ :operation => :"RetentionApi.activate_retention_reason",
149
+ :header_params => header_params,
150
+ :query_params => query_params,
151
+ :form_params => form_params,
152
+ :body => post_body,
153
+ :auth_names => auth_names,
154
+ :return_type => return_type
155
+ )
156
+
157
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
158
+ if @api_client.config.debugging
159
+ @api_client.config.logger.debug "API called: RetentionApi#activate_retention_reason\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
160
+ end
161
+ return data, status_code, headers
162
+ end
163
+
164
+ # Add a save offer
165
+ # An offer a cancelling subscriber is shown instead of cancelling: a discount for some cycles, free months (with optional credit), a pause, a downgrade to a catalog price or a custom follow-up. Only the fields of its type are kept. The same fields as the console's form, which names them in camelCase. Operator token only. 404 without the retention licence; 403 `plugin_not_in_plan` when the plan leaves the plugin out.
166
+ # @param idempotency_key [String] An opaque, caller-generated key (at most 100 characters). Required: a missing key is &#x60;400 idempotency_key_required&#x60;. A retry with the same key replays the first response; reusing it with a different body is &#x60;409&#x60;.
167
+ # @param retention_offer_input [RetentionOfferInput]
168
+ # @param [Hash] opts the optional parameters
169
+ # @return [RetentionOffer]
170
+ def create_retention_offer(idempotency_key, retention_offer_input, opts = {})
171
+ data, _status_code, _headers = create_retention_offer_with_http_info(idempotency_key, retention_offer_input, opts)
172
+ data
173
+ end
174
+
175
+ # Add a save offer
176
+ # An offer a cancelling subscriber is shown instead of cancelling: a discount for some cycles, free months (with optional credit), a pause, a downgrade to a catalog price or a custom follow-up. Only the fields of its type are kept. The same fields as the console&#39;s form, which names them in camelCase. Operator token only. 404 without the retention licence; 403 &#x60;plugin_not_in_plan&#x60; when the plan leaves the plugin out.
177
+ # @param idempotency_key [String] An opaque, caller-generated key (at most 100 characters). Required: a missing key is &#x60;400 idempotency_key_required&#x60;. A retry with the same key replays the first response; reusing it with a different body is &#x60;409&#x60;.
178
+ # @param retention_offer_input [RetentionOfferInput]
179
+ # @param [Hash] opts the optional parameters
180
+ # @return [Array<(RetentionOffer, Integer, Hash)>] RetentionOffer data, response status code and response headers
181
+ def create_retention_offer_with_http_info(idempotency_key, retention_offer_input, opts = {})
182
+ if @api_client.config.debugging
183
+ @api_client.config.logger.debug 'Calling API: RetentionApi.create_retention_offer ...'
184
+ end
185
+ # verify the required parameter 'idempotency_key' is set
186
+ if @api_client.config.client_side_validation && idempotency_key.nil?
187
+ fail ArgumentError, "Missing the required parameter 'idempotency_key' when calling RetentionApi.create_retention_offer"
188
+ end
189
+ if @api_client.config.client_side_validation && idempotency_key.to_s.length > 100
190
+ fail ArgumentError, 'invalid value for "idempotency_key" when calling RetentionApi.create_retention_offer, the character length must be smaller than or equal to 100.'
191
+ end
192
+
193
+ # verify the required parameter 'retention_offer_input' is set
194
+ if @api_client.config.client_side_validation && retention_offer_input.nil?
195
+ fail ArgumentError, "Missing the required parameter 'retention_offer_input' when calling RetentionApi.create_retention_offer"
196
+ end
197
+ # resource path
198
+ local_var_path = '/retention/offers'
199
+
200
+ # query parameters
201
+ query_params = opts[:query_params] || {}
202
+
203
+ # header parameters
204
+ header_params = opts[:header_params] || {}
205
+ # HTTP header 'Accept' (if needed)
206
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
207
+ # HTTP header 'Content-Type'
208
+ content_type = @api_client.select_header_content_type(['application/json'])
209
+ if !content_type.nil?
210
+ header_params['Content-Type'] = content_type
211
+ end
212
+ header_params[:'Idempotency-Key'] = idempotency_key
213
+
214
+ # form parameters
215
+ form_params = opts[:form_params] || {}
216
+
217
+ # http body (model)
218
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(retention_offer_input)
219
+
220
+ # return_type
221
+ return_type = opts[:debug_return_type] || 'RetentionOffer'
222
+
223
+ # auth_names
224
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
225
+
226
+ new_options = opts.merge(
227
+ :operation => :"RetentionApi.create_retention_offer",
228
+ :header_params => header_params,
229
+ :query_params => query_params,
230
+ :form_params => form_params,
231
+ :body => post_body,
232
+ :auth_names => auth_names,
233
+ :return_type => return_type
234
+ )
235
+
236
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
237
+ if @api_client.config.debugging
238
+ @api_client.config.logger.debug "API called: RetentionApi#create_retention_offer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
239
+ end
240
+ return data, status_code, headers
241
+ end
242
+
243
+ # Add a cancellation reason
244
+ # Adds a reason the survey offers a cancelling subscriber. Its key is made from the label and never changes, because answers carry it. Operator token only. 404 without the retention licence; 403 `plugin_not_in_plan` when the plan leaves the plugin out.
245
+ # @param idempotency_key [String] An opaque, caller-generated key (at most 100 characters). Required: a missing key is &#x60;400 idempotency_key_required&#x60;. A retry with the same key replays the first response; reusing it with a different body is &#x60;409&#x60;.
246
+ # @param retention_reason_input [RetentionReasonInput]
247
+ # @param [Hash] opts the optional parameters
248
+ # @return [RetentionReason]
249
+ def create_retention_reason(idempotency_key, retention_reason_input, opts = {})
250
+ data, _status_code, _headers = create_retention_reason_with_http_info(idempotency_key, retention_reason_input, opts)
251
+ data
252
+ end
253
+
254
+ # Add a cancellation reason
255
+ # Adds a reason the survey offers a cancelling subscriber. Its key is made from the label and never changes, because answers carry it. Operator token only. 404 without the retention licence; 403 &#x60;plugin_not_in_plan&#x60; when the plan leaves the plugin out.
256
+ # @param idempotency_key [String] An opaque, caller-generated key (at most 100 characters). Required: a missing key is &#x60;400 idempotency_key_required&#x60;. A retry with the same key replays the first response; reusing it with a different body is &#x60;409&#x60;.
257
+ # @param retention_reason_input [RetentionReasonInput]
258
+ # @param [Hash] opts the optional parameters
259
+ # @return [Array<(RetentionReason, Integer, Hash)>] RetentionReason data, response status code and response headers
260
+ def create_retention_reason_with_http_info(idempotency_key, retention_reason_input, opts = {})
261
+ if @api_client.config.debugging
262
+ @api_client.config.logger.debug 'Calling API: RetentionApi.create_retention_reason ...'
263
+ end
264
+ # verify the required parameter 'idempotency_key' is set
265
+ if @api_client.config.client_side_validation && idempotency_key.nil?
266
+ fail ArgumentError, "Missing the required parameter 'idempotency_key' when calling RetentionApi.create_retention_reason"
267
+ end
268
+ if @api_client.config.client_side_validation && idempotency_key.to_s.length > 100
269
+ fail ArgumentError, 'invalid value for "idempotency_key" when calling RetentionApi.create_retention_reason, the character length must be smaller than or equal to 100.'
270
+ end
271
+
272
+ # verify the required parameter 'retention_reason_input' is set
273
+ if @api_client.config.client_side_validation && retention_reason_input.nil?
274
+ fail ArgumentError, "Missing the required parameter 'retention_reason_input' when calling RetentionApi.create_retention_reason"
275
+ end
276
+ # resource path
277
+ local_var_path = '/retention/reasons'
278
+
279
+ # query parameters
280
+ query_params = opts[:query_params] || {}
281
+
282
+ # header parameters
283
+ header_params = opts[:header_params] || {}
284
+ # HTTP header 'Accept' (if needed)
285
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
286
+ # HTTP header 'Content-Type'
287
+ content_type = @api_client.select_header_content_type(['application/json'])
288
+ if !content_type.nil?
289
+ header_params['Content-Type'] = content_type
290
+ end
291
+ header_params[:'Idempotency-Key'] = idempotency_key
292
+
293
+ # form parameters
294
+ form_params = opts[:form_params] || {}
295
+
296
+ # http body (model)
297
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(retention_reason_input)
298
+
299
+ # return_type
300
+ return_type = opts[:debug_return_type] || 'RetentionReason'
301
+
302
+ # auth_names
303
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
304
+
305
+ new_options = opts.merge(
306
+ :operation => :"RetentionApi.create_retention_reason",
307
+ :header_params => header_params,
308
+ :query_params => query_params,
309
+ :form_params => form_params,
310
+ :body => post_body,
311
+ :auth_names => auth_names,
312
+ :return_type => return_type
313
+ )
314
+
315
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
316
+ if @api_client.config.debugging
317
+ @api_client.config.logger.debug "API called: RetentionApi#create_retention_reason\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
318
+ end
319
+ return data, status_code, headers
320
+ end
321
+
322
+ # Turn off a save offer
323
+ # Cancelling subscribers stop being shown it; redemptions stay. Operator token only. 404 without the retention licence; 403 `plugin_not_in_plan` when the plan leaves the plugin out.
324
+ # @param id [String] The save offer&#39;s id, such as &#x60;roff_2Kp8&#x60;.
325
+ # @param [Hash] opts the optional parameters
326
+ # @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is &#x60;409&#x60;.
327
+ # @return [RetentionOffer]
328
+ def deactivate_retention_offer(id, opts = {})
329
+ data, _status_code, _headers = deactivate_retention_offer_with_http_info(id, opts)
330
+ data
331
+ end
332
+
333
+ # Turn off a save offer
334
+ # Cancelling subscribers stop being shown it; redemptions stay. Operator token only. 404 without the retention licence; 403 &#x60;plugin_not_in_plan&#x60; when the plan leaves the plugin out.
335
+ # @param id [String] The save offer&#39;s id, such as &#x60;roff_2Kp8&#x60;.
336
+ # @param [Hash] opts the optional parameters
337
+ # @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is &#x60;409&#x60;.
338
+ # @return [Array<(RetentionOffer, Integer, Hash)>] RetentionOffer data, response status code and response headers
339
+ def deactivate_retention_offer_with_http_info(id, opts = {})
340
+ if @api_client.config.debugging
341
+ @api_client.config.logger.debug 'Calling API: RetentionApi.deactivate_retention_offer ...'
342
+ end
343
+ # verify the required parameter 'id' is set
344
+ if @api_client.config.client_side_validation && id.nil?
345
+ fail ArgumentError, "Missing the required parameter 'id' when calling RetentionApi.deactivate_retention_offer"
346
+ end
347
+ pattern = Regexp.new(/^roff_[A-Za-z0-9]+$/)
348
+ if @api_client.config.client_side_validation && id !~ pattern
349
+ fail ArgumentError, "invalid value for 'id' when calling RetentionApi.deactivate_retention_offer, must conform to the pattern #{pattern}."
350
+ end
351
+
352
+ # resource path
353
+ local_var_path = '/retention/offers/{id}/deactivate'.sub('{id}', CGI.escape(id.to_s))
354
+
355
+ # query parameters
356
+ query_params = opts[:query_params] || {}
357
+
358
+ # header parameters
359
+ header_params = opts[:header_params] || {}
360
+ # HTTP header 'Accept' (if needed)
361
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
362
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
363
+
364
+ # form parameters
365
+ form_params = opts[:form_params] || {}
366
+
367
+ # http body (model)
368
+ post_body = opts[:debug_body]
369
+
370
+ # return_type
371
+ return_type = opts[:debug_return_type] || 'RetentionOffer'
372
+
373
+ # auth_names
374
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
375
+
376
+ new_options = opts.merge(
377
+ :operation => :"RetentionApi.deactivate_retention_offer",
378
+ :header_params => header_params,
379
+ :query_params => query_params,
380
+ :form_params => form_params,
381
+ :body => post_body,
382
+ :auth_names => auth_names,
383
+ :return_type => return_type
384
+ )
385
+
386
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
387
+ if @api_client.config.debugging
388
+ @api_client.config.logger.debug "API called: RetentionApi#deactivate_retention_offer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
389
+ end
390
+ return data, status_code, headers
391
+ end
392
+
393
+ # Turn off a cancellation reason
394
+ # The survey stops listing it; answers already given keep it. Operator token only. 404 without the retention licence; 403 `plugin_not_in_plan` when the plan leaves the plugin out.
395
+ # @param id [String] The cancellation reason&#39;s id, such as &#x60;rrsn_6Tn3&#x60;.
396
+ # @param [Hash] opts the optional parameters
397
+ # @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is &#x60;409&#x60;.
398
+ # @return [RetentionReason]
399
+ def deactivate_retention_reason(id, opts = {})
400
+ data, _status_code, _headers = deactivate_retention_reason_with_http_info(id, opts)
401
+ data
402
+ end
403
+
404
+ # Turn off a cancellation reason
405
+ # The survey stops listing it; answers already given keep it. Operator token only. 404 without the retention licence; 403 &#x60;plugin_not_in_plan&#x60; when the plan leaves the plugin out.
406
+ # @param id [String] The cancellation reason&#39;s id, such as &#x60;rrsn_6Tn3&#x60;.
407
+ # @param [Hash] opts the optional parameters
408
+ # @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is &#x60;409&#x60;.
409
+ # @return [Array<(RetentionReason, Integer, Hash)>] RetentionReason data, response status code and response headers
410
+ def deactivate_retention_reason_with_http_info(id, opts = {})
411
+ if @api_client.config.debugging
412
+ @api_client.config.logger.debug 'Calling API: RetentionApi.deactivate_retention_reason ...'
413
+ end
414
+ # verify the required parameter 'id' is set
415
+ if @api_client.config.client_side_validation && id.nil?
416
+ fail ArgumentError, "Missing the required parameter 'id' when calling RetentionApi.deactivate_retention_reason"
417
+ end
418
+ pattern = Regexp.new(/^rrsn_[A-Za-z0-9]+$/)
419
+ if @api_client.config.client_side_validation && id !~ pattern
420
+ fail ArgumentError, "invalid value for 'id' when calling RetentionApi.deactivate_retention_reason, must conform to the pattern #{pattern}."
421
+ end
422
+
423
+ # resource path
424
+ local_var_path = '/retention/reasons/{id}/deactivate'.sub('{id}', CGI.escape(id.to_s))
425
+
426
+ # query parameters
427
+ query_params = opts[:query_params] || {}
428
+
429
+ # header parameters
430
+ header_params = opts[:header_params] || {}
431
+ # HTTP header 'Accept' (if needed)
432
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
433
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
434
+
435
+ # form parameters
436
+ form_params = opts[:form_params] || {}
437
+
438
+ # http body (model)
439
+ post_body = opts[:debug_body]
440
+
441
+ # return_type
442
+ return_type = opts[:debug_return_type] || 'RetentionReason'
443
+
444
+ # auth_names
445
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
446
+
447
+ new_options = opts.merge(
448
+ :operation => :"RetentionApi.deactivate_retention_reason",
449
+ :header_params => header_params,
450
+ :query_params => query_params,
451
+ :form_params => form_params,
452
+ :body => post_body,
453
+ :auth_names => auth_names,
454
+ :return_type => return_type
455
+ )
456
+
457
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
458
+ if @api_client.config.debugging
459
+ @api_client.config.logger.debug "API called: RetentionApi#deactivate_retention_reason\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
460
+ end
461
+ return data, status_code, headers
462
+ end
463
+
464
+ # Delete a save offer
465
+ # Refused (409) once a customer has accepted it: turn it off instead. Operator token only. 404 without the retention licence; 403 `plugin_not_in_plan` when the plan leaves the plugin out.
466
+ # @param id [String] The save offer&#39;s id, such as &#x60;roff_2Kp8&#x60;.
467
+ # @param [Hash] opts the optional parameters
468
+ # @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is &#x60;409&#x60;.
469
+ # @return [DeleteExperiment200Response]
470
+ def delete_retention_offer(id, opts = {})
471
+ data, _status_code, _headers = delete_retention_offer_with_http_info(id, opts)
472
+ data
473
+ end
474
+
475
+ # Delete a save offer
476
+ # Refused (409) once a customer has accepted it: turn it off instead. Operator token only. 404 without the retention licence; 403 &#x60;plugin_not_in_plan&#x60; when the plan leaves the plugin out.
477
+ # @param id [String] The save offer&#39;s id, such as &#x60;roff_2Kp8&#x60;.
478
+ # @param [Hash] opts the optional parameters
479
+ # @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is &#x60;409&#x60;.
480
+ # @return [Array<(DeleteExperiment200Response, Integer, Hash)>] DeleteExperiment200Response data, response status code and response headers
481
+ def delete_retention_offer_with_http_info(id, opts = {})
482
+ if @api_client.config.debugging
483
+ @api_client.config.logger.debug 'Calling API: RetentionApi.delete_retention_offer ...'
484
+ end
485
+ # verify the required parameter 'id' is set
486
+ if @api_client.config.client_side_validation && id.nil?
487
+ fail ArgumentError, "Missing the required parameter 'id' when calling RetentionApi.delete_retention_offer"
488
+ end
489
+ pattern = Regexp.new(/^roff_[A-Za-z0-9]+$/)
490
+ if @api_client.config.client_side_validation && id !~ pattern
491
+ fail ArgumentError, "invalid value for 'id' when calling RetentionApi.delete_retention_offer, must conform to the pattern #{pattern}."
492
+ end
493
+
494
+ # resource path
495
+ local_var_path = '/retention/offers/{id}'.sub('{id}', CGI.escape(id.to_s))
496
+
497
+ # query parameters
498
+ query_params = opts[:query_params] || {}
499
+
500
+ # header parameters
501
+ header_params = opts[:header_params] || {}
502
+ # HTTP header 'Accept' (if needed)
503
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
504
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
505
+
506
+ # form parameters
507
+ form_params = opts[:form_params] || {}
508
+
509
+ # http body (model)
510
+ post_body = opts[:debug_body]
511
+
512
+ # return_type
513
+ return_type = opts[:debug_return_type] || 'DeleteExperiment200Response'
514
+
515
+ # auth_names
516
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
517
+
518
+ new_options = opts.merge(
519
+ :operation => :"RetentionApi.delete_retention_offer",
520
+ :header_params => header_params,
521
+ :query_params => query_params,
522
+ :form_params => form_params,
523
+ :body => post_body,
524
+ :auth_names => auth_names,
525
+ :return_type => return_type
526
+ )
527
+
528
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
529
+ if @api_client.config.debugging
530
+ @api_client.config.logger.debug "API called: RetentionApi#delete_retention_offer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
531
+ end
532
+ return data, status_code, headers
533
+ end
534
+
535
+ # Delete a cancellation reason
536
+ # Refused (409) once a customer has given it: turn it off instead, so the analytics can still name it. Operator token only. 404 without the retention licence; 403 `plugin_not_in_plan` when the plan leaves the plugin out.
537
+ # @param id [String] The cancellation reason&#39;s id, such as &#x60;rrsn_6Tn3&#x60;.
538
+ # @param [Hash] opts the optional parameters
539
+ # @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is &#x60;409&#x60;.
540
+ # @return [DeleteExperiment200Response]
541
+ def delete_retention_reason(id, opts = {})
542
+ data, _status_code, _headers = delete_retention_reason_with_http_info(id, opts)
543
+ data
544
+ end
545
+
546
+ # Delete a cancellation reason
547
+ # Refused (409) once a customer has given it: turn it off instead, so the analytics can still name it. Operator token only. 404 without the retention licence; 403 &#x60;plugin_not_in_plan&#x60; when the plan leaves the plugin out.
548
+ # @param id [String] The cancellation reason&#39;s id, such as &#x60;rrsn_6Tn3&#x60;.
549
+ # @param [Hash] opts the optional parameters
550
+ # @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is &#x60;409&#x60;.
551
+ # @return [Array<(DeleteExperiment200Response, Integer, Hash)>] DeleteExperiment200Response data, response status code and response headers
552
+ def delete_retention_reason_with_http_info(id, opts = {})
553
+ if @api_client.config.debugging
554
+ @api_client.config.logger.debug 'Calling API: RetentionApi.delete_retention_reason ...'
555
+ end
556
+ # verify the required parameter 'id' is set
557
+ if @api_client.config.client_side_validation && id.nil?
558
+ fail ArgumentError, "Missing the required parameter 'id' when calling RetentionApi.delete_retention_reason"
559
+ end
560
+ pattern = Regexp.new(/^rrsn_[A-Za-z0-9]+$/)
561
+ if @api_client.config.client_side_validation && id !~ pattern
562
+ fail ArgumentError, "invalid value for 'id' when calling RetentionApi.delete_retention_reason, must conform to the pattern #{pattern}."
563
+ end
564
+
565
+ # resource path
566
+ local_var_path = '/retention/reasons/{id}'.sub('{id}', CGI.escape(id.to_s))
567
+
568
+ # query parameters
569
+ query_params = opts[:query_params] || {}
570
+
571
+ # header parameters
572
+ header_params = opts[:header_params] || {}
573
+ # HTTP header 'Accept' (if needed)
574
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
575
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
576
+
577
+ # form parameters
578
+ form_params = opts[:form_params] || {}
579
+
580
+ # http body (model)
581
+ post_body = opts[:debug_body]
582
+
583
+ # return_type
584
+ return_type = opts[:debug_return_type] || 'DeleteExperiment200Response'
585
+
586
+ # auth_names
587
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
588
+
589
+ new_options = opts.merge(
590
+ :operation => :"RetentionApi.delete_retention_reason",
591
+ :header_params => header_params,
592
+ :query_params => query_params,
593
+ :form_params => form_params,
594
+ :body => post_body,
595
+ :auth_names => auth_names,
596
+ :return_type => return_type
597
+ )
598
+
599
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
600
+ if @api_client.config.debugging
601
+ @api_client.config.logger.debug "API called: RetentionApi#delete_retention_reason\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
602
+ end
603
+ return data, status_code, headers
604
+ end
605
+
606
+ # List the save offers
607
+ # The save offers, in the order a cancelling subscriber is shown them, on or off. Operator token only. 404 without the retention licence; 403 `plugin_not_in_plan` when the plan leaves the plugin out.
608
+ # @param [Hash] opts the optional parameters
609
+ # @return [ListRetentionOffers200Response]
610
+ def list_retention_offers(opts = {})
611
+ data, _status_code, _headers = list_retention_offers_with_http_info(opts)
612
+ data
613
+ end
614
+
615
+ # List the save offers
616
+ # The save offers, in the order a cancelling subscriber is shown them, on or off. Operator token only. 404 without the retention licence; 403 &#x60;plugin_not_in_plan&#x60; when the plan leaves the plugin out.
617
+ # @param [Hash] opts the optional parameters
618
+ # @return [Array<(ListRetentionOffers200Response, Integer, Hash)>] ListRetentionOffers200Response data, response status code and response headers
619
+ def list_retention_offers_with_http_info(opts = {})
620
+ if @api_client.config.debugging
621
+ @api_client.config.logger.debug 'Calling API: RetentionApi.list_retention_offers ...'
622
+ end
623
+ # resource path
624
+ local_var_path = '/retention/offers'
625
+
626
+ # query parameters
627
+ query_params = opts[:query_params] || {}
628
+
629
+ # header parameters
630
+ header_params = opts[:header_params] || {}
631
+ # HTTP header 'Accept' (if needed)
632
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
633
+
634
+ # form parameters
635
+ form_params = opts[:form_params] || {}
636
+
637
+ # http body (model)
638
+ post_body = opts[:debug_body]
639
+
640
+ # return_type
641
+ return_type = opts[:debug_return_type] || 'ListRetentionOffers200Response'
642
+
643
+ # auth_names
644
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
645
+
646
+ new_options = opts.merge(
647
+ :operation => :"RetentionApi.list_retention_offers",
648
+ :header_params => header_params,
649
+ :query_params => query_params,
650
+ :form_params => form_params,
651
+ :body => post_body,
652
+ :auth_names => auth_names,
653
+ :return_type => return_type
654
+ )
655
+
656
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
657
+ if @api_client.config.debugging
658
+ @api_client.config.logger.debug "API called: RetentionApi#list_retention_offers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
659
+ end
660
+ return data, status_code, headers
661
+ end
662
+
663
+ # List the cancellation reasons
664
+ # The cancellation survey's reasons, in the order the survey lists them, on or off. Operator token only. 404 without the retention licence; 403 `plugin_not_in_plan` when the plan leaves the plugin out.
665
+ # @param [Hash] opts the optional parameters
666
+ # @return [ListRetentionReasons200Response]
667
+ def list_retention_reasons(opts = {})
668
+ data, _status_code, _headers = list_retention_reasons_with_http_info(opts)
669
+ data
670
+ end
671
+
672
+ # List the cancellation reasons
673
+ # The cancellation survey&#39;s reasons, in the order the survey lists them, on or off. Operator token only. 404 without the retention licence; 403 &#x60;plugin_not_in_plan&#x60; when the plan leaves the plugin out.
674
+ # @param [Hash] opts the optional parameters
675
+ # @return [Array<(ListRetentionReasons200Response, Integer, Hash)>] ListRetentionReasons200Response data, response status code and response headers
676
+ def list_retention_reasons_with_http_info(opts = {})
677
+ if @api_client.config.debugging
678
+ @api_client.config.logger.debug 'Calling API: RetentionApi.list_retention_reasons ...'
679
+ end
680
+ # resource path
681
+ local_var_path = '/retention/reasons'
682
+
683
+ # query parameters
684
+ query_params = opts[:query_params] || {}
685
+
686
+ # header parameters
687
+ header_params = opts[:header_params] || {}
688
+ # HTTP header 'Accept' (if needed)
689
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
690
+
691
+ # form parameters
692
+ form_params = opts[:form_params] || {}
693
+
694
+ # http body (model)
695
+ post_body = opts[:debug_body]
696
+
697
+ # return_type
698
+ return_type = opts[:debug_return_type] || 'ListRetentionReasons200Response'
699
+
700
+ # auth_names
701
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
702
+
703
+ new_options = opts.merge(
704
+ :operation => :"RetentionApi.list_retention_reasons",
705
+ :header_params => header_params,
706
+ :query_params => query_params,
707
+ :form_params => form_params,
708
+ :body => post_body,
709
+ :auth_names => auth_names,
710
+ :return_type => return_type
711
+ )
712
+
713
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
714
+ if @api_client.config.debugging
715
+ @api_client.config.logger.debug "API called: RetentionApi#list_retention_reasons\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
716
+ end
717
+ return data, status_code, headers
718
+ end
719
+
720
+ # Change a save offer
721
+ # The whole save offer, as the console's form sends it. The key stays. Operator token only. 404 without the retention licence; 403 `plugin_not_in_plan` when the plan leaves the plugin out.
722
+ # @param id [String] The save offer&#39;s id, such as &#x60;roff_2Kp8&#x60;.
723
+ # @param retention_offer_input [RetentionOfferInput]
724
+ # @param [Hash] opts the optional parameters
725
+ # @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is &#x60;409&#x60;.
726
+ # @return [RetentionOffer]
727
+ def update_retention_offer(id, retention_offer_input, opts = {})
728
+ data, _status_code, _headers = update_retention_offer_with_http_info(id, retention_offer_input, opts)
729
+ data
730
+ end
731
+
732
+ # Change a save offer
733
+ # The whole save offer, as the console&#39;s form sends it. The key stays. Operator token only. 404 without the retention licence; 403 &#x60;plugin_not_in_plan&#x60; when the plan leaves the plugin out.
734
+ # @param id [String] The save offer&#39;s id, such as &#x60;roff_2Kp8&#x60;.
735
+ # @param retention_offer_input [RetentionOfferInput]
736
+ # @param [Hash] opts the optional parameters
737
+ # @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is &#x60;409&#x60;.
738
+ # @return [Array<(RetentionOffer, Integer, Hash)>] RetentionOffer data, response status code and response headers
739
+ def update_retention_offer_with_http_info(id, retention_offer_input, opts = {})
740
+ if @api_client.config.debugging
741
+ @api_client.config.logger.debug 'Calling API: RetentionApi.update_retention_offer ...'
742
+ end
743
+ # verify the required parameter 'id' is set
744
+ if @api_client.config.client_side_validation && id.nil?
745
+ fail ArgumentError, "Missing the required parameter 'id' when calling RetentionApi.update_retention_offer"
746
+ end
747
+ pattern = Regexp.new(/^roff_[A-Za-z0-9]+$/)
748
+ if @api_client.config.client_side_validation && id !~ pattern
749
+ fail ArgumentError, "invalid value for 'id' when calling RetentionApi.update_retention_offer, must conform to the pattern #{pattern}."
750
+ end
751
+
752
+ # verify the required parameter 'retention_offer_input' is set
753
+ if @api_client.config.client_side_validation && retention_offer_input.nil?
754
+ fail ArgumentError, "Missing the required parameter 'retention_offer_input' when calling RetentionApi.update_retention_offer"
755
+ end
756
+ # resource path
757
+ local_var_path = '/retention/offers/{id}'.sub('{id}', CGI.escape(id.to_s))
758
+
759
+ # query parameters
760
+ query_params = opts[:query_params] || {}
761
+
762
+ # header parameters
763
+ header_params = opts[:header_params] || {}
764
+ # HTTP header 'Accept' (if needed)
765
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
766
+ # HTTP header 'Content-Type'
767
+ content_type = @api_client.select_header_content_type(['application/json'])
768
+ if !content_type.nil?
769
+ header_params['Content-Type'] = content_type
770
+ end
771
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
772
+
773
+ # form parameters
774
+ form_params = opts[:form_params] || {}
775
+
776
+ # http body (model)
777
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(retention_offer_input)
778
+
779
+ # return_type
780
+ return_type = opts[:debug_return_type] || 'RetentionOffer'
781
+
782
+ # auth_names
783
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
784
+
785
+ new_options = opts.merge(
786
+ :operation => :"RetentionApi.update_retention_offer",
787
+ :header_params => header_params,
788
+ :query_params => query_params,
789
+ :form_params => form_params,
790
+ :body => post_body,
791
+ :auth_names => auth_names,
792
+ :return_type => return_type
793
+ )
794
+
795
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
796
+ if @api_client.config.debugging
797
+ @api_client.config.logger.debug "API called: RetentionApi#update_retention_offer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
798
+ end
799
+ return data, status_code, headers
800
+ end
801
+
802
+ # Change a cancellation reason
803
+ # The whole cancellation reason, as the console's form sends it. The key stays. Operator token only. 404 without the retention licence; 403 `plugin_not_in_plan` when the plan leaves the plugin out.
804
+ # @param id [String] The cancellation reason&#39;s id, such as &#x60;rrsn_6Tn3&#x60;.
805
+ # @param retention_reason_input [RetentionReasonInput]
806
+ # @param [Hash] opts the optional parameters
807
+ # @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is &#x60;409&#x60;.
808
+ # @return [RetentionReason]
809
+ def update_retention_reason(id, retention_reason_input, opts = {})
810
+ data, _status_code, _headers = update_retention_reason_with_http_info(id, retention_reason_input, opts)
811
+ data
812
+ end
813
+
814
+ # Change a cancellation reason
815
+ # The whole cancellation reason, as the console&#39;s form sends it. The key stays. Operator token only. 404 without the retention licence; 403 &#x60;plugin_not_in_plan&#x60; when the plan leaves the plugin out.
816
+ # @param id [String] The cancellation reason&#39;s id, such as &#x60;rrsn_6Tn3&#x60;.
817
+ # @param retention_reason_input [RetentionReasonInput]
818
+ # @param [Hash] opts the optional parameters
819
+ # @option opts [String] :idempotency_key An opaque, caller-generated key giving this write exactly-once semantics. A retry with the same key replays the first response instead of re-running the effect; reusing it with a different body is &#x60;409&#x60;.
820
+ # @return [Array<(RetentionReason, Integer, Hash)>] RetentionReason data, response status code and response headers
821
+ def update_retention_reason_with_http_info(id, retention_reason_input, opts = {})
822
+ if @api_client.config.debugging
823
+ @api_client.config.logger.debug 'Calling API: RetentionApi.update_retention_reason ...'
824
+ end
825
+ # verify the required parameter 'id' is set
826
+ if @api_client.config.client_side_validation && id.nil?
827
+ fail ArgumentError, "Missing the required parameter 'id' when calling RetentionApi.update_retention_reason"
828
+ end
829
+ pattern = Regexp.new(/^rrsn_[A-Za-z0-9]+$/)
830
+ if @api_client.config.client_side_validation && id !~ pattern
831
+ fail ArgumentError, "invalid value for 'id' when calling RetentionApi.update_retention_reason, must conform to the pattern #{pattern}."
832
+ end
833
+
834
+ # verify the required parameter 'retention_reason_input' is set
835
+ if @api_client.config.client_side_validation && retention_reason_input.nil?
836
+ fail ArgumentError, "Missing the required parameter 'retention_reason_input' when calling RetentionApi.update_retention_reason"
837
+ end
838
+ # resource path
839
+ local_var_path = '/retention/reasons/{id}'.sub('{id}', CGI.escape(id.to_s))
840
+
841
+ # query parameters
842
+ query_params = opts[:query_params] || {}
843
+
844
+ # header parameters
845
+ header_params = opts[:header_params] || {}
846
+ # HTTP header 'Accept' (if needed)
847
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
848
+ # HTTP header 'Content-Type'
849
+ content_type = @api_client.select_header_content_type(['application/json'])
850
+ if !content_type.nil?
851
+ header_params['Content-Type'] = content_type
852
+ end
853
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
854
+
855
+ # form parameters
856
+ form_params = opts[:form_params] || {}
857
+
858
+ # http body (model)
859
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(retention_reason_input)
860
+
861
+ # return_type
862
+ return_type = opts[:debug_return_type] || 'RetentionReason'
863
+
864
+ # auth_names
865
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
866
+
867
+ new_options = opts.merge(
868
+ :operation => :"RetentionApi.update_retention_reason",
869
+ :header_params => header_params,
870
+ :query_params => query_params,
871
+ :form_params => form_params,
872
+ :body => post_body,
873
+ :auth_names => auth_names,
874
+ :return_type => return_type
875
+ )
876
+
877
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
878
+ if @api_client.config.debugging
879
+ @api_client.config.logger.debug "API called: RetentionApi#update_retention_reason\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
880
+ end
881
+ return data, status_code, headers
882
+ end
883
+ end
884
+ end