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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 52af264fcdc855f894e217f618df44b609d26107e10f8c1212d00d5183f5c302
4
- data.tar.gz: 213b60174d717d93f369842f5c72e4fd95b6cff2d56bbc4afef5c917943c482c
3
+ metadata.gz: d080f51c6d3dabe81a36efe61033e2c7453779e906d3a342ce8912b23a01da68
4
+ data.tar.gz: 59b050e4243d10c364768def98e5858a38c5350e6dec2b22a3158c2f0985c285
5
5
  SHA512:
6
- metadata.gz: 1f650d9129e71b335d2a8a48ce3e8b4d1471b189a62e54ca917287d6e1884a0a76c85a46cfd731b0e8faf3fd27bd10ba8507f186e1ccd738af4eeb87d9d097ca
7
- data.tar.gz: 275a8098a2bf15951a65ac422d40a3a42e7ab90dfc8a61c66d6ff0a76014d9fc70c297e709b867748327c137c6cabcba68447613445c37aaf039cb1f2ee3b460
6
+ metadata.gz: 898ed51a7817a4ffbb7eabf9a0405c6010ad1bdc3c7a20d1e6103cf79804e1668e57bf85cb1692961a3c6d4df1bc50cab044b6448c95f727f3ed9dfe321635e8
7
+ data.tar.gz: c43b62d986092708586e27e925f83b3e57860546ab7758e3ac032fa7027922666e5aaf594a542d2ba1cb2a40ae4c6358838868a380e73e84aeb0fc152fd37b15
@@ -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(id: ::String, retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::StackoneDeleteAccountResponse) }
25
- def delete_account(id, retries = nil)
25
+ sig { params(id: ::String, retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::StackoneDeleteAccountResponse) }
26
+ def delete_account(id, retries = nil, timeout_ms = nil)
26
27
  # delete_account - Delete Account
27
28
  request = ::StackOne::Operations::StackoneDeleteAccountRequest.new(
28
29
 
@@ -53,13 +54,61 @@ module StackOne
53
54
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
54
55
  retry_options[:retry_statuses] = [429, 408]
55
56
 
57
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
58
+
59
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
60
+ timeout ||= @sdk_configuration.timeout
61
+
56
62
  connection = @sdk_configuration.client.dup
57
63
  connection.request :retry, retry_options
58
64
 
59
- r = connection.delete(url) do |req|
60
- req.headers = headers
61
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
62
- Utils.configure_request_security(req, security) if !security.nil?
65
+ hook_ctx = SDKHooks::HookContext.new(
66
+ base_url: base_url,
67
+ oauth2_scopes: [],
68
+ operation_id: 'stackone_delete_account',
69
+ security_source: @sdk_configuration.security_source
70
+ )
71
+
72
+ error = T.let(nil, T.nilable(StandardError))
73
+ r = T.let(nil, T.nilable(Faraday::Response))
74
+
75
+ begin
76
+ r = connection.delete(url) do |req|
77
+ req.headers.merge!(headers)
78
+ req.options.timeout = timeout unless timeout.nil?
79
+ Utils.configure_request_security(req, security)
80
+
81
+ @sdk_configuration.hooks.before_request(
82
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
83
+ hook_ctx: hook_ctx
84
+ ),
85
+ request: req
86
+ )
87
+ end
88
+ rescue StandardError => e
89
+ error = e
90
+ ensure
91
+ if r.nil? || Utils.error_status?(r.status)
92
+ r = @sdk_configuration.hooks.after_error(
93
+ error: error,
94
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
95
+ hook_ctx: hook_ctx
96
+ ),
97
+ response: r
98
+ )
99
+ else
100
+ r = @sdk_configuration.hooks.after_success(
101
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
102
+ hook_ctx: hook_ctx
103
+ ),
104
+ response: r
105
+ )
106
+ end
107
+
108
+ if r.nil?
109
+ raise error if !error.nil?
110
+ raise 'no response'
111
+ end
63
112
  end
