1use reqwest;
13
14use crate::apis::ResponseContent;
15use super::{Error, configuration};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum AcceptConsentRequestError {
22 Status404(crate::models::GenericError),
23 Status500(crate::models::GenericError),
24 UnknownValue(serde_json::Value),
25}
26
27#[derive(Debug, Clone, Serialize, Deserialize)]
29#[serde(untagged)]
30pub enum AcceptLoginRequestError {
31 Status401(crate::models::GenericError),
32 Status404(crate::models::GenericError),
33 Status500(crate::models::GenericError),
34 UnknownValue(serde_json::Value),
35}
36
37#[derive(Debug, Clone, Serialize, Deserialize)]
39#[serde(untagged)]
40pub enum AcceptLogoutRequestError {
41 Status404(crate::models::GenericError),
42 Status500(crate::models::GenericError),
43 UnknownValue(serde_json::Value),
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum CreateJsonWebKeySetError {
50 Status401(crate::models::GenericError),
51 Status403(crate::models::GenericError),
52 Status500(crate::models::GenericError),
53 UnknownValue(serde_json::Value),
54}
55
56#[derive(Debug, Clone, Serialize, Deserialize)]
58#[serde(untagged)]
59pub enum CreateOAuth2ClientError {
60 Status400(crate::models::GenericError),
61 Status409(crate::models::GenericError),
62 Status500(crate::models::GenericError),
63 UnknownValue(serde_json::Value),
64}
65
66#[derive(Debug, Clone, Serialize, Deserialize)]
68#[serde(untagged)]
69pub enum DeleteJsonWebKeyError {
70 Status401(crate::models::GenericError),
71 Status403(crate::models::GenericError),
72 Status500(crate::models::GenericError),
73 UnknownValue(serde_json::Value),
74}
75
76#[derive(Debug, Clone, Serialize, Deserialize)]
78#[serde(untagged)]
79pub enum DeleteJsonWebKeySetError {
80 Status401(crate::models::GenericError),
81 Status403(crate::models::GenericError),
82 Status500(crate::models::GenericError),
83 UnknownValue(serde_json::Value),
84}
85
86#[derive(Debug, Clone, Serialize, Deserialize)]
88#[serde(untagged)]
89pub enum DeleteOAuth2ClientError {
90 Status404(crate::models::GenericError),
91 Status500(crate::models::GenericError),
92 UnknownValue(serde_json::Value),
93}
94
95#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum FlushInactiveOAuth2TokensError {
99 Status401(crate::models::GenericError),
100 Status500(crate::models::GenericError),
101 UnknownValue(serde_json::Value),
102}
103
104#[derive(Debug, Clone, Serialize, Deserialize)]
106#[serde(untagged)]
107pub enum GetConsentRequestError {
108 Status404(crate::models::GenericError),
109 Status409(crate::models::GenericError),
110 Status500(crate::models::GenericError),
111 UnknownValue(serde_json::Value),
112}
113
114#[derive(Debug, Clone, Serialize, Deserialize)]
116#[serde(untagged)]
117pub enum GetJsonWebKeyError {
118 Status404(crate::models::GenericError),
119 Status500(crate::models::GenericError),
120 UnknownValue(serde_json::Value),
121}
122
123#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum GetJsonWebKeySetError {
127 Status401(crate::models::GenericError),
128 Status403(crate::models::GenericError),
129 Status500(crate::models::GenericError),
130 UnknownValue(serde_json::Value),
131}
132
133#[derive(Debug, Clone, Serialize, Deserialize)]
135#[serde(untagged)]
136pub enum GetLoginRequestError {
137 Status400(crate::models::GenericError),
138 Status404(crate::models::GenericError),
139 Status409(crate::models::GenericError),
140 Status500(crate::models::GenericError),
141 UnknownValue(serde_json::Value),
142}
143
144#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum GetLogoutRequestError {
148 Status404(crate::models::GenericError),
149 Status500(crate::models::GenericError),
150 UnknownValue(serde_json::Value),
151}
152
153#[derive(Debug, Clone, Serialize, Deserialize)]
155#[serde(untagged)]
156pub enum GetOAuth2ClientError {
157 Status404(crate::models::GenericError),
158 Status500(crate::models::GenericError),
159 UnknownValue(serde_json::Value),
160}
161
162#[derive(Debug, Clone, Serialize, Deserialize)]
164#[serde(untagged)]
165pub enum GetVersionError {
166 UnknownValue(serde_json::Value),
167}
168
169#[derive(Debug, Clone, Serialize, Deserialize)]
171#[serde(untagged)]
172pub enum IntrospectOAuth2TokenError {
173 Status401(crate::models::GenericError),
174 Status500(crate::models::GenericError),
175 UnknownValue(serde_json::Value),
176}
177
178#[derive(Debug, Clone, Serialize, Deserialize)]
180#[serde(untagged)]
181pub enum IsInstanceAliveError {
182 Status500(crate::models::GenericError),
183 UnknownValue(serde_json::Value),
184}
185
186#[derive(Debug, Clone, Serialize, Deserialize)]
188#[serde(untagged)]
189pub enum ListOAuth2ClientsError {
190 Status500(crate::models::GenericError),
191 UnknownValue(serde_json::Value),
192}
193
194#[derive(Debug, Clone, Serialize, Deserialize)]
196#[serde(untagged)]
197pub enum ListSubjectConsentSessionsError {
198 Status400(crate::models::GenericError),
199 Status404(crate::models::GenericError),
200 Status500(crate::models::GenericError),
201 UnknownValue(serde_json::Value),
202}
203
204#[derive(Debug, Clone, Serialize, Deserialize)]
206#[serde(untagged)]
207pub enum PrometheusError {
208 UnknownValue(serde_json::Value),
209}
210
211#[derive(Debug, Clone, Serialize, Deserialize)]
213#[serde(untagged)]
214pub enum RejectConsentRequestError {
215 Status404(crate::models::GenericError),
216 Status500(crate::models::GenericError),
217 UnknownValue(serde_json::Value),
218}
219
220#[derive(Debug, Clone, Serialize, Deserialize)]
222#[serde(untagged)]
223pub enum RejectLoginRequestError {
224 Status401(crate::models::GenericError),
225 Status404(crate::models::GenericError),
226 Status500(crate::models::GenericError),
227 UnknownValue(serde_json::Value),
228}
229
230#[derive(Debug, Clone, Serialize, Deserialize)]
232#[serde(untagged)]
233pub enum RejectLogoutRequestError {
234 Status404(crate::models::GenericError),
235 Status500(crate::models::GenericError),
236 UnknownValue(serde_json::Value),
237}
238
239#[derive(Debug, Clone, Serialize, Deserialize)]
241#[serde(untagged)]
242pub enum RevokeAuthenticationSessionError {
243 Status400(crate::models::GenericError),
244 Status404(crate::models::GenericError),
245 Status500(crate::models::GenericError),
246 UnknownValue(serde_json::Value),
247}
248
249#[derive(Debug, Clone, Serialize, Deserialize)]
251#[serde(untagged)]
252pub enum RevokeConsentSessionsError {
253 Status400(crate::models::GenericError),
254 Status404(crate::models::GenericError),
255 Status500(crate::models::GenericError),
256 UnknownValue(serde_json::Value),
257}
258
259#[derive(Debug, Clone, Serialize, Deserialize)]
261#[serde(untagged)]
262pub enum UpdateJsonWebKeyError {
263 Status401(crate::models::GenericError),
264 Status403(crate::models::GenericError),
265 Status500(crate::models::GenericError),
266 UnknownValue(serde_json::Value),
267}
268
269#[derive(Debug, Clone, Serialize, Deserialize)]
271#[serde(untagged)]
272pub enum UpdateJsonWebKeySetError {
273 Status401(crate::models::GenericError),
274 Status403(crate::models::GenericError),
275 Status500(crate::models::GenericError),
276 UnknownValue(serde_json::Value),
277}
278
279#[derive(Debug, Clone, Serialize, Deserialize)]
281#[serde(untagged)]
282pub enum UpdateOAuth2ClientError {
283 Status500(crate::models::GenericError),
284 UnknownValue(serde_json::Value),
285}
286
287
288pub async fn accept_consent_request(configuration: &configuration::Configuration, consent_challenge: &str, body: Option<crate::models::AcceptConsentRequest>) -> Result<crate::models::CompletedRequest, Error<AcceptConsentRequestError>> {
290
291 let local_var_client = &configuration.client;
292
293 let local_var_uri_str = format!("{}/oauth2/auth/requests/consent/accept", configuration.base_path);
294 let mut local_var_req_builder = local_var_client.put(local_var_uri_str.as_str());
295
296 local_var_req_builder = local_var_req_builder.query(&[("consent_challenge", &consent_challenge.to_string())]);
297 if let Some(ref local_var_user_agent) = configuration.user_agent {
298 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
299 }
300 local_var_req_builder = local_var_req_builder.json(&body);
301
302 let local_var_req = local_var_req_builder.build()?;
303 let local_var_resp = local_var_client.execute(local_var_req).await?;
304
305 let local_var_status = local_var_resp.status();
306 let local_var_content = local_var_resp.text().await?;
307
308 if local_var_status.is_success() {
309 serde_json::from_str(&local_var_content).map_err(Error::from)
310 } else {
311 let local_var_entity: Option<AcceptConsentRequestError> = serde_json::from_str(&local_var_content).ok();
312 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
313 Err(Error::ResponseError(local_var_error))
314 }
315}
316
317pub async fn accept_login_request(configuration: &configuration::Configuration, login_challenge: &str, body: Option<crate::models::AcceptLoginRequest>) -> Result<crate::models::CompletedRequest, Error<AcceptLoginRequestError>> {
319
320 let local_var_client = &configuration.client;
321
322 let local_var_uri_str = format!("{}/oauth2/auth/requests/login/accept", configuration.base_path);
323 let mut local_var_req_builder = local_var_client.put(local_var_uri_str.as_str());
324
325 local_var_req_builder = local_var_req_builder.query(&[("login_challenge", &login_challenge.to_string())]);
326 if let Some(ref local_var_user_agent) = configuration.user_agent {
327 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
328 }
329 local_var_req_builder = local_var_req_builder.json(&body);
330
331 let local_var_req = local_var_req_builder.build()?;
332 let local_var_resp = local_var_client.execute(local_var_req).await?;
333
334 let local_var_status = local_var_resp.status();
335 let local_var_content = local_var_resp.text().await?;
336
337 if local_var_status.is_success() {
338 serde_json::from_str(&local_var_content).map_err(Error::from)
339 } else {
340 let local_var_entity: Option<AcceptLoginRequestError> = serde_json::from_str(&local_var_content).ok();
341 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
342 Err(Error::ResponseError(local_var_error))
343 }
344}
345
346pub async fn accept_logout_request(configuration: &configuration::Configuration, logout_challenge: &str) -> Result<crate::models::CompletedRequest, Error<AcceptLogoutRequestError>> {
348
349 let local_var_client = &configuration.client;
350
351 let local_var_uri_str = format!("{}/oauth2/auth/requests/logout/accept", configuration.base_path);
352 let mut local_var_req_builder = local_var_client.put(local_var_uri_str.as_str());
353
354 local_var_req_builder = local_var_req_builder.query(&[("logout_challenge", &logout_challenge.to_string())]);
355 if let Some(ref local_var_user_agent) = configuration.user_agent {
356 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
357 }
358
359 let local_var_req = local_var_req_builder.build()?;
360 let local_var_resp = local_var_client.execute(local_var_req).await?;
361
362 let local_var_status = local_var_resp.status();
363 let local_var_content = local_var_resp.text().await?;
364
365 if local_var_status.is_success() {
366 serde_json::from_str(&local_var_content).map_err(Error::from)
367 } else {
368 let local_var_entity: Option<AcceptLogoutRequestError> = serde_json::from_str(&local_var_content).ok();
369 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
370 Err(Error::ResponseError(local_var_error))
371 }
372}
373
374pub async fn create_json_web_key_set(configuration: &configuration::Configuration, set: &str, body: Option<crate::models::JsonWebKeySetGeneratorRequest>) -> Result<crate::models::JsonWebKeySet, Error<CreateJsonWebKeySetError>> {
376
377 let local_var_client = &configuration.client;
378
379 let local_var_uri_str = format!("{}/keys/{set}", configuration.base_path, set=crate::apis::urlencode(set));
380 let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
381
382 if let Some(ref local_var_user_agent) = configuration.user_agent {
383 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
384 }
385 local_var_req_builder = local_var_req_builder.json(&body);
386
387 let local_var_req = local_var_req_builder.build()?;
388 let local_var_resp = local_var_client.execute(local_var_req).await?;
389
390 let local_var_status = local_var_resp.status();
391 let local_var_content = local_var_resp.text().await?;
392
393 if local_var_status.is_success() {
394 serde_json::from_str(&local_var_content).map_err(Error::from)
395 } else {
396 let local_var_entity: Option<CreateJsonWebKeySetError> = serde_json::from_str(&local_var_content).ok();
397 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
398 Err(Error::ResponseError(local_var_error))
399 }
400}
401
402pub async fn create_o_auth2_client(configuration: &configuration::Configuration, body: crate::models::OAuth2Client) -> Result<crate::models::OAuth2Client, Error<CreateOAuth2ClientError>> {
404
405 let local_var_client = &configuration.client;
406
407 let local_var_uri_str = format!("{}/clients", configuration.base_path);
408 let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
409
410 if let Some(ref local_var_user_agent) = configuration.user_agent {
411 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
412 }
413 local_var_req_builder = local_var_req_builder.json(&body);
414
415 let local_var_req = local_var_req_builder.build()?;
416 let local_var_resp = local_var_client.execute(local_var_req).await?;
417
418 let local_var_status = local_var_resp.status();
419 let local_var_content = local_var_resp.text().await?;
420
421 if local_var_status.is_success() {
422 serde_json::from_str(&local_var_content).map_err(Error::from)
423 } else {
424 let local_var_entity: Option<CreateOAuth2ClientError> = serde_json::from_str(&local_var_content).ok();
425 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
426 Err(Error::ResponseError(local_var_error))
427 }
428}
429
430pub async fn delete_json_web_key(configuration: &configuration::Configuration, kid: &str, set: &str) -> Result<(), Error<DeleteJsonWebKeyError>> {
432
433 let local_var_client = &configuration.client;
434
435 let local_var_uri_str = format!("{}/keys/{set}/{kid}", configuration.base_path, kid=crate::apis::urlencode(kid), set=crate::apis::urlencode(set));
436 let mut local_var_req_builder = local_var_client.delete(local_var_uri_str.as_str());
437
438 if let Some(ref local_var_user_agent) = configuration.user_agent {
439 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
440 }
441
442 let local_var_req = local_var_req_builder.build()?;
443 let local_var_resp = local_var_client.execute(local_var_req).await?;
444
445 let local_var_status = local_var_resp.status();
446 let local_var_content = local_var_resp.text().await?;
447
448 if local_var_status.is_success() {
449 Ok(())
450 } else {
451 let local_var_entity: Option<DeleteJsonWebKeyError> = serde_json::from_str(&local_var_content).ok();
452 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
453 Err(Error::ResponseError(local_var_error))
454 }
455}
456
457pub async fn delete_json_web_key_set(configuration: &configuration::Configuration, set: &str) -> Result<(), Error<DeleteJsonWebKeySetError>> {
459
460 let local_var_client = &configuration.client;
461
462 let local_var_uri_str = format!("{}/keys/{set}", configuration.base_path, set=crate::apis::urlencode(set));
463 let mut local_var_req_builder = local_var_client.delete(local_var_uri_str.as_str());
464
465 if let Some(ref local_var_user_agent) = configuration.user_agent {
466 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
467 }
468
469 let local_var_req = local_var_req_builder.build()?;
470 let local_var_resp = local_var_client.execute(local_var_req).await?;
471
472 let local_var_status = local_var_resp.status();
473 let local_var_content = local_var_resp.text().await?;
474
475 if local_var_status.is_success() {
476 Ok(())
477 } else {
478 let local_var_entity: Option<DeleteJsonWebKeySetError> = serde_json::from_str(&local_var_content).ok();
479 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
480 Err(Error::ResponseError(local_var_error))
481 }
482}
483
484pub async fn delete_o_auth2_client(configuration: &configuration::Configuration, id: &str) -> Result<(), Error<DeleteOAuth2ClientError>> {
486
487 let local_var_client = &configuration.client;
488
489 let local_var_uri_str = format!("{}/clients/{id}", configuration.base_path, id=crate::apis::urlencode(id));
490 let mut local_var_req_builder = local_var_client.delete(local_var_uri_str.as_str());
491
492 if let Some(ref local_var_user_agent) = configuration.user_agent {
493 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
494 }
495
496 let local_var_req = local_var_req_builder.build()?;
497 let local_var_resp = local_var_client.execute(local_var_req).await?;
498
499 let local_var_status = local_var_resp.status();
500 let local_var_content = local_var_resp.text().await?;
501
502 if local_var_status.is_success() {
503 Ok(())
504 } else {
505 let local_var_entity: Option<DeleteOAuth2ClientError> = serde_json::from_str(&local_var_content).ok();
506 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
507 Err(Error::ResponseError(local_var_error))
508 }
509}
510
511pub async fn flush_inactive_o_auth2_tokens(configuration: &configuration::Configuration, body: Option<crate::models::FlushInactiveOAuth2TokensRequest>) -> Result<(), Error<FlushInactiveOAuth2TokensError>> {
513
514 let local_var_client = &configuration.client;
515
516 let local_var_uri_str = format!("{}/oauth2/flush", configuration.base_path);
517 let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
518
519 if let Some(ref local_var_user_agent) = configuration.user_agent {
520 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
521 }
522 local_var_req_builder = local_var_req_builder.json(&body);
523
524 let local_var_req = local_var_req_builder.build()?;
525 let local_var_resp = local_var_client.execute(local_var_req).await?;
526
527 let local_var_status = local_var_resp.status();
528 let local_var_content = local_var_resp.text().await?;
529
530 if local_var_status.is_success() {
531 Ok(())
532 } else {
533 let local_var_entity: Option<FlushInactiveOAuth2TokensError> = serde_json::from_str(&local_var_content).ok();
534 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
535 Err(Error::ResponseError(local_var_error))
536 }
537}
538
539pub async fn get_consent_request(configuration: &configuration::Configuration, consent_challenge: &str) -> Result<crate::models::ConsentRequest, Error<GetConsentRequestError>> {
541
542 let local_var_client = &configuration.client;
543
544 let local_var_uri_str = format!("{}/oauth2/auth/requests/consent", configuration.base_path);
545 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
546
547 local_var_req_builder = local_var_req_builder.query(&[("consent_challenge", &consent_challenge.to_string())]);
548 if let Some(ref local_var_user_agent) = configuration.user_agent {
549 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
550 }
551
552 let local_var_req = local_var_req_builder.build()?;
553 let local_var_resp = local_var_client.execute(local_var_req).await?;
554
555 let local_var_status = local_var_resp.status();
556 let local_var_content = local_var_resp.text().await?;
557
558 if local_var_status.is_success() {
559 serde_json::from_str(&local_var_content).map_err(Error::from)
560 } else {
561 let local_var_entity: Option<GetConsentRequestError> = serde_json::from_str(&local_var_content).ok();
562 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
563 Err(Error::ResponseError(local_var_error))
564 }
565}
566
567pub async fn get_json_web_key(configuration: &configuration::Configuration, kid: &str, set: &str) -> Result<crate::models::JsonWebKeySet, Error<GetJsonWebKeyError>> {
569
570 let local_var_client = &configuration.client;
571
572 let local_var_uri_str = format!("{}/keys/{set}/{kid}", configuration.base_path, kid=crate::apis::urlencode(kid), set=crate::apis::urlencode(set));
573 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
574
575 if let Some(ref local_var_user_agent) = configuration.user_agent {
576 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
577 }
578
579 let local_var_req = local_var_req_builder.build()?;
580 let local_var_resp = local_var_client.execute(local_var_req).await?;
581
582 let local_var_status = local_var_resp.status();
583 let local_var_content = local_var_resp.text().await?;
584
585 if local_var_status.is_success() {
586 serde_json::from_str(&local_var_content).map_err(Error::from)
587 } else {
588 let local_var_entity: Option<GetJsonWebKeyError> = serde_json::from_str(&local_var_content).ok();
589 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
590 Err(Error::ResponseError(local_var_error))
591 }
592}
593
594pub async fn get_json_web_key_set(configuration: &configuration::Configuration, set: &str) -> Result<crate::models::JsonWebKeySet, Error<GetJsonWebKeySetError>> {
596
597 let local_var_client = &configuration.client;
598
599 let local_var_uri_str = format!("{}/keys/{set}", configuration.base_path, set=crate::apis::urlencode(set));
600 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
601
602 if let Some(ref local_var_user_agent) = configuration.user_agent {
603 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
604 }
605
606 let local_var_req = local_var_req_builder.build()?;
607 let local_var_resp = local_var_client.execute(local_var_req).await?;
608
609 let local_var_status = local_var_resp.status();
610 let local_var_content = local_var_resp.text().await?;
611
612 if local_var_status.is_success() {
613 serde_json::from_str(&local_var_content).map_err(Error::from)
614 } else {
615 let local_var_entity: Option<GetJsonWebKeySetError> = serde_json::from_str(&local_var_content).ok();
616 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
617 Err(Error::ResponseError(local_var_error))
618 }
619}
620
621pub async fn get_login_request(configuration: &configuration::Configuration, login_challenge: &str) -> Result<crate::models::LoginRequest, Error<GetLoginRequestError>> {
623
624 let local_var_client = &configuration.client;
625
626 let local_var_uri_str = format!("{}/oauth2/auth/requests/login", configuration.base_path);
627 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
628
629 local_var_req_builder = local_var_req_builder.query(&[("login_challenge", &login_challenge.to_string())]);
630 if let Some(ref local_var_user_agent) = configuration.user_agent {
631 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
632 }
633
634 let local_var_req = local_var_req_builder.build()?;
635 let local_var_resp = local_var_client.execute(local_var_req).await?;
636
637 let local_var_status = local_var_resp.status();
638 let local_var_content = local_var_resp.text().await?;
639
640 if local_var_status.is_success() {
641 serde_json::from_str(&local_var_content).map_err(Error::from)
642 } else {
643 let local_var_entity: Option<GetLoginRequestError> = serde_json::from_str(&local_var_content).ok();
644 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
645 Err(Error::ResponseError(local_var_error))
646 }
647}
648
649pub async fn get_logout_request(configuration: &configuration::Configuration, logout_challenge: &str) -> Result<crate::models::LogoutRequest, Error<GetLogoutRequestError>> {
651
652 let local_var_client = &configuration.client;
653
654 let local_var_uri_str = format!("{}/oauth2/auth/requests/logout", configuration.base_path);
655 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
656
657 local_var_req_builder = local_var_req_builder.query(&[("logout_challenge", &logout_challenge.to_string())]);
658 if let Some(ref local_var_user_agent) = configuration.user_agent {
659 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
660 }
661
662 let local_var_req = local_var_req_builder.build()?;
663 let local_var_resp = local_var_client.execute(local_var_req).await?;
664
665 let local_var_status = local_var_resp.status();
666 let local_var_content = local_var_resp.text().await?;
667
668 if local_var_status.is_success() {
669 serde_json::from_str(&local_var_content).map_err(Error::from)
670 } else {
671 let local_var_entity: Option<GetLogoutRequestError> = serde_json::from_str(&local_var_content).ok();
672 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
673 Err(Error::ResponseError(local_var_error))
674 }
675}
676
677pub async fn get_o_auth2_client(configuration: &configuration::Configuration, id: &str) -> Result<crate::models::OAuth2Client, Error<GetOAuth2ClientError>> {
679
680 let local_var_client = &configuration.client;
681
682 let local_var_uri_str = format!("{}/clients/{id}", configuration.base_path, id=crate::apis::urlencode(id));
683 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
684
685 if let Some(ref local_var_user_agent) = configuration.user_agent {
686 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
687 }
688
689 let local_var_req = local_var_req_builder.build()?;
690 let local_var_resp = local_var_client.execute(local_var_req).await?;
691
692 let local_var_status = local_var_resp.status();
693 let local_var_content = local_var_resp.text().await?;
694
695 if local_var_status.is_success() {
696 serde_json::from_str(&local_var_content).map_err(Error::from)
697 } else {
698 let local_var_entity: Option<GetOAuth2ClientError> = serde_json::from_str(&local_var_content).ok();
699 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
700 Err(Error::ResponseError(local_var_error))
701 }
702}
703
704pub async fn get_version(configuration: &configuration::Configuration, ) -> Result<crate::models::Version, Error<GetVersionError>> {
706
707 let local_var_client = &configuration.client;
708
709 let local_var_uri_str = format!("{}/version", configuration.base_path);
710 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
711
712 if let Some(ref local_var_user_agent) = configuration.user_agent {
713 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
714 }
715
716 let local_var_req = local_var_req_builder.build()?;
717 let local_var_resp = local_var_client.execute(local_var_req).await?;
718
719 let local_var_status = local_var_resp.status();
720 let local_var_content = local_var_resp.text().await?;
721
722 if local_var_status.is_success() {
723 serde_json::from_str(&local_var_content).map_err(Error::from)
724 } else {
725 let local_var_entity: Option<GetVersionError> = serde_json::from_str(&local_var_content).ok();
726 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
727 Err(Error::ResponseError(local_var_error))
728 }
729}
730
731pub async fn introspect_o_auth2_token(configuration: &configuration::Configuration, token: &str, scope: Option<&str>) -> Result<crate::models::OAuth2TokenIntrospection, Error<IntrospectOAuth2TokenError>> {
733
734 let local_var_client = &configuration.client;
735
736 let local_var_uri_str = format!("{}/oauth2/introspect", configuration.base_path);
737 let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
738
739 if let Some(ref local_var_user_agent) = configuration.user_agent {
740 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
741 }
742 if let Some(ref local_var_auth_conf) = configuration.basic_auth {
743 local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
744 };
745 if let Some(ref local_var_token) = configuration.oauth_access_token {
746 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
747 };
748 let mut local_var_form_params = std::collections::HashMap::new();
749 local_var_form_params.insert("token", token.to_string());
750 if let Some(local_var_param_value) = scope {
751 local_var_form_params.insert("scope", local_var_param_value.to_string());
752 }
753 local_var_req_builder = local_var_req_builder.form(&local_var_form_params);
754
755 let local_var_req = local_var_req_builder.build()?;
756 let local_var_resp = local_var_client.execute(local_var_req).await?;
757
758 let local_var_status = local_var_resp.status();
759 let local_var_content = local_var_resp.text().await?;
760
761 if local_var_status.is_success() {
762 serde_json::from_str(&local_var_content).map_err(Error::from)
763 } else {
764 let local_var_entity: Option<IntrospectOAuth2TokenError> = serde_json::from_str(&local_var_content).ok();
765 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
766 Err(Error::ResponseError(local_var_error))
767 }
768}
769
770pub async fn is_instance_alive(configuration: &configuration::Configuration, ) -> Result<crate::models::HealthStatus, Error<IsInstanceAliveError>> {
772
773 let local_var_client = &configuration.client;
774
775 let local_var_uri_str = format!("{}/health/alive", configuration.base_path);
776 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
777
778 if let Some(ref local_var_user_agent) = configuration.user_agent {
779 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
780 }
781
782 let local_var_req = local_var_req_builder.build()?;
783 let local_var_resp = local_var_client.execute(local_var_req).await?;
784
785 let local_var_status = local_var_resp.status();
786 let local_var_content = local_var_resp.text().await?;
787
788 if local_var_status.is_success() {
789 serde_json::from_str(&local_var_content).map_err(Error::from)
790 } else {
791 let local_var_entity: Option<IsInstanceAliveError> = serde_json::from_str(&local_var_content).ok();
792 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
793 Err(Error::ResponseError(local_var_error))
794 }
795}
796
797pub async fn list_o_auth2_clients(configuration: &configuration::Configuration, limit: Option<i64>, offset: Option<i64>) -> Result<Vec<crate::models::OAuth2Client>, Error<ListOAuth2ClientsError>> {
799
800 let local_var_client = &configuration.client;
801
802 let local_var_uri_str = format!("{}/clients", configuration.base_path);
803 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
804
805 if let Some(ref local_var_str) = limit {
806 local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
807 }
808 if let Some(ref local_var_str) = offset {
809 local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]);
810 }
811 if let Some(ref local_var_user_agent) = configuration.user_agent {
812 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
813 }
814
815 let local_var_req = local_var_req_builder.build()?;
816 let local_var_resp = local_var_client.execute(local_var_req).await?;
817
818 let local_var_status = local_var_resp.status();
819 let local_var_content = local_var_resp.text().await?;
820
821 if local_var_status.is_success() {
822 serde_json::from_str(&local_var_content).map_err(Error::from)
823 } else {
824 let local_var_entity: Option<ListOAuth2ClientsError> = serde_json::from_str(&local_var_content).ok();
825 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
826 Err(Error::ResponseError(local_var_error))
827 }
828}
829
830pub async fn list_subject_consent_sessions(configuration: &configuration::Configuration, subject: &str) -> Result<Vec<crate::models::PreviousConsentSession>, Error<ListSubjectConsentSessionsError>> {
832
833 let local_var_client = &configuration.client;
834
835 let local_var_uri_str = format!("{}/oauth2/auth/sessions/consent", configuration.base_path);
836 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
837
838 local_var_req_builder = local_var_req_builder.query(&[("subject", &subject.to_string())]);
839 if let Some(ref local_var_user_agent) = configuration.user_agent {
840 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
841 }
842
843 let local_var_req = local_var_req_builder.build()?;
844 let local_var_resp = local_var_client.execute(local_var_req).await?;
845
846 let local_var_status = local_var_resp.status();
847 let local_var_content = local_var_resp.text().await?;
848
849 if local_var_status.is_success() {
850 serde_json::from_str(&local_var_content).map_err(Error::from)
851 } else {
852 let local_var_entity: Option<ListSubjectConsentSessionsError> = serde_json::from_str(&local_var_content).ok();
853 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
854 Err(Error::ResponseError(local_var_error))
855 }
856}
857
858pub async fn prometheus(configuration: &configuration::Configuration, ) -> Result<(), Error<PrometheusError>> {
860
861 let local_var_client = &configuration.client;
862
863 let local_var_uri_str = format!("{}/metrics/prometheus", configuration.base_path);
864 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
865
866 if let Some(ref local_var_user_agent) = configuration.user_agent {
867 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
868 }
869
870 let local_var_req = local_var_req_builder.build()?;
871 let local_var_resp = local_var_client.execute(local_var_req).await?;
872
873 let local_var_status = local_var_resp.status();
874 let local_var_content = local_var_resp.text().await?;
875
876 if local_var_status.is_success() {
877 Ok(())
878 } else {
879 let local_var_entity: Option<PrometheusError> = serde_json::from_str(&local_var_content).ok();
880 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
881 Err(Error::ResponseError(local_var_error))
882 }
883}
884
885pub async fn reject_consent_request(configuration: &configuration::Configuration, consent_challenge: &str, body: Option<crate::models::RejectRequest>) -> Result<crate::models::CompletedRequest, Error<RejectConsentRequestError>> {
887
888 let local_var_client = &configuration.client;
889
890 let local_var_uri_str = format!("{}/oauth2/auth/requests/consent/reject", configuration.base_path);
891 let mut local_var_req_builder = local_var_client.put(local_var_uri_str.as_str());
892
893 local_var_req_builder = local_var_req_builder.query(&[("consent_challenge", &consent_challenge.to_string())]);
894 if let Some(ref local_var_user_agent) = configuration.user_agent {
895 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
896 }
897 local_var_req_builder = local_var_req_builder.json(&body);
898
899 let local_var_req = local_var_req_builder.build()?;
900 let local_var_resp = local_var_client.execute(local_var_req).await?;
901
902 let local_var_status = local_var_resp.status();
903 let local_var_content = local_var_resp.text().await?;
904
905 if local_var_status.is_success() {
906 serde_json::from_str(&local_var_content).map_err(Error::from)
907 } else {
908 let local_var_entity: Option<RejectConsentRequestError> = serde_json::from_str(&local_var_content).ok();
909 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
910 Err(Error::ResponseError(local_var_error))
911 }
912}
913
914pub async fn reject_login_request(configuration: &configuration::Configuration, login_challenge: &str, body: Option<crate::models::RejectRequest>) -> Result<crate::models::CompletedRequest, Error<RejectLoginRequestError>> {
916
917 let local_var_client = &configuration.client;
918
919 let local_var_uri_str = format!("{}/oauth2/auth/requests/login/reject", configuration.base_path);
920 let mut local_var_req_builder = local_var_client.put(local_var_uri_str.as_str());
921
922 local_var_req_builder = local_var_req_builder.query(&[("login_challenge", &login_challenge.to_string())]);
923 if let Some(ref local_var_user_agent) = configuration.user_agent {
924 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
925 }
926 local_var_req_builder = local_var_req_builder.json(&body);
927
928 let local_var_req = local_var_req_builder.build()?;
929 let local_var_resp = local_var_client.execute(local_var_req).await?;
930
931 let local_var_status = local_var_resp.status();
932 let local_var_content = local_var_resp.text().await?;
933
934 if local_var_status.is_success() {
935 serde_json::from_str(&local_var_content).map_err(Error::from)
936 } else {
937 let local_var_entity: Option<RejectLoginRequestError> = serde_json::from_str(&local_var_content).ok();
938 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
939 Err(Error::ResponseError(local_var_error))
940 }
941}
942
943pub async fn reject_logout_request(configuration: &configuration::Configuration, logout_challenge: &str, body: Option<crate::models::RejectRequest>) -> Result<(), Error<RejectLogoutRequestError>> {
945
946 let local_var_client = &configuration.client;
947
948 let local_var_uri_str = format!("{}/oauth2/auth/requests/logout/reject", configuration.base_path);
949 let mut local_var_req_builder = local_var_client.put(local_var_uri_str.as_str());
950
951 local_var_req_builder = local_var_req_builder.query(&[("logout_challenge", &logout_challenge.to_string())]);
952 if let Some(ref local_var_user_agent) = configuration.user_agent {
953 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
954 }
955 local_var_req_builder = local_var_req_builder.json(&body);
956
957 let local_var_req = local_var_req_builder.build()?;
958 let local_var_resp = local_var_client.execute(local_var_req).await?;
959
960 let local_var_status = local_var_resp.status();
961 let local_var_content = local_var_resp.text().await?;
962
963 if local_var_status.is_success() {
964 Ok(())
965 } else {
966 let local_var_entity: Option<RejectLogoutRequestError> = serde_json::from_str(&local_var_content).ok();
967 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
968 Err(Error::ResponseError(local_var_error))
969 }
970}
971
972pub async fn revoke_authentication_session(configuration: &configuration::Configuration, subject: &str) -> Result<(), Error<RevokeAuthenticationSessionError>> {
974
975 let local_var_client = &configuration.client;
976
977 let local_var_uri_str = format!("{}/oauth2/auth/sessions/login", configuration.base_path);
978 let mut local_var_req_builder = local_var_client.delete(local_var_uri_str.as_str());
979
980 local_var_req_builder = local_var_req_builder.query(&[("subject", &subject.to_string())]);
981 if let Some(ref local_var_user_agent) = configuration.user_agent {
982 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
983 }
984
985 let local_var_req = local_var_req_builder.build()?;
986 let local_var_resp = local_var_client.execute(local_var_req).await?;
987
988 let local_var_status = local_var_resp.status();
989 let local_var_content = local_var_resp.text().await?;
990
991 if local_var_status.is_success() {
992 Ok(())
993 } else {
994 let local_var_entity: Option<RevokeAuthenticationSessionError> = serde_json::from_str(&local_var_content).ok();
995 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
996 Err(Error::ResponseError(local_var_error))
997 }
998}
999
1000pub async fn revoke_consent_sessions(configuration: &configuration::Configuration, subject: &str, client: Option<&str>) -> Result<(), Error<RevokeConsentSessionsError>> {
1002
1003 let local_var_client = &configuration.client;
1004
1005 let local_var_uri_str = format!("{}/oauth2/auth/sessions/consent", configuration.base_path);
1006 let mut local_var_req_builder = local_var_client.delete(local_var_uri_str.as_str());
1007
1008 local_var_req_builder = local_var_req_builder.query(&[("subject", &subject.to_string())]);
1009 if let Some(ref local_var_str) = client {
1010 local_var_req_builder = local_var_req_builder.query(&[("client", &local_var_str.to_string())]);
1011 }
1012 if let Some(ref local_var_user_agent) = configuration.user_agent {
1013 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1014 }
1015
1016 let local_var_req = local_var_req_builder.build()?;
1017 let local_var_resp = local_var_client.execute(local_var_req).await?;
1018
1019 let local_var_status = local_var_resp.status();
1020 let local_var_content = local_var_resp.text().await?;
1021
1022 if local_var_status.is_success() {
1023 Ok(())
1024 } else {
1025 let local_var_entity: Option<RevokeConsentSessionsError> = serde_json::from_str(&local_var_content).ok();
1026 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1027 Err(Error::ResponseError(local_var_error))
1028 }
1029}
1030
1031pub async fn update_json_web_key(configuration: &configuration::Configuration, kid: &str, set: &str, body: Option<crate::models::JsonWebKey>) -> Result<crate::models::JsonWebKey, Error<UpdateJsonWebKeyError>> {
1033
1034 let local_var_client = &configuration.client;
1035
1036 let local_var_uri_str = format!("{}/keys/{set}/{kid}", configuration.base_path, kid=crate::apis::urlencode(kid), set=crate::apis::urlencode(set));
1037 let mut local_var_req_builder = local_var_client.put(local_var_uri_str.as_str());
1038
1039 if let Some(ref local_var_user_agent) = configuration.user_agent {
1040 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1041 }
1042 local_var_req_builder = local_var_req_builder.json(&body);
1043
1044 let local_var_req = local_var_req_builder.build()?;
1045 let local_var_resp = local_var_client.execute(local_var_req).await?;
1046
1047 let local_var_status = local_var_resp.status();
1048 let local_var_content = local_var_resp.text().await?;
1049
1050 if local_var_status.is_success() {
1051 serde_json::from_str(&local_var_content).map_err(Error::from)
1052 } else {
1053 let local_var_entity: Option<UpdateJsonWebKeyError> = serde_json::from_str(&local_var_content).ok();
1054 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1055 Err(Error::ResponseError(local_var_error))
1056 }
1057}
1058
1059pub async fn update_json_web_key_set(configuration: &configuration::Configuration, set: &str, body: Option<crate::models::JsonWebKeySet>) -> Result<crate::models::JsonWebKeySet, Error<UpdateJsonWebKeySetError>> {
1061
1062 let local_var_client = &configuration.client;
1063
1064 let local_var_uri_str = format!("{}/keys/{set}", configuration.base_path, set=crate::apis::urlencode(set));
1065 let mut local_var_req_builder = local_var_client.put(local_var_uri_str.as_str());
1066
1067 if let Some(ref local_var_user_agent) = configuration.user_agent {
1068 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1069 }
1070 local_var_req_builder = local_var_req_builder.json(&body);
1071
1072 let local_var_req = local_var_req_builder.build()?;
1073 let local_var_resp = local_var_client.execute(local_var_req).await?;
1074
1075 let local_var_status = local_var_resp.status();
1076 let local_var_content = local_var_resp.text().await?;
1077
1078 if local_var_status.is_success() {
1079 serde_json::from_str(&local_var_content).map_err(Error::from)
1080 } else {
1081 let local_var_entity: Option<UpdateJsonWebKeySetError> = serde_json::from_str(&local_var_content).ok();
1082 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1083 Err(Error::ResponseError(local_var_error))
1084 }
1085}
1086
1087pub async fn update_o_auth2_client(configuration: &configuration::Configuration, id: &str, body: crate::models::OAuth2Client) -> Result<crate::models::OAuth2Client, Error<UpdateOAuth2ClientError>> {
1089
1090 let local_var_client = &configuration.client;
1091
1092 let local_var_uri_str = format!("{}/clients/{id}", configuration.base_path, id=crate::apis::urlencode(id));
1093 let mut local_var_req_builder = local_var_client.put(local_var_uri_str.as_str());
1094
1095 if let Some(ref local_var_user_agent) = configuration.user_agent {
1096 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1097 }
1098 local_var_req_builder = local_var_req_builder.json(&body);
1099
1100 let local_var_req = local_var_req_builder.build()?;
1101 let local_var_resp = local_var_client.execute(local_var_req).await?;
1102
1103 let local_var_status = local_var_resp.status();
1104 let local_var_content = local_var_resp.text().await?;
1105
1106 if local_var_status.is_success() {
1107 serde_json::from_str(&local_var_content).map_err(Error::from)
1108 } else {
1109 let local_var_entity: Option<UpdateOAuth2ClientError> = serde_json::from_str(&local_var_content).ok();
1110 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1111 Err(Error::ResponseError(local_var_error))
1112 }
1113}
1114