From eab2581c3e6603bec1fdb3d3e494c5dada2caeca Mon Sep 17 00:00:00 2001 From: VRCCat Date: Sun, 22 Jan 2023 17:24:39 +0000 Subject: [PATCH] Upgrade Rust SDK to spec 1.11.0 --- .openapi-generator/FILES | 4 +++ Cargo.toml | 4 +-- docs/AuthenticationApi.md | 33 +++++++++++++++++- docs/TwoFactorEmailCode.md | 11 ++++++ docs/Verify2FaEmailCodeResult.md | 11 ++++++ src/apis/authentication_api.rs | 39 +++++++++++++++++++++- src/models/mod.rs | 4 +++ src/models/two_factor_email_code.rs | 26 +++++++++++++++ src/models/verify2_fa_email_code_result.rs | 26 +++++++++++++++ 9 files changed, 154 insertions(+), 4 deletions(-) create mode 100644 docs/TwoFactorEmailCode.md create mode 100644 docs/Verify2FaEmailCodeResult.md create mode 100644 src/models/two_factor_email_code.rs create mode 100644 src/models/verify2_fa_email_code_result.rs diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 9f212a6..fd8f706 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -112,6 +112,7 @@ docs/TransactionStatus.md docs/TransactionSteamInfo.md docs/TransactionSteamWalletInfo.md docs/TwoFactorAuthCode.md +docs/TwoFactorEmailCode.md docs/UnityPackage.md docs/UpdateAvatarRequest.md docs/UpdateFavoriteGroupRequest.md @@ -128,6 +129,7 @@ docs/UserState.md docs/UserStatus.md docs/UserSubscription.md docs/UsersApi.md +docs/Verify2FaEmailCodeResult.md docs/Verify2FaResult.md docs/VerifyAuthTokenResult.md docs/World.md @@ -253,6 +255,7 @@ src/models/transaction_status.rs src/models/transaction_steam_info.rs src/models/transaction_steam_wallet_info.rs src/models/two_factor_auth_code.rs +src/models/two_factor_email_code.rs src/models/unity_package.rs src/models/update_avatar_request.rs src/models/update_favorite_group_request.rs @@ -268,6 +271,7 @@ src/models/user_exists.rs src/models/user_state.rs src/models/user_status.rs src/models/user_subscription.rs +src/models/verify2_fa_email_code_result.rs src/models/verify2_fa_result.rs src/models/verify_auth_token_result.rs src/models/world.rs diff --git a/Cargo.toml b/Cargo.toml index 542e179..037790d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,9 @@ [package] name = "vrchatapi" -version = "1.10.1" +version = "1.11.0" authors = ["me@ariesclark.com"] description = "VRChat API Client for Rust" -license = "The MIT License (MIT)" +license = "MIT" edition = "2018" [dependencies] diff --git a/docs/AuthenticationApi.md b/docs/AuthenticationApi.md index c32dafa..0cb9fc7 100644 --- a/docs/AuthenticationApi.md +++ b/docs/AuthenticationApi.md @@ -5,10 +5,11 @@ All URIs are relative to *https://api.vrchat.cloud/api/1* Method | HTTP request | Description ------------- | ------------- | ------------- [**check_user_exists**](AuthenticationApi.md#check_user_exists) | **GET** /auth/exists | Check User Exists -[**delete_user**](AuthenticationApi.md#delete_user) | **PUT** /user/{userId}/delete | Delete User +[**delete_user**](AuthenticationApi.md#delete_user) | **PUT** /users/{userId}/delete | Delete User [**get_current_user**](AuthenticationApi.md#get_current_user) | **GET** /auth/user | Login and/or Get Current User Info [**logout**](AuthenticationApi.md#logout) | **PUT** /logout | Logout [**verify2_fa**](AuthenticationApi.md#verify2_fa) | **POST** /auth/twofactorauth/totp/verify | Verify 2FA code +[**verify2_fa_email_code**](AuthenticationApi.md#verify2_fa_email_code) | **POST** /auth/twofactorauth/emailotp/verify | Verify 2FA email code [**verify_auth_token**](AuthenticationApi.md#verify_auth_token) | **GET** /auth | Verify Auth Token [**verify_recovery_code**](AuthenticationApi.md#verify_recovery_code) | **POST** /auth/twofactorauth/otp/verify | Verify 2FA code with Recovery code @@ -161,6 +162,36 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## verify2_fa_email_code + +> crate::models::Verify2FaEmailCodeResult verify2_fa_email_code(two_factor_email_code) +Verify 2FA email code + +Finishes the login sequence with an 2FA email code. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**two_factor_email_code** | Option<[**TwoFactorEmailCode**](TwoFactorEmailCode.md)> | | | + +### Return type + +[**crate::models::Verify2FaEmailCodeResult**](Verify2FAEmailCodeResult.md) + +### Authorization + +[authCookie](../README.md#authCookie) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## verify_auth_token > crate::models::VerifyAuthTokenResult verify_auth_token() diff --git a/docs/TwoFactorEmailCode.md b/docs/TwoFactorEmailCode.md new file mode 100644 index 0000000..8d8c9f5 --- /dev/null +++ b/docs/TwoFactorEmailCode.md @@ -0,0 +1,11 @@ +# TwoFactorEmailCode + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Verify2FaEmailCodeResult.md b/docs/Verify2FaEmailCodeResult.md new file mode 100644 index 0000000..fc3a3df --- /dev/null +++ b/docs/Verify2FaEmailCodeResult.md @@ -0,0 +1,11 @@ +# Verify2FaEmailCodeResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**verified** | **bool** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/src/apis/authentication_api.rs b/src/apis/authentication_api.rs index 6f1c0b5..70a818d 100644 --- a/src/apis/authentication_api.rs +++ b/src/apis/authentication_api.rs @@ -53,6 +53,14 @@ pub enum Verify2FaError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`verify2_fa_email_code`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum Verify2FaEmailCodeError { + Status401(crate::models::Error), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`verify_auth_token`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -116,7 +124,7 @@ pub fn delete_user(configuration: &configuration::Configuration, user_id: &str) let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/user/{userId}/delete", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); + let local_var_uri_str = format!("{}/users/{userId}/delete", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { @@ -226,6 +234,35 @@ 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: Option) -> Result> { + let local_var_configuration = configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/auth/twofactorauth/emailotp/verify", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_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(&two_factor_email_code); + + let local_var_req = local_var_req_builder.build()?; + let mut local_var_resp = local_var_client.execute(local_var_req)?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text()?; + + 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 = 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)) + } +} + /// Verify whether the currently provided Auth Token is valid. pub fn verify_auth_token(configuration: &configuration::Configuration, ) -> Result> { let local_var_configuration = configuration; diff --git a/src/models/mod.rs b/src/models/mod.rs index daab75f..44c274a 100644 --- a/src/models/mod.rs +++ b/src/models/mod.rs @@ -196,6 +196,8 @@ pub mod transaction_steam_wallet_info; pub use self::transaction_steam_wallet_info::TransactionSteamWalletInfo; pub mod two_factor_auth_code; pub use self::two_factor_auth_code::TwoFactorAuthCode; +pub mod two_factor_email_code; +pub use self::two_factor_email_code::TwoFactorEmailCode; pub mod unity_package; pub use self::unity_package::UnityPackage; pub mod update_avatar_request; @@ -226,6 +228,8 @@ pub mod user_status; pub use self::user_status::UserStatus; pub mod user_subscription; pub use self::user_subscription::UserSubscription; +pub mod verify2_fa_email_code_result; +pub use self::verify2_fa_email_code_result::Verify2FaEmailCodeResult; pub mod verify2_fa_result; pub use self::verify2_fa_result::Verify2FaResult; pub mod verify_auth_token_result; diff --git a/src/models/two_factor_email_code.rs b/src/models/two_factor_email_code.rs new file mode 100644 index 0000000..fd1354d --- /dev/null +++ b/src/models/two_factor_email_code.rs @@ -0,0 +1,26 @@ +/* + * VRChat API Documentation + * + * + * Contact: me@ariesclark.com + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct TwoFactorEmailCode { + #[serde(rename = "code")] + pub code: String, +} + +impl TwoFactorEmailCode { + pub fn new(code: String) -> TwoFactorEmailCode { + TwoFactorEmailCode { + code, + } + } +} + + diff --git a/src/models/verify2_fa_email_code_result.rs b/src/models/verify2_fa_email_code_result.rs new file mode 100644 index 0000000..c5382b6 --- /dev/null +++ b/src/models/verify2_fa_email_code_result.rs @@ -0,0 +1,26 @@ +/* + * VRChat API Documentation + * + * + * Contact: me@ariesclark.com + * Generated by: https://openapi-generator.tech + */ + + + + +#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)] +pub struct Verify2FaEmailCodeResult { + #[serde(rename = "verified")] + pub verified: bool, +} + +impl Verify2FaEmailCodeResult { + pub fn new(verified: bool) -> Verify2FaEmailCodeResult { + Verify2FaEmailCodeResult { + verified, + } + } +} + +