use std::fmt::Display;
use num_traits;
use reqwest;
use crate::apis::ResponseContent;
use super::{Error, configuration};
trait NumVecJoin {
fn join(&self, sep: &str) -> String;
}
impl <T: Display + num_traits::Num> NumVecJoin for Vec<T> {
fn join(&self, sep: &str) -> String {
self.iter()
.map(ToString::to_string)
.collect::<Vec<String>>()
.join(sep)
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateBrowserLoginFlowError {
Status400(crate::models::ErrorGeneric),
DefaultResponse(crate::models::ErrorGeneric),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateBrowserLogoutFlowError {
Status400(crate::models::ErrorGeneric),
Status401(crate::models::ErrorGeneric),
Status500(crate::models::ErrorGeneric),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateBrowserRecoveryFlowError {
Status400(crate::models::ErrorGeneric),
DefaultResponse(crate::models::ErrorGeneric),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateBrowserRegistrationFlowError {
DefaultResponse(crate::models::ErrorGeneric),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateBrowserSettingsFlowError {
Status400(crate::models::ErrorGeneric),
Status401(crate::models::ErrorGeneric),
Status403(crate::models::ErrorGeneric),
DefaultResponse(crate::models::ErrorGeneric),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateBrowserVerificationFlowError {
DefaultResponse(crate::models::ErrorGeneric),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateNativeLoginFlowError {
Status400(crate::models::ErrorGeneric),
DefaultResponse(crate::models::ErrorGeneric),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateNativeRecoveryFlowError {
Status400(crate::models::ErrorGeneric),
DefaultResponse(crate::models::ErrorGeneric),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateNativeRegistrationFlowError {
Status400(crate::models::ErrorGeneric),
DefaultResponse(crate::models::ErrorGeneric),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateNativeSettingsFlowError {
Status400(crate::models::ErrorGeneric),
DefaultResponse(crate::models::ErrorGeneric),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateNativeVerificationFlowError {
Status400(crate::models::ErrorGeneric),
DefaultResponse(crate::models::ErrorGeneric),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DisableMyOtherSessionsError {
Status400(crate::models::ErrorGeneric),
Status401(crate::models::ErrorGeneric),
DefaultResponse(crate::models::ErrorGeneric),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DisableMySessionError {
Status400(crate::models::ErrorGeneric),
Status401(crate::models::ErrorGeneric),
DefaultResponse(crate::models::ErrorGeneric),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ExchangeSessionTokenError {
Status403(crate::models::ErrorGeneric),
Status404(crate::models::ErrorGeneric),
Status410(crate::models::ErrorGeneric),
DefaultResponse(crate::models::ErrorGeneric),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetFlowErrorError {
Status403(crate::models::ErrorGeneric),
Status404(crate::models::ErrorGeneric),
Status500(crate::models::ErrorGeneric),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetLoginFlowError {
Status403(crate::models::ErrorGeneric),
Status404(crate::models::ErrorGeneric),
Status410(crate::models::ErrorGeneric),
DefaultResponse(crate::models::ErrorGeneric),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetRecoveryFlowError {
Status404(crate::models::ErrorGeneric),
Status410(crate::models::ErrorGeneric),
DefaultResponse(crate::models::ErrorGeneric),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetRegistrationFlowError {
Status403(crate::models::ErrorGeneric),
Status404(crate::models::ErrorGeneric),
Status410(crate::models::ErrorGeneric),
DefaultResponse(crate::models::ErrorGeneric),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetSettingsFlowError {
Status401(crate::models::ErrorGeneric),
Status403(crate::models::ErrorGeneric),
Status404(crate::models::ErrorGeneric),
Status410(crate::models::ErrorGeneric),
DefaultResponse(crate::models::ErrorGeneric),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetVerificationFlowError {
Status403(crate::models::ErrorGeneric),
Status404(crate::models::ErrorGeneric),
DefaultResponse(crate::models::ErrorGeneric),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetWebAuthnJavaScriptError {
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListMySessionsError {
Status400(crate::models::ErrorGeneric),
Status401(crate::models::ErrorGeneric),
DefaultResponse(crate::models::ErrorGeneric),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PerformNativeLogoutError {
Status400(crate::models::ErrorGeneric),
DefaultResponse(crate::models::ErrorGeneric),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ToSessionError {
Status401(crate::models::ErrorGeneric),
Status403(crate::models::ErrorGeneric),
DefaultResponse(crate::models::ErrorGeneric),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateLoginFlowError {
Status400(crate::models::LoginFlow),
Status410(crate::models::ErrorGeneric),
Status422(crate::models::ErrorBrowserLocationChangeRequired),
DefaultResponse(crate::models::ErrorGeneric),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateLogoutFlowError {
DefaultResponse(crate::models::ErrorGeneric),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateRecoveryFlowError {
Status400(crate::models::RecoveryFlow),
Status410(crate::models::ErrorGeneric),
Status422(crate::models::ErrorBrowserLocationChangeRequired),
DefaultResponse(crate::models::ErrorGeneric),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateRegistrationFlowError {
Status400(crate::models::RegistrationFlow),
Status410(crate::models::ErrorGeneric),
Status422(crate::models::ErrorBrowserLocationChangeRequired),
DefaultResponse(crate::models::ErrorGeneric),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateSettingsFlowError {
Status400(crate::models::SettingsFlow),
Status401(crate::models::ErrorGeneric),
Status403(crate::models::ErrorGeneric),
Status410(crate::models::ErrorGeneric),
Status422(crate::models::ErrorBrowserLocationChangeRequired),
DefaultResponse(crate::models::ErrorGeneric),
UnknownValue(serde_json::Value),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateVerificationFlowError {
Status400(crate::models::VerificationFlow),
Status410(crate::models::ErrorGeneric),
DefaultResponse(crate::models::ErrorGeneric),
UnknownValue(serde_json::Value),
}
pub async fn create_browser_login_flow(configuration: &configuration::Configuration, refresh: Option<bool>, aal: Option<&str>, return_to: Option<&str>, cookie: Option<&str>, login_challenge: Option<&str>, organization: Option<&str>) -> Result<crate::models::LoginFlow, Error<CreateBrowserLoginFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/self-service/login/browser", configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::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_str) = aal {
local_var_req_builder = local_var_req_builder.query(&[("aal", local_var_str.to_string())]);
}
if let Some(ref local_var_str) = return_to {
local_var_req_builder = local_var_req_builder.query(&[("return_to", local_var_str.to_string())]);
}
if let Some(ref local_var_str) = login_challenge {
local_var_req_builder = local_var_req_builder.query(&[("login_challenge", local_var_str.to_string())]);
}
if let Some(ref local_var_str) = organization {
local_var_req_builder = local_var_req_builder.query(&[("organization", 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(local_var_param_value) = cookie {
local_var_req_builder = local_var_req_builder.header("Cookie", 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<CreateBrowserLoginFlowError> = 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))
}
}
pub async fn create_browser_logout_flow(configuration: &configuration::Configuration, cookie: Option<&str>, return_to: Option<&str>) -> Result<crate::models::LogoutFlow, Error<CreateBrowserLogoutFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/self-service/logout/browser", configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_str) = return_to {
local_var_req_builder = local_var_req_builder.query(&[("return_to", 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(local_var_param_value) = cookie {
local_var_req_builder = local_var_req_builder.header("cookie", 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<CreateBrowserLogoutFlowError> = 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))
}
}
pub async fn create_browser_recovery_flow(configuration: &configuration::Configuration, return_to: Option<&str>) -> Result<crate::models::RecoveryFlow, Error<CreateBrowserRecoveryFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/self-service/recovery/browser", configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_str) = return_to {
local_var_req_builder = local_var_req_builder.query(&[("return_to", 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<CreateBrowserRecoveryFlowError> = 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))
}
}
pub async fn create_browser_registration_flow(configuration: &configuration::Configuration, return_to: Option<&str>, login_challenge: Option<&str>, after_verification_return_to: Option<&str>, organization: Option<&str>) -> Result<crate::models::RegistrationFlow, Error<CreateBrowserRegistrationFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/self-service/registration/browser", configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_str) = return_to {
local_var_req_builder = local_var_req_builder.query(&[("return_to", local_var_str.to_string())]);
}
if let Some(ref local_var_str) = login_challenge {
local_var_req_builder = local_var_req_builder.query(&[("login_challenge", local_var_str.to_string())]);
}
if let Some(ref local_var_str) = after_verification_return_to {
local_var_req_builder = local_var_req_builder.query(&[("after_verification_return_to", local_var_str.to_string())]);
}
if let Some(ref local_var_str) = organization {
local_var_req_builder = local_var_req_builder.query(&[("organization", 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<CreateBrowserRegistrationFlowError> = 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))
}
}
pub async fn create_browser_settings_flow(configuration: &configuration::Configuration, return_to: Option<&str>, cookie: Option<&str>) -> Result<crate::models::SettingsFlow, Error<CreateBrowserSettingsFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/self-service/settings/browser", configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_str) = return_to {
local_var_req_builder = local_var_req_builder.query(&[("return_to", 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(local_var_param_value) = cookie {
local_var_req_builder = local_var_req_builder.header("Cookie", 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<CreateBrowserSettingsFlowError> = 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))
}
}
pub async fn create_browser_verification_flow(configuration: &configuration::Configuration, return_to: Option<&str>) -> Result<crate::models::VerificationFlow, Error<CreateBrowserVerificationFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/self-service/verification/browser", configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_str) = return_to {
local_var_req_builder = local_var_req_builder.query(&[("return_to", 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<CreateBrowserVerificationFlowError> = 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))
}
}
pub async fn create_native_login_flow(configuration: &configuration::Configuration, refresh: Option<bool>, aal: Option<&str>, x_session_token: Option<&str>, return_session_token_exchange_code: Option<bool>, return_to: Option<&str>) -> Result<crate::models::LoginFlow, Error<CreateNativeLoginFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/self-service/login/api", configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::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_str) = aal {
local_var_req_builder = local_var_req_builder.query(&[("aal", local_var_str.to_string())]);
}
if let Some(ref local_var_str) = return_session_token_exchange_code {
local_var_req_builder = local_var_req_builder.query(&[("return_session_token_exchange_code", local_var_str.to_string())]);
}
if let Some(ref local_var_str) = return_to {
local_var_req_builder = local_var_req_builder.query(&[("return_to", 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(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<CreateNativeLoginFlowError> = 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))
}
}
pub async fn create_native_recovery_flow(configuration: &configuration::Configuration, ) -> Result<crate::models::RecoveryFlow, Error<CreateNativeRecoveryFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/self-service/recovery/api", configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::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<CreateNativeRecoveryFlowError> = 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))
}
}
pub async fn create_native_registration_flow(configuration: &configuration::Configuration, return_session_token_exchange_code: Option<bool>, return_to: Option<&str>) -> Result<crate::models::RegistrationFlow, Error<CreateNativeRegistrationFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/self-service/registration/api", configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_str) = return_session_token_exchange_code {
local_var_req_builder = local_var_req_builder.query(&[("return_session_token_exchange_code", local_var_str.to_string())]);
}
if let Some(ref local_var_str) = return_to {
local_var_req_builder = local_var_req_builder.query(&[("return_to", 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<CreateNativeRegistrationFlowError> = 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))
}
}
pub async fn create_native_settings_flow(configuration: &configuration::Configuration, x_session_token: Option<&str>) -> Result<crate::models::SettingsFlow, Error<CreateNativeSettingsFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/self-service/settings/api", configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::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<CreateNativeSettingsFlowError> = 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))
}
}
pub async fn create_native_verification_flow(configuration: &configuration::Configuration, ) -> Result<crate::models::VerificationFlow, Error<CreateNativeVerificationFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/self-service/verification/api", configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::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<CreateNativeVerificationFlowError> = 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))
}
}
pub async fn disable_my_other_sessions(configuration: &configuration::Configuration, x_session_token: Option<&str>, cookie: Option<&str>) -> Result<crate::models::DeleteMySessionsCount, Error<DisableMyOtherSessionsError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/sessions", configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::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(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());
}
if let Some(local_var_param_value) = cookie {
local_var_req_builder = local_var_req_builder.header("Cookie", 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<DisableMyOtherSessionsError> = 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))
}
}
pub async fn disable_my_session(configuration: &configuration::Configuration, id: &str, x_session_token: Option<&str>, cookie: Option<&str>) -> Result<(), Error<DisableMySessionError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/sessions/{id}", configuration.base_path, id=crate::apis::urlencode(id));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::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(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());
}
if let Some(local_var_param_value) = cookie {
local_var_req_builder = local_var_req_builder.header("Cookie", 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() {
Ok(())
} else {
let local_var_entity: Option<DisableMySessionError> = 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))
}
}
pub async fn exchange_session_token(configuration: &configuration::Configuration, init_code: &str, return_to_code: &str) -> Result<crate::models::SuccessfulNativeLogin, Error<ExchangeSessionTokenError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/sessions/token-exchange", configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("init_code", init_code.to_string())]);
local_var_req_builder = local_var_req_builder.query(&[("return_to_code", return_to_code.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<ExchangeSessionTokenError> = 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))
}
}
pub async fn get_flow_error(configuration: &configuration::Configuration, id: &str) -> Result<crate::models::FlowError, Error<GetFlowErrorError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/self-service/errors", configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::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<GetFlowErrorError> = 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))
}
}
pub async fn get_login_flow(configuration: &configuration::Configuration, id: &str, cookie: Option<&str>) -> Result<crate::models::LoginFlow, Error<GetLoginFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/self-service/login/flows", configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::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(local_var_param_value) = cookie {
local_var_req_builder = local_var_req_builder.header("Cookie", 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<GetLoginFlowError> = 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))
}
}
pub async fn get_recovery_flow(configuration: &configuration::Configuration, id: &str, cookie: Option<&str>) -> Result<crate::models::RecoveryFlow, Error<GetRecoveryFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/self-service/recovery/flows", configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::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(local_var_param_value) = cookie {
local_var_req_builder = local_var_req_builder.header("Cookie", 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<GetRecoveryFlowError> = 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))
}
}
pub async fn get_registration_flow(configuration: &configuration::Configuration, id: &str, cookie: Option<&str>) -> Result<crate::models::RegistrationFlow, Error<GetRegistrationFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/self-service/registration/flows", configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::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(local_var_param_value) = cookie {
local_var_req_builder = local_var_req_builder.header("Cookie", 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<GetRegistrationFlowError> = 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))
}
}
pub async fn get_settings_flow(configuration: &configuration::Configuration, id: &str, x_session_token: Option<&str>, cookie: Option<&str>) -> Result<crate::models::SettingsFlow, Error<GetSettingsFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/self-service/settings/flows", configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::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(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());
}
if let Some(local_var_param_value) = cookie {
local_var_req_builder = local_var_req_builder.header("Cookie", 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<GetSettingsFlowError> = 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))
}
}
pub async fn get_verification_flow(configuration: &configuration::Configuration, id: &str, cookie: Option<&str>) -> Result<crate::models::VerificationFlow, Error<GetVerificationFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/self-service/verification/flows", configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::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(local_var_param_value) = cookie {
local_var_req_builder = local_var_req_builder.header("cookie", 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<GetVerificationFlowError> = 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))
}
}
pub async fn get_web_authn_java_script(configuration: &configuration::Configuration, ) -> Result<String, Error<GetWebAuthnJavaScriptError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/.well-known/ory/webauthn.js", configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::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<GetWebAuthnJavaScriptError> = 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))
}
}
pub async fn list_my_sessions(configuration: &configuration::Configuration, per_page: Option<i64>, page: Option<i64>, page_size: Option<i64>, page_token: Option<&str>, x_session_token: Option<&str>, cookie: Option<&str>) -> Result<Vec<crate::models::Session>, Error<ListMySessionsError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/sessions", configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::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_str) = page_size {
local_var_req_builder = local_var_req_builder.query(&[("page_size", local_var_str.to_string())]);
}
if let Some(ref local_var_str) = page_token {
local_var_req_builder = local_var_req_builder.query(&[("page_token", 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(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());
}
if let Some(local_var_param_value) = cookie {
local_var_req_builder = local_var_req_builder.header("Cookie", 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<ListMySessionsError> = 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))
}
}
pub async fn perform_native_logout(configuration: &configuration::Configuration, perform_native_logout_body: &crate::models::PerformNativeLogoutBody) -> Result<(), Error<PerformNativeLogoutError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/self-service/logout/api", configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::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(&perform_native_logout_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<PerformNativeLogoutError> = 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))
}
}
pub async fn to_session(configuration: &configuration::Configuration, x_session_token: Option<&str>, cookie: Option<&str>, tokenize_as: Option<&str>) -> Result<crate::models::Session, Error<ToSessionError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/sessions/whoami", configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_str) = tokenize_as {
local_var_req_builder = local_var_req_builder.query(&[("tokenize_as", 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(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());
}
if let Some(local_var_param_value) = cookie {
local_var_req_builder = local_var_req_builder.header("Cookie", 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))
}
}
pub async fn update_login_flow(configuration: &configuration::Configuration, flow: &str, update_login_flow_body: &crate::models::UpdateLoginFlowBody, x_session_token: Option<&str>, cookie: Option<&str>) -> Result<crate::models::SuccessfulNativeLogin, Error<UpdateLoginFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/self-service/login", configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::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(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());
}
if let Some(local_var_param_value) = cookie {
local_var_req_builder = local_var_req_builder.header("Cookie", local_var_param_value.to_string());
}
local_var_req_builder = local_var_req_builder.json(&update_login_flow_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() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<UpdateLoginFlowError> = 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))
}
}
pub async fn update_logout_flow(configuration: &configuration::Configuration, token: Option<&str>, return_to: Option<&str>, cookie: Option<&str>) -> Result<(), Error<UpdateLogoutFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/self-service/logout", configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, 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) = return_to {
local_var_req_builder = local_var_req_builder.query(&[("return_to", 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(local_var_param_value) = cookie {
local_var_req_builder = local_var_req_builder.header("Cookie", 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() {
Ok(())
} else {
let local_var_entity: Option<UpdateLogoutFlowError> = 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))
}
}
pub async fn update_recovery_flow(configuration: &configuration::Configuration, flow: &str, update_recovery_flow_body: &crate::models::UpdateRecoveryFlowBody, token: Option<&str>, cookie: Option<&str>) -> Result<crate::models::RecoveryFlow, Error<UpdateRecoveryFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/self-service/recovery", configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::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_str) = token {
local_var_req_builder = local_var_req_builder.query(&[("token", 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(local_var_param_value) = cookie {
local_var_req_builder = local_var_req_builder.header("Cookie", local_var_param_value.to_string());
}
local_var_req_builder = local_var_req_builder.json(&update_recovery_flow_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() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<UpdateRecoveryFlowError> = 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))
}
}
pub async fn update_registration_flow(configuration: &configuration::Configuration, flow: &str, update_registration_flow_body: &crate::models::UpdateRegistrationFlowBody, cookie: Option<&str>) -> Result<crate::models::SuccessfulNativeRegistration, Error<UpdateRegistrationFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/self-service/registration", configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::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(local_var_param_value) = cookie {
local_var_req_builder = local_var_req_builder.header("Cookie", local_var_param_value.to_string());
}
local_var_req_builder = local_var_req_builder.json(&update_registration_flow_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() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<UpdateRegistrationFlowError> = 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))
}
}
pub async fn update_settings_flow(configuration: &configuration::Configuration, flow: &str, update_settings_flow_body: &crate::models::UpdateSettingsFlowBody, x_session_token: Option<&str>, cookie: Option<&str>) -> Result<crate::models::SettingsFlow, Error<UpdateSettingsFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/self-service/settings", configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::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(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());
}
if let Some(local_var_param_value) = cookie {
local_var_req_builder = local_var_req_builder.header("Cookie", local_var_param_value.to_string());
}
local_var_req_builder = local_var_req_builder.json(&update_settings_flow_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() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<UpdateSettingsFlowError> = 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))
}
}
pub async fn update_verification_flow(configuration: &configuration::Configuration, flow: &str, update_verification_flow_body: &crate::models::UpdateVerificationFlowBody, token: Option<&str>, cookie: Option<&str>) -> Result<crate::models::VerificationFlow, Error<UpdateVerificationFlowError>> {
let local_var_client = &configuration.client;
let local_var_uri_str = format!("{}/self-service/verification", configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::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_str) = token {
local_var_req_builder = local_var_req_builder.query(&[("token", 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(local_var_param_value) = cookie {
local_var_req_builder = local_var_req_builder.header("Cookie", local_var_param_value.to_string());
}
local_var_req_builder = local_var_req_builder.json(&update_verification_flow_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() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<UpdateVerificationFlowError> = 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))
}
}