stackone_client 0.6.0 → 0.7.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 (40) hide show
  1. checksums.yaml +4 -4
  2. data/lib/stack_one/accounts.rb +279 -36
  3. data/lib/stack_one/ats.rb +4075 -580
  4. data/lib/stack_one/connect_sessions.rb +123 -22
  5. data/lib/stack_one/connectors.rb +111 -14
  6. data/lib/stack_one/crm.rb +563 -78
  7. data/lib/stack_one/hris.rb +3401 -458
  8. data/lib/stack_one/iam.rb +675 -56
  9. data/lib/stack_one/lms.rb +1533 -220
  10. data/lib/stack_one/marketing.rb +1503 -230
  11. data/lib/stack_one/models/operations/hris_update_employee_time_off_request_request.rb +33 -0
  12. data/lib/stack_one/models/operations/hris_update_employee_time_off_request_response.rb +36 -0
  13. data/lib/stack_one/models/operations/iam_delete_user_request.rb +27 -0
  14. data/lib/stack_one/models/operations/iam_delete_user_response.rb +36 -0
  15. data/lib/stack_one/models/operations/iam_update_user_request.rb +30 -0
  16. data/lib/stack_one/models/operations/iam_update_user_response.rb +36 -0
  17. data/lib/stack_one/models/operations/lms_list_users_queryparam_filter.rb +5 -2
  18. data/lib/stack_one/models/operations.rb +6 -0
  19. data/lib/stack_one/models/shared/atscreatejobrequestdto.rb +5 -2
  20. data/lib/stack_one/models/shared/atsupdatejobrequestdto.rb +5 -2
  21. data/lib/stack_one/models/shared/hriscreatetimeoffrequestdto.rb +2 -0
  22. data/lib/stack_one/models/shared/hriscreatetimeoffrequestdto_type.rb +2 -0
  23. data/lib/stack_one/models/shared/iamupdateuserrequestdto.rb +45 -0
  24. data/lib/stack_one/models/shared/iamupdateuserrequestdto_status.rb +27 -0
  25. data/lib/stack_one/models/shared/iamupdateuserrequestdto_value.rb +20 -0
  26. data/lib/stack_one/models/shared/job.rb +5 -2
  27. data/lib/stack_one/models/shared/rawresponse.rb +2 -2
  28. data/lib/stack_one/models/shared/timeoff.rb +2 -0
  29. data/lib/stack_one/models/shared/timeoff_type.rb +2 -0
  30. data/lib/stack_one/models/shared/updateuserapimodel.rb +45 -0
  31. data/lib/stack_one/models/shared/updateuserapimodel_status.rb +27 -0
  32. data/lib/stack_one/models/shared/updateuserapimodel_value.rb +20 -0
  33. data/lib/stack_one/models/shared.rb +6 -0
  34. data/lib/stack_one/proxy.rb +62 -11
  35. data/lib/stack_one/sdk_hooks/hooks.rb +101 -0
  36. data/lib/stack_one/sdk_hooks/types.rb +152 -0
  37. data/lib/stack_one/sdkconfiguration.rb +11 -4
  38. data/lib/stack_one/stackone.rb +22 -8
  39. data/lib/stack_one/utils/utils.rb +10 -0
  40. metadata +16 -2
@@ -7,6 +7,7 @@ require 'faraday'
7
7
  require 'faraday/multipart'
8
8
  require 'faraday/retry'
9
9
  require 'sorbet-runtime'
10
+ require_relative 'sdk_hooks/hooks'
10
11
  require_relative 'utils/retries'
11
12
 
12
13
  module StackOne
@@ -21,8 +22,8 @@ module StackOne
21
22
  end
22
23
 
23
24
 
24
- sig { params(marketing_create_content_blocks_request_dto: ::StackOne::Shared::MarketingCreateContentBlocksRequestDto, x_account_id: ::String, retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::MarketingCreateContentBlockResponse) }
25
- def create_content_block(marketing_create_content_blocks_request_dto, x_account_id, retries = nil)
25
+ sig { params(marketing_create_content_blocks_request_dto: ::StackOne::Shared::MarketingCreateContentBlocksRequestDto, x_account_id: ::String, retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::MarketingCreateContentBlockResponse) }
26
+ def create_content_block(marketing_create_content_blocks_request_dto, x_account_id, retries = nil, timeout_ms = nil)
26
27
  # create_content_block - Create Content Block
27
28
  request = ::StackOne::Operations::MarketingCreateContentBlockRequest.new(
28
29
 
@@ -36,6 +37,14 @@ module StackOne
36
37
  req_content_type, data, form = Utils.serialize_request_body(request, :marketing_create_content_blocks_request_dto, :json)
37
38
  headers['content-type'] = req_content_type
38
39
  raise StandardError, 'request body is required' if data.nil? && form.nil?
40
+
41
+ if form
42
+ body = Utils.encode_form(form)
43
+ elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
44
+ body = URI.encode_www_form(data)
45
+ else
46
+ body = data
47
+ end
39
48
  headers['Accept'] = 'application/json'
40
49
  headers['user-agent'] = @sdk_configuration.user_agent
41
50
  retries ||= @sdk_configuration.retry_config
@@ -52,19 +61,61 @@ module StackOne
52
61
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
53
62
  retry_options[:retry_statuses] = [429, 408]
54
63
 
64
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
65
+
66
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
67
+ timeout ||= @sdk_configuration.timeout
68
+
55
69
  connection = @sdk_configuration.client.dup
56
70
  connection.request :retry, retry_options
57
71
 
58
- r = connection.post(url) do |req|
59
- req.headers = headers
60
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
61
- Utils.configure_request_security(req, security) if !security.nil?
62
- if form
63
- req.body = Utils.encode_form(form)
64
- elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
65
- req.body = URI.encode_www_form(data)
72
+ hook_ctx = SDKHooks::HookContext.new(
73
+ base_url: base_url,
74
+ oauth2_scopes: [],
75
+ operation_id: 'marketing_create_content_block',
76
+ security_source: @sdk_configuration.security_source
77
+ )
78
+
79
+ error = T.let(nil, T.nilable(StandardError))
80
+ r = T.let(nil, T.nilable(Faraday::Response))
81
+
82
+ begin
83
+ r = connection.post(url) do |req|
84
+ req.body = body
85
+ req.headers.merge!(headers)
86
+ req.options.timeout = timeout unless timeout.nil?
87
+ Utils.configure_request_security(req, security)
88
+
89
+ @sdk_configuration.hooks.before_request(
90
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
91
+ hook_ctx: hook_ctx
92
+ ),
93
+ request: req
94
+ )
95
+ end
96
+ rescue StandardError => e
97
+ error = e
98
+ ensure
99
+ if r.nil? || Utils.error_status?(r.status)
100
+ r = @sdk_configuration.hooks.after_error(
101
+ error: error,
102
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
103
+ hook_ctx: hook_ctx
104
+ ),
105
+ response: r
106
+ )
66
107
  else
67
- req.body = data
108
+ r = @sdk_configuration.hooks.after_success(
109
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
110
+ hook_ctx: hook_ctx
111
+ ),
112
+ response: r
113
+ )
114
+ end
115
+
116
+ if r.nil?
117
+ raise error if !error.nil?
118
+ raise 'no response'
68
119
  end
69
120
  end
70
121
 
@@ -88,8 +139,8 @@ module StackOne
88
139
  end
89
140
 
90
141
 
91
- sig { params(marketing_create_email_template_request_dto: ::StackOne::Shared::MarketingCreateEmailTemplateRequestDto, x_account_id: ::String, retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::MarketingCreateEmailTemplateResponse) }
92
- def create_email_template(marketing_create_email_template_request_dto, x_account_id, retries = nil)
142
+ sig { params(marketing_create_email_template_request_dto: ::StackOne::Shared::MarketingCreateEmailTemplateRequestDto, x_account_id: ::String, retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::MarketingCreateEmailTemplateResponse) }
143
+ def create_email_template(marketing_create_email_template_request_dto, x_account_id, retries = nil, timeout_ms = nil)
93
144
  # create_email_template - Create Email Templates
94
145
  request = ::StackOne::Operations::MarketingCreateEmailTemplateRequest.new(
95
146
 
@@ -103,6 +154,14 @@ module StackOne
103
154
  req_content_type, data, form = Utils.serialize_request_body(request, :marketing_create_email_template_request_dto, :json)
104
155
  headers['content-type'] = req_content_type
105
156
  raise StandardError, 'request body is required' if data.nil? && form.nil?
157
+
158
+ if form
159
+ body = Utils.encode_form(form)
160
+ elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
161
+ body = URI.encode_www_form(data)
162
+ else
163
+ body = data
164
+ end
106
165
  headers['Accept'] = 'application/json'
107
166
  headers['user-agent'] = @sdk_configuration.user_agent
108
167
  retries ||= @sdk_configuration.retry_config
@@ -119,19 +178,61 @@ module StackOne
119
178
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
120
179
  retry_options[:retry_statuses] = [429, 408]
121
180
 
181
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
182
+
183
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
184
+ timeout ||= @sdk_configuration.timeout
185
+
122
186
  connection = @sdk_configuration.client.dup
123
187
  connection.request :retry, retry_options
124
188
 
125
- r = connection.post(url) do |req|
126
- req.headers = headers
127
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
128
- Utils.configure_request_security(req, security) if !security.nil?
129
- if form
130
- req.body = Utils.encode_form(form)
131
- elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
132
- req.body = URI.encode_www_form(data)
189
+ hook_ctx = SDKHooks::HookContext.new(
190
+ base_url: base_url,
191
+ oauth2_scopes: [],
192
+ operation_id: 'marketing_create_email_template',
193
+ security_source: @sdk_configuration.security_source
194
+ )
195
+
196
+ error = T.let(nil, T.nilable(StandardError))
197
+ r = T.let(nil, T.nilable(Faraday::Response))
198
+
199
+ begin
200
+ r = connection.post(url) do |req|
201
+ req.body = body
202
+ req.headers.merge!(headers)
203
+ req.options.timeout = timeout unless timeout.nil?
204
+ Utils.configure_request_security(req, security)
205
+
206
+ @sdk_configuration.hooks.before_request(
207
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
208
+ hook_ctx: hook_ctx
209
+ ),
210
+ request: req
211
+ )
212
+ end
213
+ rescue StandardError => e
214
+ error = e
215
+ ensure
216
+ if r.nil? || Utils.error_status?(r.status)
217
+ r = @sdk_configuration.hooks.after_error(
218
+ error: error,
219
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
220
+ hook_ctx: hook_ctx
221
+ ),
222
+ response: r
223
+ )
133
224
  else
134
- req.body = data
225
+ r = @sdk_configuration.hooks.after_success(
226
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
227
+ hook_ctx: hook_ctx
228
+ ),
229
+ response: r
230
+ )
231
+ end
232
+
233
+ if r.nil?
234
+ raise error if !error.nil?
235
+ raise 'no response'
135
236
  end
136
237
  end
137
238
 
@@ -155,8 +256,8 @@ module StackOne
155
256
  end
156
257
 
157
258
 