64
113
 
65
114
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -82,8 +131,8 @@ module StackOne
82
131
  end
83
132
 
84
133
 
85
- sig { params(id: ::String, retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::StackoneGetAccountResponse) }
86
- def get_account(id, retries = nil)
134
+ sig { params(id: ::String, retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::StackoneGetAccountResponse) }
135
+ def get_account(id, retries = nil, timeout_ms = nil)
87
136
  # get_account - Get Account
88
137
  request = ::StackOne::Operations::StackoneGetAccountRequest.new(
89
138
 
@@ -114,13 +163,61 @@ module StackOne
114
163
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
115
164
  retry_options[:retry_statuses] = [429, 408]
116
165
 
166
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
167
+
168
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
169
+ timeout ||= @sdk_configuration.timeout
170
+
117
171
  connection = @sdk_configuration.client.dup
118
172
  connection.request :retry, retry_options
119
173
 
120
- r = connection.get(url) do |req|
121
- req.headers = headers
122
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
123
- Utils.configure_request_security(req, security) if !security.nil?
174
+ hook_ctx = SDKHooks::HookContext.new(
175
+ base_url: base_url,
176
+ oauth2_scopes: [],
177
+ operation_id: 'stackone_get_account',
178
+ security_source: @sdk_configuration.security_source
179
+ )
180
+
181
+ error = T.let(nil, T.nilable(StandardError))
182
+ r = T.let(nil, T.nilable(Faraday::Response))
183
+
184
+ begin
185
+ r = connection.get(url) do |req|
186
+ req.headers.merge!(headers)
187
+ req.options.timeout = timeout unless timeout.nil?
188
+ Utils.configure_request_security(req, security)
189
+
190
+ @sdk_configuration.hooks.before_request(
191
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
192
+ hook_ctx: hook_ctx
193
+ ),
194
+ request: req
195
+ )
196
+ end
197
+ rescue StandardError => e
198
+ error = e
199
+ ensure
200
+ if r.nil? || Utils.error_status?(r.status)
201
+ r = @sdk_configuration.hooks.after_error(
202
+ error: error,
203
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
204
+ hook_ctx: hook_ctx
205
+ ),
206
+ response: r
207
+ )
208
+ else
209
+ r = @sdk_configuration.hooks.after_success(
210
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
211
+ hook_ctx: hook_ctx
212
+ ),
213
+ response: r
214
+ )
215
+ end
216
+
217
+ if r.nil?
218
+ raise error if !error.nil?
219
+ raise 'no response'
220
+ end
124
221
  end
125
222
 
126
223
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -143,8 +240,8 @@ module StackOne
143
240
  end
144
241
 
145
242
 
146
- sig { params(id: ::String, retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::StackoneGetAccountMetaInfoResponse) }
147
- def get_account_meta_info(id, retries = nil)
243
+ sig { params(id: ::String, retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::StackoneGetAccountMetaInfoResponse) }
244
+ def get_account_meta_info(id, retries = nil, timeout_ms = nil)
148
245
  # get_account_meta_info - Get meta information of the account
