Add formatting (#20)

* add formatting

Signed-off-by: C0D3 M4513R <28912031+C0D3-M4513R@users.noreply.github.com>

* Apply Changes

---------

Signed-off-by: C0D3 M4513R <28912031+C0D3-M4513R@users.noreply.github.com>
This commit is contained in:
C0D3 M4513R
2024-09-28 19:01:11 +02:00
committed by GitHub
parent 96cadec85e
commit 9534a4ed8a
161 changed files with 4333 additions and 1446 deletions

View File

@ -5,11 +5,21 @@ async fn main() {
let mut config = apis::configuration::Configuration::default(); let mut config = apis::configuration::Configuration::default();
config.basic_auth = Some((String::from("username"), Some(String::from("password")))); config.basic_auth = Some((String::from("username"), Some(String::from("password"))));
match apis::authentication_api::get_current_user(&config).await.unwrap() { match apis::authentication_api::get_current_user(&config)
vrchatapi::models::EitherUserOrTwoFactor::CurrentUser(me) => println!("Username: {}", me.username.unwrap()), .await
vrchatapi::models::EitherUserOrTwoFactor::RequiresTwoFactorAuth(requires_auth) => println!("The Username requires Auth: {:?}", requires_auth.requires_two_factor_auth) .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); println!("Current Online Users: {}", online);
} }

View File

@ -39,5 +39,6 @@ cat patches/2FA_Current_User.rs >> src/models/current_user.rs
sed -i 's/pub use self::current_user::CurrentUser;/pub use self::current_user::{EitherUserOrTwoFactor, CurrentUser};/g' src/models/mod.rs sed -i 's/pub use self::current_user::CurrentUser;/pub use self::current_user::{EitherUserOrTwoFactor, CurrentUser};/g' src/models/mod.rs
sed -i 's/Result<models::CurrentUser, Error<GetCurrentUserError>>/Result<models::EitherUserOrTwoFactor, Error<GetCurrentUserError>>/g' src/apis/authentication_api.rs sed -i 's/Result<models::CurrentUser, Error<GetCurrentUserError>>/Result<models::EitherUserOrTwoFactor, Error<GetCurrentUserError>>/g' src/apis/authentication_api.rs
cargo fmt
cargo build cargo build
cargo test cargo test

View File