158
- sig { params(marketing_create_in_app_template_request_dto: ::StackOne::Shared::MarketingCreateInAppTemplateRequestDto, x_account_id: ::String, retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::MarketingCreateInAppTemplateResponse) }
159
- def create_in_app_template(marketing_create_in_app_template_request_dto, x_account_id, retries = nil)
259
+ sig { params(marketing_create_in_app_template_request_dto: ::StackOne::Shared::MarketingCreateInAppTemplateRequestDto, x_account_id: ::String, retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::MarketingCreateInAppTemplateResponse) }
260
+ def create_in_app_template(marketing_create_in_app_template_request_dto, x_account_id, retries = nil, timeout_ms = nil)
160
261
  # create_in_app_template - Create In-App Template
161
262
  request = ::StackOne::Operations::MarketingCreateInAppTemplateRequest.new(
162
263
 
@@ -170,6 +271,14 @@ module StackOne
170
271
  req_content_type, data, form = Utils.serialize_request_body(request, :marketing_create_in_app_template_request_dto, :json)
171
272
  headers['content-type'] = req_content_type
172
273
  raise StandardError, 'request body is required' if data.nil? && form.nil?
274
+
275
+ if form
276
+ body = Utils.encode_form(form)
277
+ elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
278
+ body = URI.encode_www_form(data)
279
+ else
280
+ body = data
281
+ end
173
282
  headers['Accept'] = 'application/json'
174
283
  headers['user-agent'] = @sdk_configuration.user_agent
175
284
  retries ||= @sdk_configuration.retry_config
@@ -186,19 +295,61 @@ module StackOne
186
295
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
187
296
  retry_options[:retry_statuses] = [429, 408]
188
297
 
298
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
299
+
300
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
301
+ timeout ||= @sdk_configuration.timeout
302
+
189
303
  connection = @sdk_configuration.client.dup
190
304
  connection.request :retry, retry_options
191
305
 
192
- r = connection.post(url) do |req|
193
- req.headers = headers
194
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
195
- Utils.configure_request_security(req, security) if !security.nil?
196
- if form
197
- req.body = Utils.encode_form(form)
198
- elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
199
- req.body = URI.encode_www_form(data)
306
+ hook_ctx = SDKHooks::HookContext.new(
307
+ base_url: base_url,
308
+ oauth2_scopes: [],
309
+ operation_id: 'marketing_create_in_app_template',
310
+ security_source: @sdk_configuration.security_source
311
+ )
312
+
313
+ error = T.let(nil, T.nilable(StandardError))
314
+ r = T.let(nil, T.nilable(Faraday::Response))
315
+
316
+ begin
317
+ r = connection.post(url) do |req|
318
+ req.body = body
319
+ req.headers.merge!(headers)
320
+ req.options.timeout = timeout unless timeout.nil?
321
+ Utils.configure_request_security(req, security)
322
+
323
+ @sdk_configuration.hooks.before_request(
324
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
325
+ hook_ctx: hook_ctx
326
+ ),
327
+ request: req
328
+ )
329
+ end
330
+ rescue StandardError => e
331
+ error = e
332
+ ensure
333
+ if r.nil? || Utils.error_status?(r.status)
334
+ r = @sdk_configuration.hooks.after_error(
335
+ error: error,
336
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
337
+ hook_ctx: hook_ctx
338
+ ),
339
+ response: r
340
+ )
200
341
  else
201
- req.body = data
342
+ r = @sdk_configuration.hooks.after_success(
343
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
344
+ hook_ctx: hook_ctx
345
+ ),
346
+ response: r
347
+ )
348
+ end
349
+
350
+ if r.nil?
351
+ raise error if !error.nil?
352
+ raise 'no response'
202
353
  end
203
354
  end
204
355
 
@@ -222,8 +373,8 @@ module StackOne
222
373
  end
223
374
 
224
375
 
225
- sig { params(marketing_create_template_request_dto: ::StackOne::Shared::MarketingCreateTemplateRequestDto, x_account_id: ::String, retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::MarketingCreateOmniChannelTemplateResponse) }
226
- def create_omni_channel_template(marketing_create_template_request_dto, x_account_id, retries = nil)
376
+ sig { params(marketing_create_template_request_dto: ::StackOne::Shared::MarketingCreateTemplateRequestDto, x_account_id: ::String, retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::MarketingCreateOmniChannelTemplateResponse) }
377
+ def create_omni_channel_template(marketing_create_template_request_dto, x_account_id, retries = nil, timeout_ms = nil)
227
378
  # create_omni_channel_template - Create Omni-Channel Template
228
379
  #
229
380
  # @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible.
@@ -239,6 +390,14 @@ module StackOne
239
390
  req_content_type, data, form = Utils.serialize_request_body(request, :marketing_create_template_request_dto, :json)
240
391
  headers['content-type'] = req_content_type
241
392
  raise StandardError, 'request body is required' if data.nil? && form.nil?
393
+
394
+ if form
395
+ body = Utils.encode_form(form)
396
+ elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
397
+ body = URI.encode_www_form(data)
398
+ else
399
+ body = data
400
+ end
242
401
  headers['Accept'] = 'application/json'
243
402
  headers['user-agent'] = @sdk_configuration.user_agent
244
403
  retries ||= @sdk_configuration.retry_config
@@ -255,19 +414,61 @@ module StackOne
255
414
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
256
415
  retry_options[:retry_statuses] = [429, 408]
257
416
 
417
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
418
+
419
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
420
+ timeout ||= @sdk_configuration.timeout
421
+
258
422
  connection = @sdk_configuration.client.dup
259
423
  connection.request :retry, retry_options
260
424
 
261
- r = connection.post(url) do |req|
262
- req.headers = headers
263
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
264
- Utils.configure_request_security(req, security) if !security.nil?
265
- if form
266
- req.body = Utils.encode_form(form)
267
- elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
268
- req.body = URI.encode_www_form(data)
425
+ hook_ctx = SDKHooks::HookContext.new(
426
+ base_url: base_url,
427
+ oauth2_scopes: [],
428
+ operation_id: 'marketing_create_omni_channel_template',
429
+ security_source: @sdk_configuration.security_source
430
+ )
431
+
432
+ error = T.let(nil, T.nilable(StandardError))
433
+ r = T.let(nil, T.nilable(Faraday::Response))
434
+
435
+ begin
436
+ r = connection.post(url) do |req|
437
+ req.body = body
438
+ req.headers.merge!(headers)
439
+ req.options.timeout = timeout unless timeout.nil?
440
+ Utils.configure_request_security(req, security)
441
+
442
+ @sdk_configuration.hooks.before_request(
443
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
444
+ hook_ctx: hook_ctx
445
+ ),
446
+ request: req
447
+ )
448
+ end
449
+ rescue StandardError => e
450
+ error = e
451
+ ensure
452
+ if r.nil? || Utils.error_status?(r.status)
453
+ r = @sdk_configuration.hooks.after_error(
454
+ error: error,
455
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
456
+ hook_ctx: hook_ctx
457
+ ),
458
+ response: r
459
+ )
269
460
  else
270
- req.body = data
461
+ r = @sdk_configuration.hooks.after_success(
462
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
463
+ hook_ctx: hook_ctx
464
+ ),
465
+ response: r
466
+ )
467
+ end
468
+
469
+ if r.nil?
470
+ raise error if !error.nil?
471
+ raise 'no response'
271
472
  end
272
473
  end
273
474
 
@@ -291,8 +492,8 @@ module StackOne
291
492
  end
292
493
 
293
494
 
294
- sig { params(marketing_create_push_template_request_dto: ::StackOne::Shared::MarketingCreatePushTemplateRequestDto, x_account_id: ::String, retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::MarketingCreatePushTemplateResponse) }
295
- def create_push_template(marketing_create_push_template_request_dto, x_account_id, retries = nil)
495
+ sig { params(marketing_create_push_template_request_dto: ::StackOne::Shared::MarketingCreatePushTemplateRequestDto, x_account_id: ::String, retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::MarketingCreatePushTemplateResponse) }
496
+ def create_push_template(marketing_create_push_template_request_dto, x_account_id, retries = nil, timeout_ms = nil)
296
497
  # create_push_template - Create Push Template
297
498
  request = ::StackOne::Operations::MarketingCreatePushTemplateRequest.new(
298
499
 
@@ -306,6 +507,14 @@ module StackOne
306
507
  req_content_type, data, form = Utils.serialize_request_body(request, :marketing_create_push_template_request_dto, :json)
307
508
  headers['content-type'] = req_content_type
308
509
  raise StandardError, 'request body is required' if data.nil? && form.nil?
510
+
511
+ if form
512
+ body = Utils.encode_form(form)
513
+ elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
514
+ body = URI.encode_www_form(data)
515
+ else
516
+ body = data
517
+ end
309
518
  headers['Accept'] = 'application/json'
310
519
  headers['user-agent'] = @sdk_configuration.user_agent
311
520
  retries ||= @sdk_configuration.retry_config
@@ -322,19 +531,61 @@ module StackOne
322
531
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
323
532
  retry_options[:retry_statuses] = [429, 408]
324
533
 
534
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
535
+
536
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
537
+ timeout ||= @sdk_configuration.timeout
538
+
325
539
  connection = @sdk_configuration.client.dup
326
540
  connection.request :retry, retry_options
327
541
 
328
- r = connection.post(url) do |req|
329
- req.headers = headers
330
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
331
- Utils.configure_request_security(req, security) if !security.nil?
332
- if form
333
- req.body = Utils.encode_form(form)
334
- elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
335
- req.body = URI.encode_www_form(data)
542
+ hook_ctx = SDKHooks::HookContext.new(
543
+ base_url: base_url,
544
+ oauth2_scopes: [],
545
+ operation_id: 'marketing_create_push_template',
546
+ security_source: @sdk_configuration.security_source
547
+ )
548
+
549
+ error = T.let(nil, T.nilable(StandardError))
550
+ r = T.let(nil, T.nilable(Faraday::Response))
551
+
552
+ begin
553
+ r = connection.post(url) do |req|
554
+ req.body = body
555
+ req.headers.merge!(headers)
556
+ req.options.timeout = timeout unless timeout.nil?
557
+ Utils.configure_request_security(req, security)
558
+
559
+ @sdk_configuration.hooks.before_request(
560
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
561
+ hook_ctx: hook_ctx
562
+ ),
563
+ request: req
564
+ )
565
+ end
566
+ rescue StandardError => e
567
+ error = e
568
+ ensure
569
+ if r.nil? || Utils.error_status?(r.status)
570
+ r = @sdk_configuration.hooks.after_error(
571
+ error: error,
572
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
573
+ hook_ctx: hook_ctx
574
+ ),
575
+ response: r
576
+ )
336
577
  else
337
- req.body = data
578
+ r = @sdk_configuration.hooks.after_success(
579
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
580
+ hook_ctx: hook_ctx
581
+ ),
582
+ response: r
583
+ )
584
+ end
585
+
586
+ if r.nil?
587
+ raise error if !error.nil?
588
+ raise 'no response'
338
589
  end
339
590
  end
340
591
 
@@ -358,8 +609,8 @@ module StackOne
358
609
  end
359
610
 
360
611
 
361
- sig { params(marketing_create_sms_template_request_dto: ::StackOne::Shared::MarketingCreateSmsTemplateRequestDto, x_account_id: ::String, retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::MarketingCreateSmsTemplateResponse) }
362
- def create_sms_template(marketing_create_sms_template_request_dto, x_account_id, retries = nil)
612
+ sig { params(marketing_create_sms_template_request_dto: ::StackOne::Shared::MarketingCreateSmsTemplateRequestDto, x_account_id: ::String, retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::MarketingCreateSmsTemplateResponse) }
613
+ def create_sms_template(marketing_create_sms_template_request_dto, x_account_id, retries = nil, timeout_ms = nil)
363
614
  # create_sms_template - Create SMS Template
