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.
@@ -0,0 +1,103 @@
1
+ # Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
2
+
3
+ # typed: true
4
+ # frozen_string_literal: true
5
+
6
+ require_relative './registration'
7
+ require_relative './types'
8
+
9
+ require 'sorbet-runtime'
10
+
11
+ module OpenApiSDK
12
+ module SDKHooks
13
+ class Hooks
14
+ extend T::Sig
15
+
16
+ sig { void }
17
+ def initialize
18
+ @sdk_init_hooks = T.let([], T::Array[AbstractSDKInitHook])
19
+ @before_request_hooks = T.let([], T::Array[AbstractBeforeRequestHook])
20
+ @after_success_hooks = T.let([], T::Array[AbstractAfterSuccessHook])
21
+ @after_error_hooks = T.let([], T::Array[AbstractAfterErrorHook])
22
+ Registration.init_hooks self
23
+ end
24
+
25
+ sig { params(hook: AbstractSDKInitHook).void }
26
+ def register_sdk_init_hook(hook)
27
+ @sdk_init_hooks << hook
28
+ end
29
+
30
+ sig { params(hook: AbstractBeforeRequestHook).void }
31
+ def register_before_request_hook(hook)
32
+ @before_request_hooks << hook
33
+ end
34
+
35
+ sig { params(hook: AbstractAfterSuccessHook).void }
36
+ def register_after_success_hook(hook)
37
+ @after_success_hooks << hook
38
+ end
39
+
40
+ sig { params(hook: AbstractAfterErrorHook).void }
41
+ def register_after_error_hook(hook)
42
+ @after_error_hooks << hook
43
+ end
44
+
45
+ sig do
46
+ params(
47
+ base_url: String,
48
+ client: Faraday::Connection
49
+ ).returns([String, Faraday::Connection])
50
+ end
51
+ def sdk_init(base_url:, client:)
52
+ @sdk_init_hooks.each do |hook|
53
+ base_url, client = hook.sdk_init(base_url: base_url, client: client)
54
+ end
55
+
56
+ return base_url, client
57
+ end
58
+
59
+ sig do
60
+ params(
61
+ hook_ctx: BeforeRequestHookContext,
62
+ request: Faraday::Request
63
+ ).returns(Faraday::Request)
64
+ end
65
+ def before_request(hook_ctx:, request:)
66
+ @before_request_hooks.each do |hook|
67
+ request = hook.before_request(hook_ctx: hook_ctx, request: request)
68
+ end
69
+
70
+ request
71
+ end
72
+
73
+ sig do
74
+ params(
75
+ hook_ctx: AfterSuccessHookContext,
76
+ response: Faraday::Response
77
+ ).returns(Faraday::Response)
78
+ end
79
+ def after_success(hook_ctx:, response:)
80
+ @after_success_hooks.each do |hook|
81
+ response = hook.after_success(hook_ctx: hook_ctx, response: response)
82
+ end
83
+
84
+ response
85
+ end
86
+
87
+ sig do
88
+ params(
89
+ error: T.nilable(StandardError),
90
+ hook_ctx: AfterErrorHookContext,
91
+ response: T.nilable(Faraday::Response)
92
+ ).returns(T.nilable(Faraday::Response))
93
+ end
94
+ def after_error(error:, hook_ctx:, response:)
95
+ @after_error_hooks.each do |hook|
96
+ response = hook.after_error(error: error, hook_ctx: hook_ctx, response: response)
97
+ end
98
+
99
+ response
100
+ end
101
+ end
102
+ end
103
+ end
@@ -0,0 +1,35 @@
1
+ # typed: true
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file is only ever generated once on the first generation and then is free to be modified.
6
+ # Any hooks you wish to add should be registered in the init_hooks method.
7
+ #
8
+ # Hooks are registered per SDK instance, and are valid for the lifetime of the SDK instance.
9
+ #
10
+
11
+ require_relative './types'
12
+
13
+ require 'sorbet-runtime'
14
+
15
+ module OpenApiSDK
16
+ module SDKHooks
17
+ class Registration
18
+ extend T::Sig
19
+
20
+ sig do
21
+ params(
22
+ hooks: Hooks
23
+ ).void
24
+ end
25
+ def self.init_hooks(hooks)
26
+ # example_hook = ExampleHook.new
27
+
28
+ # hooks.register_sdk_init_hook example_hook
29
+ # hooks.register_before_request_hook example_hook
30
+ # hooks.register_after_error_hook example_hook
31
+ # hooks.register_after_success_hook example_hook
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,152 @@
1
+ # Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
2
+
3
+ # typed: true
4
+ # frozen_string_literal: true
5
+
6
+ require 'sorbet-runtime'
7
+
8
+ module OpenApiSDK
9
+ module SDKHooks
10
+ class HookContext
11
+ extend T::Sig
12
+
13
+ sig { returns(String) }
14
+ attr_accessor :base_url
15
+
16
+ sig { returns(T.nilable(T::Array[String])) }
17
+ attr_accessor :oauth2_scopes
18
+
19
+ sig { returns(String) }
20
+ attr_accessor :operation_id
21
+
22
+ sig { returns(T.nilable(T.proc.returns(T.untyped))) }
23
+ attr_accessor :security_source
24
+
25
+ sig do
26
+ params(
27
+ base_url: String,
28
+ oauth2_scopes: T.nilable(T::Array[String]),
29
+ operation_id: String,
30
+ security_source: T.nilable(T.proc.returns(T.untyped))
31
+ ).void
32
+ end
33
+ def initialize(base_url:, oauth2_scopes:, operation_id:, security_source:)
34
+ @base_url = T.let(base_url, String)
35
+ @oauth2_scopes = T.let(oauth2_scopes, T.nilable(T::Array[String]))
36
+ @operation_id = T.let(operation_id, String)
37
+ @security_source = T.let(security_source, T.nilable(T.proc.returns(T.untyped)))
38
+ end
39
+ end
40
+
41
+ class BeforeRequestHookContext < HookContext
42
+ extend T::Sig
43
+
44
+ sig do
45
+ params(
46
+ hook_ctx: HookContext
47
+ ).void
48
+ end
49
+ def initialize(hook_ctx:)
50
+ super(
51
+ base_url: hook_ctx.base_url,
52
+ operation_id: hook_ctx.operation_id,
53
+ oauth2_scopes: hook_ctx.oauth2_scopes,
54
+ security_source: hook_ctx.security_source
55
+ )
56
+ end
57
+ end
58
+
59
+ class AfterSuccessHookContext < HookContext
60
+ extend T::Sig
61
+
62
+ sig do
63
+ params(
64
+ hook_ctx: HookContext
65
+ ).void
66
+ end
67
+ def initialize(hook_ctx:)
68
+ super(
69
+ base_url: hook_ctx.base_url,
70
+ operation_id: hook_ctx.operation_id,
71
+ oauth2_scopes: hook_ctx.oauth2_scopes,
72
+ security_source: hook_ctx.security_source
73
+ )
74
+ end
75
+ end
76
+
77
+ class AfterErrorHookContext < HookContext
78
+ extend T::Sig
79
+
80
+ sig do
81
+ params(
82
+ hook_ctx: HookContext
83
+ ).void
84
+ end
85
+ def initialize(hook_ctx:)
86
+ super(
87
+ base_url: hook_ctx.base_url,
88
+ operation_id: hook_ctx.operation_id,
89
+ oauth2_scopes: hook_ctx.oauth2_scopes,
90
+ security_source: hook_ctx.security_source
91
+ )
92
+ end
93
+ end
94
+
95
+ module AbstractSDKInitHook
96
+ extend T::Sig
97
+ extend T::Helpers
98
+ abstract!
99
+
100
+ sig do
101
+ abstract.params(
102
+ base_url: String,
103
+ client: Faraday::Connection
104
+ ).returns([String, Faraday::Connection])
105
+ end
106
+ def sdk_init(base_url:, client:); end
107
+ end
108
+
109
+ module AbstractBeforeRequestHook
110
+ extend T::Sig
111
+ extend T::Helpers
112
+ abstract!
113
+
114
+ sig do
115
+ abstract.params(
116
+ hook_ctx: BeforeRequestHookContext,
117
+ request: Faraday::Request
118
+ ).returns(Faraday::Request)
119
+ end
120
+ def before_request(hook_ctx:, request:); end
121
+ end
122
+
123
+ module AbstractAfterSuccessHook
124
+ extend T::Sig
125
+ extend T::Helpers
126
+ abstract!
127
+
128
+ sig do
129
+ abstract.params(
130
+ hook_ctx: AfterSuccessHookContext,
131
+ response: Faraday::Response
132
+ ).returns(Faraday::Response)
133
+ end
134
+ def after_success(hook_ctx:, response:); end
135
+ end
136
+
137
+ module AbstractAfterErrorHook
138
+ extend T::Sig
139
+ extend T::Helpers
140
+ abstract!
141
+
142
+ sig do
143
+ abstract.params(
144
+ error: T.nilable(StandardError),
145
+ hook_ctx: AfterErrorHookContext,
146
+ response: T.nilable(Faraday::Response)
147
+ ).returns(T.nilable(Faraday::Response))
148
+ end
149
+ def after_error(error:, hook_ctx:, response:); end
150
+ end
151
+ end
152
+ end
@@ -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,7 +22,9 @@ module OpenApiSDK
21
22
  extend T::Sig
