mirror of
https://github.com/mii443/vrchatapi-rust.git
synced 2025-08-22 23:55:33 +00:00
@ -79,7 +79,7 @@ pub enum VerifyRecoveryCodeError {
|
||||
|
||||
|
||||
/// Checks if a user by a given `username`, `displayName` or `email` exist. This is used during registration to check if a username has already been taken, during change of displayName to check if a displayName is available, and during change of email to check if the email is already used. In the later two cases the `excludeUserId` is used to exclude oneself, otherwise the result would always be true. It is **REQUIRED** to include **AT LEAST** `username`, `displayName` **or** `email` query parameter. Although they can be combined - in addition with `excludeUserId` (generally to exclude yourself) - to further fine-tune the search.
|
||||
pub fn check_user_exists(configuration: &configuration::Configuration, email: Option<&str>, display_name: Option<&str>, user_id: Option<&str>, exclude_user_id: Option<&str>) -> Result<models::UserExists, Error<CheckUserExistsError>> {
|
||||
pub async fn check_user_exists(configuration: &configuration::Configuration, email: Option<&str>, display_name: Option<&str>, user_id: Option<&str>, exclude_user_id: Option<&str>) -> Result<models::UserExists, Error<CheckUserExistsError>> {
|
||||
let local_var_configuration = configuration;
|
||||
|
||||
let local_var_client = &local_var_configuration.client;
|
||||
@ -104,10 +104,10 @@ pub fn check_user_exists(configuration: &configuration::Configuration, email: Op
|
||||
}
|
||||
|
||||
let local_var_req = local_var_req_builder.build()?;
|
||||
let local_var_resp = local_var_client.execute(local_var_req)?;
|
||||
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()?;
|
||||
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)
|
||||
@ -119,7 +119,7 @@ pub fn check_user_exists(configuration: &configuration::Configuration, email: Op
|
||||
}
|
||||
|
||||
/// Deletes the account with given ID. Normal users only have permission to delete their own account. Account deletion is 14 days from this request, and will be cancelled if you do an authenticated request with the account afterwards. **VRC+ NOTE:** Despite the 14-days cooldown, any VRC+ subscription will be cancelled **immediately**. **METHOD NOTE:** Despite this being a Delete action, the method type required is PUT.
|
||||
pub fn delete_user(configuration: &configuration::Configuration, user_id: &str) -> Result<models::CurrentUser, Error<DeleteUserError>> {
|
||||
pub async fn delete_user(configuration: &configuration::Configuration, user_id: &str) -> Result<models::CurrentUser, Error<DeleteUserError>> {
|
||||
let local_var_configuration = configuration;
|
||||
|
||||
let local_var_client = &local_var_configuration.client;
|
||||
@ -132,10 +132,10 @@ pub fn delete_user(configuration: &configuration::Configuration, user_id: &str)
|
||||
}
|
||||
|
||||
let local_var_req = local_var_req_builder.build()?;
|
||||
let local_var_resp = local_var_client.execute(local_var_req)?;
|
||||
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()?;
|
||||
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)
|
||||
@ -147,7 +147,7 @@ pub fn delete_user(configuration: &configuration::Configuration, user_id: &str)
|
||||
}
|
||||
|
||||
/// This endpoint does the following two operations: 1) Checks if you are already logged in by looking for a valid `auth` cookie. If you are have a valid auth cookie then no additional auth-related actions are taken. If you are **not** logged in then it will log you in with the `Authorization` header and set the `auth` cookie. The `auth` cookie will only be sent once. 2) If logged in, this function will also return the CurrentUser object containing detailed information about the currently logged in user. The auth string after `Authorization: Basic {string}` is a base64-encoded string of the username and password, both individually url-encoded, and then joined with a colon. > base64(urlencode(username):urlencode(password)) **WARNING: Session Limit:** Each authentication with login credentials counts as a separate session, out of which you have a limited amount. Make sure to save and reuse the `auth` cookie if you are often restarting the program. The provided API libraries automatically save cookies during runtime, but does not persist during restart. While it can be fine to use username/password during development, expect in production to very fast run into the rate-limit and be temporarily blocked from making new sessions until older ones expire. The exact number of simultaneous sessions is unknown/undisclosed.
|
||||
pub fn get_current_user(configuration: &configuration::Configuration, ) -> Result<models::CurrentUser, Error<GetCurrentUserError>> {
|
||||
pub async fn get_current_user(configuration: &configuration::Configuration, ) -> Result<models::CurrentUser, Error<GetCurrentUserError>> {
|
||||
let local_var_configuration = configuration;
|
||||
|
||||
let local_var_client = &local_var_configuration.client;
|
||||
@ -163,10 +163,10 @@ pub fn get_current_user(configuration: &configuration::Configuration, ) -> Resul
|
||||
};
|
||||
|
||||
let local_var_req = local_var_req_builder.build()?;
|
||||
let local_var_resp = local_var_client.execute(local_var_req)?;
|
||||
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()?;
|
||||
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)
|
||||
@ -178,7 +178,7 @@ pub fn get_current_user(configuration: &configuration::Configuration, ) -> Resul
|
||||
}
|
||||
|
||||
/// Invalidates the login session.
|
||||
pub fn logout(configuration: &configuration::Configuration, ) -> Result<models::Success, Error<LogoutError>> {
|
||||
pub async fn logout(configuration: &configuration::Configuration, ) -> Result<models::Success, Error<LogoutError>> {
|
||||
let local_var_configuration = configuration;
|
||||
|
||||
let local_var_client = &local_var_configuration.client;
|
||||
@ -191,10 +191,10 @@ pub fn logout(configuration: &configuration::Configuration, ) -> Result<models::
|
||||
}
|
||||
|
||||
let local_var_req = local_var_req_builder.build()?;
|
||||
let local_var_resp = local_var_client.execute(local_var_req)?;
|
||||
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()?;
|
||||
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)
|
||||
@ -206,7 +206,7 @@ pub fn logout(configuration: &configuration::Configuration, ) -> Result<models::
|
||||
}
|
||||
|
||||
/// Finishes the login sequence with a normal 2FA-generated code for accounts with 2FA-protection enabled.
|
||||
pub fn verify2_fa(configuration: &configuration::Configuration, two_factor_auth_code: models::TwoFactorAuthCode) -> Result<models::Verify2FaResult, Error<Verify2FaError>> {
|
||||
pub async fn verify2_fa(configuration: &configuration::Configuration, two_factor_auth_code: models::TwoFactorAuthCode) -> Result<models::Verify2FaResult, Error<Verify2FaError>> {
|
||||
let local_var_configuration = configuration;
|
||||
|
||||
let local_var_client = &local_var_configuration.client;
|
||||
@ -220,10 +220,10 @@ pub fn verify2_fa(configuration: &configuration::Configuration, two_factor_auth_
|
||||
local_var_req_builder = local_var_req_builder.json(&two_factor_auth_code);
|
||||
|
||||
let local_var_req = local_var_req_builder.build()?;
|
||||
let local_var_resp = local_var_client.execute(local_var_req)?;
|
||||
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()?;
|
||||
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)
|
||||
@ -235,7 +235,7 @@ pub fn verify2_fa(configuration: &configuration::Configuration, two_factor_auth_
|
||||
}
|
||||
|
||||
/// Finishes the login sequence with an 2FA email code.
|
||||
pub fn verify2_fa_email_code(configuration: &configuration::Configuration, two_factor_email_code: models::TwoFactorEmailCode) -> Result<models::Verify2FaEmailCodeResult, Error<Verify2FaEmailCodeError>> {
|
||||
pub async fn verify2_fa_email_code(configuration: &configuration::Configuration, two_factor_email_code: models::TwoFactorEmailCode) -> Result<models::Verify2FaEmailCodeResult, Error<Verify2FaEmailCodeError>> {
|
||||
let local_var_configuration = configuration;
|
||||
|
||||
let local_var_client = &local_var_configuration.client;
|
||||
@ -249,10 +249,10 @@ pub fn verify2_fa_email_code(configuration: &configuration::Configuration, two_f
|
||||
local_var_req_builder = local_var_req_builder.json(&two_factor_email_code);
|
||||
|
||||
let local_var_req = local_var_req_builder.build()?;
|
||||
let local_var_resp = local_var_client.execute(local_var_req)?;
|
||||
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()?;
|
||||
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)
|
||||
@ -264,7 +264,7 @@ pub fn verify2_fa_email_code(configuration: &configuration::Configuration, two_f
|
||||
}
|
||||
|
||||
/// Verify whether the currently provided Auth Token is valid.
|
||||
pub fn verify_auth_token(configuration: &configuration::Configuration, ) -> Result<models::VerifyAuthTokenResult, Error<VerifyAuthTokenError>> {
|
||||
pub async fn verify_auth_token(configuration: &configuration::Configuration, ) -> Result<models::VerifyAuthTokenResult, Error<VerifyAuthTokenError>> {
|
||||
let local_var_configuration = configuration;
|
||||
|
||||
let local_var_client = &local_var_configuration.client;
|
||||
@ -277,10 +277,10 @@ pub fn verify_auth_token(configuration: &configuration::Configuration, ) -> Resu
|
||||
}
|
||||
|
||||
let local_var_req = local_var_req_builder.build()?;
|
||||
let local_var_resp = local_var_client.execute(local_var_req)?;
|
||||
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()?;
|
||||
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)
|
||||
@ -292,7 +292,7 @@ pub fn verify_auth_token(configuration: &configuration::Configuration, ) -> Resu
|
||||
}
|
||||
|
||||
/// Finishes the login sequence with an OTP (One Time Password) recovery code for accounts with 2FA-protection enabled.
|
||||
pub fn verify_recovery_code(configuration: &configuration::Configuration, two_factor_auth_code: models::TwoFactorAuthCode) -> Result<models::Verify2FaResult, Error<VerifyRecoveryCodeError>> {
|
||||
pub async fn verify_recovery_code(configuration: &configuration::Configuration, two_factor_auth_code: models::TwoFactorAuthCode) -> Result<models::Verify2FaResult, Error<VerifyRecoveryCodeError>> {
|
||||
let local_var_configuration = configuration;
|
||||
|
||||
let local_var_client = &local_var_configuration.client;
|
||||
@ -306,10 +306,10 @@ pub fn verify_recovery_code(configuration: &configuration::Configuration, two_fa
|
||||
local_var_req_builder = local_var_req_builder.json(&two_factor_auth_code);
|
||||
|
||||
let local_var_req = local_var_req_builder.build()?;
|
||||
let local_var_resp = local_var_client.execute(local_var_req)?;
|
||||
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()?;
|
||||
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)
|
||||
|
Reference in New Issue
Block a user