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
data/lib/stack_one/crm.rb CHANGED
@@ -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(crm_create_contact_request_dto: ::StackOne::Shared::CrmCreateContactRequestDto, x_account_id: ::String, retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::CrmCreateContactResponse) }
25
- def create_contact(crm_create_contact_request_dto, x_account_id, retries = nil)
25
+ sig { params(crm_create_contact_request_dto: ::StackOne::Shared::CrmCreateContactRequestDto, x_account_id: ::String, retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::CrmCreateContactResponse) }
26
+ def create_contact(crm_create_contact_request_dto, x_account_id, retries = nil, timeout_ms = nil)
26
27
  # create_contact - Creates a new Contact
27
28
  request = ::StackOne::Operations::CrmCreateContactRequest.new(
28
29
 
@@ -36,6 +37,14 @@ module StackOne
36
37
  req_content_type, data, form = Utils.serialize_request_body(request, :crm_create_contact_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: 'crm_create_contact',
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(request: T.nilable(::StackOne::Operations::CrmGetAccountRequest), retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::CrmGetAccountResponse) }
92
- def get_account(request, retries = nil)
142
+ sig { params(request: T.nilable(::StackOne::Operations::CrmGetAccountRequest), retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::CrmGetAccountResponse) }
143
+ def get_account(request, retries = nil, timeout_ms = nil)
93
144
  # get_account - Get Account
94
145
  url, params = @sdk_configuration.get_server_details
95
146
  base_url = Utils.template_url(url, params)
@@ -117,14 +168,62 @@ module StackOne
117
168
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
118
169
  retry_options[:retry_statuses] = [429, 408]
119
170
 
171
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
172
+
173
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
174
+ timeout ||= @sdk_configuration.timeout
175
+
120
176
  connection = @sdk_configuration.client.dup
121
177
  connection.request :retry, retry_options
122
178
 
123
- r = connection.get(url) do |req|
124
- req.headers = headers
125
- req.params = query_params
126
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
127
- Utils.configure_request_security(req, security) if !security.nil?
179
+ hook_ctx = SDKHooks::HookContext.new(
180
+ base_url: base_url,
181
+ oauth2_scopes: [],
182
+ operation_id: 'crm_get_account',
183
+ security_source: @sdk_configuration.security_source
184
+ )
185
+
186
+ error = T.let(nil, T.nilable(StandardError))
187
+ r = T.let(nil, T.nilable(Faraday::Response))
188
+
189
+ begin
190
+ r = connection.get(url) do |req|
191
+ req.headers.merge!(headers)
192
+ req.options.timeout = timeout unless timeout.nil?
193
+ req.params = query_params
194
+ Utils.configure_request_security(req, security)
195
+
196
+ @sdk_configuration.hooks.before_request(
197
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
198
+ hook_ctx: hook_ctx
199
+ ),
200
+ request: req
201
+ )
202
+ end
203
+ rescue StandardError => e
204
+ error = e
205
+ ensure
206
+ if r.nil? || Utils.error_status?(r.status)
207
+ r = @sdk_configuration.hooks.after_error(
208
+ error: error,
209
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
210
+ hook_ctx: hook_ctx
211
+ ),
212
+ response: r
213
+ )
214
+ else
215
+ r = @sdk_configuration.hooks.after_success(
216
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
217
+ hook_ctx: hook_ctx
218
+ ),
219
+ response: r
220
+ )
221
+ end
222
+
223
+ if r.nil?
224
+ raise error if !error.nil?
225
+ raise 'no response'
226
+ end
128
227
  end
129
228
 
130
229
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -147,8 +246,8 @@ module StackOne
147
246
  end
148
247
 
149
248
 
150
- sig { params(request: T.nilable(::StackOne::Operations::CrmGetContactRequest), retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::CrmGetContactResponse) }
151
- def get_contact(request, retries = nil)
249
+ sig { params(request: T.nilable(::StackOne::Operations::CrmGetContactRequest), retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::CrmGetContactResponse) }
250
+ def get_contact(request, retries = nil, timeout_ms = nil)
152
251
  # get_contact - Get Contact
153
252
  url, params = @sdk_configuration.get_server_details
154
253
  base_url = Utils.template_url(url, params)
@@ -176,14 +275,62 @@ module StackOne
176
275
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
177
276
  retry_options[:retry_statuses] = [429, 408]
178
277
 
278
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
279
+
280
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
281
+ timeout ||= @sdk_configuration.timeout
282
+
179
283
  connection = @sdk_configuration.client.dup