22
23
 
23
24
  field :client, T.nilable(Faraday::Connection)
25
+ field :hooks, ::OpenApiSDK::SDKHooks::Hooks
24
26
  field :retry_config, T.nilable(::OpenApiSDK::Utils::RetryConfig)
27
+ field :timeout, T.nilable(Float)
25
28
  field :security_source, T.nilable(T.proc.returns(T.nilable(::OpenApiSDK::Shared::Security)))
26
29
  field :server_url, T.nilable(String)
27
30
  field :server_idx, T.nilable(Integer)
@@ -34,17 +37,21 @@ module OpenApiSDK
34
37
  sig do
35
38
  params(
36
39
  client: T.nilable(Faraday::Connection),
40
+ hooks: ::OpenApiSDK::SDKHooks::Hooks,
37
41
  retry_config: T.nilable(::OpenApiSDK::Utils::RetryConfig),
42
+ timeout_ms: T.nilable(Integer),
38
43
  security: T.nilable(::OpenApiSDK::Shared::Security),
39
44
  security_source: T.nilable(T.proc.returns(::OpenApiSDK::Shared::Security)),
40
45
  server_url: T.nilable(String),
41
46
  server_idx: T.nilable(Integer)
42
47
  ).void
43
48
  end
44
- def initialize(client, retry_config, security, security_source, server_url, server_idx)
49
+ def initialize(client, hooks, retry_config, timeout_ms, security, security_source, server_url, server_idx)
45
50
  @client = client
