noresponse 5.1.1 → 6.0.1
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 +663 -71
- data/lib/no_response/late_results.rb +10 -8
- data/lib/no_response/models/operations/listaccounts_request.rb +52 -0
- data/lib/no_response/models/operations/listaccounts_request.rbi +26 -0
- data/lib/no_response/models/operations/listaccounts_response.rb +32 -0
- data/lib/no_response/models/operations/listaccounts_response.rbi +20 -0
- data/lib/no_response/models/operations/recordenforcement_request.rb +33 -0
- data/lib/no_response/models/operations/recordenforcement_request.rbi +20 -0
- data/lib/no_response/models/operations/recordenforcement_response.rb +32 -0
- data/lib/no_response/models/operations/recordenforcement_response.rbi +20 -0
- data/lib/no_response/models/operations.rb +4 -0
- data/lib/no_response/models/shared/accountdeleted.rb +49 -0
- data/lib/no_response/models/shared/accountdeleted.rbi +26 -0
- data/lib/no_response/models/shared/accountdeletedevent.rb +70 -0
- data/lib/no_response/models/shared/accountdeletedevent.rbi +38 -0
- data/lib/no_response/models/shared/accountlist.rb +40 -0
- data/lib/no_response/models/shared/accountlist.rbi +20 -0
- data/lib/no_response/models/shared/accountriskchanged.rb +44 -0
- data/lib/no_response/models/shared/accountriskchanged.rbi +20 -0
- data/lib/no_response/models/shared/accountriskchangedevent.rb +70 -0
- data/lib/no_response/models/shared/accountriskchangedevent.rbi +38 -0
- data/lib/no_response/models/shared/assessmentexpired.rb +82 -0
- data/lib/no_response/models/shared/assessmentexpired.rbi +38 -0
- data/lib/no_response/models/shared/assessmentupdateddata.rb +23 -0
- data/lib/no_response/models/shared/assessmentupdateddata.rbi +9 -0
- data/lib/no_response/models/shared/assessmentupdatedevent.rb +79 -0
- data/lib/no_response/models/shared/assessmentupdatedevent.rbi +38 -0
- data/lib/no_response/models/shared/conflicterrorcode.rb +1 -0
- data/lib/no_response/models/shared/endpointverification.rb +41 -0
- data/lib/no_response/models/shared/endpointverification.rbi +20 -0
- data/lib/no_response/models/shared/endpointverificationevent.rb +70 -0
- data/lib/no_response/models/shared/endpointverificationevent.rbi +38 -0
- data/lib/no_response/models/shared/enforcement.rb +156 -0
- data/lib/no_response/models/shared/enforcement.rbi +68 -0
- data/lib/no_response/models/shared/enforcementaction.rb +23 -0
- data/lib/no_response/models/shared/enforcementaction.rbi +9 -0
- data/lib/no_response/models/shared/enforcementprovider.rb +21 -0
- data/lib/no_response/models/shared/enforcementprovider.rbi +9 -0
- data/lib/no_response/models/shared/enforcementrequest.rb +122 -0
- data/lib/no_response/models/shared/enforcementrequest.rbi +50 -0
- data/lib/no_response/models/shared/enforcementstate.rb +22 -0
- data/lib/no_response/models/shared/enforcementstate.rbi +9 -0
- data/lib/no_response/models/shared/enforcementstatus.rb +19 -0
- data/lib/no_response/models/shared/enforcementstatus.rbi +9 -0
- data/lib/no_response/models/shared/environment.rb +16 -0
- data/lib/no_response/models/shared/environment.rbi +9 -0
- data/lib/no_response/models/shared/webhookendpointdisabled.rb +49 -0
- data/lib/no_response/models/shared/webhookendpointdisabled.rbi +26 -0
- data/lib/no_response/models/shared/webhookendpointdisabledevent.rb +70 -0
- data/lib/no_response/models/shared/webhookendpointdisabledevent.rbi +38 -0
- data/lib/no_response/models/shared/webhookevent.rb +23 -0
- data/lib/no_response/models/shared/webhookevent.rbi +9 -0
- data/lib/no_response/models/shared/webhookverificationresponse.rb +33 -0
- data/lib/no_response/models/shared/webhookverificationresponse.rbi +14 -0
- data/lib/no_response/models/shared/workspacedeleted.rb +55 -0
- data/lib/no_response/models/shared/workspacedeleted.rbi +26 -0
- data/lib/no_response/models/shared/workspacedeletedevent.rb +70 -0
- data/lib/no_response/models/shared/workspacedeletedevent.rbi +38 -0
- data/lib/no_response/models/shared.rb +23 -0
- data/lib/no_response/sdk_hooks/registration.rb +0 -1
- data/lib/no_response/sdkconfiguration.rb +2 -2
- data/lib/no_response/webhook_verification.rb +170 -0
- data/lib/noresponse.rb +2 -0
- metadata +56 -2
- data/lib/no_response/webhooks.rb +0 -264
data/lib/no_response/accounts.rb
CHANGED
|
@@ -38,6 +38,583 @@ module NoResponse
|
|
|
38
38
|
return Utils.template_url(base_url, url_variables)
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
+
sig {
|
|
42
|
+
params(
|
|
43
|
+
changed_since: T.nilable(::String),
|
|
44
|
+
limit: T.nilable(::Integer),
|
|
45
|
+
unenforced: T.nilable(T::Boolean),
|
|
46
|
+
retries: T.nilable(Utils::RetryConfig),
|
|
47
|
+
timeout_ms: T.nilable(Integer),
|
|
48
|
+
http_headers: T.nilable(T::Hash[T.any(String, Symbol), String])
|
|
49
|
+
)
|
|
50
|
+
.returns(Models::Operations::ListAccountsResponse)
|
|
51
|
+
}
|
|
52
|
+
def list_changed(changed_since: nil, limit: nil, unenforced: nil, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
53
|
+
# list_changed - Poll the accounts whose risk changed.
|
|
54
|
+
# Your accounts whose risk changed, oldest change first, each as accounts.get answers it. Every page carries next_cursor: pass it back as changed_since to read the changes made after that page; without changed_since the list starts from the oldest change. When nothing changed, items is empty and next_cursor is the cursor you sent, so poll by calling again with the latest next_cursor. An account appears again each time its risk changes, with a higher risk_version; keep the copy with the highest. unenforced=true lists only accounts with a decision other than allow for some flow and no applied enforcement at their current risk_version; such a page can hold fewer than limit items, or none, while later changes exist, so keep polling with next_cursor. Requires the history scope. Read-only and safe to retry. A tampered or foreign cursor answers 400 invalid_cursor.
|
|
55
|
+
request = Models::Operations::ListAccountsRequest.new(
|
|
56
|
+
changed_since: changed_since,
|
|
57
|
+
limit: limit,
|
|
58
|
+
unenforced: unenforced
|
|
59
|
+
)
|
|
60
|
+
url, params = @sdk_configuration.get_server_details
|
|
61
|
+
base_url = Utils.template_url(url, params)
|
|
62
|
+
url = "#{base_url}/v1/accounts"
|
|
63
|
+
headers = {}
|
|
64
|
+
headers = T.cast(headers, T::Hash[String, String])
|
|
65
|
+
query_params = Utils.get_query_params(Models::Operations::ListAccountsRequest, request, nil)
|
|
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: "listAccounts",
|
|
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
|
+
req.params = query_params
|
|
106
|
+
Utils.configure_request_security(req, security)
|
|
107
|
+
http_headers&.each do |key, value|
|
|
108
|
+
req.headers[key.to_s] = value
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
@sdk_configuration.hooks.before_request(
|
|
112
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
113
|
+
hook_ctx: hook_ctx
|
|
114
|
+
),
|
|
115
|
+
request: req
|
|
116
|
+
)
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
rescue StandardError => e
|
|
120
|
+
error = e
|
|
121
|
+
ensure
|
|
122
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
|
123
|
+
http_response = @sdk_configuration.hooks.after_error(
|
|
124
|
+
error: error,
|
|
125
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
126
|
+
hook_ctx: hook_ctx
|
|
127
|
+
),
|
|
128
|
+
response: http_response
|
|
129
|
+
)
|
|
130
|
+
else
|
|
131
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
132
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
133
|
+
hook_ctx: hook_ctx
|
|
134
|
+
),
|
|
135
|
+
response: http_response
|
|
136
|
+
)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
if http_response.nil?
|
|
140
|
+
raise error if !error.nil?
|
|
141
|
+
raise "no response"
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
content_type = http_response.headers.fetch("Content-Type", "application/octet-stream")
|
|
146
|
+
if Utils.match_status_code(http_response.status, ["200"])
|
|
147
|
+
if Utils.match_content_type(content_type, "application/json")
|
|
148
|
+
@sdk_configuration.hooks.after_success(
|
|
149
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
150
|
+
hook_ctx: hook_ctx
|
|
151
|
+
),
|
|
152
|
+
response: http_response
|
|
153
|
+
)
|
|
154
|
+
response_data = http_response.env.response_body
|
|
155
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Shared::AccountList)
|
|
156
|
+
result = obj
|
|
157
|
+
response = Models::Operations::ListAccountsResponse.new(
|
|
158
|
+
result: result,
|
|
159
|
+
headers: http_response.headers
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
return response
|
|
163
|
+
else
|
|
164
|
+
raise(
|
|
165
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
166
|
+
status_code: http_response.status,
|
|
167
|
+
body: http_response.env.response_body,
|
|
168
|
+
raw_response: http_response
|
|
169
|
+
),
|
|
170
|
+
"Unknown content type received"
|
|
171
|
+
)
|
|
172
|
+
end
|
|
173
|
+
elsif Utils.match_status_code(http_response.status, ["400"])
|
|
174
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
175
|
+
@sdk_configuration.hooks.after_success(
|
|
176
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
177
|
+
hook_ctx: hook_ctx
|
|
178
|
+
),
|
|
179
|
+
response: http_response
|
|
180
|
+
)
|
|
181
|
+
response_data = http_response.env.response_body
|
|
182
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::BadRequestError)
|
|
183
|
+
raise obj
|
|
184
|
+
else
|
|
185
|
+
raise(
|
|
186
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
187
|
+
status_code: http_response.status,
|
|
188
|
+
body: http_response.env.response_body,
|
|
189
|
+
raw_response: http_response
|
|
190
|
+
),
|
|
191
|
+
"Unknown content type received"
|
|
192
|
+
)
|
|
193
|
+
end
|
|
194
|
+
elsif Utils.match_status_code(http_response.status, ["401"])
|
|
195
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
196
|
+
@sdk_configuration.hooks.after_success(
|
|
197
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
198
|
+
hook_ctx: hook_ctx
|
|
199
|
+
),
|
|
200
|
+
response: http_response
|
|
201
|
+
)
|
|
202
|
+
response_data = http_response.env.response_body
|
|
203
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::AuthenticationError)
|
|
204
|
+
raise obj
|
|
205
|
+
else
|
|
206
|
+
raise(
|
|
207
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
208
|
+
status_code: http_response.status,
|
|
209
|
+
body: http_response.env.response_body,
|
|
210
|
+
raw_response: http_response
|
|
211
|
+
),
|
|
212
|
+
"Unknown content type received"
|
|
213
|
+
)
|
|
214
|
+
end
|
|
215
|
+
elsif Utils.match_status_code(http_response.status, ["403"])
|
|
216
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
217
|
+
@sdk_configuration.hooks.after_success(
|
|
218
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
219
|
+
hook_ctx: hook_ctx
|
|
220
|
+
),
|
|
221
|
+
response: http_response
|
|
222
|
+
)
|
|
223
|
+
response_data = http_response.env.response_body
|
|
224
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::PermissionDeniedError)
|
|
225
|
+
raise obj
|
|
226
|
+
else
|
|
227
|
+
raise(
|
|
228
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
229
|
+
status_code: http_response.status,
|
|
230
|
+
body: http_response.env.response_body,
|
|
231
|
+
raw_response: http_response
|
|
232
|
+
),
|
|
233
|
+
"Unknown content type received"
|
|
234
|
+
)
|
|
235
|
+
end
|
|
236
|
+
elsif Utils.match_status_code(http_response.status, ["404"])
|
|
237
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
238
|
+
@sdk_configuration.hooks.after_success(
|
|
239
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
240
|
+
hook_ctx: hook_ctx
|
|
241
|
+
),
|
|
242
|
+
response: http_response
|
|
243
|
+
)
|
|
244
|
+
response_data = http_response.env.response_body
|
|
245
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::NotFoundError)
|
|
246
|
+
raise obj
|
|
247
|
+
else
|
|
248
|
+
raise(
|
|
249
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
250
|
+
status_code: http_response.status,
|
|
251
|
+
body: http_response.env.response_body,
|
|
252
|
+
raw_response: http_response
|
|
253
|
+
),
|
|
254
|
+
"Unknown content type received"
|
|
255
|
+
)
|
|
256
|
+
end
|
|
257
|
+
elsif Utils.match_status_code(http_response.status, ["409"])
|
|
258
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
259
|
+
@sdk_configuration.hooks.after_success(
|
|
260
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
261
|
+
hook_ctx: hook_ctx
|
|
262
|
+
),
|
|
263
|
+
response: http_response
|
|
264
|
+
)
|
|
265
|
+
response_data = http_response.env.response_body
|
|
266
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::ConflictError)
|
|
267
|
+
raise obj
|
|
268
|
+
else
|
|
269
|
+
raise(
|
|
270
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
271
|
+
status_code: http_response.status,
|
|
272
|
+
body: http_response.env.response_body,
|
|
273
|
+
raw_response: http_response
|
|
274
|
+
),
|
|
275
|
+
"Unknown content type received"
|
|
276
|
+
)
|
|
277
|
+
end
|
|
278
|
+
elsif Utils.match_status_code(http_response.status, ["429"])
|
|
279
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
280
|
+
@sdk_configuration.hooks.after_success(
|
|
281
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
282
|
+
hook_ctx: hook_ctx
|
|
283
|
+
),
|
|
284
|
+
response: http_response
|
|
285
|
+
)
|
|
286
|
+
response_data = http_response.env.response_body
|
|
287
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::RateLimitError)
|
|
288
|
+
raise obj
|
|
289
|
+
else
|
|
290
|
+
raise(
|
|
291
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
292
|
+
status_code: http_response.status,
|
|
293
|
+
body: http_response.env.response_body,
|
|
294
|
+
raw_response: http_response
|
|
295
|
+
),
|
|
296
|
+
"Unknown content type received"
|
|
297
|
+
)
|
|
298
|
+
end
|
|
299
|
+
elsif Utils.match_status_code(http_response.status, ["4XX"])
|
|
300
|
+
raise(
|
|
301
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
302
|
+
status_code: http_response.status,
|
|
303
|
+
body: http_response.env.response_body,
|
|
304
|
+
raw_response: http_response
|
|
305
|
+
),
|
|
306
|
+
"API error occurred"
|
|
307
|
+
)
|
|
308
|
+
elsif Utils.match_status_code(http_response.status, ["5XX"])
|
|
309
|
+
raise(
|
|
310
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
311
|
+
status_code: http_response.status,
|
|
312
|
+
body: http_response.env.response_body,
|
|
313
|
+
raw_response: http_response
|
|
314
|
+
),
|
|
315
|
+
"API error occurred"
|
|
316
|
+
)
|
|
317
|
+
else
|
|
318
|
+
raise(
|
|
319
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
320
|
+
status_code: http_response.status,
|
|
321
|
+
body: http_response.env.response_body,
|
|
322
|
+
raw_response: http_response
|
|
323
|
+
),
|
|
324
|
+
"Unknown status code received"
|
|
325
|
+
)
|
|
326
|
+
|
|
327
|
+
end
|
|
328
|
+
end
|
|
329
|
+
|
|
330
|
+
sig {
|
|
331
|
+
params(
|
|
332
|
+
account_id: ::String,
|
|
333
|
+
retries: T.nilable(Utils::RetryConfig),
|
|
334
|
+
timeout_ms: T.nilable(Integer),
|
|
335
|
+
http_headers: T.nilable(T::Hash[T.any(String, Symbol), String])
|
|
336
|
+
)
|
|
337
|
+
.returns(Models::Operations::GetAccountResponse)
|
|
338
|
+
}
|
|
339
|
+
def get(account_id:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
340
|
+
# get - Read an account's one current risk.
|
|
341
|
+
# 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; risk.decision is the decision for the flow of that assessment. Every assessment answers with this same account. 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.
|
|
342
|
+
request = Models::Operations::GetAccountRequest.new(
|
|
343
|
+
account_id: account_id
|
|
344
|
+
)
|
|
345
|
+
url, params = @sdk_configuration.get_server_details
|
|
346
|
+
base_url = Utils.template_url(url, params)
|
|
347
|
+
url = Utils.generate_url(
|
|
348
|
+
Models::Operations::GetAccountRequest,
|
|
349
|
+
base_url,
|
|
350
|
+
"/v1/accounts/{account_id}",
|
|
351
|
+
request
|
|
352
|
+
)
|
|
353
|
+
headers = {}
|
|
354
|
+
headers = T.cast(headers, T::Hash[String, String])
|
|
355
|
+
headers["Accept"] = "application/json"
|
|
356
|
+
headers["user-agent"] = @sdk_configuration.user_agent
|
|
357
|
+
retries ||= @sdk_configuration.retry_config
|
|
358
|
+
retries ||= Utils::RetryConfig.new(
|
|
359
|
+
backoff: Utils::BackoffStrategy.new(
|
|
360
|
+
exponent: 2.0,
|
|
361
|
+
initial_interval: 500,
|
|
362
|
+
max_elapsed_time: 30_000,
|
|
363
|
+
max_interval: 8000
|
|
364
|
+
),
|
|
365
|
+
retry_connection_errors: true,
|
|
366
|
+
strategy: "backoff"
|
|
367
|
+
)
|
|
368
|
+
retry_options = retries.to_faraday_retry_options(initial_time: Time.now)
|
|
369
|
+
retry_options[:retry_statuses] = [408, 429, 500, 501, 502, 503, 504, 505]
|
|
370
|
+
|
|
371
|
+
security = @sdk_configuration.security_source&.call
|
|
372
|
+
|
|
373
|
+
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
374
|
+
timeout ||= @sdk_configuration.timeout
|
|
375
|
+
|
|
376
|
+
connection = @sdk_configuration.client.dup
|
|
377
|
+
connection.use(Utils::RetryMiddleware, retry_options)
|
|
378
|
+
|
|
379
|
+
hook_ctx = SDKHooks::HookContext.new(
|
|
380
|
+
config: @sdk_configuration,
|
|
381
|
+
base_url: base_url,
|
|
382
|
+
oauth2_scopes: nil,
|
|
383
|
+
operation_id: "getAccount",
|
|
384
|
+
security_source: @sdk_configuration.security_source
|
|
385
|
+
)
|
|
386
|
+
|
|
387
|
+
error = T.let(nil, T.nilable(StandardError))
|
|
388
|
+
http_response = T.let(nil, T.nilable(Faraday::Response))
|
|
389
|
+
|
|
390
|
+
begin
|
|
391
|
+
http_response = T.must(connection).get(url) do |req|
|
|
392
|
+
req.headers.merge!(headers)
|
|
393
|
+
req.options.timeout = timeout unless timeout.nil?
|
|
394
|
+
Utils.configure_request_security(req, security)
|
|
395
|
+
http_headers&.each do |key, value|
|
|
396
|
+
req.headers[key.to_s] = value
|
|
397
|
+
end
|
|
398
|
+
|
|
399
|
+
@sdk_configuration.hooks.before_request(
|
|
400
|
+
hook_ctx: SDKHooks::BeforeRequestHookContext.new(
|
|
401
|
+
hook_ctx: hook_ctx
|
|
402
|
+
),
|
|
403
|
+
request: req
|
|
404
|
+
)
|
|
405
|
+
end
|
|
406
|
+
|
|
407
|
+
rescue StandardError => e
|
|
408
|
+
error = e
|
|
409
|
+
ensure
|
|
410
|
+
if http_response.nil? || Utils.error_status?(http_response.status)
|
|
411
|
+
http_response = @sdk_configuration.hooks.after_error(
|
|
412
|
+
error: error,
|
|
413
|
+
hook_ctx: SDKHooks::AfterErrorHookContext.new(
|
|
414
|
+
hook_ctx: hook_ctx
|
|
415
|
+
),
|
|
416
|
+
response: http_response
|
|
417
|
+
)
|
|
418
|
+
else
|
|
419
|
+
http_response = @sdk_configuration.hooks.after_success(
|
|
420
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
421
|
+
hook_ctx: hook_ctx
|
|
422
|
+
),
|
|
423
|
+
response: http_response
|
|
424
|
+
)
|
|
425
|
+
end
|
|
426
|
+
|
|
427
|
+
if http_response.nil?
|
|
428
|
+
raise error if !error.nil?
|
|
429
|
+
raise "no response"
|
|
430
|
+
end
|
|
431
|
+
end
|
|
432
|
+
|
|
433
|
+
content_type = http_response.headers.fetch("Content-Type", "application/octet-stream")
|
|
434
|
+
if Utils.match_status_code(http_response.status, ["200"])
|
|
435
|
+
if Utils.match_content_type(content_type, "application/json")
|
|
436
|
+
@sdk_configuration.hooks.after_success(
|
|
437
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
438
|
+
hook_ctx: hook_ctx
|
|
439
|
+
),
|
|
440
|
+
response: http_response
|
|
441
|
+
)
|
|
442
|
+
response_data = http_response.env.response_body
|
|
443
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Shared::Account)
|
|
444
|
+
result = obj
|
|
445
|
+
response = Models::Operations::GetAccountResponse.new(
|
|
446
|
+
result: result,
|
|
447
|
+
headers: http_response.headers
|
|
448
|
+
)
|
|
449
|
+
|
|
450
|
+
return response
|
|
451
|
+
else
|
|
452
|
+
raise(
|
|
453
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
454
|
+
status_code: http_response.status,
|
|
455
|
+
body: http_response.env.response_body,
|
|
456
|
+
raw_response: http_response
|
|
457
|
+
),
|
|
458
|
+
"Unknown content type received"
|
|
459
|
+
)
|
|
460
|
+
end
|
|
461
|
+
elsif Utils.match_status_code(http_response.status, ["400"])
|
|
462
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
463
|
+
@sdk_configuration.hooks.after_success(
|
|
464
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
465
|
+
hook_ctx: hook_ctx
|
|
466
|
+
),
|
|
467
|
+
response: http_response
|
|
468
|
+
)
|
|
469
|
+
response_data = http_response.env.response_body
|
|
470
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::BadRequestError)
|
|
471
|
+
raise obj
|
|
472
|
+
else
|
|
473
|
+
raise(
|
|
474
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
475
|
+
status_code: http_response.status,
|
|
476
|
+
body: http_response.env.response_body,
|
|
477
|
+
raw_response: http_response
|
|
478
|
+
),
|
|
479
|
+
"Unknown content type received"
|
|
480
|
+
)
|
|
481
|
+
end
|
|
482
|
+
elsif Utils.match_status_code(http_response.status, ["401"])
|
|
483
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
484
|
+
@sdk_configuration.hooks.after_success(
|
|
485
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
486
|
+
hook_ctx: hook_ctx
|
|
487
|
+
),
|
|
488
|
+
response: http_response
|
|
489
|
+
)
|
|
490
|
+
response_data = http_response.env.response_body
|
|
491
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::AuthenticationError)
|
|
492
|
+
raise obj
|
|
493
|
+
else
|
|
494
|
+
raise(
|
|
495
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
496
|
+
status_code: http_response.status,
|
|
497
|
+
body: http_response.env.response_body,
|
|
498
|
+
raw_response: http_response
|
|
499
|
+
),
|
|
500
|
+
"Unknown content type received"
|
|
501
|
+
)
|
|
502
|
+
end
|
|
503
|
+
elsif Utils.match_status_code(http_response.status, ["403"])
|
|
504
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
505
|
+
@sdk_configuration.hooks.after_success(
|
|
506
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
507
|
+
hook_ctx: hook_ctx
|
|
508
|
+
),
|
|
509
|
+
response: http_response
|
|
510
|
+
)
|
|
511
|
+
response_data = http_response.env.response_body
|
|
512
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::PermissionDeniedError)
|
|
513
|
+
raise obj
|
|
514
|
+
else
|
|
515
|
+
raise(
|
|
516
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
517
|
+
status_code: http_response.status,
|
|
518
|
+
body: http_response.env.response_body,
|
|
519
|
+
raw_response: http_response
|
|
520
|
+
),
|
|
521
|
+
"Unknown content type received"
|
|
522
|
+
)
|
|
523
|
+
end
|
|
524
|
+
elsif Utils.match_status_code(http_response.status, ["404"])
|
|
525
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
526
|
+
@sdk_configuration.hooks.after_success(
|
|
527
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
528
|
+
hook_ctx: hook_ctx
|
|
529
|
+
),
|
|
530
|
+
response: http_response
|
|
531
|
+
)
|
|
532
|
+
response_data = http_response.env.response_body
|
|
533
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::NotFoundError)
|
|
534
|
+
raise obj
|
|
535
|
+
else
|
|
536
|
+
raise(
|
|
537
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
538
|
+
status_code: http_response.status,
|
|
539
|
+
body: http_response.env.response_body,
|
|
540
|
+
raw_response: http_response
|
|
541
|
+
),
|
|
542
|
+
"Unknown content type received"
|
|
543
|
+
)
|
|
544
|
+
end
|
|
545
|
+
elsif Utils.match_status_code(http_response.status, ["409"])
|
|
546
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
547
|
+
@sdk_configuration.hooks.after_success(
|
|
548
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
549
|
+
hook_ctx: hook_ctx
|
|
550
|
+
),
|
|
551
|
+
response: http_response
|
|
552
|
+
)
|
|
553
|
+
response_data = http_response.env.response_body
|
|
554
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::ConflictError)
|
|
555
|
+
raise obj
|
|
556
|
+
else
|
|
557
|
+
raise(
|
|
558
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
559
|
+
status_code: http_response.status,
|
|
560
|
+
body: http_response.env.response_body,
|
|
561
|
+
raw_response: http_response
|
|
562
|
+
),
|
|
563
|
+
"Unknown content type received"
|
|
564
|
+
)
|
|
565
|
+
end
|
|
566
|
+
elsif Utils.match_status_code(http_response.status, ["429"])
|
|
567
|
+
if Utils.match_content_type(content_type, "application/problem+json")
|
|
568
|
+
@sdk_configuration.hooks.after_success(
|
|
569
|
+
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
570
|
+
hook_ctx: hook_ctx
|
|
571
|
+
),
|
|
572
|
+
response: http_response
|
|
573
|
+
)
|
|
574
|
+
response_data = http_response.env.response_body
|
|
575
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Errors::RateLimitError)
|
|
576
|
+
raise obj
|
|
577
|
+
else
|
|
578
|
+
raise(
|
|
579
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
580
|
+
status_code: http_response.status,
|
|
581
|
+
body: http_response.env.response_body,
|
|
582
|
+
raw_response: http_response
|
|
583
|
+
),
|
|
584
|
+
"Unknown content type received"
|
|
585
|
+
)
|
|
586
|
+
end
|
|
587
|
+
elsif Utils.match_status_code(http_response.status, ["4XX"])
|
|
588
|
+
raise(
|
|
589
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
590
|
+
status_code: http_response.status,
|
|
591
|
+
body: http_response.env.response_body,
|
|
592
|
+
raw_response: http_response
|
|
593
|
+
),
|
|
594
|
+
"API error occurred"
|
|
595
|
+
)
|
|
596
|
+
elsif Utils.match_status_code(http_response.status, ["5XX"])
|
|
597
|
+
raise(
|
|
598
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
599
|
+
status_code: http_response.status,
|
|
600
|
+
body: http_response.env.response_body,
|
|
601
|
+
raw_response: http_response
|
|
602
|
+
),
|
|
603
|
+
"API error occurred"
|
|
604
|
+
)
|
|
605
|
+
else
|
|
606
|
+
raise(
|
|
607
|
+
::NoResponse::Models::Errors::APIStatusError.new(
|
|
608
|
+
status_code: http_response.status,
|
|
609
|
+
body: http_response.env.response_body,
|
|
610
|
+
raw_response: http_response
|
|
611
|
+
),
|
|
612
|
+
"Unknown status code received"
|
|
613
|
+
)
|
|
614
|
+
|
|
615
|
+
end
|
|
616
|
+
end
|
|
617
|
+
|
|
41
618
|
sig {
|
|
42
619
|
params(
|
|
43
620
|
account_id: ::String,
|
|
@@ -45,18 +622,18 @@ module NoResponse
|
|
|
45
622
|
timeout_ms: T.nilable(Integer),
|
|
46
623
|
http_headers: T.nilable(T::Hash[T.any(String, Symbol), String])
|
|
47
624
|
)
|
|
48
|
-
.returns(Models::Operations::
|
|
625
|
+
.returns(Models::Operations::DeleteAccountResponse)
|
|
49
626
|
}
|
|
50
|
-
def
|
|
51
|
-
#
|
|
52
|
-
#
|
|
53
|
-
request = Models::Operations::
|
|
627
|
+
def delete(account_id:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
628
|
+
# delete - Erase an account and its history.
|
|
629
|
+
# Erases the account in the environment of your key, for an erasure request from your user: every assessment of it, with its revisions, evidence and outcomes, and the identity-graph marks its outcomes set. An assessment of the account begun before the call is refused or stopped. Afterwards the account and each erased assessment answer 404 and the history is empty. When the call deleted at least one assessment, an account.deleted event goes to your verified webhook endpoints. Requires the history scope. Idempotent and safe to retry: a repeat, or an account with nothing to erase, answers 200 with assessments_deleted 0 and sends no event. The account_id can be assessed again later, as a new account.
|
|
630
|
+
request = Models::Operations::DeleteAccountRequest.new(
|
|
54
631
|
account_id: account_id
|
|
55
632
|
)
|
|
56
633
|
url, params = @sdk_configuration.get_server_details
|
|
57
634
|
base_url = Utils.template_url(url, params)
|
|
58
635
|
url = Utils.generate_url(
|
|
59
|
-
Models::Operations::
|
|
636
|
+
Models::Operations::DeleteAccountRequest,
|
|
60
637
|
base_url,
|
|
61
638
|
"/v1/accounts/{account_id}",
|
|
62
639
|
request
|
|
@@ -91,7 +668,7 @@ module NoResponse
|
|
|
91
668
|
config: @sdk_configuration,
|
|
92
669
|
base_url: base_url,
|
|
93
670
|
oauth2_scopes: nil,
|
|
94
|
-
operation_id: "
|
|
671
|
+
operation_id: "deleteAccount",
|
|
95
672
|
security_source: @sdk_configuration.security_source
|
|
96
673
|
)
|
|
97
674
|
|
|
@@ -99,7 +676,7 @@ module NoResponse
|
|
|
99
676
|
http_response = T.let(nil, T.nilable(Faraday::Response))
|
|
100
677
|
|
|
101
678
|
begin
|
|
102
|
-
http_response = T.must(connection).
|
|
679
|
+
http_response = T.must(connection).delete(url) do |req|
|
|
103
680
|
req.headers.merge!(headers)
|
|
104
681
|
req.options.timeout = timeout unless timeout.nil?
|
|
105
682
|
Utils.configure_request_security(req, security)
|
|
@@ -151,9 +728,9 @@ module NoResponse
|
|
|
151
728
|
response: http_response
|
|
152
729
|
)
|
|
153
730
|
response_data = http_response.env.response_body
|
|
154
|
-
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Shared::
|
|
731
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Shared::AccountDeletion)
|
|
155
732
|
result = obj
|
|
156
|
-
response = Models::Operations::
|
|
733
|
+
response = Models::Operations::DeleteAccountResponse.new(
|
|
157
734
|
result: result,
|
|
158
735
|
headers: http_response.headers
|
|
159
736
|
)
|
|
@@ -329,28 +906,43 @@ module NoResponse
|
|
|
329
906
|
sig {
|
|
330
907
|
params(
|
|
331
908
|
account_id: ::String,
|
|
909
|
+
limit: T.nilable(::Integer),
|
|
910
|
+
cursor: T.nilable(::String),
|
|
911
|
+
response_mode: T.nilable(Models::Shared::ResponseMode),
|
|
332
912
|
retries: T.nilable(Utils::RetryConfig),
|
|
333
913
|
timeout_ms: T.nilable(Integer),
|
|
334
914
|
http_headers: T.nilable(T::Hash[T.any(String, Symbol), String])
|
|
335
915
|
)
|
|
336
|
-
.returns(Models::Operations::
|
|
916
|
+
.returns(Models::Operations::ListAccountAssessmentsResponse)
|
|
337
917
|
}
|
|
338
|
-
def
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
918
|
+
def list_assessments(
|
|
919
|
+
account_id:,
|
|
920
|
+
limit: nil,
|
|
921
|
+
cursor: nil,
|
|
922
|
+
response_mode: nil,
|
|
923
|
+
retries: nil,
|
|
924
|
+
timeout_ms: nil,
|
|
925
|
+
http_headers: nil
|
|
926
|
+
)
|
|
927
|
+
# list_assessments - Page through one account's unexpired assessments.
|
|
928
|
+
# 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 workspace 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.
|
|
929
|
+
request = Models::Operations::ListAccountAssessmentsRequest.new(
|
|
930
|
+
account_id: account_id,
|
|
931
|
+
limit: limit,
|
|
932
|
+
cursor: cursor,
|
|
933
|
+
response_mode: response_mode
|
|
343
934
|
)
|
|
344
935
|
url, params = @sdk_configuration.get_server_details
|
|
345
936
|
base_url = Utils.template_url(url, params)
|
|
346
937
|
url = Utils.generate_url(
|
|
347
|
-
Models::Operations::
|
|
938
|
+
Models::Operations::ListAccountAssessmentsRequest,
|
|
348
939
|
base_url,
|
|
349
|
-
"/v1/accounts/{account_id}",
|
|
940
|
+
"/v1/accounts/{account_id}/assessments",
|
|
350
941
|
request
|
|
351
942
|
)
|
|
352
943
|
headers = {}
|
|
353
944
|
headers = T.cast(headers, T::Hash[String, String])
|
|
945
|
+
query_params = Utils.get_query_params(Models::Operations::ListAccountAssessmentsRequest, request, nil)
|
|
354
946
|
headers["Accept"] = "application/json"
|
|
355
947
|
headers["user-agent"] = @sdk_configuration.user_agent
|
|
356
948
|
retries ||= @sdk_configuration.retry_config
|
|
@@ -379,7 +971,7 @@ module NoResponse
|
|
|
379
971
|
config: @sdk_configuration,
|
|
380
972
|
base_url: base_url,
|
|
381
973
|
oauth2_scopes: nil,
|
|
382
|
-
operation_id: "
|
|
974
|
+
operation_id: "listAccountAssessments",
|
|
383
975
|
security_source: @sdk_configuration.security_source
|
|
384
976
|
)
|
|
385
977
|
|
|
@@ -387,9 +979,10 @@ module NoResponse
|
|
|
387
979
|
http_response = T.let(nil, T.nilable(Faraday::Response))
|
|
388
980
|
|
|
389
981
|
begin
|
|
390
|
-
http_response = T.must(connection).
|
|
982
|
+
http_response = T.must(connection).get(url) do |req|
|
|
391
983
|
req.headers.merge!(headers)
|
|
392
984
|
req.options.timeout = timeout unless timeout.nil?
|
|
985
|
+
req.params = query_params
|
|
393
986
|
Utils.configure_request_security(req, security)
|
|
394
987
|
http_headers&.each do |key, value|
|
|
395
988
|
req.headers[key.to_s] = value
|
|
@@ -439,12 +1032,33 @@ module NoResponse
|
|
|
439
1032
|
response: http_response
|
|
440
1033
|
)
|
|
441
1034
|
response_data = http_response.env.response_body
|
|
442
|
-
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Shared::
|
|
1035
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Shared::AssessmentList)
|
|
443
1036
|
result = obj
|
|
444
|
-
response = Models::Operations::
|
|
1037
|
+
response = Models::Operations::ListAccountAssessmentsResponse.new(
|
|
445
1038
|
result: result,
|
|
446
1039
|
headers: http_response.headers
|
|
447
1040
|
)
|
|
1041
|
+
sdk = self
|
|
1042
|
+
|
|
1043
|
+
response.next_page = proc do
|
|
1044
|
+
next_cursor = Janeway.enum_for("$.next_cursor", JSON.parse(response_data)).search
|
|
1045
|
+
if next_cursor.nil?
|
|
1046
|
+
next nil
|
|
1047
|
+
else
|
|
1048
|
+
next_cursor = next_cursor[0]
|
|
1049
|
+
if next_cursor.nil?
|
|
1050
|
+
next nil
|
|
1051
|
+
end
|
|
1052
|
+
end
|
|
1053
|
+
|
|
1054
|
+
sdk.list_assessments(
|
|
1055
|
+
account_id: request.account_id,
|
|
1056
|
+
limit: request.limit,
|
|
1057
|
+
cursor: next_cursor,
|
|
1058
|
+
response_mode: request.response_mode,
|
|
1059
|
+
http_headers: http_headers
|
|
1060
|
+
)
|
|
1061
|
+
end
|
|
448
1062
|
|
|
449
1063
|
return response
|
|
450
1064
|
else
|
|
@@ -616,44 +1230,43 @@ module NoResponse
|
|
|
616
1230
|
|
|
617
1231
|
sig {
|
|
618
1232
|
params(
|
|
1233
|
+
body: Models::Shared::EnforcementRequest,
|
|
619
1234
|
account_id: ::String,
|
|
620
|
-
limit: T.nilable(::Integer),
|
|
621
|
-
cursor: T.nilable(::String),
|
|
622
|
-
response_mode: T.nilable(Models::Shared::ResponseMode),
|
|
623
1235
|
retries: T.nilable(Utils::RetryConfig),
|
|
624
1236
|
timeout_ms: T.nilable(Integer),
|
|
625
1237
|
http_headers: T.nilable(T::Hash[T.any(String, Symbol), String])
|
|
626
1238
|
)
|
|
627
|
-
.returns(Models::Operations::
|
|
1239
|
+
.returns(Models::Operations::RecordEnforcementResponse)
|
|
628
1240
|
}
|
|
629
|
-
def
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
response_mode: nil,
|
|
634
|
-
retries: nil,
|
|
635
|
-
timeout_ms: nil,
|
|
636
|
-
http_headers: nil
|
|
637
|
-
)
|
|
638
|
-
# list_assessments - Page through one account's unexpired assessments.
|
|
639
|
-
# 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 workspace 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.
|
|
640
|
-
request = Models::Operations::ListAccountAssessmentsRequest.new(
|
|
1241
|
+
def record_enforcement(body:, account_id:, retries: nil, timeout_ms: nil, http_headers: nil)
|
|
1242
|
+
# record_enforcement - Record what you did to an account in your identity provider.
|
|
1243
|
+
# Records what you did to the account in your identity provider for one flow's decision at one risk_version: the action (or none), the account's state before it, the provider and whether it was applied or failed. It is your action, not an outcome, and it leaves the account's risk unchanged. A record is kept once per account, risk_version, flow and action: the first report answers 201, and a repeat answers 200 with the stored record unchanged, so retries are safe without an Idempotency-Key. An applied report after a failed one replaces the failed record, keeping its id and created_at, and answers 201. A risk_version older than the account's current one is accepted and stored, but only an applied record at the current risk_version takes the account out of listChanged with unenforced=true; a newer one answers 409 risk_version_ahead. An account with no current risk answers 404 not_found. error_code is allowed only with status failed. Requires the history scope.
|
|
1244
|
+
request = Models::Operations::RecordEnforcementRequest.new(
|
|
641
1245
|
account_id: account_id,
|
|
642
|
-
|
|
643
|
-
cursor: cursor,
|
|
644
|
-
response_mode: response_mode
|
|
1246
|
+
body: body
|
|
645
1247
|
)
|
|
646
1248
|
url, params = @sdk_configuration.get_server_details
|
|
647
1249
|
base_url = Utils.template_url(url, params)
|
|
648
1250
|
url = Utils.generate_url(
|
|
649
|
-
Models::Operations::
|
|
1251
|
+
Models::Operations::RecordEnforcementRequest,
|
|
650
1252
|
base_url,
|
|
651
|
-
"/v1/accounts/{account_id}/
|
|
1253
|
+
"/v1/accounts/{account_id}/enforcements",
|
|
652
1254
|
request
|
|
653
1255
|
)
|
|
654
1256
|
headers = {}
|
|
655
1257
|
headers = T.cast(headers, T::Hash[String, String])
|
|
656
|
-
|
|
1258
|
+
req_content_type, data, form = Utils.serialize_request_body(request, false, false, :body, :json)
|
|
1259
|
+
headers["content-type"] = req_content_type
|
|
1260
|
+
raise StandardError, "request body is required" if data.nil? && form.nil?
|
|
1261
|
+
|
|
1262
|
+
if form && !form.empty?
|
|
1263
|
+
body = Utils.encode_form(form)
|
|
1264
|
+
elsif Utils.match_content_type(req_content_type, "application/x-www-form-urlencoded")
|
|
1265
|
+
body = URI.encode_www_form(T.cast(data, T::Hash[Symbol, Object]))
|
|
1266
|
+
else
|
|
1267
|
+
body = data
|
|
1268
|
+
end
|
|
1269
|
+
|
|
657
1270
|
headers["Accept"] = "application/json"
|
|
658
1271
|
headers["user-agent"] = @sdk_configuration.user_agent
|
|
659
1272
|
retries ||= @sdk_configuration.retry_config
|
|
@@ -682,7 +1295,7 @@ module NoResponse
|
|
|
682
1295
|
config: @sdk_configuration,
|
|
683
1296
|
base_url: base_url,
|
|
684
1297
|
oauth2_scopes: nil,
|
|
685
|
-
operation_id: "
|
|
1298
|
+
operation_id: "recordEnforcement",
|
|
686
1299
|
security_source: @sdk_configuration.security_source
|
|
687
1300
|
)
|
|
688
1301
|
|
|
@@ -690,10 +1303,10 @@ module NoResponse
|
|
|
690
1303
|
http_response = T.let(nil, T.nilable(Faraday::Response))
|
|
691
1304
|
|
|
692
1305
|
begin
|
|
693
|
-
http_response = T.must(connection).
|
|
1306
|
+
http_response = T.must(connection).post(url) do |req|
|
|
1307
|
+
req.body = body
|
|
694
1308
|
req.headers.merge!(headers)
|
|
695
1309
|
req.options.timeout = timeout unless timeout.nil?
|
|
696
|
-
req.params = query_params
|
|
697
1310
|
Utils.configure_request_security(req, security)
|
|
698
1311
|
http_headers&.each do |key, value|
|
|
699
1312
|
req.headers[key.to_s] = value
|
|
@@ -734,7 +1347,7 @@ module NoResponse
|
|
|
734
1347
|
end
|
|
735
1348
|
|
|
736
1349
|
content_type = http_response.headers.fetch("Content-Type", "application/octet-stream")
|
|
737
|
-
if Utils.match_status_code(http_response.status, ["200"])
|
|
1350
|
+
if Utils.match_status_code(http_response.status, ["200", "201"])
|
|
738
1351
|
if Utils.match_content_type(content_type, "application/json")
|
|
739
1352
|
@sdk_configuration.hooks.after_success(
|
|
740
1353
|
hook_ctx: SDKHooks::AfterSuccessHookContext.new(
|
|
@@ -743,33 +1356,12 @@ module NoResponse
|
|
|
743
1356
|
response: http_response
|
|
744
1357
|
)
|
|
745
1358
|
response_data = http_response.env.response_body
|
|
746
|
-
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Shared::
|
|
1359
|
+
obj = Crystalline.unmarshal_json(JSON.parse(response_data), Models::Shared::Enforcement)
|
|
747
1360
|
result = obj
|
|
748
|
-
response = Models::Operations::
|
|
1361
|
+
response = Models::Operations::RecordEnforcementResponse.new(
|
|
749
1362
|
result: result,
|
|
750
1363
|
headers: http_response.headers
|
|
751
1364
|
)
|
|
752
|
-
sdk = self
|
|
753
|
-
|
|
754
|
-
response.next_page = proc do
|
|
755
|
-
next_cursor = Janeway.enum_for("$.next_cursor", JSON.parse(response_data)).search
|
|
756
|
-
if next_cursor.nil?
|
|
757
|
-
next nil
|
|
758
|
-
else
|
|
759
|
-
next_cursor = next_cursor[0]
|
|
760
|
-
if next_cursor.nil?
|
|
761
|
-
next nil
|
|
762
|
-
end
|
|
763
|
-
end
|
|
764
|
-
|
|
765
|
-
sdk.list_assessments(
|
|
766
|
-
account_id: request.account_id,
|
|
767
|
-
limit: request.limit,
|
|
768
|
-
cursor: next_cursor,
|
|
769
|
-
response_mode: request.response_mode,
|
|
770
|
-
http_headers: http_headers
|
|
771
|
-
)
|
|
772
|
-
end
|
|
773
1365
|
|
|
774
1366
|
return response
|
|
775
1367
|
else
|