364
615
  request = ::StackOne::Operations::MarketingCreateSmsTemplateRequest.new(
365
616
 
@@ -373,6 +624,14 @@ module StackOne
373
624
  req_content_type, data, form = Utils.serialize_request_body(request, :marketing_create_sms_template_request_dto, :json)
374
625
  headers['content-type'] = req_content_type
375
626
  raise StandardError, 'request body is required' if data.nil? && form.nil?
627
+
628
+ if form
629
+ body = Utils.encode_form(form)
630
+ elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
631
+ body = URI.encode_www_form(data)
632
+ else
633
+ body = data
634
+ end
376
635
  headers['Accept'] = 'application/json'
377
636
  headers['user-agent'] = @sdk_configuration.user_agent
378
637
  retries ||= @sdk_configuration.retry_config
@@ -389,19 +648,61 @@ module StackOne
389
648
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
390
649
  retry_options[:retry_statuses] = [429, 408]
391
650
 
651
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
652
+
653
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
654
+ timeout ||= @sdk_configuration.timeout
655
+
392
656
  connection = @sdk_configuration.client.dup
393
657
  connection.request :retry, retry_options
394
658
 
395
- r = connection.post(url) do |req|
396
- req.headers = headers
397
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
398
- Utils.configure_request_security(req, security) if !security.nil?
399
- if form
400
- req.body = Utils.encode_form(form)
401
- elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
402
- req.body = URI.encode_www_form(data)
659
+ hook_ctx = SDKHooks::HookContext.new(
660
+ base_url: base_url,
661
+ oauth2_scopes: [],
662
+ operation_id: 'marketing_create_sms_template',
663
+ security_source: @sdk_configuration.security_source
664
+ )
665
+
666
+ error = T.let(nil, T.nilable(StandardError))
667
+ r = T.let(nil, T.nilable(Faraday::Response))
668
+
669
+ begin
670
+ r = connection.post(url) do |req|
671
+ req.body = body
672
+ req.headers.merge!(headers)
673
+ req.options.timeout = timeout unless timeout.nil?
674
+ Utils.configure_request_security(req, security)
675
+
676
+ @sdk_configuration.hooks.before_request(
677
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
678
+ hook_ctx: hook_ctx
679
+ ),
680
+ request: req
681
+ )
682
+ end
683
+ rescue StandardError => e
684
+ error = e
685
+ ensure
686
+ if r.nil? || Utils.error_status?(r.status)
687
+ r = @sdk_configuration.hooks.after_error(
688
+ error: error,
689
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
690
+ hook_ctx: hook_ctx
691
+ ),
692
+ response: r
693
+ )
403
694
  else
404
- req.body = data
695
+ r = @sdk_configuration.hooks.after_success(
696
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
697
+ hook_ctx: hook_ctx
698
+ ),
699
+ response: r
700
+ )
701
+ end
702
+
703
+ if r.nil?
704
+ raise error if !error.nil?
705
+ raise 'no response'
405
706
  end
406
707
  end
407
708
 
@@ -425,8 +726,8 @@ module StackOne
425
726
  end
426
727
 
427
728
 
428
- sig { params(request: T.nilable(::StackOne::Operations::MarketingGetCampaignRequest), retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::MarketingGetCampaignResponse) }
429
- def get_campaign(request, retries = nil)
729
+ sig { params(request: T.nilable(::StackOne::Operations::MarketingGetCampaignRequest), retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::MarketingGetCampaignResponse) }
730
+ def get_campaign(request, retries = nil, timeout_ms = nil)
430
731
  # get_campaign - Get campaign
431
732
  url, params = @sdk_configuration.get_server_details
432
733
  base_url = Utils.template_url(url, params)
@@ -454,14 +755,62 @@ module StackOne
454
755
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
455
756
  retry_options[:retry_statuses] = [429, 408]
456
757
 
758
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
759
+
760
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
761
+ timeout ||= @sdk_configuration.timeout
762
+
457
763
  connection = @sdk_configuration.client.dup
458
764
  connection.request :retry, retry_options
459
765
 
460
- r = connection.get(url) do |req|
461
- req.headers = headers
462
- req.params = query_params
463
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
464
- Utils.configure_request_security(req, security) if !security.nil?
766
+ hook_ctx = SDKHooks::HookContext.new(
767
+ base_url: base_url,
768
+ oauth2_scopes: [],
769
+ operation_id: 'marketing_get_campaign',
770
+ security_source: @sdk_configuration.security_source
771
+ )
772
+
773
+ error = T.let(nil, T.nilable(StandardError))
774
+ r = T.let(nil, T.nilable(Faraday::Response))
775
+
776
+ begin
777
+ r = connection.get(url) do |req|
778
+ req.headers.merge!(headers)
779
+ req.options.timeout = timeout unless timeout.nil?
780
+ req.params = query_params
781
+ Utils.configure_request_security(req, security)
782
+
783
+ @sdk_configuration.hooks.before_request(
784
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
785
+ hook_ctx: hook_ctx
786
+ ),
787
+ request: req
788
+ )
789
+ end
790
+ rescue StandardError => e
791
+ error = e
792
+ ensure
793
+ if r.nil? || Utils.error_status?(r.status)
794
+ r = @sdk_configuration.hooks.after_error(
795
+ error: error,
796
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
797
+ hook_ctx: hook_ctx
798
+ ),
799
+ response: r
800
+ )
801
+ else
802
+ r = @sdk_configuration.hooks.after_success(
803
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
804
+ hook_ctx: hook_ctx
805
+ ),
806
+ response: r
807
+ )
808
+ end
809
+
810
+ if r.nil?
811
+ raise error if !error.nil?
812
+ raise 'no response'
813
+ end
465
814
  end
466
815
 
467
816
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -484,8 +833,8 @@ module StackOne
484
833
  end
485
834
 
486
835
 
487
- sig { params(request: T.nilable(::StackOne::Operations::MarketingGetContentBlockRequest), retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::MarketingGetContentBlockResponse) }
488
- def get_content_block(request, retries = nil)
836
+ sig { params(request: T.nilable(::StackOne::Operations::MarketingGetContentBlockRequest), retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::MarketingGetContentBlockResponse) }
837
+ def get_content_block(request, retries = nil, timeout_ms = nil)
489
838
  # get_content_block - Get Content Blocks
490
839
  url, params = @sdk_configuration.get_server_details
491
840
  base_url = Utils.template_url(url, params)
@@ -513,14 +862,62 @@ module StackOne
513
862
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
514
863
  retry_options[:retry_statuses] = [429, 408]
515
864
 
865
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
866
+
867
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
868
+ timeout ||= @sdk_configuration.timeout
869
+
516
870
  connection = @sdk_configuration.client.dup
517
871
  connection.request :retry, retry_options
518
872
 
519
- r = connection.get(url) do |req|
520
- req.headers = headers
521
- req.params = query_params
522
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
523
- Utils.configure_request_security(req, security) if !security.nil?
873
+ hook_ctx = SDKHooks::HookContext.new(
874
+ base_url: base_url,
875
+ oauth2_scopes: [],
876
+ operation_id: 'marketing_get_content_block',
877
+ security_source: @sdk_configuration.security_source
878
+ )
879
+
880
+ error = T.let(nil, T.nilable(StandardError))
881
+ r = T.let(nil, T.nilable(Faraday::Response))
882
+
883
+ begin
884
+ r = connection.get(url) do |req|
885
+ req.headers.merge!(headers)
886
+ req.options.timeout = timeout unless timeout.nil?
887
+ req.params = query_params
888
+ Utils.configure_request_security(req, security)
889
+
890
+ @sdk_configuration.hooks.before_request(
891
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
892
+ hook_ctx: hook_ctx
893
+ ),
894
+ request: req
895
+ )
896
+ end
897
+ rescue StandardError => e
898
+ error = e
899
+ ensure
900
+ if r.nil? || Utils.error_status?(r.status)
901
+ r = @sdk_configuration.hooks.after_error(
902
+ error: error,
903
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
904
+ hook_ctx: hook_ctx
905
+ ),
906
+ response: r
907
+ )
908
+ else
909
+ r = @sdk_configuration.hooks.after_success(
910
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
911
+ hook_ctx: hook_ctx
912
+ ),
913
+ response: r
914
+ )
915
+ end
916
+
917
+ if r.nil?
918
+ raise error if !error.nil?
919
+ raise 'no response'
920
+ end
524
921
  end
525
922
 
526
923
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -543,8 +940,8 @@ module StackOne
543
940
  end
544
941
 
545
942
 
546
- sig { params(request: T.nilable(::StackOne::Operations::MarketingGetEmailTemplateRequest), retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::MarketingGetEmailTemplateResponse) }
547
- def get_email_template(request, retries = nil)
943
+ sig { params(request: T.nilable(::StackOne::Operations::MarketingGetEmailTemplateRequest), retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::MarketingGetEmailTemplateResponse) }
944
+ def get_email_template(request, retries = nil, timeout_ms = nil)
548
945
  # get_email_template - Get Email Templates
549
946
  url, params = @sdk_configuration.get_server_details
550
947
  base_url = Utils.template_url(url, params)
@@ -572,14 +969,62 @@ module StackOne
572
969
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
573
970
  retry_options[:retry_statuses] = [429, 408]
574
971
 
972
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
973
+
974
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
975
+ timeout ||= @sdk_configuration.timeout
976
+
575
977
  connection = @sdk_configuration.client.dup
576
978
  connection.request :retry, retry_options
577
979
 
578
- r = connection.get(url) do |req|
579
- req.headers = headers
580
- req.params = query_params
581
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
582
- Utils.configure_request_security(req, security) if !security.nil?
980
+ hook_ctx = SDKHooks::HookContext.new(
981
+ base_url: base_url,
982
+ oauth2_scopes: [],
983
+ operation_id: 'marketing_get_email_template',
984
+ security_source: @sdk_configuration.security_source
985
+ )
986
+
987
+ error = T.let(nil, T.nilable(StandardError))
988
+ r = T.let(nil, T.nilable(Faraday::Response))
989
+
990
+ begin
991
+ r = connection.get(url) do |req|
992
+ req.headers.merge!(headers)
993
+ req.options.timeout = timeout unless timeout.nil?
994
+ req.params = query_params
995
+ Utils.configure_request_security(req, security)
996
+
997
+ @sdk_configuration.hooks.before_request(
998
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
999
+ hook_ctx: hook_ctx
1000
+ ),
1001
+ request: req
1002
+ )
1003
+ end
1004
+ rescue StandardError => e
1005
+ error = e
1006
+ ensure
1007
+ if r.nil? || Utils.error_status?(r.status)
1008
+ r = @sdk_configuration.hooks.after_error(
1009
+ error: error,
1010
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
1011
+ hook_ctx: hook_ctx
1012
+ ),
1013
+ response: r
1014
+ )
1015
+ else
1016
+ r = @sdk_configuration.hooks.after_success(
1017
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
1018
+ hook_ctx: hook_ctx
1019
+ ),
1020
+ response: r
1021
+ )
1022
+ end
1023
+
1024
+ if r.nil?
1025
+ raise error if !error.nil?
1026
+ raise 'no response'
1027
+ end
583
1028
  end
584
1029
 
585
1030
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -602,8 +1047,8 @@ module StackOne
602
1047
  end
