noresponse 2.1.1 → 2.1.2
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/no_response/accounts.rb +654 -0
- data/lib/no_response/models/operations/getaccount_request.rb +29 -0
- data/lib/no_response/models/operations/getaccount_request.rbi +14 -0
- data/lib/no_response/models/operations/getaccount_response.rb +32 -0
- data/lib/no_response/models/operations/getaccount_response.rbi +20 -0
- data/lib/no_response/models/operations/listaccountassessments_request.rb +61 -0
- data/lib/no_response/models/operations/listaccountassessments_request.rbi +32 -0
- data/lib/no_response/models/operations/listaccountassessments_response.rb +44 -0
- data/lib/no_response/models/operations/listaccountassessments_response.rbi +20 -0
- data/lib/no_response/models/operations.rb +4 -0
- data/lib/no_response/models/shared/account.rb +83 -0
- data/lib/no_response/models/shared/account.rbi +44 -0
- data/lib/no_response/models/shared/accountdecision.rb +21 -0
- data/lib/no_response/models/shared/accountdecision.rbi +9 -0
- data/lib/no_response/models/shared/accountdecisionsbyflow.rb +74 -0
- data/lib/no_response/models/shared/accountdecisionsbyflow.rbi +26 -0
- data/lib/no_response/models/shared/accountrisk.rb +62 -0
- data/lib/no_response/models/shared/accountrisk.rbi +26 -0
- data/lib/no_response/models/shared/accountriskreason.rb +67 -0
- data/lib/no_response/models/shared/accountriskreason.rbi +26 -0
- data/lib/no_response/models/shared/assessment.rb +1 -1
- data/lib/no_response/models/shared/assessmentlist.rb +1 -1
- data/lib/no_response/models/shared/assessmentquery.rb +1 -1
- data/lib/no_response/models/shared/assessmentrequest.rb +1 -1
- data/lib/no_response/models/shared.rb +5 -0
- data/lib/no_response/noresponseclient.rb +2 -1
- data/lib/no_response/sdkconfiguration.rb +2 -2
- data/lib/noresponse.rb +1 -0
- metadata +20 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: abee64f2c770dc3925c0ac89374de2c10a3e95d0109e7af7a41a95b292228cf0
|
|
4
|
+
data.tar.gz: 4255a65fdbd764874671d4ac4a7b53266ac89142ae23ed6bd2f487d750a3e568
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2ac90026f9293675c2016dad3340dbdbb4db0c62668c62e224a5b479e2f63a39b2ead1072f7529e3262c30eef3f53aae038cd57a9664596f8b8ab72a6fcbaa3f
|
|
7
|
+
data.tar.gz: dd2d2455ce99adfa06dc0c8c9cdfdafc1c6d3ff2610dd3879e4fb3fc476fda24248940770625b40744b2b1ee982f32ff8ce58f1f895a3e8e416a3fab07c1cadd
|
|
@@ -0,0 +1,654 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require "faraday"
|
|
5
|
+
require "faraday/multipart"
|
|
6
|
+
require "faraday/retry"
|
|
7
|
+
require "sorbet-runtime"
|
|
8
|
+
require "janeway"
|
|
9
|
+
|
|
10
|
+
require_relative "sdk_hooks/hooks"
|
|
11
|
+
require_relative "utils/retries"
|
|
12
|
+
|
|
13
|
+
module NoResponse
|
|
14
|
+
extend T::Sig
|
|
15
|
+
|
|
16
|
+
class Accounts
|
|
17
|
+
extend T::Sig
|
|
18
|
+
|
|
19
|
+
# Your accounts, each with one current risk, and their assessment history.
|
|
20
|
+
|
|
21
|
+
sig { params(sdk_config: SDKConfiguration).void }
|
|
22
|
+
def initialize(sdk_config)
|
|
23
|
+
@sdk_configuration = sdk_config
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
sig { params(base_url: String, url_variables: T.nilable(T::Hash[Symbol, T.any(String, T::Enum)])).returns(String) }
|
|
27
|
+
def get_url(base_url:, url_variables: nil)
|
|
28
|
+
sd_base_url, sd_options = @sdk_configuration.get_server_details
|
|
29
|
+
|
|
30
|
+
if base_url.nil?
|
|
31
|
+
base_url = sd_base_url
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
if url_variables.nil?
|
|
35
|
+
url_variables = sd_options
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
return Utils.template_url(base_url, url_variables)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
sig {
|
|
42
|
+
params(
|
|
43
|
+
account_id: ::String,
|
|
44
|
+
retries: T.nilable(Utils::RetryConfig),
|
|
45
|
+
timeout_ms: T.nilable(Integer),
|
|
46
|
+
http_headers: T.nilable(T::Hash[T.any(String, Symbol), String])
|
|
47
|
+
)
|
|
48
|
+
.returns(Models::Operations::GetAccountResponse)
|
|
49
|
+
}
|
|
50
|
+
def get(account_id:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
51
|
+
# get - Read an account's one current risk.
|
|
52
|
+
# An account is the account_id you send with your assessments. Its current risk is the risk of its latest assessment with a decision (status complete or partial), scored as GET /v1/assessments/{assessment_id} scores that assessment, with a decision for each flow. Every assessment updates its account: once an assessment completes, the account carries its risk. Requires the history scope. Read-only and safe to retry. An account with no unexpired assessment that has a decision answers 404 not_found, and a malformed account_id answers 400 invalid_request.
|
|
53
|
+
request = Models::Operations::GetAccountRequest.new(
|
|
54
|
+
account_id: account_id
|
|
55
|
+
)
|
|
56
|
+
url, params = @sdk_configuration.get_server_details
|
|
57
|
+
base_url = Utils.template_url(url, params)
|
|
58
|
+
url = Utils.generate_url(
|
|
59
|
+
Models::Operations::GetAccountRequest,
|
|
60
|
+
base_url,
|
|
61
|
+
"/v1/accounts/{account_id}",
|
|
62
|
+
request
|
|
63
|
+
)
|
|
64
|
+
headers = {}
|
|
65
|
+
headers = T.cast(headers, T::Hash[String, String])
|
|
66
|
+
headers["Accept"] = "application/json"
|
|
67
|
+
headers["user-agent"] = @sdk_configuration.user_agent
|
|
68
|
+
retries ||= @sdk_configuration.retry_config
|
|
69
|
+
retries ||= Utils::RetryConfig.new(
|
|
70
|
+
backoff: Utils::BackoffStrategy.new(
|
|
71
|
+
exponent: 2.0,
|
|
72
|
+
initial_interval: 500,
|
|
73
|
+
max_elapsed_time: 30_000,
|
|
74
|
+
max_interval: 8000
|
|
75
|
+
),
|
|
76
|
+
retry_connection_errors: true,
|
|
77
|
+
strategy: "backoff"
|
|
78
|
+
)
|
|
79
|
+
retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
|
|
80
|
+
retry_options[:retry_statuses] = [408, 429, 500, 501, 502, 503, 504, 505]
|
|
81
|
+
|
|
82
|
+
security = @sdk_configuration.security_source&.call
|
|
83
|
+
|
|
84
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
85
|
+
timeout ||= @sdk_configuration.timeout
|
|
86
|
+
|
|
87
|
+
connection = @sdk_configuration.client.dup
|
|
88
|
+
connection.use(Utils::RetryMiddleware, retry_options)
|
|
89
|
+
|
|
90
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
91
|
+
config: @sdk_configuration,
|
|
92
|
+
base_url: base_url,
|
|
93
|
+
oauth2_scopes: nil,
|
|
94
|
+
operation_id: "getAccount",
|
|
95
|
+
security_source: @sdk_configuration.security_source
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
99
|
+
http_response = T.let(nil, T.nilable(Faraday::Response))
|
|
100
|
+
|
|
101
|
+
begin
|
|
102
|
+
http_response = T.must(connection).get(url) do |req|
|
|
103
|
+
req.headers.merge!(headers)
|
|
104
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
105
|
+
Utils.configure_request_security(req, security)
|
|
106
|
+
http_headers&.each do |key, value|
|
|
107
|
+
req.headers[key.to_s] = value
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
@sdk_configuration.hooks.before_request(
|
|
111
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
112
|
+
hook_ctx: hook_ctx
|
|
113
|
+
),
|
|
114
|
+
request: req
|
|
115
|
+
)
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
rescue StandardError => e
|
|
119
|
+
error = e
|
|
120
|
+
ensure
|
|
121
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
|
122
|
+
http_response = @sdk_configuration.hooks.after_error(
|
|
123
|
+
error: error,
|
|
124
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
125
|
+
hook_ctx: hook_ctx
|
|
126
|
+
),
|
|
127
|
+
response: http_response
|
|
128
|
+
)
|
|
129
|
+
else
|
|
130
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
131
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
132
|
+
hook_ctx: hook_ctx
|
|
133
|
+
),
|
|
134
|
+
response: http_response
|
|
135
|
+
)
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
if http_response.nil?
|
|
139
|
+
raise error if !error.nil?
|
|
140
|
+
raise "no response"
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
content_type = http_response.headers.fetch("Content-Type", "application/octet-stream")
|
|
145
|
+
if Utils.match_status_code(http_response.status, ["200"])
|
|
146
|
+
if Utils.match_content_type(content_type, "application/json")
|
|
147
|
+
@sdk_configuration.hooks.after_success(
|
|
148
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
149
|
+
hook_ctx: hook_ctx
|
|
150
|
+
),
|
|
151
|
+
response: http_response
|
|
152
|
+
)
|
|
153
|
+
response_data = http_response.env.response_body
|
|
154
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Shared::Account)
|
|
155
|
+
result = obj
|
|
156
|
+
response = Models::Operations::GetAccountResponse.new(
|
|
157
|
+
result: result,
|
|
158
|
+
headers: http_response.headers
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
return response
|
|
162
|
+
else
|
|
163
|
+
raise(
|
|
164
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
165
|
+
status_code: http_response.status,
|
|
166
|
+
body: http_response.env.response_body,
|
|
167
|
+
raw_response: http_response
|
|
168
|
+
),
|
|
169
|
+
"Unknown content type received"
|
|
170
|
+
)
|
|
171
|
+
end
|
|
172
|
+
elsif Utils.match_status_code(http_response.status, ["400"])
|
|
173
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
174
|
+
@sdk_configuration.hooks.after_success(
|
|
175
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
176
|
+
hook_ctx: hook_ctx
|
|
177
|
+
),
|
|
178
|
+
response: http_response
|
|
179
|
+
)
|
|
180
|
+
response_data = http_response.env.response_body
|
|
181
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::BadRequestError)
|
|
182
|
+
raise obj
|
|
183
|
+
else
|
|
184
|
+
raise(
|
|
185
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
186
|
+
status_code: http_response.status,
|
|
187
|
+
body: http_response.env.response_body,
|
|
188
|
+
raw_response: http_response
|
|
189
|
+
),
|
|
190
|
+
"Unknown content type received"
|
|
191
|
+
)
|
|
192
|
+
end
|
|
193
|
+
elsif Utils.match_status_code(http_response.status, ["401"])
|
|
194
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
195
|
+
@sdk_configuration.hooks.after_success(
|
|
196
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
197
|
+
hook_ctx: hook_ctx
|
|
198
|
+
),
|
|
199
|
+
response: http_response
|
|
200
|
+
)
|
|
201
|
+
response_data = http_response.env.response_body
|
|
202
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::AuthenticationError)
|
|
203
|
+
raise obj
|
|
204
|
+
else
|
|
205
|
+
raise(
|
|
206
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
207
|
+
status_code: http_response.status,
|
|
208
|
+
body: http_response.env.response_body,
|
|
209
|
+
raw_response: http_response
|
|
210
|
+
),
|
|
211
|
+
"Unknown content type received"
|
|
212
|
+
)
|
|
213
|
+
end
|
|
214
|
+
elsif Utils.match_status_code(http_response.status, ["403"])
|
|
215
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
216
|
+
@sdk_configuration.hooks.after_success(
|
|
217
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
218
|
+
hook_ctx: hook_ctx
|
|
219
|
+
),
|
|
220
|
+
response: http_response
|
|
221
|
+
)
|
|
222
|
+
response_data = http_response.env.response_body
|
|
223
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::PermissionDeniedError)
|
|
224
|
+
raise obj
|
|
225
|
+
else
|
|
226
|
+
raise(
|
|
227
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
228
|
+
status_code: http_response.status,
|
|
229
|
+
body: http_response.env.response_body,
|
|
230
|
+
raw_response: http_response
|
|
231
|
+
),
|
|
232
|
+
"Unknown content type received"
|
|
233
|
+
)
|
|
234
|
+
end
|
|
235
|
+
elsif Utils.match_status_code(http_response.status, ["404"])
|
|
236
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
237
|
+
@sdk_configuration.hooks.after_success(
|
|
238
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
239
|
+
hook_ctx: hook_ctx
|
|
240
|
+
),
|
|
241
|
+
response: http_response
|
|
242
|
+
)
|
|
243
|
+
response_data = http_response.env.response_body
|
|
244
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::NotFoundError)
|
|
245
|
+
raise obj
|
|
246
|
+
else
|
|
247
|
+
raise(
|
|
248
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
249
|
+
status_code: http_response.status,
|
|
250
|
+
body: http_response.env.response_body,
|
|
251
|
+
raw_response: http_response
|
|
252
|
+
),
|
|
253
|
+
"Unknown content type received"
|
|
254
|
+
)
|
|
255
|
+
end
|
|
256
|
+
elsif Utils.match_status_code(http_response.status, ["409"])
|
|
257
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
258
|
+
@sdk_configuration.hooks.after_success(
|
|
259
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
260
|
+
hook_ctx: hook_ctx
|
|
261
|
+
),
|
|
262
|
+
response: http_response
|
|
263
|
+
)
|
|
264
|
+
response_data = http_response.env.response_body
|
|
265
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::ConflictError)
|
|
266
|
+
raise obj
|
|
267
|
+
else
|
|
268
|
+
raise(
|
|
269
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
270
|
+
status_code: http_response.status,
|
|
271
|
+
body: http_response.env.response_body,
|
|
272
|
+
raw_response: http_response
|
|
273
|
+
),
|
|
274
|
+
"Unknown content type received"
|
|
275
|
+
)
|
|
276
|
+
end
|
|
277
|
+
elsif Utils.match_status_code(http_response.status, ["429"])
|
|
278
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
279
|
+
@sdk_configuration.hooks.after_success(
|
|
280
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
281
|
+
hook_ctx: hook_ctx
|
|
282
|
+
),
|
|
283
|
+
response: http_response
|
|
284
|
+
)
|
|
285
|
+
response_data = http_response.env.response_body
|
|
286
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::RateLimitError)
|
|
287
|
+
raise obj
|
|
288
|
+
else
|
|
289
|
+
raise(
|
|
290
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
291
|
+
status_code: http_response.status,
|
|
292
|
+
body: http_response.env.response_body,
|
|
293
|
+
raw_response: http_response
|
|
294
|
+
),
|
|
295
|
+
"Unknown content type received"
|
|
296
|
+
)
|
|
297
|
+
end
|
|
298
|
+
elsif Utils.match_status_code(http_response.status, ["4XX"])
|
|
299
|
+
raise(
|
|
300
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
301
|
+
status_code: http_response.status,
|
|
302
|
+
body: http_response.env.response_body,
|
|
303
|
+
raw_response: http_response
|
|
304
|
+
),
|
|
305
|
+
"API error occurred"
|
|
306
|
+
)
|
|
307
|
+
elsif Utils.match_status_code(http_response.status, ["5XX"])
|
|
308
|
+
raise(
|
|
309
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
310
|
+
status_code: http_response.status,
|
|
311
|
+
body: http_response.env.response_body,
|
|
312
|
+
raw_response: http_response
|
|
313
|
+
),
|
|
314
|
+
"API error occurred"
|
|
315
|
+
)
|
|
316
|
+
else
|
|
317
|
+
raise(
|
|
318
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
319
|
+
status_code: http_response.status,
|
|
320
|
+
body: http_response.env.response_body,
|
|
321
|
+
raw_response: http_response
|
|
322
|
+
),
|
|
323
|
+
"Unknown status code received"
|
|
324
|
+
)
|
|
325
|
+
|
|
326
|
+
end
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
sig {
|
|
330
|
+
params(
|
|
331
|
+
account_id: ::String,
|
|
332
|
+
limit: T.nilable(::Integer),
|
|
333
|
+
cursor: T.nilable(::String),
|
|
334
|
+
response_mode: T.nilable(Models::Shared::ResponseMode),
|
|
335
|
+
retries: T.nilable(Utils::RetryConfig),
|
|
336
|
+
timeout_ms: T.nilable(Integer),
|
|
337
|
+
http_headers: T.nilable(T::Hash[T.any(String, Symbol), String])
|
|
338
|
+
)
|
|
339
|
+
.returns(Models::Operations::ListAccountAssessmentsResponse)
|
|
340
|
+
}
|
|
341
|
+
def list_assessments(
|
|
342
|
+
account_id:,
|
|
343
|
+
limit: nil,
|
|
344
|
+
cursor: nil,
|
|
345
|
+
response_mode: nil,
|
|
346
|
+
retries: nil,
|
|
347
|
+
timeout_ms: nil,
|
|
348
|
+
http_headers: nil
|
|
349
|
+
)
|
|
350
|
+
# list_assessments - Page through one account's unexpired assessments.
|
|
351
|
+
# The account's history: the same page as POST /v1/assessments/query for this account_id, newest first, each at its latest assessment_version. Requires the history scope. Read-only and safe to retry. An account with no assessments answers 200 with empty items. The cursor is opaque and bound to your tenant and the account; a tampered or expired cursor answers 400 invalid_cursor. response_mode=detailed needs the detailed scope. The account_id travels in the URL; use POST /v1/assessments/query to keep it out of access logs.
|
|
352
|
+
request = Models::Operations::ListAccountAssessmentsRequest.new(
|
|
353
|
+
account_id: account_id,
|
|
354
|
+
limit: limit,
|
|
355
|
+
cursor: cursor,
|
|
356
|
+
response_mode: response_mode
|
|
357
|
+
)
|
|
358
|
+
url, params = @sdk_configuration.get_server_details
|
|
359
|
+
base_url = Utils.template_url(url, params)
|
|
360
|
+
url = Utils.generate_url(
|
|
361
|
+
Models::Operations::ListAccountAssessmentsRequest,
|
|
362
|
+
base_url,
|
|
363
|
+
"/v1/accounts/{account_id}/assessments",
|
|
364
|
+
request
|
|
365
|
+
)
|
|
366
|
+
headers = {}
|
|
367
|
+
headers = T.cast(headers, T::Hash[String, String])
|
|
368
|
+
query_params = Utils.get_query_params(Models::Operations::ListAccountAssessmentsRequest, request, nil)
|
|
369
|
+
headers["Accept"] = "application/json"
|
|
370
|
+
headers["user-agent"] = @sdk_configuration.user_agent
|
|
371
|
+
retries ||= @sdk_configuration.retry_config
|
|
372
|
+
retries ||= Utils::RetryConfig.new(
|
|
373
|
+
backoff: Utils::BackoffStrategy.new(
|
|
374
|
+
exponent: 2.0,
|
|
375
|
+
initial_interval: 500,
|
|
376
|
+
max_elapsed_time: 30_000,
|
|
377
|
+
max_interval: 8000
|
|
378
|
+
),
|
|
379
|
+
retry_connection_errors: true,
|
|
380
|
+
strategy: "backoff"
|
|
381
|
+
)
|
|
382
|
+
retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
|
|
383
|
+
retry_options[:retry_statuses] = [408, 429, 500, 501, 502, 503, 504, 505]
|
|
384
|
+
|
|
385
|
+
security = @sdk_configuration.security_source&.call
|
|
386
|
+
|
|
387
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
388
|
+
timeout ||= @sdk_configuration.timeout
|
|
389
|
+
|
|
390
|
+
connection = @sdk_configuration.client.dup
|
|
391
|
+
connection.use(Utils::RetryMiddleware, retry_options)
|
|
392
|
+
|
|
393
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
394
|
+
config: @sdk_configuration,
|
|
395
|
+
base_url: base_url,
|
|
396
|
+
oauth2_scopes: nil,
|
|
397
|
+
operation_id: "listAccountAssessments",
|
|
398
|
+
security_source: @sdk_configuration.security_source
|
|
399
|
+
)
|
|
400
|
+
|
|
401
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
402
|
+
http_response = T.let(nil, T.nilable(Faraday::Response))
|
|
403
|
+
|
|
404
|
+
begin
|
|
405
|
+
http_response = T.must(connection).get(url) do |req|
|
|
406
|
+
req.headers.merge!(headers)
|
|
407
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
408
|
+
req.params = query_params
|
|
409
|
+
Utils.configure_request_security(req, security)
|
|
410
|
+
http_headers&.each do |key, value|
|
|
411
|
+
req.headers[key.to_s] = value
|
|
412
|
+
end
|
|
413
|
+
|
|
414
|
+
@sdk_configuration.hooks.before_request(
|
|
415
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
416
|
+
hook_ctx: hook_ctx
|
|
417
|
+
),
|
|
418
|
+
request: req
|
|
419
|
+
)
|
|
420
|
+
end
|
|
421
|
+
|
|
422
|
+
rescue StandardError => e
|
|
423
|
+
error = e
|
|
424
|
+
ensure
|
|
425
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
|
426
|
+
http_response = @sdk_configuration.hooks.after_error(
|
|
427
|
+
error: error,
|
|
428
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
429
|
+
hook_ctx: hook_ctx
|
|
430
|
+
),
|
|
431
|
+
response: http_response
|
|
432
|
+
)
|
|
433
|
+
else
|
|
434
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
435
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
436
|
+
hook_ctx: hook_ctx
|
|
437
|
+
),
|
|
438
|
+
response: http_response
|
|
439
|
+
)
|
|
440
|
+
end
|
|
441
|
+
|
|
442
|
+
if http_response.nil?
|
|
443
|
+
raise error if !error.nil?
|
|
444
|
+
raise "no response"
|
|
445
|
+
end
|
|
446
|
+
end
|
|
447
|
+
|
|
448
|
+
content_type = http_response.headers.fetch("Content-Type", "application/octet-stream")
|
|
449
|
+
if Utils.match_status_code(http_response.status, ["200"])
|
|
450
|
+
if Utils.match_content_type(content_type, "application/json")
|
|
451
|
+
@sdk_configuration.hooks.after_success(
|
|
452
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
453
|
+
hook_ctx: hook_ctx
|
|
454
|
+
),
|
|
455
|
+
response: http_response
|
|
456
|
+
)
|
|
457
|
+
response_data = http_response.env.response_body
|
|
458
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Shared::AssessmentList)
|
|
459
|
+
result = obj
|
|
460
|
+
response = Models::Operations::ListAccountAssessmentsResponse.new(
|
|
461
|
+
result: result,
|
|
462
|
+
headers: http_response.headers
|
|
463
|
+
)
|
|
464
|
+
sdk = self
|
|
465
|
+
|
|
466
|
+
response.next_page = proc do
|
|
467
|
+
next_cursor = Janeway.enum_for("$.next_cursor", JSON.parse(response_data)).search
|
|
468
|
+
if next_cursor.nil?
|
|
469
|
+
next nil
|
|
470
|
+
else
|
|
471
|
+
next_cursor = next_cursor[0]
|
|
472
|
+
if next_cursor.nil?
|
|
473
|
+
next nil
|
|
474
|
+
end
|
|
475
|
+
end
|
|
476
|
+
|
|
477
|
+
sdk.list_assessments(
|
|
478
|
+
account_id: request.account_id,
|
|
479
|
+
limit: request.limit,
|
|
480
|
+
cursor: next_cursor,
|
|
481
|
+
response_mode: request.response_mode,
|
|
482
|
+
http_headers: http_headers
|
|
483
|
+
)
|
|
484
|
+
end
|
|
485
|
+
|
|
486
|
+
return response
|
|
487
|
+
else
|
|
488
|
+
raise(
|
|
489
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
490
|
+
status_code: http_response.status,
|
|
491
|
+
body: http_response.env.response_body,
|
|
492
|
+
raw_response: http_response
|
|
493
|
+
),
|
|
494
|
+
"Unknown content type received"
|
|
495
|
+
)
|
|
496
|
+
end
|
|
497
|
+
elsif Utils.match_status_code(http_response.status, ["400"])
|
|
498
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
499
|
+
@sdk_configuration.hooks.after_success(
|
|
500
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
501
|
+
hook_ctx: hook_ctx
|
|
502
|
+
),
|
|
503
|
+
response: http_response
|
|
504
|
+
)
|
|
505
|
+
response_data = http_response.env.response_body
|
|
506
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::BadRequestError)
|
|
507
|
+
raise obj
|
|
508
|
+
else
|
|
509
|
+
raise(
|
|
510
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
511
|
+
status_code: http_response.status,
|
|
512
|
+
body: http_response.env.response_body,
|
|
513
|
+
raw_response: http_response
|
|
514
|
+
),
|
|
515
|
+
"Unknown content type received"
|
|
516
|
+
)
|
|
517
|
+
end
|
|
518
|
+
elsif Utils.match_status_code(http_response.status, ["401"])
|
|
519
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
520
|
+
@sdk_configuration.hooks.after_success(
|
|
521
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
522
|
+
hook_ctx: hook_ctx
|
|
523
|
+
),
|
|
524
|
+
response: http_response
|
|
525
|
+
)
|
|
526
|
+
response_data = http_response.env.response_body
|
|
527
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::AuthenticationError)
|
|
528
|
+
raise obj
|
|
529
|
+
else
|
|
530
|
+
raise(
|
|
531
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
532
|
+
status_code: http_response.status,
|
|
533
|
+
body: http_response.env.response_body,
|
|
534
|
+
raw_response: http_response
|
|
535
|
+
),
|
|
536
|
+
"Unknown content type received"
|
|
537
|
+
)
|
|
538
|
+
end
|
|
539
|
+
elsif Utils.match_status_code(http_response.status, ["403"])
|
|
540
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
541
|
+
@sdk_configuration.hooks.after_success(
|
|
542
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
543
|
+
hook_ctx: hook_ctx
|
|
544
|
+
),
|
|
545
|
+
response: http_response
|
|
546
|
+
)
|
|
547
|
+
response_data = http_response.env.response_body
|
|
548
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::PermissionDeniedError)
|
|
549
|
+
raise obj
|
|
550
|
+
else
|
|
551
|
+
raise(
|
|
552
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
553
|
+
status_code: http_response.status,
|
|
554
|
+
body: http_response.env.response_body,
|
|
555
|
+
raw_response: http_response
|
|
556
|
+
),
|
|
557
|
+
"Unknown content type received"
|
|
558
|
+
)
|
|
559
|
+
end
|
|
560
|
+
elsif Utils.match_status_code(http_response.status, ["404"])
|
|
561
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
562
|
+
@sdk_configuration.hooks.after_success(
|
|
563
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
564
|
+
hook_ctx: hook_ctx
|
|
565
|
+
),
|
|
566
|
+
response: http_response
|
|
567
|
+
)
|
|
568
|
+
response_data = http_response.env.response_body
|
|
569
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::NotFoundError)
|
|
570
|
+
raise obj
|
|
571
|
+
else
|
|
572
|
+
raise(
|
|
573
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
574
|
+
status_code: http_response.status,
|
|
575
|
+
body: http_response.env.response_body,
|
|
576
|
+
raw_response: http_response
|
|
577
|
+
),
|
|
578
|
+
"Unknown content type received"
|
|
579
|
+
)
|
|
580
|
+
end
|
|
581
|
+
elsif Utils.match_status_code(http_response.status, ["409"])
|
|
582
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
583
|
+
@sdk_configuration.hooks.after_success(
|
|
584
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
585
|
+
hook_ctx: hook_ctx
|
|
586
|
+
),
|
|
587
|
+
response: http_response
|
|
588
|
+
)
|
|
589
|
+
response_data = http_response.env.response_body
|
|
590
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::ConflictError)
|
|
591
|
+
raise obj
|
|
592
|
+
else
|
|
593
|
+
raise(
|
|
594
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
595
|
+
status_code: http_response.status,
|
|
596
|
+
body: http_response.env.response_body,
|
|
597
|
+
raw_response: http_response
|
|
598
|
+
),
|
|
599
|
+
"Unknown content type received"
|
|
600
|
+
)
|
|
601
|
+
end
|
|
602
|
+
elsif Utils.match_status_code(http_response.status, ["429"])
|
|
603
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
604
|
+
@sdk_configuration.hooks.after_success(
|
|
605
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
606
|
+
hook_ctx: hook_ctx
|
|
607
|
+
),
|
|
608
|
+
response: http_response
|
|
609
|
+
)
|
|
610
|
+
response_data = http_response.env.response_body
|
|
611
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::RateLimitError)
|
|
612
|
+
raise obj
|
|
613
|
+
else
|
|
614
|
+
raise(
|
|
615
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
616
|
+
status_code: http_response.status,
|
|
617
|
+
body: http_response.env.response_body,
|
|
618
|
+
raw_response: http_response
|
|
619
|
+
),
|
|
620
|
+
"Unknown content type received"
|
|
621
|
+
)
|
|
622
|
+
end
|
|
623
|
+
elsif Utils.match_status_code(http_response.status, ["4XX"])
|
|
624
|
+
raise(
|
|
625
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
626
|
+
status_code: http_response.status,
|
|
627
|
+
body: http_response.env.response_body,
|
|
628
|
+
raw_response: http_response
|
|
629
|
+
),
|
|
630
|
+
"API error occurred"
|
|
631
|
+
)
|
|
632
|
+
elsif Utils.match_status_code(http_response.status, ["5XX"])
|
|
633
|
+
raise(
|
|
634
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
635
|
+
status_code: http_response.status,
|
|
636
|
+
body: http_response.env.response_body,
|
|
637
|
+
raw_response: http_response
|
|
638
|
+
),
|
|
639
|
+
"API error occurred"
|
|
640
|
+
)
|
|
641
|
+
else
|
|
642
|
+
raise(
|
|
643
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
644
|
+
status_code: http_response.status,
|
|
645
|
+
body: http_response.env.response_body,
|
|
646
|
+
raw_response: http_response
|
|
647
|
+
),
|
|
648
|
+
"Unknown status code received"
|
|
649
|
+
)
|
|
650
|
+
|
|
651
|
+
end
|
|
652
|
+
end
|
|
653
|
+
end
|
|
654
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module NoResponse
|
|
5
|
+
module Models
|
|
6
|
+
module Operations
|
|
7
|
+
|
|
8
|
+
class GetAccountRequest
|
|
9
|
+
extend T::Sig
|
|
10
|
+
include Crystalline::MetadataFields
|
|
11
|
+
|
|
12
|
+
# The account_id the tenant sends with its assessments, as one path segment (percent-encode '|' and ':' if the client requires it). A value that does not match the account_id shape answers 400 invalid_request.
|
|
13
|
+
field :account_id, ::String, {'path_param': {'field_name': "account_id", 'style': "simple", 'explode': false}}
|
|
14
|
+
|
|
15
|
+
sig { params(account_id: ::String).void }
|
|
16
|
+
def initialize(account_id:)
|
|
17
|
+
@account_id = account_id
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
sig { params(other: T.untyped).returns(T::Boolean) }
|
|
21
|
+
def ==(other)
|
|
22
|
+
return false unless other.is_a?(self.class)
|
|
23
|
+
return false unless @account_id == other.account_id
|
|
24
|
+
true
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|