180
284
  connection.request :retry, retry_options
181
285
 
182
- r = connection.get(url) do |req|
183
- req.headers = headers
184
- req.params = query_params
185
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
186
- Utils.configure_request_security(req, security) if !security.nil?
286
+ hook_ctx = SDKHooks::HookContext.new(
287
+ base_url: base_url,
288
+ oauth2_scopes: [],
289
+ operation_id: 'crm_get_contact',
290
+ security_source: @sdk_configuration.security_source
291
+ )
292
+
293
+ error = T.let(nil, T.nilable(StandardError))
294
+ r = T.let(nil, T.nilable(Faraday::Response))
295
+
296
+ begin
297
+ r = connection.get(url) do |req|
298
+ req.headers.merge!(headers)
299
+ req.options.timeout = timeout unless timeout.nil?
300
+ req.params = query_params
301
+ Utils.configure_request_security(req, security)
302
+
303
+ @sdk_configuration.hooks.before_request(
304
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
305
+ hook_ctx: hook_ctx
306
+ ),
307
+ request: req
308
+ )
309
+ end
310
+ rescue StandardError => e
311
+ error = e
312
+ ensure
313
+ if r.nil? || Utils.error_status?(r.status)
314
+ r = @sdk_configuration.hooks.after_error(
315
+ error: error,
316
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
317
+ hook_ctx: hook_ctx
318
+ ),
319
+ response: r
320
+ )
321
+ else
322
+ r = @sdk_configuration.hooks.after_success(
323
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
324
+ hook_ctx: hook_ctx
325
+ ),
326
+ response: r
327
+ )
328
+ end
329
+
330
+ if r.nil?
331
+ raise error if !error.nil?
332
+ raise 'no response'
333
+ end
187
334
  end
188
335
 
189
336
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -206,8 +353,8 @@ module StackOne
206
353
  end
207
354
 
208
355
 
209
- sig { params(request: T.nilable(::StackOne::Operations::CrmGetContactCustomFieldDefinitionRequest), retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::CrmGetContactCustomFieldDefinitionResponse) }
210
- def get_contact_custom_field_definition(request, retries = nil)
356
+ sig { params(request: T.nilable(::StackOne::Operations::CrmGetContactCustomFieldDefinitionRequest), retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::CrmGetContactCustomFieldDefinitionResponse) }
357
+ def get_contact_custom_field_definition(request, retries = nil, timeout_ms = nil)
211
358
  # get_contact_custom_field_definition - Get Contact Custom Field Definition
212
359
  url, params = @sdk_configuration.get_server_details
213
360
  base_url = Utils.template_url(url, params)
@@ -235,14 +382,62 @@ module StackOne
235
382
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
236
383
  retry_options[:retry_statuses] = [429, 408]
237
384
 
385
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
386
+
387
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
388
+ timeout ||= @sdk_configuration.timeout
389
+
238
390
  connection = @sdk_configuration.client.dup
239
391
  connection.request :retry, retry_options
240
392
 
241
- r = connection.get(url) do |req|
242
- req.headers = headers
243
- req.params = query_params
244
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
245
- Utils.configure_request_security(req, security) if !security.nil?
393
+ hook_ctx = SDKHooks::HookContext.new(
394
+ base_url: base_url,
395
+ oauth2_scopes: [],
396
+ operation_id: 'crm_get_contact_custom_field_definition',
397
+ security_source: @sdk_configuration.security_source
398
+ )
399
+
400
+ error = T.let(nil, T.nilable(StandardError))
401
+ r = T.let(nil, T.nilable(Faraday::Response))
402
+
403
+ begin
404
+ r = connection.get(url) do |req|
405
+ req.headers.merge!(headers)
406
+ req.options.timeout = timeout unless timeout.nil?
407
+ req.params = query_params
408
+ Utils.configure_request_security(req, security)
409
+
410
+ @sdk_configuration.hooks.before_request(
411
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
412
+ hook_ctx: hook_ctx
413
+ ),
414
+ request: req
415
+ )
416
+ end
417
+ rescue StandardError => e
418
+ error = e
419
+ ensure
420
+ if r.nil? || Utils.error_status?(r.status)
421
+ r = @sdk_configuration.hooks.after_error(
422
+ error: error,
423
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
424
+ hook_ctx: hook_ctx
425
+ ),
426
+ response: r
427
+ )
428
+ else
429
+ r = @sdk_configuration.hooks.after_success(
430
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
431
+ hook_ctx: hook_ctx
432
+ ),
433
+ response: r
434
+ )
435
+ end
436
+
437
+ if r.nil?
438
+ raise error if !error.nil?
439
+ raise 'no response'
440
+ end
246
441
  end