51
+ @hooks = hooks
46
52
  @retry_config = retry_config
47
53
  @server_url = server_url
54
+ @timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
48
55
  @server_idx = server_idx.nil? ? 0 : server_idx
49
56
  raise StandardError, "Invalid server index #{server_idx}" if @server_idx.negative? || @server_idx >= SERVERS.length
50
57
  if !security_source.nil?
@@ -54,9 +61,9 @@ module OpenApiSDK
54
61
  end
55
62
  @language = 'ruby'
56
63
  @openapi_doc_version = '0.0.1'
57
- @sdk_version = '0.2.2-alpha.77'
58
- @gen_version = '2.548.6'
59
- @user_agent = 'speakeasy-sdk/ruby 0.2.2-alpha.77 2.548.6 0.0.1 dub'
64
+ @sdk_version = '0.2.2-alpha.79'
65
+ @gen_version = '2.559.0'
66
+ @user_agent = 'speakeasy-sdk/ruby 0.2.2-alpha.79 2.559.0 0.0.1 dub'
60
67
  end
61
68
 
62
69
  sig { returns([String, T::Hash[Symbol, String]]) }
@@ -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::CreateTagRequestBody)).returns(::OpenApiSDK::Operations::CreateTagResponse) }
25
- def create(request)
25
+ sig { params(request: T.nilable(::OpenApiSDK::Operations::CreateTagRequestBody), timeout_ms: T.nilable(Integer)).returns(::OpenApiSDK::Operations::CreateTagResponse) }
26
+ def create(request, timeout_ms = nil)
26
27
  # create - Create a new tag
27
28
  # Create a new tag 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: 'createTag',
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::GetTagsRequest)).returns(::OpenApiSDK::Operations::GetTagsResponse) }
114
- def list(request)
164
+ sig { params(request: T.nilable(::OpenApiSDK::Operations::GetTagsRequest), timeout_ms: T.nilable(Integer)).returns(::OpenApiSDK::Operations::GetTagsResponse) }
165
+ def list(request, timeout_ms = nil)
115
166
  # list - Retrieve a list of tags
116
167
  # Retrieve a list of tags 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: 'getTags',
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::UpdateTagRequest)).returns(::OpenApiSDK::Operations::UpdateTagResponse) }
196
- def update(request)
294
+ sig { params(request: T.nilable(::OpenApiSDK::Operations::UpdateTagRequest), timeout_ms: T.nilable(Integer)).returns(::OpenApiSDK::Operations::UpdateTagResponse) }
295
+ def update(request, timeout_ms = nil)
197
296
  # update - Update a tag
198
297
  # Update a tag in the workspace.
199
298
  url, params = @sdk_configuration.get_server_details
@@ -207,21 +306,71 @@ module OpenApiSDK
207
306
  headers = {}
208
307
  req_content_type, data, form = Utils.serialize_request_body(request, :request_body, :json)
209
308
  headers['content-type'] = req_content_type
309
+
310
+ if form
311
+ body = Utils.encode_form(form)
312
+ elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
313
+ body = URI.encode_www_form(data)
314
+ else
315
+ body = data
316
+ end
210
317
  headers['Accept'] = 'application/json'
211
318
  headers['user-agent'] = @sdk_configuration.user_agent
212
319
 
