dub 0.2.2.pre.alpha.78 → 0.2.2.pre.alpha.80

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a9d0c6fc13ae910b5cfc25832002d5204dd0da7a1f5ce60a480f594107456372
4
- data.tar.gz: 245931338bb119060274847dc4438b1b4e368ed63cb61691ea3df0105293113d
3
+ metadata.gz: 83d5b190c4cd7475fc2ba2466b45ea97009600b4d9b9dbcd45e31044cf638f7f
4
+ data.tar.gz: 271753ba8049940a043e2c8f865471f6b9e45a07205a06791e0949bd8752830d
5
5
  SHA512:
6
- metadata.gz: dcb67a93a385eb338068ec26a40fee0b29426236c4d8ae23b1ed4aa09ecfe1aac233d8e064b490fda5af620f19343c97665c0951e64d9bc55d2a0dc6a341f8ab
7
- data.tar.gz: 6fdfa5f82a094263fa293834344605529108556415bfeeba54726465b46edf44b78a94186ba73cf27800797c9b53469fbf3b8bf15af9b130ac64f0592cb0c57e
6
+ metadata.gz: 9f60b5993e1e0007d265c7810ae74b2c17572542b2d094ed9401613f2741a307e52820919de937c8b30e1ae076f889c0653cea79a3b3e4b6900a734ad8754a25
7
+ data.tar.gz: d3c0a0f3cfd65db19bb9d5043c640a67f16f485cdd0021b7f949f841328f4ef9d286c92435bed44f8bcfad83c5f03ba9a9e3ecf19777b6e1a5a2a19596d17247
@@ -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::RetrieveAnalyticsRequest)).returns(::OpenApiSDK::Operations::RetrieveAnalyticsResponse) }
25
- def retrieve(request)
25
+ sig { params(request: T.nilable(::OpenApiSDK::Operations::RetrieveAnalyticsRequest), timeout_ms: T.nilable(Integer)).returns(::OpenApiSDK::Operations::RetrieveAnalyticsResponse) }
26
+ def retrieve(request, timeout_ms = nil)
26
27
  # retrieve - Retrieve analytics for a link, a domain, or the authenticated workspace.
27
28
  # Retrieve analytics for a link, a domain, or the authenticated workspace. The response type depends on the `event` and `type` query parameters.
28
29
  url, params = @sdk_configuration.get_server_details
@@ -33,13 +34,61 @@ module OpenApiSDK
33
34
  headers['Accept'] = 'application/json'
34
35
  headers['user-agent'] = @sdk_configuration.user_agent
35
36
 
37
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
38
+
39
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
40
+ timeout ||= @sdk_configuration.timeout
41
+
36
42
  connection = @sdk_configuration.client
37
43
 
38
- r = connection.get(url) do |req|
39
- req.headers = headers
40
- req.params = query_params
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?
44
+ hook_ctx = SDKHooks::HookContext.new(
45
+ base_url: base_url,
46
+ oauth2_scopes: [],
47
+ operation_id: 'retrieveAnalytics',
48
+ security_source: @sdk_configuration.security_source
49
+ )
50
+
51
+ error = T.let(nil, T.nilable(StandardError))
52
+ r = T.let(nil, T.nilable(Faraday::Response))
53
+
54
+ begin
55
+ r = connection.get(url) do |req|
56
+ req.headers.merge!(headers)
57
+ req.options.timeout = timeout unless timeout.nil?
58
+ req.params = query_params
59
+ Utils.configure_request_security(req, security)
60
+
61
+ @sdk_configuration.hooks.before_request(
62
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
63
+ hook_ctx: hook_ctx
64
+ ),
65
+ request: req
66
+ )
67
+ end
68
+ rescue StandardError => e
69
+ error = e
70
+ ensure
71
+ if r.nil? || Utils.error_status?(r.status)
72
+ r = @sdk_configuration.hooks.after_error(
73
+ error: error,
74
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
75
+ hook_ctx: hook_ctx
76
+ ),
77
+ response: r
78
+ )
79
+ else
80
+ r = @sdk_configuration.hooks.after_success(
81
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
82
+ hook_ctx: hook_ctx
83
+ ),
84
+ response: r
85
+ )
86
+ end
87
+
88
+ if r.nil?
89
+ raise error if !error.nil?
90
+ raise 'no response'
91
+ end
43
92
  end