247
442
 
248
443
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -265,8 +460,8 @@ module StackOne
265
460
  end
266
461
 
267
462
 
268
- sig { params(request: T.nilable(::StackOne::Operations::CrmGetListRequest), retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::CrmGetListResponse) }
269
- def get_list(request, retries = nil)
463
+ sig { params(request: T.nilable(::StackOne::Operations::CrmGetListRequest), retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::CrmGetListResponse) }
464
+ def get_list(request, retries = nil, timeout_ms = nil)
270
465
  # get_list - Get List
271
466
  url, params = @sdk_configuration.get_server_details
272
467
  base_url = Utils.template_url(url, params)
@@ -294,14 +489,62 @@ module StackOne
294
489
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
295
490
  retry_options[:retry_statuses] = [429, 408]
296
491
 
492
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
493
+
494
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
495
+ timeout ||= @sdk_configuration.timeout
496
+
297
497
  connection = @sdk_configuration.client.dup
298
498
  connection.request :retry, retry_options
299
499
 
300
- r = connection.get(url) do |req|
301
- req.headers = headers
302
- req.params = query_params
303
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
304
- Utils.configure_request_security(req, security) if !security.nil?
500
+ hook_ctx = SDKHooks::HookContext.new(
501
+ base_url: base_url,
502
+ oauth2_scopes: [],
503
+ operation_id: 'crm_get_list',
504
+ security_source: @sdk_configuration.security_source
505
+ )
506
+
507
+ error = T.let(nil, T.nilable(StandardError))
508
+ r = T.let(nil, T.nilable(Faraday::Response))
509
+
510
+ begin
511
+ r = connection.get(url) do |req|
512
+ req.headers.merge!(headers)
513
+ req.options.timeout = timeout unless timeout.nil?
514
+ req.params = query_params
515
+ Utils.configure_request_security(req, security)
516
+
517
+ @sdk_configuration.hooks.before_request(
518
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
519
+ hook_ctx: hook_ctx
520
+ ),
521
+ request: req
522
+ )
523
+ end
524
+ rescue StandardError => e
525
+ error = e
526
+ ensure
527
+ if r.nil? || Utils.error_status?(r.status)
528
+ r = @sdk_configuration.hooks.after_error(
529
+ error: error,
530
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
531
+ hook_ctx: hook_ctx
532
+ ),
533
+ response: r
534
+ )
535
+ else
536
+ r = @sdk_configuration.hooks.after_success(
537
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
538
+ hook_ctx: hook_ctx
539
+ ),
540
+ response: r
541
+ )
542
+ end
543
+
544
+ if r.nil?
545
+ raise error if !error.nil?
546
+ raise 'no response'
547
+ end
305
548
  end
306
549
 
307
550
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -324,8 +567,8 @@ module StackOne
324
567
  end
325
568
 
326
569
 
327
- sig { params(request: T.nilable(::StackOne::Operations::CrmListAccountsRequest), retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::CrmListAccountsResponse) }
328
- def list_accounts(request, retries = nil)
570
+ sig { params(request: T.nilable(::StackOne::Operations::CrmListAccountsRequest), retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::CrmListAccountsResponse) }
571
+ def list_accounts(request, retries = nil, timeout_ms = nil)
329
572
  # list_accounts - List Accounts
330
573
  url, params = @sdk_configuration.get_server_details
331
574
  base_url = Utils.template_url(url, params)
@@ -348,14 +591,62 @@ module StackOne
348
591
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
349
592
  retry_options[:retry_statuses] = [429, 408]
350
593
 
594
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
595
+
596
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
597
+ timeout ||= @sdk_configuration.timeout
598
+
351
599
  connection = @sdk_configuration.client.dup
352
600
  connection.request :retry, retry_options
353
601
 