320
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
321
+
322
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
323
+ timeout ||= @sdk_configuration.timeout
324
+
213
325
  connection = @sdk_configuration.client
214
326
 
215
- r = connection.patch(url) do |req|
216
- req.headers = headers
217
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
218
- Utils.configure_request_security(req, security) if !security.nil?
219
- if form
220
- req.body = Utils.encode_form(form)
221
- elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
222
- req.body = URI.encode_www_form(data)
327
+ hook_ctx = SDKHooks::HookContext.new(
328
+ base_url: base_url,
329
+ oauth2_scopes: [],
330
+ operation_id: 'updateTag',
331
+ security_source: @sdk_configuration.security_source
332
+ )
333
+
334
+ error = T.let(nil, T.nilable(StandardError))
335
+ r = T.let(nil, T.nilable(Faraday::Response))
336
+
337
+ begin
338
+ r = connection.patch(url) do |req|
339
+ req.body = body
340
+ req.headers.merge!(headers)
341
+ req.options.timeout = timeout unless timeout.nil?
342
+ Utils.configure_request_security(req, security)
343
+
344
+ @sdk_configuration.hooks.before_request(
345
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
346
+ hook_ctx: hook_ctx
347
+ ),
348
+ request: req
349
+ )
350
+ end
351
+ rescue StandardError => e
352
+ error = e
353
+ ensure
354
+ if r.nil? || Utils.error_status?(r.status)
355
+ r = @sdk_configuration.hooks.after_error(
356
+ error: error,
357
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
358
+ hook_ctx: hook_ctx
359
+ ),
360
+ response: r
361
+ )
223
362
  else
224
- req.body = data
363
+ r = @sdk_configuration.hooks.after_success(
364
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
365
+ hook_ctx: hook_ctx
366
+ ),
367
+ response: r
368
+ )
369
+ end
370
+
371
+ if r.nil?
372
+ raise error if !error.nil?
373
+ raise 'no response'
225
374
  end
226
375
  end
227
376
 
@@ -286,8 +435,8 @@ module OpenApiSDK
286
435
  end
287
436
 
288
437
 
289
- sig { params(request: T.nilable(::OpenApiSDK::Operations::DeleteTagRequest)).returns(::OpenApiSDK::Operations::DeleteTagResponse) }
290
- def delete(request)
438
+ sig { params(request: T.nilable(::OpenApiSDK::Operations::DeleteTagRequest), timeout_ms: T.nilable(Integer)).returns(::OpenApiSDK::Operations::DeleteTagResponse) }
439
+ def delete(request, timeout_ms = nil)
291
440
  # delete - Delete a tag
292
441
  # Delete a tag from the workspace. All existing links will still work, but they will no longer be associated with this tag.
293
442
  url, params = @sdk_configuration.get_server_details
@@ -302,12 +451,60 @@ module OpenApiSDK
302
451
  headers['Accept'] = 'application/json'
303
452
  headers['user-agent'] = @sdk_configuration.user_agent
304
453
 
454
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
455
+
456
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
457
+ timeout ||= @sdk_configuration.timeout
458
+
305
459
  connection = @sdk_configuration.client
306
460
 
307
- r = connection.delete(url) do |req|
308
- req.headers = headers
309
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
310
- Utils.configure_request_security(req, security) if !security.nil?
461
+ hook_ctx = SDKHooks::HookContext.new(
462
+ base_url: base_url,
463
+ oauth2_scopes: [],
464
+ operation_id: 'deleteTag',
465
+ security_source: @sdk_configuration.security_source
466
+ )
467
+
468
+ error = T.let(nil, T.nilable(StandardError))
469
+ r = T.let(nil, T.nilable(Faraday::Response))
470
+
471
+ begin
472
+ r = connection.delete(url) do |req|
473
+ req.headers.merge!(headers)
474
+ req.options.timeout = timeout unless timeout.nil?
475
+ Utils.configure_request_security(req, security)
476
+
477
+ @sdk_configuration.hooks.before_request(
478
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
479
+ hook_ctx: hook_ctx
480
+ ),
481
+ request: req
482
+ )
483
+ end
484
+ rescue StandardError => e
485
+ error = e
486
+ ensure
487
+ if r.nil? || Utils.error_status?(r.status)
488
+ r = @sdk_configuration.hooks.after_error(
489
+ error: error,
490
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
491
+ hook_ctx: hook_ctx
492
+ ),
493
+ response: r
494
+ )
495
+ else
496
+ r = @sdk_configuration.hooks.after_success(
497
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
498
+ hook_ctx: hook_ctx
499
+ ),
500
+ response: r
501
+ )
502
+ end
503
+
504
+ if r.nil?
505
+ raise error if !error.nil?
506
+ raise 'no response'
507
+ end
311
508
  end
312
509
 
313
510
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')