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.
- checksums.yaml +4 -4
- data/lib/open_api_sdk/analytics.rb +56 -7
- data/lib/open_api_sdk/customers.rb +288 -43
- data/lib/open_api_sdk/domains.rb +232 -35
- data/lib/open_api_sdk/dub.rb +22 -8
- data/lib/open_api_sdk/embed_tokens.rb +62 -11
- data/lib/open_api_sdk/events.rb +56 -7
- data/lib/open_api_sdk/folders.rb +232 -35
- data/lib/open_api_sdk/links.rb +580 -89
- data/lib/open_api_sdk/metatags.rb +56 -7
- data/lib/open_api_sdk/models/operations/status.rb +4 -1
- data/lib/open_api_sdk/models/operations/updatepartnersale_status.rb +1 -0
- data/lib/open_api_sdk/models/shared/domainschema.rb +8 -2
- data/lib/open_api_sdk/models/shared/plan.rb +1 -0
- data/lib/open_api_sdk/partners.rb +300 -51
- data/lib/open_api_sdk/qr_codes.rb +56 -7
- data/lib/open_api_sdk/sdk_hooks/hooks.rb +103 -0
- data/lib/open_api_sdk/sdk_hooks/registration.rb +35 -0
- data/lib/open_api_sdk/sdk_hooks/types.rb +152 -0
- data/lib/open_api_sdk/sdkconfiguration.rb +11 -4
- data/lib/open_api_sdk/tags.rb +232 -35
- data/lib/open_api_sdk/track.rb +123 -22
- data/lib/open_api_sdk/utils/utils.rb +10 -0
- data/lib/open_api_sdk/workspaces.rb +116 -17
- metadata +5 -2
@@ -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::GetMetatagsRequest)).returns(::OpenApiSDK::Operations::GetMetatagsResponse) }
|
25
|
-
def get(request)
|
25
|
+
sig { params(request: T.nilable(::OpenApiSDK::Operations::GetMetatagsRequest), timeout_ms: T.nilable(Integer)).returns(::OpenApiSDK::Operations::GetMetatagsResponse) }
|
26
|
+
def get(request, timeout_ms = nil)
|
26
27
|
# get - Retrieve the metatags for a URL
|
27
28
|
# Retrieve the metatags for a URL.
|
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
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
44
|
+
hook_ctx = SDKHooks::HookContext.new(
|
45
|
+
base_url: base_url,
|
46
|
+
oauth2_scopes: [],
|
47
|
+
operation_id: 'getMetatags',
|
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')
|
@@ -10,9 +10,12 @@ module OpenApiSDK
|
|
10
10
|
|
11
11
|
class Status < T::Enum
|
12
12
|
enums do
|
13
|
-
APPROVED = new('approved')
|
14
13
|
PENDING = new('pending')
|
14
|
+
APPROVED = new('approved')
|
15
15
|
REJECTED = new('rejected')
|
16
|
+
INVITED = new('invited')
|
17
|
+
DECLINED = new('declined')
|
18
|
+
BANNED = new('banned')
|
16
19
|
end
|
17
20
|
end
|
18
21
|
end
|
@@ -11,8 +11,12 @@ module OpenApiSDK
|
|
11
11
|
class DomainSchema < ::Crystalline::FieldAugmented
|
12
12
|
extend T::Sig
|
13
13
|
|
14
|
+
# apple-app-site-association configuration file (for deep link support on iOS).
|
15
|
+
field :apple_app_site_association, ::String, { 'format_json': { 'letter_case': ::OpenApiSDK::Utils.field_name('appleAppSiteAssociation') } }
|
14
16
|
# Whether the domain is archived.
|
15
17
|
field :archived, T::Boolean, { 'format_json': { 'letter_case': ::OpenApiSDK::Utils.field_name('archived') } }
|
18
|
+
# assetLinks.json configuration file (for deep link support on Android).
|
19
|
+
field :asset_links, ::String, { 'format_json': { 'letter_case': ::OpenApiSDK::Utils.field_name('assetLinks') } }
|
16
20
|
# The date the domain was created.
|
17
21
|
field :created_at, ::String, { 'format_json': { 'letter_case': ::OpenApiSDK::Utils.field_name('createdAt') } }
|
18
22
|
# The URL to redirect to when a link under this domain has expired.
|
@@ -37,9 +41,11 @@ module OpenApiSDK
|
|
37
41
|
field :verified, T::Boolean, { 'format_json': { 'letter_case': ::OpenApiSDK::Utils.field_name('verified') } }
|
38
42
|
|
39
43
|
|
40
|
-
sig { params(archived: T::Boolean, created_at: ::String, expired_url: ::String, id: ::String, logo: ::String, not_found_url: ::String, placeholder: ::String, primary: T::Boolean, registered_domain: ::OpenApiSDK::Shared::RegisteredDomain, slug: ::String, updated_at: ::String, verified: T::Boolean).void }
|
41
|
-
def initialize(archived: nil, created_at: nil, expired_url: nil, id: nil, logo: nil, not_found_url: nil, placeholder: nil, primary: nil, registered_domain: nil, slug: nil, updated_at: nil, verified: nil)
|
44
|
+
sig { params(apple_app_site_association: ::String, archived: T::Boolean, asset_links: ::String, created_at: ::String, expired_url: ::String, id: ::String, logo: ::String, not_found_url: ::String, placeholder: ::String, primary: T::Boolean, registered_domain: ::OpenApiSDK::Shared::RegisteredDomain, slug: ::String, updated_at: ::String, verified: T::Boolean).void }
|
45
|
+
def initialize(apple_app_site_association: nil, archived: nil, asset_links: nil, created_at: nil, expired_url: nil, id: nil, logo: nil, not_found_url: nil, placeholder: nil, primary: nil, registered_domain: nil, slug: nil, updated_at: nil, verified: nil)
|
46
|
+
@apple_app_site_association = apple_app_site_association
|
42
47
|
@archived = archived
|
48
|
+
@asset_links = asset_links
|
43
49
|
@created_at = created_at
|
44
50
|
@expired_url = expired_url
|
45
51
|
@id = id
|
@@ -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::CreatePartnerRequestBody)).returns(::OpenApiSDK::Operations::CreatePartnerResponse) }
|
25
|
-
def create(request)
|
25
|
+
sig { params(request: T.nilable(::OpenApiSDK::Operations::CreatePartnerRequestBody), timeout_ms: T.nilable(Integer)).returns(::OpenApiSDK::Operations::CreatePartnerResponse) }
|
26
|
+
def create(request, timeout_ms = nil)
|
26
27
|
# create - Create a new partner
|
27
28
|
# Create a new partner for a program. If partner exists, automatically enrolls them.
|
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
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
53
|
+
hook_ctx = SDKHooks::HookContext.new(
|
54
|
+
base_url: base_url,
|
55
|
+
oauth2_scopes: [],
|
56
|
+
operation_id: 'createPartner',
|
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
|
-
|
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::CreatePartnerLinkRequestBody)).returns(::OpenApiSDK::Operations::CreatePartnerLinkResponse) }
|
114
|
-
def create_link(request)
|
164
|
+
sig { params(request: T.nilable(::OpenApiSDK::Operations::CreatePartnerLinkRequestBody), timeout_ms: T.nilable(Integer)).returns(::OpenApiSDK::Operations::CreatePartnerLinkResponse) }
|
165
|
+
def create_link(request, timeout_ms = nil)
|
115
166
|
# create_link - Create a link for a partner
|
116
167
|
# Create a new link for a partner that is enrolled in your program.
|
117
168
|
url, params = @sdk_configuration.get_server_details
|
@@ -120,21 +171,71 @@ module OpenApiSDK
|
|
120
171
|
headers = {}
|
121
172
|
req_content_type, data, form = Utils.serialize_request_body(request, :request, :json)
|
122
173
|
headers['content-type'] = req_content_type
|
174
|
+
|
175
|
+
if form
|
176
|
+
body = Utils.encode_form(form)
|
177
|
+
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
178
|
+
body = URI.encode_www_form(data)
|
179
|
+
else
|
180
|
+
body = data
|
181
|
+
end
|
123
182
|
headers['Accept'] = 'application/json'
|
124
183
|
headers['user-agent'] = @sdk_configuration.user_agent
|
125
184
|
|
185
|
+
security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
|
186
|
+
|
187
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
188
|
+
timeout ||= @sdk_configuration.timeout
|
189
|
+
|
126
190
|
connection = @sdk_configuration.client
|
127
191
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
192
|
+
hook_ctx = SDKHooks::HookContext.new(
|
193
|
+
base_url: base_url,
|
194
|
+
oauth2_scopes: [],
|
195
|
+
operation_id: 'createPartnerLink',
|
196
|
+
security_source: @sdk_configuration.security_source
|
197
|
+
)
|
198
|
+
|
199
|
+
error = T.let(nil, T.nilable(StandardError))
|
200
|
+
r = T.let(nil, T.nilable(Faraday::Response))
|
201
|
+
|
202
|
+
begin
|
203
|
+
r = connection.post(url) do |req|
|
204
|
+
req.body = body
|
205
|
+
req.headers.merge!(headers)
|
206
|
+
req.options.timeout = timeout unless timeout.nil?
|
207
|
+
Utils.configure_request_security(req, security)
|
208
|
+
|
209
|
+
@sdk_configuration.hooks.before_request(
|
210
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
211
|
+
hook_ctx: hook_ctx
|
212
|
+
),
|
213
|
+
request: req
|
214
|
+
)
|
215
|
+
end
|
216
|
+
rescue StandardError => e
|
217
|
+
error = e
|
218
|
+
ensure
|
219
|
+
if r.nil? || Utils.error_status?(r.status)
|
220
|
+
r = @sdk_configuration.hooks.after_error(
|
221
|
+
error: error,
|
222
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
223
|
+
hook_ctx: hook_ctx
|
224
|
+
),
|
225
|
+
response: r
|
226
|
+
)
|
136
227
|
else
|
137
|
-
|
228
|
+
r = @sdk_configuration.hooks.after_success(
|
229
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
230
|
+
hook_ctx: hook_ctx
|
231
|
+
),
|
232
|
+
response: r
|
233
|
+
)
|
234
|
+
end
|
235
|
+
|
236
|
+
if r.nil?
|
237
|
+
raise error if !error.nil?
|
238
|
+
raise 'no response'
|
138
239
|
end
|
139
240
|
end
|
140
241
|
|
@@ -199,8 +300,8 @@ module OpenApiSDK
|
|
199
300
|
end
|
200
301
|
|
201
302
|
|
202
|
-
sig { params(request: T.nilable(::OpenApiSDK::Operations::UpsertPartnerLinkRequestBody)).returns(::OpenApiSDK::Operations::UpsertPartnerLinkResponse) }
|
203
|
-
def upsert_link(request)
|
303
|
+
sig { params(request: T.nilable(::OpenApiSDK::Operations::UpsertPartnerLinkRequestBody), timeout_ms: T.nilable(Integer)).returns(::OpenApiSDK::Operations::UpsertPartnerLinkResponse) }
|
304
|
+
def upsert_link(request, timeout_ms = nil)
|
204
305
|
# upsert_link - Upsert a link for a partner
|
205
306
|
# Upsert a link for a partner that is enrolled in your program. 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.
|
206
307
|
url, params = @sdk_configuration.get_server_details
|
@@ -209,21 +310,71 @@ module OpenApiSDK
|
|
209
310
|
headers = {}
|
210
311
|
req_content_type, data, form = Utils.serialize_request_body(request, :request, :json)
|
211
312
|
headers['content-type'] = req_content_type
|
313
|
+
|
314
|
+
if form
|
315
|
+
body = Utils.encode_form(form)
|
316
|
+
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
317
|
+
body = URI.encode_www_form(data)
|
318
|
+
else
|
319
|
+
body = data
|
320
|
+
end
|
212
321
|
headers['Accept'] = 'application/json'
|
213
322
|
headers['user-agent'] = @sdk_configuration.user_agent
|
214
323
|
|
324
|
+
security = !@sdk_configuration.nil? && !@sdk_configuration.security_source.nil? ? @sdk_configuration.security_source.call : nil
|
325
|
+
|
326
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
327
|
+
timeout ||= @sdk_configuration.timeout
|
328
|
+
|
215
329
|
connection = @sdk_configuration.client
|
216
330
|
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
331
|
+
hook_ctx = SDKHooks::HookContext.new(
|
332
|
+
base_url: base_url,
|
333
|
+
oauth2_scopes: [],
|
334
|
+
operation_id: 'upsertPartnerLink',
|
335
|
+
security_source: @sdk_configuration.security_source
|
336
|
+
)
|
337
|
+
|
338
|
+
error = T.let(nil, T.nilable(StandardError))
|
339
|
+
r = T.let(nil, T.nilable(Faraday::Response))
|
340
|
+
|
341
|
+
begin
|
342
|
+
r = connection.put(url) do |req|
|
343
|
+
req.body = body
|
344
|
+
req.headers.merge!(headers)
|
345
|
+
req.options.timeout = timeout unless timeout.nil?
|
346
|
+
Utils.configure_request_security(req, security)
|
347
|
+
|
348
|
+
@sdk_configuration.hooks.before_request(
|
349
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
350
|
+
hook_ctx: hook_ctx
|
351
|
+
),
|
352
|
+
request: req
|
353
|
+
)
|
354
|
+
end
|
355
|
+
rescue StandardError => e
|
356
|
+
error = e
|
357
|
+
ensure
|
358
|
+
if r.nil? || Utils.error_status?(r.status)
|
359
|
+
r = @sdk_configuration.hooks.after_error(
|
360
|
+
error: error,
|
361
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
362
|
+
hook_ctx: hook_ctx
|
363
|
+
),
|
364
|
+
response: r
|
365
|
+
)
|
225
366
|
else
|
226
|
-
|
367
|
+
r = @sdk_configuration.hooks.after_success(
|
368
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
369
|
+
hook_ctx: hook_ctx
|
370
|
+
),
|
371
|
+
response: r
|
372
|
+
)
|
373
|
+
end
|
374
|
+
|
375
|
+
if r.nil?
|
376
|
+
raise error if !error.nil?
|
377
|
+
raise 'no response'
|
227
378
|
end
|
228
379
|
end
|
229
380
|
|
@@ -288,8 +439,8 @@ module OpenApiSDK
|
|
288
439
|
end
|
289
440
|
|
290
441
|
|
291
|
-
sig { params(request: T.nilable(::OpenApiSDK::Operations::RetrievePartnerAnalyticsRequest)).returns(::OpenApiSDK::Operations::RetrievePartnerAnalyticsResponse) }
|
292
|
-
def analytics(request)
|
442
|
+
sig { params(request: T.nilable(::OpenApiSDK::Operations::RetrievePartnerAnalyticsRequest), timeout_ms: T.nilable(Integer)).returns(::OpenApiSDK::Operations::RetrievePartnerAnalyticsResponse) }
|
443
|
+
def analytics(request, timeout_ms = nil)
|
293
444
|
# analytics - Retrieve analytics for a partner
|
294
445
|
# Retrieve analytics for a partner within a program. The response type vary based on the `groupBy` query parameter.
|
295
446
|
url, params = @sdk_configuration.get_server_details
|
@@ -300,13 +451,61 @@ module OpenApiSDK
|
|
300
451
|
headers['Accept'] = 'application/json'
|
301
452
|
headers['user-agent'] = @sdk_configuration.user_agent
|
302
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
|
+
|
303
459
|
connection = @sdk_configuration.client
|
304
460
|
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
461
|
+
hook_ctx = SDKHooks::HookContext.new(
|
462
|
+
base_url: base_url,
|
463
|
+
oauth2_scopes: [],
|
464
|
+
operation_id: 'retrievePartnerAnalytics',
|
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.get(url) do |req|
|
473
|
+
req.headers.merge!(headers)
|
474
|
+
req.options.timeout = timeout unless timeout.nil?
|
475
|
+
req.params = query_params
|
476
|
+
Utils.configure_request_security(req, security)
|
477
|
+
|
478
|
+
@sdk_configuration.hooks.before_request(
|
479
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
480
|
+
hook_ctx: hook_ctx
|
481
|
+
),
|
482
|
+
request: req
|
483
|
+
)
|
484
|
+
end
|
485
|
+
rescue StandardError => e
|
486
|
+
error = e
|
487
|
+
ensure
|
488
|
+
if r.nil? || Utils.error_status?(r.status)
|
489
|
+
r = @sdk_configuration.hooks.after_error(
|
490
|
+
error: error,
|
491
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
492
|
+
hook_ctx: hook_ctx
|
493
|
+
),
|
494
|
+
response: r
|
495
|
+
)
|
496
|
+
else
|
497
|
+
r = @sdk_configuration.hooks.after_success(
|
498
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
499
|
+
hook_ctx: hook_ctx
|
500
|
+
),
|
501
|
+
response: r
|
502
|
+
)
|
503
|
+
end
|
504
|
+
|
505
|
+
if r.nil?
|
506
|
+
raise error if !error.nil?
|
507
|
+
raise 'no response'
|
508
|
+
end
|
310
509
|
end
|
311
510
|
|
312
511
|
content_type = r.headers.fetch('Content-Type', 'application/octet-stream')
|
@@ -370,8 +569,8 @@ module OpenApiSDK
|
|
370
569
|
end
|
371
570
|
|
372
571
|
|
373
|
-
sig { params(request: T.nilable(::OpenApiSDK::Operations::UpdatePartnerSaleRequestBody)).returns(::OpenApiSDK::Operations::UpdatePartnerSaleResponse) }
|
374
|
-
def update_sale(request)
|
572
|
+
sig { params(request: T.nilable(::OpenApiSDK::Operations::UpdatePartnerSaleRequestBody), timeout_ms: T.nilable(Integer)).returns(::OpenApiSDK::Operations::UpdatePartnerSaleResponse) }
|
573
|
+
def update_sale(request, timeout_ms = nil)
|
375
574
|
# update_sale - Update a sale for a partner.
|
376
575
|
# Update an existing sale amount. This is useful for handling refunds (partial or full) or fraudulent sales.
|
377
576
|
url, params = @sdk_configuration.get_server_details
|
@@ -380,21 +579,71 @@ module OpenApiSDK
|
|
380
579
|
headers = {}
|
381
580
|
req_content_type, data, form = Utils.serialize_request_body(request, :request, :json)
|
382
581
|
headers['content-type'] = req_content_type
|
582
|
+
|
583
|
+
if form
|
584
|
+
body = Utils.encode_form(form)
|
585
|
+
elsif Utils.match_content_type(req_content_type, 'application/x-www-form-urlencoded')
|
586
|
+
body = URI.encode_www_form(data)
|
587
|
+
else
|
588
|
+
body = data
|
589
|
+
end
|
383
590
|
headers['Accept'] = 'application/json'
|
384
591
|
headers['user-agent'] = @sdk_configuration.user_agent
|
385
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
|
+
|
386
598
|
connection = @sdk_configuration.client
|
387
599
|
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
600
|
+
hook_ctx = SDKHooks::HookContext.new(
|
601
|
+
base_url: base_url,
|
602
|
+
oauth2_scopes: [],
|
603
|
+
operation_id: 'updatePartnerSale',
|
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.patch(url) do |req|
|
612
|
+
req.body = body
|
613
|
+
req.headers.merge!(headers)
|
614
|
+
req.options.timeout = timeout unless timeout.nil?
|
615
|
+
Utils.configure_request_security(req, security)
|
616
|
+
|
617
|
+
@sdk_configuration.hooks.before_request(
|
618
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
619
|
+
hook_ctx: hook_ctx
|
620
|
+
),
|
621
|
+
request: req
|
622
|
+
)
|
623
|
+
end
|
624
|
+
rescue StandardError => e
|
625
|
+
error = e
|
626
|
+
ensure
|
627
|
+
if r.nil? || Utils.error_status?(r.status)
|
628
|
+
r = @sdk_configuration.hooks.after_error(
|
629
|
+
error: error,
|
630
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
631
|
+
hook_ctx: hook_ctx
|
632
|
+
),
|
633
|
+
response: r
|
634
|
+
)
|
396
635
|
else
|
397
|
-
|
636
|
+
r = @sdk_configuration.hooks.after_success(
|
637
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
638
|
+
hook_ctx: hook_ctx
|
639
|
+
),
|
640
|
+
response: r
|
641
|
+
)
|
642
|
+
end
|
643
|
+
|
644
|
+
if r.nil?
|
645
|
+
raise error if !error.nil?
|
646
|
+
raise 'no response'
|
398
647
|
end
|
399
648
|
end
|
400
649
|
|
@@ -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::GetQRCodeRequest)).returns(::OpenApiSDK::Operations::GetQRCodeResponse) }
|
25
|
-
def get(request)
|
25
|
+
sig { params(request: T.nilable(::OpenApiSDK::Operations::GetQRCodeRequest), timeout_ms: T.nilable(Integer)).returns(::OpenApiSDK::Operations::GetQRCodeResponse) }
|
26
|
+
def get(request, timeout_ms = nil)
|
26
27
|
# get - Retrieve a QR code
|
27
28
|
# Retrieve a QR code for a link.
|
28
29
|
url, params = @sdk_configuration.get_server_details
|
@@ -33,13 +34,61 @@ module OpenApiSDK
|
|
33
34
|
headers['Accept'] = 'application/json;q=1, image/png;q=0'
|
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
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
44
|
+
hook_ctx = SDKHooks::HookContext.new(
|
45
|
+
base_url: base_url,
|
46
|
+
oauth2_scopes: [],
|
47
|
+
operation_id: 'getQRCode',
|
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')
|