354
- r = connection.get(url) do |req|
355
- req.headers = headers
356
- req.params = query_params
357
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
358
- Utils.configure_request_security(req, security) if !security.nil?
602
+ hook_ctx = SDKHooks::HookContext.new(
603
+ base_url: base_url,
604
+ oauth2_scopes: [],
605
+ operation_id: 'crm_list_accounts',
606
+ security_source: @sdk_configuration.security_source
607
+ )
608
+
609
+ error = T.let(nil, T.nilable(StandardError))
610
+ r = T.let(nil, T.nilable(Faraday::Response))
611
+
612
+ begin
613
+ r = connection.get(url) do |req|
614
+ req.headers.merge!(headers)
615
+ req.options.timeout = timeout unless timeout.nil?
616
+ req.params = query_params
617
+ Utils.configure_request_security(req, security)
618
+
619
+ @sdk_configuration.hooks.before_request(
620
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
621
+ hook_ctx: hook_ctx
622
+ ),
623
+ request: req
624
+ )
625
+ end
626
+ rescue StandardError => e
627
+ error = e
628
+ ensure
629
+ if r.nil? || Utils.error_status?(r.status)
630
+ r = @sdk_configuration.hooks.after_error(
631
+ error: error,
632
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
633
+ hook_ctx: hook_ctx
634
+ ),
635
+ response: r
636
+ )
637
+ else
638
+ r = @sdk_configuration.hooks.after_success(
639
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
640
+ hook_ctx: hook_ctx
641
+ ),
642
+ response: r
643
+ )
644
+ end
645
+
646
+ if r.nil?
647
+ raise error if !error.nil?
648
+ raise 'no response'
649
+ end
359
650
  end
360
651
 
361
652
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -378,8 +669,8 @@ module StackOne
378
669
  end
379
670
 
380
671
 
381
- sig { params(request: T.nilable(::StackOne::Operations::CrmListContactCustomFieldDefinitionsRequest), retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::CrmListContactCustomFieldDefinitionsResponse) }
382
- def list_contact_custom_field_definitions(request, retries = nil)
672
+ sig { params(request: T.nilable(::StackOne::Operations::CrmListContactCustomFieldDefinitionsRequest), retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::CrmListContactCustomFieldDefinitionsResponse) }
673
+ def list_contact_custom_field_definitions(request, retries = nil, timeout_ms = nil)
383
674
  # list_contact_custom_field_definitions - List Contact Custom Field Definitions
384
675
  url, params = @sdk_configuration.get_server_details
385
676
  base_url = Utils.template_url(url, params)
@@ -402,14 +693,62 @@ module StackOne
402
693
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
403
694
  retry_options[:retry_statuses] = [429, 408]
404
695
 
696
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
697
+
698
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
699
+ timeout ||= @sdk_configuration.timeout
700
+
405
701
  connection = @sdk_configuration.client.dup
406
702
  connection.request :retry, retry_options
407
703
 
408
- r = connection.get(url) do |req|
409
- req.headers = headers
410
- req.params = query_params
411
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
412
- Utils.configure_request_security(req, security) if !security.nil?
704
+ hook_ctx = SDKHooks::HookContext.new(
705
+ base_url: base_url,
706
+ oauth2_scopes: [],
707
+ operation_id: 'crm_list_contact_custom_field_definitions',
708
+ security_source: @sdk_configuration.security_source
709
+ )
710
+
711
+ error = T.let(nil, T.nilable(StandardError))
712
+ r = T.let(nil, T.nilable(Faraday::Response))
713
+
714
+ begin
715
+ r = connection.get(url) do |req|
716
+ req.headers.merge!(headers)
717
+ req.options.timeout = timeout unless timeout.nil?
718
+ req.params = query_params
719
+ Utils.configure_request_security(req, security)
720
+
721
+ @sdk_configuration.hooks.before_request(
722
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
723
+ hook_ctx: hook_ctx
724
+ ),
725
+ request: req
726
+ )
727
+ end
728
+ rescue StandardError => e
729
+ error = e
730
+ ensure
731
+ if r.nil? || Utils.error_status?(r.status)
732
+ r = @sdk_configuration.hooks.after_error(
733
+ error: error,
734
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
735
+ hook_ctx: hook_ctx
736
+ ),
737
+ response: r
738
+ )
739
+ else
740
+ r = @sdk_configuration.hooks.after_success(
741
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
742
+ hook_ctx: hook_ctx
743
+ ),
744
+ response: r
745
+ )
746
+ end
747
+
748
+ if r.nil?
749
+ raise error if !error.nil?
750
+ raise 'no response'
751
+ end
413
752
  end
414
753
 
415
754
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -432,8 +771,8 @@ module StackOne
432
771
  end
433
772
 
434
773
 
435
- sig { params(request: T.nilable(::StackOne::Operations::CrmListContactsRequest), retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::CrmListContactsResponse) }
436
- def list_contacts(request, retries = nil)
774
+ sig { params(request: T.nilable(::StackOne::Operations::CrmListContactsRequest), retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::CrmListContactsResponse) }
775
+ def list_contacts(request, retries = nil, timeout_ms = nil)
437
776
  # list_contacts - List Contacts