603
1048
 
604
1049
 
605
- sig { params(request: T.nilable(::StackOne::Operations::MarketingGetInAppTemplateRequest), retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::MarketingGetInAppTemplateResponse) }
606
- def get_in_app_template(request, retries = nil)
1050
+ sig { params(request: T.nilable(::StackOne::Operations::MarketingGetInAppTemplateRequest), retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::MarketingGetInAppTemplateResponse) }
1051
+ def get_in_app_template(request, retries = nil, timeout_ms = nil)
607
1052
  # get_in_app_template - Get In-App Template
608
1053
  url, params = @sdk_configuration.get_server_details
609
1054
  base_url = Utils.template_url(url, params)
@@ -631,14 +1076,62 @@ module StackOne
631
1076
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
632
1077
  retry_options[:retry_statuses] = [429, 408]
633
1078
 
1079
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
1080
+
1081
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
1082
+ timeout ||= @sdk_configuration.timeout
1083
+
634
1084
  connection = @sdk_configuration.client.dup
635
1085
  connection.request :retry, retry_options
636
1086
 
637
- r = connection.get(url) do |req|
638
- req.headers = headers
639
- req.params = query_params
640
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
641
- Utils.configure_request_security(req, security) if !security.nil?
1087
+ hook_ctx = SDKHooks::HookContext.new(
1088
+ base_url: base_url,
1089
+ oauth2_scopes: [],
1090
+ operation_id: 'marketing_get_in_app_template',
1091
+ security_source: @sdk_configuration.security_source
1092
+ )
1093
+
1094
+ error = T.let(nil, T.nilable(StandardError))
1095
+ r = T.let(nil, T.nilable(Faraday::Response))
1096
+
1097
+ begin
1098
+ r = connection.get(url) do |req|
1099
+ req.headers.merge!(headers)
1100
+ req.options.timeout = timeout unless timeout.nil?
1101
+ req.params = query_params
1102
+ Utils.configure_request_security(req, security)
1103
+
1104
+ @sdk_configuration.hooks.before_request(
1105
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
1106
+ hook_ctx: hook_ctx
1107
+ ),
1108
+ request: req
1109
+ )
1110
+ end
1111
+ rescue StandardError => e
1112
+ error = e
1113
+ ensure
1114
+ if r.nil? || Utils.error_status?(r.status)
1115
+ r = @sdk_configuration.hooks.after_error(
1116
+ error: error,
1117
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
1118
+ hook_ctx: hook_ctx
1119
+ ),
1120
+ response: r
1121
+ )
1122
+ else
1123
+ r = @sdk_configuration.hooks.after_success(
1124
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
1125
+ hook_ctx: hook_ctx
1126
+ ),
1127
+ response: r
1128
+ )
1129
+ end
1130
+
1131
+ if r.nil?
1132
+ raise error if !error.nil?
1133
+ raise 'no response'
1134
+ end
642
1135
  end
643
1136
 
644
1137
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -661,8 +1154,8 @@ module StackOne
661
1154
  end
662
1155
 
663
1156
 
664
- sig { params(request: T.nilable(::StackOne::Operations::MarketingGetOmniChannelTemplateRequest), retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::MarketingGetOmniChannelTemplateResponse) }
665
- def get_omni_channel_template(request, retries = nil)
1157
+ sig { params(request: T.nilable(::StackOne::Operations::MarketingGetOmniChannelTemplateRequest), retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::MarketingGetOmniChannelTemplateResponse) }
1158
+ def get_omni_channel_template(request, retries = nil, timeout_ms = nil)
666
1159
  # get_omni_channel_template - Get Omni-Channel Template
667
1160
  #
668
1161
  # @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible.
@@ -692,14 +1185,62 @@ module StackOne
692
1185
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
693
1186
  retry_options[:retry_statuses] = [429, 408]
694
1187
 
1188
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
1189
+
1190
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
1191
+ timeout ||= @sdk_configuration.timeout
1192
+
695
1193
  connection = @sdk_configuration.client.dup
696
1194
  connection.request :retry, retry_options
697
1195
 
698
- r = connection.get(url) do |req|
699
- req.headers = headers
700
- req.params = query_params
701
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
702
- Utils.configure_request_security(req, security) if !security.nil?
1196
+ hook_ctx = SDKHooks::HookContext.new(
1197
+ base_url: base_url,
1198
+ oauth2_scopes: [],
1199
+ operation_id: 'marketing_get_omni_channel_template',
1200
+ security_source: @sdk_configuration.security_source
1201
+ )
1202
+
1203
+ error = T.let(nil, T.nilable(StandardError))
1204
+ r = T.let(nil, T.nilable(Faraday::Response))
1205
+
1206
+ begin
1207
+ r = connection.get(url) do |req|
1208
+ req.headers.merge!(headers)
1209
+ req.options.timeout = timeout unless timeout.nil?
1210
+ req.params = query_params
1211
+ Utils.configure_request_security(req, security)
1212
+
1213
+ @sdk_configuration.hooks.before_request(
1214
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
1215
+ hook_ctx: hook_ctx
1216
+ ),
1217
+ request: req
1218
+ )
1219
+ end
1220
+ rescue StandardError => e
1221
+ error = e
1222
+ ensure
1223
+ if r.nil? || Utils.error_status?(r.status)
1224
+ r = @sdk_configuration.hooks.after_error(
1225
+ error: error,
1226
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
1227
+ hook_ctx: hook_ctx
1228
+ ),
1229
+ response: r
1230
+ )
1231
+ else
1232
+ r = @sdk_configuration.hooks.after_success(
1233
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
1234
+ hook_ctx: hook_ctx
1235
+ ),
1236
+ response: r
1237
+ )
1238
+ end
1239
+
1240
+ if r.nil?
1241
+ raise error if !error.nil?
1242
+ raise 'no response'
1243
+ end
703
1244
  end
704
1245
 
705
1246
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -722,8 +1263,8 @@ module StackOne
722
1263
  end
723
1264
 
724
1265
 
725
- sig { params(request: T.nilable(::StackOne::Operations::MarketingGetPushTemplateRequest), retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::MarketingGetPushTemplateResponse) }
726
- def get_push_template(request, retries = nil)
1266
+ sig { params(request: T.nilable(::StackOne::Operations::MarketingGetPushTemplateRequest), retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::MarketingGetPushTemplateResponse) }
1267
+ def get_push_template(request, retries = nil, timeout_ms = nil)
727
1268
  # get_push_template - Get Push Template
728
1269
  url, params = @sdk_configuration.get_server_details
729
1270
  base_url = Utils.template_url(url, params)
@@ -751,14 +1292,62 @@ module StackOne
751
1292
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
752
1293
  retry_options[:retry_statuses] = [429, 408]
753
1294
 
1295
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
1296
+
1297
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
1298
+ timeout ||= @sdk_configuration.timeout
1299
+
754
1300
  connection = @sdk_configuration.client.dup
755
1301
  connection.request :retry, retry_options
756
1302
 
757
- r = connection.get(url) do |req|
758
- req.headers = headers
759
- req.params = query_params
760
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
761
- Utils.configure_request_security(req, security) if !security.nil?
1303
+ hook_ctx = SDKHooks::HookContext.new(
1304
+ base_url: base_url,
1305
+ oauth2_scopes: [],
1306
+ operation_id: 'marketing_get_push_template',
1307
+ security_source: @sdk_configuration.security_source
1308
+ )
1309
+
1310
+ error = T.let(nil, T.nilable(StandardError))
1311
+ r = T.let(nil, T.nilable(Faraday::Response))
1312
+
1313
+ begin
1314
+ r = connection.get(url) do |req|
1315
+ req.headers.merge!(headers)
1316
+ req.options.timeout = timeout unless timeout.nil?
1317
+ req.params = query_params
1318
+ Utils.configure_request_security(req, security)
1319
+
1320
+ @sdk_configuration.hooks.before_request(
1321
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
1322
+ hook_ctx: hook_ctx
1323
+ ),
1324
+ request: req
1325
+ )
1326
+ end
1327
+ rescue StandardError => e
1328
+ error = e
1329
+ ensure
1330
+ if r.nil? || Utils.error_status?(r.status)
1331
+ r = @sdk_configuration.hooks.after_error(
1332
+ error: error,
1333
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
1334
+ hook_ctx: hook_ctx
1335
+ ),
1336
+ response: r
1337
+ )
1338
+ else
1339
+ r = @sdk_configuration.hooks.after_success(
1340
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
1341
+ hook_ctx: hook_ctx
1342
+ ),
1343
+ response: r
1344
+ )
1345
+ end
1346
+
1347
+ if r.nil?
1348
+ raise error if !error.nil?
1349
+ raise 'no response'
1350
+ end
762
1351
  end
763
1352
 
764
1353
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -781,8 +1370,8 @@ module StackOne
781
1370
  end
782
1371
 
783
1372
 
784
- sig { params(request: T.nilable(::StackOne::Operations::MarketingGetSmsTemplateRequest), retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::MarketingGetSmsTemplateResponse) }
785
- def get_sms_template(request, retries = nil)
1373
+ sig { params(request: T.nilable(::StackOne::Operations::MarketingGetSmsTemplateRequest), retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::MarketingGetSmsTemplateResponse) }
1374
+ def get_sms_template(request, retries = nil, timeout_ms = nil)
786
1375
  # get_sms_template - Get SMS Template
787
1376
  url, params = @sdk_configuration.get_server_details
788
1377
  base_url = Utils.template_url(url, params)
@@ -810,14 +1399,62 @@ module StackOne
810
1399
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
811
1400
  retry_options[:retry_statuses] = [429, 408]
812
1401
 
1402
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
1403
+
1404
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
1405
+ timeout ||= @sdk_configuration.timeout
1406
+
813
1407
  connection = @sdk_configuration.client.dup
814
1408
  connection.request :retry, retry_options
815
1409
 
816
- r = connection.get(url) do |req|
817
- req.headers = headers
818
- req.params = query_params
819
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
820
- Utils.configure_request_security(req, security) if !security.nil?
1410
+ hook_ctx = SDKHooks::HookContext.new(
1411
+ base_url: base_url,
1412
+ oauth2_scopes: [],
1413
+ operation_id: 'marketing_get_sms_template',
1414
+ security_source: @sdk_configuration.security_source
1415
+ )
1416
+
1417
+ error = T.let(nil, T.nilable(StandardError))
1418
+ r = T.let(nil, T.nilable(Faraday::Response))
1419
+
1420
+ begin
1421
+ r = connection.get(url) do |req|
1422
+ req.headers.merge!(headers)
1423
+ req.options.timeout = timeout unless timeout.nil?
1424
+ req.params = query_params
1425
+ Utils.configure_request_security(req, security)
1426
+
1427
+ @sdk_configuration.hooks.before_request(
1428
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
1429
+ hook_ctx: hook_ctx
1430
+ ),
1431
+ request: req
1432
+ )
1433
+ end
1434
+ rescue StandardError => e
1435
+ error = e
1436
+ ensure
1437
+ if r.nil? || Utils.error_status?(r.status)
1438
+ r = @sdk_configuration.hooks.after_error(
1439
+ error: error,
1440
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
1441
+ hook_ctx: hook_ctx
1442
+ ),
1443
+ response: r
1444
+ )
1445
+ else
1446
+ r = @sdk_configuration.hooks.after_success(
1447
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
1448
+ hook_ctx: hook_ctx
1449
+ ),
1450
+ response: r
1451
+ )
1452
+ end
1453
+
1454
+ if r.nil?
1455
+ raise error if !error.nil?
1456
+ raise 'no response'
1457
+ end
821
1458
  end
