dub 0.2.2.pre.alpha.77 → 0.2.2.pre.alpha.79

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.
@@ -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 OpenApiSDK
@@ -21,8 +22,8 @@ module OpenApiSDK
21
22
  end
22
23
 
23
24
 
24
- sig { params(request: T.nilable(::OpenApiSDK::Operations::CreateLinkRequestBody)).returns(::OpenApiSDK::Operations::CreateLinkResponse) }
25
- def create(request)
25
+ sig { params(request: T.nilable(::OpenApiSDK::Operations::CreateLinkRequestBody), timeout_ms: T.nilable(Integer)).returns(::OpenApiSDK::Operations::CreateLinkResponse) }
26
+ def create(request, timeout_ms = nil)
26
27
  # create - Create a new link
27
28
  # Create a new link for the authenticated workspace.
28
29
  url, params = @sdk_configuration.get_server_details
@@ -31,21 +32,71 @@ module OpenApiSDK
31
32
  headers = {}
32
33
  req_content_type, data, form = Utils.serialize_request_body(request, :request, :json)
33
34
  headers['content-type'] = req_content_type
35
+
36
+ if form
37
+ body = Utils.encode_form(form)
38
+ elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
39
+ body = URI.encode_www_form(data)
40
+ else
41
+ body = data
42
+ end
34
43
  headers['Accept'] = 'application/json'
35
44
  headers['user-agent'] = @sdk_configuration.user_agent
36
45
 
46
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
47
+
48
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
49
+ timeout ||= @sdk_configuration.timeout
50
+
37
51
  connection = @sdk_configuration.client
38
52
 
39
- r = connection.post(url) do |req|
40
- req.headers = headers
41
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
42
- Utils.configure_request_security(req, security) if !security.nil?
43
- if form
44
- req.body = Utils.encode_form(form)
45
- elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
46
- req.body = URI.encode_www_form(data)
53
+ hook_ctx = SDKHooks::HookContext.new(
54
+ base_url: base_url,
55
+ oauth2_scopes: [],
56
+ operation_id: 'createLink',
57
+ security_source: @sdk_configuration.security_source
58
+ )
59
+
60
+ error = T.let(nil, T.nilable(StandardError))
61
+ r = T.let(nil, T.nilable(Faraday::Response))
62
+
63
+ begin
64
+ r = connection.post(url) do |req|
65
+ req.body = body
66
+ req.headers.merge!(headers)
67
+ req.options.timeout = timeout unless timeout.nil?
68
+ Utils.configure_request_security(req, security)
69
+
70
+ @sdk_configuration.hooks.before_request(
71
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
72
+ hook_ctx: hook_ctx
73
+ ),
74
+ request: req
75
+ )
76
+ end
77
+ rescue StandardError => e
78
+ error = e
79
+ ensure
80
+ if r.nil? || Utils.error_status?(r.status)
81
+ r = @sdk_configuration.hooks.after_error(
82
+ error: error,
83
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
84
+ hook_ctx: hook_ctx
85
+ ),
86
+ response: r
87
+ )
47
88
  else
48
- req.body = data
89
+ r = @sdk_configuration.hooks.after_success(
90
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
91
+ hook_ctx: hook_ctx
92
+ ),
93
+ response: r
94
+ )
95
+ end
96
+
97
+ if r.nil?
98
+ raise error if !error.nil?
99
+ raise 'no response'
49
100
  end
50
101
  end
51
102
 
@@ -110,8 +161,8 @@ module OpenApiSDK
110
161
  end
111
162
 
112
163
 
113
- sig { params(request: T.nilable(::OpenApiSDK::Operations::GetLinksRequest)).returns(::OpenApiSDK::Operations::GetLinksResponse) }
114
- def list(request)
164
+ sig { params(request: T.nilable(::OpenApiSDK::Operations::GetLinksRequest), timeout_ms: T.nilable(Integer)).returns(::OpenApiSDK::Operations::GetLinksResponse) }
165
+ def list(request, timeout_ms = nil)
115
166
  # list - Retrieve a list of links