438
777
  url, params = @sdk_configuration.get_server_details
439
778
  base_url = Utils.template_url(url, params)
@@ -456,14 +795,62 @@ module StackOne
456
795
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
457
796
  retry_options[:retry_statuses] = [429, 408]
458
797
 
798
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
799
+
800
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
801
+ timeout ||= @sdk_configuration.timeout
802
+
459
803
  connection = @sdk_configuration.client.dup
460
804
  connection.request :retry, retry_options
461
805
 
462
- r = connection.get(url) do |req|
463
- req.headers = headers
464
- req.params = query_params
465
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
466
- Utils.configure_request_security(req, security) if !security.nil?
806
+ hook_ctx = SDKHooks::HookContext.new(
807
+ base_url: base_url,
808
+ oauth2_scopes: [],
809
+ operation_id: 'crm_list_contacts',
810
+ security_source: @sdk_configuration.security_source
811
+ )
812
+
813
+ error = T.let(nil, T.nilable(StandardError))
814
+ r = T.let(nil, T.nilable(Faraday::Response))
815
+
816
+ begin
817
+ r = connection.get(url) do |req|
818
+ req.headers.merge!(headers)
819
+ req.options.timeout = timeout unless timeout.nil?
820
+ req.params = query_params
821
+ Utils.configure_request_security(req, security)
822
+
823
+ @sdk_configuration.hooks.before_request(
824
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
825
+ hook_ctx: hook_ctx
826
+ ),
827
+ request: req
828
+ )
829
+ end
830
+ rescue StandardError => e
831
+ error = e
832
+ ensure
833
+ if r.nil? || Utils.error_status?(r.status)
834
+ r = @sdk_configuration.hooks.after_error(
835
+ error: error,
836
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
837
+ hook_ctx: hook_ctx
838
+ ),
839
+ response: r
840
+ )
841
+ else
842
+ r = @sdk_configuration.hooks.after_success(
843
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
844
+ hook_ctx: hook_ctx
845
+ ),
846
+ response: r
847
+ )
848
+ end
849
+
850
+ if r.nil?
851
+ raise error if !error.nil?
852
+ raise 'no response'
853
+ end
467
854
  end
468
855
 
469
856
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -486,8 +873,8 @@ module StackOne
486
873
  end
487
874
 
488
875
 
489
- sig { params(request: T.nilable(::StackOne::Operations::CrmListListsRequest), retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::CrmListListsResponse) }
490
- def list_lists(request, retries = nil)
876
+ sig { params(request: T.nilable(::StackOne::Operations::CrmListListsRequest), retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::CrmListListsResponse) }
877
+ def list_lists(request, retries = nil, timeout_ms = nil)
491
878
  # list_lists - Get all Lists
492
879
  url, params = @sdk_configuration.get_server_details
493
880
  base_url = Utils.template_url(url, params)
@@ -510,14 +897,62 @@ module StackOne
510
897
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
511
898
  retry_options[:retry_statuses] = [429, 408]
512
899
 
900
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
901
+
902
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
903
+ timeout ||= @sdk_configuration.timeout
904
+
513
905
  connection = @sdk_configuration.client.dup
514
906
  connection.request :retry, retry_options
515
907
 
516
- r = connection.get(url) do |req|
517
- req.headers = headers
518
- req.params = query_params
519
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
520
- Utils.configure_request_security(req, security) if !security.nil?
908
+ hook_ctx = SDKHooks::HookContext.new(
909
+ base_url: base_url,
910
+ oauth2_scopes: [],
911
+ operation_id: 'crm_list_lists',
912
+ security_source: @sdk_configuration.security_source
913
+ )
914
+
915
+ error = T.let(nil, T.nilable(StandardError))
916
+ r = T.let(nil, T.nilable(Faraday::Response))
917
+
918
+ begin
919
+ r = connection.get(url) do |req|
920
+ req.headers.merge!(headers)
921
+ req.options.timeout = timeout unless timeout.nil?
922
+ req.params = query_params
923
+ Utils.configure_request_security(req, security)
924
+
925
+ @sdk_configuration.hooks.before_request(
926
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
927
+ hook_ctx: hook_ctx
928
+ ),
929
+ request: req
930
+ )
931
+ end
932
+ rescue StandardError => e
933
+ error = e
934
+ ensure
935
+ if r.nil? || Utils.error_status?(r.status)
936
+ r = @sdk_configuration.hooks.after_error(
937
+ error: error,
938
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
939
+ hook_ctx: hook_ctx
940
+ ),
941
+ response: r
942
+ )
943
+ else
944
+ r = @sdk_configuration.hooks.after_success(
945
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
946
+ hook_ctx: hook_ctx
947
+ ),
948
+ response: r
949
+ )
950
+ end
951
+
952
+ if r.nil?
953
+ raise error if !error.nil?
954
+ raise 'no response'
955
+ end
521
956
  end