822
1459
 
823
1460
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -840,8 +1477,8 @@ module StackOne
840
1477
  end
841
1478
 
842
1479
 
843
- sig { params(request: T.nilable(::StackOne::Operations::MarketingListCampaignsRequest), retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::MarketingListCampaignsResponse) }
844
- def list_campaigns(request, retries = nil)
1480
+ sig { params(request: T.nilable(::StackOne::Operations::MarketingListCampaignsRequest), retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::MarketingListCampaignsResponse) }
1481
+ def list_campaigns(request, retries = nil, timeout_ms = nil)
845
1482
  # list_campaigns - List campaigns
846
1483
  url, params = @sdk_configuration.get_server_details
847
1484
  base_url = Utils.template_url(url, params)
@@ -864,14 +1501,62 @@ module StackOne
864
1501
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
865
1502
  retry_options[:retry_statuses] = [429, 408]
866
1503
 
1504
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
1505
+
1506
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
1507
+ timeout ||= @sdk_configuration.timeout
1508
+
867
1509
  connection = @sdk_configuration.client.dup
868
1510
  connection.request :retry, retry_options
869
1511
 
870
- r = connection.get(url) do |req|
871
- req.headers = headers
872
- req.params = query_params
873
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
874
- Utils.configure_request_security(req, security) if !security.nil?
1512
+ hook_ctx = SDKHooks::HookContext.new(
1513
+ base_url: base_url,
1514
+ oauth2_scopes: [],
1515
+ operation_id: 'marketing_list_campaigns',
1516
+ security_source: @sdk_configuration.security_source
1517
+ )
1518
+
1519
+ error = T.let(nil, T.nilable(StandardError))
1520
+ r = T.let(nil, T.nilable(Faraday::Response))
1521
+
1522
+ begin
1523
+ r = connection.get(url) do |req|
1524
+ req.headers.merge!(headers)
1525
+ req.options.timeout = timeout unless timeout.nil?
1526
+ req.params = query_params
1527
+ Utils.configure_request_security(req, security)
1528
+
1529
+ @sdk_configuration.hooks.before_request(
1530
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
1531
+ hook_ctx: hook_ctx
1532
+ ),
1533
+ request: req
1534
+ )
1535
+ end
1536
+ rescue StandardError => e
1537
+ error = e
1538
+ ensure
1539
+ if r.nil? || Utils.error_status?(r.status)
1540
+ r = @sdk_configuration.hooks.after_error(
1541
+ error: error,
1542
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
1543
+ hook_ctx: hook_ctx
1544
+ ),
1545
+ response: r
1546
+ )
1547
+ else
1548
+ r = @sdk_configuration.hooks.after_success(
1549
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
1550
+ hook_ctx: hook_ctx
1551
+ ),
1552
+ response: r
1553
+ )
1554
+ end
1555
+
1556
+ if r.nil?
1557
+ raise error if !error.nil?
1558
+ raise 'no response'
1559
+ end
875
1560
  end
876
1561
 
877
1562
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -894,8 +1579,8 @@ module StackOne
894
1579
  end
895
1580
 
896
1581
 
897
- sig { params(request: T.nilable(::StackOne::Operations::MarketingListContentBlocksRequest), retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::MarketingListContentBlocksResponse) }
898
- def list_content_blocks(request, retries = nil)
1582
+ sig { params(request: T.nilable(::StackOne::Operations::MarketingListContentBlocksRequest), retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::MarketingListContentBlocksResponse) }
1583
+ def list_content_blocks(request, retries = nil, timeout_ms = nil)
899
1584
  # list_content_blocks - List Content Blocks
900
1585
  url, params = @sdk_configuration.get_server_details
901
1586
  base_url = Utils.template_url(url, params)
@@ -918,14 +1603,62 @@ module StackOne
918
1603
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
919
1604
  retry_options[:retry_statuses] = [429, 408]
920
1605
 
1606
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
1607
+
1608
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
1609
+ timeout ||= @sdk_configuration.timeout
1610
+
921
1611
  connection = @sdk_configuration.client.dup
922
1612
  connection.request :retry, retry_options
923
1613
 
924
- r = connection.get(url) do |req|
925
- req.headers = headers
926
- req.params = query_params
927
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
928
- Utils.configure_request_security(req, security) if !security.nil?
1614
+ hook_ctx = SDKHooks::HookContext.new(
1615
+ base_url: base_url,
1616
+ oauth2_scopes: [],
1617
+ operation_id: 'marketing_list_content_blocks',
1618
+ security_source: @sdk_configuration.security_source
1619
+ )
1620
+
1621
+ error = T.let(nil, T.nilable(StandardError))
1622
+ r = T.let(nil, T.nilable(Faraday::Response))
1623
+
1624
+ begin
1625
+ r = connection.get(url) do |req|
1626
+ req.headers.merge!(headers)
1627
+ req.options.timeout = timeout unless timeout.nil?
1628
+ req.params = query_params
1629
+ Utils.configure_request_security(req, security)
1630
+
1631
+ @sdk_configuration.hooks.before_request(
1632
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
1633
+ hook_ctx: hook_ctx
1634
+ ),
1635
+ request: req
1636
+ )
1637
+ end
1638
+ rescue StandardError => e
1639
+ error = e
1640
+ ensure
1641
+ if r.nil? || Utils.error_status?(r.status)
1642
+ r = @sdk_configuration.hooks.after_error(
1643
+ error: error,
1644
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
1645
+ hook_ctx: hook_ctx
1646
+ ),
1647
+ response: r
1648
+ )
1649
+ else
1650
+ r = @sdk_configuration.hooks.after_success(
1651
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
1652
+ hook_ctx: hook_ctx
1653
+ ),
1654
+ response: r
1655
+ )
1656
+ end
1657
+
1658
+ if r.nil?
1659
+ raise error if !error.nil?
1660
+ raise 'no response'
1661
+ end
929
1662
  end
930
1663
 
931
1664
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -948,8 +1681,8 @@ module StackOne
948
1681
  end
949
1682
 
950
1683
 
951
- sig { params(request: T.nilable(::StackOne::Operations::MarketingListEmailTemplatesRequest), retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::MarketingListEmailTemplatesResponse) }
952
- def list_email_templates(request, retries = nil)
1684
+ sig { params(request: T.nilable(::StackOne::Operations::MarketingListEmailTemplatesRequest), retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::MarketingListEmailTemplatesResponse) }
1685
+ def list_email_templates(request, retries = nil, timeout_ms = nil)
953
1686
  # list_email_templates - List Email Templates
954
1687
  url, params = @sdk_configuration.get_server_details
955
1688
  base_url = Utils.template_url(url, params)
@@ -972,14 +1705,62 @@ module StackOne
972
1705
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
973
1706
  retry_options[:retry_statuses] = [429, 408]
974
1707
 
1708
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
1709
+
1710
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
1711
+ timeout ||= @sdk_configuration.timeout
1712
+
975
1713
  connection = @sdk_configuration.client.dup
976
1714
  connection.request :retry, retry_options
977
1715
 
978
- r = connection.get(url) do |req|
979
- req.headers = headers
980
- req.params = query_params
981
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
982
- Utils.configure_request_security(req, security) if !security.nil?
1716
+ hook_ctx = SDKHooks::HookContext.new(
1717
+ base_url: base_url,
1718
+ oauth2_scopes: [],
1719
+ operation_id: 'marketing_list_email_templates',
1720
+ security_source: @sdk_configuration.security_source
1721
+ )
1722
+
1723
+ error = T.let(nil, T.nilable(StandardError))
1724
+ r = T.let(nil, T.nilable(Faraday::Response))
1725
+
1726
+ begin
1727
+ r = connection.get(url) do |req|
1728
+ req.headers.merge!(headers)
1729
+ req.options.timeout = timeout unless timeout.nil?
1730
+ req.params = query_params
1731
+ Utils.configure_request_security(req, security)
1732
+
1733
+ @sdk_configuration.hooks.before_request(
1734
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
1735
+ hook_ctx: hook_ctx
1736
+ ),
1737
+ request: req
1738
+ )
1739
+ end
1740
+ rescue StandardError => e
1741
+ error = e
1742
+ ensure
1743
+ if r.nil? || Utils.error_status?(r.status)
1744
+ r = @sdk_configuration.hooks.after_error(
1745
+ error: error,
1746
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
1747
+ hook_ctx: hook_ctx
1748
+ ),
1749
+ response: r
1750
+ )
1751
+ else
1752
+ r = @sdk_configuration.hooks.after_success(
1753
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
1754
+ hook_ctx: hook_ctx
1755
+ ),
1756
+ response: r
1757
+ )
1758
+ end
1759
+
1760
+ if r.nil?
1761
+ raise error if !error.nil?
1762
+ raise 'no response'
1763
+ end
983
1764
  end
984
1765
 
985
1766
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -1002,8 +1783,8 @@ module StackOne
1002
1783
  end
1003
1784
 
1004
1785
 
1005
- sig { params(request: T.nilable(::StackOne::Operations::MarketingListInAppTemplatesRequest), retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::MarketingListInAppTemplatesResponse) }
1006
- def list_in_app_templates(request, retries = nil)
1786
+ sig { params(request: T.nilable(::StackOne::Operations::MarketingListInAppTemplatesRequest), retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::MarketingListInAppTemplatesResponse) }
1787
+ def list_in_app_templates(request, retries = nil, timeout_ms = nil)
1007
1788
  # list_in_app_templates - List In-App Templates
1008
1789
  url, params = @sdk_configuration.get_server_details
1009
1790
  base_url = Utils.template_url(url, params)
@@ -1026,14 +1807,62 @@ module StackOne
1026
1807
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
1027
1808
  retry_options[:retry_statuses] = [429, 408]
1028
1809
 
1810
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
1811
+
1812
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
1813
+ timeout ||= @sdk_configuration.timeout
1814
+
1029
1815
  connection = @sdk_configuration.client.dup
1030
1816
  connection.request :retry, retry_options
1031
1817
 
1032
- r = connection.get(url) do |req|
1033
- req.headers = headers
1034
- req.params = query_params
1035
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
1036
- Utils.configure_request_security(req, security) if !security.nil?
1818
+ hook_ctx = SDKHooks::HookContext.new(
1819
+ base_url: base_url,
1820
+ oauth2_scopes: [],
1821
+ operation_id: 'marketing_list_in_app_templates',
1822
+ security_source: @sdk_configuration.security_source
1823
+ )
1824
+
1825
+ error = T.let(nil, T.nilable(StandardError))
1826
+ r = T.let(nil, T.nilable(Faraday::Response))
1827
+
1828
+ begin
1829
+ r = connection.get(url) do |req|
1830
+ req.headers.merge!(headers)
1831
+ req.options.timeout = timeout unless timeout.nil?
1832
+ req.params = query_params
1833
+ Utils.configure_request_security(req, security)
1834
+
1835
+ @sdk_configuration.hooks.before_request(
1836
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
1837
+ hook_ctx: hook_ctx
1838
+ ),
1839
+ request: req
1840
+ )
1841
+ end
1842
+ rescue StandardError => e
1843
+ error = e
1844
+ ensure
1845
+ if r.nil? || Utils.error_status?(r.status)
1846
+ r = @sdk_configuration.hooks.after_error(
1847
+ error: error,
1848
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
1849
+ hook_ctx: hook_ctx
1850
+ ),
1851
+ response: r
1852
+ )
1853
+ else
1854
+ r = @sdk_configuration.hooks.after_success(
1855
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
1856
+ hook_ctx: hook_ctx
1857
+ ),
1858
+ response: r
1859
+ )
1860
+ end
1861
+
1862
+ if r.nil?
1863
+ raise error if !error.nil?
1864
+ raise 'no response'
1865
+ end
1037
1866
  end