149
246
  request = ::StackOne::Operations::StackoneGetAccountMetaInfoRequest.new(
150
247
 
@@ -175,13 +272,61 @@ module StackOne
175
272
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
176
273
  retry_options[:retry_statuses] = [429, 408]
177
274
 
275
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
276
+
277
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
278
+ timeout ||= @sdk_configuration.timeout
279
+
178
280
  connection = @sdk_configuration.client.dup
179
281
  connection.request :retry, retry_options
180
282
 
181
- r = connection.get(url) do |req|
182
- req.headers = headers
183
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
184
- Utils.configure_request_security(req, security) if !security.nil?
283
+ hook_ctx = SDKHooks::HookContext.new(
284
+ base_url: base_url,
285
+ oauth2_scopes: [],
286
+ operation_id: 'stackone_get_account_meta_info',
287
+ security_source: @sdk_configuration.security_source
288
+ )
289
+
290
+ error = T.let(nil, T.nilable(StandardError))
291
+ r = T.let(nil, T.nilable(Faraday::Response))
292
+
293
+ begin
294
+ r = connection.get(url) do |req|
295
+ req.headers.merge!(headers)
296
+ req.options.timeout = timeout unless timeout.nil?
297
+ Utils.configure_request_security(req, security)
298
+
299
+ @sdk_configuration.hooks.before_request(
300
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
301
+ hook_ctx: hook_ctx
302
+ ),
303
+ request: req
304
+ )
305
+ end
306
+ rescue StandardError => e
307
+ error = e
308
+ ensure
309
+ if r.nil? || Utils.error_status?(r.status)
310
+ r = @sdk_configuration.hooks.after_error(
311
+ error: error,
312
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
313
+ hook_ctx: hook_ctx
314
+ ),
315
+ response: r
316
+ )
317
+ else
318
+ r = @sdk_configuration.hooks.after_success(
319
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
320
+ hook_ctx: hook_ctx
321
+ ),
322
+ response: r
323
+ )
324
+ end
325
+
326
+ if r.nil?
327
+ raise error if !error.nil?
328
+ raise 'no response'
329
+ end
185
330
  end
186
331
 
187
332
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -204,8 +349,8 @@ module StackOne
204
349
  end
205
350
 
206
351
 
207
- sig { params(request: T.nilable(::StackOne::Operations::StackoneListLinkedAccountsRequest), retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::StackoneListLinkedAccountsResponse) }
208
- def list_linked_accounts(request, retries = nil)
352
+ sig { params(request: T.nilable(::StackOne::Operations::StackoneListLinkedAccountsRequest), retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::StackoneListLinkedAccountsResponse) }
353
+ def list_linked_accounts(request, retries = nil, timeout_ms = nil)
209
354
  # list_linked_accounts - List Accounts
210
355
  url, params = @sdk_configuration.get_server_details
211
356
  base_url = Utils.template_url(url, params)
@@ -228,14 +373,62 @@ module StackOne
228
373
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
229
374
  retry_options[:retry_statuses] = [429, 408]
230
375
 
376
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
377
+
378
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
379
+ timeout ||= @sdk_configuration.timeout
380
+
231
381
  connection = @sdk_configuration.client.dup
232
382
  connection.request :retry, retry_options
233
383
 
234
- r = connection.get(url) do |req|
235
- req.headers = headers
236
- req.params = query_params
237
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
238
- Utils.configure_request_security(req, security) if !security.nil?
384
+ hook_ctx = SDKHooks::HookContext.new(
385
+ base_url: base_url,
386
+ oauth2_scopes: [],
387
+ operation_id: 'stackone_list_linked_accounts',
388
+ security_source: @sdk_configuration.security_source
389
+ )
390
+
391
+ error = T.let(nil, T.nilable(StandardError))
392
+ r = T.let(nil, T.nilable(Faraday::Response))
393
+
394
+ begin
395
+ r = connection.get(url) do |req|
396
+ req.headers.merge!(headers)
397
+ req.options.timeout = timeout unless timeout.nil?
398
+ req.params = query_params
399
+ Utils.configure_request_security(req, security)
400
+
401
+ @sdk_configuration.hooks.before_request(
402
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
403
+ hook_ctx: hook_ctx
404
+ ),
405
+ request: req
406
+ )
407
+ end
408
+ rescue StandardError => e
409
+ error = e
410
+ ensure
411
+ if r.nil? || Utils.error_status?(r.status)
412
+ r = @sdk_configuration.hooks.after_error(
413
+ error: error,
414
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
415
+ hook_ctx: hook_ctx
416
+ ),
417
+ response: r
418
+ )
419
+ else
420
+ r = @sdk_configuration.hooks.after_success(
421
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
422
+ hook_ctx: hook_ctx
423
+ ),
424
+ response: r
425
+ )
426
+ end
427
+
428
+ if r.nil?
429
+ raise error if !error.nil?
430
+ raise 'no response'
431
+ end
239
432
  end