44
93
 
45
94
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -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::GetCustomersRequest)).returns(::OpenApiSDK::Operations::GetCustomersResponse) }
25
- def list(request)
25
+ sig { params(request: T.nilable(::OpenApiSDK::Operations::GetCustomersRequest), timeout_ms: T.nilable(Integer)).returns(::OpenApiSDK::Operations::GetCustomersResponse) }
26
+ def list(request, timeout_ms = nil)
26
27
  # list - Retrieve a list of customers
27
28
  # Retrieve a list of customers for the authenticated workspace.
28
29
  url, params = @sdk_configuration.get_server_details
@@ -33,13 +34,61 @@ module OpenApiSDK
33
34
  headers['Accept'] = 'application/json'
34
35
  headers['user-agent'] = @sdk_configuration.user_agent
35
36
 
37
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
38
+
39
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
40
+ timeout ||= @sdk_configuration.timeout
41
+
36
42
  connection = @sdk_configuration.client
37
43
 
38
- r = connection.get(url) do |req|
39
- req.headers = headers
40
- req.params = query_params
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?
44
+ hook_ctx = SDKHooks::HookContext.new(
45
+ base_url: base_url,
46
+ oauth2_scopes: [],
47
+ operation_id: 'getCustomers',
48
+ security_source: @sdk_configuration.security_source
49
+ )
50
+
51
+ error = T.let(nil, T.nilable(StandardError))
52
+ r = T.let(nil, T.nilable(Faraday::Response))
53
+
54
+ begin
55
+ r = connection.get(url) do |req|
56
+ req.headers.merge!(headers)
57
+ req.options.timeout = timeout unless timeout.nil?
58
+ req.params = query_params
59
+ Utils.configure_request_security(req, security)
60
+
61
+ @sdk_configuration.hooks.before_request(
62
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
63
+ hook_ctx: hook_ctx
64
+ ),
65
+ request: req
66
+ )
67
+ end
68
+ rescue StandardError => e
69
+ error = e
70
+ ensure
71
+ if r.nil? || Utils.error_status?(r.status)
72
+ r = @sdk_configuration.hooks.after_error(
73
+ error: error,
74
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
75
+ hook_ctx: hook_ctx
76
+ ),
77
+ response: r
78
+ )
79
+ else
80
+ r = @sdk_configuration.hooks.after_success(
81
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
82
+ hook_ctx: hook_ctx
83
+ ),
84
+ response: r
85
+ )
86
+ end
87
+
88
+ if r.nil?
89
+ raise error if !error.nil?
90
+ raise 'no response'
91
+ end
43
92
  end
44
93
 
45
94
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -103,8 +152,8 @@ module OpenApiSDK
103
152
  end
104
153
 
105
154
 
106
- sig { params(request: T.nilable(::OpenApiSDK::Operations::CreateCustomerRequestBody)).returns(::OpenApiSDK::Operations::CreateCustomerResponse) }
107
- def create(request)
155
+ sig { params(request: T.nilable(::OpenApiSDK::Operations::CreateCustomerRequestBody), timeout_ms: T.nilable(Integer)).returns(::OpenApiSDK::Operations::CreateCustomerResponse) }
156
+ def create(request, timeout_ms = nil)
108
157
  # create - Create a customer
109
158
  # [Deprecated]: Customer creation can only be done via tracking a lead event. Use the /track/lead endpoint instead.
110
159
  #
@@ -115,21 +164,71 @@ module OpenApiSDK
115
164
  headers = {}
116
165
  req_content_type, data, form = Utils.serialize_request_body(request, :request, :json)