1038
1867
 
1039
1868
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -1056,8 +1885,8 @@ module StackOne
1056
1885
  end
1057
1886
 
1058
1887
 
1059
- sig { params(request: T.nilable(::StackOne::Operations::MarketingListOmniChannelTemplatesRequest), retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::MarketingListOmniChannelTemplatesResponse) }
1060
- def list_omni_channel_templates(request, retries = nil)
1888
+ sig { params(request: T.nilable(::StackOne::Operations::MarketingListOmniChannelTemplatesRequest), retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::MarketingListOmniChannelTemplatesResponse) }
1889
+ def list_omni_channel_templates(request, retries = nil, timeout_ms = nil)
1061
1890
  # list_omni_channel_templates - List Omni-Channel Templates
1062
1891
  #
1063
1892
  # @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible.
@@ -1082,14 +1911,62 @@ module StackOne
1082
1911
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
1083
1912
  retry_options[:retry_statuses] = [429, 408]
1084
1913
 
1914
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
1915
+
1916
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
1917
+ timeout ||= @sdk_configuration.timeout
1918
+
1085
1919
  connection = @sdk_configuration.client.dup
1086
1920
  connection.request :retry, retry_options
1087
1921
 
1088
- r = connection.get(url) do |req|
1089
- req.headers = headers
1090
- req.params = query_params
1091
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
1092
- Utils.configure_request_security(req, security) if !security.nil?
1922
+ hook_ctx = SDKHooks::HookContext.new(
1923
+ base_url: base_url,
1924
+ oauth2_scopes: [],
1925
+ operation_id: 'marketing_list_omni_channel_templates',
1926
+ security_source: @sdk_configuration.security_source
1927
+ )
1928
+
1929
+ error = T.let(nil, T.nilable(StandardError))
1930
+ r = T.let(nil, T.nilable(Faraday::Response))
1931
+
1932
+ begin
1933
+ r = connection.get(url) do |req|
1934
+ req.headers.merge!(headers)
1935
+ req.options.timeout = timeout unless timeout.nil?
1936
+ req.params = query_params
1937
+ Utils.configure_request_security(req, security)
1938
+
1939
+ @sdk_configuration.hooks.before_request(
1940
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
1941
+ hook_ctx: hook_ctx
1942
+ ),
1943
+ request: req
1944
+ )
1945
+ end
1946
+ rescue StandardError => e
1947
+ error = e
1948
+ ensure
1949
+ if r.nil? || Utils.error_status?(r.status)
1950
+ r = @sdk_configuration.hooks.after_error(
1951
+ error: error,
1952
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
1953
+ hook_ctx: hook_ctx
1954
+ ),
1955
+ response: r
1956
+ )
1957
+ else
1958
+ r = @sdk_configuration.hooks.after_success(
1959
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
1960
+ hook_ctx: hook_ctx
1961
+ ),
1962
+ response: r
1963
+ )
1964
+ end
1965
+
1966
+ if r.nil?
1967
+ raise error if !error.nil?
1968
+ raise 'no response'
1969
+ end
1093
1970
  end
1094
1971
 
1095
1972
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -1112,8 +1989,8 @@ module StackOne
1112
1989
  end
1113
1990
 
1114
1991
 
1115
- sig { params(request: T.nilable(::StackOne::Operations::MarketingListPushTemplatesRequest), retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::MarketingListPushTemplatesResponse) }
1116
- def list_push_templates(request, retries = nil)
1992
+ sig { params(request: T.nilable(::StackOne::Operations::MarketingListPushTemplatesRequest), retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::MarketingListPushTemplatesResponse) }
1993
+ def list_push_templates(request, retries = nil, timeout_ms = nil)
1117
1994
  # list_push_templates - List Push Templates
1118
1995
  url, params = @sdk_configuration.get_server_details
1119
1996
  base_url = Utils.template_url(url, params)
@@ -1136,14 +2013,62 @@ module StackOne
1136
2013
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
1137
2014
  retry_options[:retry_statuses] = [429, 408]
1138
2015
 
2016
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
2017
+
2018
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
2019
+ timeout ||= @sdk_configuration.timeout
2020
+
1139
2021
  connection = @sdk_configuration.client.dup
1140
2022
  connection.request :retry, retry_options
1141
2023
 
1142
- r = connection.get(url) do |req|
1143
- req.headers = headers
1144
- req.params = query_params
1145
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
1146
- Utils.configure_request_security(req, security) if !security.nil?
2024
+ hook_ctx = SDKHooks::HookContext.new(
2025
+ base_url: base_url,
2026
+ oauth2_scopes: [],
2027
+ operation_id: 'marketing_list_push_templates',
2028
+ security_source: @sdk_configuration.security_source
2029
+ )
2030
+
2031
+ error = T.let(nil, T.nilable(StandardError))
2032
+ r = T.let(nil, T.nilable(Faraday::Response))
2033
+
2034
+ begin
2035
+ r = connection.get(url) do |req|
2036
+ req.headers.merge!(headers)
2037
+ req.options.timeout = timeout unless timeout.nil?
2038
+ req.params = query_params
2039
+ Utils.configure_request_security(req, security)
2040
+
2041
+ @sdk_configuration.hooks.before_request(
2042
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
2043
+ hook_ctx: hook_ctx
2044
+ ),
2045
+ request: req
2046
+ )
2047
+ end
2048
+ rescue StandardError => e
2049
+ error = e
2050
+ ensure
2051
+ if r.nil? || Utils.error_status?(r.status)
2052
+ r = @sdk_configuration.hooks.after_error(
2053
+ error: error,
2054
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
2055
+ hook_ctx: hook_ctx
2056
+ ),
2057
+ response: r
2058
+ )
2059
+ else
2060
+ r = @sdk_configuration.hooks.after_success(
2061
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
2062
+ hook_ctx: hook_ctx
2063
+ ),
2064
+ response: r
2065
+ )
2066
+ end
2067
+
2068
+ if r.nil?
2069
+ raise error if !error.nil?
2070
+ raise 'no response'
2071
+ end
1147
2072
  end
1148
2073
 
1149
2074
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -1166,8 +2091,8 @@ module StackOne
1166
2091
  end
1167
2092
 
1168
2093
 
1169
- sig { params(request: T.nilable(::StackOne::Operations::MarketingListSmsTemplatesRequest), retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::MarketingListSmsTemplatesResponse) }
1170
- def list_sms_templates(request, retries = nil)
2094
+ sig { params(request: T.nilable(::StackOne::Operations::MarketingListSmsTemplatesRequest), retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::MarketingListSmsTemplatesResponse) }
2095
+ def list_sms_templates(request, retries = nil, timeout_ms = nil)
1171
2096
  # list_sms_templates - List SMS Templates
1172
2097
  url, params = @sdk_configuration.get_server_details
1173
2098
  base_url = Utils.template_url(url, params)
@@ -1190,14 +2115,62 @@ module StackOne
1190
2115
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
1191
2116
  retry_options[:retry_statuses] = [429, 408]
1192
2117
 
2118
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
2119
+
2120
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
2121
+ timeout ||= @sdk_configuration.timeout
2122
+
1193
2123
  connection = @sdk_configuration.client.dup
1194
2124
  connection.request :retry, retry_options
1195
2125
 
1196
- r = connection.get(url) do |req|
1197
- req.headers = headers
1198
- req.params = query_params
1199
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
1200
- Utils.configure_request_security(req, security) if !security.nil?
2126
+ hook_ctx = SDKHooks::HookContext.new(
2127
+ base_url: base_url,
2128
+ oauth2_scopes: [],
2129
+ operation_id: 'marketing_list_sms_templates',
2130
+ security_source: @sdk_configuration.security_source
2131
+ )
2132
+
2133
+ error = T.let(nil, T.nilable(StandardError))
2134
+ r = T.let(nil, T.nilable(Faraday::Response))
2135
+
2136
+ begin
2137
+ r = connection.get(url) do |req|
2138
+ req.headers.merge!(headers)
2139
+ req.options.timeout = timeout unless timeout.nil?
2140
+ req.params = query_params
2141
+ Utils.configure_request_security(req, security)
2142
+
2143
+ @sdk_configuration.hooks.before_request(
2144
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
2145
+ hook_ctx: hook_ctx
2146
+ ),
2147
+ request: req
2148
+ )
2149
+ end
2150
+ rescue StandardError => e
2151
+ error = e
2152
+ ensure
2153
+ if r.nil? || Utils.error_status?(r.status)
2154
+ r = @sdk_configuration.hooks.after_error(
2155
+ error: error,
2156
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
2157
+ hook_ctx: hook_ctx
2158
+ ),
2159
+ response: r
2160
+ )
2161
+ else
2162
+ r = @sdk_configuration.hooks.after_success(
2163
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
2164
+ hook_ctx: hook_ctx
2165
+ ),
2166
+ response: r
2167
+ )
2168
+ end
2169
+
2170
+ if r.nil?
2171
+ raise error if !error.nil?
2172
+ raise 'no response'
2173
+ end
1201
2174
  end
1202
2175
 
1203
2176
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -1220,8 +2193,8 @@ module StackOne
1220
2193
  end
1221
2194
 
1222
2195
 
1223
- sig { params(marketing_create_content_blocks_request_dto: ::StackOne::Shared::MarketingCreateContentBlocksRequestDto, id: ::String, x_account_id: ::String, retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::MarketingUpdateContentBlockResponse) }
1224
- def update_content_block(marketing_create_content_blocks_request_dto, id, x_account_id, retries = nil)
2196
+ sig { params(marketing_create_content_blocks_request_dto: ::StackOne::Shared::MarketingCreateContentBlocksRequestDto, id: ::String, x_account_id: ::String, retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::MarketingUpdateContentBlockResponse) }
2197
+ def update_content_block(marketing_create_content_blocks_request_dto, id, x_account_id, retries = nil, timeout_ms = nil)
1225
2198
  # update_content_block - Update Content Block