116
167
  # Retrieve a paginated list of links for the authenticated workspace.
117
168
  url, params = @sdk_configuration.get_server_details
@@ -122,13 +173,61 @@ module OpenApiSDK
122
173
  headers['Accept'] = 'application/json'
123
174
  headers['user-agent'] = @sdk_configuration.user_agent
124
175
 
176
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
177
+
178
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
179
+ timeout ||= @sdk_configuration.timeout
180
+
125
181
  connection = @sdk_configuration.client
126
182
 
127
- r = connection.get(url) do |req|
128
- req.headers = headers
129
- req.params = query_params
130
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
131
- Utils.configure_request_security(req, security) if !security.nil?
183
+ hook_ctx = SDKHooks::HookContext.new(
184
+ base_url: base_url,
185
+ oauth2_scopes: [],
186
+ operation_id: 'getLinks',
187
+ security_source: @sdk_configuration.security_source
188
+ )
189
+
190
+ error = T.let(nil, T.nilable(StandardError))
191
+ r = T.let(nil, T.nilable(Faraday::Response))
192
+
193
+ begin
194
+ r = connection.get(url) do |req|
195
+ req.headers.merge!(headers)
196
+ req.options.timeout = timeout unless timeout.nil?
197
+ req.params = query_params
198
+ Utils.configure_request_security(req, security)
199
+
200
+ @sdk_configuration.hooks.before_request(
201
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
202
+ hook_ctx: hook_ctx
203
+ ),
204
+ request: req
205
+ )
206
+ end
207
+ rescue StandardError => e
208
+ error = e
209
+ ensure
210
+ if r.nil? || Utils.error_status?(r.status)
211
+ r = @sdk_configuration.hooks.after_error(
212
+ error: error,
213
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
214
+ hook_ctx: hook_ctx
215
+ ),
216
+ response: r
217
+ )
218
+ else
219
+ r = @sdk_configuration.hooks.after_success(
220
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
221
+ hook_ctx: hook_ctx
222
+ ),
223
+ response: r
224
+ )
225
+ end
226
+
227
+ if r.nil?
228
+ raise error if !error.nil?
229
+ raise 'no response'
230
+ end
132
231
  end
133
232
 
134
233
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -192,8 +291,8 @@ module OpenApiSDK
192
291
  end
193
292
 
194
293
 
195
- sig { params(request: T.nilable(::OpenApiSDK::Operations::GetLinksCountRequest)).returns(::OpenApiSDK::Operations::GetLinksCountResponse) }
196
- def count(request)
294
+ sig { params(request: T.nilable(::OpenApiSDK::Operations::GetLinksCountRequest), timeout_ms: T.nilable(Integer)).returns(::OpenApiSDK::Operations::GetLinksCountResponse) }
295
+ def count(request, timeout_ms = nil)
197
296
  # count - Retrieve links count
198
297
  # Retrieve the number of links for the authenticated workspace.
199
298
  url, params = @sdk_configuration.get_server_details
@@ -204,13 +303,61 @@ module OpenApiSDK
204
303
  headers['Accept'] = 'application/json'
205
304
  headers['user-agent'] = @sdk_configuration.user_agent
206
305
 
306
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
307
+
308
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
309
+ timeout ||= @sdk_configuration.timeout
310
+
207
311
  connection = @sdk_configuration.client
208
312
 