117
166
  headers['content-type'] = req_content_type
167
+
168
+ if form
169
+ body = Utils.encode_form(form)
170
+ elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
171
+ body = URI.encode_www_form(data)
172
+ else
173
+ body = data
174
+ end
118
175
  headers['Accept'] = 'application/json'
119
176
  headers['user-agent'] = @sdk_configuration.user_agent
120
177
 
178
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
179
+
180
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
181
+ timeout ||= @sdk_configuration.timeout
182
+
121
183
  connection = @sdk_configuration.client
122
184
 
123
- r = connection.post(url) do |req|
124
- req.headers = headers
125
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
126
- Utils.configure_request_security(req, security) if !security.nil?
127
- if form
128
- req.body = Utils.encode_form(form)
129
- elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
130
- req.body = URI.encode_www_form(data)
185
+ hook_ctx = SDKHooks::HookContext.new(
186
+ base_url: base_url,
187
+ oauth2_scopes: [],
188
+ operation_id: 'createCustomer',
189
+ security_source: @sdk_configuration.security_source
190
+ )
191
+
192
+ error = T.let(nil, T.nilable(StandardError))
193
+ r = T.let(nil, T.nilable(Faraday::Response))
194
+
195
+ begin
196
+ r = connection.post(url) do |req|
197
+ req.body = body
198
+ req.headers.merge!(headers)
199
+ req.options.timeout = timeout unless timeout.nil?
200
+ Utils.configure_request_security(req, security)
201
+
202
+ @sdk_configuration.hooks.before_request(
203
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
204
+ hook_ctx: hook_ctx
205
+ ),
206
+ request: req
207
+ )
208
+ end
209
+ rescue StandardError => e
210
+ error = e
211
+ ensure
212
+ if r.nil? || Utils.error_status?(r.status)
213
+ r = @sdk_configuration.hooks.after_error(
214
+ error: error,
215
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
216
+ hook_ctx: hook_ctx
217
+ ),
218
+ response: r
219
+ )
131
220
  else
132
- req.body = data
221
+ r = @sdk_configuration.hooks.after_success(
222
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
223
+ hook_ctx: hook_ctx
224
+ ),
225
+ response: r
226
+ )
227
+ end
228
+
229
+ if r.nil?
230
+ raise error if !error.nil?
231
+ raise 'no response'
133
232
  end
134
233
  end
135
234
 
@@ -194,8 +293,8 @@ module OpenApiSDK
194
293
  end
195
294
 
196
295
 
197
- sig { params(request: T.nilable(::OpenApiSDK::Operations::GetCustomerRequest)).returns(::OpenApiSDK::Operations::GetCustomerResponse) }
198
- def get(request)
296
+ sig { params(request: T.nilable(::OpenApiSDK::Operations::GetCustomerRequest), timeout_ms: T.nilable(Integer)).returns(::OpenApiSDK::Operations::GetCustomerResponse) }
297
+ def get(request, timeout_ms = nil)
199
298
  # get - Retrieve a customer
200
299
  # Retrieve a customer by ID for the authenticated workspace.
201
300
  url, params = @sdk_configuration.get_server_details
@@ -211,13 +310,61 @@ module OpenApiSDK
211
310
  headers['Accept'] = 'application/json'
212
311
  headers['user-agent'] = @sdk_configuration.user_agent
213
312
 
313
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
314
+
315
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
316
+ timeout ||= @sdk_configuration.timeout
317
+
214
318
  connection = @sdk_configuration.client
215
319
 
