/*
* Ory APIs
*
* 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.
*
* The version of the OpenAPI document: v0.0.1-alpha.1
* Contact: support@ory.sh
* Generated by: https://openapi-generator.tech
*/
use reqwest;
use crate::apis::ResponseContent;
use super::{Error, configuration};
/// struct for typed errors of method `create_identity_admin`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateIdentityAdminError {
Status400(crate::models::JsonError),
Status401(crate::models::JsonError),
Status403(crate::models::JsonError),
Status409(crate::models::JsonError),
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `create_recovery_link_admin`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateRecoveryLinkAdminError {
Status400(crate::models::JsonError),
Status404(crate::models::JsonError),
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `delete_identity_admin`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteIdentityAdminError {
Status401(crate::models::JsonError),
Status403(crate::models::JsonError),
Status404(crate::models::JsonError),
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `get_identity_admin`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetIdentityAdminError {
Status400(crate::models::JsonError),
Status401(crate::models::JsonError),
Status403(crate::models::JsonError),
Status404(crate::models::JsonError),
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `get_schema`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetSchemaError {
Status404(crate::models::JsonError),
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `get_schema_admin`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetSchemaAdminError {
Status404(crate::models::JsonError),
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `get_self_service_error`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetSelfServiceErrorError {
Status403(crate::models::JsonError),
Status404(crate::models::JsonError),
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `get_self_service_error_admin`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetSelfServiceErrorAdminError {
Status403(crate::models::JsonError),
Status404(crate::models::JsonError),
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `get_self_service_login_flow`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetSelfServiceLoginFlowError {
Status403(crate::models::JsonError),
Status404(crate::models::JsonError),
Status410(crate::models::JsonError),
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `get_self_service_login_flow_admin`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetSelfServiceLoginFlowAdminError {
Status403(crate::models::JsonError),
Status404(crate::models::JsonError),
Status410(crate::models::JsonError),
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `get_self_service_recovery_flow`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetSelfServiceRecoveryFlowError {
Status404(crate::models::JsonError),
Status410(crate::models::JsonError),
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `get_self_service_recovery_flow_admin`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetSelfServiceRecoveryFlowAdminError {
Status404(crate::models::JsonError),
Status410(crate::models::JsonError),
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `get_self_service_registration_flow`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetSelfServiceRegistrationFlowError {
Status403(crate::models::JsonError),
Status404(crate::models::JsonError),
Status410(crate::models::JsonError),
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `get_self_service_registration_flow_admin`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetSelfServiceRegistrationFlowAdminError {
Status403(crate::models::JsonError),
Status404(crate::models::JsonError),
Status410(crate::models::JsonError),
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `get_self_service_settings_flow`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetSelfServiceSettingsFlowError {
Status403(crate::models::JsonError),
Status404(crate::models::JsonError),
Status410(crate::models::JsonError),
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `get_self_service_settings_flow_admin`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetSelfServiceSettingsFlowAdminError {
Status403(crate::models::JsonError),
Status404(crate::models::JsonError),
Status410(crate::models::JsonError),
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `get_self_service_verification_flow`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetSelfServiceVerificationFlowError {
Status403(crate::models::JsonError),
Status404(crate::models::JsonError),
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `get_self_service_verification_flow_admin`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetSelfServiceVerificationFlowAdminError {
Status403(crate::models::JsonError),
Status404(crate::models::JsonError),
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `get_version_admin`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetVersionAdminError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `initialize_self_service_browser_logout_flow`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum InitializeSelfServiceBrowserLogoutFlowError {
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `initialize_self_service_login_via_api_flow`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum InitializeSelfServiceLoginViaApiFlowError {
Status400(crate::models::JsonError),
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `initialize_self_service_login_via_browser_flow`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum InitializeSelfServiceLoginViaBrowserFlowError {
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `initialize_self_service_recovery_via_api_flow`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum InitializeSelfServiceRecoveryViaApiFlowError {
Status400(crate::models::JsonError),
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `initialize_self_service_recovery_via_browser_flow`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum InitializeSelfServiceRecoveryViaBrowserFlowError {
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `initialize_self_service_registration`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum InitializeSelfServiceRegistrationError {
Status400(crate::models::JsonError),
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `initialize_self_service_registration_for_browsers`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum InitializeSelfServiceRegistrationForBrowsersError {
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `initialize_self_service_settings_via_api_flow`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum InitializeSelfServiceSettingsViaApiFlowError {
Status400(crate::models::JsonError),
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `initialize_self_service_settings_via_browser_flow`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum InitializeSelfServiceSettingsViaBrowserFlowError {
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `initialize_self_service_verification_via_api_flow`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum InitializeSelfServiceVerificationViaApiFlowError {
Status400(crate::models::JsonError),
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `initialize_self_service_verification_via_browser_flow`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum InitializeSelfServiceVerificationViaBrowserFlowError {
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `is_alive_admin`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum IsAliveAdminError {
Status500(crate::models::GenericError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `is_ready_admin`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum IsReadyAdminError {
Status503(crate::models::InlineResponse503),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `list_identities_admin`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListIdentitiesAdminError {
Status401(crate::models::JsonError),
Status403(crate::models::JsonError),
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `prometheus_admin`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PrometheusAdminError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `revoke_session`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum RevokeSessionError {
Status400(crate::models::JsonError),
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `submit_self_service_login_flow`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SubmitSelfServiceLoginFlowError {
Status400(crate::models::LoginFlow),
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `submit_self_service_recovery_flow`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SubmitSelfServiceRecoveryFlowError {
Status400(crate::models::RecoveryFlow),
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `submit_self_service_recovery_flow_with_link_method`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SubmitSelfServiceRecoveryFlowWithLinkMethodError {
Status400(crate::models::RecoveryFlow),
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `submit_self_service_registration_flow`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SubmitSelfServiceRegistrationFlowError {
Status400(crate::models::RegistrationFlow),
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `submit_self_service_settings_flow`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SubmitSelfServiceSettingsFlowError {
Status400(crate::models::SettingsFlow),
Status401(crate::models::JsonError),
Status403(crate::models::JsonError),
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `submit_self_service_verification_flow`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SubmitSelfServiceVerificationFlowError {
Status400(crate::models::VerificationFlow),
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `to_session`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToSessionError {
Status401(crate::models::JsonError),
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method `update_identity_admin`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateIdentityAdminError {
Status400(crate::models::JsonError),
Status401(crate::models::JsonError),
Status403(crate::models::JsonError),
Status404(crate::models::JsonError),
Status500(crate::models::JsonError),
UnknownValue(serde_json::Value),
}
/// This endpoint creates an identity. It is NOT possible to set an identity's credentials (password, ...) using this method! A way to achieve that will be introduced in the future. Learn how identities work in [Ory Kratos' User And Identity Model Documentation](https://www.ory.sh/docs/next/kratos/concepts/identity-user-model).
pub async fn create_identity_admin(configuration: &configuration::Configuration, create_identity: Option<crate::models::CreateIdentity>) -> Result<crate::models::Identity, Error<CreateIdentityAdminError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/admin/identities", configuration.base_path);
let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&create_identity);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<CreateIdentityAdminError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// This endpoint creates a recovery link which should be given to the user in order for them to recover (or activate) their account.
pub async fn create_recovery_link_admin(configuration: &configuration::Configuration, create_recovery_link: Option<crate::models::CreateRecoveryLink>) -> Result<crate::models::RecoveryLink, Error<CreateRecoveryLinkAdminError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/admin/recovery/link", configuration.base_path);
let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&create_recovery_link);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<CreateRecoveryLinkAdminError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// Calling this endpoint irrecoverably and permanently deletes the identity given its ID. This action can not be undone. This endpoint returns 204 when the identity was deleted or when the identity was not found, in which case it is assumed that is has been deleted already. Learn how identities work in [Ory Kratos' User And Identity Model Documentation](https://www.ory.sh/docs/next/kratos/concepts/identity-user-model).
pub async fn delete_identity_admin(configuration: &configuration::Configuration, id: &str) -> Result<(), Error<DeleteIdentityAdminError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/admin/identities/{id}", configuration.base_path, id=crate::apis::urlencode(id));
let mut local_var_req_builder = local_var_client.delete(local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(())
} else {
let local_var_entity: Option<DeleteIdentityAdminError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// Learn how identities work in [Ory Kratos' User And Identity Model Documentation](https://www.ory.sh/docs/next/kratos/concepts/identity-user-model).
pub async fn get_identity_admin(configuration: &configuration::Configuration, id: &str) -> Result<crate::models::Identity, Error<GetIdentityAdminError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/admin/identities/{id}", configuration.base_path, id=crate::apis::urlencode(id));
let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetIdentityAdminError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// Get a Traits Schema Definition
pub async fn get_schema(configuration: &configuration::Configuration, id: &str) -> Result<serde_json::Value, Error<GetSchemaError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/public/schemas/{id}", configuration.base_path, id=crate::apis::urlencode(id));
let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetSchemaError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// Get a Traits Schema Definition
pub async fn get_schema_admin(configuration: &configuration::Configuration, id: &str) -> Result<serde_json::Value, Error<GetSchemaAdminError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/admin/schemas/{id}", configuration.base_path, id=crate::apis::urlencode(id));
let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetSchemaAdminError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// This endpoint returns the error associated with a user-facing self service errors. This endpoint supports stub values to help you implement the error UI: `?error=stub:500` - returns a stub 500 (Internal Server Error) error. More information can be found at [Ory Kratos User User Facing Error Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-facing-errors).
pub async fn get_self_service_error(configuration: &configuration::Configuration, error: &str) -> Result<crate::models::ErrorContainer, Error<GetSelfServiceErrorError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/public/self-service/errors", configuration.base_path);
let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("error", &error.to_string())]);
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetSelfServiceErrorError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// This endpoint returns the error associated with a user-facing self service errors. This endpoint supports stub values to help you implement the error UI: `?error=stub:500` - returns a stub 500 (Internal Server Error) error. More information can be found at [Ory Kratos User User Facing Error Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-facing-errors).
pub async fn get_self_service_error_admin(configuration: &configuration::Configuration, error: &str) -> Result<crate::models::ErrorContainer, Error<GetSelfServiceErrorAdminError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/admin/self-service/errors", configuration.base_path);
let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("error", &error.to_string())]);
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetSelfServiceErrorAdminError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// This endpoint returns a login flow's context with, for example, error details and other information. More information can be found at [Ory Kratos User Login and User Registration Documentation](https://www.ory.sh/docs/next/kratos/self-service/flows/user-login-user-registration).
pub async fn get_self_service_login_flow(configuration: &configuration::Configuration, id: &str) -> Result<crate::models::LoginFlow, Error<GetSelfServiceLoginFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/public/self-service/login/flows", configuration.base_path);
let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("id", &id.to_string())]);
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetSelfServiceLoginFlowError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// This endpoint returns a login flow's context with, for example, error details and other information. More information can be found at [Ory Kratos User Login and User Registration Documentation](https://www.ory.sh/docs/next/kratos/self-service/flows/user-login-user-registration).
pub async fn get_self_service_login_flow_admin(configuration: &configuration::Configuration, id: &str) -> Result<crate::models::LoginFlow, Error<GetSelfServiceLoginFlowAdminError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/admin/self-service/login/flows", configuration.base_path);
let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("id", &id.to_string())]);
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetSelfServiceLoginFlowAdminError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// This endpoint returns a recovery flow's context with, for example, error details and other information. More information can be found at [Ory Kratos Account Recovery Documentation](../self-service/flows/account-recovery.mdx).
pub async fn get_self_service_recovery_flow(configuration: &configuration::Configuration, id: &str) -> Result<crate::models::RecoveryFlow, Error<GetSelfServiceRecoveryFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/public/self-service/recovery/flows", configuration.base_path);
let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("id", &id.to_string())]);
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetSelfServiceRecoveryFlowError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// This endpoint returns a recovery flow's context with, for example, error details and other information. More information can be found at [Ory Kratos Account Recovery Documentation](../self-service/flows/account-recovery.mdx).
pub async fn get_self_service_recovery_flow_admin(configuration: &configuration::Configuration, id: &str) -> Result<crate::models::RecoveryFlow, Error<GetSelfServiceRecoveryFlowAdminError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/admin/self-service/recovery/flows", configuration.base_path);
let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("id", &id.to_string())]);
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetSelfServiceRecoveryFlowAdminError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// This endpoint returns a registration flow's context with, for example, error details and other information. More information can be found at [Ory Kratos User Login and User Registration Documentation](https://www.ory.sh/docs/next/kratos/self-service/flows/user-login-user-registration).
pub async fn get_self_service_registration_flow(configuration: &configuration::Configuration, id: &str) -> Result<crate::models::RegistrationFlow, Error<GetSelfServiceRegistrationFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/public/self-service/registration/flows", configuration.base_path);
let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("id", &id.to_string())]);
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetSelfServiceRegistrationFlowError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// This endpoint returns a registration flow's context with, for example, error details and other information. More information can be found at [Ory Kratos User Login and User Registration Documentation](https://www.ory.sh/docs/next/kratos/self-service/flows/user-login-user-registration).
pub async fn get_self_service_registration_flow_admin(configuration: &configuration::Configuration, id: &str) -> Result<crate::models::RegistrationFlow, Error<GetSelfServiceRegistrationFlowAdminError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/admin/self-service/registration/flows", configuration.base_path);
let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("id", &id.to_string())]);
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetSelfServiceRegistrationFlowAdminError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// When accessing this endpoint through Ory Kratos' Public API you must ensure that either the Ory Kratos Session Cookie or the Ory Kratos Session Token are set. The public endpoint does not return 404 status codes but instead 403 or 500 to improve data privacy. You can access this endpoint without credentials when using Ory Kratos' Admin API. More information can be found at [Ory Kratos User Settings & Profile Management Documentation](../self-service/flows/user-settings).
pub async fn get_self_service_settings_flow(configuration: &configuration::Configuration, id: &str) -> Result<crate::models::SettingsFlow, Error<GetSelfServiceSettingsFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/public/self-service/settings/flows", configuration.base_path);
let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("id", &id.to_string())]);
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetSelfServiceSettingsFlowError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// When accessing this endpoint through Ory Kratos' Public API you must ensure that either the Ory Kratos Session Cookie or the Ory Kratos Session Token are set. The public endpoint does not return 404 status codes but instead 403 or 500 to improve data privacy. You can access this endpoint without credentials when using Ory Kratos' Admin API. More information can be found at [Ory Kratos User Settings & Profile Management Documentation](../self-service/flows/user-settings).
pub async fn get_self_service_settings_flow_admin(configuration: &configuration::Configuration, id: &str) -> Result<crate::models::SettingsFlow, Error<GetSelfServiceSettingsFlowAdminError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/admin/self-service/settings/flows", configuration.base_path);
let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("id", &id.to_string())]);
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetSelfServiceSettingsFlowAdminError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// This endpoint returns a verification flow's context with, for example, error details and other information. More information can be found at [Ory Kratos Email and Phone Verification Documentation](https://www.ory.sh/docs/kratos/selfservice/flows/verify-email-account-activation).
pub async fn get_self_service_verification_flow(configuration: &configuration::Configuration, id: &str) -> Result<crate::models::VerificationFlow, Error<GetSelfServiceVerificationFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/public/self-service/verification/flows", configuration.base_path);
let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("id", &id.to_string())]);
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetSelfServiceVerificationFlowError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// This endpoint returns a verification flow's context with, for example, error details and other information. More information can be found at [Ory Kratos Email and Phone Verification Documentation](https://www.ory.sh/docs/kratos/selfservice/flows/verify-email-account-activation).
pub async fn get_self_service_verification_flow_admin(configuration: &configuration::Configuration, id: &str) -> Result<crate::models::VerificationFlow, Error<GetSelfServiceVerificationFlowAdminError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/admin/self-service/verification/flows", configuration.base_path);
let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("id", &id.to_string())]);
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetSelfServiceVerificationFlowAdminError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// This endpoint returns the version of Ory Kratos. If the service supports TLS Edge Termination, this endpoint does not require the `X-Forwarded-Proto` header to be set. Be aware that if you are running multiple nodes of this service, the version will never refer to the cluster state, only to a single instance.
pub async fn get_version_admin(configuration: &configuration::Configuration, ) -> Result<crate::models::InlineResponse2001, Error<GetVersionAdminError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/admin/version", configuration.base_path);
let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetVersionAdminError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// This endpoint initializes a logout flow. > This endpoint is NOT INTENDED for API clients and only works with browsers (Chrome, Firefox, ...). On successful logout, the browser will be redirected (HTTP 302 Found) to the `return_to` parameter of the initial request or fall back to `urls.default_return_to`. More information can be found at [Ory Kratos User Logout Documentation](https://www.ory.sh/docs/next/kratos/self-service/flows/user-logout).
pub async fn initialize_self_service_browser_logout_flow(configuration: &configuration::Configuration, ) -> Result<(), Error<InitializeSelfServiceBrowserLogoutFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/public/self-service/browser/flows/logout", configuration.base_path);
let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(())
} else {
let local_var_entity: Option<InitializeSelfServiceBrowserLogoutFlowError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// This endpoint initiates a login flow for API clients such as mobile devices, smart TVs, and so on. If a valid provided session cookie or session token is provided, a 400 Bad Request error will be returned unless the URL query parameter `?refresh=true` is set. To fetch an existing login flow call `/self-service/login/flows?flow=<flow_id>`. :::warning You MUST NOT use this endpoint in client-side (Single Page Apps, ReactJS, AngularJS) nor server-side (Java Server Pages, NodeJS, PHP, Golang, ...) browser applications. Using this endpoint in these applications will make you vulnerable to a variety of CSRF attacks, including CSRF login attacks. This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). ::: More information can be found at [Ory Kratos User Login and User Registration Documentation](https://www.ory.sh/docs/next/kratos/self-service/flows/user-login-user-registration).
pub async fn initialize_self_service_login_via_api_flow(configuration: &configuration::Configuration, refresh: Option<bool>) -> Result<crate::models::LoginFlow, Error<InitializeSelfServiceLoginViaApiFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/public/self-service/login/api", configuration.base_path);
let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
if let Some(ref local_var_str) = refresh {
local_var_req_builder = local_var_req_builder.query(&[("refresh", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<InitializeSelfServiceLoginViaApiFlowError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// This endpoint initializes a browser-based user login flow. Once initialized, the browser will be redirected to `selfservice.flows.login.ui_url` with the flow ID set as the query parameter `?flow=`. If a valid user session exists already, the browser will be redirected to `urls.default_redirect_url` unless the query parameter `?refresh=true` was set. This endpoint is NOT INTENDED for API clients and only works with browsers (Chrome, Firefox, ...). More information can be found at [Ory Kratos User Login and User Registration Documentation](https://www.ory.sh/docs/next/kratos/self-service/flows/user-login-user-registration).
pub async fn initialize_self_service_login_via_browser_flow(configuration: &configuration::Configuration, ) -> Result<(), Error<InitializeSelfServiceLoginViaBrowserFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/public/self-service/login/browser", configuration.base_path);
let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(())
} else {
let local_var_entity: Option<InitializeSelfServiceLoginViaBrowserFlowError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// This endpoint initiates a recovery flow for API clients such as mobile devices, smart TVs, and so on. If a valid provided session cookie or session token is provided, a 400 Bad Request error. To fetch an existing recovery flow call `/self-service/recovery/flows?flow=<flow_id>`. :::warning You MUST NOT use this endpoint in client-side (Single Page Apps, ReactJS, AngularJS) nor server-side (Java Server Pages, NodeJS, PHP, Golang, ...) browser applications. Using this endpoint in these applications will make you vulnerable to a variety of CSRF attacks. This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). ::: More information can be found at [Ory Kratos Account Recovery Documentation](../self-service/flows/account-recovery.mdx).
pub async fn initialize_self_service_recovery_via_api_flow(configuration: &configuration::Configuration, ) -> Result<crate::models::RecoveryFlow, Error<InitializeSelfServiceRecoveryViaApiFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/public/self-service/recovery/api", configuration.base_path);
let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<InitializeSelfServiceRecoveryViaApiFlowError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// This endpoint initializes a browser-based account recovery flow. Once initialized, the browser will be redirected to `selfservice.flows.recovery.ui_url` with the flow ID set as the query parameter `?flow=`. If a valid user session exists, the browser is returned to the configured return URL. This endpoint is NOT INTENDED for API clients and only works with browsers (Chrome, Firefox, ...). More information can be found at [Ory Kratos Account Recovery Documentation](../self-service/flows/account-recovery.mdx).
pub async fn initialize_self_service_recovery_via_browser_flow(configuration: &configuration::Configuration, ) -> Result<(), Error<InitializeSelfServiceRecoveryViaBrowserFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/public/self-service/recovery/browser", configuration.base_path);
let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(())
} else {
let local_var_entity: Option<InitializeSelfServiceRecoveryViaBrowserFlowError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// This endpoint initiates a registration flow for API clients such as mobile devices, smart TVs, and so on. If a valid provided session cookie or session token is provided, a 400 Bad Request error will be returned unless the URL query parameter `?refresh=true` is set. To fetch an existing registration flow call `/self-service/registration/flows?flow=<flow_id>`. :::warning You MUST NOT use this endpoint in client-side (Single Page Apps, ReactJS, AngularJS) nor server-side (Java Server Pages, NodeJS, PHP, Golang, ...) browser applications. Using this endpoint in these applications will make you vulnerable to a variety of CSRF attacks. This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). ::: More information can be found at [Ory Kratos User Login and User Registration Documentation](https://www.ory.sh/docs/next/kratos/self-service/flows/user-login-user-registration).
pub async fn initialize_self_service_registration(configuration: &configuration::Configuration, ) -> Result<crate::models::RegistrationFlow, Error<InitializeSelfServiceRegistrationError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/public/self-service/registration/api", configuration.base_path);
let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<InitializeSelfServiceRegistrationError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// This endpoint initializes a browser-based user registration flow. Once initialized, the browser will be redirected to `selfservice.flows.registration.ui_url` with the flow ID set as the query parameter `?flow=`. If a valid user session exists already, the browser will be redirected to `urls.default_redirect_url` unless the query parameter `?refresh=true` was set. :::note This endpoint is NOT INTENDED for API clients and only works with browsers (Chrome, Firefox, ...). ::: More information can be found at [Ory Kratos User Login and User Registration Documentation](https://www.ory.sh/docs/next/kratos/self-service/flows/user-login-user-registration).
pub async fn initialize_self_service_registration_for_browsers(configuration: &configuration::Configuration, ) -> Result<(), Error<InitializeSelfServiceRegistrationForBrowsersError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/public/self-service/registration/browser", configuration.base_path);
let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(())
} else {
let local_var_entity: Option<InitializeSelfServiceRegistrationForBrowsersError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// This endpoint initiates a settings flow for API clients such as mobile devices, smart TVs, and so on. You must provide a valid Ory Kratos Session Token for this endpoint to respond with HTTP 200 OK. To fetch an existing settings flow call `/self-service/settings/flows?flow=<flow_id>`. :::warning You MUST NOT use this endpoint in client-side (Single Page Apps, ReactJS, AngularJS) nor server-side (Java Server Pages, NodeJS, PHP, Golang, ...) browser applications. Using this endpoint in these applications will make you vulnerable to a variety of CSRF attacks. This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). ::: More information can be found at [Ory Kratos User Settings & Profile Management Documentation](../self-service/flows/user-settings).
pub async fn initialize_self_service_settings_via_api_flow(configuration: &configuration::Configuration, ) -> Result<crate::models::SettingsFlow, Error<InitializeSelfServiceSettingsViaApiFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/public/self-service/settings/api", configuration.base_path);
let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<InitializeSelfServiceSettingsViaApiFlowError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// This endpoint initializes a browser-based user settings flow. Once initialized, the browser will be redirected to `selfservice.flows.settings.ui_url` with the flow ID set as the query parameter `?flow=`. If no valid Ory Kratos Session Cookie is included in the request, a login flow will be initialized. :::note This endpoint is NOT INTENDED for API clients and only works with browsers (Chrome, Firefox, ...). ::: More information can be found at [Ory Kratos User Settings & Profile Management Documentation](../self-service/flows/user-settings).
pub async fn initialize_self_service_settings_via_browser_flow(configuration: &configuration::Configuration, ) -> Result<(), Error<InitializeSelfServiceSettingsViaBrowserFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/public/self-service/settings/browser", configuration.base_path);
let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(())
} else {
let local_var_entity: Option<InitializeSelfServiceSettingsViaBrowserFlowError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// This endpoint initiates a verification flow for API clients such as mobile devices, smart TVs, and so on. To fetch an existing verification flow call `/self-service/verification/flows?flow=<flow_id>`. :::warning You MUST NOT use this endpoint in client-side (Single Page Apps, ReactJS, AngularJS) nor server-side (Java Server Pages, NodeJS, PHP, Golang, ...) browser applications. Using this endpoint in these applications will make you vulnerable to a variety of CSRF attacks. This endpoint MUST ONLY be used in scenarios such as native mobile apps (React Native, Objective C, Swift, Java, ...). ::: More information can be found at [Ory Kratos Email and Phone Verification Documentation](https://www.ory.sh/docs/kratos/selfservice/flows/verify-email-account-activation).
pub async fn initialize_self_service_verification_via_api_flow(configuration: &configuration::Configuration, ) -> Result<crate::models::VerificationFlow, Error<InitializeSelfServiceVerificationViaApiFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/public/self-service/verification/api", configuration.base_path);
let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<InitializeSelfServiceVerificationViaApiFlowError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// This endpoint initializes a browser-based account verification flow. Once initialized, the browser will be redirected to `selfservice.flows.verification.ui_url` with the flow ID set as the query parameter `?flow=`. This endpoint is NOT INTENDED for API clients and only works with browsers (Chrome, Firefox, ...). More information can be found at [Ory Kratos Email and Phone Verification Documentation](https://www.ory.sh/docs/kratos/selfservice/flows/verify-email-account-activation).
pub async fn initialize_self_service_verification_via_browser_flow(configuration: &configuration::Configuration, ) -> Result<(), Error<InitializeSelfServiceVerificationViaBrowserFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/public/self-service/verification/browser", configuration.base_path);
let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(())
} else {
let local_var_entity: Option<InitializeSelfServiceVerificationViaBrowserFlowError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// This endpoint returns a HTTP 200 status code when Ory Kratos is accepting incoming HTTP requests. This status does currently not include checks whether the database connection is working. If the service supports TLS Edge Termination, this endpoint does not require the `X-Forwarded-Proto` header to be set. Be aware that if you are running multiple nodes of this service, the health status will never refer to the cluster state, only to a single instance.
pub async fn is_alive_admin(configuration: &configuration::Configuration, ) -> Result<crate::models::InlineResponse200, Error<IsAliveAdminError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/admin/health/alive", configuration.base_path);
let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<IsAliveAdminError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// This endpoint returns a HTTP 200 status code when Ory Kratos is up running and the environment dependencies (e.g. the database) are responsive as well. If the service supports TLS Edge Termination, this endpoint does not require the `X-Forwarded-Proto` header to be set. Be aware that if you are running multiple nodes of Ory Kratos, the health status will never refer to the cluster state, only to a single instance.
pub async fn is_ready_admin(configuration: &configuration::Configuration, ) -> Result<crate::models::InlineResponse200, Error<IsReadyAdminError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/admin/health/ready", configuration.base_path);
let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<IsReadyAdminError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// Lists all identities. Does not support search at the moment. Learn how identities work in [Ory Kratos' User And Identity Model Documentation](https://www.ory.sh/docs/next/kratos/concepts/identity-user-model).
pub async fn list_identities_admin(configuration: &configuration::Configuration, per_page: Option<i64>, page: Option<i64>) -> Result<Vec<crate::models::Identity>, Error<ListIdentitiesAdminError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/admin/identities", configuration.base_path);
let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
if let Some(ref local_var_str) = per_page {
local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = page {
local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<ListIdentitiesAdminError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// ``` metadata: annotations: prometheus.io/port: \"4434\" prometheus.io/path: \"/metrics/prometheus\" ```
pub async fn prometheus_admin(configuration: &configuration::Configuration, ) -> Result<(), Error<PrometheusAdminError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/admin/metrics/prometheus", configuration.base_path);
let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(())
} else {
let local_var_entity: Option<PrometheusAdminError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// Use this endpoint to revoke a session using its token. This endpoint is particularly useful for API clients such as mobile apps to log the user out of the system and invalidate the session. This endpoint does not remove any HTTP Cookies - use the Browser-Based Self-Service Logout Flow instead.
pub async fn revoke_session(configuration: &configuration::Configuration, revoke_session: crate::models::RevokeSession) -> Result<(), Error<RevokeSessionError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/public/sessions", configuration.base_path);
let mut local_var_req_builder = local_var_client.delete(local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
local_var_req_builder = local_var_req_builder.json(&revoke_session);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(())
} else {
let local_var_entity: Option<RevokeSessionError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// Use this endpoint to complete a login flow. This endpoint behaves differently for API and browser flows. API flows expect `application/json` to be sent in the body and responds with HTTP 200 and a application/json body with the session token on success; HTTP 302 redirect to a fresh login flow if the original flow expired with the appropriate error messages set; HTTP 400 on form validation errors. Browser flows expect `application/x-www-form-urlencoded` to be sent in the body and responds with a HTTP 302 redirect to the post/after login URL or the `return_to` value if it was set and if the login succeeded; a HTTP 302 redirect to the login UI URL with the flow ID containing the validation errors otherwise. More information can be found at [Ory Kratos User Login and User Registration Documentation](https://www.ory.sh/docs/next/kratos/self-service/flows/user-login-user-registration).
pub async fn submit_self_service_login_flow(configuration: &configuration::Configuration, flow: &str, submit_self_service_login_flow: Option<crate::models::SubmitSelfServiceLoginFlow>) -> Result<crate::models::LoginViaApiResponse, Error<SubmitSelfServiceLoginFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/public/self-service/login", configuration.base_path);
let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("flow", &flow.to_string())]);
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
local_var_req_builder = local_var_req_builder.json(&submit_self_service_login_flow);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<SubmitSelfServiceLoginFlowError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// Use this endpoint to complete a recovery flow. This endpoint behaves differently for API and browser flows and has several states: `choose_method` expects `flow` (in the URL query) and `email` (in the body) to be sent and works with API- and Browser-initiated flows. For API clients it either returns a HTTP 200 OK when the form is valid and HTTP 400 OK when the form is invalid and a HTTP 302 Found redirect with a fresh recovery flow if the flow was otherwise invalid (e.g. expired). For Browser clients it returns a HTTP 302 Found redirect to the Recovery UI URL with the Recovery Flow ID appended. `sent_email` is the success state after `choose_method` for the `link` method and allows the user to request another recovery email. It works for both API and Browser-initiated flows and returns the same responses as the flow in `choose_method` state. `passed_challenge` expects a `token` to be sent in the URL query and given the nature of the flow (\"sending a recovery link\") does not have any API capabilities. The server responds with a HTTP 302 Found redirect either to the Settings UI URL (if the link was valid) and instructs the user to update their password, or a redirect to the Recover UI URL with a new Recovery Flow ID which contains an error message that the recovery link was invalid. More information can be found at [Ory Kratos Account Recovery Documentation](../self-service/flows/account-recovery.mdx).
pub async fn submit_self_service_recovery_flow(configuration: &configuration::Configuration, flow: &str, body: Option<serde_json::Value>) -> Result<(), Error<SubmitSelfServiceRecoveryFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/public/self-service/recovery", configuration.base_path);
let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("flow", &flow.to_string())]);
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
local_var_req_builder = local_var_req_builder.json(&body);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(())
} else {
let local_var_entity: Option<SubmitSelfServiceRecoveryFlowError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// Use this endpoint to complete a recovery flow using the link method. This endpoint behaves differently for API and browser flows and has several states: `choose_method` expects `flow` (in the URL query) and `email` (in the body) to be sent and works with API- and Browser-initiated flows. For API clients it either returns a HTTP 200 OK when the form is valid and HTTP 400 OK when the form is invalid and a HTTP 302 Found redirect with a fresh recovery flow if the flow was otherwise invalid (e.g. expired). For Browser clients it returns a HTTP 302 Found redirect to the Recovery UI URL with the Recovery Flow ID appended. `sent_email` is the success state after `choose_method` and allows the user to request another recovery email. It works for both API and Browser-initiated flows and returns the same responses as the flow in `choose_method` state. `passed_challenge` expects a `token` to be sent in the URL query and given the nature of the flow (\"sending a recovery link\") does not have any API capabilities. The server responds with a HTTP 302 Found redirect either to the Settings UI URL (if the link was valid) and instructs the user to update their password, or a redirect to the Recover UI URL with a new Recovery Flow ID which contains an error message that the recovery link was invalid. More information can be found at [Ory Kratos Account Recovery Documentation](../self-service/flows/account-recovery.mdx).
pub async fn submit_self_service_recovery_flow_with_link_method(configuration: &configuration::Configuration, token: Option<&str>, flow: Option<&str>, submit_self_service_recovery_flow_with_link_method: Option<crate::models::SubmitSelfServiceRecoveryFlowWithLinkMethod>) -> Result<(), Error<SubmitSelfServiceRecoveryFlowWithLinkMethodError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/public/self-service/recovery/methods/link", configuration.base_path);
let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
if let Some(ref local_var_str) = token {
local_var_req_builder = local_var_req_builder.query(&[("token", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = flow {
local_var_req_builder = local_var_req_builder.query(&[("flow", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
local_var_req_builder = local_var_req_builder.json(&submit_self_service_recovery_flow_with_link_method);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(())
} else {
let local_var_entity: Option<SubmitSelfServiceRecoveryFlowWithLinkMethodError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// Use this endpoint to complete a registration flow by sending an identity's traits and password. This endpoint behaves differently for API and browser flows. API flows expect `application/json` to be sent in the body and respond with HTTP 200 and a application/json body with the created identity success - if the session hook is configured the `session` and `session_token` will also be included; HTTP 302 redirect to a fresh registration flow if the original flow expired with the appropriate error messages set; HTTP 400 on form validation errors. Browser flows expect `application/x-www-form-urlencoded` to be sent in the body and responds with a HTTP 302 redirect to the post/after registration URL or the `return_to` value if it was set and if the registration succeeded; a HTTP 302 redirect to the registration UI URL with the flow ID containing the validation errors otherwise. More information can be found at [Ory Kratos User Login and User Registration Documentation](https://www.ory.sh/docs/next/kratos/self-service/flows/user-login-user-registration).
pub async fn submit_self_service_registration_flow(configuration: &configuration::Configuration, flow: &str, submit_self_service_registration_flow: Option<crate::models::SubmitSelfServiceRegistrationFlow>) -> Result<crate::models::RegistrationViaApiResponse, Error<SubmitSelfServiceRegistrationFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/public/self-service/registration", configuration.base_path);
let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("flow", &flow.to_string())]);
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
local_var_req_builder = local_var_req_builder.json(&submit_self_service_registration_flow);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<SubmitSelfServiceRegistrationFlowError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// Use this endpoint to complete a settings flow by sending an identity's updated password. This endpoint behaves differently for API and browser flows. API-initiated flows expect `application/json` to be sent in the body and respond with HTTP 200 and an application/json body with the session token on success; HTTP 302 redirect to a fresh settings flow if the original flow expired with the appropriate error messages set; HTTP 400 on form validation errors. HTTP 401 when the endpoint is called without a valid session token. HTTP 403 when `selfservice.flows.settings.privileged_session_max_age` was reached. Implies that the user needs to re-authenticate. Browser flows expect `application/x-www-form-urlencoded` to be sent in the body and responds with a HTTP 302 redirect to the post/after settings URL or the `return_to` value if it was set and if the flow succeeded; a HTTP 302 redirect to the Settings UI URL with the flow ID containing the validation errors otherwise. a HTTP 302 redirect to the login endpoint when `selfservice.flows.settings.privileged_session_max_age` was reached. More information can be found at [Ory Kratos User Settings & Profile Management Documentation](../self-service/flows/user-settings).
pub async fn submit_self_service_settings_flow(configuration: &configuration::Configuration, flow: &str, submit_self_service_settings_flow: Option<crate::models::SubmitSelfServiceSettingsFlow>) -> Result<crate::models::SettingsViaApiResponse, Error<SubmitSelfServiceSettingsFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/public/self-service/settings", configuration.base_path);
let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("flow", &flow.to_string())]);
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&submit_self_service_settings_flow);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<SubmitSelfServiceSettingsFlowError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// Use this endpoint to complete a verification flow. This endpoint behaves differently for API and browser flows and has several states: `choose_method` expects `flow` (in the URL query) and `email` (in the body) to be sent and works with API- and Browser-initiated flows. For API clients it either returns a HTTP 200 OK when the form is valid and HTTP 400 OK when the form is invalid and a HTTP 302 Found redirect with a fresh verification flow if the flow was otherwise invalid (e.g. expired). For Browser clients it returns a HTTP 302 Found redirect to the Verification UI URL with the Verification Flow ID appended. `sent_email` is the success state after `choose_method` when using the `link` method and allows the user to request another verification email. It works for both API and Browser-initiated flows and returns the same responses as the flow in `choose_method` state. `passed_challenge` expects a `token` to be sent in the URL query and given the nature of the flow (\"sending a verification link\") does not have any API capabilities. The server responds with a HTTP 302 Found redirect either to the Settings UI URL (if the link was valid) and instructs the user to update their password, or a redirect to the Verification UI URL with a new Verification Flow ID which contains an error message that the verification link was invalid. More information can be found at [Ory Kratos Email and Phone Verification Documentation](https://www.ory.sh/docs/kratos/selfservice/flows/verify-email-account-activation).
pub async fn submit_self_service_verification_flow(configuration: &configuration::Configuration, flow: &str, body: Option<serde_json::Value>) -> Result<(), Error<SubmitSelfServiceVerificationFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/public/self-service/verification/methods/link", configuration.base_path);
let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("flow", &flow.to_string())]);
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
local_var_req_builder = local_var_req_builder.json(&body);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(())
} else {
let local_var_entity: Option<SubmitSelfServiceVerificationFlowError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// Uses the HTTP Headers in the GET request to determine (e.g. by using checking the cookies) who is authenticated. Returns a session object in the body or 401 if the credentials are invalid or no credentials were sent. Additionally when the request it successful it adds the user ID to the 'X-Kratos-Authenticated-Identity-Id' header in the response. This endpoint is useful for: AJAX calls. Remember to send credentials and set up CORS correctly! Reverse proxies and API Gateways Server-side calls - use the `X-Session-Token` header!
pub async fn to_session(configuration: &configuration::Configuration, x_session_token: Option<&str>) -> Result<crate::models::Session, Error<ToSessionError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/public/sessions/whoami", configuration.base_path);
let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(local_var_param_value) = x_session_token {
local_var_req_builder = local_var_req_builder.header("X-Session-Token", local_var_param_value.to_string());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<ToSessionError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// This endpoint updates an identity. It is NOT possible to set an identity's credentials (password, ...) using this method! A way to achieve that will be introduced in the future. The full identity payload (except credentials) is expected. This endpoint does not support patching. Learn how identities work in [Ory Kratos' User And Identity Model Documentation](https://www.ory.sh/docs/next/kratos/concepts/identity-user-model).
pub async fn update_identity_admin(configuration: &configuration::Configuration, id: &str, update_identity: Option<crate::models::UpdateIdentity>) -> Result<crate::models::Identity, Error<UpdateIdentityAdminError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/api/kratos/admin/identities/{id}", configuration.base_path, id=crate::apis::urlencode(id));
let mut local_var_req_builder = local_var_client.put(local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = configuration.bearer_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&update_identity);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<UpdateIdentityAdminError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}