209
- r = connection.get(url) do |req|
210
- req.headers = headers
211
- req.params = query_params
212
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
213
- Utils.configure_request_security(req, security) if !security.nil?
313
+ hook_ctx = SDKHooks::HookContext.new(
314
+ base_url: base_url,
315
+ oauth2_scopes: [],
316
+ operation_id: 'getLinksCount',
317
+ security_source: @sdk_configuration.security_source
318
+ )
319
+
320
+ error = T.let(nil, T.nilable(StandardError))
321
+ r = T.let(nil, T.nilable(Faraday::Response))
322
+
323
+ begin
324
+ r = connection.get(url) do |req|
325
+ req.headers.merge!(headers)
326
+ req.options.timeout = timeout unless timeout.nil?
327
+ req.params = query_params
328
+ Utils.configure_request_security(req, security)
329
+
330
+ @sdk_configuration.hooks.before_request(
331
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
332
+ hook_ctx: hook_ctx
333
+ ),
334
+ request: req
335
+ )
336
+ end
337
+ rescue StandardError => e
338
+ error = e
339
+ ensure
340
+ if r.nil? || Utils.error_status?(r.status)
341
+ r = @sdk_configuration.hooks.after_error(
342
+ error: error,
343
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
344
+ hook_ctx: hook_ctx
345
+ ),
346
+ response: r
347
+ )
348
+ else
349
+ r = @sdk_configuration.hooks.after_success(
350
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
351
+ hook_ctx: hook_ctx
352
+ ),
353
+ response: r
354
+ )
355
+ end
356
+
357
+ if r.nil?
358
+ raise error if !error.nil?
359
+ raise 'no response'
360
+ end
214
361
  end
215
362
 
216
363
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -274,8 +421,8 @@ module OpenApiSDK
274
421
  end
275
422
 
276
423
 
277
- sig { params(request: T.nilable(::OpenApiSDK::Operations::GetLinkInfoRequest)).returns(::OpenApiSDK::Operations::GetLinkInfoResponse) }
278
- def get(request)
424
+ sig { params(request: T.nilable(::OpenApiSDK::Operations::GetLinkInfoRequest), timeout_ms: T.nilable(Integer)).returns(::OpenApiSDK::Operations::GetLinkInfoResponse) }
425
+ def get(request, timeout_ms = nil)
279
426
  # get - Retrieve a link
280
427
  # Retrieve the info for a link.
281
428
  url, params = @sdk_configuration.get_server_details
@@ -286,13 +433,61 @@ module OpenApiSDK
286
433
  headers['Accept'] = 'application/json'
287
434
  headers['user-agent'] = @sdk_configuration.user_agent
288
435
 
436
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
437
+
438
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
439
+ timeout ||= @sdk_configuration.timeout
440
+
289
441
  connection = @sdk_configuration.client
290
442
 
291
- r = connection.get(url) do |req|
292
- req.headers = headers
293
- req.params = query_params
294
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
295
- Utils.configure_request_security(req, security) if !security.nil?
443
+ hook_ctx = SDKHooks::HookContext.new(
444
+ base_url: base_url,
445
+ oauth2_scopes: [],
446
+ operation_id: 'getLinkInfo',
447
+ security_source: @sdk_configuration.security_source
448
+ )
449
+
450
+ error = T.let(nil, T.nilable(StandardError))
451
+ r = T.let(nil, T.nilable(Faraday::Response))
452
+
453
+ begin
454
+ r = connection.get(url) do |req|
455
+ req.headers.merge!(headers)
456
+ req.options.timeout = timeout unless timeout.nil?
457
+ req.params = query_params
458
+ Utils.configure_request_security(req, security)
459
+
460
+ @sdk_configuration.hooks.before_request(
461
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
462
+ hook_ctx: hook_ctx
463
+ ),
464
+ request: req
465
+ )
466
+ end
467
+ rescue StandardError => e
468
+ error = e
469
+ ensure
470
+ if r.nil? || Utils.error_status?(r.status)
471
+ r = @sdk_configuration.hooks.after_error(
472
+ error: error,
473
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
474
+ hook_ctx: hook_ctx
475
+ ),
476
+ response: r
477
+ )
478
+ else
479
+ r = @sdk_configuration.hooks.after_success(
480
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
481
+ hook_ctx: hook_ctx
482
+ ),
483
+ response: r
484
+ )
485
+ end
486
+
487
+ if r.nil?
488
+ raise error if !error.nil?
489
+ raise 'no response'
490
+ end
296
491
  end
