ory_client/apis/
o_auth2_api.rs

1/*
2 * Ory APIs
3 *
4 * # Introduction Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers.  ## SDKs This document describes the APIs available in the Ory Network. The APIs are available as SDKs for the following languages:  | Language       | Download SDK                                                     | Documentation                                                                        | | -------------- | ---------------------------------------------------------------- | ------------------------------------------------------------------------------------ | | Dart           | [pub.dev](https://pub.dev/packages/ory_client)                   | [README](https://github.com/ory/sdk/blob/master/clients/client/dart/README.md)       | | .NET           | [nuget.org](https://www.nuget.org/packages/Ory.Client/)          | [README](https://github.com/ory/sdk/blob/master/clients/client/dotnet/README.md)     | | Elixir         | [hex.pm](https://hex.pm/packages/ory_client)                     | [README](https://github.com/ory/sdk/blob/master/clients/client/elixir/README.md)     | | Go             | [github.com](https://github.com/ory/client-go)                   | [README](https://github.com/ory/sdk/blob/master/clients/client/go/README.md)         | | Java           | [maven.org](https://search.maven.org/artifact/sh.ory/ory-client) | [README](https://github.com/ory/sdk/blob/master/clients/client/java/README.md)       | | JavaScript     | [npmjs.com](https://www.npmjs.com/package/@ory/client)           | [README](https://github.com/ory/sdk/blob/master/clients/client/typescript/README.md) | | JavaScript (With fetch) | [npmjs.com](https://www.npmjs.com/package/@ory/client-fetch)           | [README](https://github.com/ory/sdk/blob/master/clients/client/typescript-fetch/README.md) |  | PHP            | [packagist.org](https://packagist.org/packages/ory/client)       | [README](https://github.com/ory/sdk/blob/master/clients/client/php/README.md)        | | Python         | [pypi.org](https://pypi.org/project/ory-client/)                 | [README](https://github.com/ory/sdk/blob/master/clients/client/python/README.md)     | | Ruby           | [rubygems.org](https://rubygems.org/gems/ory-client)             | [README](https://github.com/ory/sdk/blob/master/clients/client/ruby/README.md)       | | Rust           | [crates.io](https://crates.io/crates/ory-client)                 | [README](https://github.com/ory/sdk/blob/master/clients/client/rust/README.md)       | 
5 *
6 * The version of the OpenAPI document: v1.17.2
7 * Contact: support@ory.sh
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17
18/// struct for typed errors of method [`accept_o_auth2_consent_request`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum AcceptOAuth2ConsentRequestError {
22    DefaultResponse(models::ErrorOAuth2),
23    UnknownValue(serde_json::Value),
24}
25
26/// struct for typed errors of method [`accept_o_auth2_login_request`]
27#[derive(Debug, Clone, Serialize, Deserialize)]
28#[serde(untagged)]
29pub enum AcceptOAuth2LoginRequestError {
30    DefaultResponse(models::ErrorOAuth2),
31    UnknownValue(serde_json::Value),
32}
33
34/// struct for typed errors of method [`accept_o_auth2_logout_request`]
35#[derive(Debug, Clone, Serialize, Deserialize)]
36#[serde(untagged)]
37pub enum AcceptOAuth2LogoutRequestError {
38    DefaultResponse(models::ErrorOAuth2),
39    UnknownValue(serde_json::Value),
40}
41
42/// struct for typed errors of method [`create_o_auth2_client`]
43#[derive(Debug, Clone, Serialize, Deserialize)]
44#[serde(untagged)]
45pub enum CreateOAuth2ClientError {
46    Status400(models::ErrorOAuth2),
47    DefaultResponse(models::ErrorOAuth2),
48    UnknownValue(serde_json::Value),
49}
50
51/// struct for typed errors of method [`delete_o_auth2_client`]
52#[derive(Debug, Clone, Serialize, Deserialize)]
53#[serde(untagged)]
54pub enum DeleteOAuth2ClientError {
55    DefaultResponse(models::GenericError),
56    UnknownValue(serde_json::Value),
57}
58
59/// struct for typed errors of method [`delete_o_auth2_token`]
60#[derive(Debug, Clone, Serialize, Deserialize)]
61#[serde(untagged)]
62pub enum DeleteOAuth2TokenError {
63    DefaultResponse(models::ErrorOAuth2),
64    UnknownValue(serde_json::Value),
65}
66
67/// struct for typed errors of method [`delete_trusted_o_auth2_jwt_grant_issuer`]
68#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum DeleteTrustedOAuth2JwtGrantIssuerError {
71    DefaultResponse(models::GenericError),
72    UnknownValue(serde_json::Value),
73}
74
75/// struct for typed errors of method [`get_o_auth2_client`]
76#[derive(Debug, Clone, Serialize, Deserialize)]
77#[serde(untagged)]
78pub enum GetOAuth2ClientError {
79    DefaultResponse(models::ErrorOAuth2),
80    UnknownValue(serde_json::Value),
81}
82
83/// struct for typed errors of method [`get_o_auth2_consent_request`]
84#[derive(Debug, Clone, Serialize, Deserialize)]
85#[serde(untagged)]
86pub enum GetOAuth2ConsentRequestError {
87    Status410(models::OAuth2RedirectTo),
88    DefaultResponse(models::ErrorOAuth2),
89    UnknownValue(serde_json::Value),
90}
91
92/// struct for typed errors of method [`get_o_auth2_login_request`]
93#[derive(Debug, Clone, Serialize, Deserialize)]
94#[serde(untagged)]
95pub enum GetOAuth2LoginRequestError {
96    Status410(models::OAuth2RedirectTo),
97    DefaultResponse(models::ErrorOAuth2),
98    UnknownValue(serde_json::Value),
99}
100
101/// struct for typed errors of method [`get_o_auth2_logout_request`]
102#[derive(Debug, Clone, Serialize, Deserialize)]
103#[serde(untagged)]
104pub enum GetOAuth2LogoutRequestError {
105    Status410(models::OAuth2RedirectTo),
106    DefaultResponse(models::ErrorOAuth2),
107    UnknownValue(serde_json::Value),
108}
109
110/// struct for typed errors of method [`get_trusted_o_auth2_jwt_grant_issuer`]
111#[derive(Debug, Clone, Serialize, Deserialize)]
112#[serde(untagged)]
113pub enum GetTrustedOAuth2JwtGrantIssuerError {
114    DefaultResponse(models::GenericError),
115    UnknownValue(serde_json::Value),
116}
117
118/// struct for typed errors of method [`introspect_o_auth2_token`]
119#[derive(Debug, Clone, Serialize, Deserialize)]
120#[serde(untagged)]
121pub enum IntrospectOAuth2TokenError {
122    DefaultResponse(models::ErrorOAuth2),
123    UnknownValue(serde_json::Value),
124}
125
126/// struct for typed errors of method [`list_o_auth2_clients`]
127#[derive(Debug, Clone, Serialize, Deserialize)]
128#[serde(untagged)]
129pub enum ListOAuth2ClientsError {
130    DefaultResponse(models::ErrorOAuth2),
131    UnknownValue(serde_json::Value),
132}
133
134/// struct for typed errors of method [`list_o_auth2_consent_sessions`]
135#[derive(Debug, Clone, Serialize, Deserialize)]
136#[serde(untagged)]
137pub enum ListOAuth2ConsentSessionsError {
138    DefaultResponse(models::ErrorOAuth2),
139    UnknownValue(serde_json::Value),
140}
141
142/// struct for typed errors of method [`list_trusted_o_auth2_jwt_grant_issuers`]
143#[derive(Debug, Clone, Serialize, Deserialize)]
144#[serde(untagged)]
145pub enum ListTrustedOAuth2JwtGrantIssuersError {
146    DefaultResponse(models::GenericError),
147    UnknownValue(serde_json::Value),
148}
149
150/// struct for typed errors of method [`o_auth2_authorize`]
151#[derive(Debug, Clone, Serialize, Deserialize)]
152#[serde(untagged)]
153pub enum OAuth2AuthorizeError {
154    DefaultResponse(models::ErrorOAuth2),
155    UnknownValue(serde_json::Value),
156}
157
158/// struct for typed errors of method [`oauth2_token_exchange`]
159#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum Oauth2TokenExchangeError {
162    DefaultResponse(models::ErrorOAuth2),
163    UnknownValue(serde_json::Value),
164}
165
166/// struct for typed errors of method [`patch_o_auth2_client`]
167#[derive(Debug, Clone, Serialize, Deserialize)]
168#[serde(untagged)]
169pub enum PatchOAuth2ClientError {
170    Status404(models::ErrorOAuth2),
171    DefaultResponse(models::ErrorOAuth2),
172    UnknownValue(serde_json::Value),
173}
174
175/// struct for typed errors of method [`reject_o_auth2_consent_request`]
176#[derive(Debug, Clone, Serialize, Deserialize)]
177#[serde(untagged)]
178pub enum RejectOAuth2ConsentRequestError {
179    DefaultResponse(models::ErrorOAuth2),
180    UnknownValue(serde_json::Value),
181}
182
183/// struct for typed errors of method [`reject_o_auth2_login_request`]
184#[derive(Debug, Clone, Serialize, Deserialize)]
185#[serde(untagged)]
186pub enum RejectOAuth2LoginRequestError {
187    DefaultResponse(models::ErrorOAuth2),
188    UnknownValue(serde_json::Value),
189}
190
191/// struct for typed errors of method [`reject_o_auth2_logout_request`]
192#[derive(Debug, Clone, Serialize, Deserialize)]
193#[serde(untagged)]
194pub enum RejectOAuth2LogoutRequestError {
195    DefaultResponse(models::ErrorOAuth2),
196    UnknownValue(serde_json::Value),
197}
198
199/// struct for typed errors of method [`revoke_o_auth2_consent_sessions`]
200#[derive(Debug, Clone, Serialize, Deserialize)]
201#[serde(untagged)]
202pub enum RevokeOAuth2ConsentSessionsError {
203    DefaultResponse(models::ErrorOAuth2),
204    UnknownValue(serde_json::Value),
205}
206
207/// struct for typed errors of method [`revoke_o_auth2_login_sessions`]
208#[derive(Debug, Clone, Serialize, Deserialize)]
209#[serde(untagged)]
210pub enum RevokeOAuth2LoginSessionsError {
211    DefaultResponse(models::ErrorOAuth2),
212    UnknownValue(serde_json::Value),
213}
214
215/// struct for typed errors of method [`revoke_o_auth2_token`]
216#[derive(Debug, Clone, Serialize, Deserialize)]
217#[serde(untagged)]
218pub enum RevokeOAuth2TokenError {
219    DefaultResponse(models::ErrorOAuth2),
220    UnknownValue(serde_json::Value),
221}
222
223/// struct for typed errors of method [`set_o_auth2_client`]
224#[derive(Debug, Clone, Serialize, Deserialize)]
225#[serde(untagged)]
226pub enum SetOAuth2ClientError {
227    Status400(models::ErrorOAuth2),
228    Status404(models::ErrorOAuth2),
229    DefaultResponse(models::ErrorOAuth2),
230    UnknownValue(serde_json::Value),
231}
232
233/// struct for typed errors of method [`set_o_auth2_client_lifespans`]
234#[derive(Debug, Clone, Serialize, Deserialize)]
235#[serde(untagged)]
236pub enum SetOAuth2ClientLifespansError {
237    DefaultResponse(models::GenericError),
238    UnknownValue(serde_json::Value),
239}
240
241/// struct for typed errors of method [`trust_o_auth2_jwt_grant_issuer`]
242#[derive(Debug, Clone, Serialize, Deserialize)]
243#[serde(untagged)]
244pub enum TrustOAuth2JwtGrantIssuerError {
245    DefaultResponse(models::GenericError),
246    UnknownValue(serde_json::Value),
247}
248
249
250/// When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, Ory asks the login provider to authenticate the subject and then tell Ory now about it. If the subject authenticated, he/she must now be asked if the OAuth 2.0 Client which initiated the flow should be allowed to access the resources on the subject's behalf.  The consent challenge is appended to the consent provider's URL to which the subject's user-agent (browser) is redirected to. The consent provider uses that challenge to fetch information on the OAuth2 request and then tells Ory if the subject accepted or rejected the request.  This endpoint tells Ory that the subject has authorized the OAuth 2.0 client to access resources on his/her behalf. The consent provider includes additional information, such as session data for access and ID tokens, and if the consent request should be used as basis for future requests.  The response contains a redirect URL which the consent provider should redirect the user-agent to.  The default consent provider is available via the Ory Managed Account Experience. To customize the consent provider, please head over to the OAuth 2.0 documentation.
251pub 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>> {
252    let local_var_configuration = configuration;
253
254    let local_var_client = &local_var_configuration.client;
255
256    let local_var_uri_str = format!("{}/admin/oauth2/auth/requests/consent/accept", local_var_configuration.base_path);
257    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
258
259    local_var_req_builder = local_var_req_builder.query(&[("consent_challenge", &consent_challenge.to_string())]);
260    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
261        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
262    }
263    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
264        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
265    };
266    local_var_req_builder = local_var_req_builder.json(&accept_o_auth2_consent_request);
267
268    let local_var_req = local_var_req_builder.build()?;
269    let local_var_resp = local_var_client.execute(local_var_req).await?;
270
271    let local_var_status = local_var_resp.status();
272    let local_var_content = local_var_resp.text().await?;
273
274    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
275        serde_json::from_str(&local_var_content).map_err(Error::from)
276    } else {
277        let local_var_entity: Option<AcceptOAuth2ConsentRequestError> = serde_json::from_str(&local_var_content).ok();
278        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
279        Err(Error::ResponseError(local_var_error))
280    }
281}
282
283/// When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, Ory asks the login provider to authenticate the subject and then tell the Ory OAuth2 Service about it.  The authentication challenge is appended to the login provider URL to which the subject's user-agent (browser) is redirected to. The login provider uses that challenge to fetch information on the OAuth2 request and then accept or reject the requested authentication process.  This endpoint tells Ory that the subject has successfully authenticated and includes additional information such as the subject's ID and if Ory should remember the subject's subject agent for future authentication attempts by setting a cookie.  The response contains a redirect URL which the login provider should redirect the user-agent to.
284pub 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>> {
285    let local_var_configuration = configuration;
286
287    let local_var_client = &local_var_configuration.client;
288
289    let local_var_uri_str = format!("{}/admin/oauth2/auth/requests/login/accept", local_var_configuration.base_path);
290    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
291
292    local_var_req_builder = local_var_req_builder.query(&[("login_challenge", &login_challenge.to_string())]);
293    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
294        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
295    }
296    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
297        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
298    };
299    local_var_req_builder = local_var_req_builder.json(&accept_o_auth2_login_request);
300
301    let local_var_req = local_var_req_builder.build()?;
302    let local_var_resp = local_var_client.execute(local_var_req).await?;
303
304    let local_var_status = local_var_resp.status();
305    let local_var_content = local_var_resp.text().await?;
306
307    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
308        serde_json::from_str(&local_var_content).map_err(Error::from)
309    } else {
310        let local_var_entity: Option<AcceptOAuth2LoginRequestError> = serde_json::from_str(&local_var_content).ok();
311        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
312        Err(Error::ResponseError(local_var_error))
313    }
314}
315
316/// When a user or an application requests Ory OAuth 2.0 to remove the session state of a subject, this endpoint is used to confirm that logout request.  The response contains a redirect URL which the consent provider should redirect the user-agent to.
317pub async fn accept_o_auth2_logout_request(configuration: &configuration::Configuration, logout_challenge: &str) -> Result<models::OAuth2RedirectTo, Error<AcceptOAuth2LogoutRequestError>> {
318    let local_var_configuration = configuration;
319
320    let local_var_client = &local_var_configuration.client;
321
322    let local_var_uri_str = format!("{}/admin/oauth2/auth/requests/logout/accept", local_var_configuration.base_path);
323    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
324
325    local_var_req_builder = local_var_req_builder.query(&[("logout_challenge", &logout_challenge.to_string())]);
326    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
327        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
328    }
329    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
330        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
331    };
332
333    let local_var_req = local_var_req_builder.build()?;
334    let local_var_resp = local_var_client.execute(local_var_req).await?;
335
336    let local_var_status = local_var_resp.status();
337    let local_var_content = local_var_resp.text().await?;
338
339    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
340        serde_json::from_str(&local_var_content).map_err(Error::from)
341    } else {
342        let local_var_entity: Option<AcceptOAuth2LogoutRequestError> = serde_json::from_str(&local_var_content).ok();
343        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
344        Err(Error::ResponseError(local_var_error))
345    }
346}
347
348/// Create a new OAuth 2.0 client. If you pass `client_secret` the secret is used, otherwise a random secret is generated. The secret is echoed in the response. It is not possible to retrieve it later on.
349pub async fn create_o_auth2_client(configuration: &configuration::Configuration, o_auth2_client: models::OAuth2Client) -> Result<models::OAuth2Client, Error<CreateOAuth2ClientError>> {
350    let local_var_configuration = configuration;
351
352    let local_var_client = &local_var_configuration.client;
353
354    let local_var_uri_str = format!("{}/admin/clients", local_var_configuration.base_path);
355    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
356
357    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
358        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
359    }
360    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
361        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
362    };
363    local_var_req_builder = local_var_req_builder.json(&o_auth2_client);
364
365    let local_var_req = local_var_req_builder.build()?;
366    let local_var_resp = local_var_client.execute(local_var_req).await?;
367
368    let local_var_status = local_var_resp.status();
369    let local_var_content = local_var_resp.text().await?;
370
371    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
372        serde_json::from_str(&local_var_content).map_err(Error::from)
373    } else {
374        let local_var_entity: Option<CreateOAuth2ClientError> = serde_json::from_str(&local_var_content).ok();
375        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
376        Err(Error::ResponseError(local_var_error))
377    }
378}
379
380/// Delete an existing OAuth 2.0 Client by its ID.  OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.  Make sure that this endpoint is well protected and only callable by first-party components.
381pub async fn delete_o_auth2_client(configuration: &configuration::Configuration, id: &str) -> Result<(), Error<DeleteOAuth2ClientError>> {
382    let local_var_configuration = configuration;
383
384    let local_var_client = &local_var_configuration.client;
385
386    let local_var_uri_str = format!("{}/admin/clients/{id}", local_var_configuration.base_path, id=crate::apis::urlencode(id));
387    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
388
389    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
390        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
391    }
392    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
393        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
394    };
395
396    let local_var_req = local_var_req_builder.build()?;
397    let local_var_resp = local_var_client.execute(local_var_req).await?;
398
399    let local_var_status = local_var_resp.status();
400    let local_var_content = local_var_resp.text().await?;
401
402    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
403        Ok(())
404    } else {
405        let local_var_entity: Option<DeleteOAuth2ClientError> = serde_json::from_str(&local_var_content).ok();
406        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
407        Err(Error::ResponseError(local_var_error))
408    }
409}
410
411/// This endpoint deletes OAuth2 access tokens issued to an OAuth 2.0 Client from the database.
412pub async fn delete_o_auth2_token(configuration: &configuration::Configuration, client_id: &str) -> Result<(), Error<DeleteOAuth2TokenError>> {
413    let local_var_configuration = configuration;
414
415    let local_var_client = &local_var_configuration.client;
416
417    let local_var_uri_str = format!("{}/admin/oauth2/tokens", local_var_configuration.base_path);
418    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
419
420    local_var_req_builder = local_var_req_builder.query(&[("client_id", &client_id.to_string())]);
421    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
422        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
423    }
424    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
425        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
426    };
427
428    let local_var_req = local_var_req_builder.build()?;
429    let local_var_resp = local_var_client.execute(local_var_req).await?;
430
431    let local_var_status = local_var_resp.status();
432    let local_var_content = local_var_resp.text().await?;
433
434    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
435        Ok(())
436    } else {
437        let local_var_entity: Option<DeleteOAuth2TokenError> = serde_json::from_str(&local_var_content).ok();
438        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
439        Err(Error::ResponseError(local_var_error))
440    }
441}
442
443/// Use this endpoint to delete trusted JWT Bearer Grant Type Issuer. The ID is the one returned when you created the trust relationship.  Once deleted, the associated issuer will no longer be able to perform the JSON Web Token (JWT) Profile for OAuth 2.0 Client Authentication and Authorization Grant.
444pub async fn delete_trusted_o_auth2_jwt_grant_issuer(configuration: &configuration::Configuration, id: &str) -> Result<(), Error<DeleteTrustedOAuth2JwtGrantIssuerError>> {
445    let local_var_configuration = configuration;
446
447    let local_var_client = &local_var_configuration.client;
448
449    let local_var_uri_str = format!("{}/admin/trust/grants/jwt-bearer/issuers/{id}", local_var_configuration.base_path, id=crate::apis::urlencode(id));
450    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
451
452    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
453        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
454    }
455    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
456        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
457    };
458
459    let local_var_req = local_var_req_builder.build()?;
460    let local_var_resp = local_var_client.execute(local_var_req).await?;
461
462    let local_var_status = local_var_resp.status();
463    let local_var_content = local_var_resp.text().await?;
464
465    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
466        Ok(())
467    } else {
468        let local_var_entity: Option<DeleteTrustedOAuth2JwtGrantIssuerError> = serde_json::from_str(&local_var_content).ok();
469        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
470        Err(Error::ResponseError(local_var_error))
471    }
472}
473
474/// Get an OAuth 2.0 client by its ID. This endpoint never returns the client secret.  OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
475pub async fn get_o_auth2_client(configuration: &configuration::Configuration, id: &str) -> Result<models::OAuth2Client, Error<GetOAuth2ClientError>> {
476    let local_var_configuration = configuration;
477
478    let local_var_client = &local_var_configuration.client;
479
480    let local_var_uri_str = format!("{}/admin/clients/{id}", local_var_configuration.base_path, id=crate::apis::urlencode(id));
481    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
482
483    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
484        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
485    }
486    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
487        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
488    };
489
490    let local_var_req = local_var_req_builder.build()?;
491    let local_var_resp = local_var_client.execute(local_var_req).await?;
492
493    let local_var_status = local_var_resp.status();
494    let local_var_content = local_var_resp.text().await?;
495
496    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
497        serde_json::from_str(&local_var_content).map_err(Error::from)
498    } else {
499        let local_var_entity: Option<GetOAuth2ClientError> = serde_json::from_str(&local_var_content).ok();
500        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
501        Err(Error::ResponseError(local_var_error))
502    }
503}
504
505/// When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, Ory asks the login provider to authenticate the subject and then tell Ory now about it. If the subject authenticated, he/she must now be asked if the OAuth 2.0 Client which initiated the flow should be allowed to access the resources on the subject's behalf.  The consent challenge is appended to the consent provider's URL to which the subject's user-agent (browser) is redirected to. The consent provider uses that challenge to fetch information on the OAuth2 request and then tells Ory if the subject accepted or rejected the request.  The default consent provider is available via the Ory Managed Account Experience. To customize the consent provider, please head over to the OAuth 2.0 documentation.
506pub async fn get_o_auth2_consent_request(configuration: &configuration::Configuration, consent_challenge: &str) -> Result<models::OAuth2ConsentRequest, Error<GetOAuth2ConsentRequestError>> {
507    let local_var_configuration = configuration;
508
509    let local_var_client = &local_var_configuration.client;
510
511    let local_var_uri_str = format!("{}/admin/oauth2/auth/requests/consent", local_var_configuration.base_path);
512    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
513
514    local_var_req_builder = local_var_req_builder.query(&[("consent_challenge", &consent_challenge.to_string())]);
515    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
516        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
517    }
518    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
519        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
520    };
521
522    let local_var_req = local_var_req_builder.build()?;
523    let local_var_resp = local_var_client.execute(local_var_req).await?;
524
525    let local_var_status = local_var_resp.status();
526    let local_var_content = local_var_resp.text().await?;
527
528    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
529        serde_json::from_str(&local_var_content).map_err(Error::from)
530    } else {
531        let local_var_entity: Option<GetOAuth2ConsentRequestError> = serde_json::from_str(&local_var_content).ok();
532        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
533        Err(Error::ResponseError(local_var_error))
534    }
535}
536
537/// When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, Ory asks the login provider to authenticate the subject and then tell the Ory OAuth2 Service about it.  Per default, the login provider is Ory itself. You may use a different login provider which needs to be a web-app you write and host, and it must be able to authenticate (\"show the subject a login screen\") a subject (in OAuth2 the proper name for subject is \"resource owner\").  The authentication challenge is appended to the login provider URL to which the subject's user-agent (browser) is redirected to. The login provider uses that challenge to fetch information on the OAuth2 request and then accept or reject the requested authentication process.
538pub async fn get_o_auth2_login_request(configuration: &configuration::Configuration, login_challenge: &str) -> Result<models::OAuth2LoginRequest, Error<GetOAuth2LoginRequestError>> {
539    let local_var_configuration = configuration;
540
541    let local_var_client = &local_var_configuration.client;
542
543    let local_var_uri_str = format!("{}/admin/oauth2/auth/requests/login", local_var_configuration.base_path);
544    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
545
546    local_var_req_builder = local_var_req_builder.query(&[("login_challenge", &login_challenge.to_string())]);
547    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
548        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
549    }
550    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
551        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
552    };
553
554    let local_var_req = local_var_req_builder.build()?;
555    let local_var_resp = local_var_client.execute(local_var_req).await?;
556
557    let local_var_status = local_var_resp.status();
558    let local_var_content = local_var_resp.text().await?;
559
560    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
561        serde_json::from_str(&local_var_content).map_err(Error::from)
562    } else {
563        let local_var_entity: Option<GetOAuth2LoginRequestError> = serde_json::from_str(&local_var_content).ok();
564        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
565        Err(Error::ResponseError(local_var_error))
566    }
567}
568
569/// Use this endpoint to fetch an Ory OAuth 2.0 logout request.
570pub async fn get_o_auth2_logout_request(configuration: &configuration::Configuration, logout_challenge: &str) -> Result<models::OAuth2LogoutRequest, Error<GetOAuth2LogoutRequestError>> {
571    let local_var_configuration = configuration;
572
573    let local_var_client = &local_var_configuration.client;
574
575    let local_var_uri_str = format!("{}/admin/oauth2/auth/requests/logout", local_var_configuration.base_path);
576    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
577
578    local_var_req_builder = local_var_req_builder.query(&[("logout_challenge", &logout_challenge.to_string())]);
579    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
580        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
581    }
582    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
583        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
584    };
585
586    let local_var_req = local_var_req_builder.build()?;
587    let local_var_resp = local_var_client.execute(local_var_req).await?;
588
589    let local_var_status = local_var_resp.status();
590    let local_var_content = local_var_resp.text().await?;
591
592    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
593        serde_json::from_str(&local_var_content).map_err(Error::from)
594    } else {
595        let local_var_entity: Option<GetOAuth2LogoutRequestError> = serde_json::from_str(&local_var_content).ok();
596        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
597        Err(Error::ResponseError(local_var_error))
598    }
599}
600
601/// Use this endpoint to get a trusted JWT Bearer Grant Type Issuer. The ID is the one returned when you created the trust relationship.
602pub async fn get_trusted_o_auth2_jwt_grant_issuer(configuration: &configuration::Configuration, id: &str) -> Result<models::TrustedOAuth2JwtGrantIssuer, Error<GetTrustedOAuth2JwtGrantIssuerError>> {
603    let local_var_configuration = configuration;
604
605    let local_var_client = &local_var_configuration.client;
606
607    let local_var_uri_str = format!("{}/admin/trust/grants/jwt-bearer/issuers/{id}", local_var_configuration.base_path, id=crate::apis::urlencode(id));
608    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
609
610    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
611        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
612    }
613    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
614        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
615    };
616
617    let local_var_req = local_var_req_builder.build()?;
618    let local_var_resp = local_var_client.execute(local_var_req).await?;
619
620    let local_var_status = local_var_resp.status();
621    let local_var_content = local_var_resp.text().await?;
622
623    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
624        serde_json::from_str(&local_var_content).map_err(Error::from)
625    } else {
626        let local_var_entity: Option<GetTrustedOAuth2JwtGrantIssuerError> = serde_json::from_str(&local_var_content).ok();
627        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
628        Err(Error::ResponseError(local_var_error))
629    }
630}
631
632/// The introspection endpoint allows to check if a token (both refresh and access) is active or not. An active token is neither expired nor revoked. If a token is active, additional information on the token will be included. You can set additional data for a token by setting `session.access_token` during the consent flow.
633pub async fn introspect_o_auth2_token(configuration: &configuration::Configuration, token: &str, scope: Option<&str>) -> Result<models::IntrospectedOAuth2Token, Error<IntrospectOAuth2TokenError>> {
634    let local_var_configuration = configuration;
635
636    let local_var_client = &local_var_configuration.client;
637
638    let local_var_uri_str = format!("{}/admin/oauth2/introspect", local_var_configuration.base_path);
639    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
640
641    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
642        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
643    }
644    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
645        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
646    };
647    let mut local_var_form_params = std::collections::HashMap::new();
648    if let Some(local_var_param_value) = scope {
649        local_var_form_params.insert("scope", local_var_param_value.to_string());
650    }
651    local_var_form_params.insert("token", token.to_string());
652    local_var_req_builder = local_var_req_builder.form(&local_var_form_params);
653
654    let local_var_req = local_var_req_builder.build()?;
655    let local_var_resp = local_var_client.execute(local_var_req).await?;
656
657    let local_var_status = local_var_resp.status();
658    let local_var_content = local_var_resp.text().await?;
659
660    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
661        serde_json::from_str(&local_var_content).map_err(Error::from)
662    } else {
663        let local_var_entity: Option<IntrospectOAuth2TokenError> = serde_json::from_str(&local_var_content).ok();
664        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
665        Err(Error::ResponseError(local_var_error))
666    }
667}
668
669/// This endpoint lists all clients in the database, and never returns client secrets. As a default it lists the first 100 clients.
670pub 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>> {
671    let local_var_configuration = configuration;
672
673    let local_var_client = &local_var_configuration.client;
674
675    let local_var_uri_str = format!("{}/admin/clients", local_var_configuration.base_path);
676    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
677
678    if let Some(ref local_var_str) = page_size {
679        local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
680    }
681    if let Some(ref local_var_str) = page_token {
682        local_var_req_builder = local_var_req_builder.query(&[("page_token", &local_var_str.to_string())]);
683    }
684    if let Some(ref local_var_str) = client_name {
685        local_var_req_builder = local_var_req_builder.query(&[("client_name", &local_var_str.to_string())]);
686    }
687    if let Some(ref local_var_str) = owner {
688        local_var_req_builder = local_var_req_builder.query(&[("owner", &local_var_str.to_string())]);
689    }
690    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
691        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
692    }
693    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
694        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
695    };
696
697    let local_var_req = local_var_req_builder.build()?;
698    let local_var_resp = local_var_client.execute(local_var_req).await?;
699
700    let local_var_status = local_var_resp.status();
701    let local_var_content = local_var_resp.text().await?;
702
703    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
704        serde_json::from_str(&local_var_content).map_err(Error::from)
705    } else {
706        let local_var_entity: Option<ListOAuth2ClientsError> = serde_json::from_str(&local_var_content).ok();
707        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
708        Err(Error::ResponseError(local_var_error))
709    }
710}
711
712/// This endpoint lists all subject's granted consent sessions, including client and granted scope. If the subject is unknown or has not granted any consent sessions yet, the endpoint returns an empty JSON array with status code 200 OK.
713pub 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>> {
714    let local_var_configuration = configuration;
715
716    let local_var_client = &local_var_configuration.client;
717
718    let local_var_uri_str = format!("{}/admin/oauth2/auth/sessions/consent", local_var_configuration.base_path);
719    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
720
721    if let Some(ref local_var_str) = page_size {
722        local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
723    }
724    if let Some(ref local_var_str) = page_token {
725        local_var_req_builder = local_var_req_builder.query(&[("page_token", &local_var_str.to_string())]);
726    }
727    local_var_req_builder = local_var_req_builder.query(&[("subject", &subject.to_string())]);
728    if let Some(ref local_var_str) = login_session_id {
729        local_var_req_builder = local_var_req_builder.query(&[("login_session_id", &local_var_str.to_string())]);
730    }
731    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
732        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
733    }
734    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
735        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
736    };
737
738    let local_var_req = local_var_req_builder.build()?;
739    let local_var_resp = local_var_client.execute(local_var_req).await?;
740
741    let local_var_status = local_var_resp.status();
742    let local_var_content = local_var_resp.text().await?;
743
744    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
745        serde_json::from_str(&local_var_content).map_err(Error::from)
746    } else {
747        let local_var_entity: Option<ListOAuth2ConsentSessionsError> = serde_json::from_str(&local_var_content).ok();
748        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
749        Err(Error::ResponseError(local_var_error))
750    }
751}
752
753/// Use this endpoint to list all trusted JWT Bearer Grant Type Issuers.
754pub async fn list_trusted_o_auth2_jwt_grant_issuers(configuration: &configuration::Configuration, max_items: Option<i64>, default_items: Option<i64>, issuer: Option<&str>) -> Result<Vec<models::TrustedOAuth2JwtGrantIssuer>, Error<ListTrustedOAuth2JwtGrantIssuersError>> {
755    let local_var_configuration = configuration;
756
757    let local_var_client = &local_var_configuration.client;
758
759    let local_var_uri_str = format!("{}/admin/trust/grants/jwt-bearer/issuers", local_var_configuration.base_path);
760    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
761
762    if let Some(ref local_var_str) = max_items {
763        local_var_req_builder = local_var_req_builder.query(&[("MaxItems", &local_var_str.to_string())]);
764    }
765    if let Some(ref local_var_str) = default_items {
766        local_var_req_builder = local_var_req_builder.query(&[("DefaultItems", &local_var_str.to_string())]);
767    }
768    if let Some(ref local_var_str) = issuer {
769        local_var_req_builder = local_var_req_builder.query(&[("issuer", &local_var_str.to_string())]);
770    }
771    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
772        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
773    }
774    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
775        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
776    };
777
778    let local_var_req = local_var_req_builder.build()?;
779    let local_var_resp = local_var_client.execute(local_var_req).await?;
780
781    let local_var_status = local_var_resp.status();
782    let local_var_content = local_var_resp.text().await?;
783
784    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
785        serde_json::from_str(&local_var_content).map_err(Error::from)
786    } else {
787        let local_var_entity: Option<ListTrustedOAuth2JwtGrantIssuersError> = serde_json::from_str(&local_var_content).ok();
788        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
789        Err(Error::ResponseError(local_var_error))
790    }
791}
792
793/// Use open source libraries to perform OAuth 2.0 and OpenID Connect available for any programming language. You can find a list of libraries at https://oauth.net/code/  This endpoint should not be used via the Ory SDK and is only included for technical reasons. Instead, use one of the libraries linked above.
794pub async fn o_auth2_authorize(configuration: &configuration::Configuration, ) -> Result<models::ErrorOAuth2, Error<OAuth2AuthorizeError>> {
795    let local_var_configuration = configuration;
796
797    let local_var_client = &local_var_configuration.client;
798
799    let local_var_uri_str = format!("{}/oauth2/auth", local_var_configuration.base_path);
800    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
801
802    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
803        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
804    }
805
806    let local_var_req = local_var_req_builder.build()?;
807    let local_var_resp = local_var_client.execute(local_var_req).await?;
808
809    let local_var_status = local_var_resp.status();
810    let local_var_content = local_var_resp.text().await?;
811
812    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
813        serde_json::from_str(&local_var_content).map_err(Error::from)
814    } else {
815        let local_var_entity: Option<OAuth2AuthorizeError> = serde_json::from_str(&local_var_content).ok();
816        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
817        Err(Error::ResponseError(local_var_error))
818    }
819}
820
821/// Use open source libraries to perform OAuth 2.0 and OpenID Connect available for any programming language. You can find a list of libraries here https://oauth.net/code/  This endpoint should not be used via the Ory SDK and is only included for technical reasons. Instead, use one of the libraries linked above.
822pub 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>> {
823    let local_var_configuration = configuration;
824
825    let local_var_client = &local_var_configuration.client;
826
827    let local_var_uri_str = format!("{}/oauth2/token", local_var_configuration.base_path);
828    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
829
830    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
831        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
832    }
833    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
834        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
835    };
836    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
837        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
838    };
839    let mut local_var_form_params = std::collections::HashMap::new();
840    if let Some(local_var_param_value) = client_id {
841        local_var_form_params.insert("client_id", local_var_param_value.to_string());
842    }
843    if let Some(local_var_param_value) = code {
844        local_var_form_params.insert("code", local_var_param_value.to_string());
845    }
846    local_var_form_params.insert("grant_type", grant_type.to_string());
847    if let Some(local_var_param_value) = redirect_uri {
848        local_var_form_params.insert("redirect_uri", local_var_param_value.to_string());
849    }
850    if let Some(local_var_param_value) = refresh_token {
851        local_var_form_params.insert("refresh_token", local_var_param_value.to_string());
852    }
853    local_var_req_builder = local_var_req_builder.form(&local_var_form_params);
854
855    let local_var_req = local_var_req_builder.build()?;
856    let local_var_resp = local_var_client.execute(local_var_req).await?;
857
858    let local_var_status = local_var_resp.status();
859    let local_var_content = local_var_resp.text().await?;
860
861    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
862        serde_json::from_str(&local_var_content).map_err(Error::from)
863    } else {
864        let local_var_entity: Option<Oauth2TokenExchangeError> = serde_json::from_str(&local_var_content).ok();
865        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
866        Err(Error::ResponseError(local_var_error))
867    }
868}
869
870/// Patch an existing OAuth 2.0 Client using JSON Patch. If you pass `client_secret` the secret will be updated and returned via the API. This is the only time you will be able to retrieve the client secret, so write it down and keep it safe.  OAuth 2.0 clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
871pub async fn patch_o_auth2_client(configuration: &configuration::Configuration, id: &str, json_patch: Vec<models::JsonPatch>) -> Result<models::OAuth2Client, Error<PatchOAuth2ClientError>> {
872    let local_var_configuration = configuration;
873
874    let local_var_client = &local_var_configuration.client;
875
876    let local_var_uri_str = format!("{}/admin/clients/{id}", local_var_configuration.base_path, id=crate::apis::urlencode(id));
877    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
878
879    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
880        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
881    }
882    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
883        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
884    };
885    local_var_req_builder = local_var_req_builder.json(&json_patch);
886
887    let local_var_req = local_var_req_builder.build()?;
888    let local_var_resp = local_var_client.execute(local_var_req).await?;
889
890    let local_var_status = local_var_resp.status();
891    let local_var_content = local_var_resp.text().await?;
892
893    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
894        serde_json::from_str(&local_var_content).map_err(Error::from)
895    } else {
896        let local_var_entity: Option<PatchOAuth2ClientError> = serde_json::from_str(&local_var_content).ok();
897        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
898        Err(Error::ResponseError(local_var_error))
899    }
900}
901
902/// When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, Ory asks the login provider to authenticate the subject and then tell Ory now about it. If the subject authenticated, he/she must now be asked if the OAuth 2.0 Client which initiated the flow should be allowed to access the resources on the subject's behalf.  The consent challenge is appended to the consent provider's URL to which the subject's user-agent (browser) is redirected to. The consent provider uses that challenge to fetch information on the OAuth2 request and then tells Ory if the subject accepted or rejected the request.  This endpoint tells Ory that the subject has not authorized the OAuth 2.0 client to access resources on his/her behalf. The consent provider must include a reason why the consent was not granted.  The response contains a redirect URL which the consent provider should redirect the user-agent to.  The default consent provider is available via the Ory Managed Account Experience. To customize the consent provider, please head over to the OAuth 2.0 documentation.
903pub 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>> {
904    let local_var_configuration = configuration;
905
906    let local_var_client = &local_var_configuration.client;
907
908    let local_var_uri_str = format!("{}/admin/oauth2/auth/requests/consent/reject", local_var_configuration.base_path);
909    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
910
911    local_var_req_builder = local_var_req_builder.query(&[("consent_challenge", &consent_challenge.to_string())]);
912    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
913        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
914    }
915    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
916        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
917    };
918    local_var_req_builder = local_var_req_builder.json(&reject_o_auth2_request);
919
920    let local_var_req = local_var_req_builder.build()?;
921    let local_var_resp = local_var_client.execute(local_var_req).await?;
922
923    let local_var_status = local_var_resp.status();
924    let local_var_content = local_var_resp.text().await?;
925
926    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
927        serde_json::from_str(&local_var_content).map_err(Error::from)
928    } else {
929        let local_var_entity: Option<RejectOAuth2ConsentRequestError> = serde_json::from_str(&local_var_content).ok();
930        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
931        Err(Error::ResponseError(local_var_error))
932    }
933}
934
935/// When an authorization code, hybrid, or implicit OAuth 2.0 Flow is initiated, Ory asks the login provider to authenticate the subject and then tell the Ory OAuth2 Service about it.  The authentication challenge is appended to the login provider URL to which the subject's user-agent (browser) is redirected to. The login provider uses that challenge to fetch information on the OAuth2 request and then accept or reject the requested authentication process.  This endpoint tells Ory that the subject has not authenticated and includes a reason why the authentication was denied.  The response contains a redirect URL which the login provider should redirect the user-agent to.
936pub 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>> {
937    let local_var_configuration = configuration;
938
939    let local_var_client = &local_var_configuration.client;
940
941    let local_var_uri_str = format!("{}/admin/oauth2/auth/requests/login/reject", local_var_configuration.base_path);
942    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
943
944    local_var_req_builder = local_var_req_builder.query(&[("login_challenge", &login_challenge.to_string())]);
945    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
946        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
947    }
948    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
949        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
950    };
951    local_var_req_builder = local_var_req_builder.json(&reject_o_auth2_request);
952
953    let local_var_req = local_var_req_builder.build()?;
954    let local_var_resp = local_var_client.execute(local_var_req).await?;
955
956    let local_var_status = local_var_resp.status();
957    let local_var_content = local_var_resp.text().await?;
958
959    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
960        serde_json::from_str(&local_var_content).map_err(Error::from)
961    } else {
962        let local_var_entity: Option<RejectOAuth2LoginRequestError> = serde_json::from_str(&local_var_content).ok();
963        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
964        Err(Error::ResponseError(local_var_error))
965    }
966}
967
968/// When a user or an application requests Ory OAuth 2.0 to remove the session state of a subject, this endpoint is used to deny that logout request. No HTTP request body is required.  The response is empty as the logout provider has to chose what action to perform next.
969pub async fn reject_o_auth2_logout_request(configuration: &configuration::Configuration, logout_challenge: &str) -> Result<(), Error<RejectOAuth2LogoutRequestError>> {
970    let local_var_configuration = configuration;
971
972    let local_var_client = &local_var_configuration.client;
973
974    let local_var_uri_str = format!("{}/admin/oauth2/auth/requests/logout/reject", local_var_configuration.base_path);
975    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
976
977    local_var_req_builder = local_var_req_builder.query(&[("logout_challenge", &logout_challenge.to_string())]);
978    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
979        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
980    }
981    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
982        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
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_client_error() && !local_var_status.is_server_error() {
992        Ok(())
993    } else {
994        let local_var_entity: Option<RejectOAuth2LogoutRequestError> = 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
1000/// This endpoint revokes a subject's granted consent sessions and invalidates all associated OAuth 2.0 Access Tokens. You may also only revoke sessions for a specific OAuth 2.0 Client ID.
1001pub 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>> {
1002    let local_var_configuration = configuration;
1003
1004    let local_var_client = &local_var_configuration.client;
1005
1006    let local_var_uri_str = format!("{}/admin/oauth2/auth/sessions/consent", local_var_configuration.base_path);
1007    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
1008
1009    if let Some(ref local_var_str) = subject {
1010        local_var_req_builder = local_var_req_builder.query(&[("subject", &local_var_str.to_string())]);
1011    }
1012    if let Some(ref local_var_str) = client {
1013        local_var_req_builder = local_var_req_builder.query(&[("client", &local_var_str.to_string())]);
1014    }
1015    if let Some(ref local_var_str) = consent_request_id {
1016        local_var_req_builder = local_var_req_builder.query(&[("consent_request_id", &local_var_str.to_string())]);
1017    }
1018    if let Some(ref local_var_str) = all {
1019        local_var_req_builder = local_var_req_builder.query(&[("all", &local_var_str.to_string())]);
1020    }
1021    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1022        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1023    }
1024    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1025        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1026    };
1027
1028    let local_var_req = local_var_req_builder.build()?;
1029    let local_var_resp = local_var_client.execute(local_var_req).await?;
1030
1031    let local_var_status = local_var_resp.status();
1032    let local_var_content = local_var_resp.text().await?;
1033
1034    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1035        Ok(())
1036    } else {
1037        let local_var_entity: Option<RevokeOAuth2ConsentSessionsError> = serde_json::from_str(&local_var_content).ok();
1038        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1039        Err(Error::ResponseError(local_var_error))
1040    }
1041}
1042
1043/// This endpoint invalidates authentication sessions. After revoking the authentication session(s), the subject has to re-authenticate at the Ory OAuth2 Provider. This endpoint does not invalidate any tokens.  If you send the subject in a query param, all authentication sessions that belong to that subject are revoked. No OpenID Connect Front- or Back-channel logout is performed in this case.  Alternatively, you can send a SessionID via `sid` query param, in which case, only the session that is connected to that SessionID is revoked. OpenID Connect Back-channel logout is performed in this case.  When using Ory for the identity provider, the login provider will also invalidate the session cookie.
1044pub async fn revoke_o_auth2_login_sessions(configuration: &configuration::Configuration, subject: Option<&str>, sid: Option<&str>) -> Result<(), Error<RevokeOAuth2LoginSessionsError>> {
1045    let local_var_configuration = configuration;
1046
1047    let local_var_client = &local_var_configuration.client;
1048
1049    let local_var_uri_str = format!("{}/admin/oauth2/auth/sessions/login", local_var_configuration.base_path);
1050    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
1051
1052    if let Some(ref local_var_str) = subject {
1053        local_var_req_builder = local_var_req_builder.query(&[("subject", &local_var_str.to_string())]);
1054    }
1055    if let Some(ref local_var_str) = sid {
1056        local_var_req_builder = local_var_req_builder.query(&[("sid", &local_var_str.to_string())]);
1057    }
1058    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1059        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1060    }
1061    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1062        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1063    };
1064
1065    let local_var_req = local_var_req_builder.build()?;
1066    let local_var_resp = local_var_client.execute(local_var_req).await?;
1067
1068    let local_var_status = local_var_resp.status();
1069    let local_var_content = local_var_resp.text().await?;
1070
1071    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1072        Ok(())
1073    } else {
1074        let local_var_entity: Option<RevokeOAuth2LoginSessionsError> = serde_json::from_str(&local_var_content).ok();
1075        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1076        Err(Error::ResponseError(local_var_error))
1077    }
1078}
1079
1080/// Revoking a token (both access and refresh) means that the tokens will be invalid. A revoked access token can no longer be used to make access requests, and a revoked refresh token can no longer be used to refresh an access token. Revoking a refresh token also invalidates the access token that was created with it. A token may only be revoked by the client the token was generated for.
1081pub async fn revoke_o_auth2_token(configuration: &configuration::Configuration, token: &str, client_id: Option<&str>, client_secret: Option<&str>) -> Result<(), Error<RevokeOAuth2TokenError>> {
1082    let local_var_configuration = configuration;
1083
1084    let local_var_client = &local_var_configuration.client;
1085
1086    let local_var_uri_str = format!("{}/oauth2/revoke", local_var_configuration.base_path);
1087    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1088
1089    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1090        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1091    }
1092    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
1093        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
1094    };
1095    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
1096        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1097    };
1098    let mut local_var_form_params = std::collections::HashMap::new();
1099    if let Some(local_var_param_value) = client_id {
1100        local_var_form_params.insert("client_id", local_var_param_value.to_string());
1101    }
1102    if let Some(local_var_param_value) = client_secret {
1103        local_var_form_params.insert("client_secret", local_var_param_value.to_string());
1104    }
1105    local_var_form_params.insert("token", token.to_string());
1106    local_var_req_builder = local_var_req_builder.form(&local_var_form_params);
1107
1108    let local_var_req = local_var_req_builder.build()?;
1109    let local_var_resp = local_var_client.execute(local_var_req).await?;
1110
1111    let local_var_status = local_var_resp.status();
1112    let local_var_content = local_var_resp.text().await?;
1113
1114    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1115        Ok(())
1116    } else {
1117        let local_var_entity: Option<RevokeOAuth2TokenError> = serde_json::from_str(&local_var_content).ok();
1118        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1119        Err(Error::ResponseError(local_var_error))
1120    }
1121}
1122
1123/// Replaces an existing OAuth 2.0 Client with the payload you send. If you pass `client_secret` the secret is used, otherwise the existing secret is used.  If set, the secret is echoed in the response. It is not possible to retrieve it later on.  OAuth 2.0 Clients are used to perform OAuth 2.0 and OpenID Connect flows. Usually, OAuth 2.0 clients are generated for applications which want to consume your OAuth 2.0 or OpenID Connect capabilities.
1124pub async fn set_o_auth2_client(configuration: &configuration::Configuration, id: &str, o_auth2_client: models::OAuth2Client) -> Result<models::OAuth2Client, Error<SetOAuth2ClientError>> {
1125    let local_var_configuration = configuration;
1126
1127    let local_var_client = &local_var_configuration.client;
1128
1129    let local_var_uri_str = format!("{}/admin/clients/{id}", local_var_configuration.base_path, id=crate::apis::urlencode(id));
1130    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1131
1132    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1133        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1134    }
1135    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1136        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1137    };
1138    local_var_req_builder = local_var_req_builder.json(&o_auth2_client);
1139
1140    let local_var_req = local_var_req_builder.build()?;
1141    let local_var_resp = local_var_client.execute(local_var_req).await?;
1142
1143    let local_var_status = local_var_resp.status();
1144    let local_var_content = local_var_resp.text().await?;
1145
1146    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1147        serde_json::from_str(&local_var_content).map_err(Error::from)
1148    } else {
1149        let local_var_entity: Option<SetOAuth2ClientError> = serde_json::from_str(&local_var_content).ok();
1150        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1151        Err(Error::ResponseError(local_var_error))
1152    }
1153}
1154
1155/// Set lifespans of different token types issued for this OAuth 2.0 client. Does not modify other fields.
1156pub 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>> {
1157    let local_var_configuration = configuration;
1158
1159    let local_var_client = &local_var_configuration.client;
1160
1161    let local_var_uri_str = format!("{}/admin/clients/{id}/lifespans", local_var_configuration.base_path, id=crate::apis::urlencode(id));
1162    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
1163
1164    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1165        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1166    }
1167    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1168        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1169    };
1170    local_var_req_builder = local_var_req_builder.json(&o_auth2_client_token_lifespans);
1171
1172    let local_var_req = local_var_req_builder.build()?;
1173    let local_var_resp = local_var_client.execute(local_var_req).await?;
1174
1175    let local_var_status = local_var_resp.status();
1176    let local_var_content = local_var_resp.text().await?;
1177
1178    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1179        serde_json::from_str(&local_var_content).map_err(Error::from)
1180    } else {
1181        let local_var_entity: Option<SetOAuth2ClientLifespansError> = serde_json::from_str(&local_var_content).ok();
1182        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1183        Err(Error::ResponseError(local_var_error))
1184    }
1185}
1186
1187/// Use this endpoint to establish a trust relationship for a JWT issuer to perform JSON Web Token (JWT) Profile for OAuth 2.0 Client Authentication and Authorization Grants [RFC7523](https://datatracker.ietf.org/doc/html/rfc7523).
1188pub 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>> {
1189    let local_var_configuration = configuration;
1190
1191    let local_var_client = &local_var_configuration.client;
1192
1193    let local_var_uri_str = format!("{}/admin/trust/grants/jwt-bearer/issuers", local_var_configuration.base_path);
1194    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1195
1196    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1197        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1198    }
1199    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
1200        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1201    };
1202    local_var_req_builder = local_var_req_builder.json(&trust_o_auth2_jwt_grant_issuer);
1203
1204    let local_var_req = local_var_req_builder.build()?;
1205    let local_var_resp = local_var_client.execute(local_var_req).await?;
1206
1207    let local_var_status = local_var_resp.status();
1208    let local_var_content = local_var_resp.text().await?;
1209
1210    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1211        serde_json::from_str(&local_var_content).map_err(Error::from)
1212    } else {
1213        let local_var_entity: Option<TrustOAuth2JwtGrantIssuerError> = serde_json::from_str(&local_var_content).ok();
1214        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1215        Err(Error::ResponseError(local_var_error))
1216    }
1217}
1218