216
- r = connection.get(url) do |req|
217
- req.headers = headers
218
- req.params = query_params
219
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
220
- Utils.configure_request_security(req, security) if !security.nil?
320
+ hook_ctx = SDKHooks::HookContext.new(
321
+ base_url: base_url,
322
+ oauth2_scopes: [],
323
+ operation_id: 'getCustomer',
324
+ security_source: @sdk_configuration.security_source
325
+ )
326
+
327
+ error = T.let(nil, T.nilable(StandardError))
328
+ r = T.let(nil, T.nilable(Faraday::Response))
329
+
330
+ begin
331
+ r = connection.get(url) do |req|
332
+ req.headers.merge!(headers)
333
+ req.options.timeout = timeout unless timeout.nil?
334
+ req.params = query_params
335
+ Utils.configure_request_security(req, security)
336
+
337
+ @sdk_configuration.hooks.before_request(
338
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
339
+ hook_ctx: hook_ctx
340
+ ),
341
+ request: req
342
+ )
343
+ end
344
+ rescue StandardError => e
345
+ error = e
346
+ ensure
347
+ if r.nil? || Utils.error_status?(r.status)
348
+ r = @sdk_configuration.hooks.after_error(
349
+ error: error,
350
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
351
+ hook_ctx: hook_ctx
352
+ ),
353
+ response: r
354
+ )
355
+ else
356
+ r = @sdk_configuration.hooks.after_success(
357
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
358
+ hook_ctx: hook_ctx
359
+ ),
360
+ response: r
361
+ )
362
+ end
363
+
364
+ if r.nil?
365
+ raise error if !error.nil?
366
+ raise 'no response'
367
+ end
221
368
  end
222
369
 
223
370
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
@@ -281,8 +428,8 @@ module OpenApiSDK
281
428
  end
282
429
 
283
430
 
284
- sig { params(request: T.nilable(::OpenApiSDK::Operations::UpdateCustomerRequest)).returns(::OpenApiSDK::Operations::UpdateCustomerResponse) }
285
- def update(request)
431
+ sig { params(request: T.nilable(::OpenApiSDK::Operations::UpdateCustomerRequest), timeout_ms: T.nilable(Integer)).returns(::OpenApiSDK::Operations::UpdateCustomerResponse) }
432
+ def update(request, timeout_ms = nil)
286
433
  # update - Update a customer
287
434
  # Update a customer for the authenticated workspace.
288
435
  url, params = @sdk_configuration.get_server_details
@@ -296,23 +443,73 @@ module OpenApiSDK
296
443
  headers = {}
297
444
  req_content_type, data, form = Utils.serialize_request_body(request, :request_body, :json)
298
445
  headers['content-type'] = req_content_type
446
+
447
+ if form
448
+ body = Utils.encode_form(form)
449
+ elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
450
+ body = URI.encode_www_form(data)
451
+ else
452
+ body = data
453
+ end
299
454
  query_params = Utils.get_query_params(::OpenApiSDK::Operations::UpdateCustomerRequest, request)
300
455
  headers['Accept'] = 'application/json'
301
456
  headers['user-agent'] = @sdk_configuration.user_agent
302
457
 
458
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
459
+
460
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
461
+ timeout ||= @sdk_configuration.timeout
462
+
303
463
  connection = @sdk_configuration.client
304
464
 
305
- r = connection.patch(url) do |req|
306
- req.headers = headers
307
- req.params = query_params
308
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
309
- Utils.configure_request_security(req, security) if !security.nil?
310
- if form
311
- req.body = Utils.encode_form(form)
312
- elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
313
- req.body = URI.encode_www_form(data)
465
+ hook_ctx = SDKHooks::HookContext.new(
466
+ base_url: base_url,
467
+ oauth2_scopes: [],
468
+ operation_id: 'updateCustomer',
469
+ security_source: @sdk_configuration.security_source
470
+ )
471
+
472
+ error = T.let(nil, T.nilable(StandardError))
473
+ r = T.let(nil, T.nilable(Faraday::Response))
474
+
475
+ begin
476
+ r = connection.patch(url) do |req|
477
+ req.body = body
478
+ req.headers.merge!(headers)
479
+ req.options.timeout = timeout unless timeout.nil?
480
+ req.params = query_params
481
+ Utils.configure_request_security(req, security)
482
+
483
+ @sdk_configuration.hooks.before_request(
484
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
485
+ hook_ctx: hook_ctx
486
+ ),
487
+ request: req
488
+ )
489
+ end
490
+ rescue StandardError => e
491
+ error = e
492
+ ensure
493
+ if r.nil? || Utils.error_status?(r.status)
494
+ r = @sdk_configuration.hooks.after_error(
495
+ error: error,
496
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
497
+ hook_ctx: hook_ctx
498
+ ),
499
+ response: r
500
+ )
314
501
  else