297
492
 
298
493
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -356,8 +551,8 @@ module OpenApiSDK
356
551
  end
357
552
 
358
553
 
359
- sig { params(request: T.nilable(::OpenApiSDK::Operations::UpdateLinkRequest)).returns(::OpenApiSDK::Operations::UpdateLinkResponse) }
360
- def update(request)
554
+ sig { params(request: T.nilable(::OpenApiSDK::Operations::UpdateLinkRequest), timeout_ms: T.nilable(Integer)).returns(::OpenApiSDK::Operations::UpdateLinkResponse) }
555
+ def update(request, timeout_ms = nil)
361
556
  # update - Update a link
362
557
  # Update a link for the authenticated workspace. If there's no change, returns it as it is.
363
558
  url, params = @sdk_configuration.get_server_details
@@ -371,21 +566,71 @@ module OpenApiSDK
371
566
  headers = {}
372
567
  req_content_type, data, form = Utils.serialize_request_body(request, :request_body, :json)
373
568
  headers['content-type'] = req_content_type
569
+
570
+ if form
571
+ body = Utils.encode_form(form)
572
+ elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
573
+ body = URI.encode_www_form(data)
574
+ else
575
+ body = data
576
+ end
374
577
  headers['Accept'] = 'application/json'
375
578
  headers['user-agent'] = @sdk_configuration.user_agent
376
579
 
580
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
581
+
582
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
583
+ timeout ||= @sdk_configuration.timeout
584
+
377
585
  connection = @sdk_configuration.client
378
586
 
379
- r = connection.patch(url) do |req|
380
- req.headers = headers
381
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
382
- Utils.configure_request_security(req, security) if !security.nil?
383
- if form
384
- req.body = Utils.encode_form(form)
385
- elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
386
- req.body = URI.encode_www_form(data)
587
+ hook_ctx = SDKHooks::HookContext.new(
588
+ base_url: base_url,
589
+ oauth2_scopes: [],
590
+ operation_id: 'updateLink',
591
+ security_source: @sdk_configuration.security_source
592
+ )
593
+
594
+ error = T.let(nil, T.nilable(StandardError))
595
+ r = T.let(nil, T.nilable(Faraday::Response))
596
+
597
+ begin
598
+ r = connection.patch(url) do |req|
599
+ req.body = body
600
+ req.headers.merge!(headers)
601
+ req.options.timeout = timeout unless timeout.nil?
602
+ Utils.configure_request_security(req, security)
603
+
604
+ @sdk_configuration.hooks.before_request(
605
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
606
+ hook_ctx: hook_ctx
607
+ ),
608
+ request: req
609
+ )
610
+ end
611
+ rescue StandardError => e
612
+ error = e
613
+ ensure
614
+ if r.nil? || Utils.error_status?(r.status)
615
+ r = @sdk_configuration.hooks.after_error(
616
+ error: error,
617
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
618
+ hook_ctx: hook_ctx
619
+ ),
620
+ response: r
621
+ )
387
622
  else
388
- req.body = data
623
+ r = @sdk_configuration.hooks.after_success(
624
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
625
+ hook_ctx: hook_ctx
626
+ ),
627
+ response: r
628
+ )
629
+ end
630
+
631
+ if r.nil?
632
+ raise error if !error.nil?
633
+ raise 'no response'
389
634
  end
390
635
  end
391
636
 
@@ -450,8 +695,8 @@ module OpenApiSDK
450
695
  end
451
696
 
452
697
 
453
- sig { params(request: T.nilable(::OpenApiSDK::Operations::DeleteLinkRequest)).returns(::OpenApiSDK::Operations::DeleteLinkResponse) }
454
- def delete(request)
698
+ sig { params(request: T.nilable(::OpenApiSDK::Operations::DeleteLinkRequest), timeout_ms: T.nilable(Integer)).returns(::OpenApiSDK::Operations::DeleteLinkResponse) }
699
+ def delete(request, timeout_ms = nil)
455
700
  # delete - Delete a link