@ -6,12 +6,10 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
use super::{configuration, Error};
use crate::{apis::ResponseContent, models};
use reqwest; use reqwest;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration};
/// struct for typed errors of method [`check_user_exists`] /// struct for typed errors of method [`check_user_exists`]
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
@ -77,30 +75,41 @@ pub enum VerifyRecoveryCodeError {
UnknownValue(serde_json::Value), UnknownValue(serde_json::Value),
} }
/// 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. /// 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 async fn check_user_exists(configuration: &configuration::Configuration, email: Option<&str>, display_name: Option<&str>, username: 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>,
username: Option<&str>,
exclude_user_id: Option<&str>,
) -> Result<models::UserExists, Error<CheckUserExistsError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/auth/exists", local_var_configuration.base_path); let local_var_uri_str = format!("{}/auth/exists", 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_str) = email { if let Some(ref local_var_str) = email {
local_var_req_builder = local_var_req_builder.query(&[("email", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("email", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = display_name { if let Some(ref local_var_str) = display_name {
local_var_req_builder = local_var_req_builder.query(&[("displayName", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("displayName", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = username { if let Some(ref local_var_str) = username {
local_var_req_builder = local_var_req_builder.query(&[("username", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("username", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = exclude_user_id { if let Some(ref local_var_str) = exclude_user_id {
local_var_req_builder = local_var_req_builder.query(&[("excludeUserId", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("excludeUserId", &local_var_str.to_string())]);
} }
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -112,23 +121,37 @@ pub async fn check_user_exists(configuration: &configuration::Configuration, ema
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<CheckUserExistsError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<CheckUserExistsError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// 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. /// 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 async 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_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/users/{userId}/delete", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); "{}/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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -140,26 +163,38 @@ pub async fn delete_user(configuration: &configuration::Configuration, user_id:
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<DeleteUserError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<DeleteUserError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// 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. /// 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 async fn get_current_user(configuration: &configuration::Configuration, ) -> Result<models::EitherUserOrTwoFactor, Error<GetCurrentUserError>> { pub async fn get_current_user(
configuration: &configuration::Configuration,
) -> Result<models::EitherUserOrTwoFactor, Error<GetCurrentUserError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/auth/user", local_var_configuration.base_path); let local_var_uri_str = format!("{}/auth/user", 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 { 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());
} }
if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); local_var_req_builder = local_var_req_builder.basic_auth(
local_var_auth_conf.0.to_owned(),
local_var_auth_conf.1.to_owned(),
);
}; };
let local_var_req = local_var_req_builder.build()?; let local_var_req = local_var_req_builder.build()?;
@ -171,23 +206,32 @@ pub async fn get_current_user(configuration: &configuration::Configuration, ) ->
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetCurrentUserError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetCurrentUserError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Invalidates the login session. /// Invalidates the login session.
pub async 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_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/logout", local_var_configuration.base_path); let local_var_uri_str = format!("{}/logout", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); 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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -200,22 +244,34 @@ pub async fn logout(configuration: &configuration::Configuration, ) -> Result<mo
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<LogoutError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<LogoutError> = 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_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Finishes the login sequence with a normal 2FA-generated code for accounts with 2FA-protection enabled. /// Finishes the login sequence with a normal 2FA-generated code for accounts with 2FA-protection enabled.
pub async 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_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/auth/twofactorauth/totp/verify", local_var_configuration.base_path); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); "{}/auth/twofactorauth/totp/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 { 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());
} }
local_var_req_builder = local_var_req_builder.json(&two_factor_auth_code); local_var_req_builder = local_var_req_builder.json(&two_factor_auth_code);
@ -228,23 +284,36 @@ pub async fn verify2_fa(configuration: &configuration::Configuration, two_factor
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<Verify2FaError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<Verify2FaError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Finishes the login sequence with an 2FA email code. /// Finishes the login sequence with an 2FA email code.
pub async 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_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/auth/twofactorauth/emailotp/verify", local_var_configuration.base_path); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); "{}/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 { 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());
} }
local_var_req_builder = local_var_req_builder.json(&two_factor_email_code); local_var_req_builder = local_var_req_builder.json(&two_factor_email_code);
@ -257,23 +326,32 @@ pub async fn verify2_fa_email_code(configuration: &configuration::Configuration,
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<Verify2FaEmailCodeError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<Verify2FaEmailCodeError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Verify whether the currently provided Auth Token is valid. /// Verify whether the currently provided Auth Token is valid.
pub async 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_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/auth", local_var_configuration.base_path); let local_var_uri_str = format!("{}/auth", 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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -285,23 +363,36 @@ pub async fn verify_auth_token(configuration: &configuration::Configuration, ) -
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<VerifyAuthTokenError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<VerifyAuthTokenError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Finishes the login sequence with an OTP (One Time Password) recovery code for accounts with 2FA-protection enabled. /// Finishes the login sequence with an OTP (One Time Password) recovery code for accounts with 2FA-protection enabled.
pub async 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_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/auth/twofactorauth/otp/verify", local_var_configuration.base_path); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); "{}/auth/twofactorauth/otp/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 { 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());
} }
local_var_req_builder = local_var_req_builder.json(&two_factor_auth_code); local_var_req_builder = local_var_req_builder.json(&two_factor_auth_code);
@ -314,9 +405,13 @@ pub async fn verify_recovery_code(configuration: &configuration::Configuration,
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<VerifyRecoveryCodeError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<VerifyRecoveryCodeError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }

View File

@ -6,12 +6,10 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
use super::{configuration, Error};
use crate::{apis::ResponseContent, models};
use reqwest; use reqwest;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration};
/// struct for typed errors of method [`create_avatar`] /// struct for typed errors of method [`create_avatar`]
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
@ -93,18 +91,22 @@ pub enum UpdateAvatarError {
UnknownValue(serde_json::Value), UnknownValue(serde_json::Value),
} }
/// Create an avatar. It's possible to optionally specify a ID if you want a custom one. Attempting to create an Avatar with an already claimed ID will result in a DB error. /// Create an avatar. It's possible to optionally specify a ID if you want a custom one. Attempting to create an Avatar with an already claimed ID will result in a DB error.
pub async fn create_avatar(configuration: &configuration::Configuration, create_avatar_request: Option<models::CreateAvatarRequest>) -> Result<models::Avatar, Error<CreateAvatarError>> { pub async fn create_avatar(
configuration: &configuration::Configuration,
create_avatar_request: Option<models::CreateAvatarRequest>,
) -> Result<models::Avatar, Error<CreateAvatarError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/avatars", local_var_configuration.base_path); let local_var_uri_str = format!("{}/avatars", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); 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 { 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());
} }
local_var_req_builder = local_var_req_builder.json(&create_avatar_request); local_var_req_builder = local_var_req_builder.json(&create_avatar_request);
@ -117,23 +119,37 @@ pub async fn create_avatar(configuration: &configuration::Configuration, create_
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<CreateAvatarError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<CreateAvatarError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Delete an avatar. Notice an avatar is never fully \"deleted\", only its ReleaseStatus is set to \"hidden\" and the linked Files are deleted. The AvatarID is permanently reserved. /// Delete an avatar. Notice an avatar is never fully \"deleted\", only its ReleaseStatus is set to \"hidden\" and the linked Files are deleted. The AvatarID is permanently reserved.
pub async fn delete_avatar(configuration: &configuration::Configuration, avatar_id: &str) -> Result<models::Avatar, Error<DeleteAvatarError>> { pub async fn delete_avatar(
configuration: &configuration::Configuration,
avatar_id: &str,
) -> Result<models::Avatar, Error<DeleteAvatarError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/avatars/{avatarId}", local_var_configuration.base_path, avatarId=crate::apis::urlencode(avatar_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); "{}/avatars/{avatarId}",
local_var_configuration.base_path,
avatarId = crate::apis::urlencode(avatar_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) = local_var_configuration.user_agent { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -145,23 +161,37 @@ pub async fn delete_avatar(configuration: &configuration::Configuration, avatar_
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<DeleteAvatarError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<DeleteAvatarError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Get information about a specific Avatar. /// Get information about a specific Avatar.
pub async fn get_avatar(configuration: &configuration::Configuration, avatar_id: &str) -> Result<models::Avatar, Error<GetAvatarError>> { pub async fn get_avatar(
configuration: &configuration::Configuration,
avatar_id: &str,
) -> Result<models::Avatar, Error<GetAvatarError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/avatars/{avatarId}", local_var_configuration.base_path, avatarId=crate::apis::urlencode(avatar_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); "{}/avatars/{avatarId}",
local_var_configuration.base_path,
avatarId = crate::apis::urlencode(avatar_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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -173,62 +203,95 @@ pub async fn get_avatar(configuration: &configuration::Configuration, avatar_id:
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetAvatarError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetAvatarError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Search and list favorited avatars by query filters. /// Search and list favorited avatars by query filters.
pub async fn get_favorited_avatars(configuration: &configuration::Configuration, featured: Option<bool>, sort: Option<models::SortOption>, n: Option<i32>, order: Option<models::OrderOption>, offset: Option<i32>, search: Option<&str>, tag: Option<&str>, notag: Option<&str>, release_status: Option<models::ReleaseStatus>, max_unity_version: Option<&str>, min_unity_version: Option<&str>, platform: Option<&str>, user_id: Option<&str>) -> Result<Vec<models::Avatar>, Error<GetFavoritedAvatarsError>> { pub async fn get_favorited_avatars(
configuration: &configuration::Configuration,
featured: Option<bool>,
sort: Option<models::SortOption>,
n: Option<i32>,
order: Option<models::OrderOption>,
offset: Option<i32>,
search: Option<&str>,
tag: Option<&str>,
notag: Option<&str>,
release_status: Option<models::ReleaseStatus>,
max_unity_version: Option<&str>,
min_unity_version: Option<&str>,
platform: Option<&str>,
user_id: Option<&str>,
) -> Result<Vec<models::Avatar>, Error<GetFavoritedAvatarsError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/avatars/favorites", local_var_configuration.base_path); let local_var_uri_str = format!("{}/avatars/favorites", 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_str) = featured { if let Some(ref local_var_str) = featured {
local_var_req_builder = local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("featured", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = sort { if let Some(ref local_var_str) = sort {
local_var_req_builder = local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("sort", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = n { if let Some(ref local_var_str) = n {
local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = order { if let Some(ref local_var_str) = order {
local_var_req_builder = local_var_req_builder.query(&[("order", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("order", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = offset { if let Some(ref local_var_str) = offset {
local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("offset", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = search { if let Some(ref local_var_str) = search {
local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = tag { if let Some(ref local_var_str) = tag {
local_var_req_builder = local_var_req_builder.query(&[("tag", &local_var_str.to_string())]); local_var_req_builder = local_var_req_builder.query(&[("tag", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = notag { if let Some(ref local_var_str) = notag {
local_var_req_builder = local_var_req_builder.query(&[("notag", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("notag", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = release_status { if let Some(ref local_var_str) = release_status {
local_var_req_builder = local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = max_unity_version { if let Some(ref local_var_str) = max_unity_version {
local_var_req_builder = local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = min_unity_version { if let Some(ref local_var_str) = min_unity_version {
local_var_req_builder = local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = platform { if let Some(ref local_var_str) = platform {
local_var_req_builder = local_var_req_builder.query(&[("platform", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("platform", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = user_id { if let Some(ref local_var_str) = user_id {
local_var_req_builder = local_var_req_builder.query(&[("userId", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("userId", &local_var_str.to_string())]);
} }
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -240,23 +303,37 @@ pub async fn get_favorited_avatars(configuration: &configuration::Configuration,
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetFavoritedAvatarsError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetFavoritedAvatarsError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Get the current avatar for the user. This will return an error for any other user than the one logged in. /// Get the current avatar for the user. This will return an error for any other user than the one logged in.
pub async fn get_own_avatar(configuration: &configuration::Configuration, user_id: &str) -> Result<models::Avatar, Error<GetOwnAvatarError>> { pub async fn get_own_avatar(
configuration: &configuration::Configuration,
user_id: &str,
) -> Result<models::Avatar, Error<GetOwnAvatarError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/users/{userId}/avatar", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); "{}/users/{userId}/avatar",
local_var_configuration.base_path,
userId = crate::apis::urlencode(user_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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -268,62 +345,95 @@ pub async fn get_own_avatar(configuration: &configuration::Configuration, user_i
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetOwnAvatarError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetOwnAvatarError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Search and list avatars by query filters. You can only search your own or featured avatars. It is not possible as a normal user to search other peoples avatars. /// Search and list avatars by query filters. You can only search your own or featured avatars. It is not possible as a normal user to search other peoples avatars.
pub async fn search_avatars(configuration: &configuration::Configuration, featured: Option<bool>, sort: Option<models::SortOption>, user: Option<&str>, user_id: Option<&str>, n: Option<i32>, order: Option<models::OrderOption>, offset: Option<i32>, tag: Option<&str>, notag: Option<&str>, release_status: Option<models::ReleaseStatus>, max_unity_version: Option<&str>, min_unity_version: Option<&str>, platform: Option<&str>) -> Result<Vec<models::Avatar>, Error<SearchAvatarsError>> { pub async fn search_avatars(
configuration: &configuration::Configuration,
featured: Option<bool>,
sort: Option<models::SortOption>,
user: Option<&str>,
user_id: Option<&str>,
n: Option<i32>,
order: Option<models::OrderOption>,
offset: Option<i32>,
tag: Option<&str>,
notag: Option<&str>,
release_status: Option<models::ReleaseStatus>,
max_unity_version: Option<&str>,
min_unity_version: Option<&str>,
platform: Option<&str>,
) -> Result<Vec<models::Avatar>, Error<SearchAvatarsError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/avatars", local_var_configuration.base_path); let local_var_uri_str = format!("{}/avatars", 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_str) = featured { if let Some(ref local_var_str) = featured {
local_var_req_builder = local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("featured", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = sort { if let Some(ref local_var_str) = sort {
local_var_req_builder = local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("sort", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = user { if let Some(ref local_var_str) = user {
local_var_req_builder = local_var_req_builder.query(&[("user", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("user", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = user_id { if let Some(ref local_var_str) = user_id {
local_var_req_builder = local_var_req_builder.query(&[("userId", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("userId", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = n { if let Some(ref local_var_str) = n {
local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = order { if let Some(ref local_var_str) = order {
local_var_req_builder = local_var_req_builder.query(&[("order", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("order", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = offset { if let Some(ref local_var_str) = offset {
local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("offset", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = tag { if let Some(ref local_var_str) = tag {
local_var_req_builder = local_var_req_builder.query(&[("tag", &local_var_str.to_string())]); local_var_req_builder = local_var_req_builder.query(&[("tag", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = notag { if let Some(ref local_var_str) = notag {
local_var_req_builder = local_var_req_builder.query(&[("notag", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("notag", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = release_status { if let Some(ref local_var_str) = release_status {
local_var_req_builder = local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = max_unity_version { if let Some(ref local_var_str) = max_unity_version {
local_var_req_builder = local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = min_unity_version { if let Some(ref local_var_str) = min_unity_version {
local_var_req_builder = local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = platform { if let Some(ref local_var_str) = platform {
local_var_req_builder = local_var_req_builder.query(&[("platform", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("platform", &local_var_str.to_string())]);
} }
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -335,23 +445,37 @@ pub async fn search_avatars(configuration: &configuration::Configuration, featur
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<SearchAvatarsError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<SearchAvatarsError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Switches into that avatar. /// Switches into that avatar.
pub async fn select_avatar(configuration: &configuration::Configuration, avatar_id: &str) -> Result<models::CurrentUser, Error<SelectAvatarError>> { pub async fn select_avatar(
configuration: &configuration::Configuration,
avatar_id: &str,
) -> Result<models::CurrentUser, Error<SelectAvatarError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/avatars/{avatarId}/select", local_var_configuration.base_path, avatarId=crate::apis::urlencode(avatar_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); "{}/avatars/{avatarId}/select",
local_var_configuration.base_path,
avatarId = crate::apis::urlencode(avatar_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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -363,23 +487,37 @@ pub async fn select_avatar(configuration: &configuration::Configuration, avatar_
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<SelectAvatarError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<SelectAvatarError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Switches into that avatar as your fallback avatar. /// Switches into that avatar as your fallback avatar.
pub async fn select_fallback_avatar(configuration: &configuration::Configuration, avatar_id: &str) -> Result<models::CurrentUser, Error<SelectFallbackAvatarError>> { pub async fn select_fallback_avatar(
configuration: &configuration::Configuration,
avatar_id: &str,
) -> Result<models::CurrentUser, Error<SelectFallbackAvatarError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/avatars/{avatarId}/selectFallback", local_var_configuration.base_path, avatarId=crate::apis::urlencode(avatar_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); "{}/avatars/{avatarId}/selectFallback",
local_var_configuration.base_path,
avatarId = crate::apis::urlencode(avatar_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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -391,23 +529,38 @@ pub async fn select_fallback_avatar(configuration: &configuration::Configuration
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<SelectFallbackAvatarError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<SelectFallbackAvatarError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Update information about a specific avatar. /// Update information about a specific avatar.
pub async fn update_avatar(configuration: &configuration::Configuration, avatar_id: &str, update_avatar_request: Option<models::UpdateAvatarRequest>) -> Result<models::Avatar, Error<UpdateAvatarError>> { pub async fn update_avatar(
configuration: &configuration::Configuration,
avatar_id: &str,
update_avatar_request: Option<models::UpdateAvatarRequest>,
) -> Result<models::Avatar, Error<UpdateAvatarError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/avatars/{avatarId}", local_var_configuration.base_path, avatarId=crate::apis::urlencode(avatar_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); "{}/avatars/{avatarId}",
local_var_configuration.base_path,
avatarId = crate::apis::urlencode(avatar_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 { 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());
} }
local_var_req_builder = local_var_req_builder.json(&update_avatar_request); local_var_req_builder = local_var_req_builder.json(&update_avatar_request);
@ -420,9 +573,13 @@ pub async fn update_avatar(configuration: &configuration::Configuration, avatar_
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<UpdateAvatarError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<UpdateAvatarError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }

View File

@ -6,8 +6,6 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct Configuration { pub struct Configuration {
pub base_path: String, pub base_path: String,
@ -28,7 +26,6 @@ pub struct ApiKey {
pub key: String, pub key: String,
} }
impl Configuration { impl Configuration {
pub fn new() -> Configuration { pub fn new() -> Configuration {
Configuration::default() Configuration::default()
@ -40,12 +37,14 @@ impl Default for Configuration {
Configuration { Configuration {
base_path: "https://vrchat.com/api/1".to_owned(), base_path: "https://vrchat.com/api/1".to_owned(),
user_agent: Some("vrchatapi-rust".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, basic_auth: None,
oauth_access_token: None, oauth_access_token: None,
bearer_access_token: None, bearer_access_token: None,
api_key: None, api_key: None,
} }
} }
} }

View File

@ -6,12 +6,10 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
use super::{configuration, Error};
use crate::{apis::ResponseContent, models};
use reqwest; use reqwest;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration};
/// struct for typed errors of method [`get_current_subscriptions`] /// struct for typed errors of method [`get_current_subscriptions`]
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
@ -53,18 +51,24 @@ pub enum GetSubscriptionsError {
UnknownValue(serde_json::Value), UnknownValue(serde_json::Value),
} }
/// Get a list of all current user subscriptions. /// 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_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/auth/user/subscription", local_var_configuration.base_path); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); "{}/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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -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() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetCurrentSubscriptionsError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetCurrentSubscriptionsError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Get a single License Group by given ID. /// 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_configuration = configuration;
let local_var_client = &local_var_configuration.client; 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 local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); "{}/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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -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() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetLicenseGroupError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetLicenseGroupError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) 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. /// 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_configuration = configuration;
let local_var_client = &local_var_configuration.client; 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 local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); "{}/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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -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() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetSteamTransactionError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetSteamTransactionError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Get all own Steam transactions. /// 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_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/Steam/transactions", local_var_configuration.base_path); 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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -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() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetSteamTransactionsError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetSteamTransactionsError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// List all existing Subscriptions. For example, \"vrchatplus-monthly\" and \"vrchatplus-yearly\". /// 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_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/subscriptions", local_var_configuration.base_path); 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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -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() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetSubscriptionsError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetSubscriptionsError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }

View File

@ -6,12 +6,10 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
use super::{configuration, Error};
use crate::{apis::ResponseContent, models};
use reqwest; use reqwest;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration};
/// struct for typed errors of method [`add_favorite`] /// struct for typed errors of method [`add_favorite`]
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
@ -77,18 +75,22 @@ pub enum UpdateFavoriteGroupError {
UnknownValue(serde_json::Value), UnknownValue(serde_json::Value),
} }
/// Add a new favorite. Friend groups are named `group_0` through `group_3`. Avatar and World groups are named `avatars1` to `avatars4` and `worlds1` to `worlds4`. You cannot add people whom you are not friends with to your friends list. Destroying a friendship removes the person as favorite on both sides. /// Add a new favorite. Friend groups are named `group_0` through `group_3`. Avatar and World groups are named `avatars1` to `avatars4` and `worlds1` to `worlds4`. You cannot add people whom you are not friends with to your friends list. Destroying a friendship removes the person as favorite on both sides.
pub async fn add_favorite(configuration: &configuration::Configuration, add_favorite_request: Option<models::AddFavoriteRequest>) -> Result<models::Favorite, Error<AddFavoriteError>> { pub async fn add_favorite(
configuration: &configuration::Configuration,
add_favorite_request: Option<models::AddFavoriteRequest>,
) -> Result<models::Favorite, Error<AddFavoriteError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/favorites", local_var_configuration.base_path); let local_var_uri_str = format!("{}/favorites", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); 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 { 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());
} }
local_var_req_builder = local_var_req_builder.json(&add_favorite_request); local_var_req_builder = local_var_req_builder.json(&add_favorite_request);
@ -101,23 +103,41 @@ pub async fn add_favorite(configuration: &configuration::Configuration, add_favo
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<AddFavoriteError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<AddFavoriteError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Clear ALL contents of a specific favorite group. /// Clear ALL contents of a specific favorite group.
pub async fn clear_favorite_group(configuration: &configuration::Configuration, favorite_group_type: &str, favorite_group_name: &str, user_id: &str) -> Result<models::Success, Error<ClearFavoriteGroupError>> { pub async fn clear_favorite_group(
configuration: &configuration::Configuration,
favorite_group_type: &str,
favorite_group_name: &str,
user_id: &str,
) -> Result<models::Success, Error<ClearFavoriteGroupError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/favorite/group/{favoriteGroupType}/{favoriteGroupName}/{userId}", local_var_configuration.base_path, favoriteGroupType=crate::apis::urlencode(favorite_group_type), favoriteGroupName=crate::apis::urlencode(favorite_group_name), userId=crate::apis::urlencode(user_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); "{}/favorite/group/{favoriteGroupType}/{favoriteGroupName}/{userId}",
local_var_configuration.base_path,
favoriteGroupType = crate::apis::urlencode(favorite_group_type),
favoriteGroupName = crate::apis::urlencode(favorite_group_name),
userId = crate::apis::urlencode(user_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) = local_var_configuration.user_agent { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -129,23 +149,37 @@ pub async fn clear_favorite_group(configuration: &configuration::Configuration,
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<ClearFavoriteGroupError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<ClearFavoriteGroupError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Return information about a specific Favorite. /// Return information about a specific Favorite.
pub async fn get_favorite(configuration: &configuration::Configuration, favorite_id: &str) -> Result<models::Favorite, Error<GetFavoriteError>> { pub async fn get_favorite(
configuration: &configuration::Configuration,
favorite_id: &str,
) -> Result<models::Favorite, Error<GetFavoriteError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/favorites/{favoriteId}", local_var_configuration.base_path, favoriteId=crate::apis::urlencode(favorite_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); "{}/favorites/{favoriteId}",
local_var_configuration.base_path,
favoriteId = crate::apis::urlencode(favorite_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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -157,23 +191,41 @@ pub async fn get_favorite(configuration: &configuration::Configuration, favorite
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetFavoriteError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetFavoriteError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Fetch information about a specific favorite group. /// Fetch information about a specific favorite group.
pub async fn get_favorite_group(configuration: &configuration::Configuration, favorite_group_type: &str, favorite_group_name: &str, user_id: &str) -> Result<models::FavoriteGroup, Error<GetFavoriteGroupError>> { pub async fn get_favorite_group(
configuration: &configuration::Configuration,
favorite_group_type: &str,
favorite_group_name: &str,
user_id: &str,
) -> Result<models::FavoriteGroup, Error<GetFavoriteGroupError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/favorite/group/{favoriteGroupType}/{favoriteGroupName}/{userId}", local_var_configuration.base_path, favoriteGroupType=crate::apis::urlencode(favorite_group_type), favoriteGroupName=crate::apis::urlencode(favorite_group_name), userId=crate::apis::urlencode(user_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); "{}/favorite/group/{favoriteGroupType}/{favoriteGroupName}/{userId}",
local_var_configuration.base_path,
favoriteGroupType = crate::apis::urlencode(favorite_group_type),
favoriteGroupName = crate::apis::urlencode(favorite_group_name),
userId = crate::apis::urlencode(user_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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -185,32 +237,46 @@ pub async fn get_favorite_group(configuration: &configuration::Configuration, fa
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetFavoriteGroupError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetFavoriteGroupError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Return a list of favorite groups owned by a user. Returns the same information as `getFavoriteGroups`. /// Return a list of favorite groups owned by a user. Returns the same information as `getFavoriteGroups`.
pub async fn get_favorite_groups(configuration: &configuration::Configuration, n: Option<i32>, offset: Option<i32>, owner_id: Option<&str>) -> Result<Vec<models::FavoriteGroup>, Error<GetFavoriteGroupsError>> { pub async fn get_favorite_groups(
configuration: &configuration::Configuration,
n: Option<i32>,
offset: Option<i32>,
owner_id: Option<&str>,
) -> Result<Vec<models::FavoriteGroup>, Error<GetFavoriteGroupsError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/favorite/groups", local_var_configuration.base_path); let local_var_uri_str = format!("{}/favorite/groups", 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_str) = n { if let Some(ref local_var_str) = n {
local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = offset { if let Some(ref local_var_str) = offset {
local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("offset", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = owner_id { if let Some(ref local_var_str) = owner_id {
local_var_req_builder = local_var_req_builder.query(&[("ownerId", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("ownerId", &local_var_str.to_string())]);
} }
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -222,35 +288,50 @@ pub async fn get_favorite_groups(configuration: &configuration::Configuration, n
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetFavoriteGroupsError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetFavoriteGroupsError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Returns a list of favorites. /// Returns a list of favorites.
pub async fn get_favorites(configuration: &configuration::Configuration, n: Option<i32>, offset: Option<i32>, r#type: Option<&str>, tag: Option<&str>) -> Result<Vec<models::Favorite>, Error<GetFavoritesError>> { pub async fn get_favorites(
configuration: &configuration::Configuration,
n: Option<i32>,
offset: Option<i32>,
r#type: Option<&str>,
tag: Option<&str>,
) -> Result<Vec<models::Favorite>, Error<GetFavoritesError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/favorites", local_var_configuration.base_path); let local_var_uri_str = format!("{}/favorites", 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_str) = n { if let Some(ref local_var_str) = n {
local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = offset { if let Some(ref local_var_str) = offset {
local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("offset", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = r#type { if let Some(ref local_var_str) = r#type {
local_var_req_builder = local_var_req_builder.query(&[("type", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("type", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = tag { if let Some(ref local_var_str) = tag {
local_var_req_builder = local_var_req_builder.query(&[("tag", &local_var_str.to_string())]); local_var_req_builder = local_var_req_builder.query(&[("tag", &local_var_str.to_string())]);
} }
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -262,23 +343,37 @@ pub async fn get_favorites(configuration: &configuration::Configuration, n: Opti
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetFavoritesError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetFavoritesError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Remove a favorite from your favorites list. /// Remove a favorite from your favorites list.
pub async fn remove_favorite(configuration: &configuration::Configuration, favorite_id: &str) -> Result<models::Success, Error<RemoveFavoriteError>> { pub async fn remove_favorite(
configuration: &configuration::Configuration,
favorite_id: &str,
) -> Result<models::Success, Error<RemoveFavoriteError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/favorites/{favoriteId}", local_var_configuration.base_path, favoriteId=crate::apis::urlencode(favorite_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); "{}/favorites/{favoriteId}",
local_var_configuration.base_path,
favoriteId = crate::apis::urlencode(favorite_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) = local_var_configuration.user_agent { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -290,23 +385,42 @@ pub async fn remove_favorite(configuration: &configuration::Configuration, favor
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<RemoveFavoriteError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<RemoveFavoriteError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Update information about a specific favorite group. /// Update information about a specific favorite group.
pub async fn update_favorite_group(configuration: &configuration::Configuration, favorite_group_type: &str, favorite_group_name: &str, user_id: &str, update_favorite_group_request: Option<models::UpdateFavoriteGroupRequest>) -> Result<(), Error<UpdateFavoriteGroupError>> { pub async fn update_favorite_group(
configuration: &configuration::Configuration,
favorite_group_type: &str,
favorite_group_name: &str,
user_id: &str,
update_favorite_group_request: Option<models::UpdateFavoriteGroupRequest>,
) -> Result<(), Error<UpdateFavoriteGroupError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/favorite/group/{favoriteGroupType}/{favoriteGroupName}/{userId}", local_var_configuration.base_path, favoriteGroupType=crate::apis::urlencode(favorite_group_type), favoriteGroupName=crate::apis::urlencode(favorite_group_name), userId=crate::apis::urlencode(user_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); "{}/favorite/group/{favoriteGroupType}/{favoriteGroupName}/{userId}",
local_var_configuration.base_path,
favoriteGroupType = crate::apis::urlencode(favorite_group_type),
favoriteGroupName = crate::apis::urlencode(favorite_group_name),
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 { 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());
} }
local_var_req_builder = local_var_req_builder.json(&update_favorite_group_request); local_var_req_builder = local_var_req_builder.json(&update_favorite_group_request);
@ -319,9 +433,13 @@ pub async fn update_favorite_group(configuration: &configuration::Configuration,
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(()) Ok(())
} else { } else {
let local_var_entity: Option<UpdateFavoriteGroupError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<UpdateFavoriteGroupError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }

View File

@ -6,12 +6,10 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
use super::{configuration, Error};
use crate::{apis::ResponseContent, models};
use reqwest; use reqwest;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration};
/// struct for typed errors of method [`create_file`] /// struct for typed errors of method [`create_file`]
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
@ -89,18 +87,22 @@ pub enum StartFileDataUploadError {
UnknownValue(serde_json::Value), UnknownValue(serde_json::Value),
} }
/// Creates a new File object /// Creates a new File object
pub async fn create_file(configuration: &configuration::Configuration, create_file_request: Option<models::CreateFileRequest>) -> Result<models::File, Error<CreateFileError>> { pub async fn create_file(
configuration: &configuration::Configuration,
create_file_request: Option<models::CreateFileRequest>,
) -> Result<models::File, Error<CreateFileError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/file", local_var_configuration.base_path); let local_var_uri_str = format!("{}/file", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); 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 { 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());
} }
local_var_req_builder = local_var_req_builder.json(&create_file_request); local_var_req_builder = local_var_req_builder.json(&create_file_request);
@ -113,23 +115,38 @@ pub async fn create_file(configuration: &configuration::Configuration, create_fi
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<CreateFileError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<CreateFileError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Creates a new FileVersion. Once a Version has been created, proceed to the `/file/{fileId}/{versionId}/file/start` endpoint to start a file upload. /// Creates a new FileVersion. Once a Version has been created, proceed to the `/file/{fileId}/{versionId}/file/start` endpoint to start a file upload.
pub async fn create_file_version(configuration: &configuration::Configuration, file_id: &str, create_file_version_request: Option<models::CreateFileVersionRequest>) -> Result<models::File, Error<CreateFileVersionError>> { pub async fn create_file_version(
configuration: &configuration::Configuration,
file_id: &str,
create_file_version_request: Option<models::CreateFileVersionRequest>,
) -> Result<models::File, Error<CreateFileVersionError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/file/{fileId}", local_var_configuration.base_path, fileId=crate::apis::urlencode(file_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); "{}/file/{fileId}",
local_var_configuration.base_path,
fileId = crate::apis::urlencode(file_id)
);
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 { 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());
} }
local_var_req_builder = local_var_req_builder.json(&create_file_version_request); local_var_req_builder = local_var_req_builder.json(&create_file_version_request);
@ -142,23 +159,37 @@ pub async fn create_file_version(configuration: &configuration::Configuration, f
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<CreateFileVersionError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<CreateFileVersionError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Deletes a File object. /// Deletes a File object.
pub async fn delete_file(configuration: &configuration::Configuration, file_id: &str) -> Result<models::File, Error<DeleteFileError>> { pub async fn delete_file(
configuration: &configuration::Configuration,
file_id: &str,
) -> Result<models::File, Error<DeleteFileError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/file/{fileId}", local_var_configuration.base_path, fileId=crate::apis::urlencode(file_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); "{}/file/{fileId}",
local_var_configuration.base_path,
fileId = crate::apis::urlencode(file_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) = local_var_configuration.user_agent { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -170,23 +201,39 @@ pub async fn delete_file(configuration: &configuration::Configuration, file_id:
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<DeleteFileError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<DeleteFileError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Delete a specific version of a file. You can only delete the latest version. /// Delete a specific version of a file. You can only delete the latest version.
pub async fn delete_file_version(configuration: &configuration::Configuration, file_id: &str, version_id: i32) -> Result<models::File, Error<DeleteFileVersionError>> { pub async fn delete_file_version(
configuration: &configuration::Configuration,
file_id: &str,
version_id: i32,
) -> Result<models::File, Error<DeleteFileVersionError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/file/{fileId}/{versionId}", local_var_configuration.base_path, fileId=crate::apis::urlencode(file_id), versionId=version_id); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); "{}/file/{fileId}/{versionId}",
local_var_configuration.base_path,
fileId = crate::apis::urlencode(file_id),
versionId = version_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) = local_var_configuration.user_agent { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -198,23 +245,39 @@ pub async fn delete_file_version(configuration: &configuration::Configuration, f
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<DeleteFileVersionError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<DeleteFileVersionError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Downloads the file with the provided version number. **Version Note:** Version 0 is always when the file was created. The real data is usually always located in version 1 and up. **Extension Note:** Files are not guaranteed to have a file extensions. UnityPackage files tends to have it, images through this endpoint do not. You are responsible for appending file extension from the `extension` field when neccesary. /// Downloads the file with the provided version number. **Version Note:** Version 0 is always when the file was created. The real data is usually always located in version 1 and up. **Extension Note:** Files are not guaranteed to have a file extensions. UnityPackage files tends to have it, images through this endpoint do not. You are responsible for appending file extension from the `extension` field when neccesary.
pub async fn download_file_version(configuration: &configuration::Configuration, file_id: &str, version_id: i32) -> Result<(), Error<DownloadFileVersionError>> { pub async fn download_file_version(
configuration: &configuration::Configuration,
file_id: &str,
version_id: i32,
) -> Result<(), Error<DownloadFileVersionError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/file/{fileId}/{versionId}", local_var_configuration.base_path, fileId=crate::apis::urlencode(file_id), versionId=version_id); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); "{}/file/{fileId}/{versionId}",
local_var_configuration.base_path,
fileId = crate::apis::urlencode(file_id),
versionId = version_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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -226,23 +289,42 @@ pub async fn download_file_version(configuration: &configuration::Configuration,
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(()) Ok(())
} else { } else {
let local_var_entity: Option<DownloadFileVersionError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<DownloadFileVersionError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Finish an upload of a FileData. This will mark it as \"complete\". After uploading the `file` for Avatars and Worlds you then have to upload a `signature` file. /// Finish an upload of a FileData. This will mark it as \"complete\". After uploading the `file` for Avatars and Worlds you then have to upload a `signature` file.
pub async fn finish_file_data_upload(configuration: &configuration::Configuration, file_id: &str, version_id: i32, file_type: &str, finish_file_data_upload_request: Option<models::FinishFileDataUploadRequest>) -> Result<models::File, Error<FinishFileDataUploadError>> { pub async fn finish_file_data_upload(
configuration: &configuration::Configuration,
file_id: &str,
version_id: i32,
file_type: &str,
finish_file_data_upload_request: Option<models::FinishFileDataUploadRequest>,
) -> Result<models::File, Error<FinishFileDataUploadError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/file/{fileId}/{versionId}/{fileType}/finish", local_var_configuration.base_path, fileId=crate::apis::urlencode(file_id), versionId=version_id, fileType=crate::apis::urlencode(file_type)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); "{}/file/{fileId}/{versionId}/{fileType}/finish",
local_var_configuration.base_path,
fileId = crate::apis::urlencode(file_id),
versionId = version_id,
fileType = crate::apis::urlencode(file_type)
);
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 { 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());
} }
local_var_req_builder = local_var_req_builder.json(&finish_file_data_upload_request); local_var_req_builder = local_var_req_builder.json(&finish_file_data_upload_request);
@ -255,23 +337,37 @@ pub async fn finish_file_data_upload(configuration: &configuration::Configuratio
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<FinishFileDataUploadError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<FinishFileDataUploadError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Shows general information about the \"File\" object. Each File can have several \"Version\"'s, and each Version can have multiple real files or \"Data\" blobs. /// Shows general information about the \"File\" object. Each File can have several \"Version\"'s, and each Version can have multiple real files or \"Data\" blobs.
pub async fn get_file(configuration: &configuration::Configuration, file_id: &str) -> Result<models::File, Error<GetFileError>> { pub async fn get_file(
configuration: &configuration::Configuration,
file_id: &str,
) -> Result<models::File, Error<GetFileError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/file/{fileId}", local_var_configuration.base_path, fileId=crate::apis::urlencode(file_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); "{}/file/{fileId}",
local_var_configuration.base_path,
fileId = crate::apis::urlencode(file_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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -284,22 +380,39 @@ pub async fn get_file(configuration: &configuration::Configuration, file_id: &st
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetFileError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetFileError> = 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_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Retrieves the upload status for file upload. Can currently only be accessed when `status` is `waiting`. Trying to access it on a file version already uploaded currently times out. /// Retrieves the upload status for file upload. Can currently only be accessed when `status` is `waiting`. Trying to access it on a file version already uploaded currently times out.
pub async fn get_file_data_upload_status(configuration: &configuration::Configuration, file_id: &str, version_id: i32, file_type: &str) -> Result<models::FileVersionUploadStatus, Error<GetFileDataUploadStatusError>> { pub async fn get_file_data_upload_status(
configuration: &configuration::Configuration,
file_id: &str,
version_id: i32,
file_type: &str,
) -> Result<models::FileVersionUploadStatus, Error<GetFileDataUploadStatusError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/file/{fileId}/{versionId}/{fileType}/status", local_var_configuration.base_path, fileId=crate::apis::urlencode(file_id), versionId=version_id, fileType=crate::apis::urlencode(file_type)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); "{}/file/{fileId}/{versionId}/{fileType}/status",
local_var_configuration.base_path,
fileId = crate::apis::urlencode(file_id),
versionId = version_id,
fileType = crate::apis::urlencode(file_type)
);
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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -311,35 +424,50 @@ pub async fn get_file_data_upload_status(configuration: &configuration::Configur
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetFileDataUploadStatusError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetFileDataUploadStatusError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Returns a list of files /// Returns a list of files
pub async fn get_files(configuration: &configuration::Configuration, tag: Option<&str>, user_id: Option<&str>, n: Option<i32>, offset: Option<i32>) -> Result<Vec<models::File>, Error<GetFilesError>> { pub async fn get_files(
configuration: &configuration::Configuration,
tag: Option<&str>,
user_id: Option<&str>,
n: Option<i32>,
offset: Option<i32>,
) -> Result<Vec<models::File>, Error<GetFilesError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/files", local_var_configuration.base_path); let local_var_uri_str = format!("{}/files", 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_str) = tag { if let Some(ref local_var_str) = tag {
local_var_req_builder = local_var_req_builder.query(&[("tag", &local_var_str.to_string())]); local_var_req_builder = local_var_req_builder.query(&[("tag", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = user_id { if let Some(ref local_var_str) = user_id {
local_var_req_builder = local_var_req_builder.query(&[("userId", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("userId", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = n { if let Some(ref local_var_str) = n {
local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = offset { if let Some(ref local_var_str) = offset {
local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("offset", &local_var_str.to_string())]);
} }
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -352,25 +480,44 @@ pub async fn get_files(configuration: &configuration::Configuration, tag: Option
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetFilesError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetFilesError> = 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_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Starts an upload of a specific FilePart. This endpoint will return an AWS URL which you can PUT data to. You need to call this and receive a new AWS API URL for each `partNumber`. Please see AWS's REST documentation on \"PUT Object to S3\" on how to upload. Once all parts has been uploaded, proceed to `/finish` endpoint. **Note:** `nextPartNumber` seems like it is always ignored. Despite it returning 0, first partNumber is always 1. /// Starts an upload of a specific FilePart. This endpoint will return an AWS URL which you can PUT data to. You need to call this and receive a new AWS API URL for each `partNumber`. Please see AWS's REST documentation on \"PUT Object to S3\" on how to upload. Once all parts has been uploaded, proceed to `/finish` endpoint. **Note:** `nextPartNumber` seems like it is always ignored. Despite it returning 0, first partNumber is always 1.
pub async fn start_file_data_upload(configuration: &configuration::Configuration, file_id: &str, version_id: i32, file_type: &str, part_number: Option<i32>) -> Result<models::FileUploadUrl, Error<StartFileDataUploadError>> { pub async fn start_file_data_upload(
configuration: &configuration::Configuration,
file_id: &str,
version_id: i32,
file_type: &str,
part_number: Option<i32>,
) -> Result<models::FileUploadUrl, Error<StartFileDataUploadError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/file/{fileId}/{versionId}/{fileType}/start", local_var_configuration.base_path, fileId=crate::apis::urlencode(file_id), versionId=version_id, fileType=crate::apis::urlencode(file_type)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); "{}/file/{fileId}/{versionId}/{fileType}/start",
local_var_configuration.base_path,
fileId = crate::apis::urlencode(file_id),
versionId = version_id,
fileType = crate::apis::urlencode(file_type)
);
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_str) = part_number { if let Some(ref local_var_str) = part_number {
local_var_req_builder = local_var_req_builder.query(&[("partNumber", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("partNumber", &local_var_str.to_string())]);
} }
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -382,9 +529,13 @@ pub async fn start_file_data_upload(configuration: &configuration::Configuration
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<StartFileDataUploadError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<StartFileDataUploadError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }

View File

@ -6,12 +6,10 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
use super::{configuration, Error};
use crate::{apis::ResponseContent, models};
use reqwest; use reqwest;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration};
/// struct for typed errors of method [`delete_friend_request`] /// struct for typed errors of method [`delete_friend_request`]
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
@ -57,18 +55,26 @@ pub enum UnfriendError {
UnknownValue(serde_json::Value), UnknownValue(serde_json::Value),
} }
/// Deletes an outgoing pending friend request to another user. To delete an incoming friend request, use the `deleteNotification` endpoint instead. /// Deletes an outgoing pending friend request to another user. To delete an incoming friend request, use the `deleteNotification` endpoint instead.
pub async fn delete_friend_request(configuration: &configuration::Configuration, user_id: &str) -> Result<models::Success, Error<DeleteFriendRequestError>> { pub async fn delete_friend_request(
configuration: &configuration::Configuration,
user_id: &str,
) -> Result<models::Success, Error<DeleteFriendRequestError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/user/{userId}/friendRequest", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); "{}/user/{userId}/friendRequest",
local_var_configuration.base_path,
userId = crate::apis::urlencode(user_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) = local_var_configuration.user_agent { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -80,23 +86,37 @@ pub async fn delete_friend_request(configuration: &configuration::Configuration,
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<DeleteFriendRequestError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<DeleteFriendRequestError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Send a friend request to another user. /// Send a friend request to another user.
pub async fn friend(configuration: &configuration::Configuration, user_id: &str) -> Result<models::Notification, Error<FriendError>> { pub async fn friend(
configuration: &configuration::Configuration,
user_id: &str,
) -> Result<models::Notification, Error<FriendError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/user/{userId}/friendRequest", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); "{}/user/{userId}/friendRequest",
local_var_configuration.base_path,
userId = crate::apis::urlencode(user_id)
);
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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -109,22 +129,35 @@ pub async fn friend(configuration: &configuration::Configuration, user_id: &str)
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<FriendError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<FriendError> = 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_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Retrieve if the user is currently a friend with a given user, if they have an outgoing friend request, and if they have an incoming friend request. The proper way to receive and accept friend request is by checking if the user has an incoming `Notification` of type `friendRequest`, and then accepting that notification. /// Retrieve if the user is currently a friend with a given user, if they have an outgoing friend request, and if they have an incoming friend request. The proper way to receive and accept friend request is by checking if the user has an incoming `Notification` of type `friendRequest`, and then accepting that notification.
pub async fn get_friend_status(configuration: &configuration::Configuration, user_id: &str) -> Result<models::FriendStatus, Error<GetFriendStatusError>> { pub async fn get_friend_status(
configuration: &configuration::Configuration,
user_id: &str,
) -> Result<models::FriendStatus, Error<GetFriendStatusError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/user/{userId}/friendStatus", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); "{}/user/{userId}/friendStatus",
local_var_configuration.base_path,
userId = crate::apis::urlencode(user_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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -136,32 +169,46 @@ pub async fn get_friend_status(configuration: &configuration::Configuration, use
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetFriendStatusError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetFriendStatusError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// List information about friends. /// List information about friends.
pub async fn get_friends(configuration: &configuration::Configuration, offset: Option<i32>, n: Option<i32>, offline: Option<bool>) -> Result<Vec<models::LimitedUser>, Error<GetFriendsError>> { pub async fn get_friends(
configuration: &configuration::Configuration,
offset: Option<i32>,
n: Option<i32>,
offline: Option<bool>,
) -> Result<Vec<models::LimitedUser>, Error<GetFriendsError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/auth/user/friends", local_var_configuration.base_path); let local_var_uri_str = format!("{}/auth/user/friends", 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_str) = offset { if let Some(ref local_var_str) = offset {
local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("offset", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = n { if let Some(ref local_var_str) = n {
local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = offline { if let Some(ref local_var_str) = offline {
local_var_req_builder = local_var_req_builder.query(&[("offline", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("offline", &local_var_str.to_string())]);
} }
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -173,23 +220,37 @@ pub async fn get_friends(configuration: &configuration::Configuration, offset: O
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetFriendsError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetFriendsError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Unfriend a user by ID. /// Unfriend a user by ID.
pub async fn unfriend(configuration: &configuration::Configuration, user_id: &str) -> Result<models::Success, Error<UnfriendError>> { pub async fn unfriend(
configuration: &configuration::Configuration,
user_id: &str,
) -> Result<models::Success, Error<UnfriendError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/auth/user/friends/{userId}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); "{}/auth/user/friends/{userId}",
local_var_configuration.base_path,
userId = crate::apis::urlencode(user_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) = local_var_configuration.user_agent { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -202,8 +263,11 @@ pub async fn unfriend(configuration: &configuration::Configuration, user_id: &st
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<UnfriendError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<UnfriendError> = 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_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error)) Err(Error::ResponseError(local_var_error))
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -6,12 +6,10 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
use super::{configuration, Error};
use crate::{apis::ResponseContent, models};
use reqwest; use reqwest;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration};
/// struct for typed errors of method [`close_instance`] /// struct for typed errors of method [`close_instance`]
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
@ -64,24 +62,38 @@ pub enum SendSelfInviteError {
UnknownValue(serde_json::Value), UnknownValue(serde_json::Value),
} }
/// Close an instance or update the closedAt time when it will be closed. You can only close an instance if the ownerId is yourself or if the instance owner is a group and you have the `group-instance-moderate` permission. /// Close an instance or update the closedAt time when it will be closed. You can only close an instance if the ownerId is yourself or if the instance owner is a group and you have the `group-instance-moderate` permission.
pub async fn close_instance(configuration: &configuration::Configuration, world_id: &str, instance_id: &str, hard_close: Option<bool>, closed_at: Option<String>) -> Result<models::Instance, Error<CloseInstanceError>> { pub async fn close_instance(
configuration: &configuration::Configuration,
world_id: &str,
instance_id: &str,
hard_close: Option<bool>,
closed_at: Option<String>,
) -> Result<models::Instance, Error<CloseInstanceError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/instances/{worldId}:{instanceId}", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id), instanceId=crate::apis::urlencode(instance_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); "{}/instances/{worldId}:{instanceId}",
local_var_configuration.base_path,
worldId = crate::apis::urlencode(world_id),
instanceId = crate::apis::urlencode(instance_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_str) = hard_close { if let Some(ref local_var_str) = hard_close {
local_var_req_builder = local_var_req_builder.query(&[("hardClose", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("hardClose", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = closed_at { if let Some(ref local_var_str) = closed_at {
local_var_req_builder = local_var_req_builder.query(&[("closedAt", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("closedAt", &local_var_str.to_string())]);
} }
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -93,23 +105,33 @@ pub async fn close_instance(configuration: &configuration::Configuration, world_
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<CloseInstanceError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<CloseInstanceError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Create an instance /// Create an instance
pub async fn create_instance(configuration: &configuration::Configuration, create_instance_request: models::CreateInstanceRequest) -> Result<models::Instance, Error<CreateInstanceError>> { pub async fn create_instance(
configuration: &configuration::Configuration,
create_instance_request: models::CreateInstanceRequest,
) -> Result<models::Instance, Error<CreateInstanceError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/instances", local_var_configuration.base_path); let local_var_uri_str = format!("{}/instances", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); 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 { 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());
} }
local_var_req_builder = local_var_req_builder.json(&create_instance_request); local_var_req_builder = local_var_req_builder.json(&create_instance_request);
@ -122,23 +144,39 @@ pub async fn create_instance(configuration: &configuration::Configuration, creat
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<CreateInstanceError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<CreateInstanceError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Returns an instance. Please read [Instances Tutorial](https://vrchatapi.github.io/tutorials/instances/) for more information on Instances. If an invalid instanceId is provided, this endpoint will simply return \"null\"! /// Returns an instance. Please read [Instances Tutorial](https://vrchatapi.github.io/tutorials/instances/) for more information on Instances. If an invalid instanceId is provided, this endpoint will simply return \"null\"!
pub async fn get_instance(configuration: &configuration::Configuration, world_id: &str, instance_id: &str) -> Result<models::Instance, Error<GetInstanceError>> { pub async fn get_instance(
configuration: &configuration::Configuration,
world_id: &str,
instance_id: &str,
) -> Result<models::Instance, Error<GetInstanceError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/instances/{worldId}:{instanceId}", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id), instanceId=crate::apis::urlencode(instance_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); "{}/instances/{worldId}:{instanceId}",
local_var_configuration.base_path,
worldId = crate::apis::urlencode(world_id),
instanceId = crate::apis::urlencode(instance_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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -150,23 +188,37 @@ pub async fn get_instance(configuration: &configuration::Configuration, world_id
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetInstanceError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetInstanceError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Returns an instance. Please read [Instances Tutorial](https://vrchatapi.github.io/tutorials/instances/) for more information on Instances. /// Returns an instance. Please read [Instances Tutorial](https://vrchatapi.github.io/tutorials/instances/) for more information on Instances.
pub async fn get_instance_by_short_name(configuration: &configuration::Configuration, short_name: &str) -> Result<models::Instance, Error<GetInstanceByShortNameError>> { pub async fn get_instance_by_short_name(
configuration: &configuration::Configuration,
short_name: &str,
) -> Result<models::Instance, Error<GetInstanceByShortNameError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/instances/s/{shortName}", local_var_configuration.base_path, shortName=crate::apis::urlencode(short_name)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); "{}/instances/s/{shortName}",
local_var_configuration.base_path,
shortName = crate::apis::urlencode(short_name)
);
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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -178,23 +230,39 @@ pub async fn get_instance_by_short_name(configuration: &configuration::Configura
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetInstanceByShortNameError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetInstanceByShortNameError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Returns an instance short name. /// Returns an instance short name.
pub async fn get_short_name(configuration: &configuration::Configuration, world_id: &str, instance_id: &str) -> Result<models::InstanceShortNameResponse, Error<GetShortNameError>> { pub async fn get_short_name(
configuration: &configuration::Configuration,
world_id: &str,
instance_id: &str,
) -> Result<models::InstanceShortNameResponse, Error<GetShortNameError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/instances/{worldId}:{instanceId}/shortName", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id), instanceId=crate::apis::urlencode(instance_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); "{}/instances/{worldId}:{instanceId}/shortName",
local_var_configuration.base_path,
worldId = crate::apis::urlencode(world_id),
instanceId = crate::apis::urlencode(instance_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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -206,23 +274,39 @@ pub async fn get_short_name(configuration: &configuration::Configuration, world_
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetShortNameError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetShortNameError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Sends an invite to the instance to yourself. /// Sends an invite to the instance to yourself.
pub async fn send_self_invite(configuration: &configuration::Configuration, world_id: &str, instance_id: &str) -> Result<models::Success, Error<SendSelfInviteError>> { pub async fn send_self_invite(
configuration: &configuration::Configuration,
world_id: &str,
instance_id: &str,
) -> Result<models::Success, Error<SendSelfInviteError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/instances/{worldId}:{instanceId}/invite", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id), instanceId=crate::apis::urlencode(instance_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); "{}/instances/{worldId}:{instanceId}/invite",
local_var_configuration.base_path,
worldId = crate::apis::urlencode(world_id),
instanceId = crate::apis::urlencode(instance_id)
);
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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -234,9 +318,13 @@ pub async fn send_self_invite(configuration: &configuration::Configuration, worl
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<SendSelfInviteError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<SendSelfInviteError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }

View File

@ -6,12 +6,10 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
use super::{configuration, Error};
use crate::{apis::ResponseContent, models};
use reqwest; use reqwest;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration};
/// struct for typed errors of method [`get_invite_message`] /// struct for typed errors of method [`get_invite_message`]
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
@ -86,18 +84,30 @@ pub enum UpdateInviteMessageError {
UnknownValue(serde_json::Value), UnknownValue(serde_json::Value),
} }
/// Returns a single Invite Message. This returns the exact same information but less than `getInviteMessages`. Admin Credentials are required to view messages of other users! Message type refers to a different collection of messages, used during different types of responses. * `message` = Message during a normal invite * `response` = Message when replying to a message * `request` = Message when requesting an invite * `requestResponse` = Message when replying to a request for invite /// Returns a single Invite Message. This returns the exact same information but less than `getInviteMessages`. Admin Credentials are required to view messages of other users! Message type refers to a different collection of messages, used during different types of responses. * `message` = Message during a normal invite * `response` = Message when replying to a message * `request` = Message when requesting an invite * `requestResponse` = Message when replying to a request for invite
pub async fn get_invite_message(configuration: &configuration::Configuration, user_id: &str, message_type: models::InviteMessageType, slot: i32) -> Result<models::InviteMessage, Error<GetInviteMessageError>> { pub async fn get_invite_message(
configuration: &configuration::Configuration,
user_id: &str,
message_type: models::InviteMessageType,
slot: i32,
) -> Result<models::InviteMessage, Error<GetInviteMessageError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/message/{userId}/{messageType}/{slot}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id), messageType=message_type.to_string(), slot=slot); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); "{}/message/{userId}/{messageType}/{slot}",
local_var_configuration.base_path,
userId = crate::apis::urlencode(user_id),
messageType = message_type.to_string(),
slot = slot
);
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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -109,23 +119,39 @@ pub async fn get_invite_message(configuration: &configuration::Configuration, us
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetInviteMessageError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetInviteMessageError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Returns a list of all the users Invite Messages. Admin Credentials are required to view messages of other users! Message type refers to a different collection of messages, used during different types of responses. * `message` = Message during a normal invite * `response` = Message when replying to a message * `request` = Message when requesting an invite * `requestResponse` = Message when replying to a request for invite /// Returns a list of all the users Invite Messages. Admin Credentials are required to view messages of other users! Message type refers to a different collection of messages, used during different types of responses. * `message` = Message during a normal invite * `response` = Message when replying to a message * `request` = Message when requesting an invite * `requestResponse` = Message when replying to a request for invite
pub async fn get_invite_messages(configuration: &configuration::Configuration, user_id: &str, message_type: models::InviteMessageType) -> Result<Vec<models::InviteMessage>, Error<GetInviteMessagesError>> { pub async fn get_invite_messages(
configuration: &configuration::Configuration,
user_id: &str,
message_type: models::InviteMessageType,
) -> Result<Vec<models::InviteMessage>, Error<GetInviteMessagesError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/message/{userId}/{messageType}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id), messageType=message_type.to_string()); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); "{}/message/{userId}/{messageType}",
local_var_configuration.base_path,
userId = crate::apis::urlencode(user_id),
messageType = message_type.to_string()
);
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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -137,23 +163,39 @@ pub async fn get_invite_messages(configuration: &configuration::Configuration, u
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetInviteMessagesError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetInviteMessagesError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Sends self an invite to an instance /// Sends self an invite to an instance
pub async fn invite_myself_to(configuration: &configuration::Configuration, world_id: &str, instance_id: &str) -> Result<models::SentNotification, Error<InviteMyselfToError>> { pub async fn invite_myself_to(
configuration: &configuration::Configuration,
world_id: &str,
instance_id: &str,
) -> Result<models::SentNotification, Error<InviteMyselfToError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/invite/myself/to/{worldId}:{instanceId}", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id), instanceId=crate::apis::urlencode(instance_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); "{}/invite/myself/to/{worldId}:{instanceId}",
local_var_configuration.base_path,
worldId = crate::apis::urlencode(world_id),
instanceId = crate::apis::urlencode(instance_id)
);
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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -165,23 +207,38 @@ pub async fn invite_myself_to(configuration: &configuration::Configuration, worl
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<InviteMyselfToError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<InviteMyselfToError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Sends an invite to a user. Returns the Notification of type `invite` that was sent. /// Sends an invite to a user. Returns the Notification of type `invite` that was sent.
pub async fn invite_user(configuration: &configuration::Configuration, user_id: &str, invite_request: models::InviteRequest) -> Result<models::SentNotification, Error<InviteUserError>> { pub async fn invite_user(
configuration: &configuration::Configuration,
user_id: &str,
invite_request: models::InviteRequest,
) -> Result<models::SentNotification, Error<InviteUserError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/invite/{userId}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); "{}/invite/{userId}",
local_var_configuration.base_path,
userId = crate::apis::urlencode(user_id)
);
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 { 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());
} }
local_var_req_builder = local_var_req_builder.json(&invite_request); local_var_req_builder = local_var_req_builder.json(&invite_request);
@ -194,23 +251,38 @@ pub async fn invite_user(configuration: &configuration::Configuration, user_id:
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<InviteUserError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<InviteUserError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Requests an invite from a user. Returns the Notification of type `requestInvite` that was sent. /// Requests an invite from a user. Returns the Notification of type `requestInvite` that was sent.
pub async fn request_invite(configuration: &configuration::Configuration, user_id: &str, request_invite_request: Option<models::RequestInviteRequest>) -> Result<models::Notification, Error<RequestInviteError>> { pub async fn request_invite(
configuration: &configuration::Configuration,
user_id: &str,
request_invite_request: Option<models::RequestInviteRequest>,
) -> Result<models::Notification, Error<RequestInviteError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/requestInvite/{userId}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); "{}/requestInvite/{userId}",
local_var_configuration.base_path,
userId = crate::apis::urlencode(user_id)
);
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 { 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());
} }
local_var_req_builder = local_var_req_builder.json(&request_invite_request); local_var_req_builder = local_var_req_builder.json(&request_invite_request);
@ -223,23 +295,41 @@ pub async fn request_invite(configuration: &configuration::Configuration, user_i
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<RequestInviteError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<RequestInviteError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Resets a single Invite Message back to its original message, and then returns a list of all of them. Admin Credentials are required to update messages of other users! Resetting a message respects the rate-limit, so it is not possible to reset within the 60 minutes countdown. Resetting it does however not set the rate-limit to 60 like when editing it. It is possible to edit it right after resetting it. Trying to edit a message before the cooldown timer expires results in a 429 \"Too Fast Error\". Message type refers to a different collection of messages, used during different types of responses. * `message` = Message during a normal invite * `response` = Message when replying to a message * `request` = Message when requesting an invite * `requestResponse` = Message when replying to a request for invite The DELETE endpoint does not have/require any request body. /// Resets a single Invite Message back to its original message, and then returns a list of all of them. Admin Credentials are required to update messages of other users! Resetting a message respects the rate-limit, so it is not possible to reset within the 60 minutes countdown. Resetting it does however not set the rate-limit to 60 like when editing it. It is possible to edit it right after resetting it. Trying to edit a message before the cooldown timer expires results in a 429 \"Too Fast Error\". Message type refers to a different collection of messages, used during different types of responses. * `message` = Message during a normal invite * `response` = Message when replying to a message * `request` = Message when requesting an invite * `requestResponse` = Message when replying to a request for invite The DELETE endpoint does not have/require any request body.
pub async fn reset_invite_message(configuration: &configuration::Configuration, user_id: &str, message_type: models::InviteMessageType, slot: i32) -> Result<Vec<models::InviteMessage>, Error<ResetInviteMessageError>> { pub async fn reset_invite_message(
configuration: &configuration::Configuration,
user_id: &str,
message_type: models::InviteMessageType,
slot: i32,
) -> Result<Vec<models::InviteMessage>, Error<ResetInviteMessageError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/message/{userId}/{messageType}/{slot}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id), messageType=message_type.to_string(), slot=slot); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); "{}/message/{userId}/{messageType}/{slot}",
local_var_configuration.base_path,
userId = crate::apis::urlencode(user_id),
messageType = message_type.to_string(),
slot = slot
);
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) = local_var_configuration.user_agent { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -251,23 +341,38 @@ pub async fn reset_invite_message(configuration: &configuration::Configuration,
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<ResetInviteMessageError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<ResetInviteMessageError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Respond to an invite request by sending a world invite to the requesting user. `:notificationId` is the ID of the requesting notification. /// Respond to an invite request by sending a world invite to the requesting user. `:notificationId` is the ID of the requesting notification.
pub async fn respond_invite(configuration: &configuration::Configuration, notification_id: &str, invite_response: models::InviteResponse) -> Result<models::Notification, Error<RespondInviteError>> { pub async fn respond_invite(
configuration: &configuration::Configuration,
notification_id: &str,
invite_response: models::InviteResponse,
) -> Result<models::Notification, Error<RespondInviteError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/invite/{notificationId}/response", local_var_configuration.base_path, notificationId=crate::apis::urlencode(notification_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); "{}/invite/{notificationId}/response",
local_var_configuration.base_path,
notificationId = crate::apis::urlencode(notification_id)
);
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 { 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());
} }
local_var_req_builder = local_var_req_builder.json(&invite_response); local_var_req_builder = local_var_req_builder.json(&invite_response);
@ -280,23 +385,42 @@ pub async fn respond_invite(configuration: &configuration::Configuration, notifi
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<RespondInviteError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<RespondInviteError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Updates a single Invite Message and then returns a list of all of them. Admin Credentials are required to update messages of other users! Updating a message automatically sets the cooldown timer to 60 minutes. Trying to edit a message before the cooldown timer expires results in a 429 \"Too Fast Error\". Message type refers to a different collection of messages, used during different types of responses. * `message` = Message during a normal invite * `response` = Message when replying to a message * `request` = Message when requesting an invite * `requestResponse` = Message when replying to a request for invite /// Updates a single Invite Message and then returns a list of all of them. Admin Credentials are required to update messages of other users! Updating a message automatically sets the cooldown timer to 60 minutes. Trying to edit a message before the cooldown timer expires results in a 429 \"Too Fast Error\". Message type refers to a different collection of messages, used during different types of responses. * `message` = Message during a normal invite * `response` = Message when replying to a message * `request` = Message when requesting an invite * `requestResponse` = Message when replying to a request for invite
pub async fn update_invite_message(configuration: &configuration::Configuration, user_id: &str, message_type: models::InviteMessageType, slot: i32, update_invite_message_request: Option<models::UpdateInviteMessageRequest>) -> Result<Vec<models::InviteMessage>, Error<UpdateInviteMessageError>> { pub async fn update_invite_message(
configuration: &configuration::Configuration,
user_id: &str,
message_type: models::InviteMessageType,
slot: i32,
update_invite_message_request: Option<models::UpdateInviteMessageRequest>,
) -> Result<Vec<models::InviteMessage>, Error<UpdateInviteMessageError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/message/{userId}/{messageType}/{slot}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id), messageType=message_type.to_string(), slot=slot); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); "{}/message/{userId}/{messageType}/{slot}",
local_var_configuration.base_path,
userId = crate::apis::urlencode(user_id),
messageType = message_type.to_string(),
slot = slot
);
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 { 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());
} }
local_var_req_builder = local_var_req_builder.json(&update_invite_message_request); local_var_req_builder = local_var_req_builder.json(&update_invite_message_request);
@ -309,9 +433,13 @@ pub async fn update_invite_message(configuration: &configuration::Configuration,
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<UpdateInviteMessageError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<UpdateInviteMessageError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }

View File

@ -16,7 +16,7 @@ pub enum Error<T> {
ResponseError(ResponseContent<T>), ResponseError(ResponseContent<T>),
} }
impl <T> fmt::Display for Error<T> { impl<T> fmt::Display for Error<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let (module, e) = match self { let (module, e) = match self {
Error::Reqwest(e) => ("reqwest", e.to_string()), Error::Reqwest(e) => ("reqwest", e.to_string()),
@ -28,7 +28,7 @@ impl <T> fmt::Display for Error<T> {
} }
} }
impl <T: fmt::Debug> error::Error for Error<T> { impl<T: fmt::Debug> error::Error for Error<T> {
fn source(&self) -> Option<&(dyn error::Error + 'static)> { fn source(&self) -> Option<&(dyn error::Error + 'static)> {
Some(match self { Some(match self {
Error::Reqwest(e) => e, Error::Reqwest(e) => e,
@ -39,19 +39,19 @@ impl <T: fmt::Debug> error::Error for Error<T> {
} }
} }
impl <T> From<reqwest::Error> for Error<T> { impl<T> From<reqwest::Error> for Error<T> {
fn from(e: reqwest::Error) -> Self { fn from(e: reqwest::Error) -> Self {
Error::Reqwest(e) Error::Reqwest(e)
} }
} }
impl <T> From<serde_json::Error> for Error<T> { impl<T> From<serde_json::Error> for Error<T> {
fn from(e: serde_json::Error) -> Self { fn from(e: serde_json::Error) -> Self {
Error::Serde(e) Error::Serde(e)
} }
} }
impl <T> From<std::io::Error> for Error<T> { impl<T> From<std::io::Error> for Error<T> {
fn from(e: std::io::Error) -> Self { fn from(e: std::io::Error) -> Self {
Error::Io(e) Error::Io(e)
} }
@ -78,8 +78,10 @@ pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String
value, value,
)); ));
} }
}, }
serde_json::Value::String(s) => params.push((format!("{}[{}]", prefix, key), s.clone())), serde_json::Value::String(s) => {
params.push((format!("{}[{}]", prefix, key), s.clone()))
}
_ => params.push((format!("{}[{}]", prefix, key), value.to_string())), _ => params.push((format!("{}[{}]", prefix, key), value.to_string())),
} }
} }

View File

@ -6,12 +6,10 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
use super::{configuration, Error};
use crate::{apis::ResponseContent, models};
use reqwest; use reqwest;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration};
/// struct for typed errors of method [`accept_friend_request`] /// struct for typed errors of method [`accept_friend_request`]
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
@ -54,18 +52,26 @@ pub enum MarkNotificationAsReadError {
UnknownValue(serde_json::Value), UnknownValue(serde_json::Value),
} }
/// Accept a friend request by notification `frq_` ID. Friend requests can be found using the NotificationsAPI `getNotifications` by filtering of type `friendRequest`. /// Accept a friend request by notification `frq_` ID. Friend requests can be found using the NotificationsAPI `getNotifications` by filtering of type `friendRequest`.
pub async fn accept_friend_request(configuration: &configuration::Configuration, notification_id: &str) -> Result<models::Success, Error<AcceptFriendRequestError>> { pub async fn accept_friend_request(
configuration: &configuration::Configuration,
notification_id: &str,
) -> Result<models::Success, Error<AcceptFriendRequestError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/auth/user/notifications/{notificationId}/accept", local_var_configuration.base_path, notificationId=crate::apis::urlencode(notification_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); "{}/auth/user/notifications/{notificationId}/accept",
local_var_configuration.base_path,
notificationId = crate::apis::urlencode(notification_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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -77,23 +83,35 @@ pub async fn accept_friend_request(configuration: &configuration::Configuration,
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<AcceptFriendRequestError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<AcceptFriendRequestError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Clear **all** notifications. /// Clear **all** notifications.
pub async fn clear_notifications(configuration: &configuration::Configuration, ) -> Result<models::Success, Error<ClearNotificationsError>> { pub async fn clear_notifications(
configuration: &configuration::Configuration,
) -> Result<models::Success, Error<ClearNotificationsError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/auth/user/notifications/clear", local_var_configuration.base_path); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); "{}/auth/user/notifications/clear",
local_var_configuration.base_path
);
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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -105,23 +123,37 @@ pub async fn clear_notifications(configuration: &configuration::Configuration, )
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<ClearNotificationsError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<ClearNotificationsError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Delete a notification. /// Delete a notification.
pub async fn delete_notification(configuration: &configuration::Configuration, notification_id: &str) -> Result<models::Notification, Error<DeleteNotificationError>> { pub async fn delete_notification(
configuration: &configuration::Configuration,
notification_id: &str,
) -> Result<models::Notification, Error<DeleteNotificationError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/auth/user/notifications/{notificationId}/hide", local_var_configuration.base_path, notificationId=crate::apis::urlencode(notification_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); "{}/auth/user/notifications/{notificationId}/hide",
local_var_configuration.base_path,
notificationId = crate::apis::urlencode(notification_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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -133,41 +165,64 @@ pub async fn delete_notification(configuration: &configuration::Configuration, n
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<DeleteNotificationError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<DeleteNotificationError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Retrieve all of the current user's notifications. /// Retrieve all of the current user's notifications.
pub async fn get_notifications(configuration: &configuration::Configuration, r#type: Option<&str>, sent: Option<bool>, hidden: Option<bool>, after: Option<&str>, n: Option<i32>, offset: Option<i32>) -> Result<Vec<models::Notification>, Error<GetNotificationsError>> { pub async fn get_notifications(
configuration: &configuration::Configuration,
r#type: Option<&str>,
sent: Option<bool>,
hidden: Option<bool>,
after: Option<&str>,
n: Option<i32>,
offset: Option<i32>,
) -> Result<Vec<models::Notification>, Error<GetNotificationsError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/auth/user/notifications", local_var_configuration.base_path); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); "{}/auth/user/notifications",
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_str) = r#type { if let Some(ref local_var_str) = r#type {
local_var_req_builder = local_var_req_builder.query(&[("type", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("type", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = sent { if let Some(ref local_var_str) = sent {
local_var_req_builder = local_var_req_builder.query(&[("sent", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("sent", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = hidden { if let Some(ref local_var_str) = hidden {
local_var_req_builder = local_var_req_builder.query(&[("hidden", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("hidden", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = after { if let Some(ref local_var_str) = after {
local_var_req_builder = local_var_req_builder.query(&[("after", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("after", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = n { if let Some(ref local_var_str) = n {
local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = offset { if let Some(ref local_var_str) = offset {
local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("offset", &local_var_str.to_string())]);
} }
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -179,23 +234,37 @@ pub async fn get_notifications(configuration: &configuration::Configuration, r#t
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetNotificationsError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetNotificationsError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Mark a notification as seen. /// Mark a notification as seen.
pub async fn mark_notification_as_read(configuration: &configuration::Configuration, notification_id: &str) -> Result<models::Notification, Error<MarkNotificationAsReadError>> { pub async fn mark_notification_as_read(
configuration: &configuration::Configuration,
notification_id: &str,
) -> Result<models::Notification, Error<MarkNotificationAsReadError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/auth/user/notifications/{notificationId}/see", local_var_configuration.base_path, notificationId=crate::apis::urlencode(notification_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); "{}/auth/user/notifications/{notificationId}/see",
local_var_configuration.base_path,
notificationId = crate::apis::urlencode(notification_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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -207,9 +276,13 @@ pub async fn mark_notification_as_read(configuration: &configuration::Configurat
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<MarkNotificationAsReadError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<MarkNotificationAsReadError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }

View File

@ -6,12 +6,10 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
use super::{configuration, Error};
use crate::{apis::ResponseContent, models};
use reqwest; use reqwest;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration};
/// struct for typed errors of method [`get_assigned_permissions`] /// struct for typed errors of method [`get_assigned_permissions`]
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
@ -29,18 +27,21 @@ pub enum GetPermissionError {
UnknownValue(serde_json::Value), UnknownValue(serde_json::Value),
} }
/// Returns a list of all permissions currently granted by the user. Permissions are assigned e.g. by subscribing to VRC+. /// Returns a list of all permissions currently granted by the user. Permissions are assigned e.g. by subscribing to VRC+.
pub async fn get_assigned_permissions(configuration: &configuration::Configuration, ) -> Result<Vec<models::Permission>, Error<GetAssignedPermissionsError>> { pub async fn get_assigned_permissions(
configuration: &configuration::Configuration,
) -> Result<Vec<models::Permission>, Error<GetAssignedPermissionsError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/auth/permissions", local_var_configuration.base_path); let local_var_uri_str = format!("{}/auth/permissions", 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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -52,23 +53,37 @@ pub async fn get_assigned_permissions(configuration: &configuration::Configurati
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetAssignedPermissionsError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetAssignedPermissionsError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Returns a single permission. This endpoint is pretty useless, as it returns the exact same information as `/auth/permissions`. /// Returns a single permission. This endpoint is pretty useless, as it returns the exact same information as `/auth/permissions`.
pub async fn get_permission(configuration: &configuration::Configuration, permission_id: &str) -> Result<models::Permission, Error<GetPermissionError>> { pub async fn get_permission(
configuration: &configuration::Configuration,
permission_id: &str,
) -> Result<models::Permission, Error<GetPermissionError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/permissions/{permissionId}", local_var_configuration.base_path, permissionId=crate::apis::urlencode(permission_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); "{}/permissions/{permissionId}",
local_var_configuration.base_path,
permissionId = crate::apis::urlencode(permission_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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -80,9 +95,13 @@ pub async fn get_permission(configuration: &configuration::Configuration, permis
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetPermissionError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetPermissionError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }

View File

@ -6,12 +6,10 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
use super::{configuration, Error};
use crate::{apis::ResponseContent, models};
use reqwest; use reqwest;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration};
/// struct for typed errors of method [`clear_all_player_moderations`] /// struct for typed errors of method [`clear_all_player_moderations`]
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
@ -63,18 +61,24 @@ pub enum UnmoderateUserError {
UnknownValue(serde_json::Value), UnknownValue(serde_json::Value),
} }
/// ⚠️ **This will delete every single player moderation you've ever made.** /// ⚠️ **This will delete every single player moderation you've ever made.**
pub async fn clear_all_player_moderations(configuration: &configuration::Configuration, ) -> Result<models::Success, Error<ClearAllPlayerModerationsError>> { pub async fn clear_all_player_moderations(
configuration: &configuration::Configuration,
) -> Result<models::Success, Error<ClearAllPlayerModerationsError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/auth/user/playermoderations", local_var_configuration.base_path); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); "{}/auth/user/playermoderations",
local_var_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) = local_var_configuration.user_agent { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -86,23 +90,37 @@ pub async fn clear_all_player_moderations(configuration: &configuration::Configu
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<ClearAllPlayerModerationsError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<ClearAllPlayerModerationsError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Deletes a specific player moderation based on it's `pmod_` ID. The website uses `unmoderateUser` instead. You can delete the same player moderation multiple times successfully. /// Deletes a specific player moderation based on it's `pmod_` ID. The website uses `unmoderateUser` instead. You can delete the same player moderation multiple times successfully.
pub async fn delete_player_moderation(configuration: &configuration::Configuration, player_moderation_id: &str) -> Result<models::Success, Error<DeletePlayerModerationError>> { pub async fn delete_player_moderation(
configuration: &configuration::Configuration,
player_moderation_id: &str,
) -> Result<models::Success, Error<DeletePlayerModerationError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/auth/user/playermoderations/{playerModerationId}", local_var_configuration.base_path, playerModerationId=crate::apis::urlencode(player_moderation_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); "{}/auth/user/playermoderations/{playerModerationId}",
local_var_configuration.base_path,
playerModerationId = crate::apis::urlencode(player_moderation_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) = local_var_configuration.user_agent { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -114,23 +132,37 @@ pub async fn delete_player_moderation(configuration: &configuration::Configurati
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<DeletePlayerModerationError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<DeletePlayerModerationError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Returns a single Player Moderation. This returns the exact same amount of information as the more generalised `getPlayerModerations`. /// Returns a single Player Moderation. This returns the exact same amount of information as the more generalised `getPlayerModerations`.
pub async fn get_player_moderation(configuration: &configuration::Configuration, player_moderation_id: &str) -> Result<models::PlayerModeration, Error<GetPlayerModerationError>> { pub async fn get_player_moderation(
configuration: &configuration::Configuration,
player_moderation_id: &str,
) -> Result<models::PlayerModeration, Error<GetPlayerModerationError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/auth/user/playermoderations/{playerModerationId}", local_var_configuration.base_path, playerModerationId=crate::apis::urlencode(player_moderation_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); "{}/auth/user/playermoderations/{playerModerationId}",
local_var_configuration.base_path,
playerModerationId = crate::apis::urlencode(player_moderation_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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -142,29 +174,45 @@ pub async fn get_player_moderation(configuration: &configuration::Configuration,
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetPlayerModerationError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetPlayerModerationError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Returns a list of all player moderations made by **you**. This endpoint does not have pagination, and will return *all* results. Use query parameters to limit your query if needed. /// Returns a list of all player moderations made by **you**. This endpoint does not have pagination, and will return *all* results. Use query parameters to limit your query if needed.
pub async fn get_player_moderations(configuration: &configuration::Configuration, r#type: Option<&str>, target_user_id: Option<&str>) -> Result<Vec<models::PlayerModeration>, Error<GetPlayerModerationsError>> { pub async fn get_player_moderations(
configuration: &configuration::Configuration,
r#type: Option<&str>,
target_user_id: Option<&str>,
) -> Result<Vec<models::PlayerModeration>, Error<GetPlayerModerationsError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/auth/user/playermoderations", local_var_configuration.base_path); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); "{}/auth/user/playermoderations",
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_str) = r#type { if let Some(ref local_var_str) = r#type {
local_var_req_builder = local_var_req_builder.query(&[("type", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("type", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = target_user_id { if let Some(ref local_var_str) = target_user_id {
local_var_req_builder = local_var_req_builder.query(&[("targetUserId", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("targetUserId", &local_var_str.to_string())]);
} }
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -176,23 +224,36 @@ pub async fn get_player_moderations(configuration: &configuration::Configuration
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetPlayerModerationsError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetPlayerModerationsError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Moderate a user, e.g. unmute them or show their avatar. Please see the [Player Moderation docs](https://vrchatapi.github.io/docs/api/#tag--playermoderation) on what playerModerations are, and how they differ from staff moderations. /// Moderate a user, e.g. unmute them or show their avatar. Please see the [Player Moderation docs](https://vrchatapi.github.io/docs/api/#tag--playermoderation) on what playerModerations are, and how they differ from staff moderations.
pub async fn moderate_user(configuration: &configuration::Configuration, moderate_user_request: models::ModerateUserRequest) -> Result<models::PlayerModeration, Error<ModerateUserError>> { pub async fn moderate_user(
configuration: &configuration::Configuration,
moderate_user_request: models::ModerateUserRequest,
) -> Result<models::PlayerModeration, Error<ModerateUserError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/auth/user/playermoderations", local_var_configuration.base_path); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); "{}/auth/user/playermoderations",
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 { 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());
} }
local_var_req_builder = local_var_req_builder.json(&moderate_user_request); local_var_req_builder = local_var_req_builder.json(&moderate_user_request);
@ -205,23 +266,36 @@ pub async fn moderate_user(configuration: &configuration::Configuration, moderat
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<ModerateUserError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<ModerateUserError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Removes a player moderation previously added through `moderateUser`. E.g if you previously have shown their avatar, but now want to reset it to default. /// Removes a player moderation previously added through `moderateUser`. E.g if you previously have shown their avatar, but now want to reset it to default.
pub async fn unmoderate_user(configuration: &configuration::Configuration, moderate_user_request: models::ModerateUserRequest) -> Result<models::Success, Error<UnmoderateUserError>> { pub async fn unmoderate_user(
configuration: &configuration::Configuration,
moderate_user_request: models::ModerateUserRequest,
) -> Result<models::Success, Error<UnmoderateUserError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/auth/user/unplayermoderate", local_var_configuration.base_path); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); "{}/auth/user/unplayermoderate",
local_var_configuration.base_path
);
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 { 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());
} }
local_var_req_builder = local_var_req_builder.json(&moderate_user_request); local_var_req_builder = local_var_req_builder.json(&moderate_user_request);
@ -234,9 +308,13 @@ pub async fn unmoderate_user(configuration: &configuration::Configuration, moder
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<UnmoderateUserError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<UnmoderateUserError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }

View File

@ -6,12 +6,10 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
use super::{configuration, Error};
use crate::{apis::ResponseContent, models};
use reqwest; use reqwest;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration};
/// struct for typed errors of method [`get_config`] /// struct for typed errors of method [`get_config`]
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
@ -64,18 +62,21 @@ pub enum GetSystemTimeError {
UnknownValue(serde_json::Value), UnknownValue(serde_json::Value),
} }
/// API config contains configuration that the clients needs to work properly. Currently the most important value here is `clientApiKey` which is used for all other API endpoints. /// API config contains configuration that the clients needs to work properly. Currently the most important value here is `clientApiKey` which is used for all other API endpoints.
pub async fn get_config(configuration: &configuration::Configuration, ) -> Result<models::ApiConfig, Error<GetConfigError>> { pub async fn get_config(
configuration: &configuration::Configuration,
) -> Result<models::ApiConfig, Error<GetConfigError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/config", local_var_configuration.base_path); let local_var_uri_str = format!("{}/config", 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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -87,29 +88,42 @@ pub async fn get_config(configuration: &configuration::Configuration, ) -> Resul
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetConfigError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetConfigError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Fetches the CSS code to the frontend React website. /// Fetches the CSS code to the frontend React website.
pub async fn get_css(configuration: &configuration::Configuration, variant: Option<&str>, branch: Option<&str>) -> Result<String, Error<GetCssError>> { pub async fn get_css(
configuration: &configuration::Configuration,
variant: Option<&str>,
branch: Option<&str>,
) -> Result<String, Error<GetCssError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/css/app.css", local_var_configuration.base_path); let local_var_uri_str = format!("{}/css/app.css", 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_str) = variant { if let Some(ref local_var_str) = variant {
local_var_req_builder = local_var_req_builder.query(&[("variant", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("variant", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = branch { if let Some(ref local_var_str) = branch {
local_var_req_builder = local_var_req_builder.query(&[("branch", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("branch", &local_var_str.to_string())]);
} }
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -122,22 +136,30 @@ pub async fn get_css(configuration: &configuration::Configuration, variant: Opti
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetCssError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetCssError> = 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_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Returns the current number of online users. **NOTE:** The response type is not a JSON object, but a simple JSON integer. /// Returns the current number of online users. **NOTE:** The response type is not a JSON object, but a simple JSON integer.
pub async fn get_current_online_users(configuration: &configuration::Configuration, ) -> Result<i32, Error<GetCurrentOnlineUsersError>> { pub async fn get_current_online_users(
configuration: &configuration::Configuration,
) -> Result<i32, Error<GetCurrentOnlineUsersError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/visits", local_var_configuration.base_path); let local_var_uri_str = format!("{}/visits", 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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -149,23 +171,32 @@ pub async fn get_current_online_users(configuration: &configuration::Configurati
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetCurrentOnlineUsersError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetCurrentOnlineUsersError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// ~~Gets the overall health status, the server name, and the current build version tag of the API.~~ **DEPRECATED:** VRChat has suddenly restricted this endpoint for unknown reasons, and now always return 401 Unauthorized. /// ~~Gets the overall health status, the server name, and the current build version tag of the API.~~ **DEPRECATED:** VRChat has suddenly restricted this endpoint for unknown reasons, and now always return 401 Unauthorized.
pub async fn get_health(configuration: &configuration::Configuration, ) -> Result<models::ApiHealth, Error<GetHealthError>> { pub async fn get_health(
configuration: &configuration::Configuration,
) -> Result<models::ApiHealth, Error<GetHealthError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/health", local_var_configuration.base_path); let local_var_uri_str = format!("{}/health", 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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -177,29 +208,42 @@ pub async fn get_health(configuration: &configuration::Configuration, ) -> Resul
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetHealthError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetHealthError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// IPS (Info Push System) is a system for VRChat to push out dynamic information to the client. This is primarily used by the Quick-Menu info banners, but can also be used to e.g. alert you to update your game to the latest version. `include` is used to query what Information Pushes should be included in the response. If include is missing or empty, then no notices will normally be returned. This is an \"any of\" search. `require` is used to limit what Information Pushes should be included in the response. This is usually used in combination with `include`, and is an \"all of\" search. /// IPS (Info Push System) is a system for VRChat to push out dynamic information to the client. This is primarily used by the Quick-Menu info banners, but can also be used to e.g. alert you to update your game to the latest version. `include` is used to query what Information Pushes should be included in the response. If include is missing or empty, then no notices will normally be returned. This is an \"any of\" search. `require` is used to limit what Information Pushes should be included in the response. This is usually used in combination with `include`, and is an \"all of\" search.
pub async fn get_info_push(configuration: &configuration::Configuration, require: Option<&str>, include: Option<&str>) -> Result<Vec<models::InfoPush>, Error<GetInfoPushError>> { pub async fn get_info_push(
configuration: &configuration::Configuration,
require: Option<&str>,
include: Option<&str>,
) -> Result<Vec<models::InfoPush>, Error<GetInfoPushError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/infoPush", local_var_configuration.base_path); let local_var_uri_str = format!("{}/infoPush", 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_str) = require { if let Some(ref local_var_str) = require {
local_var_req_builder = local_var_req_builder.query(&[("require", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("require", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = include { if let Some(ref local_var_str) = include {
local_var_req_builder = local_var_req_builder.query(&[("include", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("include", &local_var_str.to_string())]);
} }
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -211,29 +255,42 @@ pub async fn get_info_push(configuration: &configuration::Configuration, require
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetInfoPushError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetInfoPushError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Fetches the JavaScript code to the frontend React website. /// Fetches the JavaScript code to the frontend React website.
pub async fn get_java_script(configuration: &configuration::Configuration, variant: Option<&str>, branch: Option<&str>) -> Result<String, Error<GetJavaScriptError>> { pub async fn get_java_script(
configuration: &configuration::Configuration,
variant: Option<&str>,
branch: Option<&str>,
) -> Result<String, Error<GetJavaScriptError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/js/app.js", local_var_configuration.base_path); let local_var_uri_str = format!("{}/js/app.js", 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_str) = variant { if let Some(ref local_var_str) = variant {
local_var_req_builder = local_var_req_builder.query(&[("variant", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("variant", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = branch { if let Some(ref local_var_str) = branch {
local_var_req_builder = local_var_req_builder.query(&[("branch", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("branch", &local_var_str.to_string())]);
} }
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -245,23 +302,32 @@ pub async fn get_java_script(configuration: &configuration::Configuration, varia
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetJavaScriptError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetJavaScriptError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Returns the current time of the API server. **NOTE:** The response type is not a JSON object, but a simple JSON string. /// Returns the current time of the API server. **NOTE:** The response type is not a JSON object, but a simple JSON string.
pub async fn get_system_time(configuration: &configuration::Configuration, ) -> Result<String, Error<GetSystemTimeError>> { pub async fn get_system_time(
configuration: &configuration::Configuration,
) -> Result<String, Error<GetSystemTimeError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/time", local_var_configuration.base_path); let local_var_uri_str = format!("{}/time", 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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -273,9 +339,13 @@ pub async fn get_system_time(configuration: &configuration::Configuration, ) ->
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetSystemTimeError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetSystemTimeError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }

View File

@ -6,12 +6,10 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
use super::{configuration, Error};
use crate::{apis::ResponseContent, models};
use reqwest; use reqwest;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration};
/// struct for typed errors of method [`get_user`] /// struct for typed errors of method [`get_user`]
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
@ -70,18 +68,26 @@ pub enum UpdateUserError {
UnknownValue(serde_json::Value), UnknownValue(serde_json::Value),
} }
/// Get public user information about a specific user using their ID. /// Get public user information about a specific user using their ID.
pub async fn get_user(configuration: &configuration::Configuration, user_id: &str) -> Result<models::User, Error<GetUserError>> { pub async fn get_user(
configuration: &configuration::Configuration,
user_id: &str,
) -> Result<models::User, Error<GetUserError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/users/{userId}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); "{}/users/{userId}",
local_var_configuration.base_path,
userId = crate::apis::urlencode(user_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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -94,22 +100,35 @@ pub async fn get_user(configuration: &configuration::Configuration, user_id: &st
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetUserError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetUserError> = 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_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error)) Err(Error::ResponseError(local_var_error))
} }
} }
/// ~~Get public user information about a specific user using their name.~~ **DEPRECATED:** VRChat API no longer return usernames of other users. [See issue by Tupper for more information](https://github.com/pypy-vrc/VRCX/issues/429). This endpoint now require Admin Credentials. /// ~~Get public user information about a specific user using their name.~~ **DEPRECATED:** VRChat API no longer return usernames of other users. [See issue by Tupper for more information](https://github.com/pypy-vrc/VRCX/issues/429). This endpoint now require Admin Credentials.
pub async fn get_user_by_name(configuration: &configuration::Configuration, username: &str) -> Result<models::User, Error<GetUserByNameError>> { pub async fn get_user_by_name(
configuration: &configuration::Configuration,
username: &str,
) -> Result<models::User, Error<GetUserByNameError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/users/{username}/name", local_var_configuration.base_path, username=crate::apis::urlencode(username)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); "{}/users/{username}/name",
local_var_configuration.base_path,
username = crate::apis::urlencode(username)
);
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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -121,23 +140,37 @@ pub async fn get_user_by_name(configuration: &configuration::Configuration, user
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetUserByNameError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetUserByNameError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Returns a list of Groups the user has requested to be invited into. /// Returns a list of Groups the user has requested to be invited into.
pub async fn get_user_group_requests(configuration: &configuration::Configuration, user_id: &str) -> Result<Vec<models::Group>, Error<GetUserGroupRequestsError>> { pub async fn get_user_group_requests(
configuration: &configuration::Configuration,
user_id: &str,
) -> Result<Vec<models::Group>, Error<GetUserGroupRequestsError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/users/{userId}/groups/requested", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); "{}/users/{userId}/groups/requested",
local_var_configuration.base_path,
userId = crate::apis::urlencode(user_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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -149,23 +182,37 @@ pub async fn get_user_group_requests(configuration: &configuration::Configuratio
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetUserGroupRequestsError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetUserGroupRequestsError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Get user's public groups /// Get user's public groups
pub async fn get_user_groups(configuration: &configuration::Configuration, user_id: &str) -> Result<Vec<models::LimitedUserGroups>, Error<GetUserGroupsError>> { pub async fn get_user_groups(
configuration: &configuration::Configuration,
user_id: &str,
) -> Result<Vec<models::LimitedUserGroups>, Error<GetUserGroupsError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/users/{userId}/groups", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); "{}/users/{userId}/groups",
local_var_configuration.base_path,
userId = crate::apis::urlencode(user_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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -177,23 +224,37 @@ pub async fn get_user_groups(configuration: &configuration::Configuration, user_
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetUserGroupsError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetUserGroupsError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Returns the current group that the user is currently representing /// Returns the current group that the user is currently representing
pub async fn get_user_represented_group(configuration: &configuration::Configuration, user_id: &str) -> Result<models::RepresentedGroup, Error<GetUserRepresentedGroupError>> { pub async fn get_user_represented_group(
configuration: &configuration::Configuration,
user_id: &str,
) -> Result<models::RepresentedGroup, Error<GetUserRepresentedGroupError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/users/{userId}/groups/represented", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); "{}/users/{userId}/groups/represented",
local_var_configuration.base_path,
userId = crate::apis::urlencode(user_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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -205,35 +266,51 @@ pub async fn get_user_represented_group(configuration: &configuration::Configura
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetUserRepresentedGroupError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetUserRepresentedGroupError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Search and list any users by text query /// Search and list any users by text query
pub async fn search_users(configuration: &configuration::Configuration, search: Option<&str>, developer_type: Option<&str>, n: Option<i32>, offset: Option<i32>) -> Result<Vec<models::LimitedUser>, Error<SearchUsersError>> { pub async fn search_users(
configuration: &configuration::Configuration,
search: Option<&str>,
developer_type: Option<&str>,
n: Option<i32>,
offset: Option<i32>,
) -> Result<Vec<models::LimitedUser>, Error<SearchUsersError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/users", local_var_configuration.base_path); let local_var_uri_str = format!("{}/users", 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_str) = search { if let Some(ref local_var_str) = search {
local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = developer_type { if let Some(ref local_var_str) = developer_type {
local_var_req_builder = local_var_req_builder.query(&[("developerType", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("developerType", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = n { if let Some(ref local_var_str) = n {
local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = offset { if let Some(ref local_var_str) = offset {
local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("offset", &local_var_str.to_string())]);
} }
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -245,23 +322,38 @@ pub async fn search_users(configuration: &configuration::Configuration, search:
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<SearchUsersError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<SearchUsersError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Update a users information such as the email and birthday. /// Update a users information such as the email and birthday.
pub async fn update_user(configuration: &configuration::Configuration, user_id: &str, update_user_request: Option<models::UpdateUserRequest>) -> Result<models::CurrentUser, Error<UpdateUserError>> { pub async fn update_user(
configuration: &configuration::Configuration,
user_id: &str,
update_user_request: Option<models::UpdateUserRequest>,
) -> Result<models::CurrentUser, Error<UpdateUserError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/users/{userId}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); "{}/users/{userId}",
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 { 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());
} }
local_var_req_builder = local_var_req_builder.json(&update_user_request); local_var_req_builder = local_var_req_builder.json(&update_user_request);
@ -274,9 +366,13 @@ pub async fn update_user(configuration: &configuration::Configuration, user_id:
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<UpdateUserError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<UpdateUserError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }

View File

@ -6,12 +6,10 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
use super::{configuration, Error};
use crate::{apis::ResponseContent, models};
use reqwest; use reqwest;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration};
/// struct for typed errors of method [`create_world`] /// struct for typed errors of method [`create_world`]
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
@ -125,18 +123,22 @@ pub enum UpdateWorldError {
UnknownValue(serde_json::Value), UnknownValue(serde_json::Value),
} }
/// Create a new world. This endpoint requires `assetUrl` to be a valid File object with `.vrcw` file extension, and `imageUrl` to be a valid File object with an image file extension. /// Create a new world. This endpoint requires `assetUrl` to be a valid File object with `.vrcw` file extension, and `imageUrl` to be a valid File object with an image file extension.
pub async fn create_world(configuration: &configuration::Configuration, create_world_request: Option<models::CreateWorldRequest>) -> Result<models::World, Error<CreateWorldError>> { pub async fn create_world(
configuration: &configuration::Configuration,
create_world_request: Option<models::CreateWorldRequest>,
) -> Result<models::World, Error<CreateWorldError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/worlds", local_var_configuration.base_path); let local_var_uri_str = format!("{}/worlds", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); 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 { 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());
} }
local_var_req_builder = local_var_req_builder.json(&create_world_request); local_var_req_builder = local_var_req_builder.json(&create_world_request);
@ -149,23 +151,37 @@ pub async fn create_world(configuration: &configuration::Configuration, create_w
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<CreateWorldError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<CreateWorldError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Delete a world. Notice a world is never fully \"deleted\", only its ReleaseStatus is set to \"hidden\" and the linked Files are deleted. The WorldID is permanently reserved. /// Delete a world. Notice a world is never fully \"deleted\", only its ReleaseStatus is set to \"hidden\" and the linked Files are deleted. The WorldID is permanently reserved.
pub async fn delete_world(configuration: &configuration::Configuration, world_id: &str) -> Result<(), Error<DeleteWorldError>> { pub async fn delete_world(
configuration: &configuration::Configuration,
world_id: &str,
) -> Result<(), Error<DeleteWorldError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/worlds/{worldId}", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); "{}/worlds/{worldId}",
local_var_configuration.base_path,
worldId = crate::apis::urlencode(world_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) = local_var_configuration.user_agent { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -177,59 +193,90 @@ pub async fn delete_world(configuration: &configuration::Configuration, world_id
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(()) Ok(())
} else { } else {
let local_var_entity: Option<DeleteWorldError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<DeleteWorldError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Search and list currently Active worlds by query filters. /// Search and list currently Active worlds by query filters.
pub async fn get_active_worlds(configuration: &configuration::Configuration, featured: Option<bool>, sort: Option<models::SortOption>, n: Option<i32>, order: Option<models::OrderOption>, offset: Option<i32>, search: Option<&str>, tag: Option<&str>, notag: Option<&str>, release_status: Option<models::ReleaseStatus>, max_unity_version: Option<&str>, min_unity_version: Option<&str>, platform: Option<&str>) -> Result<Vec<models::LimitedWorld>, Error<GetActiveWorldsError>> { pub async fn get_active_worlds(
configuration: &configuration::Configuration,
featured: Option<bool>,
sort: Option<models::SortOption>,
n: Option<i32>,
order: Option<models::OrderOption>,
offset: Option<i32>,
search: Option<&str>,
tag: Option<&str>,
notag: Option<&str>,
release_status: Option<models::ReleaseStatus>,
max_unity_version: Option<&str>,
min_unity_version: Option<&str>,
platform: Option<&str>,
) -> Result<Vec<models::LimitedWorld>, Error<GetActiveWorldsError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/worlds/active", local_var_configuration.base_path); let local_var_uri_str = format!("{}/worlds/active", 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_str) = featured { if let Some(ref local_var_str) = featured {
local_var_req_builder = local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("featured", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = sort { if let Some(ref local_var_str) = sort {
local_var_req_builder = local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("sort", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = n { if let Some(ref local_var_str) = n {
local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = order { if let Some(ref local_var_str) = order {
local_var_req_builder = local_var_req_builder.query(&[("order", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("order", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = offset { if let Some(ref local_var_str) = offset {
local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("offset", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = search { if let Some(ref local_var_str) = search {
local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = tag { if let Some(ref local_var_str) = tag {
local_var_req_builder = local_var_req_builder.query(&[("tag", &local_var_str.to_string())]); local_var_req_builder = local_var_req_builder.query(&[("tag", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = notag { if let Some(ref local_var_str) = notag {
local_var_req_builder = local_var_req_builder.query(&[("notag", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("notag", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = release_status { if let Some(ref local_var_str) = release_status {
local_var_req_builder = local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = max_unity_version { if let Some(ref local_var_str) = max_unity_version {
local_var_req_builder = local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = min_unity_version { if let Some(ref local_var_str) = min_unity_version {
local_var_req_builder = local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = platform { if let Some(ref local_var_str) = platform {
local_var_req_builder = local_var_req_builder.query(&[("platform", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("platform", &local_var_str.to_string())]);
} }
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -241,62 +288,95 @@ pub async fn get_active_worlds(configuration: &configuration::Configuration, fea
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetActiveWorldsError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetActiveWorldsError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Search and list favorited worlds by query filters. /// Search and list favorited worlds by query filters.
pub async fn get_favorited_worlds(configuration: &configuration::Configuration, featured: Option<bool>, sort: Option<models::SortOption>, n: Option<i32>, order: Option<models::OrderOption>, offset: Option<i32>, search: Option<&str>, tag: Option<&str>, notag: Option<&str>, release_status: Option<models::ReleaseStatus>, max_unity_version: Option<&str>, min_unity_version: Option<&str>, platform: Option<&str>, user_id: Option<&str>) -> Result<Vec<models::LimitedWorld>, Error<GetFavoritedWorldsError>> { pub async fn get_favorited_worlds(
configuration: &configuration::Configuration,
featured: Option<bool>,
sort: Option<models::SortOption>,
n: Option<i32>,
order: Option<models::OrderOption>,
offset: Option<i32>,
search: Option<&str>,
tag: Option<&str>,
notag: Option<&str>,
release_status: Option<models::ReleaseStatus>,
max_unity_version: Option<&str>,
min_unity_version: Option<&str>,
platform: Option<&str>,
user_id: Option<&str>,
) -> Result<Vec<models::LimitedWorld>, Error<GetFavoritedWorldsError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/worlds/favorites", local_var_configuration.base_path); let local_var_uri_str = format!("{}/worlds/favorites", 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_str) = featured { if let Some(ref local_var_str) = featured {
local_var_req_builder = local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("featured", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = sort { if let Some(ref local_var_str) = sort {
local_var_req_builder = local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("sort", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = n { if let Some(ref local_var_str) = n {
local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = order { if let Some(ref local_var_str) = order {
local_var_req_builder = local_var_req_builder.query(&[("order", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("order", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = offset { if let Some(ref local_var_str) = offset {
local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("offset", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = search { if let Some(ref local_var_str) = search {
local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = tag { if let Some(ref local_var_str) = tag {
local_var_req_builder = local_var_req_builder.query(&[("tag", &local_var_str.to_string())]); local_var_req_builder = local_var_req_builder.query(&[("tag", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = notag { if let Some(ref local_var_str) = notag {
local_var_req_builder = local_var_req_builder.query(&[("notag", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("notag", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = release_status { if let Some(ref local_var_str) = release_status {
local_var_req_builder = local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = max_unity_version { if let Some(ref local_var_str) = max_unity_version {
local_var_req_builder = local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = min_unity_version { if let Some(ref local_var_str) = min_unity_version {
local_var_req_builder = local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = platform { if let Some(ref local_var_str) = platform {
local_var_req_builder = local_var_req_builder.query(&[("platform", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("platform", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = user_id { if let Some(ref local_var_str) = user_id {
local_var_req_builder = local_var_req_builder.query(&[("userId", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("userId", &local_var_str.to_string())]);
} }
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -308,62 +388,95 @@ pub async fn get_favorited_worlds(configuration: &configuration::Configuration,
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetFavoritedWorldsError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetFavoritedWorldsError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Search and list recently visited worlds by query filters. /// Search and list recently visited worlds by query filters.
pub async fn get_recent_worlds(configuration: &configuration::Configuration, featured: Option<bool>, sort: Option<models::SortOption>, n: Option<i32>, order: Option<models::OrderOption>, offset: Option<i32>, search: Option<&str>, tag: Option<&str>, notag: Option<&str>, release_status: Option<models::ReleaseStatus>, max_unity_version: Option<&str>, min_unity_version: Option<&str>, platform: Option<&str>, user_id: Option<&str>) -> Result<Vec<models::LimitedWorld>, Error<GetRecentWorldsError>> { pub async fn get_recent_worlds(
configuration: &configuration::Configuration,
featured: Option<bool>,
sort: Option<models::SortOption>,
n: Option<i32>,
order: Option<models::OrderOption>,
offset: Option<i32>,
search: Option<&str>,
tag: Option<&str>,
notag: Option<&str>,
release_status: Option<models::ReleaseStatus>,
max_unity_version: Option<&str>,
min_unity_version: Option<&str>,
platform: Option<&str>,
user_id: Option<&str>,
) -> Result<Vec<models::LimitedWorld>, Error<GetRecentWorldsError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/worlds/recent", local_var_configuration.base_path); let local_var_uri_str = format!("{}/worlds/recent", 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_str) = featured { if let Some(ref local_var_str) = featured {
local_var_req_builder = local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("featured", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = sort { if let Some(ref local_var_str) = sort {
local_var_req_builder = local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("sort", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = n { if let Some(ref local_var_str) = n {
local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = order { if let Some(ref local_var_str) = order {
local_var_req_builder = local_var_req_builder.query(&[("order", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("order", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = offset { if let Some(ref local_var_str) = offset {
local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("offset", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = search { if let Some(ref local_var_str) = search {
local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = tag { if let Some(ref local_var_str) = tag {
local_var_req_builder = local_var_req_builder.query(&[("tag", &local_var_str.to_string())]); local_var_req_builder = local_var_req_builder.query(&[("tag", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = notag { if let Some(ref local_var_str) = notag {
local_var_req_builder = local_var_req_builder.query(&[("notag", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("notag", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = release_status { if let Some(ref local_var_str) = release_status {
local_var_req_builder = local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = max_unity_version { if let Some(ref local_var_str) = max_unity_version {
local_var_req_builder = local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = min_unity_version { if let Some(ref local_var_str) = min_unity_version {
local_var_req_builder = local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = platform { if let Some(ref local_var_str) = platform {
local_var_req_builder = local_var_req_builder.query(&[("platform", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("platform", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = user_id { if let Some(ref local_var_str) = user_id {
local_var_req_builder = local_var_req_builder.query(&[("userId", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("userId", &local_var_str.to_string())]);
} }
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -375,23 +488,37 @@ pub async fn get_recent_worlds(configuration: &configuration::Configuration, fea
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetRecentWorldsError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetRecentWorldsError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Get information about a specific World. Works unauthenticated but when so will always return `0` for certain fields. /// Get information about a specific World. Works unauthenticated but when so will always return `0` for certain fields.
pub async fn get_world(configuration: &configuration::Configuration, world_id: &str) -> Result<models::World, Error<GetWorldError>> { pub async fn get_world(
configuration: &configuration::Configuration,
world_id: &str,
) -> Result<models::World, Error<GetWorldError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/worlds/{worldId}", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); "{}/worlds/{worldId}",
local_var_configuration.base_path,
worldId = crate::apis::urlencode(world_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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -404,22 +531,37 @@ pub async fn get_world(configuration: &configuration::Configuration, world_id: &
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetWorldError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetWorldError> = 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_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Returns a worlds instance. /// Returns a worlds instance.
pub async fn get_world_instance(configuration: &configuration::Configuration, world_id: &str, instance_id: &str) -> Result<models::Instance, Error<GetWorldInstanceError>> { pub async fn get_world_instance(
configuration: &configuration::Configuration,
world_id: &str,
instance_id: &str,
) -> Result<models::Instance, Error<GetWorldInstanceError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/worlds/{worldId}/{instanceId}", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id), instanceId=crate::apis::urlencode(instance_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); "{}/worlds/{worldId}/{instanceId}",
local_var_configuration.base_path,
worldId = crate::apis::urlencode(world_id),
instanceId = crate::apis::urlencode(instance_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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -431,23 +573,37 @@ pub async fn get_world_instance(configuration: &configuration::Configuration, wo
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetWorldInstanceError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetWorldInstanceError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Return a worlds custom metadata. This is currently believed to be unused. Metadata can be set with `updateWorld` and can be any arbitrary object. /// Return a worlds custom metadata. This is currently believed to be unused. Metadata can be set with `updateWorld` and can be any arbitrary object.
pub async fn get_world_metadata(configuration: &configuration::Configuration, world_id: &str) -> Result<models::WorldMetadata, Error<GetWorldMetadataError>> { pub async fn get_world_metadata(
configuration: &configuration::Configuration,
world_id: &str,
) -> Result<models::WorldMetadata, Error<GetWorldMetadataError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/worlds/{worldId}/metadata", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); "{}/worlds/{worldId}/metadata",
local_var_configuration.base_path,
worldId = crate::apis::urlencode(world_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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -459,23 +615,37 @@ pub async fn get_world_metadata(configuration: &configuration::Configuration, wo
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetWorldMetadataError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetWorldMetadataError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Returns a worlds publish status. /// Returns a worlds publish status.
pub async fn get_world_publish_status(configuration: &configuration::Configuration, world_id: &str) -> Result<models::WorldPublishStatus, Error<GetWorldPublishStatusError>> { pub async fn get_world_publish_status(
configuration: &configuration::Configuration,
world_id: &str,
) -> Result<models::WorldPublishStatus, Error<GetWorldPublishStatusError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/worlds/{worldId}/publish", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); "{}/worlds/{worldId}/publish",
local_var_configuration.base_path,
worldId = crate::apis::urlencode(world_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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -487,23 +657,37 @@ pub async fn get_world_publish_status(configuration: &configuration::Configurati
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<GetWorldPublishStatusError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<GetWorldPublishStatusError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Publish a world. You can only publish one world per week. /// Publish a world. You can only publish one world per week.
pub async fn publish_world(configuration: &configuration::Configuration, world_id: &str) -> Result<(), Error<PublishWorldError>> { pub async fn publish_world(
configuration: &configuration::Configuration,
world_id: &str,
) -> Result<(), Error<PublishWorldError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/worlds/{worldId}/publish", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); "{}/worlds/{worldId}/publish",
local_var_configuration.base_path,
worldId = crate::apis::urlencode(world_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 { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -515,68 +699,105 @@ pub async fn publish_world(configuration: &configuration::Configuration, world_i
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(()) Ok(())
} else { } else {
let local_var_entity: Option<PublishWorldError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<PublishWorldError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Search and list any worlds by query filters. /// Search and list any worlds by query filters.
pub async fn search_worlds(configuration: &configuration::Configuration, featured: Option<bool>, sort: Option<models::SortOption>, user: Option<&str>, user_id: Option<&str>, n: Option<i32>, order: Option<models::OrderOption>, offset: Option<i32>, search: Option<&str>, tag: Option<&str>, notag: Option<&str>, release_status: Option<models::ReleaseStatus>, max_unity_version: Option<&str>, min_unity_version: Option<&str>, platform: Option<&str>, fuzzy: Option<bool>) -> Result<Vec<models::LimitedWorld>, Error<SearchWorldsError>> { pub async fn search_worlds(
configuration: &configuration::Configuration,
featured: Option<bool>,
sort: Option<models::SortOption>,
user: Option<&str>,
user_id: Option<&str>,
n: Option<i32>,
order: Option<models::OrderOption>,
offset: Option<i32>,
search: Option<&str>,
tag: Option<&str>,
notag: Option<&str>,
release_status: Option<models::ReleaseStatus>,
max_unity_version: Option<&str>,
min_unity_version: Option<&str>,
platform: Option<&str>,
fuzzy: Option<bool>,
) -> Result<Vec<models::LimitedWorld>, Error<SearchWorldsError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/worlds", local_var_configuration.base_path); let local_var_uri_str = format!("{}/worlds", 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_str) = featured { if let Some(ref local_var_str) = featured {
local_var_req_builder = local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("featured", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = sort { if let Some(ref local_var_str) = sort {
local_var_req_builder = local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("sort", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = user { if let Some(ref local_var_str) = user {
local_var_req_builder = local_var_req_builder.query(&[("user", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("user", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = user_id { if let Some(ref local_var_str) = user_id {
local_var_req_builder = local_var_req_builder.query(&[("userId", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("userId", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = n { if let Some(ref local_var_str) = n {
local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = order { if let Some(ref local_var_str) = order {
local_var_req_builder = local_var_req_builder.query(&[("order", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("order", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = offset { if let Some(ref local_var_str) = offset {
local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("offset", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = search { if let Some(ref local_var_str) = search {
local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("search", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = tag { if let Some(ref local_var_str) = tag {
local_var_req_builder = local_var_req_builder.query(&[("tag", &local_var_str.to_string())]); local_var_req_builder = local_var_req_builder.query(&[("tag", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = notag { if let Some(ref local_var_str) = notag {
local_var_req_builder = local_var_req_builder.query(&[("notag", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("notag", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = release_status { if let Some(ref local_var_str) = release_status {
local_var_req_builder = local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = max_unity_version { if let Some(ref local_var_str) = max_unity_version {
local_var_req_builder = local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = min_unity_version { if let Some(ref local_var_str) = min_unity_version {
local_var_req_builder = local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = platform { if let Some(ref local_var_str) = platform {
local_var_req_builder = local_var_req_builder.query(&[("platform", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("platform", &local_var_str.to_string())]);
} }
if let Some(ref local_var_str) = fuzzy { if let Some(ref local_var_str) = fuzzy {
local_var_req_builder = local_var_req_builder.query(&[("fuzzy", &local_var_str.to_string())]); local_var_req_builder =
local_var_req_builder.query(&[("fuzzy", &local_var_str.to_string())]);
} }
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -588,23 +809,37 @@ pub async fn search_worlds(configuration: &configuration::Configuration, feature
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<SearchWorldsError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<SearchWorldsError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Unpublish a world. /// Unpublish a world.
pub async fn unpublish_world(configuration: &configuration::Configuration, world_id: &str) -> Result<(), Error<UnpublishWorldError>> { pub async fn unpublish_world(
configuration: &configuration::Configuration,
world_id: &str,
) -> Result<(), Error<UnpublishWorldError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/worlds/{worldId}/publish", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); "{}/worlds/{worldId}/publish",
local_var_configuration.base_path,
worldId = crate::apis::urlencode(world_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) = local_var_configuration.user_agent { 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()?; let local_var_req = local_var_req_builder.build()?;
@ -616,23 +851,38 @@ pub async fn unpublish_world(configuration: &configuration::Configuration, world
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(()) Ok(())
} else { } else {
let local_var_entity: Option<UnpublishWorldError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<UnpublishWorldError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }
/// Update information about a specific World. /// Update information about a specific World.
pub async fn update_world(configuration: &configuration::Configuration, world_id: &str, update_world_request: Option<models::UpdateWorldRequest>) -> Result<models::World, Error<UpdateWorldError>> { pub async fn update_world(
configuration: &configuration::Configuration,
world_id: &str,
update_world_request: Option<models::UpdateWorldRequest>,
) -> Result<models::World, Error<UpdateWorldError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client; let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/worlds/{worldId}", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id)); let local_var_uri_str = format!(
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); "{}/worlds/{worldId}",
local_var_configuration.base_path,
worldId = crate::apis::urlencode(world_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 { 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());
} }
local_var_req_builder = local_var_req_builder.json(&update_world_request); local_var_req_builder = local_var_req_builder.json(&update_world_request);
@ -645,9 +895,13 @@ pub async fn update_world(configuration: &configuration::Configuration, world_id
if !local_var_status.is_client_error() && !local_var_status.is_server_error() { if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from) serde_json::from_str(&local_var_content).map_err(Error::from)
} else { } else {
let local_var_entity: Option<UpdateWorldError> = serde_json::from_str(&local_var_content).ok(); let local_var_entity: Option<UpdateWorldError> =
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; 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)) Err(Error::ResponseError(local_var_error))
} }
} }

View File

@ -1,10 +1,10 @@
#![allow(unused_imports)] #![allow(unused_imports)]
#![allow(clippy::too_many_arguments)] #![allow(clippy::too_many_arguments)]
extern crate reqwest;
extern crate serde; extern crate serde;
extern crate serde_json; extern crate serde_json;
extern crate url; extern crate url;
extern crate reqwest;
pub mod apis; pub mod apis;
pub mod models; pub mod models;

View File

@ -15,7 +15,12 @@ pub struct AccountDeletionLog {
#[serde(rename = "message", skip_serializing_if = "Option::is_none")] #[serde(rename = "message", skip_serializing_if = "Option::is_none")]
pub message: Option<String>, pub message: Option<String>,
/// When the deletion is scheduled to happen, standard is 14 days after the request. /// When the deletion is scheduled to happen, standard is 14 days after the request.
#[serde(rename = "deletionScheduled", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "deletionScheduled",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub deletion_scheduled: Option<Option<String>>, pub deletion_scheduled: Option<Option<String>>,
/// Date and time of the deletion request. /// Date and time of the deletion request.
#[serde(rename = "dateTime", skip_serializing_if = "Option::is_none")] #[serde(rename = "dateTime", skip_serializing_if = "Option::is_none")]
@ -31,4 +36,3 @@ impl AccountDeletionLog {
} }
} }
} }

View File

@ -22,7 +22,11 @@ pub struct AddFavoriteRequest {
} }
impl AddFavoriteRequest { impl AddFavoriteRequest {
pub fn new(r#type: models::FavoriteType, favorite_id: String, tags: Vec<String>) -> AddFavoriteRequest { pub fn new(
r#type: models::FavoriteType,
favorite_id: String,
tags: Vec<String>,
) -> AddFavoriteRequest {
AddFavoriteRequest { AddFavoriteRequest {
r#type, r#type,
favorite_id, favorite_id,
@ -30,4 +34,3 @@ impl AddFavoriteRequest {
} }
} }
} }

View File

@ -17,9 +17,6 @@ pub struct AddGroupGalleryImageRequest {
impl AddGroupGalleryImageRequest { impl AddGroupGalleryImageRequest {
pub fn new(file_id: String) -> AddGroupGalleryImageRequest { pub fn new(file_id: String) -> AddGroupGalleryImageRequest {
AddGroupGalleryImageRequest { AddGroupGalleryImageRequest { file_id }
file_id,
}
} }
} }

View File

@ -46,7 +46,10 @@ pub struct ApiConfig {
#[serde(rename = "clientDisconnectTimeout")] #[serde(rename = "clientDisconnectTimeout")]
pub client_disconnect_timeout: i32, pub client_disconnect_timeout: i32,
/// Unknown /// Unknown
#[serde(rename = "clientNetDispatchThread", skip_serializing_if = "Option::is_none")] #[serde(
rename = "clientNetDispatchThread",
skip_serializing_if = "Option::is_none"
)]
pub client_net_dispatch_thread: Option<bool>, pub client_net_dispatch_thread: Option<bool>,
/// Unknown /// Unknown
#[serde(rename = "clientNetInThread", skip_serializing_if = "Option::is_none")] #[serde(rename = "clientNetInThread", skip_serializing_if = "Option::is_none")]
@ -55,22 +58,37 @@ pub struct ApiConfig {
#[serde(rename = "clientNetInThread2", skip_serializing_if = "Option::is_none")] #[serde(rename = "clientNetInThread2", skip_serializing_if = "Option::is_none")]
pub client_net_in_thread2: Option<bool>, pub client_net_in_thread2: Option<bool>,
/// Unknown /// Unknown
#[serde(rename = "clientNetInThreadMobile", skip_serializing_if = "Option::is_none")] #[serde(
rename = "clientNetInThreadMobile",
skip_serializing_if = "Option::is_none"
)]
pub client_net_in_thread_mobile: Option<bool>, pub client_net_in_thread_mobile: Option<bool>,
/// Unknown /// Unknown
#[serde(rename = "clientNetInThreadMobile2", skip_serializing_if = "Option::is_none")] #[serde(
rename = "clientNetInThreadMobile2",
skip_serializing_if = "Option::is_none"
)]
pub client_net_in_thread_mobile2: Option<bool>, pub client_net_in_thread_mobile2: Option<bool>,
/// Unknown /// Unknown
#[serde(rename = "clientNetOutThread", skip_serializing_if = "Option::is_none")] #[serde(rename = "clientNetOutThread", skip_serializing_if = "Option::is_none")]
pub client_net_out_thread: Option<bool>, pub client_net_out_thread: Option<bool>,
/// Unknown /// Unknown
#[serde(rename = "clientNetOutThread2", skip_serializing_if = "Option::is_none")] #[serde(
rename = "clientNetOutThread2",
skip_serializing_if = "Option::is_none"
)]
pub client_net_out_thread2: Option<bool>, pub client_net_out_thread2: Option<bool>,
/// Unknown /// Unknown
#[serde(rename = "clientNetOutThreadMobile", skip_serializing_if = "Option::is_none")] #[serde(
rename = "clientNetOutThreadMobile",
skip_serializing_if = "Option::is_none"
)]
pub client_net_out_thread_mobile: Option<bool>, pub client_net_out_thread_mobile: Option<bool>,
/// Unknown /// Unknown
#[serde(rename = "clientNetOutThreadMobile2", skip_serializing_if = "Option::is_none")] #[serde(
rename = "clientNetOutThreadMobile2",
skip_serializing_if = "Option::is_none"
)]
pub client_net_out_thread_mobile2: Option<bool>, pub client_net_out_thread_mobile2: Option<bool>,
/// Unknown /// Unknown
#[serde(rename = "clientQR", skip_serializing_if = "Option::is_none")] #[serde(rename = "clientQR", skip_serializing_if = "Option::is_none")]
@ -88,7 +106,10 @@ pub struct ApiConfig {
#[serde(rename = "copyrightEmail")] #[serde(rename = "copyrightEmail")]
pub copyright_email: String, pub copyright_email: String,
/// Current version number of the Privacy Agreement /// Current version number of the Privacy Agreement
#[serde(rename = "currentPrivacyVersion", skip_serializing_if = "Option::is_none")] #[serde(
rename = "currentPrivacyVersion",
skip_serializing_if = "Option::is_none"
)]
pub current_privacy_version: Option<i32>, pub current_privacy_version: Option<i32>,
/// Current version number of the Terms of Service /// Current version number of the Terms of Service
#[serde(rename = "currentTOSVersion")] #[serde(rename = "currentTOSVersion")]
@ -110,7 +131,10 @@ pub struct ApiConfig {
#[serde(rename = "dis-countdown")] #[serde(rename = "dis-countdown")]
pub dis_countdown: String, pub dis_countdown: String,
/// Unknown /// Unknown
#[serde(rename = "disableAVProInProton", skip_serializing_if = "Option::is_none")] #[serde(
rename = "disableAVProInProton",
skip_serializing_if = "Option::is_none"
)]
pub disable_av_pro_in_proton: Option<bool>, pub disable_av_pro_in_proton: Option<bool>,
/// Toggles if copying avatars should be disabled /// Toggles if copying avatars should be disabled
#[serde(rename = "disableAvatarCopying")] #[serde(rename = "disableAvatarCopying")]
@ -263,7 +287,75 @@ pub struct ApiConfig {
} }
impl ApiConfig { impl ApiConfig {
pub fn new(voice_enable_degradation: bool, voice_enable_receiver_limiting: bool, address: String, announcements: Vec<models::ApiConfigAnnouncement>, app_name: String, available_language_codes: Vec<String>, available_languages: Vec<String>, build_version_tag: String, client_api_key: String, client_bps_ceiling: i32, client_disconnect_timeout: i32, client_reserved_player_bps: i32, client_sent_count_allowance: i32, contact_email: String, copyright_email: String, current_tos_version: i32, default_avatar: String, deployment_group: models::DeploymentGroup, dev_sdk_url: String, dev_sdk_version: String, dis_countdown: String, disable_avatar_copying: bool, disable_avatar_gating: bool, disable_community_labs: bool, disable_community_labs_promotion: bool, disable_email: bool, disable_event_stream: bool, disable_feedback_gating: bool, disable_frontend_builds: bool, disable_hello: bool, disable_oculus_subs: bool, disable_registration: bool, disable_steam_networking: bool, disable_two_factor_auth: bool, disable_udon: bool, disable_upgrade_account: bool, download_link_windows: String, download_urls: models::ApiConfigDownloadUrlList, dynamic_world_rows: Vec<models::DynamicContentRow>, events: models::ApiConfigEvents, home_world_id: String, homepage_redirect_target: String, hub_world_id: String, image_host_url_list: Vec<String>, jobs_email: String, moderation_email: String, not_allowed_to_select_avatar_in_private_world_message: String, sdk_developer_faq_url: String, sdk_discord_url: String, sdk_not_allowed_to_publish_message: String, sdk_unity_version: String, server_name: String, string_host_url_list: Vec<String>, support_email: String, time_out_world_id: String, tutorial_world_id: String, update_rate_ms_maximum: i32, update_rate_ms_minimum: i32, update_rate_ms_normal: i32, update_rate_ms_udon_manual: i32, upload_analysis_percent: i32, url_list: Vec<String>, use_reliable_udp_for_voice: bool, vive_windows_url: String, white_listed_asset_urls: Vec<String>, player_url_resolver_version: String, player_url_resolver_sha1: String) -> ApiConfig { pub fn new(
voice_enable_degradation: bool,
voice_enable_receiver_limiting: bool,
address: String,
announcements: Vec<models::ApiConfigAnnouncement>,
app_name: String,
available_language_codes: Vec<String>,
available_languages: Vec<String>,
build_version_tag: String,
client_api_key: String,
client_bps_ceiling: i32,
client_disconnect_timeout: i32,
client_reserved_player_bps: i32,
client_sent_count_allowance: i32,
contact_email: String,
copyright_email: String,
current_tos_version: i32,
default_avatar: String,
deployment_group: models::DeploymentGroup,
dev_sdk_url: String,
dev_sdk_version: String,
dis_countdown: String,
disable_avatar_copying: bool,
disable_avatar_gating: bool,
disable_community_labs: bool,
disable_community_labs_promotion: bool,
disable_email: bool,
disable_event_stream: bool,
disable_feedback_gating: bool,
disable_frontend_builds: bool,
disable_hello: bool,
disable_oculus_subs: bool,
disable_registration: bool,
disable_steam_networking: bool,
disable_two_factor_auth: bool,
disable_udon: bool,
disable_upgrade_account: bool,
download_link_windows: String,
download_urls: models::ApiConfigDownloadUrlList,
dynamic_world_rows: Vec<models::DynamicContentRow>,
events: models::ApiConfigEvents,
home_world_id: String,
homepage_redirect_target: String,
hub_world_id: String,
image_host_url_list: Vec<String>,
jobs_email: String,
moderation_email: String,
not_allowed_to_select_avatar_in_private_world_message: String,
sdk_developer_faq_url: String,
sdk_discord_url: String,
sdk_not_allowed_to_publish_message: String,
sdk_unity_version: String,
server_name: String,
string_host_url_list: Vec<String>,
support_email: String,
time_out_world_id: String,
tutorial_world_id: String,
update_rate_ms_maximum: i32,
update_rate_ms_minimum: i32,
update_rate_ms_normal: i32,
update_rate_ms_udon_manual: i32,
upload_analysis_percent: i32,
url_list: Vec<String>,
use_reliable_udp_for_voice: bool,
vive_windows_url: String,
white_listed_asset_urls: Vec<String>,
player_url_resolver_version: String,
player_url_resolver_sha1: String,
) -> ApiConfig {
ApiConfig { ApiConfig {
voice_enable_degradation, voice_enable_degradation,
voice_enable_receiver_limiting, voice_enable_receiver_limiting,
@ -352,4 +444,3 @@ impl ApiConfig {
} }
} }
} }

View File

@ -23,10 +23,6 @@ pub struct ApiConfigAnnouncement {
impl ApiConfigAnnouncement { impl ApiConfigAnnouncement {
/// Public Announcement /// Public Announcement
pub fn new(name: String, text: String) -> ApiConfigAnnouncement { pub fn new(name: String, text: String) -> ApiConfigAnnouncement {
ApiConfigAnnouncement { ApiConfigAnnouncement { name, text }
name,
text,
}
} }
} }

View File

@ -31,7 +31,13 @@ pub struct ApiConfigDownloadUrlList {
impl ApiConfigDownloadUrlList { impl ApiConfigDownloadUrlList {
/// Download links for various development assets. /// Download links for various development assets.
pub fn new(sdk2: String, sdk3_avatars: String, sdk3_worlds: String, vcc: String, bootstrap: String) -> ApiConfigDownloadUrlList { pub fn new(
sdk2: String,
sdk3_avatars: String,
sdk3_worlds: String,
vcc: String,
bootstrap: String,
) -> ApiConfigDownloadUrlList {
ApiConfigDownloadUrlList { ApiConfigDownloadUrlList {
sdk2, sdk2,
sdk3_avatars, sdk3_avatars,
@ -41,4 +47,3 @@ impl ApiConfigDownloadUrlList {
} }
} }
} }

View File

@ -44,7 +44,18 @@ pub struct ApiConfigEvents {
} }
impl ApiConfigEvents { impl ApiConfigEvents {
pub fn new(distance_close: i32, distance_factor: i32, distance_far: i32, group_distance: i32, maximum_bunch_size: i32, not_visible_factor: i32, player_order_bucket_size: i32, player_order_factor: i32, slow_update_factor_threshold: i32, view_segment_length: i32) -> ApiConfigEvents { pub fn new(
distance_close: i32,
distance_factor: i32,
distance_far: i32,
group_distance: i32,
maximum_bunch_size: i32,
not_visible_factor: i32,
player_order_bucket_size: i32,
player_order_factor: i32,
slow_update_factor_threshold: i32,
view_segment_length: i32,
) -> ApiConfigEvents {
ApiConfigEvents { ApiConfigEvents {
distance_close, distance_close,
distance_factor, distance_factor,
@ -59,4 +70,3 @@ impl ApiConfigEvents {
} }
} }
} }

View File

@ -28,4 +28,3 @@ impl ApiHealth {
} }
} }
} }

View File

@ -54,7 +54,24 @@ pub struct Avatar {
} }
impl Avatar { impl Avatar {
pub fn new(author_id: String, author_name: String, created_at: String, description: String, featured: bool, id: String, image_url: String, name: String, release_status: models::ReleaseStatus, tags: Vec<String>, thumbnail_image_url: String, unity_package_url: String, unity_package_url_object: models::AvatarUnityPackageUrlObject, unity_packages: Vec<models::UnityPackage>, updated_at: String, version: i32) -> Avatar { pub fn new(
author_id: String,
author_name: String,
created_at: String,
description: String,
featured: bool,
id: String,
image_url: String,
name: String,
release_status: models::ReleaseStatus,
tags: Vec<String>,
thumbnail_image_url: String,
unity_package_url: String,
unity_package_url_object: models::AvatarUnityPackageUrlObject,
unity_packages: Vec<models::UnityPackage>,
updated_at: String,
version: i32,
) -> Avatar {
Avatar { Avatar {
asset_url: None, asset_url: None,
asset_url_object: None, asset_url_object: None,
@ -77,4 +94,3 @@ impl Avatar {
} }
} }
} }

View File

@ -24,4 +24,3 @@ impl AvatarUnityPackageUrlObject {
} }
} }
} }

View File

@ -12,7 +12,12 @@ use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Badge { pub struct Badge {
/// only present in CurrentUser badges /// only present in CurrentUser badges
#[serde(rename = "assignedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "assignedAt",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub assigned_at: Option<Option<String>>, pub assigned_at: Option<Option<String>>,
#[serde(rename = "badgeDescription")] #[serde(rename = "badgeDescription")]
pub badge_description: String, pub badge_description: String,
@ -24,17 +29,33 @@ pub struct Badge {
#[serde(rename = "badgeName")] #[serde(rename = "badgeName")]
pub badge_name: String, pub badge_name: String,
/// only present in CurrentUser badges /// only present in CurrentUser badges
#[serde(rename = "hidden", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "hidden",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub hidden: Option<Option<bool>>, pub hidden: Option<Option<bool>>,
#[serde(rename = "showcased")] #[serde(rename = "showcased")]
pub showcased: bool, pub showcased: bool,
/// only present in CurrentUser badges /// only present in CurrentUser badges
#[serde(rename = "updatedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "updatedAt",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub updated_at: Option<Option<String>>, pub updated_at: Option<Option<String>>,
} }
impl Badge { impl Badge {
pub fn new(badge_description: String, badge_id: String, badge_image_url: String, badge_name: String, showcased: bool) -> Badge { pub fn new(
badge_description: String,
badge_id: String,
badge_image_url: String,
badge_name: String,
showcased: bool,
) -> Badge {
Badge { Badge {
assigned_at: None, assigned_at: None,
badge_description, badge_description,
@ -47,4 +68,3 @@ impl Badge {
} }
} }
} }

View File

@ -18,9 +18,6 @@ pub struct BanGroupMemberRequest {
impl BanGroupMemberRequest { impl BanGroupMemberRequest {
pub fn new(user_id: String) -> BanGroupMemberRequest { pub fn new(user_id: String) -> BanGroupMemberRequest {
BanGroupMemberRequest { BanGroupMemberRequest { user_id }
user_id,
}
} }
} }

View File

@ -49,4 +49,3 @@ impl CreateAvatarRequest {
} }
} }
} }

View File

@ -31,4 +31,3 @@ impl CreateFileRequest {
} }
} }
} }

View File

@ -31,4 +31,3 @@ impl CreateFileVersionRequest {
} }
} }
} }

View File

@ -34,4 +34,3 @@ impl CreateGroupAnnouncementRequest {
} }
} }
} }

View File

@ -20,13 +20,33 @@ pub struct CreateGroupGalleryRequest {
/// Whether the gallery is members only. /// Whether the gallery is members only.
#[serde(rename = "membersOnly", skip_serializing_if = "Option::is_none")] #[serde(rename = "membersOnly", skip_serializing_if = "Option::is_none")]
pub members_only: Option<bool>, pub members_only: Option<bool>,
#[serde(rename = "roleIdsToView", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "roleIdsToView",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub role_ids_to_view: Option<Option<Vec<String>>>, pub role_ids_to_view: Option<Option<Vec<String>>>,
#[serde(rename = "roleIdsToSubmit", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "roleIdsToSubmit",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub role_ids_to_submit: Option<Option<Vec<String>>>, pub role_ids_to_submit: Option<Option<Vec<String>>>,
#[serde(rename = "roleIdsToAutoApprove", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "roleIdsToAutoApprove",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub role_ids_to_auto_approve: Option<Option<Vec<String>>>, pub role_ids_to_auto_approve: Option<Option<Vec<String>>>,
#[serde(rename = "roleIdsToManage", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "roleIdsToManage",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub role_ids_to_manage: Option<Option<Vec<String>>>, pub role_ids_to_manage: Option<Option<Vec<String>>>,
} }
@ -43,4 +63,3 @@ impl CreateGroupGalleryRequest {
} }
} }
} }

View File

@ -14,7 +14,10 @@ pub struct CreateGroupInviteRequest {
/// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed.
#[serde(rename = "userId")] #[serde(rename = "userId")]
pub user_id: String, pub user_id: String,
#[serde(rename = "confirmOverrideBlock", skip_serializing_if = "Option::is_none")] #[serde(
rename = "confirmOverrideBlock",
skip_serializing_if = "Option::is_none"
)]
pub confirm_override_block: Option<bool>, pub confirm_override_block: Option<bool>,
} }
@ -26,4 +29,3 @@ impl CreateGroupInviteRequest {
} }
} }
} }

View File

@ -29,7 +29,12 @@ pub struct CreateGroupPostRequest {
} }
impl CreateGroupPostRequest { impl CreateGroupPostRequest {
pub fn new(title: String, text: String, send_notification: bool, visibility: models::GroupPostVisibility) -> CreateGroupPostRequest { pub fn new(
title: String,
text: String,
send_notification: bool,
visibility: models::GroupPostVisibility,
) -> CreateGroupPostRequest {
CreateGroupPostRequest { CreateGroupPostRequest {
title, title,
text, text,
@ -40,4 +45,3 @@ impl CreateGroupPostRequest {
} }
} }
} }

View File

@ -19,9 +19,19 @@ pub struct CreateGroupRequest {
pub description: Option<String>, pub description: Option<String>,
#[serde(rename = "joinState", skip_serializing_if = "Option::is_none")] #[serde(rename = "joinState", skip_serializing_if = "Option::is_none")]
pub join_state: Option<models::GroupJoinState>, pub join_state: Option<models::GroupJoinState>,
#[serde(rename = "iconId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "iconId",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub icon_id: Option<Option<String>>, pub icon_id: Option<Option<String>>,
#[serde(rename = "bannerId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "bannerId",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub banner_id: Option<Option<String>>, pub banner_id: Option<Option<String>>,
#[serde(rename = "privacy", skip_serializing_if = "Option::is_none")] #[serde(rename = "privacy", skip_serializing_if = "Option::is_none")]
pub privacy: Option<models::GroupPrivacy>, pub privacy: Option<models::GroupPrivacy>,
@ -30,7 +40,11 @@ pub struct CreateGroupRequest {
} }
impl CreateGroupRequest { impl CreateGroupRequest {
pub fn new(name: String, short_code: String, role_template: models::GroupRoleTemplate) -> CreateGroupRequest { pub fn new(
name: String,
short_code: String,
role_template: models::GroupRoleTemplate,
) -> CreateGroupRequest {
CreateGroupRequest { CreateGroupRequest {
name, name,
short_code, short_code,
@ -43,4 +57,3 @@ impl CreateGroupRequest {
} }
} }
} }

View File

@ -34,4 +34,3 @@ impl CreateGroupRoleRequest {
} }
} }
} }

View File

@ -19,7 +19,12 @@ pub struct CreateInstanceRequest {
#[serde(rename = "region")] #[serde(rename = "region")]
pub region: models::InstanceRegion, pub region: models::InstanceRegion,
/// A groupId if the instance type is \"group\", null if instance type is public, or a userId otherwise /// A groupId if the instance type is \"group\", null if instance type is public, or a userId otherwise
#[serde(rename = "ownerId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "ownerId",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub owner_id: Option<Option<String>>, pub owner_id: Option<Option<String>>,
/// Group roleIds that are allowed to join if the type is \"group\" and groupAccessType is \"member\" /// Group roleIds that are allowed to join if the type is \"group\" and groupAccessType is \"member\"
#[serde(rename = "roleIds", skip_serializing_if = "Option::is_none")] #[serde(rename = "roleIds", skip_serializing_if = "Option::is_none")]
@ -42,7 +47,11 @@ pub struct CreateInstanceRequest {
} }
impl CreateInstanceRequest { impl CreateInstanceRequest {
pub fn new(world_id: String, r#type: models::InstanceType, region: models::InstanceRegion) -> CreateInstanceRequest { pub fn new(
world_id: String,
r#type: models::InstanceType,
region: models::InstanceRegion,
) -> CreateInstanceRequest {
CreateInstanceRequest { CreateInstanceRequest {
world_id, world_id,
r#type, r#type,
@ -58,4 +67,3 @@ impl CreateInstanceRequest {
} }
} }
} }

View File

@ -64,4 +64,3 @@ impl CreateWorldRequest {
} }
} }
} }

View File

@ -13,11 +13,24 @@ use serde::{Deserialize, Serialize};
pub struct CurrentUser { pub struct CurrentUser {
#[serde(rename = "acceptedTOSVersion")] #[serde(rename = "acceptedTOSVersion")]
pub accepted_tos_version: i32, pub accepted_tos_version: i32,
#[serde(rename = "acceptedPrivacyVersion", skip_serializing_if = "Option::is_none")] #[serde(
rename = "acceptedPrivacyVersion",
skip_serializing_if = "Option::is_none"
)]
pub accepted_privacy_version: Option<i32>, pub accepted_privacy_version: Option<i32>,
#[serde(rename = "accountDeletionDate", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "accountDeletionDate",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub account_deletion_date: Option<Option<String>>, pub account_deletion_date: Option<Option<String>>,
#[serde(rename = "accountDeletionLog", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "accountDeletionLog",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub account_deletion_log: Option<Option<Vec<models::AccountDeletionLog>>>, pub account_deletion_log: Option<Option<Vec<models::AccountDeletionLog>>>,
#[serde(rename = "activeFriends", skip_serializing_if = "Option::is_none")] #[serde(rename = "activeFriends", skip_serializing_if = "Option::is_none")]
pub active_friends: Option<Vec<String>>, pub active_friends: Option<Vec<String>>,
@ -60,11 +73,24 @@ pub struct CurrentUser {
pub friends: Vec<String>, pub friends: Vec<String>,
#[serde(rename = "hasBirthday")] #[serde(rename = "hasBirthday")]
pub has_birthday: bool, pub has_birthday: bool,
#[serde(rename = "hideContentFilterSettings", skip_serializing_if = "Option::is_none")] #[serde(
rename = "hideContentFilterSettings",
skip_serializing_if = "Option::is_none"
)]
pub hide_content_filter_settings: Option<bool>, pub hide_content_filter_settings: Option<bool>,
#[serde(rename = "userLanguage", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "userLanguage",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub user_language: Option<Option<String>>, pub user_language: Option<Option<String>>,
#[serde(rename = "userLanguageCode", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "userLanguageCode",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub user_language_code: Option<Option<String>>, pub user_language_code: Option<Option<String>>,
#[serde(rename = "hasEmail")] #[serde(rename = "hasEmail")]
pub has_email: bool, pub has_email: bool,
@ -119,9 +145,17 @@ pub struct CurrentUser {
pub profile_pic_override_thumbnail: String, pub profile_pic_override_thumbnail: String,
#[serde(rename = "pronouns")] #[serde(rename = "pronouns")]
pub pronouns: String, pub pronouns: String,
#[serde(rename = "queuedInstance", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "queuedInstance",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub queued_instance: Option<Option<String>>, pub queued_instance: Option<Option<String>>,
#[serde(rename = "receiveMobileInvitations", skip_serializing_if = "Option::is_none")] #[serde(
rename = "receiveMobileInvitations",
skip_serializing_if = "Option::is_none"
)]
pub receive_mobile_invitations: Option<bool>, pub receive_mobile_invitations: Option<bool>,
#[serde(rename = "state")] #[serde(rename = "state")]
pub state: models::UserState, pub state: models::UserState,
@ -141,7 +175,12 @@ pub struct CurrentUser {
pub tags: Vec<String>, pub tags: Vec<String>,
#[serde(rename = "twoFactorAuthEnabled")] #[serde(rename = "twoFactorAuthEnabled")]
pub two_factor_auth_enabled: bool, pub two_factor_auth_enabled: bool,
#[serde(rename = "twoFactorAuthEnabledDate", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "twoFactorAuthEnabledDate",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub two_factor_auth_enabled_date: Option<Option<String>>, pub two_factor_auth_enabled_date: Option<Option<String>>,
#[serde(rename = "unsubscribe")] #[serde(rename = "unsubscribe")]
pub unsubscribe: bool, pub unsubscribe: bool,
@ -155,7 +194,52 @@ pub struct CurrentUser {
} }
impl CurrentUser { impl CurrentUser {
pub fn new(accepted_tos_version: i32, allow_avatar_copying: bool, bio: String, bio_links: Vec<String>, current_avatar: String, current_avatar_asset_url: String, current_avatar_image_url: String, current_avatar_thumbnail_image_url: String, current_avatar_tags: Vec<String>, date_joined: String, developer_type: models::DeveloperType, display_name: String, email_verified: bool, friend_group_names: Vec<String>, friend_key: String, friends: Vec<String>, has_birthday: bool, has_email: bool, has_logged_in_from_client: bool, has_pending_email: bool, home_location: String, id: String, is_friend: bool, last_login: String, last_mobile: Option<String>, last_platform: String, obfuscated_email: String, obfuscated_pending_email: String, oculus_id: String, past_display_names: Vec<models::PastDisplayName>, profile_pic_override: String, profile_pic_override_thumbnail: String, pronouns: String, state: models::UserState, status: models::UserStatus, status_description: String, status_first_time: bool, status_history: Vec<String>, steam_details: serde_json::Value, steam_id: String, tags: Vec<String>, two_factor_auth_enabled: bool, unsubscribe: bool, user_icon: String) -> CurrentUser { pub fn new(
accepted_tos_version: i32,
allow_avatar_copying: bool,
bio: String,
bio_links: Vec<String>,
current_avatar: String,
current_avatar_asset_url: String,
current_avatar_image_url: String,
current_avatar_thumbnail_image_url: String,
current_avatar_tags: Vec<String>,
date_joined: String,
developer_type: models::DeveloperType,
display_name: String,
email_verified: bool,
friend_group_names: Vec<String>,
friend_key: String,
friends: Vec<String>,
has_birthday: bool,
has_email: bool,
has_logged_in_from_client: bool,
has_pending_email: bool,
home_location: String,
id: String,
is_friend: bool,
last_login: String,
last_mobile: Option<String>,
last_platform: String,
obfuscated_email: String,
obfuscated_pending_email: String,
oculus_id: String,
past_display_names: Vec<models::PastDisplayName>,
profile_pic_override: String,
profile_pic_override_thumbnail: String,
pronouns: String,
state: models::UserState,
status: models::UserStatus,
status_description: String,
status_first_time: bool,
status_history: Vec<String>,
steam_details: serde_json::Value,
steam_id: String,
tags: Vec<String>,
two_factor_auth_enabled: bool,
unsubscribe: bool,
user_icon: String,
) -> CurrentUser {
CurrentUser { CurrentUser {
accepted_tos_version, accepted_tos_version,
accepted_privacy_version: None, accepted_privacy_version: None,
@ -230,13 +314,13 @@ impl CurrentUser {
#[derive(Serialize, Deserialize)] #[derive(Serialize, Deserialize)]
#[serde(untagged)] #[serde(untagged)]
pub enum EitherUserOrTwoFactor{ pub enum EitherUserOrTwoFactor {
CurrentUser(CurrentUser), CurrentUser(CurrentUser),
RequiresTwoFactorAuth(RequiresTwoFactorAuth), RequiresTwoFactorAuth(RequiresTwoFactorAuth),
} }
#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize, Deserialize)] #[derive(Clone, Debug, PartialEq, Eq, Default, Serialize, Deserialize)]
pub struct RequiresTwoFactorAuth{ pub struct RequiresTwoFactorAuth {
#[serde(rename = "requiresTwoFactorAuth")] #[serde(rename = "requiresTwoFactorAuth")]
pub requires_two_factor_auth: Vec<String> pub requires_two_factor_auth: Vec<String>,
} }

View File

@ -11,38 +11,88 @@ use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CurrentUserPresence { pub struct CurrentUserPresence {
#[serde(rename = "avatarThumbnail", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "avatarThumbnail",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub avatar_thumbnail: Option<Option<String>>, pub avatar_thumbnail: Option<Option<String>>,
#[serde(rename = "currentAvatarTags", skip_serializing_if = "Option::is_none")] #[serde(rename = "currentAvatarTags", skip_serializing_if = "Option::is_none")]
pub current_avatar_tags: Option<String>, pub current_avatar_tags: Option<String>,
#[serde(rename = "displayName", skip_serializing_if = "Option::is_none")] #[serde(rename = "displayName", skip_serializing_if = "Option::is_none")]
pub display_name: Option<String>, pub display_name: Option<String>,
#[serde(rename = "groups", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "groups",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub groups: Option<Option<Vec<String>>>, pub groups: Option<Option<Vec<String>>>,
/// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed.
#[serde(rename = "id", skip_serializing_if = "Option::is_none")] #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
pub id: Option<String>, pub id: Option<String>,
#[serde(rename = "instance", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "instance",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub instance: Option<Option<String>>, pub instance: Option<Option<String>>,
/// either an InstanceType or an empty string /// either an InstanceType or an empty string
#[serde(rename = "instanceType", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "instanceType",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub instance_type: Option<Option<String>>, pub instance_type: Option<Option<String>>,
#[serde(rename = "isRejoining", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "isRejoining",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub is_rejoining: Option<Option<String>>, pub is_rejoining: Option<Option<String>>,
/// either a Platform or an empty string /// either a Platform or an empty string
#[serde(rename = "platform", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "platform",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub platform: Option<Option<String>>, pub platform: Option<Option<String>>,
#[serde(rename = "profilePicOverride", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "profilePicOverride",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub profile_pic_override: Option<Option<String>>, pub profile_pic_override: Option<Option<String>>,
/// either a UserStatus or empty string /// either a UserStatus or empty string
#[serde(rename = "status", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "status",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub status: Option<Option<String>>, pub status: Option<Option<String>>,
#[serde(rename = "travelingToInstance", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "travelingToInstance",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub traveling_to_instance: Option<Option<String>>, pub traveling_to_instance: Option<Option<String>>,
/// WorldID be \"offline\" on User profiles if you are not friends with that user. /// WorldID be \"offline\" on User profiles if you are not friends with that user.
#[serde(rename = "travelingToWorld", skip_serializing_if = "Option::is_none")] #[serde(rename = "travelingToWorld", skip_serializing_if = "Option::is_none")]
pub traveling_to_world: Option<String>, pub traveling_to_world: Option<String>,
#[serde(rename = "userIcon", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "userIcon",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub user_icon: Option<Option<String>>, pub user_icon: Option<Option<String>>,
/// WorldID be \"offline\" on User profiles if you are not friends with that user. /// WorldID be \"offline\" on User profiles if you are not friends with that user.
#[serde(rename = "world", skip_serializing_if = "Option::is_none")] #[serde(rename = "world", skip_serializing_if = "Option::is_none")]
@ -70,4 +120,3 @@ impl CurrentUserPresence {
} }
} }
} }

View File

@ -21,7 +21,6 @@ pub enum DeploymentGroup {
Grape, Grape,
#[serde(rename = "cherry")] #[serde(rename = "cherry")]
Cherry, Cherry,
} }
impl std::fmt::Display for DeploymentGroup { impl std::fmt::Display for DeploymentGroup {
@ -40,4 +39,3 @@ impl Default for DeploymentGroup {
Self::Blue Self::Blue
} }
} }

View File

@ -21,7 +21,6 @@ pub enum DeveloperType {
Internal, Internal,
#[serde(rename = "moderator")] #[serde(rename = "moderator")]
Moderator, Moderator,
} }
impl std::fmt::Display for DeveloperType { impl std::fmt::Display for DeveloperType {
@ -40,4 +39,3 @@ impl Default for DeveloperType {
Self::None Self::None
} }
} }

View File

@ -33,7 +33,13 @@ pub struct DynamicContentRow {
} }
impl DynamicContentRow { impl DynamicContentRow {
pub fn new(name: String, platform: String, sort_heading: String, sort_order: String, sort_ownership: String) -> DynamicContentRow { pub fn new(
name: String,
platform: String,
sort_heading: String,
sort_order: String,
sort_ownership: String,
) -> DynamicContentRow {
DynamicContentRow { DynamicContentRow {
index: None, index: None,
name, name,
@ -46,4 +52,3 @@ impl DynamicContentRow {
} }
} }
} }

View File

@ -17,9 +17,6 @@ pub struct Error {
impl Error { impl Error {
pub fn new() -> Error { pub fn new() -> Error {
Error { Error { error: None }
error: None,
}
} }
} }

View File

@ -24,7 +24,12 @@ pub struct Favorite {
} }
impl Favorite { impl Favorite {
pub fn new(favorite_id: String, id: String, tags: Vec<String>, r#type: models::FavoriteType) -> Favorite { pub fn new(
favorite_id: String,
id: String,
tags: Vec<String>,
r#type: models::FavoriteType,
) -> Favorite {
Favorite { Favorite {
favorite_id, favorite_id,
id, id,
@ -33,4 +38,3 @@ impl Favorite {
} }
} }
} }

View File

@ -32,7 +32,16 @@ pub struct FavoriteGroup {
} }
impl FavoriteGroup { impl FavoriteGroup {
pub fn new(display_name: String, id: String, name: String, owner_display_name: String, owner_id: String, tags: Vec<String>, r#type: models::FavoriteType, visibility: models::FavoriteGroupVisibility) -> FavoriteGroup { pub fn new(
display_name: String,
id: String,
name: String,
owner_display_name: String,
owner_id: String,
tags: Vec<String>,
r#type: models::FavoriteType,
visibility: models::FavoriteGroupVisibility,
) -> FavoriteGroup {
FavoriteGroup { FavoriteGroup {
display_name, display_name,
id, id,
@ -45,4 +54,3 @@ impl FavoriteGroup {
} }
} }
} }

View File

@ -17,7 +17,6 @@ pub enum FavoriteGroupVisibility {
Friends, Friends,
#[serde(rename = "public")] #[serde(rename = "public")]
Public, Public,
} }
impl std::fmt::Display for FavoriteGroupVisibility { impl std::fmt::Display for FavoriteGroupVisibility {
@ -35,4 +34,3 @@ impl Default for FavoriteGroupVisibility {
Self::Private Self::Private
} }
} }

View File

@ -17,7 +17,6 @@ pub enum FavoriteType {
Friend, Friend,
#[serde(rename = "avatar")] #[serde(rename = "avatar")]
Avatar, Avatar,
} }
impl std::fmt::Display for FavoriteType { impl std::fmt::Display for FavoriteType {
@ -35,4 +34,3 @@ impl Default for FavoriteType {
Self::World Self::World
} }
} }

View File

@ -30,7 +30,15 @@ pub struct File {
} }
impl File { impl File {
pub fn new(extension: String, id: String, mime_type: models::MimeType, name: String, owner_id: String, tags: Vec<String>, versions: Vec<models::FileVersion>) -> File { pub fn new(
extension: String,
id: String,
mime_type: models::MimeType,
name: String,
owner_id: String,
tags: Vec<String>,
versions: Vec<models::FileVersion>,
) -> File {
File { File {
extension, extension,
id, id,
@ -42,4 +50,3 @@ impl File {
} }
} }
} }

View File

@ -29,7 +29,14 @@ pub struct FileData {
} }
impl FileData { impl FileData {
pub fn new(category: Category, file_name: String, size_in_bytes: i32, status: models::FileStatus, upload_id: String, url: String) -> FileData { pub fn new(
category: Category,
file_name: String,
size_in_bytes: i32,
status: models::FileStatus,
upload_id: String,
url: String,
) -> FileData {
FileData { FileData {
category, category,
file_name, file_name,
@ -56,4 +63,3 @@ impl Default for Category {
Self::Multipart Self::Multipart
} }
} }

View File

@ -19,7 +19,6 @@ pub enum FileStatus {
None, None,
#[serde(rename = "queued")] #[serde(rename = "queued")]
Queued, Queued,
} }
impl std::fmt::Display for FileStatus { impl std::fmt::Display for FileStatus {
@ -38,4 +37,3 @@ impl Default for FileStatus {
Self::Waiting Self::Waiting
} }
} }

View File

@ -18,9 +18,6 @@ pub struct FileUploadUrl {
impl FileUploadUrl { impl FileUploadUrl {
pub fn new(url: String) -> FileUploadUrl { pub fn new(url: String) -> FileUploadUrl {
FileUploadUrl { FileUploadUrl { url }
url,
}
} }
} }

View File

@ -43,4 +43,3 @@ impl FileVersion {
} }
} }
} }

View File

@ -28,7 +28,14 @@ pub struct FileVersionUploadStatus {
} }
impl FileVersionUploadStatus { impl FileVersionUploadStatus {
pub fn new(upload_id: String, file_name: String, next_part_number: i32, max_parts: i32, parts: Vec<serde_json::Value>, etags: Vec<serde_json::Value>) -> FileVersionUploadStatus { pub fn new(
upload_id: String,
file_name: String,
next_part_number: i32,
max_parts: i32,
parts: Vec<serde_json::Value>,
etags: Vec<serde_json::Value>,
) -> FileVersionUploadStatus {
FileVersionUploadStatus { FileVersionUploadStatus {
upload_id, upload_id,
file_name, file_name,
@ -39,4 +46,3 @@ impl FileVersionUploadStatus {
} }
} }
} }

View File

@ -32,4 +32,3 @@ impl FinishFileDataUploadRequest {
} }
} }
} }

View File

@ -28,4 +28,3 @@ impl FriendStatus {
} }
} }
} }

View File

@ -21,28 +21,56 @@ pub struct Group {
pub discriminator: Option<String>, pub discriminator: Option<String>,
#[serde(rename = "description", skip_serializing_if = "Option::is_none")] #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
pub description: Option<String>, pub description: Option<String>,
#[serde(rename = "iconUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "iconUrl",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub icon_url: Option<Option<String>>, pub icon_url: Option<Option<String>>,
#[serde(rename = "bannerUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "bannerUrl",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub banner_url: Option<Option<String>>, pub banner_url: Option<Option<String>>,
#[serde(rename = "privacy", skip_serializing_if = "Option::is_none")] #[serde(rename = "privacy", skip_serializing_if = "Option::is_none")]
pub privacy: Option<models::GroupPrivacy>, pub privacy: Option<models::GroupPrivacy>,
/// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed.
#[serde(rename = "ownerId", skip_serializing_if = "Option::is_none")] #[serde(rename = "ownerId", skip_serializing_if = "Option::is_none")]
pub owner_id: Option<String>, pub owner_id: Option<String>,
#[serde(rename = "rules", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "rules",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub rules: Option<Option<String>>, pub rules: Option<Option<String>>,
#[serde(rename = "links", skip_serializing_if = "Option::is_none")] #[serde(rename = "links", skip_serializing_if = "Option::is_none")]
pub links: Option<Vec<String>>, pub links: Option<Vec<String>>,
#[serde(rename = "languages", skip_serializing_if = "Option::is_none")] #[serde(rename = "languages", skip_serializing_if = "Option::is_none")]
pub languages: Option<Vec<String>>, pub languages: Option<Vec<String>>,
#[serde(rename = "iconId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "iconId",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub icon_id: Option<Option<String>>, pub icon_id: Option<Option<String>>,
#[serde(rename = "bannerId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "bannerId",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub banner_id: Option<Option<String>>, pub banner_id: Option<Option<String>>,
#[serde(rename = "memberCount", skip_serializing_if = "Option::is_none")] #[serde(rename = "memberCount", skip_serializing_if = "Option::is_none")]
pub member_count: Option<i32>, pub member_count: Option<i32>,
#[serde(rename = "memberCountSyncedAt", skip_serializing_if = "Option::is_none")] #[serde(
rename = "memberCountSyncedAt",
skip_serializing_if = "Option::is_none"
)]
pub member_count_synced_at: Option<String>, pub member_count_synced_at: Option<String>,
#[serde(rename = "isVerified", skip_serializing_if = "Option::is_none")] #[serde(rename = "isVerified", skip_serializing_if = "Option::is_none")]
pub is_verified: Option<bool>, pub is_verified: Option<bool>,
@ -59,7 +87,12 @@ pub struct Group {
pub created_at: Option<String>, pub created_at: Option<String>,
#[serde(rename = "updatedAt", skip_serializing_if = "Option::is_none")] #[serde(rename = "updatedAt", skip_serializing_if = "Option::is_none")]
pub updated_at: Option<String>, pub updated_at: Option<String>,
#[serde(rename = "lastPostCreatedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "lastPostCreatedAt",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub last_post_created_at: Option<Option<String>>, pub last_post_created_at: Option<Option<String>>,
#[serde(rename = "onlineMemberCount", skip_serializing_if = "Option::is_none")] #[serde(rename = "onlineMemberCount", skip_serializing_if = "Option::is_none")]
pub online_member_count: Option<i32>, pub online_member_count: Option<i32>,
@ -68,7 +101,12 @@ pub struct Group {
#[serde(rename = "myMember", skip_serializing_if = "Option::is_none")] #[serde(rename = "myMember", skip_serializing_if = "Option::is_none")]
pub my_member: Option<models::GroupMyMember>, pub my_member: Option<models::GroupMyMember>,
/// Only returned if ?includeRoles=true is specified. /// Only returned if ?includeRoles=true is specified.
#[serde(rename = "roles", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "roles",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub roles: Option<Option<Vec<models::GroupRole>>>, pub roles: Option<Option<Vec<models::GroupRole>>>,
} }
@ -106,4 +144,3 @@ impl Group {
} }
} }
} }

View File

@ -19,7 +19,6 @@ pub enum GroupAccessType {
Plus, Plus,
#[serde(rename = "members")] #[serde(rename = "members")]
Members, Members,
} }
impl std::fmt::Display for GroupAccessType { impl std::fmt::Display for GroupAccessType {
@ -37,4 +36,3 @@ impl Default for GroupAccessType {
Self::Public Self::Public
} }
} }

View File

@ -18,17 +18,42 @@ pub struct GroupAnnouncement {
/// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed.
#[serde(rename = "authorId", skip_serializing_if = "Option::is_none")] #[serde(rename = "authorId", skip_serializing_if = "Option::is_none")]
pub author_id: Option<String>, pub author_id: Option<String>,
#[serde(rename = "title", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "title",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub title: Option<Option<String>>, pub title: Option<Option<String>>,
#[serde(rename = "text", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "text",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub text: Option<Option<String>>, pub text: Option<Option<String>>,
#[serde(rename = "imageId", skip_serializing_if = "Option::is_none")] #[serde(rename = "imageId", skip_serializing_if = "Option::is_none")]
pub image_id: Option<String>, pub image_id: Option<String>,
#[serde(rename = "imageUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "imageUrl",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub image_url: Option<Option<String>>, pub image_url: Option<Option<String>>,
#[serde(rename = "createdAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "createdAt",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub created_at: Option<Option<String>>, pub created_at: Option<Option<String>>,
#[serde(rename = "updatedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "updatedAt",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub updated_at: Option<Option<String>>, pub updated_at: Option<Option<String>>,
} }
@ -47,4 +72,3 @@ impl GroupAnnouncement {
} }
} }
} }

View File

@ -51,4 +51,3 @@ impl GroupAuditLogEntry {
} }
} }
} }

View File

@ -22,13 +22,33 @@ pub struct GroupGallery {
/// Whether the gallery is members only. /// Whether the gallery is members only.
#[serde(rename = "membersOnly", skip_serializing_if = "Option::is_none")] #[serde(rename = "membersOnly", skip_serializing_if = "Option::is_none")]
pub members_only: Option<bool>, pub members_only: Option<bool>,
#[serde(rename = "roleIdsToView", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "roleIdsToView",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub role_ids_to_view: Option<Option<Vec<String>>>, pub role_ids_to_view: Option<Option<Vec<String>>>,
#[serde(rename = "roleIdsToSubmit", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "roleIdsToSubmit",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub role_ids_to_submit: Option<Option<Vec<String>>>, pub role_ids_to_submit: Option<Option<Vec<String>>>,
#[serde(rename = "roleIdsToAutoApprove", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "roleIdsToAutoApprove",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub role_ids_to_auto_approve: Option<Option<Vec<String>>>, pub role_ids_to_auto_approve: Option<Option<Vec<String>>>,
#[serde(rename = "roleIdsToManage", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "roleIdsToManage",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub role_ids_to_manage: Option<Option<Vec<String>>>, pub role_ids_to_manage: Option<Option<Vec<String>>>,
#[serde(rename = "createdAt", skip_serializing_if = "Option::is_none")] #[serde(rename = "createdAt", skip_serializing_if = "Option::is_none")]
pub created_at: Option<String>, pub created_at: Option<String>,
@ -52,4 +72,3 @@ impl GroupGallery {
} }
} }
} }

View File

@ -51,4 +51,3 @@ impl GroupGalleryImage {
} }
} }
} }

View File

@ -23,7 +23,12 @@ pub struct GroupInstance {
} }
impl GroupInstance { impl GroupInstance {
pub fn new(instance_id: String, location: String, world: models::World, member_count: i32) -> GroupInstance { pub fn new(
instance_id: String,
location: String,
world: models::World,
member_count: i32,
) -> GroupInstance {
GroupInstance { GroupInstance {
instance_id, instance_id,
location, location,
@ -32,4 +37,3 @@ impl GroupInstance {
} }
} }
} }

View File

@ -15,7 +15,6 @@ pub enum GroupJoinRequestAction {
Accept, Accept,
#[serde(rename = "reject")] #[serde(rename = "reject")]
Reject, Reject,
} }
impl std::fmt::Display for GroupJoinRequestAction { impl std::fmt::Display for GroupJoinRequestAction {
@ -32,4 +31,3 @@ impl Default for GroupJoinRequestAction {
Self::Accept Self::Accept
} }
} }

View File

@ -19,7 +19,6 @@ pub enum GroupJoinState {
Request, Request,
#[serde(rename = "open")] #[serde(rename = "open")]
Open, Open,
} }
impl std::fmt::Display for GroupJoinState { impl std::fmt::Display for GroupJoinState {
@ -38,4 +37,3 @@ impl Default for GroupJoinState {
Self::Closed Self::Closed
} }
} }

View File

@ -25,26 +25,57 @@ pub struct GroupLimitedMember {
pub role_ids: Option<Vec<String>>, pub role_ids: Option<Vec<String>>,
#[serde(rename = "mRoleIds", skip_serializing_if = "Option::is_none")] #[serde(rename = "mRoleIds", skip_serializing_if = "Option::is_none")]
pub m_role_ids: Option<Vec<String>>, pub m_role_ids: Option<Vec<String>>,
#[serde(rename = "joinedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "joinedAt",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub joined_at: Option<Option<String>>, pub joined_at: Option<Option<String>>,
#[serde(rename = "membershipStatus", skip_serializing_if = "Option::is_none")] #[serde(rename = "membershipStatus", skip_serializing_if = "Option::is_none")]
pub membership_status: Option<models::GroupMemberStatus>, pub membership_status: Option<models::GroupMemberStatus>,
#[serde(rename = "visibility", skip_serializing_if = "Option::is_none")] #[serde(rename = "visibility", skip_serializing_if = "Option::is_none")]
pub visibility: Option<String>, pub visibility: Option<String>,
#[serde(rename = "isSubscribedToAnnouncements", skip_serializing_if = "Option::is_none")] #[serde(
rename = "isSubscribedToAnnouncements",
skip_serializing_if = "Option::is_none"
)]
pub is_subscribed_to_announcements: Option<bool>, pub is_subscribed_to_announcements: Option<bool>,
/// Only visible via the /groups/:groupId/members endpoint, **not** when fetching a specific user. /// Only visible via the /groups/:groupId/members endpoint, **not** when fetching a specific user.
#[serde(rename = "createdAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "createdAt",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub created_at: Option<Option<String>>, pub created_at: Option<Option<String>>,
/// Only visible via the /groups/:groupId/members endpoint, **not** when fetching a specific user. /// Only visible via the /groups/:groupId/members endpoint, **not** when fetching a specific user.
#[serde(rename = "bannedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "bannedAt",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub banned_at: Option<Option<String>>, pub banned_at: Option<Option<String>>,
/// Only visible via the /groups/:groupId/members endpoint, **not** when fetching a specific user. /// Only visible via the /groups/:groupId/members endpoint, **not** when fetching a specific user.
#[serde(rename = "managerNotes", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "managerNotes",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub manager_notes: Option<Option<String>>, pub manager_notes: Option<Option<String>>,
#[serde(rename = "lastPostReadAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "lastPostReadAt",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub last_post_read_at: Option<Option<String>>, pub last_post_read_at: Option<Option<String>>,
#[serde(rename = "hasJoinedFromPurchase", skip_serializing_if = "Option::is_none")] #[serde(
rename = "hasJoinedFromPurchase",
skip_serializing_if = "Option::is_none"
)]
pub has_joined_from_purchase: Option<bool>, pub has_joined_from_purchase: Option<bool>,
} }
@ -69,4 +100,3 @@ impl GroupLimitedMember {
} }
} }
} }

View File

@ -27,26 +27,57 @@ pub struct GroupMember {
pub role_ids: Option<Vec<String>>, pub role_ids: Option<Vec<String>>,
#[serde(rename = "mRoleIds", skip_serializing_if = "Option::is_none")] #[serde(rename = "mRoleIds", skip_serializing_if = "Option::is_none")]
pub m_role_ids: Option<Vec<String>>, pub m_role_ids: Option<Vec<String>>,
#[serde(rename = "joinedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "joinedAt",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub joined_at: Option<Option<String>>, pub joined_at: Option<Option<String>>,
#[serde(rename = "membershipStatus", skip_serializing_if = "Option::is_none")] #[serde(rename = "membershipStatus", skip_serializing_if = "Option::is_none")]
pub membership_status: Option<models::GroupMemberStatus>, pub membership_status: Option<models::GroupMemberStatus>,
#[serde(rename = "visibility", skip_serializing_if = "Option::is_none")] #[serde(rename = "visibility", skip_serializing_if = "Option::is_none")]
pub visibility: Option<String>, pub visibility: Option<String>,
#[serde(rename = "isSubscribedToAnnouncements", skip_serializing_if = "Option::is_none")] #[serde(
rename = "isSubscribedToAnnouncements",
skip_serializing_if = "Option::is_none"
)]
pub is_subscribed_to_announcements: Option<bool>, pub is_subscribed_to_announcements: Option<bool>,
/// Only visible via the /groups/:groupId/members endpoint, **not** when fetching a specific user. /// Only visible via the /groups/:groupId/members endpoint, **not** when fetching a specific user.
#[serde(rename = "createdAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "createdAt",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub created_at: Option<Option<String>>, pub created_at: Option<Option<String>>,
/// Only visible via the /groups/:groupId/members endpoint, **not** when fetching a specific user. /// Only visible via the /groups/:groupId/members endpoint, **not** when fetching a specific user.
#[serde(rename = "bannedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "bannedAt",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub banned_at: Option<Option<String>>, pub banned_at: Option<Option<String>>,
/// Only visible via the /groups/:groupId/members endpoint, **not** when fetching a specific user. /// Only visible via the /groups/:groupId/members endpoint, **not** when fetching a specific user.
#[serde(rename = "managerNotes", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "managerNotes",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub manager_notes: Option<Option<String>>, pub manager_notes: Option<Option<String>>,
#[serde(rename = "lastPostReadAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "lastPostReadAt",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub last_post_read_at: Option<Option<String>>, pub last_post_read_at: Option<Option<String>>,
#[serde(rename = "hasJoinedFromPurchase", skip_serializing_if = "Option::is_none")] #[serde(
rename = "hasJoinedFromPurchase",
skip_serializing_if = "Option::is_none"
)]
pub has_joined_from_purchase: Option<bool>, pub has_joined_from_purchase: Option<bool>,
} }
@ -72,4 +103,3 @@ impl GroupMember {
} }
} }
} }

View File

@ -17,13 +17,23 @@ pub struct GroupMemberLimitedUser {
pub id: Option<String>, pub id: Option<String>,
#[serde(rename = "displayName", skip_serializing_if = "Option::is_none")] #[serde(rename = "displayName", skip_serializing_if = "Option::is_none")]
pub display_name: Option<String>, pub display_name: Option<String>,
#[serde(rename = "thumbnailUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "thumbnailUrl",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub thumbnail_url: Option<Option<String>>, pub thumbnail_url: Option<Option<String>>,
#[serde(rename = "iconUrl", skip_serializing_if = "Option::is_none")] #[serde(rename = "iconUrl", skip_serializing_if = "Option::is_none")]
pub icon_url: Option<String>, pub icon_url: Option<String>,
#[serde(rename = "profilePicOverride", skip_serializing_if = "Option::is_none")] #[serde(rename = "profilePicOverride", skip_serializing_if = "Option::is_none")]
pub profile_pic_override: Option<String>, pub profile_pic_override: Option<String>,
#[serde(rename = "currentAvatarThumbnailImageUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "currentAvatarThumbnailImageUrl",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub current_avatar_thumbnail_image_url: Option<Option<String>>, pub current_avatar_thumbnail_image_url: Option<Option<String>>,
#[serde(rename = "currentAvatarTags", skip_serializing_if = "Option::is_none")] #[serde(rename = "currentAvatarTags", skip_serializing_if = "Option::is_none")]
pub current_avatar_tags: Option<Vec<String>>, pub current_avatar_tags: Option<Vec<String>>,
@ -43,4 +53,3 @@ impl GroupMemberLimitedUser {
} }
} }
} }

View File

@ -23,7 +23,6 @@ pub enum GroupMemberStatus {
Banned, Banned,
#[serde(rename = "userblocked")] #[serde(rename = "userblocked")]
Userblocked, Userblocked,
} }
impl std::fmt::Display for GroupMemberStatus { impl std::fmt::Display for GroupMemberStatus {
@ -44,4 +43,3 @@ impl Default for GroupMemberStatus {
Self::Inactive Self::Inactive
} }
} }

View File

@ -20,7 +20,12 @@ pub struct GroupMyMember {
pub user_id: Option<String>, pub user_id: Option<String>,
#[serde(rename = "roleIds", skip_serializing_if = "Option::is_none")] #[serde(rename = "roleIds", skip_serializing_if = "Option::is_none")]
pub role_ids: Option<Vec<String>>, pub role_ids: Option<Vec<String>>,
#[serde(rename = "acceptedByDisplayName", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "acceptedByDisplayName",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub accepted_by_display_name: Option<Option<String>>, pub accepted_by_display_name: Option<Option<String>>,
/// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed.
#[serde(rename = "acceptedById", skip_serializing_if = "Option::is_none")] #[serde(rename = "acceptedById", skip_serializing_if = "Option::is_none")]
@ -31,7 +36,10 @@ pub struct GroupMyMember {
pub manager_notes: Option<String>, pub manager_notes: Option<String>,
#[serde(rename = "membershipStatus", skip_serializing_if = "Option::is_none")] #[serde(rename = "membershipStatus", skip_serializing_if = "Option::is_none")]
pub membership_status: Option<String>, pub membership_status: Option<String>,
#[serde(rename = "isSubscribedToAnnouncements", skip_serializing_if = "Option::is_none")] #[serde(
rename = "isSubscribedToAnnouncements",
skip_serializing_if = "Option::is_none"
)]
pub is_subscribed_to_announcements: Option<bool>, pub is_subscribed_to_announcements: Option<bool>,
#[serde(rename = "visibility", skip_serializing_if = "Option::is_none")] #[serde(rename = "visibility", skip_serializing_if = "Option::is_none")]
pub visibility: Option<String>, pub visibility: Option<String>,
@ -39,13 +47,26 @@ pub struct GroupMyMember {
pub is_representing: Option<bool>, pub is_representing: Option<bool>,
#[serde(rename = "joinedAt", skip_serializing_if = "Option::is_none")] #[serde(rename = "joinedAt", skip_serializing_if = "Option::is_none")]
pub joined_at: Option<String>, pub joined_at: Option<String>,
#[serde(rename = "bannedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "bannedAt",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub banned_at: Option<Option<String>>, pub banned_at: Option<Option<String>>,
#[serde(rename = "has2FA", skip_serializing_if = "Option::is_none")] #[serde(rename = "has2FA", skip_serializing_if = "Option::is_none")]
pub has2_fa: Option<bool>, pub has2_fa: Option<bool>,
#[serde(rename = "hasJoinedFromPurchase", skip_serializing_if = "Option::is_none")] #[serde(
rename = "hasJoinedFromPurchase",
skip_serializing_if = "Option::is_none"
)]
pub has_joined_from_purchase: Option<bool>, pub has_joined_from_purchase: Option<bool>,
#[serde(rename = "lastPostReadAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "lastPostReadAt",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub last_post_read_at: Option<Option<String>>, pub last_post_read_at: Option<Option<String>>,
#[serde(rename = "mRoleIds", skip_serializing_if = "Option::is_none")] #[serde(rename = "mRoleIds", skip_serializing_if = "Option::is_none")]
pub m_role_ids: Option<Vec<String>>, pub m_role_ids: Option<Vec<String>>,
@ -78,4 +99,3 @@ impl GroupMyMember {
} }
} }
} }

View File

@ -22,7 +22,10 @@ pub struct GroupPermission {
#[serde(rename = "help", skip_serializing_if = "Option::is_none")] #[serde(rename = "help", skip_serializing_if = "Option::is_none")]
pub help: Option<String>, pub help: Option<String>,
/// Whether this permission is a \"management\" permission. /// Whether this permission is a \"management\" permission.
#[serde(rename = "isManagementPermission", skip_serializing_if = "Option::is_none")] #[serde(
rename = "isManagementPermission",
skip_serializing_if = "Option::is_none"
)]
pub is_management_permission: Option<bool>, pub is_management_permission: Option<bool>,
/// Whether the user is allowed to add this permission to a role. /// Whether the user is allowed to add this permission to a role.
#[serde(rename = "allowedToAdd", skip_serializing_if = "Option::is_none")] #[serde(rename = "allowedToAdd", skip_serializing_if = "Option::is_none")]
@ -41,4 +44,3 @@ impl GroupPermission {
} }
} }
} }

View File

@ -31,7 +31,12 @@ pub struct GroupPost {
pub text: Option<String>, pub text: Option<String>,
#[serde(rename = "imageId", skip_serializing_if = "Option::is_none")] #[serde(rename = "imageId", skip_serializing_if = "Option::is_none")]
pub image_id: Option<String>, pub image_id: Option<String>,
#[serde(rename = "imageUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "imageUrl",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub image_url: Option<Option<String>>, pub image_url: Option<Option<String>>,
#[serde(rename = "createdAt", skip_serializing_if = "Option::is_none")] #[serde(rename = "createdAt", skip_serializing_if = "Option::is_none")]
pub created_at: Option<String>, pub created_at: Option<String>,
@ -57,4 +62,3 @@ impl GroupPost {
} }
} }
} }

View File

@ -15,7 +15,6 @@ pub enum GroupPostVisibility {
Group, Group,
#[serde(rename = "public")] #[serde(rename = "public")]
Public, Public,
} }
impl std::fmt::Display for GroupPostVisibility { impl std::fmt::Display for GroupPostVisibility {
@ -32,4 +31,3 @@ impl Default for GroupPostVisibility {
Self::Group Self::Group
} }
} }

View File

@ -15,7 +15,6 @@ pub enum GroupPrivacy {
Default, Default,
#[serde(rename = "private")] #[serde(rename = "private")]
Private, Private,
} }
impl std::fmt::Display for GroupPrivacy { impl std::fmt::Display for GroupPrivacy {
@ -32,4 +31,3 @@ impl Default for GroupPrivacy {
Self::Default Self::Default
} }
} }

View File

@ -55,4 +55,3 @@ impl GroupRole {
} }
} }
} }

View File

@ -19,7 +19,6 @@ pub enum GroupRoleTemplate {
ManagedInvite, ManagedInvite,
#[serde(rename = "managedRequest")] #[serde(rename = "managedRequest")]
ManagedRequest, ManagedRequest,
} }
impl std::fmt::Display for GroupRoleTemplate { impl std::fmt::Display for GroupRoleTemplate {
@ -38,4 +37,3 @@ impl Default for GroupRoleTemplate {
Self::Default Self::Default
} }
} }

View File

@ -15,7 +15,6 @@ pub enum GroupSearchSort {
Asc, Asc,
#[serde(rename = "joinedAt:desc")] #[serde(rename = "joinedAt:desc")]
Desc, Desc,
} }
impl std::fmt::Display for GroupSearchSort { impl std::fmt::Display for GroupSearchSort {
@ -32,4 +31,3 @@ impl Default for GroupSearchSort {
Self::Asc Self::Asc
} }
} }

View File

@ -17,7 +17,6 @@ pub enum GroupUserVisibility {
Hidden, Hidden,
#[serde(rename = "friends")] #[serde(rename = "friends")]
Friends, Friends,
} }
impl std::fmt::Display for GroupUserVisibility { impl std::fmt::Display for GroupUserVisibility {
@ -35,4 +34,3 @@ impl Default for GroupUserVisibility {
Self::Visible Self::Visible
} }
} }

View File

@ -38,7 +38,17 @@ pub struct InfoPush {
} }
impl InfoPush { impl InfoPush {
pub fn new(id: String, is_enabled: bool, release_status: models::ReleaseStatus, priority: i32, tags: Vec<String>, data: models::InfoPushData, hash: String, created_at: String, updated_at: String) -> InfoPush { pub fn new(
id: String,
is_enabled: bool,
release_status: models::ReleaseStatus,
priority: i32,
tags: Vec<String>,
data: models::InfoPushData,
hash: String,
created_at: String,
updated_at: String,
) -> InfoPush {
InfoPush { InfoPush {
id, id,
is_enabled, is_enabled,
@ -54,4 +64,3 @@ impl InfoPush {
} }
} }
} }

View File

@ -44,4 +44,3 @@ impl InfoPushData {
} }
} }
} }

View File

@ -17,9 +17,6 @@ pub struct InfoPushDataArticle {
impl InfoPushDataArticle { impl InfoPushDataArticle {
pub fn new() -> InfoPushDataArticle { pub fn new() -> InfoPushDataArticle {
InfoPushDataArticle { InfoPushDataArticle { content: None }
content: None,
}
} }
} }

View File

@ -28,4 +28,3 @@ impl InfoPushDataArticleContent {
} }
} }
} }

View File

@ -43,4 +43,3 @@ impl Default for Command {
Self::OpenUrl Self::OpenUrl
} }
} }

View File

@ -36,7 +36,12 @@ pub struct Instance {
#[serde(rename = "name")] #[serde(rename = "name")]
pub name: String, pub name: String,
/// A groupId if the instance type is \"group\", null if instance type is public, or a userId otherwise /// A groupId if the instance type is \"group\", null if instance type is public, or a userId otherwise
#[serde(rename = "ownerId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "ownerId",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub owner_id: Option<Option<String>>, pub owner_id: Option<Option<String>>,
#[serde(rename = "permanent")] #[serde(rename = "permanent")]
pub permanent: bool, pub permanent: bool,
@ -48,7 +53,12 @@ pub struct Instance {
pub region: models::InstanceRegion, pub region: models::InstanceRegion,
#[serde(rename = "secureName")] #[serde(rename = "secureName")]
pub secure_name: String, pub secure_name: String,
#[serde(rename = "shortName", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "shortName",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub short_name: Option<Option<String>>, pub short_name: Option<Option<String>>,
/// The tags array on Instances usually contain the language tags of the people in the instance. /// The tags array on Instances usually contain the language tags of the people in the instance.
#[serde(rename = "tags")] #[serde(rename = "tags")]
@ -90,15 +100,50 @@ pub struct Instance {
pub has_capacity_for_you: Option<bool>, pub has_capacity_for_you: Option<bool>,
#[serde(rename = "nonce", skip_serializing_if = "Option::is_none")] #[serde(rename = "nonce", skip_serializing_if = "Option::is_none")]
pub nonce: Option<String>, pub nonce: Option<String>,
#[serde(rename = "closedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "closedAt",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub closed_at: Option<Option<String>>, pub closed_at: Option<Option<String>>,
#[serde(rename = "hardClose", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] #[serde(
rename = "hardClose",
default,
with = "::serde_with::rust::double_option",
skip_serializing_if = "Option::is_none"
)]
pub hard_close: Option<Option<bool>>, pub hard_close: Option<Option<bool>>,
} }
impl Instance { impl Instance {
/// * `hidden` field is only present if InstanceType is `hidden` aka \"Friends+\", and is instance creator. * `friends` field is only present if InstanceType is `friends` aka \"Friends\", and is instance creator. * `private` field is only present if InstanceType is `private` aka \"Invite\" or \"Invite+\", and is instance creator. /// * `hidden` field is only present if InstanceType is `hidden` aka \"Friends+\", and is instance creator. * `friends` field is only present if InstanceType is `friends` aka \"Friends\", and is instance creator. * `private` field is only present if InstanceType is `private` aka \"Invite\" or \"Invite+\", and is instance creator.
pub fn new(active: bool, can_request_invite: bool, capacity: i32, client_number: String, full: bool, id: String, instance_id: String, location: String, n_users: i32, name: String, permanent: bool, photon_region: models::Region, platforms: models::InstancePlatforms, region: models::InstanceRegion, secure_name: String, tags: Vec<String>, r#type: models::InstanceType, world_id: String, queue_enabled: bool, queue_size: i32, recommended_capacity: i32, strict: bool, user_count: i32, world: models::World) -> Instance { pub fn new(
active: bool,
can_request_invite: bool,
capacity: i32,
client_number: String,
full: bool,
id: String,
instance_id: String,
location: String,
n_users: i32,
name: String,
permanent: bool,
photon_region: models::Region,
platforms: models::InstancePlatforms,
region: models::InstanceRegion,
secure_name: String,
tags: Vec<String>,
r#type: models::InstanceType,
world_id: String,
queue_enabled: bool,
queue_size: i32,
recommended_capacity: i32,
strict: bool,
user_count: i32,
world: models::World,
) -> Instance {
Instance { Instance {
active, active,
can_request_invite, can_request_invite,
@ -139,4 +184,3 @@ impl Instance {
} }
} }
} }

View File

@ -25,4 +25,3 @@ impl InstancePlatforms {
} }
} }
} }

View File

@ -23,7 +23,6 @@ pub enum InstanceRegion {
Jp, Jp,
#[serde(rename = "unknown")] #[serde(rename = "unknown")]
Unknown, Unknown,
} }
impl std::fmt::Display for InstanceRegion { impl std::fmt::Display for InstanceRegion {
@ -43,4 +42,3 @@ impl Default for InstanceRegion {
Self::Us Self::Us
} }
} }

View File

@ -25,4 +25,3 @@ impl InstanceShortNameResponse {
} }
} }
} }

View File

@ -22,7 +22,6 @@ pub enum InstanceType {
Private, Private,
#[serde(rename = "group")] #[serde(rename = "group")]
Group, Group,
} }
impl std::fmt::Display for InstanceType { impl std::fmt::Display for InstanceType {
@ -42,4 +41,3 @@ impl Default for InstanceType {
Self::Public Self::Public
} }
} }

View File

@ -30,7 +30,15 @@ pub struct InviteMessage {
} }
impl InviteMessage { impl InviteMessage {
pub fn new(can_be_updated: bool, id: String, message: String, message_type: models::InviteMessageType, remaining_cooldown_minutes: i32, slot: i32, updated_at: String) -> InviteMessage { pub fn new(
can_be_updated: bool,
id: String,
message: String,
message_type: models::InviteMessageType,
remaining_cooldown_minutes: i32,
slot: i32,
updated_at: String,
) -> InviteMessage {
InviteMessage { InviteMessage {
can_be_updated, can_be_updated,
id, id,
@ -42,4 +50,3 @@ impl InviteMessage {
} }
} }
} }

View File

@ -20,7 +20,6 @@ pub enum InviteMessageType {
Request, Request,
#[serde(rename = "requestResponse")] #[serde(rename = "requestResponse")]
RequestResponse, RequestResponse,
} }
impl std::fmt::Display for InviteMessageType { impl std::fmt::Display for InviteMessageType {
@ -39,4 +38,3 @@ impl Default for InviteMessageType {
Self::Message Self::Message
} }
} }

View File

@ -26,4 +26,3 @@ impl InviteRequest {
} }
} }
} }

View File

@ -17,9 +17,6 @@ pub struct InviteResponse {
impl InviteResponse { impl InviteResponse {
pub fn new(response_slot: i32) -> InviteResponse { pub fn new(response_slot: i32) -> InviteResponse {
InviteResponse { InviteResponse { response_slot }
response_slot,
}
} }
} }

View File

@ -23,7 +23,12 @@ pub struct License {
} }
impl License { impl License {
pub fn new(for_id: String, for_type: models::LicenseType, for_name: String, for_action: models::LicenseAction) -> License { pub fn new(
for_id: String,
for_type: models::LicenseType,
for_name: String,
for_action: models::LicenseAction,
) -> License {
License { License {
for_id, for_id,
for_type, for_type,
@ -32,4 +37,3 @@ impl License {
} }
} }
} }

View File

@ -15,7 +15,6 @@ pub enum LicenseAction {
Wear, Wear,
#[serde(rename = "have")] #[serde(rename = "have")]
Have, Have,
} }
impl std::fmt::Display for LicenseAction { impl std::fmt::Display for LicenseAction {
@ -32,4 +31,3 @@ impl Default for LicenseAction {
Self::Wear Self::Wear
} }
} }

View File

@ -23,7 +23,12 @@ pub struct LicenseGroup {
} }
impl LicenseGroup { impl LicenseGroup {
pub fn new(id: String, name: String, description: String, licenses: Vec<models::License>) -> LicenseGroup { pub fn new(
id: String,
name: String,
description: String,
licenses: Vec<models::License>,
) -> LicenseGroup {
LicenseGroup { LicenseGroup {
id, id,
name, name,
@ -32,4 +37,3 @@ impl LicenseGroup {
} }
} }
} }

Some files were not shown because too many files have changed in this diff Show More