Skip to content

Commit

Permalink
Apply Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
C0D3-M4513R committed Sep 28, 2024
1 parent 99d8e94 commit 516640e
Show file tree
Hide file tree
Showing 160 changed files with 4,332 additions and 1,446 deletions.
20 changes: 15 additions & 5 deletions examples/online.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,21 @@ async fn main() {
let mut config = apis::configuration::Configuration::default();
config.basic_auth = Some((String::from("username"), Some(String::from("password"))));

match apis::authentication_api::get_current_user(&config).await.unwrap() {
vrchatapi::models::EitherUserOrTwoFactor::CurrentUser(me) => println!("Username: {}", me.username.unwrap()),
vrchatapi::models::EitherUserOrTwoFactor::RequiresTwoFactorAuth(requires_auth) => println!("The Username requires Auth: {:?}", requires_auth.requires_two_factor_auth)
match apis::authentication_api::get_current_user(&config)
.await
.unwrap()
{
vrchatapi::models::EitherUserOrTwoFactor::CurrentUser(me) => {
println!("Username: {}", me.username.unwrap())
}
vrchatapi::models::EitherUserOrTwoFactor::RequiresTwoFactorAuth(requires_auth) => println!(
"The Username requires Auth: {:?}",
requires_auth.requires_two_factor_auth
),
}

let online = apis::system_api::get_current_online_users(&config).await.unwrap();
let online = apis::system_api::get_current_online_users(&config)
.await
.unwrap();
println!("Current Online Users: {}", online);
}
}
203 changes: 149 additions & 54 deletions src/apis/authentication_api.rs

Large diffs are not rendered by default.

315 changes: 236 additions & 79 deletions src/apis/avatars_api.rs

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions src/apis/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
* Generated by: https://openapi-generator.tech
*/