456
701
  # Delete a link for the authenticated workspace.
457
702
  url, params = @sdk_configuration.get_server_details
@@ -466,12 +711,60 @@ module OpenApiSDK
466
711
  headers['Accept'] = 'application/json'
467
712
  headers['user-agent'] = @sdk_configuration.user_agent
468
713
 
714
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
715
+
716
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
717
+ timeout ||= @sdk_configuration.timeout
718
+
469
719
  connection = @sdk_configuration.client
470
720
 
471
- r = connection.delete(url) do |req|
472
- req.headers = headers
473
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
474
- Utils.configure_request_security(req, security) if !security.nil?
721
+ hook_ctx = SDKHooks::HookContext.new(
722
+ base_url: base_url,
723
+ oauth2_scopes: [],
724
+ operation_id: 'deleteLink',
725
+ security_source: @sdk_configuration.security_source
726
+ )
727
+
728
+ error = T.let(nil, T.nilable(StandardError))
729
+ r = T.let(nil, T.nilable(Faraday::Response))
730
+
731
+ begin
732
+ r = connection.delete(url) do |req|
733
+ req.headers.merge!(headers)
734
+ req.options.timeout = timeout unless timeout.nil?
735
+ Utils.configure_request_security(req, security)
736
+
737
+ @sdk_configuration.hooks.before_request(
738
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
739
+ hook_ctx: hook_ctx
740
+ ),
741
+ request: req
742
+ )
743
+ end
744
+ rescue StandardError => e
745
+ error = e
746
+ ensure
747
+ if r.nil? || Utils.error_status?(r.status)
748
+ r = @sdk_configuration.hooks.after_error(
749
+ error: error,
750
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
751
+ hook_ctx: hook_ctx
752
+ ),
753
+ response: r
754
+ )
755
+ else
756
+ r = @sdk_configuration.hooks.after_success(
757
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
758
+ hook_ctx: hook_ctx
759
+ ),
760
+ response: r
761
+ )
762
+ end
763
+
764
+ if r.nil?
765
+ raise error if !error.nil?
766
+ raise 'no response'
767
+ end
475
768
  end
476
769
 
477
770
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -535,8 +828,8 @@ module OpenApiSDK
535
828
  end
536
829
 
537
830
 
538
- sig { params(request: T.nilable(T::Array[::OpenApiSDK::Operations::RequestBody])).returns(::OpenApiSDK::Operations::BulkCreateLinksResponse) }
539
- def create_many(request)
831
+ sig { params(request: T.nilable(T::Array[::OpenApiSDK::Operations::RequestBody]), timeout_ms: T.nilable(Integer)).returns(::OpenApiSDK::Operations::BulkCreateLinksResponse) }
832
+ def create_many(request, timeout_ms = nil)
540
833
  # create_many - Bulk create links
541
834
  # Bulk create up to 100 links for the authenticated workspace.
542
835
  url, params = @sdk_configuration.get_server_details
@@ -545,21 +838,71 @@ module OpenApiSDK
545
838
  headers = {}
546
839
  req_content_type, data, form = Utils.serialize_request_body(request, :request, :json)
547
840
  headers['content-type'] = req_content_type
841
+
842
+ if form
843
+ body = Utils.encode_form(form)
844
+ elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
845
+ body = URI.encode_www_form(data)
846
+ else
847
+ body = data
848
+ end
548
849
  headers['Accept'] = 'application/json'
549
850
  headers['user-agent'] = @sdk_configuration.user_agent
550
851
 
852
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
853
+
854
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
855
+ timeout ||= @sdk_configuration.timeout
856
+
551
857
  connection = @sdk_configuration.client
552
858
 