522
957
 
523
958
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -540,8 +975,8 @@ module StackOne
540
975
  end
541
976
 
542
977
 
543
- sig { params(crm_create_contact_request_dto: ::StackOne::Shared::CrmCreateContactRequestDto, id: ::String, x_account_id: ::String, retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::CrmUpdateContactResponse) }
544
- def update_contact(crm_create_contact_request_dto, id, x_account_id, retries = nil)
978
+ sig { params(crm_create_contact_request_dto: ::StackOne::Shared::CrmCreateContactRequestDto, id: ::String, x_account_id: ::String, retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::CrmUpdateContactResponse) }
979
+ def update_contact(crm_create_contact_request_dto, id, x_account_id, retries = nil, timeout_ms = nil)
545
980
  # update_contact - Update Contact (early access)
546
981
  request = ::StackOne::Operations::CrmUpdateContactRequest.new(
547
982
 
@@ -561,6 +996,14 @@ module StackOne
561
996
  req_content_type, data, form = Utils.serialize_request_body(request, :crm_create_contact_request_dto, :json)
562
997
  headers['content-type'] = req_content_type
563
998
  raise StandardError, 'request body is required' if data.nil? && form.nil?
999
+
1000
+ if form
1001
+ body = Utils.encode_form(form)
1002
+ elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
1003
+ body = URI.encode_www_form(data)
1004
+ else
1005
+ body = data
1006
+ end
564
1007
  headers['Accept'] = 'application/json'
565
1008
  headers['user-agent'] = @sdk_configuration.user_agent
566
1009
  retries ||= @sdk_configuration.retry_config
@@ -577,19 +1020,61 @@ module StackOne
577
1020
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
578
1021
  retry_options[:retry_statuses] = [429, 408]
579
1022
 
1023
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
1024
+
1025
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
1026
+ timeout ||= @sdk_configuration.timeout
1027
+
580
1028
  connection = @sdk_configuration.client.dup
581
1029
  connection.request :retry, retry_options
582
1030
 
583
- r = connection.patch(url) do |req|
584
- req.headers = headers
585
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
586
- Utils.configure_request_security(req, security) if !security.nil?
587
- if form
588
- req.body = Utils.encode_form(form)
589
- elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
590
- req.body = URI.encode_www_form(data)
1031
+ hook_ctx = SDKHooks::HookContext.new(
1032
+ base_url: base_url,
1033
+ oauth2_scopes: [],
1034
+ operation_id: 'crm_update_contact',
1035
+ security_source: @sdk_configuration.security_source
1036
+ )
1037
+
1038
+ error = T.let(nil, T.nilable(StandardError))
1039
+ r = T.let(nil, T.nilable(Faraday::Response))
1040
+
1041
+ begin
1042
+ r = connection.patch(url) do |req|
1043
+ req.body = body
1044
+ req.headers.merge!(headers)
1045
+ req.options.timeout = timeout unless timeout.nil?
1046
+ Utils.configure_request_security(req, security)
1047
+
1048
+ @sdk_configuration.hooks.before_request(
1049
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
1050
+ hook_ctx: hook_ctx
1051
+ ),
1052
+ request: req
1053
+ )
1054
+ end
1055
+ rescue StandardError => e
1056
+ error = e
1057
+ ensure
1058
+ if r.nil? || Utils.error_status?(r.status)
1059
+ r = @sdk_configuration.hooks.after_error(
1060
+ error: error,
1061
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
1062
+ hook_ctx: hook_ctx
1063
+ ),
1064
+ response: r
1065
+ )
591
1066
  else
592
- req.body = data
1067
+ r = @sdk_configuration.hooks.after_success(
1068
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
1069
+ hook_ctx: hook_ctx
1070
+ ),
1071
+ response: r
1072
+ )
1073
+ end
1074
+
1075
+ if r.nil?
1076
+ raise error if !error.nil?
1077
+ raise 'no response'
593
1078
  end
594
1079
  end
595
1080