#[derive(Debug, Clone)]
pub struct Configuration {
pub base_path: String,
Expand All @@ -28,7 +26,6 @@ pub struct ApiKey {
pub key: String,
}


impl Configuration {
pub fn new() -> Configuration {
Configuration::default()
Expand All @@ -40,12 +37,14 @@ impl Default for Configuration {
Configuration {
base_path: "https://vrchat.com/api/1".to_owned(),
user_agent: Some("vrchatapi-rust".to_owned()),
client: reqwest::Client::builder().cookie_store(true).build().unwrap(),
client: reqwest::Client::builder()
.cookie_store(true)
.build()
.unwrap(),
basic_auth: None,
oauth_access_token: None,
bearer_access_token: None,
api_key: None,

}
}
}
122 changes: 88 additions & 34 deletions src/apis/economy_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
* Generated by: https://openapi-generator.tech
*/


use super::{configuration, Error};
use crate::{apis::ResponseContent, models};
use reqwest;
use serde::{Deserialize, Serialize};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration};


/// struct for typed errors of method [`get_current_subscriptions`]
#[derive(Debug, Clone, Serialize, Deserialize)]
Expand Down Expand Up @@ -53,18 +51,24 @@ pub enum GetSubscriptionsError {
UnknownValue(serde_json::Value),
}


/// Get a list of all current user subscriptions.
pub async fn get_current_subscriptions(configuration: &configuration::Configuration, ) -> Result<Vec<models::UserSubscription>, Error<GetCurrentSubscriptionsError>> {
pub async fn get_current_subscriptions(
configuration: &configuration::Configuration,
) -> Result<Vec<models::UserSubscription>, Error<GetCurrentSubscriptionsError>> {
let local_var_configuration = configuration;

let local_var_client = &local_var_configuration.client;

let local_var_uri_str = format!("{}/auth/user/subscription", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
let local_var_uri_str = format!(
"{}/auth/user/subscription",
local_var_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) = 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.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}

let local_var_req = local_var_req_builder.build()?;
Expand All @@ -76,23 +80,37 @@ pub async fn get_current_subscriptions(configuration: &configuration::Configurat
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<GetCurrentSubscriptionsError> = 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 };
let local_var_entity: Option<GetCurrentSubscriptionsError> =
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 single License Group by given ID.
pub async fn get_license_group(configuration: &configuration::Configuration, license_group_id: &str) -> Result<models::LicenseGroup, Error<GetLicenseGroupError>> {
pub async fn get_license_group(
configuration: &configuration::Configuration,
license_group_id: &str,
) -> Result<models::LicenseGroup, Error<GetLicenseGroupError>> {
let local_var_configuration = configuration;

let local_var_client = &local_var_configuration.client;

let local_var_uri_str = format!("{}/licenseGroups/{licenseGroupId}", local_var_configuration.base_path, licenseGroupId=crate::apis::urlencode(license_group_id));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
let local_var_uri_str = format!(
"{}/licenseGroups/{licenseGroupId}",
local_var_configuration.base_path,
licenseGroupId = crate::apis::urlencode(license_group_id)
);
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) = 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.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}

let local_var_req = local_var_req_builder.build()?;
Expand All @@ -104,23 +122,37 @@ pub async fn get_license_group(configuration: &configuration::Configuration, lic
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<GetLicenseGroupError> = 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 };
let local_var_entity: Option<GetLicenseGroupError> =
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 single Steam transactions by ID. This returns the exact same information as `getSteamTransactions`, so no point in using this endpoint.
pub async fn get_steam_transaction(configuration: &configuration::Configuration, transaction_id: &str) -> Result<models::Transaction, Error<GetSteamTransactionError>> {
pub async fn get_steam_transaction(
configuration: &configuration::Configuration,
transaction_id: &str,
) -> Result<models::Transaction, Error<GetSteamTransactionError>> {
let local_var_configuration = configuration;

let local_var_client = &local_var_configuration.client;

let local_var_uri_str = format!("{}/Steam/transactions/{transactionId}", local_var_configuration.base_path, transactionId=crate::apis::urlencode(transaction_id));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
let local_var_uri_str = format!(
"{}/Steam/transactions/{transactionId}",
local_var_configuration.base_path,
transactionId = crate::apis::urlencode(transaction_id)
);
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) = 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.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}

let local_var_req = local_var_req_builder.build()?;
Expand All @@ -132,23 +164,32 @@ pub async fn get_steam_transaction(configuration: &configuration::Configuration,
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<GetSteamTransactionError> = 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 };
let local_var_entity: Option<GetSteamTransactionError> =
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 all own Steam transactions.
pub async fn get_steam_transactions(configuration: &configuration::Configuration, ) -> Result<Vec<models::Transaction>, Error<GetSteamTransactionsError>> {
pub async fn get_steam_transactions(
configuration: &configuration::Configuration,
) -> Result<Vec<models::Transaction>, Error<GetSteamTransactionsError>> {
let local_var_configuration = configuration;

let local_var_client = &local_var_configuration.client;

let local_var_uri_str = format!("{}/Steam/transactions", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
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) = 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.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}

let local_var_req = local_var_req_builder.build()?;
Expand All @@ -160,23 +201,32 @@ pub async fn get_steam_transactions(configuration: &configuration::Configuration
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<GetSteamTransactionsError> = 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 };
let local_var_entity: Option<GetSteamTransactionsError> =
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))
}
}

/// List all existing Subscriptions. For example, \"vrchatplus-monthly\" and \"vrchatplus-yearly\".
pub async fn get_subscriptions(configuration: &configuration::Configuration, ) -> Result<Vec<models::Subscription>, Error<GetSubscriptionsError>> {
pub async fn get_subscriptions(
configuration: &configuration::Configuration,
) -> Result<Vec<models::Subscription>, Error<GetSubscriptionsError>> {
let local_var_configuration = configuration;

let local_var_client = &local_var_configuration.client;

let local_var_uri_str = format!("{}/subscriptions", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
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) = 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.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}

let local_var_req = local_var_req_builder.build()?;
Expand All @@ -188,9 +238,13 @@ pub async fn get_subscriptions(configuration: &configuration::Configuration, ) -
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<GetSubscriptionsError> = 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 };
let local_var_entity: Option<GetSubscriptionsError> =
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))
}
}

Loading

0 comments on commit 516640e

Please sign in to comment.