553
- r = connection.post(url) do |req|
554
- req.headers = headers
555
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
556
- Utils.configure_request_security(req, security) if !security.nil?
557
- if form
558
- req.body = Utils.encode_form(form)
559
- elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
560
- req.body = URI.encode_www_form(data)
859
+ hook_ctx = SDKHooks::HookContext.new(
860
+ base_url: base_url,
861
+ oauth2_scopes: [],
862
+ operation_id: 'bulkCreateLinks',
863
+ security_source: @sdk_configuration.security_source
864
+ )
865
+
866
+ error = T.let(nil, T.nilable(StandardError))
867
+ r = T.let(nil, T.nilable(Faraday::Response))
868
+
869
+ begin
870
+ r = connection.post(url) do |req|
871
+ req.body = body
872
+ req.headers.merge!(headers)
873
+ req.options.timeout = timeout unless timeout.nil?
874
+ Utils.configure_request_security(req, security)
875
+
876
+ @sdk_configuration.hooks.before_request(
877
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
878
+ hook_ctx: hook_ctx
879
+ ),
880
+ request: req
881
+ )
882
+ end
883
+ rescue StandardError => e
884
+ error = e
885
+ ensure
886
+ if r.nil? || Utils.error_status?(r.status)
887
+ r = @sdk_configuration.hooks.after_error(
888
+ error: error,
889
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
890
+ hook_ctx: hook_ctx
891
+ ),
892
+ response: r
893
+ )
561
894
  else
562
- req.body = data
895
+ r = @sdk_configuration.hooks.after_success(
896
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
897
+ hook_ctx: hook_ctx
898
+ ),
899
+ response: r
900
+ )
901
+ end
902
+
903
+ if r.nil?
904
+ raise error if !error.nil?
905
+ raise 'no response'
563
906
  end
564
907
  end
565
908
 
@@ -624,8 +967,8 @@ module OpenApiSDK
624
967
  end
625
968
 
626
969
 
627
- sig { params(request: T.nilable(::OpenApiSDK::Operations::BulkUpdateLinksRequestBody)).returns(::OpenApiSDK::Operations::BulkUpdateLinksResponse) }
628
- def update_many(request)
970
+ sig { params(request: T.nilable(::OpenApiSDK::Operations::BulkUpdateLinksRequestBody), timeout_ms: T.nilable(Integer)).returns(::OpenApiSDK::Operations::BulkUpdateLinksResponse) }
971
+ def update_many(request, timeout_ms = nil)
629
972
  # update_many - Bulk update links
630
973
  # Bulk update up to 100 links with the same data for the authenticated workspace.
631
974
  url, params = @sdk_configuration.get_server_details
@@ -634,21 +977,71 @@ module OpenApiSDK
634
977
  headers = {}
635
978
  req_content_type, data, form = Utils.serialize_request_body(request, :request, :json)
636
979
  headers['content-type'] = req_content_type
980
+
981
+ if form
982
+ body = Utils.encode_form(form)
983
+ elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
984
+ body = URI.encode_www_form(data)
985
+ else
986
+ body = data
987
+ end
637
988
  headers['Accept'] = 'application/json'
638
989
  headers['user-agent'] = @sdk_configuration.user_agent
639
990
 
991
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
992
+
993
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
994
+ timeout ||= @sdk_configuration.timeout
995
+
640
996
  connection = @sdk_configuration.client
641
997
 