240
433
 
241
434
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -258,8 +451,8 @@ module StackOne
258
451
  end
259
452
 
260
453
 
261
- sig { params(patch_account_external_dto: ::StackOne::Shared::PatchAccountExternalDto, id: ::String, retries: T.nilable(Utils::RetryConfig)).returns(::StackOne::Operations::StackoneUpdateAccountResponse) }
262
- def update_account(patch_account_external_dto, id, retries = nil)
454
+ sig { params(patch_account_external_dto: ::StackOne::Shared::PatchAccountExternalDto, id: ::String, retries: T.nilable(Utils::RetryConfig), timeout_ms: T.nilable(Integer)).returns(::StackOne::Operations::StackoneUpdateAccountResponse) }
455
+ def update_account(patch_account_external_dto, id, retries = nil, timeout_ms = nil)
263
456
  # update_account - Update Account
264
457
  request = ::StackOne::Operations::StackoneUpdateAccountRequest.new(
265
458
 
@@ -278,6 +471,14 @@ module StackOne
278
471
  req_content_type, data, form = Utils.serialize_request_body(request, :patch_account_external_dto, :json)
279
472
  headers['content-type'] = req_content_type
280
473
  raise StandardError, 'request body is required' if data.nil? && form.nil?
474
+
475
+ if form
476
+ body = Utils.encode_form(form)
477
+ elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
478
+ body = URI.encode_www_form(data)
479
+ else
480
+ body = data
481
+ end
281
482
  headers['Accept'] = 'application/json'
282
483
  headers['user-agent'] = @sdk_configuration.user_agent
283
484
  retries ||= @sdk_configuration.retry_config
@@ -294,19 +495,61 @@ module StackOne
294
495
  retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
295
496
  retry_options[:retry_statuses] = [429, 408]
296
497
 
498
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
499
+
500
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
501
+ timeout ||= @sdk_configuration.timeout
502
+
297
503
  connection = @sdk_configuration.client.dup
298
504
  connection.request :retry, retry_options
299
505
 
300
- r = connection.patch(url) do |req|
301
- req.headers = headers
302
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
303
- Utils.configure_request_security(req, security) if !security.nil?
304
- if form
305
- req.body = Utils.encode_form(form)
306
- elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
307
- req.body = URI.encode_www_form(data)
506
+ hook_ctx = SDKHooks::HookContext.new(
507
+ base_url: base_url,
508
+ oauth2_scopes: [],
509
+ operation_id: 'stackone_update_account',
510
+ security_source: @sdk_configuration.security_source
511
+ )
512
+
513
+ error = T.let(nil, T.nilable(StandardError))
514
+ r = T.let(nil, T.nilable(Faraday::Response))
515
+
516
+ begin
517
+ r = connection.patch(url) do |req|
518
+ req.body = body
519
+ req.headers.merge!(headers)
520
+ req.options.timeout = timeout unless timeout.nil?
521
+ Utils.configure_request_security(req, security)
522
+
523
+ @sdk_configuration.hooks.before_request(
524
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
525
+ hook_ctx: hook_ctx
526
+ ),
527
+ request: req
528
+ )
529
+ end
530
+ rescue StandardError => e
531
+ error = e
532
+ ensure
533
+ if r.nil? || Utils.error_status?(r.status)
534
+ r = @sdk_configuration.hooks.after_error(
535
+ error: error,
536
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
537
+ hook_ctx: hook_ctx
538
+ ),
539
+ response: r
540
+ )
308
541
  else
309
- req.body = data
542
+ r = @sdk_configuration.hooks.after_success(
543
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
544
+ hook_ctx: hook_ctx
545
+ ),
546
+ response: r
547
+ )
548
+ end
549
+
550
+ if r.nil?
551
+ raise error if !error.nil?
552
+ raise 'no response'
310
553
  end
311
554
  end
312
555