1226
2199
  request = ::StackOne::Operations::MarketingUpdateContentBlockRequest.new(
1227
2200
 
@@ -1241,6 +2214,14 @@ module StackOne
1241
2214
  req_content_type, data, form = Utils.serialize_request_body(request, :marketing_create_content_blocks_request_dto, :json)
1242
2215
  headers['content-type'] = req_content_type
1243
2216
  raise StandardError, 'request body is required' if data.nil? && form.nil?
2217
+
2218
+ if form
2219
+ body = Utils.encode_form(form)
2220
+ elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
2221
+ body = URI.encode_www_form(data)
2222
+ else
2223
+ body = data
2224
+ end
1244
2225
  headers['Accept'] = 'application/json'
1245
2226
  headers['user-agent'] = @sdk_configuration.user_agent
1246
2227
  retries ||= @sdk_configuration.retry_config
@@ -1257,19 +2238,61 @@ module StackOne
1257
2238
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
1258
2239
  retry_options[:retry_statuses] = [429, 408]
1259
2240
 
2241
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
2242
+
2243
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
2244
+ timeout ||= @sdk_configuration.timeout
2245
+
1260
2246
  connection = @sdk_configuration.client.dup
1261
2247
  connection.request :retry, retry_options
1262
2248
 
1263
- r = connection.patch(url) do |req|
1264
- req.headers = headers
1265
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
1266
- Utils.configure_request_security(req, security) if !security.nil?
1267
- if form
1268
- req.body = Utils.encode_form(form)
1269
- elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
1270
- req.body = URI.encode_www_form(data)
2249
+ hook_ctx = SDKHooks::HookContext.new(
2250
+ base_url: base_url,
2251
+ oauth2_scopes: [],
2252
+ operation_id: 'marketing_update_content_block',
2253
+ security_source: @sdk_configuration.security_source
2254
+ )
2255
+
2256
+ error = T.let(nil, T.nilable(StandardError))
2257
+ r = T.let(nil, T.nilable(Faraday::Response))
2258
+
2259
+ begin
2260
+ r = connection.patch(url) do |req|
2261
+ req.body = body
2262
+ req.headers.merge!(headers)
2263
+ req.options.timeout = timeout unless timeout.nil?
2264
+ Utils.configure_request_security(req, security)
2265
+
2266
+ @sdk_configuration.hooks.before_request(
2267
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
2268
+ hook_ctx: hook_ctx
2269
+ ),
2270
+ request: req
2271
+ )
2272
+ end
2273
+ rescue StandardError => e
2274
+ error = e
2275
+ ensure
2276
+ if r.nil? || Utils.error_status?(r.status)
2277
+ r = @sdk_configuration.hooks.after_error(
2278
+ error: error,
2279
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
2280
+ hook_ctx: hook_ctx
2281
+ ),
2282
+ response: r
2283
+ )
1271
2284
  else
1272
- req.body = data
2285
+ r = @sdk_configuration.hooks.after_success(
2286
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
2287
+ hook_ctx: hook_ctx
2288
+ ),
2289
+ response: r
2290
+ )
2291
+ end
2292
+
2293
+ if r.nil?
2294
+ raise error if !error.nil?
2295
+ raise 'no response'
1273
2296
  end
1274
2297
  end
1275
2298
 
@@ -1293,8 +2316,8 @@ module StackOne
1293
2316
  end
1294
2317
 
1295
2318
 
1296
- sig { params(marketing_create_email_template_request_dto: ::StackOne::Shared::MarketingCreateEmailTemplateRequestDto, id: ::String, x_account_id: ::String, retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::MarketingUpdateEmailTemplateResponse) }
1297
- def update_email_template(marketing_create_email_template_request_dto, id, x_account_id, retries = nil)
2319
+ sig { params(marketing_create_email_template_request_dto: ::StackOne::Shared::MarketingCreateEmailTemplateRequestDto, id: ::String, x_account_id: ::String, retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::MarketingUpdateEmailTemplateResponse) }
2320
+ def update_email_template(marketing_create_email_template_request_dto, id, x_account_id, retries = nil, timeout_ms = nil)
1298
2321
  # update_email_template - Update Email Templates
1299
2322
  request = ::StackOne::Operations::MarketingUpdateEmailTemplateRequest.new(
1300
2323
 
@@ -1314,6 +2337,14 @@ module StackOne
1314
2337
  req_content_type, data, form = Utils.serialize_request_body(request, :marketing_create_email_template_request_dto, :json)
1315
2338
  headers['content-type'] = req_content_type
1316
2339
  raise StandardError, 'request body is required' if data.nil? && form.nil?
2340
+
2341
+ if form
2342
+ body = Utils.encode_form(form)
2343
+ elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
2344
+ body = URI.encode_www_form(data)
2345
+ else
2346
+ body = data
2347
+ end
1317
2348
  headers['Accept'] = 'application/json'
1318
2349
  headers['user-agent'] = @sdk_configuration.user_agent
1319
2350
  retries ||= @sdk_configuration.retry_config
@@ -1330,19 +2361,61 @@ module StackOne
1330
2361
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
1331
2362
  retry_options[:retry_statuses] = [429, 408]
1332
2363
 
2364
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
2365
+
2366
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
2367
+ timeout ||= @sdk_configuration.timeout
2368
+
1333
2369
  connection = @sdk_configuration.client.dup
1334
2370
  connection.request :retry, retry_options
1335
2371
 
1336
- r = connection.patch(url) do |req|
1337
- req.headers = headers
1338
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
1339
- Utils.configure_request_security(req, security) if !security.nil?
1340
- if form
1341
- req.body = Utils.encode_form(form)
1342
- elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
1343
- req.body = URI.encode_www_form(data)
2372
+ hook_ctx = SDKHooks::HookContext.new(
2373
+ base_url: base_url,
2374
+ oauth2_scopes: [],
2375
+ operation_id: 'marketing_update_email_template',
2376
+ security_source: @sdk_configuration.security_source
2377
+ )
2378
+
2379
+ error = T.let(nil, T.nilable(StandardError))
2380
+ r = T.let(nil, T.nilable(Faraday::Response))
2381
+
2382
+ begin
2383
+ r = connection.patch(url) do |req|
2384
+ req.body = body
2385
+ req.headers.merge!(headers)
2386
+ req.options.timeout = timeout unless timeout.nil?
2387
+ Utils.configure_request_security(req, security)
2388
+
2389
+ @sdk_configuration.hooks.before_request(
2390
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
2391
+ hook_ctx: hook_ctx
2392
+ ),
2393
+ request: req
2394
+ )
2395
+ end
2396
+ rescue StandardError => e
2397
+ error = e
2398
+ ensure
2399
+ if r.nil? || Utils.error_status?(r.status)
2400
+ r = @sdk_configuration.hooks.after_error(
2401
+ error: error,
2402
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
2403
+ hook_ctx: hook_ctx
2404
+ ),
2405
+ response: r
2406
+ )
1344
2407
  else
1345
- req.body = data
2408
+ r = @sdk_configuration.hooks.after_success(
2409
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
2410
+ hook_ctx: hook_ctx
2411
+ ),
2412
+ response: r
2413
+ )
2414
+ end
2415
+
2416
+ if r.nil?
2417
+ raise error if !error.nil?
2418
+ raise 'no response'
1346
2419
  end
1347
2420
  end
1348
2421
 
@@ -1366,8 +2439,8 @@ module StackOne
1366
2439
  end
1367
2440
 
1368
2441
 
1369
- sig { params(marketing_create_in_app_template_request_dto: ::StackOne::Shared::MarketingCreateInAppTemplateRequestDto, id: ::String, x_account_id: ::String, retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::MarketingUpdateInAppTemplateResponse) }
1370
- def update_in_app_template(marketing_create_in_app_template_request_dto, id, x_account_id, retries = nil)
2442
+ sig { params(marketing_create_in_app_template_request_dto: ::StackOne::Shared::MarketingCreateInAppTemplateRequestDto, id: ::String, x_account_id: ::String, retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::MarketingUpdateInAppTemplateResponse) }
2443
+ def update_in_app_template(marketing_create_in_app_template_request_dto, id, x_account_id, retries = nil, timeout_ms = nil)
1371
2444
  # update_in_app_template - Update In-App Template
1372
2445
  request = ::StackOne::Operations::MarketingUpdateInAppTemplateRequest.new(
1373
2446
 
@@ -1387,6 +2460,14 @@ module StackOne
1387
2460
  req_content_type, data, form = Utils.serialize_request_body(request, :marketing_create_in_app_template_request_dto, :json)
1388
2461
  headers['content-type'] = req_content_type
1389
2462
  raise StandardError, 'request body is required' if data.nil? && form.nil?
2463
+
2464
+ if form
2465
+ body = Utils.encode_form(form)
2466
+ elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
2467
+ body = URI.encode_www_form(data)
2468
+ else
2469
+ body = data
2470
+ end
1390
2471
  headers['Accept'] = 'application/json'
1391
2472
  headers['user-agent'] = @sdk_configuration.user_agent
1392
2473
  retries ||= @sdk_configuration.retry_config
@@ -1403,19 +2484,61 @@ module StackOne
1403
2484
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
1404
2485
  retry_options[:retry_statuses] = [429, 408]
1405
2486
 
2487
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
2488
+
2489
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
2490
+ timeout ||= @sdk_configuration.timeout
2491
+
1406
2492
  connection = @sdk_configuration.client.dup
1407
2493
  connection.request :retry, retry_options
1408
2494
 
1409
- r = connection.patch(url) do |req|
1410
- req.headers = headers
1411
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
1412
- Utils.configure_request_security(req, security) if !security.nil?
1413
- if form
1414
- req.body = Utils.encode_form(form)
1415
- elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
1416
- req.body = URI.encode_www_form(data)
2495
+ hook_ctx = SDKHooks::HookContext.new(
2496
+ base_url: base_url,
2497
+ oauth2_scopes: [],
2498
+ operation_id: 'marketing_update_in_app_template',
2499
+ security_source: @sdk_configuration.security_source
2500
+ )
2501
+
2502
+ error = T.let(nil, T.nilable(StandardError))
2503
+ r = T.let(nil, T.nilable(Faraday::Response))
2504
+
2505
+ begin
2506
+ r = connection.patch(url) do |req|
2507
+ req.body = body
2508
+ req.headers.merge!(headers)
2509
+ req.options.timeout = timeout unless timeout.nil?
2510
+ Utils.configure_request_security(req, security)
2511
+
2512
+ @sdk_configuration.hooks.before_request(
2513
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
2514
+ hook_ctx: hook_ctx
2515
+ ),
2516
+ request: req
2517
+ )
2518
+ end
2519
+ rescue StandardError => e
2520
+ error = e
2521
+ ensure
2522
+ if r.nil? || Utils.error_status?(r.status)
2523
+ r = @sdk_configuration.hooks.after_error(
2524
+ error: error,
2525
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
2526
+ hook_ctx: hook_ctx
2527
+ ),
2528
+ response: r
2529
+ )
1417
2530
  else
1418
- req.body = data
2531
+ r = @sdk_configuration.hooks.after_success(
2532
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
2533
+ hook_ctx: hook_ctx
2534
+ ),
2535
+ response: r
2536
+ )
2537
+ end
2538
+
2539
+ if r.nil?
2540
+ raise error if !error.nil?
2541
+ raise 'no response'
1419
2542
  end
1420
2543
  end
1421
2544
 
@@ -1439,8 +2562,8 @@ module StackOne
1439
2562
  end
1440
2563
 
1441
2564
 
1442
- sig { params(marketing_create_template_request_dto: ::StackOne::Shared::MarketingCreateTemplateRequestDto, id: ::String, x_account_id: ::String, retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::MarketingUpdateOmniChannelTemplateResponse) }
1443
- def update_omni_channel_template(marketing_create_template_request_dto, id, x_account_id, retries = nil)
2565
+ sig { params(marketing_create_template_request_dto: ::StackOne::Shared::MarketingCreateTemplateRequestDto, id: ::String, x_account_id: ::String, retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::MarketingUpdateOmniChannelTemplateResponse) }
2566
+ def update_omni_channel_template(marketing_create_template_request_dto, id, x_account_id, retries = nil, timeout_ms = nil)
1444
2567
  # update_omni_channel_template - Update Omni-Channel Template