315
- req.body = data
502
+ r = @sdk_configuration.hooks.after_success(
503
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
504
+ hook_ctx: hook_ctx
505
+ ),
506
+ response: r
507
+ )
508
+ end
509
+
510
+ if r.nil?
511
+ raise error if !error.nil?
512
+ raise 'no response'
316
513
  end
317
514
  end
318
515
 
@@ -377,8 +574,8 @@ module OpenApiSDK
377
574
  end
378
575
 
379
576
 
380
- sig { params(request: T.nilable(::OpenApiSDK::Operations::DeleteCustomerRequest)).returns(::OpenApiSDK::Operations::DeleteCustomerResponse) }
381
- def delete(request)
577
+ sig { params(request: T.nilable(::OpenApiSDK::Operations::DeleteCustomerRequest), timeout_ms: T.nilable(Integer)).returns(::OpenApiSDK::Operations::DeleteCustomerResponse) }
578
+ def delete(request, timeout_ms = nil)
382
579
  # delete - Delete a customer
383
580
  # Delete a customer from a workspace.
384
581
  url, params = @sdk_configuration.get_server_details
@@ -393,12 +590,60 @@ module OpenApiSDK
393
590
  headers['Accept'] = 'application/json'
394
591
  headers['user-agent'] = @sdk_configuration.user_agent
395
592
 
593
+ security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
594
+
595
+ timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
596
+ timeout ||= @sdk_configuration.timeout
597
+
396
598
  connection = @sdk_configuration.client
397
599
 
398
- r = connection.delete(url) do |req|
399
- req.headers = headers
400
- security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
401
- Utils.configure_request_security(req, security) if !security.nil?
600
+ hook_ctx = SDKHooks::HookContext.new(
601
+ base_url: base_url,
602
+ oauth2_scopes: [],
603
+ operation_id: 'deleteCustomer',
604
+ security_source: @sdk_configuration.security_source
605
+ )
606
+
607
+ error = T.let(nil, T.nilable(StandardError))
608
+ r = T.let(nil, T.nilable(Faraday::Response))
609
+
610
+ begin
611
+ r = connection.delete(url) do |req|
612
+ req.headers.merge!(headers)
613
+ req.options.timeout = timeout unless timeout.nil?
614
+ Utils.configure_request_security(req, security)
615
+
616
+ @sdk_configuration.hooks.before_request(
617
+ hook_ctx: SDKHooks::BeforeRequestHookContext.new(
618
+ hook_ctx: hook_ctx
619
+ ),
620
+ request: req
621
+ )
622
+ end
623
+ rescue StandardError => e
624
+ error = e
625
+ ensure
626
+ if r.nil? || Utils.error_status?(r.status)
627
+ r = @sdk_configuration.hooks.after_error(
628
+ error: error,
629
+ hook_ctx: SDKHooks::AfterErrorHookContext.new(
630
+ hook_ctx: hook_ctx
631
+ ),
632
+ response: r
633
+ )
634
+ else
635
+ r = @sdk_configuration.hooks.after_success(
636
+ hook_ctx: SDKHooks::AfterSuccessHookContext.new(
637
+ hook_ctx: hook_ctx
638
+ ),
639
+ response: r
640
+ )
641
+ end
642
+
643
+ if r.nil?
644
+ raise error if !error.nil?
645
+ raise 'no response'
646
+ end
402
647
  end
403
648
 
404
649
  content_type = r.headers.fetch('Content-Type', 'application/octet-stream')