642
- r = connection.patch(url) do |req|
643
- req.headers = headers
644
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
645
- Utils.configure_request_security(req, security) if !security.nil?
646
- if form
647
- req.body = Utils.encode_form(form)
648
- elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
649
- req.body = URI.encode_www_form(data)
998
+ hook_ctx = SDKHooks::HookContext.new(
999
+ base_url: base_url,
1000
+ oauth2_scopes: [],
1001
+ operation_id: 'bulkUpdateLinks',
1002
+ security_source: @sdk_configuration.security_source
1003
+ )
1004
+
1005
+ error = T.let(nil, T.nilable(StandardError))
1006
+ r = T.let(nil, T.nilable(Faraday::Response))
1007
+
1008
+ begin
1009
+ r = connection.patch(url) do |req|
1010
+ req.body = body
1011
+ req.headers.merge!(headers)
1012
+ req.options.timeout = timeout unless timeout.nil?
1013
+ Utils.configure_request_security(req, security)
1014
+
1015
+ @sdk_configuration.hooks.before_request(
1016
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
1017
+ hook_ctx: hook_ctx
1018
+ ),
1019
+ request: req
1020
+ )
1021
+ end
1022
+ rescue StandardError => e
1023
+ error = e
1024
+ ensure
1025
+ if r.nil? || Utils.error_status?(r.status)
1026
+ r = @sdk_configuration.hooks.after_error(
1027
+ error: error,
1028
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
1029
+ hook_ctx: hook_ctx
1030
+ ),
1031
+ response: r
1032
+ )
650
1033
  else
651
- req.body = data
1034
+ r = @sdk_configuration.hooks.after_success(
1035
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
1036
+ hook_ctx: hook_ctx
1037
+ ),
1038
+ response: r
1039
+ )
1040
+ end
1041
+
1042
+ if r.nil?
1043
+ raise error if !error.nil?
1044
+ raise 'no response'
652
1045
  end
653
1046
  end
654
1047
 
@@ -713,8 +1106,8 @@ module OpenApiSDK
713
1106
  end
714
1107
 
715
1108
 
716
- sig { params(request: T.nilable(::OpenApiSDK::Operations::BulkDeleteLinksRequest)).returns(::OpenApiSDK::Operations::BulkDeleteLinksResponse) }
717
- def delete_many(request)
1109
+ sig { params(request: T.nilable(::OpenApiSDK::Operations::BulkDeleteLinksRequest), timeout_ms: T.nilable(Integer)).returns(::OpenApiSDK::Operations::BulkDeleteLinksResponse) }
1110
+ def delete_many(request, timeout_ms = nil)
718
1111
  # delete_many - Bulk delete links
719
1112
  # Bulk delete up to 100 links for the authenticated workspace.
720
1113
  url, params = @sdk_configuration.get_server_details
@@ -725,13 +1118,61 @@ module OpenApiSDK
725
1118
  headers['Accept'] = 'application/json'
726
1119
  headers['user-agent'] = @sdk_configuration.user_agent
727
1120
 
1121
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
1122
+
1123
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
1124
+ timeout ||= @sdk_configuration.timeout
1125
+
728
1126
  connection = @sdk_configuration.client
729
1127
 
730
- r = connection.delete(url) do |req|
731
- req.headers = headers
732
- req.params = query_params
733
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
734
- Utils.configure_request_security(req, security) if !security.nil?
1128
+ hook_ctx = SDKHooks::HookContext.new(
1129
+ base_url: base_url,
1130
+ oauth2_scopes: [],
1131
+ operation_id: 'bulkDeleteLinks',
1132
+ security_source: @sdk_configuration.security_source
1133
+ )
1134
+
1135
+ error = T.let(nil, T.nilable(StandardError))
1136
+ r = T.let(nil, T.nilable(Faraday::Response))
1137
+
1138
+ begin
1139
+ r = connection.delete(url) do |req|
1140
+ req.headers.merge!(headers)
1141
+ req.options.timeout = timeout unless timeout.nil?
1142
+ req.params = query_params
1143
+ Utils.configure_request_security(req, security)
1144
+
1145
+ @sdk_configuration.hooks.before_request(
1146
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
1147
+ hook_ctx: hook_ctx
1148
+ ),
1149
+ request: req
1150
+ )
1151
+ end
1152
+ rescue StandardError => e
1153
+ error = e
1154
+ ensure
1155
+ if r.nil? || Utils.error_status?(r.status)
1156
+ r = @sdk_configuration.hooks.after_error(
1157
+ error: error,
1158
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
1159
+ hook_ctx: hook_ctx
1160
+ ),
1161
+ response: r
1162
+ )
1163
+ else
1164
+ r = @sdk_configuration.hooks.after_success(
1165
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
1166
+ hook_ctx: hook_ctx
1167
+ ),
1168
+ response: r
1169
+ )
1170
+ end
1171
+
1172
+ if r.nil?
1173
+ raise error if !error.nil?
1174
+ raise 'no response'
1175
+ end
735
1176
  end