1445
2568
  #
1446
2569
  # @deprecated method: This will be removed in a future release, please migrate away from it as soon as possible.
@@ -1462,6 +2585,14 @@ module StackOne
1462
2585
  req_content_type, data, form = Utils.serialize_request_body(request, :marketing_create_template_request_dto, :json)
1463
2586
  headers['content-type'] = req_content_type
1464
2587
  raise StandardError, 'request body is required' if data.nil? && form.nil?
2588
+
2589
+ if form
2590
+ body = Utils.encode_form(form)
2591
+ elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
2592
+ body = URI.encode_www_form(data)
2593
+ else
2594
+ body = data
2595
+ end
1465
2596
  headers['Accept'] = 'application/json'
1466
2597
  headers['user-agent'] = @sdk_configuration.user_agent
1467
2598
  retries ||= @sdk_configuration.retry_config
@@ -1478,19 +2609,61 @@ module StackOne
1478
2609
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
1479
2610
  retry_options[:retry_statuses] = [429, 408]
1480
2611
 
2612
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
2613
+
2614
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
2615
+ timeout ||= @sdk_configuration.timeout
2616
+
1481
2617
  connection = @sdk_configuration.client.dup
1482
2618
  connection.request :retry, retry_options
1483
2619
 
1484
- r = connection.patch(url) do |req|
1485
- req.headers = headers
1486
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
1487
- Utils.configure_request_security(req, security) if !security.nil?
1488
- if form
1489
- req.body = Utils.encode_form(form)
1490
- elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
1491
- req.body = URI.encode_www_form(data)
2620
+ hook_ctx = SDKHooks::HookContext.new(
2621
+ base_url: base_url,
2622
+ oauth2_scopes: [],
2623
+ operation_id: 'marketing_update_omni_channel_template',
2624
+ security_source: @sdk_configuration.security_source
2625
+ )
2626
+
2627
+ error = T.let(nil, T.nilable(StandardError))
2628
+ r = T.let(nil, T.nilable(Faraday::Response))
2629
+
2630
+ begin
2631
+ r = connection.patch(url) do |req|
2632
+ req.body = body
2633
+ req.headers.merge!(headers)
2634
+ req.options.timeout = timeout unless timeout.nil?
2635
+ Utils.configure_request_security(req, security)
2636
+
2637
+ @sdk_configuration.hooks.before_request(
2638
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
2639
+ hook_ctx: hook_ctx
2640
+ ),
2641
+ request: req
2642
+ )
2643
+ end
2644
+ rescue StandardError => e
2645
+ error = e
2646
+ ensure
2647
+ if r.nil? || Utils.error_status?(r.status)
2648
+ r = @sdk_configuration.hooks.after_error(
2649
+ error: error,
2650
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
2651
+ hook_ctx: hook_ctx
2652
+ ),
2653
+ response: r
2654
+ )
1492
2655
  else
1493
- req.body = data
2656
+ r = @sdk_configuration.hooks.after_success(
2657
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
2658
+ hook_ctx: hook_ctx
2659
+ ),
2660
+ response: r
2661
+ )
2662
+ end
2663
+
2664
+ if r.nil?
2665
+ raise error if !error.nil?
2666
+ raise 'no response'
1494
2667
  end
1495
2668
  end
1496
2669
 
@@ -1514,8 +2687,8 @@ module StackOne
1514
2687
  end
1515
2688
 
1516
2689
 
1517
- sig { params(marketing_create_push_template_request_dto: ::StackOne::Shared::MarketingCreatePushTemplateRequestDto, id: ::String, x_account_id: ::String, retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::MarketingUpdatePushTemplateResponse) }
1518
- def update_push_template(marketing_create_push_template_request_dto, id, x_account_id, retries = nil)
2690
+ sig { params(marketing_create_push_template_request_dto: ::StackOne::Shared::MarketingCreatePushTemplateRequestDto, id: ::String, x_account_id: ::String, retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::MarketingUpdatePushTemplateResponse) }
2691
+ def update_push_template(marketing_create_push_template_request_dto, id, x_account_id, retries = nil, timeout_ms = nil)
1519
2692
  # update_push_template - Update Push Template
1520
2693
  request = ::StackOne::Operations::MarketingUpdatePushTemplateRequest.new(
1521
2694
 
@@ -1535,6 +2708,14 @@ module StackOne
1535
2708
  req_content_type, data, form = Utils.serialize_request_body(request, :marketing_create_push_template_request_dto, :json)
1536
2709
  headers['content-type'] = req_content_type
1537
2710
  raise StandardError, 'request body is required' if data.nil? && form.nil?
2711
+
2712
+ if form
2713
+ body = Utils.encode_form(form)
2714
+ elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
2715
+ body = URI.encode_www_form(data)
2716
+ else
2717
+ body = data
2718
+ end
1538
2719
  headers['Accept'] = 'application/json'
1539
2720
  headers['user-agent'] = @sdk_configuration.user_agent
1540
2721
  retries ||= @sdk_configuration.retry_config
@@ -1551,19 +2732,61 @@ module StackOne
1551
2732
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
1552
2733
  retry_options[:retry_statuses] = [429, 408]
1553
2734
 
2735
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
2736
+
2737
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
2738
+ timeout ||= @sdk_configuration.timeout
2739
+
1554
2740
  connection = @sdk_configuration.client.dup
1555
2741
  connection.request :retry, retry_options
1556
2742
 
1557
- r = connection.patch(url) do |req|
1558
- req.headers = headers
1559
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
1560
- Utils.configure_request_security(req, security) if !security.nil?
1561
- if form
1562
- req.body = Utils.encode_form(form)
1563
- elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
1564
- req.body = URI.encode_www_form(data)
2743
+ hook_ctx = SDKHooks::HookContext.new(
2744
+ base_url: base_url,
2745
+ oauth2_scopes: [],
2746
+ operation_id: 'marketing_update_push_template',
2747
+ security_source: @sdk_configuration.security_source
2748
+ )
2749
+
2750
+ error = T.let(nil, T.nilable(StandardError))
2751
+ r = T.let(nil, T.nilable(Faraday::Response))
2752
+
2753
+ begin
2754
+ r = connection.patch(url) do |req|
2755
+ req.body = body
2756
+ req.headers.merge!(headers)
2757
+ req.options.timeout = timeout unless timeout.nil?
2758
+ Utils.configure_request_security(req, security)
2759
+
2760
+ @sdk_configuration.hooks.before_request(
2761
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
2762
+ hook_ctx: hook_ctx
2763
+ ),
2764
+ request: req
2765
+ )
2766
+ end
2767
+ rescue StandardError => e
2768
+ error = e
2769
+ ensure
2770
+ if r.nil? || Utils.error_status?(r.status)
2771
+ r = @sdk_configuration.hooks.after_error(
2772
+ error: error,
2773
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
2774
+ hook_ctx: hook_ctx
2775
+ ),
2776
+ response: r
2777
+ )
1565
2778
  else
1566
- req.body = data
2779
+ r = @sdk_configuration.hooks.after_success(
2780
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
2781
+ hook_ctx: hook_ctx
2782
+ ),
2783
+ response: r
2784
+ )
2785
+ end
2786
+
2787
+ if r.nil?
2788
+ raise error if !error.nil?
2789
+ raise 'no response'
1567
2790
  end
1568
2791
  end
1569
2792
 
@@ -1587,8 +2810,8 @@ module StackOne
1587
2810
  end
1588
2811
 
1589
2812
 
1590
- sig { params(marketing_create_sms_template_request_dto: ::StackOne::Shared::MarketingCreateSmsTemplateRequestDto, id: ::String, x_account_id: ::String, retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::MarketingUpdateSmsTemplateResponse) }
1591
- def update_sms_template(marketing_create_sms_template_request_dto, id, x_account_id, retries = nil)
2813
+ sig { params(marketing_create_sms_template_request_dto: ::StackOne::Shared::MarketingCreateSmsTemplateRequestDto, id: ::String, x_account_id: ::String, retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::MarketingUpdateSmsTemplateResponse) }
2814
+ def update_sms_template(marketing_create_sms_template_request_dto, id, x_account_id, retries = nil, timeout_ms = nil)
1592
2815
  # update_sms_template - Update SMS Template
1593
2816
  request = ::StackOne::Operations::MarketingUpdateSmsTemplateRequest.new(
1594
2817
 
@@ -1608,6 +2831,14 @@ module StackOne
1608
2831
  req_content_type, data, form = Utils.serialize_request_body(request, :marketing_create_sms_template_request_dto, :json)
1609
2832
  headers['content-type'] = req_content_type
1610
2833
  raise StandardError, 'request body is required' if data.nil? && form.nil?
2834
+
2835
+ if form
2836
+ body = Utils.encode_form(form)
2837
+ elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
2838
+ body = URI.encode_www_form(data)
2839
+ else
2840
+ body = data
2841
+ end
1611
2842
  headers['Accept'] = 'application/json'
1612
2843
  headers['user-agent'] = @sdk_configuration.user_agent
1613
2844
  retries ||= @sdk_configuration.retry_config
@@ -1624,19 +2855,61 @@ module StackOne
1624
2855
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
1625
2856
  retry_options[:retry_statuses] = [429, 408]
1626
2857
 
2858
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
2859
+
2860
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
2861
+ timeout ||= @sdk_configuration.timeout
2862
+
1627
2863
  connection = @sdk_configuration.client.dup
1628
2864
  connection.request :retry, retry_options
1629
2865
 
1630
- r = connection.patch(url) do |req|
1631
- req.headers = headers
1632
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
1633
- Utils.configure_request_security(req, security) if !security.nil?
1634
- if form
1635
- req.body = Utils.encode_form(form)
1636
- elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
1637
- req.body = URI.encode_www_form(data)
2866
+ hook_ctx = SDKHooks::HookContext.new(
2867
+ base_url: base_url,
2868
+ oauth2_scopes: [],
2869
+ operation_id: 'marketing_update_sms_template',
2870
+ security_source: @sdk_configuration.security_source
2871
+ )
2872
+
2873
+ error = T.let(nil, T.nilable(StandardError))
2874
+ r = T.let(nil, T.nilable(Faraday::Response))
2875
+
2876
+ begin
2877
+ r = connection.patch(url) do |req|
2878
+ req.body = body
2879
+ req.headers.merge!(headers)
2880
+ req.options.timeout = timeout unless timeout.nil?
2881
+ Utils.configure_request_security(req, security)
2882
+
2883
+ @sdk_configuration.hooks.before_request(
2884
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
2885
+ hook_ctx: hook_ctx
2886
+ ),
2887
+ request: req
2888
+ )
2889
+ end
2890
+ rescue StandardError => e
2891
+ error = e
2892
+ ensure
2893
+ if r.nil? || Utils.error_status?(r.status)
2894
+ r = @sdk_configuration.hooks.after_error(
2895
+ error: error,
2896
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
2897
+ hook_ctx: hook_ctx
2898
+ ),
2899
+ response: r
2900
+ )
1638
2901
  else
1639
- req.body = data
2902
+ r = @sdk_configuration.hooks.after_success(
2903
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
2904
+ hook_ctx: hook_ctx
2905
+ ),
2906
+ response: r
2907
+ )
2908
+ end
2909
+
2910
+ if r.nil?
2911
+ raise error if !error.nil?
2912
+ raise 'no response'
1640
2913
  end
1641
2914
  end
1642
2915