1use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum AcceptOAuth2ConsentRequestError {
22 DefaultResponse(models::ErrorOAuth2),
23 UnknownValue(serde_json::Value),
24}
25
26#[derive(Debug, Clone, Serialize, Deserialize)]
28#[serde(untagged)]
29pub enum AcceptOAuth2LoginRequestError {
30 DefaultResponse(models::ErrorOAuth2),
31 UnknownValue(serde_json::Value),
32}
33
34#[derive(Debug, Clone, Serialize, Deserialize)]
36#[serde(untagged)]
37pub enum AcceptOAuth2LogoutRequestError {
38 DefaultResponse(models::ErrorOAuth2),
39 UnknownValue(serde_json::Value),
40}
41
42#[derive(Debug, Clone, Serialize, Deserialize)]
44#[serde(untagged)]
45pub enum AcceptUserCodeRequestError {
46 DefaultResponse(models::ErrorOAuth2),
47 UnknownValue(serde_json::Value),
48}
49
50#[derive(Debug, Clone, Serialize, Deserialize)]
52#[serde(untagged)]
53pub enum CreateOAuth2ClientError {
54 Status400(models::ErrorOAuth2),
55 DefaultResponse(models::ErrorOAuth2),
56 UnknownValue(serde_json::Value),
57}
58
59#[derive(Debug, Clone, Serialize, Deserialize)]
61#[serde(untagged)]
62pub enum DeleteOAuth2ClientError {
63 DefaultResponse(models::GenericError),
64 UnknownValue(serde_json::Value),
65}
66
67#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum DeleteOAuth2TokenError {
71 DefaultResponse(models::ErrorOAuth2),
72 UnknownValue(serde_json::Value),
73}
74
75#[derive(Debug, Clone, Serialize, Deserialize)]
77#[serde(untagged)]
78pub enum DeleteRotatedOAuth2ClientSecretsError {
79 Status404(models::ErrorOAuth2),
80 DefaultResponse(models::ErrorOAuth2),
81 UnknownValue(serde_json::Value),
82}
83
84#[derive(Debug, Clone, Serialize, Deserialize)]
86#[serde(untagged)]
87pub enum DeleteTrustedOAuth2JwtGrantIssuerError {
88 DefaultResponse(models::GenericError),
89 UnknownValue(serde_json::Value),
90}
91
92#[derive(Debug, Clone, Serialize, Deserialize)]
94#[serde(untagged)]
95pub enum GetOAuth2ClientError {
96 DefaultResponse(models::ErrorOAuth2),
97 UnknownValue(serde_json::Value),
98}
99
100#[derive(Debug, Clone, Serialize, Deserialize)]
102#[serde(untagged)]
103pub enum GetOAuth2ConsentRequestError {
104 Status410(models::OAuth2RedirectTo),
105 DefaultResponse(models::ErrorOAuth2),
106 UnknownValue(serde_json::Value),
107}
108
109#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum GetOAuth2LoginRequestError {
113 Status410(models::OAuth2RedirectTo),
114 DefaultResponse(models::ErrorOAuth2),
115 UnknownValue(serde_json::Value),
116}
117
118#[derive(Debug, Clone, Serialize, Deserialize)]
120#[serde(untagged)]
121pub enum GetOAuth2LogoutRequestError {
122 DefaultResponse(models::ErrorOAuth2),
123 UnknownValue(serde_json::Value),
124}
125
126#[derive(Debug, Clone, Serialize, Deserialize)]
128#[serde(untagged)]
129pub enum GetTrustedOAuth2JwtGrantIssuerError {
130 DefaultResponse(models::GenericError),
131 UnknownValue(serde_json::Value),
132}
133
134#[derive(Debug, Clone, Serialize, Deserialize)]
136#[serde(untagged)]
137pub enum IntrospectOAuth2TokenError {
138 DefaultResponse(models::ErrorOAuth2),
139 UnknownValue(serde_json::Value),
140}
141
142#[derive(Debug, Clone, Serialize, Deserialize)]
144#[serde(untagged)]
145pub enum ListOAuth2ClientsError {
146 DefaultResponse(models::ErrorOAuth2),
147 UnknownValue(serde_json::Value),
148}
149
150#[derive(Debug, Clone, Serialize, Deserialize)]
152#[serde(untagged)]
153pub enum ListOAuth2ConsentSessionsError {
154 DefaultResponse(models::ErrorOAuth2),
155 UnknownValue(serde_json::Value),
156}
157
158#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum ListTrustedOAuth2JwtGrantIssuersError {
162 DefaultResponse(models::GenericError),
163 UnknownValue(serde_json::Value),
164}
165
166#[derive(Debug, Clone, Serialize, Deserialize)]
168#[serde(untagged)]
169pub enum OAuth2AuthorizeError {
170 DefaultResponse(models::ErrorOAuth2),
171 UnknownValue(serde_json::Value),
172}
173
174#[derive(Debug, Clone, Serialize, Deserialize)]
176#[serde(untagged)]
177pub enum OAuth2DeviceFlowError {
178 DefaultResponse(models::ErrorOAuth2),
179 UnknownValue(serde_json::Value),
180}
181
182#[derive(Debug, Clone, Serialize, Deserialize)]
184#[serde(untagged)]
185pub enum Oauth2TokenExchangeError {
186 DefaultResponse(models::ErrorOAuth2),
187 UnknownValue(serde_json::Value),
188}
189
190#[derive(Debug, Clone, Serialize, Deserialize)]
192#[serde(untagged)]
193pub enum PatchOAuth2ClientError {
194 Status404(models::ErrorOAuth2),
195 DefaultResponse(models::ErrorOAuth2),
196 UnknownValue(serde_json::Value),
197}
198
199#[derive(Debug, Clone, Serialize, Deserialize)]
201#[serde(untagged)]
202pub enum PerformOAuth2DeviceVerificationFlowError {
203 DefaultResponse(models::ErrorOAuth2),
204 UnknownValue(serde_json::Value),
205}
206
207#[derive(Debug, Clone, Serialize, Deserialize)]
209#[serde(untagged)]
210pub enum RejectOAuth2ConsentRequestError {
211 DefaultResponse(models::ErrorOAuth2),
212 UnknownValue(serde_json::Value),
213}
214
215#[derive(Debug, Clone, Serialize, Deserialize)]
217#[serde(untagged)]
218pub enum RejectOAuth2LoginRequestError {
219 DefaultResponse(models::ErrorOAuth2),
220 UnknownValue(serde_json::Value),
221}
222
223#[derive(Debug, Clone, Serialize, Deserialize)]
225#[serde(untagged)]
226pub enum RejectOAuth2LogoutRequestError {
227 DefaultResponse(models::ErrorOAuth2),
228 UnknownValue(serde_json::Value),
229}
230
231#[derive(Debug, Clone, Serialize, Deserialize)]
233#[serde(untagged)]
234pub enum RevokeOAuth2ConsentSessionsError {
235 DefaultResponse(models::ErrorOAuth2),
236 UnknownValue(serde_json::Value),
237}
238
239#[derive(Debug, Clone, Serialize, Deserialize)]
241#[serde(untagged)]
242pub enum RevokeOAuth2LoginSessionsError {
243 DefaultResponse(models::ErrorOAuth2),
244 UnknownValue(serde_json::Value),
245}
246
247#[derive(Debug, Clone, Serialize, Deserialize)]
249#[serde(untagged)]
250pub enum RevokeOAuth2TokenError {
251 DefaultResponse(models::ErrorOAuth2),
252 UnknownValue(serde_json::Value),
253}
254
255#[derive(Debug, Clone, Serialize, Deserialize)]
257#[serde(untagged)]
258pub enum RotateOAuth2ClientSecretError {
259 Status404(models::ErrorOAuth2),
260 DefaultResponse(models::ErrorOAuth2),
261 UnknownValue(serde_json::Value),
262}
263
264#[derive(Debug, Clone, Serialize, Deserialize)]
266#[serde(untagged)]
267pub enum SetOAuth2ClientError {
268 Status400(models::ErrorOAuth2),
269 Status404(models::ErrorOAuth2),
270 DefaultResponse(models::ErrorOAuth2),
271 UnknownValue(serde_json::Value),
272}
273
274#[derive(Debug, Clone, Serialize, Deserialize)]
276#[serde(untagged)]
277pub enum SetOAuth2ClientLifespansError {
278 DefaultResponse(models::GenericError),
279 UnknownValue(serde_json::Value),
280}
281
282#[derive(Debug, Clone, Serialize, Deserialize)]
284#[serde(untagged)]
285pub enum TrustOAuth2JwtGrantIssuerError {
286 DefaultResponse(models::GenericError),
287 UnknownValue(serde_json::Value),
288}
289
290
291pub async fn accept_o_auth2_consent_request(configuration: &configuration::Configuration, consent_challenge: &str, accept_o_auth2_consent_request: Option<models::AcceptOAuth2ConsentRequest>) -> Result<models::OAuth2RedirectTo, Error<AcceptOAuth2ConsentRequestError>> {
293 let p_query_consent_challenge = consent_challenge;
295 let p_body_accept_o_auth2_consent_request = accept_o_auth2_consent_request;
296
297 let uri_str = format!("{}/admin/oauth2/auth/requests/consent/accept", configuration.base_path);
298 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
299
300 req_builder = req_builder.query(&[("consent_challenge", &p_query_consent_challenge.to_string())]);
301 if let Some(ref user_agent) = configuration.user_agent {
302 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
303 }
304 if let Some(ref token) = configuration.bearer_access_token {
305 req_builder = req_builder.bearer_auth(token.to_owned());
306 };
307 req_builder = req_builder.json(&p_body_accept_o_auth2_consent_request);
308
309 let req = req_builder.build()?;
310 let resp = configuration.client.execute(req).await?;
311
312 let status = resp.status();
313 let content_type = resp
314 .headers()
315 .get("content-type")
316 .and_then(|v| v.to_str().ok())
317 .unwrap_or("application/octet-stream");
318 let content_type = super::ContentType::from(content_type);
319
320 if !status.is_client_error() && !status.is_server_error() {
321 let content = resp.text().await?;
322 match content_type {
323 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
324 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OAuth2RedirectTo`"))),
325 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::OAuth2RedirectTo`")))),
326 }
327 } else {
328 let content = resp.text().await?;
329 let entity: Option<AcceptOAuth2ConsentRequestError> = serde_json::from_str(&content).ok();
330 Err(Error::ResponseError(ResponseContent { status, content, entity }))
331 }
332}
333
334pub async fn accept_o_auth2_login_request(configuration: &configuration::Configuration, login_challenge: &str, accept_o_auth2_login_request: Option<models::AcceptOAuth2LoginRequest>) -> Result<models::OAuth2RedirectTo, Error<AcceptOAuth2LoginRequestError>> {
336 let p_query_login_challenge = login_challenge;
338 let p_body_accept_o_auth2_login_request = accept_o_auth2_login_request;
339
340 let uri_str = format!("{}/admin/oauth2/auth/requests/login/accept", configuration.base_path);
341 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
342
343 req_builder = req_builder.query(&[("login_challenge", &p_query_login_challenge.to_string())]);
344 if let Some(ref user_agent) = configuration.user_agent {
345 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
346 }
347 if let Some(ref token) = configuration.bearer_access_token {
348 req_builder = req_builder.bearer_auth(token.to_owned());
349 };
350 req_builder = req_builder.json(&p_body_accept_o_auth2_login_request);
351
352 let req = req_builder.build()?;
353 let resp = configuration.client.execute(req).await?;
354
355 let status = resp.status();
356 let content_type = resp
357 .headers()
358 .get("content-type")
359 .and_then(|v| v.to_str().ok())
360 .unwrap_or("application/octet-stream");
361 let content_type = super::ContentType::from(content_type);
362
363 if !status.is_client_error() && !status.is_server_error() {
364 let content = resp.text().await?;
365 match content_type {
366 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
367 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OAuth2RedirectTo`"))),
368 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::OAuth2RedirectTo`")))),
369 }
370 } else {
371 let content = resp.text().await?;
372 let entity: Option<AcceptOAuth2LoginRequestError> = serde_json::from_str(&content).ok();
373 Err(Error::ResponseError(ResponseContent { status, content, entity }))
374 }
375}
376
377pub async fn accept_o_auth2_logout_request(configuration: &configuration::Configuration, logout_challenge: &str) -> Result<models::OAuth2RedirectTo, Error<AcceptOAuth2LogoutRequestError>> {
379 let p_query_logout_challenge = logout_challenge;
381
382 let uri_str = format!("{}/admin/oauth2/auth/requests/logout/accept", configuration.base_path);
383 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
384
385 req_builder = req_builder.query(&[("logout_challenge", &p_query_logout_challenge.to_string())]);
386 if let Some(ref user_agent) = configuration.user_agent {
387 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
388 }
389 if let Some(ref token) = configuration.bearer_access_token {
390 req_builder = req_builder.bearer_auth(token.to_owned());
391 };
392
393 let req = req_builder.build()?;
394 let resp = configuration.client.execute(req).await?;
395
396 let status = resp.status();
397 let content_type = resp
398 .headers()
399 .get("content-type")
400 .and_then(|v| v.to_str().ok())
401 .unwrap_or("application/octet-stream");
402 let content_type = super::ContentType::from(content_type);
403
404 if !status.is_client_error() && !status.is_server_error() {
405 let content = resp.text().await?;
406 match content_type {
407 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
408 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OAuth2RedirectTo`"))),
409 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::OAuth2RedirectTo`")))),
410 }
411 } else {
412 let content = resp.text().await?;
413 let entity: Option<AcceptOAuth2LogoutRequestError> = serde_json::from_str(&content).ok();
414 Err(Error::ResponseError(ResponseContent { status, content, entity }))
415 }
416}
417
418pub async fn accept_user_code_request(configuration: &configuration::Configuration, device_challenge: &str, accept_device_user_code_request: Option<models::AcceptDeviceUserCodeRequest>) -> Result<models::OAuth2RedirectTo, Error<AcceptUserCodeRequestError>> {
420 let p_query_device_challenge = device_challenge;
422 let p_body_accept_device_user_code_request = accept_device_user_code_request;
423
424 let uri_str = format!("{}/admin/oauth2/auth/requests/device/accept", configuration.base_path);
425 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
426
427 req_builder = req_builder.query(&[("device_challenge", &p_query_device_challenge.to_string())]);
428 if let Some(ref user_agent) = configuration.user_agent {
429 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
430 }
431 if let Some(ref token) = configuration.bearer_access_token {
432 req_builder = req_builder.bearer_auth(token.to_owned());
433 };
434 req_builder = req_builder.json(&p_body_accept_device_user_code_request);
435
436 let req = req_builder.build()?;
437 let resp = configuration.client.execute(req).await?;
438
439 let status = resp.status();
440 let content_type = resp
441 .headers()
442 .get("content-type")
443 .and_then(|v| v.to_str().ok())
444 .unwrap_or("application/octet-stream");
445 let content_type = super::ContentType::from(content_type);
446
447 if !status.is_client_error() && !status.is_server_error() {
448 let content = resp.text().await?;
449 match content_type {
450 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
451 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OAuth2RedirectTo`"))),
452 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::OAuth2RedirectTo`")))),
453 }
454 } else {
455 let content = resp.text().await?;
456 let entity: Option<AcceptUserCodeRequestError> = serde_json::from_str(&content).ok();
457 Err(Error::ResponseError(ResponseContent { status, content, entity }))
458 }
459}
460
461pub async fn create_o_auth2_client(configuration: &configuration::Configuration, o_auth2_client: models::OAuth2Client) -> Result<models::OAuth2Client, Error<CreateOAuth2ClientError>> {
463 let p_body_o_auth2_client = o_auth2_client;
465
466 let uri_str = format!("{}/admin/clients", configuration.base_path);
467 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
468
469 if let Some(ref user_agent) = configuration.user_agent {
470 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
471 }
472 if let Some(ref token) = configuration.bearer_access_token {
473 req_builder = req_builder.bearer_auth(token.to_owned());
474 };
475 req_builder = req_builder.json(&p_body_o_auth2_client);
476
477 let req = req_builder.build()?;
478 let resp = configuration.client.execute(req).await?;
479
480 let status = resp.status();
481 let content_type = resp
482 .headers()
483 .get("content-type")
484 .and_then(|v| v.to_str().ok())
485 .unwrap_or("application/octet-stream");
486 let content_type = super::ContentType::from(content_type);
487
488 if !status.is_client_error() && !status.is_server_error() {
489 let content = resp.text().await?;
490 match content_type {
491 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
492 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OAuth2Client`"))),
493 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::OAuth2Client`")))),
494 }
495 } else {
496 let content = resp.text().await?;
497 let entity: Option<CreateOAuth2ClientError> = serde_json::from_str(&content).ok();
498 Err(Error::ResponseError(ResponseContent { status, content, entity }))
499 }
500}
501
502pub async fn delete_o_auth2_client(configuration: &configuration::Configuration, id: &str) -> Result<(), Error<DeleteOAuth2ClientError>> {
504 let p_path_id = id;
506
507 let uri_str = format!("{}/admin/clients/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
508 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
509
510 if let Some(ref user_agent) = configuration.user_agent {
511 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
512 }
513 if let Some(ref token) = configuration.bearer_access_token {
514 req_builder = req_builder.bearer_auth(token.to_owned());
515 };
516
517 let req = req_builder.build()?;
518 let resp = configuration.client.execute(req).await?;
519
520 let status = resp.status();
521
522 if !status.is_client_error() && !status.is_server_error() {
523 Ok(())
524 } else {
525 let content = resp.text().await?;
526 let entity: Option<DeleteOAuth2ClientError> = serde_json::from_str(&content).ok();
527 Err(Error::ResponseError(ResponseContent { status, content, entity }))
528 }
529}
530
531pub async fn delete_o_auth2_token(configuration: &configuration::Configuration, client_id: &str) -> Result<(), Error<DeleteOAuth2TokenError>> {
533 let p_query_client_id = client_id;
535
536 let uri_str = format!("{}/admin/oauth2/tokens", configuration.base_path);
537 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
538
539 req_builder = req_builder.query(&[("client_id", &p_query_client_id.to_string())]);
540 if let Some(ref user_agent) = configuration.user_agent {
541 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
542 }
543 if let Some(ref token) = configuration.bearer_access_token {
544 req_builder = req_builder.bearer_auth(token.to_owned());
545 };
546
547 let req = req_builder.build()?;
548 let resp = configuration.client.execute(req).await?;
549
550 let status = resp.status();
551
552 if !status.is_client_error() && !status.is_server_error() {
553 Ok(())
554 } else {
555 let content = resp.text().await?;
556 let entity: Option<DeleteOAuth2TokenError> = serde_json::from_str(&content).ok();
557 Err(Error::ResponseError(ResponseContent { status, content, entity }))
558 }
559}
560
561pub async fn delete_rotated_o_auth2_client_secrets(configuration: &configuration::Configuration, id: &str) -> Result<models::OAuth2Client, Error<DeleteRotatedOAuth2ClientSecretsError>> {
563 let p_path_id = id;
565
566 let uri_str = format!("{}/admin/clients/{id}/secrets/rotate", configuration.base_path, id=crate::apis::urlencode(p_path_id));
567 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
568
569 if let Some(ref user_agent) = configuration.user_agent {
570 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
571 }
572 if let Some(ref token) = configuration.bearer_access_token {
573 req_builder = req_builder.bearer_auth(token.to_owned());
574 };
575
576 let req = req_builder.build()?;
577 let resp = configuration.client.execute(req).await?;
578
579 let status = resp.status();
580 let content_type = resp
581 .headers()
582 .get("content-type")
583 .and_then(|v| v.to_str().ok())
584 .unwrap_or("application/octet-stream");
585 let content_type = super::ContentType::from(content_type);
586
587 if !status.is_client_error() && !status.is_server_error() {
588 let content = resp.text().await?;
589 match content_type {
590 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
591 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OAuth2Client`"))),
592 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::OAuth2Client`")))),
593 }
594 } else {
595 let content = resp.text().await?;
596 let entity: Option<DeleteRotatedOAuth2ClientSecretsError> = serde_json::from_str(&content).ok();
597 Err(Error::ResponseError(ResponseContent { status, content, entity }))
598 }
599}
600
601pub async fn delete_trusted_o_auth2_jwt_grant_issuer(configuration: &configuration::Configuration, id: &str) -> Result<(), Error<DeleteTrustedOAuth2JwtGrantIssuerError>> {
603 let p_path_id = id;
605
606 let uri_str = format!("{}/admin/trust/grants/jwt-bearer/issuers/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
607 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
608
609 if let Some(ref user_agent) = configuration.user_agent {
610 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
611 }
612 if let Some(ref token) = configuration.bearer_access_token {
613 req_builder = req_builder.bearer_auth(token.to_owned());
614 };
615
616 let req = req_builder.build()?;
617 let resp = configuration.client.execute(req).await?;
618
619 let status = resp.status();
620
621 if !status.is_client_error() && !status.is_server_error() {
622 Ok(())
623 } else {
624 let content = resp.text().await?;
625 let entity: Option<DeleteTrustedOAuth2JwtGrantIssuerError> = serde_json::from_str(&content).ok();
626 Err(Error::ResponseError(ResponseContent { status, content, entity }))
627 }
628}
629
630pub async fn get_o_auth2_client(configuration: &configuration::Configuration, id: &str) -> Result<models::OAuth2Client, Error<GetOAuth2ClientError>> {
632 let p_path_id = id;
634
635 let uri_str = format!("{}/admin/clients/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
636 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
637
638 if let Some(ref user_agent) = configuration.user_agent {
639 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
640 }
641 if let Some(ref token) = configuration.bearer_access_token {
642 req_builder = req_builder.bearer_auth(token.to_owned());
643 };
644
645 let req = req_builder.build()?;
646 let resp = configuration.client.execute(req).await?;
647
648 let status = resp.status();
649 let content_type = resp
650 .headers()
651 .get("content-type")
652 .and_then(|v| v.to_str().ok())
653 .unwrap_or("application/octet-stream");
654 let content_type = super::ContentType::from(content_type);
655
656 if !status.is_client_error() && !status.is_server_error() {
657 let content = resp.text().await?;
658 match content_type {
659 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
660 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OAuth2Client`"))),
661 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::OAuth2Client`")))),
662 }
663 } else {
664 let content = resp.text().await?;
665 let entity: Option<GetOAuth2ClientError> = serde_json::from_str(&content).ok();
666 Err(Error::ResponseError(ResponseContent { status, content, entity }))
667 }
668}
669
670pub async fn get_o_auth2_consent_request(configuration: &configuration::Configuration, consent_challenge: &str) -> Result<models::OAuth2ConsentRequest, Error<GetOAuth2ConsentRequestError>> {
672 let p_query_consent_challenge = consent_challenge;
674
675 let uri_str = format!("{}/admin/oauth2/auth/requests/consent", configuration.base_path);
676 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
677
678 req_builder = req_builder.query(&[("consent_challenge", &p_query_consent_challenge.to_string())]);
679 if let Some(ref user_agent) = configuration.user_agent {
680 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
681 }
682 if let Some(ref token) = configuration.bearer_access_token {
683 req_builder = req_builder.bearer_auth(token.to_owned());
684 };
685
686 let req = req_builder.build()?;
687 let resp = configuration.client.execute(req).await?;
688
689 let status = resp.status();
690 let content_type = resp
691 .headers()
692 .get("content-type")
693 .and_then(|v| v.to_str().ok())
694 .unwrap_or("application/octet-stream");
695 let content_type = super::ContentType::from(content_type);
696
697 if !status.is_client_error() && !status.is_server_error() {
698 let content = resp.text().await?;
699 match content_type {
700 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
701 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OAuth2ConsentRequest`"))),
702 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::OAuth2ConsentRequest`")))),
703 }
704 } else {
705 let content = resp.text().await?;
706 let entity: Option<GetOAuth2ConsentRequestError> = serde_json::from_str(&content).ok();
707 Err(Error::ResponseError(ResponseContent { status, content, entity }))
708 }
709}
710
711pub async fn get_o_auth2_login_request(configuration: &configuration::Configuration, login_challenge: &str) -> Result<models::OAuth2LoginRequest, Error<GetOAuth2LoginRequestError>> {
713 let p_query_login_challenge = login_challenge;
715
716 let uri_str = format!("{}/admin/oauth2/auth/requests/login", configuration.base_path);
717 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
718
719 req_builder = req_builder.query(&[("login_challenge", &p_query_login_challenge.to_string())]);
720 if let Some(ref user_agent) = configuration.user_agent {
721 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
722 }
723 if let Some(ref token) = configuration.bearer_access_token {
724 req_builder = req_builder.bearer_auth(token.to_owned());
725 };
726
727 let req = req_builder.build()?;
728 let resp = configuration.client.execute(req).await?;
729
730 let status = resp.status();
731 let content_type = resp
732 .headers()
733 .get("content-type")
734 .and_then(|v| v.to_str().ok())
735 .unwrap_or("application/octet-stream");
736 let content_type = super::ContentType::from(content_type);
737
738 if !status.is_client_error() && !status.is_server_error() {
739 let content = resp.text().await?;
740 match content_type {
741 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
742 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OAuth2LoginRequest`"))),
743 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::OAuth2LoginRequest`")))),
744 }
745 } else {
746 let content = resp.text().await?;
747 let entity: Option<GetOAuth2LoginRequestError> = serde_json::from_str(&content).ok();
748 Err(Error::ResponseError(ResponseContent { status, content, entity }))
749 }
750}
751
752pub async fn get_o_auth2_logout_request(configuration: &configuration::Configuration, logout_challenge: &str) -> Result<models::OAuth2LogoutRequest, Error<GetOAuth2LogoutRequestError>> {
754 let p_query_logout_challenge = logout_challenge;
756
757 let uri_str = format!("{}/admin/oauth2/auth/requests/logout", configuration.base_path);
758 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
759
760 req_builder = req_builder.query(&[("logout_challenge", &p_query_logout_challenge.to_string())]);
761 if let Some(ref user_agent) = configuration.user_agent {
762 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
763 }
764 if let Some(ref token) = configuration.bearer_access_token {
765 req_builder = req_builder.bearer_auth(token.to_owned());
766 };
767
768 let req = req_builder.build()?;
769 let resp = configuration.client.execute(req).await?;
770
771 let status = resp.status();
772 let content_type = resp
773 .headers()
774 .get("content-type")
775 .and_then(|v| v.to_str().ok())
776 .unwrap_or("application/octet-stream");
777 let content_type = super::ContentType::from(content_type);
778
779 if !status.is_client_error() && !status.is_server_error() {
780 let content = resp.text().await?;
781 match content_type {
782 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
783 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OAuth2LogoutRequest`"))),
784 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::OAuth2LogoutRequest`")))),
785 }
786 } else {
787 let content = resp.text().await?;
788 let entity: Option<GetOAuth2LogoutRequestError> = serde_json::from_str(&content).ok();
789 Err(Error::ResponseError(ResponseContent { status, content, entity }))
790 }
791}
792
793pub async fn get_trusted_o_auth2_jwt_grant_issuer(configuration: &configuration::Configuration, id: &str) -> Result<models::TrustedOAuth2JwtGrantIssuer, Error<GetTrustedOAuth2JwtGrantIssuerError>> {
795 let p_path_id = id;
797
798 let uri_str = format!("{}/admin/trust/grants/jwt-bearer/issuers/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
799 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
800
801 if let Some(ref user_agent) = configuration.user_agent {
802 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
803 }
804 if let Some(ref token) = configuration.bearer_access_token {
805 req_builder = req_builder.bearer_auth(token.to_owned());
806 };
807
808 let req = req_builder.build()?;
809 let resp = configuration.client.execute(req).await?;
810
811 let status = resp.status();
812 let content_type = resp
813 .headers()
814 .get("content-type")
815 .and_then(|v| v.to_str().ok())
816 .unwrap_or("application/octet-stream");
817 let content_type = super::ContentType::from(content_type);
818
819 if !status.is_client_error() && !status.is_server_error() {
820 let content = resp.text().await?;
821 match content_type {
822 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
823 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TrustedOAuth2JwtGrantIssuer`"))),
824 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TrustedOAuth2JwtGrantIssuer`")))),
825 }
826 } else {
827 let content = resp.text().await?;
828 let entity: Option<GetTrustedOAuth2JwtGrantIssuerError> = serde_json::from_str(&content).ok();
829 Err(Error::ResponseError(ResponseContent { status, content, entity }))
830 }
831}
832
833pub async fn introspect_o_auth2_token(configuration: &configuration::Configuration, token: &str, scope: Option<&str>) -> Result<models::IntrospectedOAuth2Token, Error<IntrospectOAuth2TokenError>> {
835 let p_form_token = token;
837 let p_form_scope = scope;
838
839 let uri_str = format!("{}/admin/oauth2/introspect", configuration.base_path);
840 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
841
842 if let Some(ref user_agent) = configuration.user_agent {
843 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
844 }
845 if let Some(ref token) = configuration.bearer_access_token {
846 req_builder = req_builder.bearer_auth(token.to_owned());
847 };
848 let mut multipart_form_params = std::collections::HashMap::new();
849 if let Some(param_value) = p_form_scope {
850 multipart_form_params.insert("scope", param_value.to_string());
851 }
852 multipart_form_params.insert("token", p_form_token.to_string());
853 req_builder = req_builder.form(&multipart_form_params);
854
855 let req = req_builder.build()?;
856 let resp = configuration.client.execute(req).await?;
857
858 let status = resp.status();
859 let content_type = resp
860 .headers()
861 .get("content-type")
862 .and_then(|v| v.to_str().ok())
863 .unwrap_or("application/octet-stream");
864 let content_type = super::ContentType::from(content_type);
865
866 if !status.is_client_error() && !status.is_server_error() {
867 let content = resp.text().await?;
868 match content_type {
869 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
870 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IntrospectedOAuth2Token`"))),
871 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::IntrospectedOAuth2Token`")))),
872 }
873 } else {
874 let content = resp.text().await?;
875 let entity: Option<IntrospectOAuth2TokenError> = serde_json::from_str(&content).ok();
876 Err(Error::ResponseError(ResponseContent { status, content, entity }))
877 }
878}
879
880pub async fn list_o_auth2_clients(configuration: &configuration::Configuration, page_size: Option<i64>, page_token: Option<&str>, client_name: Option<&str>, owner: Option<&str>) -> Result<Vec<models::OAuth2Client>, Error<ListOAuth2ClientsError>> {
882 let p_query_page_size = page_size;
884 let p_query_page_token = page_token;
885 let p_query_client_name = client_name;
886 let p_query_owner = owner;
887
888 let uri_str = format!("{}/admin/clients", configuration.base_path);
889 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
890
891 if let Some(ref param_value) = p_query_page_size {
892 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
893 }
894 if let Some(ref param_value) = p_query_page_token {
895 req_builder = req_builder.query(&[("page_token", ¶m_value.to_string())]);
896 }
897 if let Some(ref param_value) = p_query_client_name {
898 req_builder = req_builder.query(&[("client_name", ¶m_value.to_string())]);
899 }
900 if let Some(ref param_value) = p_query_owner {
901 req_builder = req_builder.query(&[("owner", ¶m_value.to_string())]);
902 }
903 if let Some(ref user_agent) = configuration.user_agent {
904 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
905 }
906 if let Some(ref token) = configuration.bearer_access_token {
907 req_builder = req_builder.bearer_auth(token.to_owned());
908 };
909
910 let req = req_builder.build()?;
911 let resp = configuration.client.execute(req).await?;
912
913 let status = resp.status();
914 let content_type = resp
915 .headers()
916 .get("content-type")
917 .and_then(|v| v.to_str().ok())
918 .unwrap_or("application/octet-stream");
919 let content_type = super::ContentType::from(content_type);
920
921 if !status.is_client_error() && !status.is_server_error() {
922 let content = resp.text().await?;
923 match content_type {
924 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
925 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::OAuth2Client>`"))),
926 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::OAuth2Client>`")))),
927 }
928 } else {
929 let content = resp.text().await?;
930 let entity: Option<ListOAuth2ClientsError> = serde_json::from_str(&content).ok();
931 Err(Error::ResponseError(ResponseContent { status, content, entity }))
932 }
933}
934
935pub async fn list_o_auth2_consent_sessions(configuration: &configuration::Configuration, subject: &str, page_size: Option<i64>, page_token: Option<&str>, login_session_id: Option<&str>) -> Result<Vec<models::OAuth2ConsentSession>, Error<ListOAuth2ConsentSessionsError>> {
937 let p_query_subject = subject;
939 let p_query_page_size = page_size;
940 let p_query_page_token = page_token;
941 let p_query_login_session_id = login_session_id;
942
943 let uri_str = format!("{}/admin/oauth2/auth/sessions/consent", configuration.base_path);
944 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
945
946 if let Some(ref param_value) = p_query_page_size {
947 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
948 }
949 if let Some(ref param_value) = p_query_page_token {
950 req_builder = req_builder.query(&[("page_token", ¶m_value.to_string())]);
951 }
952 req_builder = req_builder.query(&[("subject", &p_query_subject.to_string())]);
953 if let Some(ref param_value) = p_query_login_session_id {
954 req_builder = req_builder.query(&[("login_session_id", ¶m_value.to_string())]);
955 }
956 if let Some(ref user_agent) = configuration.user_agent {
957 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
958 }
959 if let Some(ref token) = configuration.bearer_access_token {
960 req_builder = req_builder.bearer_auth(token.to_owned());
961 };
962
963 let req = req_builder.build()?;
964 let resp = configuration.client.execute(req).await?;
965
966 let status = resp.status();
967 let content_type = resp
968 .headers()
969 .get("content-type")
970 .and_then(|v| v.to_str().ok())
971 .unwrap_or("application/octet-stream");
972 let content_type = super::ContentType::from(content_type);
973
974 if !status.is_client_error() && !status.is_server_error() {
975 let content = resp.text().await?;
976 match content_type {
977 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
978 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::OAuth2ConsentSession>`"))),
979 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::OAuth2ConsentSession>`")))),
980 }
981 } else {
982 let content = resp.text().await?;
983 let entity: Option<ListOAuth2ConsentSessionsError> = serde_json::from_str(&content).ok();
984 Err(Error::ResponseError(ResponseContent { status, content, entity }))
985 }
986}
987
988pub async fn list_trusted_o_auth2_jwt_grant_issuers(configuration: &configuration::Configuration, page_size: Option<i64>, page_token: Option<&str>, issuer: Option<&str>) -> Result<Vec<models::TrustedOAuth2JwtGrantIssuer>, Error<ListTrustedOAuth2JwtGrantIssuersError>> {
990 let p_query_page_size = page_size;
992 let p_query_page_token = page_token;
993 let p_query_issuer = issuer;
994
995 let uri_str = format!("{}/admin/trust/grants/jwt-bearer/issuers", configuration.base_path);
996 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
997
998 if let Some(ref param_value) = p_query_page_size {
999 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
1000 }
1001 if let Some(ref param_value) = p_query_page_token {
1002 req_builder = req_builder.query(&[("page_token", ¶m_value.to_string())]);
1003 }
1004 if let Some(ref param_value) = p_query_issuer {
1005 req_builder = req_builder.query(&[("issuer", ¶m_value.to_string())]);
1006 }
1007 if let Some(ref user_agent) = configuration.user_agent {
1008 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1009 }
1010 if let Some(ref token) = configuration.bearer_access_token {
1011 req_builder = req_builder.bearer_auth(token.to_owned());
1012 };
1013
1014 let req = req_builder.build()?;
1015 let resp = configuration.client.execute(req).await?;
1016
1017 let status = resp.status();
1018 let content_type = resp
1019 .headers()
1020 .get("content-type")
1021 .and_then(|v| v.to_str().ok())
1022 .unwrap_or("application/octet-stream");
1023 let content_type = super::ContentType::from(content_type);
1024
1025 if !status.is_client_error() && !status.is_server_error() {
1026 let content = resp.text().await?;
1027 match content_type {
1028 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1029 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::TrustedOAuth2JwtGrantIssuer>`"))),
1030 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::TrustedOAuth2JwtGrantIssuer>`")))),
1031 }
1032 } else {
1033 let content = resp.text().await?;
1034 let entity: Option<ListTrustedOAuth2JwtGrantIssuersError> = serde_json::from_str(&content).ok();
1035 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1036 }
1037}
1038
1039pub async fn o_auth2_authorize(configuration: &configuration::Configuration, ) -> Result<models::ErrorOAuth2, Error<OAuth2AuthorizeError>> {
1041
1042 let uri_str = format!("{}/oauth2/auth", configuration.base_path);
1043 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1044
1045 if let Some(ref user_agent) = configuration.user_agent {
1046 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1047 }
1048
1049 let req = req_builder.build()?;
1050 let resp = configuration.client.execute(req).await?;
1051
1052 let status = resp.status();
1053 let content_type = resp
1054 .headers()
1055 .get("content-type")
1056 .and_then(|v| v.to_str().ok())
1057 .unwrap_or("application/octet-stream");
1058 let content_type = super::ContentType::from(content_type);
1059
1060 if !status.is_client_error() && !status.is_server_error() {
1061 let content = resp.text().await?;
1062 match content_type {
1063 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1064 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ErrorOAuth2`"))),
1065 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ErrorOAuth2`")))),
1066 }
1067 } else {
1068 let content = resp.text().await?;
1069 let entity: Option<OAuth2AuthorizeError> = serde_json::from_str(&content).ok();
1070 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1071 }
1072}
1073
1074pub async fn o_auth2_device_flow(configuration: &configuration::Configuration, ) -> Result<models::DeviceAuthorization, Error<OAuth2DeviceFlowError>> {
1076
1077 let uri_str = format!("{}/oauth2/device/auth", configuration.base_path);
1078 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1079
1080 if let Some(ref user_agent) = configuration.user_agent {
1081 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1082 }
1083
1084 let req = req_builder.build()?;
1085 let resp = configuration.client.execute(req).await?;
1086
1087 let status = resp.status();
1088 let content_type = resp
1089 .headers()
1090 .get("content-type")
1091 .and_then(|v| v.to_str().ok())
1092 .unwrap_or("application/octet-stream");
1093 let content_type = super::ContentType::from(content_type);
1094
1095 if !status.is_client_error() && !status.is_server_error() {
1096 let content = resp.text().await?;
1097 match content_type {
1098 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1099 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeviceAuthorization`"))),
1100 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DeviceAuthorization`")))),
1101 }
1102 } else {
1103 let content = resp.text().await?;
1104 let entity: Option<OAuth2DeviceFlowError> = serde_json::from_str(&content).ok();
1105 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1106 }
1107}
1108
1109pub async fn oauth2_token_exchange(configuration: &configuration::Configuration, grant_type: &str, client_id: Option<&str>, code: Option<&str>, redirect_uri: Option<&str>, refresh_token: Option<&str>) -> Result<models::OAuth2TokenExchange, Error<Oauth2TokenExchangeError>> {
1111 let p_form_grant_type = grant_type;
1113 let p_form_client_id = client_id;
1114 let p_form_code = code;
1115 let p_form_redirect_uri = redirect_uri;
1116 let p_form_refresh_token = refresh_token;
1117
1118 let uri_str = format!("{}/oauth2/token", configuration.base_path);
1119 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1120
1121 if let Some(ref user_agent) = configuration.user_agent {
1122 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1123 }
1124 if let Some(ref auth_conf) = configuration.basic_auth {
1125 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1126 };
1127 if let Some(ref token) = configuration.oauth_access_token {
1128 req_builder = req_builder.bearer_auth(token.to_owned());
1129 };
1130 let mut multipart_form_params = std::collections::HashMap::new();
1131 if let Some(param_value) = p_form_client_id {
1132 multipart_form_params.insert("client_id", param_value.to_string());
1133 }
1134 if let Some(param_value) = p_form_code {
1135 multipart_form_params.insert("code", param_value.to_string());
1136 }
1137 multipart_form_params.insert("grant_type", p_form_grant_type.to_string());
1138 if let Some(param_value) = p_form_redirect_uri {
1139 multipart_form_params.insert("redirect_uri", param_value.to_string());
1140 }
1141 if let Some(param_value) = p_form_refresh_token {
1142 multipart_form_params.insert("refresh_token", param_value.to_string());
1143 }
1144 req_builder = req_builder.form(&multipart_form_params);
1145
1146 let req = req_builder.build()?;
1147 let resp = configuration.client.execute(req).await?;
1148
1149 let status = resp.status();
1150 let content_type = resp
1151 .headers()
1152 .get("content-type")
1153 .and_then(|v| v.to_str().ok())
1154 .unwrap_or("application/octet-stream");
1155 let content_type = super::ContentType::from(content_type);
1156
1157 if !status.is_client_error() && !status.is_server_error() {
1158 let content = resp.text().await?;
1159 match content_type {
1160 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1161 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OAuth2TokenExchange`"))),
1162 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::OAuth2TokenExchange`")))),
1163 }
1164 } else {
1165 let content = resp.text().await?;
1166 let entity: Option<Oauth2TokenExchangeError> = serde_json::from_str(&content).ok();
1167 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1168 }
1169}
1170
1171pub async fn patch_o_auth2_client(configuration: &configuration::Configuration, id: &str, json_patch: Vec<models::JsonPatch>) -> Result<models::OAuth2Client, Error<PatchOAuth2ClientError>> {
1173 let p_path_id = id;
1175 let p_body_json_patch = json_patch;
1176
1177 let uri_str = format!("{}/admin/clients/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
1178 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1179
1180 if let Some(ref user_agent) = configuration.user_agent {
1181 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1182 }
1183 if let Some(ref token) = configuration.bearer_access_token {
1184 req_builder = req_builder.bearer_auth(token.to_owned());
1185 };
1186 req_builder = req_builder.json(&p_body_json_patch);
1187
1188 let req = req_builder.build()?;
1189 let resp = configuration.client.execute(req).await?;
1190
1191 let status = resp.status();
1192 let content_type = resp
1193 .headers()
1194 .get("content-type")
1195 .and_then(|v| v.to_str().ok())
1196 .unwrap_or("application/octet-stream");
1197 let content_type = super::ContentType::from(content_type);
1198
1199 if !status.is_client_error() && !status.is_server_error() {
1200 let content = resp.text().await?;
1201 match content_type {
1202 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1203 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OAuth2Client`"))),
1204 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::OAuth2Client`")))),
1205 }
1206 } else {
1207 let content = resp.text().await?;
1208 let entity: Option<PatchOAuth2ClientError> = serde_json::from_str(&content).ok();
1209 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1210 }
1211}
1212
1213pub async fn perform_o_auth2_device_verification_flow(configuration: &configuration::Configuration, ) -> Result<models::ErrorOAuth2, Error<PerformOAuth2DeviceVerificationFlowError>> {
1215
1216 let uri_str = format!("{}/oauth2/device/verify", configuration.base_path);
1217 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1218
1219 if let Some(ref user_agent) = configuration.user_agent {
1220 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1221 }
1222
1223 let req = req_builder.build()?;
1224 let resp = configuration.client.execute(req).await?;
1225
1226 let status = resp.status();
1227 let content_type = resp
1228 .headers()
1229 .get("content-type")
1230 .and_then(|v| v.to_str().ok())
1231 .unwrap_or("application/octet-stream");
1232 let content_type = super::ContentType::from(content_type);
1233
1234 if !status.is_client_error() && !status.is_server_error() {
1235 let content = resp.text().await?;
1236 match content_type {
1237 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1238 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ErrorOAuth2`"))),
1239 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::ErrorOAuth2`")))),
1240 }
1241 } else {
1242 let content = resp.text().await?;
1243 let entity: Option<PerformOAuth2DeviceVerificationFlowError> = serde_json::from_str(&content).ok();
1244 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1245 }
1246}
1247
1248pub async fn reject_o_auth2_consent_request(configuration: &configuration::Configuration, consent_challenge: &str, reject_o_auth2_request: Option<models::RejectOAuth2Request>) -> Result<models::OAuth2RedirectTo, Error<RejectOAuth2ConsentRequestError>> {
1250 let p_query_consent_challenge = consent_challenge;
1252 let p_body_reject_o_auth2_request = reject_o_auth2_request;
1253
1254 let uri_str = format!("{}/admin/oauth2/auth/requests/consent/reject", configuration.base_path);
1255 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1256
1257 req_builder = req_builder.query(&[("consent_challenge", &p_query_consent_challenge.to_string())]);
1258 if let Some(ref user_agent) = configuration.user_agent {
1259 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1260 }
1261 if let Some(ref token) = configuration.bearer_access_token {
1262 req_builder = req_builder.bearer_auth(token.to_owned());
1263 };
1264 req_builder = req_builder.json(&p_body_reject_o_auth2_request);
1265
1266 let req = req_builder.build()?;
1267 let resp = configuration.client.execute(req).await?;
1268
1269 let status = resp.status();
1270 let content_type = resp
1271 .headers()
1272 .get("content-type")
1273 .and_then(|v| v.to_str().ok())
1274 .unwrap_or("application/octet-stream");
1275 let content_type = super::ContentType::from(content_type);
1276
1277 if !status.is_client_error() && !status.is_server_error() {
1278 let content = resp.text().await?;
1279 match content_type {
1280 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1281 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OAuth2RedirectTo`"))),
1282 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::OAuth2RedirectTo`")))),
1283 }
1284 } else {
1285 let content = resp.text().await?;
1286 let entity: Option<RejectOAuth2ConsentRequestError> = serde_json::from_str(&content).ok();
1287 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1288 }
1289}
1290
1291pub async fn reject_o_auth2_login_request(configuration: &configuration::Configuration, login_challenge: &str, reject_o_auth2_request: Option<models::RejectOAuth2Request>) -> Result<models::OAuth2RedirectTo, Error<RejectOAuth2LoginRequestError>> {
1293 let p_query_login_challenge = login_challenge;
1295 let p_body_reject_o_auth2_request = reject_o_auth2_request;
1296
1297 let uri_str = format!("{}/admin/oauth2/auth/requests/login/reject", configuration.base_path);
1298 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1299
1300 req_builder = req_builder.query(&[("login_challenge", &p_query_login_challenge.to_string())]);
1301 if let Some(ref user_agent) = configuration.user_agent {
1302 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1303 }
1304 if let Some(ref token) = configuration.bearer_access_token {
1305 req_builder = req_builder.bearer_auth(token.to_owned());
1306 };
1307 req_builder = req_builder.json(&p_body_reject_o_auth2_request);
1308
1309 let req = req_builder.build()?;
1310 let resp = configuration.client.execute(req).await?;
1311
1312 let status = resp.status();
1313 let content_type = resp
1314 .headers()
1315 .get("content-type")
1316 .and_then(|v| v.to_str().ok())
1317 .unwrap_or("application/octet-stream");
1318 let content_type = super::ContentType::from(content_type);
1319
1320 if !status.is_client_error() && !status.is_server_error() {
1321 let content = resp.text().await?;
1322 match content_type {
1323 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1324 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OAuth2RedirectTo`"))),
1325 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::OAuth2RedirectTo`")))),
1326 }
1327 } else {
1328 let content = resp.text().await?;
1329 let entity: Option<RejectOAuth2LoginRequestError> = serde_json::from_str(&content).ok();
1330 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1331 }
1332}
1333
1334pub async fn reject_o_auth2_logout_request(configuration: &configuration::Configuration, logout_challenge: &str) -> Result<(), Error<RejectOAuth2LogoutRequestError>> {
1336 let p_query_logout_challenge = logout_challenge;
1338
1339 let uri_str = format!("{}/admin/oauth2/auth/requests/logout/reject", configuration.base_path);
1340 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1341
1342 req_builder = req_builder.query(&[("logout_challenge", &p_query_logout_challenge.to_string())]);
1343 if let Some(ref user_agent) = configuration.user_agent {
1344 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1345 }
1346 if let Some(ref token) = configuration.bearer_access_token {
1347 req_builder = req_builder.bearer_auth(token.to_owned());
1348 };
1349
1350 let req = req_builder.build()?;
1351 let resp = configuration.client.execute(req).await?;
1352
1353 let status = resp.status();
1354
1355 if !status.is_client_error() && !status.is_server_error() {
1356 Ok(())
1357 } else {
1358 let content = resp.text().await?;
1359 let entity: Option<RejectOAuth2LogoutRequestError> = serde_json::from_str(&content).ok();
1360 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1361 }
1362}
1363
1364pub async fn revoke_o_auth2_consent_sessions(configuration: &configuration::Configuration, subject: Option<&str>, client: Option<&str>, consent_request_id: Option<&str>, all: Option<bool>) -> Result<(), Error<RevokeOAuth2ConsentSessionsError>> {
1366 let p_query_subject = subject;
1368 let p_query_client = client;
1369 let p_query_consent_request_id = consent_request_id;
1370 let p_query_all = all;
1371
1372 let uri_str = format!("{}/admin/oauth2/auth/sessions/consent", configuration.base_path);
1373 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1374
1375 if let Some(ref param_value) = p_query_subject {
1376 req_builder = req_builder.query(&[("subject", ¶m_value.to_string())]);
1377 }
1378 if let Some(ref param_value) = p_query_client {
1379 req_builder = req_builder.query(&[("client", ¶m_value.to_string())]);
1380 }
1381 if let Some(ref param_value) = p_query_consent_request_id {
1382 req_builder = req_builder.query(&[("consent_request_id", ¶m_value.to_string())]);
1383 }
1384 if let Some(ref param_value) = p_query_all {
1385 req_builder = req_builder.query(&[("all", ¶m_value.to_string())]);
1386 }
1387 if let Some(ref user_agent) = configuration.user_agent {
1388 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1389 }
1390 if let Some(ref token) = configuration.bearer_access_token {
1391 req_builder = req_builder.bearer_auth(token.to_owned());
1392 };
1393
1394 let req = req_builder.build()?;
1395 let resp = configuration.client.execute(req).await?;
1396
1397 let status = resp.status();
1398
1399 if !status.is_client_error() && !status.is_server_error() {
1400 Ok(())
1401 } else {
1402 let content = resp.text().await?;
1403 let entity: Option<RevokeOAuth2ConsentSessionsError> = serde_json::from_str(&content).ok();
1404 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1405 }
1406}
1407
1408pub async fn revoke_o_auth2_login_sessions(configuration: &configuration::Configuration, subject: Option<&str>, sid: Option<&str>) -> Result<(), Error<RevokeOAuth2LoginSessionsError>> {
1410 let p_query_subject = subject;
1412 let p_query_sid = sid;
1413
1414 let uri_str = format!("{}/admin/oauth2/auth/sessions/login", configuration.base_path);
1415 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
1416
1417 if let Some(ref param_value) = p_query_subject {
1418 req_builder = req_builder.query(&[("subject", ¶m_value.to_string())]);
1419 }
1420 if let Some(ref param_value) = p_query_sid {
1421 req_builder = req_builder.query(&[("sid", ¶m_value.to_string())]);
1422 }
1423 if let Some(ref user_agent) = configuration.user_agent {
1424 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1425 }
1426 if let Some(ref token) = configuration.bearer_access_token {
1427 req_builder = req_builder.bearer_auth(token.to_owned());
1428 };
1429
1430 let req = req_builder.build()?;
1431 let resp = configuration.client.execute(req).await?;
1432
1433 let status = resp.status();
1434
1435 if !status.is_client_error() && !status.is_server_error() {
1436 Ok(())
1437 } else {
1438 let content = resp.text().await?;
1439 let entity: Option<RevokeOAuth2LoginSessionsError> = serde_json::from_str(&content).ok();
1440 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1441 }
1442}
1443
1444pub async fn revoke_o_auth2_token(configuration: &configuration::Configuration, token: &str, client_id: Option<&str>, client_secret: Option<&str>) -> Result<(), Error<RevokeOAuth2TokenError>> {
1446 let p_form_token = token;
1448 let p_form_client_id = client_id;
1449 let p_form_client_secret = client_secret;
1450
1451 let uri_str = format!("{}/oauth2/revoke", configuration.base_path);
1452 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1453
1454 if let Some(ref user_agent) = configuration.user_agent {
1455 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1456 }
1457 if let Some(ref auth_conf) = configuration.basic_auth {
1458 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
1459 };
1460 if let Some(ref token) = configuration.oauth_access_token {
1461 req_builder = req_builder.bearer_auth(token.to_owned());
1462 };
1463 let mut multipart_form_params = std::collections::HashMap::new();
1464 if let Some(param_value) = p_form_client_id {
1465 multipart_form_params.insert("client_id", param_value.to_string());
1466 }
1467 if let Some(param_value) = p_form_client_secret {
1468 multipart_form_params.insert("client_secret", param_value.to_string());
1469 }
1470 multipart_form_params.insert("token", p_form_token.to_string());
1471 req_builder = req_builder.form(&multipart_form_params);
1472
1473 let req = req_builder.build()?;
1474 let resp = configuration.client.execute(req).await?;
1475
1476 let status = resp.status();
1477
1478 if !status.is_client_error() && !status.is_server_error() {
1479 Ok(())
1480 } else {
1481 let content = resp.text().await?;
1482 let entity: Option<RevokeOAuth2TokenError> = serde_json::from_str(&content).ok();
1483 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1484 }
1485}
1486
1487pub async fn rotate_o_auth2_client_secret(configuration: &configuration::Configuration, id: &str) -> Result<models::OAuth2Client, Error<RotateOAuth2ClientSecretError>> {
1489 let p_path_id = id;
1491
1492 let uri_str = format!("{}/admin/clients/{id}/secrets/rotate", configuration.base_path, id=crate::apis::urlencode(p_path_id));
1493 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1494
1495 if let Some(ref user_agent) = configuration.user_agent {
1496 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1497 }
1498 if let Some(ref token) = configuration.bearer_access_token {
1499 req_builder = req_builder.bearer_auth(token.to_owned());
1500 };
1501
1502 let req = req_builder.build()?;
1503 let resp = configuration.client.execute(req).await?;
1504
1505 let status = resp.status();
1506 let content_type = resp
1507 .headers()
1508 .get("content-type")
1509 .and_then(|v| v.to_str().ok())
1510 .unwrap_or("application/octet-stream");
1511 let content_type = super::ContentType::from(content_type);
1512
1513 if !status.is_client_error() && !status.is_server_error() {
1514 let content = resp.text().await?;
1515 match content_type {
1516 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1517 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OAuth2Client`"))),
1518 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::OAuth2Client`")))),
1519 }
1520 } else {
1521 let content = resp.text().await?;
1522 let entity: Option<RotateOAuth2ClientSecretError> = serde_json::from_str(&content).ok();
1523 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1524 }
1525}
1526
1527pub async fn set_o_auth2_client(configuration: &configuration::Configuration, id: &str, o_auth2_client: models::OAuth2Client) -> Result<models::OAuth2Client, Error<SetOAuth2ClientError>> {
1529 let p_path_id = id;
1531 let p_body_o_auth2_client = o_auth2_client;
1532
1533 let uri_str = format!("{}/admin/clients/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
1534 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1535
1536 if let Some(ref user_agent) = configuration.user_agent {
1537 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1538 }
1539 if let Some(ref token) = configuration.bearer_access_token {
1540 req_builder = req_builder.bearer_auth(token.to_owned());
1541 };
1542 req_builder = req_builder.json(&p_body_o_auth2_client);
1543
1544 let req = req_builder.build()?;
1545 let resp = configuration.client.execute(req).await?;
1546
1547 let status = resp.status();
1548 let content_type = resp
1549 .headers()
1550 .get("content-type")
1551 .and_then(|v| v.to_str().ok())
1552 .unwrap_or("application/octet-stream");
1553 let content_type = super::ContentType::from(content_type);
1554
1555 if !status.is_client_error() && !status.is_server_error() {
1556 let content = resp.text().await?;
1557 match content_type {
1558 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1559 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OAuth2Client`"))),
1560 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::OAuth2Client`")))),
1561 }
1562 } else {
1563 let content = resp.text().await?;
1564 let entity: Option<SetOAuth2ClientError> = serde_json::from_str(&content).ok();
1565 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1566 }
1567}
1568
1569pub async fn set_o_auth2_client_lifespans(configuration: &configuration::Configuration, id: &str, o_auth2_client_token_lifespans: Option<models::OAuth2ClientTokenLifespans>) -> Result<models::OAuth2Client, Error<SetOAuth2ClientLifespansError>> {
1571 let p_path_id = id;
1573 let p_body_o_auth2_client_token_lifespans = o_auth2_client_token_lifespans;
1574
1575 let uri_str = format!("{}/admin/clients/{id}/lifespans", configuration.base_path, id=crate::apis::urlencode(p_path_id));
1576 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1577
1578 if let Some(ref user_agent) = configuration.user_agent {
1579 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1580 }
1581 if let Some(ref token) = configuration.bearer_access_token {
1582 req_builder = req_builder.bearer_auth(token.to_owned());
1583 };
1584 req_builder = req_builder.json(&p_body_o_auth2_client_token_lifespans);
1585
1586 let req = req_builder.build()?;
1587 let resp = configuration.client.execute(req).await?;
1588
1589 let status = resp.status();
1590 let content_type = resp
1591 .headers()
1592 .get("content-type")
1593 .and_then(|v| v.to_str().ok())
1594 .unwrap_or("application/octet-stream");
1595 let content_type = super::ContentType::from(content_type);
1596
1597 if !status.is_client_error() && !status.is_server_error() {
1598 let content = resp.text().await?;
1599 match content_type {
1600 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1601 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OAuth2Client`"))),
1602 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::OAuth2Client`")))),
1603 }
1604 } else {
1605 let content = resp.text().await?;
1606 let entity: Option<SetOAuth2ClientLifespansError> = serde_json::from_str(&content).ok();
1607 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1608 }
1609}
1610
1611pub async fn trust_o_auth2_jwt_grant_issuer(configuration: &configuration::Configuration, trust_o_auth2_jwt_grant_issuer: Option<models::TrustOAuth2JwtGrantIssuer>) -> Result<models::TrustedOAuth2JwtGrantIssuer, Error<TrustOAuth2JwtGrantIssuerError>> {
1613 let p_body_trust_o_auth2_jwt_grant_issuer = trust_o_auth2_jwt_grant_issuer;
1615
1616 let uri_str = format!("{}/admin/trust/grants/jwt-bearer/issuers", configuration.base_path);
1617 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1618
1619 if let Some(ref user_agent) = configuration.user_agent {
1620 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1621 }
1622 if let Some(ref token) = configuration.bearer_access_token {
1623 req_builder = req_builder.bearer_auth(token.to_owned());
1624 };
1625 req_builder = req_builder.json(&p_body_trust_o_auth2_jwt_grant_issuer);
1626
1627 let req = req_builder.build()?;
1628 let resp = configuration.client.execute(req).await?;
1629
1630 let status = resp.status();
1631 let content_type = resp
1632 .headers()
1633 .get("content-type")
1634 .and_then(|v| v.to_str().ok())
1635 .unwrap_or("application/octet-stream");
1636 let content_type = super::ContentType::from(content_type);
1637
1638 if !status.is_client_error() && !status.is_server_error() {
1639 let content = resp.text().await?;
1640 match content_type {
1641 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1642 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TrustedOAuth2JwtGrantIssuer`"))),
1643 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::TrustedOAuth2JwtGrantIssuer`")))),
1644 }
1645 } else {
1646 let content = resp.text().await?;
1647 let entity: Option<TrustOAuth2JwtGrantIssuerError> = serde_json::from_str(&content).ok();
1648 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1649 }
1650}
1651