736
1177
 
737
1178
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -795,8 +1236,8 @@ module OpenApiSDK
795
1236
  end
796
1237
 
797
1238
 
798
- sig { params(request: T.nilable(::OpenApiSDK::Operations::UpsertLinkRequestBody)).returns(::OpenApiSDK::Operations::UpsertLinkResponse) }
799
- def upsert(request)
1239
+ sig { params(request: T.nilable(::OpenApiSDK::Operations::UpsertLinkRequestBody), timeout_ms: T.nilable(Integer)).returns(::OpenApiSDK::Operations::UpsertLinkResponse) }
1240
+ def upsert(request, timeout_ms = nil)
800
1241
  # upsert - Upsert a link
801
1242
  # Upsert a link for the authenticated workspace by its URL. If a link with the same URL already exists, return it (or update it if there are any changes). Otherwise, a new link will be created.
802
1243
  url, params = @sdk_configuration.get_server_details
@@ -805,21 +1246,71 @@ module OpenApiSDK
805
1246
  headers = {}
806
1247
  req_content_type, data, form = Utils.serialize_request_body(request, :request, :json)
807
1248
  headers['content-type'] = req_content_type
1249
+
1250
+ if form
1251
+ body = Utils.encode_form(form)
1252
+ elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
1253
+ body = URI.encode_www_form(data)
1254
+ else
1255
+ body = data
1256
+ end
808
1257
  headers['Accept'] = 'application/json'
809
1258
  headers['user-agent'] = @sdk_configuration.user_agent
810
1259
 
1260
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
1261
+
1262
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
1263
+ timeout ||= @sdk_configuration.timeout
1264
+
811
1265
  connection = @sdk_configuration.client
812
1266
 
813
- r = connection.put(url) do |req|
814
- req.headers = headers
815
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
816
- Utils.configure_request_security(req, security) if !security.nil?
817
- if form
818
- req.body = Utils.encode_form(form)
819
- elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
820
- req.body = URI.encode_www_form(data)
1267
+ hook_ctx = SDKHooks::HookContext.new(
1268
+ base_url: base_url,
1269
+ oauth2_scopes: [],
1270
+ operation_id: 'upsertLink',
1271
+ security_source: @sdk_configuration.security_source
1272
+ )
1273
+
1274
+ error = T.let(nil, T.nilable(StandardError))
1275
+ r = T.let(nil, T.nilable(Faraday::Response))
1276
+
1277
+ begin
1278
+ r = connection.put(url) do |req|
1279
+ req.body = body
1280
+ req.headers.merge!(headers)
1281
+ req.options.timeout = timeout unless timeout.nil?
1282
+ Utils.configure_request_security(req, security)
1283
+
1284
+ @sdk_configuration.hooks.before_request(
1285
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
1286
+ hook_ctx: hook_ctx
1287
+ ),
1288
+ request: req
1289
+ )
1290
+ end
1291
+ rescue StandardError => e
1292
+ error = e
1293
+ ensure
1294
+ if r.nil? || Utils.error_status?(r.status)
1295
+ r = @sdk_configuration.hooks.after_error(
1296
+ error: error,
1297
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
1298
+ hook_ctx: hook_ctx
1299
+ ),
1300
+ response: r
1301
+ )
821
1302
  else
822
- req.body = data
1303
+ r = @sdk_configuration.hooks.after_success(
1304
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
1305
+ hook_ctx: hook_ctx
1306
+ ),
1307
+ response: r
1308
+ )
1309
+ end
1310
+
1311
+ if r.nil?
1312
+ raise error if !error.nil?
1313
+ raise 'no response'
823
1314
  end
824
1315
  end
825
1316