diff --git a/.env.example b/.env.example index 132e464..7d6736d 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,2 @@ -CLIENT_ID= -CLIENT_SECRET= -TRIBUFU_API_URL=https://api.tribufu.com \ No newline at end of file +TRIBUFU_API_KEY="" +TRIBUFU_API_URL="https://api.tribufu.com" diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore new file mode 100644 index 0000000..3f6703d --- /dev/null +++ b/.openapi-generator-ignore @@ -0,0 +1,8 @@ +docs/ + +.gitignore +.travis.yml +Cargo.toml +git_push.sh +README.md +src/lib.rs diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES new file mode 100644 index 0000000..573536a --- /dev/null +++ b/.openapi-generator/FILES @@ -0,0 +1,46 @@ +src/apis/configuration.rs +src/apis/mod.rs +src/apis/tribufu_generated_api.rs +src/models/account.rs +src/models/application.rs +src/models/application_type.rs +src/models/authorize_request.rs +src/models/code_challenge_method.rs +src/models/crypto_view_model.rs +src/models/game.rs +src/models/game_server.rs +src/models/game_server_cluster.rs +src/models/grant_type.rs +src/models/group.rs +src/models/group_game.rs +src/models/group_member.rs +src/models/group_rank.rs +src/models/hash_view_model.rs +src/models/introspect_request.rs +src/models/ip_address.rs +src/models/leaderboard_item.rs +src/models/leaderboard_order.rs +src/models/login_provider.rs +src/models/login_request.rs +src/models/login_response.rs +src/models/mod.rs +src/models/package.rs +src/models/profile.rs +src/models/profile_game.rs +src/models/profile_group.rs +src/models/refresh_request.rs +src/models/register_request.rs +src/models/response_type.rs +src/models/revoke_request.rs +src/models/search_request.rs +src/models/search_type.rs +src/models/server_metrics.rs +src/models/server_status.rs +src/models/subscription.rs +src/models/token_hint_type.rs +src/models/token_request.rs +src/models/token_response.rs +src/models/token_type.rs +src/models/update_profile.rs +src/models/user_info.rs +src/models/user_type.rs diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION new file mode 100644 index 0000000..5f84a81 --- /dev/null +++ b/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.12.0 diff --git a/Cargo.toml b/Cargo.toml index fd88d14..e71c290 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "tribufu" -version = "0.1.0" -description = "Tribufu SDK" -repository = "https://github.com/Tribufu/TribufuRust" +version = "1.1.0" +description = "REST API to access Tribufu services." +repository = "https://github.com/tribufu/tribufu-rust" authors = ["Tribufu "] license = "MIT" readme = "README.md" @@ -11,31 +11,36 @@ publish = true exclude = [ ".editorconfig", + ".env*", ".gitattributes", ".github/", + ".openapi-generator-ignore", + ".openapi-generator/", ".vscode/", "examples/", "scripts/", + "scripts/", ] -[workspace] -resolver = "2" -members = ["src/*"] - [lib] name = "tribufu" crate-type = ["rlib"] path = "src/lib.rs" -[features] -#actix = ["tribufu-actix"] - [dependencies] -tribufu-api = { version = "0.1.0", path = "./src/api" } -tribufu-constants = { version = "0.1.0", path = "./src/constants" } -tribufu-types = { version = "0.1.0", path = "./src/types" } -#tribufu-actix = { version = "0.1.0", path = "./src/actix", optional = true } +async-trait = "^0.1" +reqwest = { version = "^0.12", features = ["json", "multipart"] } +serde = { version = "^1.0", features = ["derive"] } +serde_json = "^1.0" +serde_repr = "^0.1" +serde_with = { version = "^3.8", default-features = false, features = [ + "base64", + "std", + "macros", +] } +url = "^2.5" +uuid = { version = "^1.8", features = ["serde", "v4"] } [dev-dependencies] dotenv = "0.15.0" -tokio = { version = "1", features = ["full"] } +tokio = { version = "1.45.1", features = ["full"] } diff --git a/examples/api.rs b/examples/api.rs index eb1b2c3..9d644f4 100644 --- a/examples/api.rs +++ b/examples/api.rs @@ -1,10 +1,14 @@ -// Copyright (c) Tribufu. All Rights Reserved +// Copyright (c) Tribufu. All Rights Reserved. +// SPDX-License-Identifier: MIT -use tribufu::*; +use dotenv::dotenv; +use tribufu::apis::tribufu_generated_api::TribufuGeneratedApi; +use tribufu::TribufuApi; #[tokio::main] async fn main() { - let api = TribufuApi::default(); - let games = api.get_games(Some(1)).await.unwrap(); - println!("{:?}", games); + dotenv().unwrap(); + let tribufu = TribufuApi::from_env_or_default(None); + let user_info = tribufu.get_user_info().await.unwrap(); + println!("{:?}", user_info); } diff --git a/examples/token.rs b/examples/token.rs deleted file mode 100644 index 133240d..0000000 --- a/examples/token.rs +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Tribufu. All Rights Reserved - -use tribufu::*; - -#[tokio::main] -async fn main() { - let api = TribufuApi::with_client_from_env().unwrap_or_default(); - let games = api.get_games(Some(1)).await.unwrap(); - println!("{:?}", games); -} diff --git a/scripts/generate.ps1 b/scripts/generate.ps1 new file mode 100644 index 0000000..5a1835e --- /dev/null +++ b/scripts/generate.ps1 @@ -0,0 +1,10 @@ +#!/usr/bin/env pwsh + +java -jar ./vendor/openapi-generator/openapi-generator-cli.jar generate ` + -i https://api.tribufu.com/openapi.json ` + -g rust ` + -o . ` + --global-property apis,models,supportingFiles,apiDocs=false,modelDocs=false,apiTests=false,modelTests=false ` + --additional-properties=packageName=tribufu,library=reqwest-trait,supportAsync=true,preferUnsignedInt=true ` + --openapi-normalizer SET_TAGS_FOR_ALL_OPERATIONS=TribufuGenerated ` + --skip-validate-spec diff --git a/src/actix/Cargo.toml b/src/actix/Cargo.toml deleted file mode 100644 index fde32a0..0000000 --- a/src/actix/Cargo.toml +++ /dev/null @@ -1,19 +0,0 @@ -[package] -name = "tribufu-actix" -version = "0.1.0" -description = "Tribufu Actix Extension" -repository = "https://github.com/Tribufu/TribufuRust" -authors = ["Tribufu "] -license = "MIT" -edition = "2021" -publish = true - -[lib] -name = "tribufu_actix" -crate-type = ["rlib"] -path = "lib.rs" - -[dependencies] -actix-web = { version = "4", features = ["rustls"] } -mintaka-error = { version = "0.0.1" } -tribufu-api = { path = "../api" } diff --git a/src/actix/lib.rs b/src/actix/lib.rs deleted file mode 100644 index f396744..0000000 --- a/src/actix/lib.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Tribufu. All Rights Reserved. - -use actix_web::HttpRequest; - -pub trait TribufuApiActixExtension { - fn from_actix(req: &HttpRequest) -> Self; -} - -/* -impl TribufuApiActixExtension for TribufuApi { - fn from_actix(req: &HttpRequest) -> Self { - let mut api = Self::with_client_from_env().unwrap_or_default(); - - if let Some(authorization) = req.headers().get("Authorization") { - let authorization = authorization.to_str().unwrap(); - - if authorization.starts_with("Bearer ") { - api = Self::with_user(authorization[7..].to_string()); - } - } - - return api; - } -} -*/ diff --git a/src/api/Cargo.toml b/src/api/Cargo.toml deleted file mode 100644 index 9de8779..0000000 --- a/src/api/Cargo.toml +++ /dev/null @@ -1,28 +0,0 @@ -[package] -name = "tribufu-api" -version = "0.1.0" -description = "Tribufu API" -repository = "https://github.com/Tribufu/TribufuRust" -authors = ["Tribufu "] -license = "MIT" -edition = "2021" -publish = true - -[lib] -name = "tribufu_api" -crate-type = ["rlib"] -path = "lib.rs" - -[dependencies] -tribufu-constants = { version = "0.1.0", path = "../constants" } -tribufu-types = { version = "0.1.0", path = "../types" } -base64 = "0.21.5" -mintaka-error = { version = "0.0.1" } -alnilam-consts = { version = "0.0.4" } -anyhow = "1.0.75" -chrono = { version = "0.4.22", features = ["serde", "rustc-serialize"] } -derive_more = "0.99.17" -reqwest = { version = "0.11.18", features = ["json", "stream"] } -serde = { version = "1.0", features = ["derive"] } -serde_json = { version = "1.0", features = ["raw_value"] } -serde_with = "3.4.0" diff --git a/src/api/lib.rs b/src/api/lib.rs deleted file mode 100644 index 19bfad6..0000000 --- a/src/api/lib.rs +++ /dev/null @@ -1,392 +0,0 @@ -// Copyright (c) Tribufu. All Rights Reserved. - -use alnilam_consts::TARGET_TRIPLE; -use mintaka_error::{Error, Result}; -use reqwest::header::{HeaderMap, HeaderValue, AUTHORIZATION}; -use reqwest::Client; -use std::env; -use tribufu_constants::VERSION; -use tribufu_types::games::Game; -use tribufu_types::oauth2::{OAuth2GrantType, OAuth2TokenRequest, OAuth2TokenResponse}; -use tribufu_types::users::*; - -pub enum Credentials { - Anonymous, - ApiKey { - api_key: String, - }, - Client { - client_id: u64, - client_secret: String, - }, -} - -pub enum Token { - ApiKey { - api_key: String, - }, - Basic { - basic_token: String, - }, - Bearer { - access_token: String, - refresh_token: Option, - }, -} - -pub struct TribufuApi { - base_url: String, - credentials: Credentials, - token: Option, - http: Client, -} - -impl Default for TribufuApi { - fn default() -> Self { - Self::new(Credentials::Anonymous) - } -} - -impl TribufuApi { - const TRIBUFU_API_URL: &'static str = "https://api.tribufu.com"; - - pub fn new(credentials: Credentials) -> Self { - let http = Client::builder() - .user_agent(Self::user_agent()) - .default_headers(Self::default_headers()) - .build() - .unwrap(); - - Self { - base_url: Self::get_base_url(), - credentials, - token: None, - http, - } - } - - pub fn debug_enabled(&self) -> bool { - return cfg!(debug_assertions); - } - - #[inline] - fn user_agent() -> String { - format!( - "Tribufu/{} (+https://api.tribufu.com; {})", - VERSION, TARGET_TRIPLE - ) - } - - #[inline] - fn default_headers() -> HeaderMap { - let mut headers = HeaderMap::new(); - headers.insert("X-Tribufu-Language", HeaderValue::from_static("rust")); - headers.insert("X-Tribufu-Version", HeaderValue::from_static(VERSION)); - headers - } - - fn get_base_url() -> String { - if cfg!(debug_assertions) { - return env::var("TRIBUFU_API_URL") - .unwrap_or_else(|_| Self::TRIBUFU_API_URL.to_string()); - } - - Self::TRIBUFU_API_URL.to_string() - } - - pub fn with_api_key(api_key: String) -> Self { - Self::new(Credentials::ApiKey { api_key }) - } - - pub fn with_client(client_id: u64, client_secret: String) -> Self { - Self::new(Credentials::Client { - client_id, - client_secret, - }) - } - - pub fn with_api_key_from_env() -> Option { - if let Ok(api_key) = env::var("TRIBUFU_API_KEY") { - Some(Self::with_api_key(api_key)) - } else { - None - } - } - - pub fn with_client_from_env() -> Option { - let client_id = env::var("TRIBUFU_CLIENT_ID"); - let client_secret = env::var("TRIBUFU_CLIENT_SECRET"); - - if let (Ok(client_id), Ok(client_secret)) = (client_id, client_secret) { - Some(Self::with_client(client_id.parse().unwrap(), client_secret)) - } else { - None - } - } - - pub fn set_anonymous(&mut self) { - self.credentials = Credentials::Anonymous; - } - - pub fn set_api_key(&mut self, api_key: String) { - self.credentials = Credentials::ApiKey { api_key }; - } - - pub fn set_clients(&mut self, client_id: u64, client_secret: String) { - self.credentials = Credentials::Client { - client_id, - client_secret, - }; - } - - pub fn set_basic_token(&mut self, basic_token: String) { - self.token = Some(Token::Basic { basic_token }); - } - - pub fn set_bearer_token(&mut self, access_token: String, refresh_token: Option) { - self.token = Some(Token::Bearer { - access_token, - refresh_token, - }); - } - - #[inline] - fn headers(&self) -> HeaderMap { - let mut headers = Self::default_headers(); - - match &self.token { - Some(token) => match token { - Token::ApiKey { api_key } => { - headers.insert( - AUTHORIZATION, - HeaderValue::from_str(&format!("ApiKey {}", api_key)).unwrap(), - ); - } - Token::Basic { basic_token } => { - headers.insert( - AUTHORIZATION, - HeaderValue::from_str(&format!("Basic {}", basic_token)).unwrap(), - ); - } - Token::Bearer { access_token, .. } => { - headers.insert( - AUTHORIZATION, - HeaderValue::from_str(&format!("Bearer {}", access_token)).unwrap(), - ); - } - }, - None => {} - } - - headers - } - - pub async fn get_token_with_code( - &mut self, - code: String, - client_id: u64, - client_secret: String, - ) -> Result { - self.get_oauth_token( - OAuth2GrantType::AuthorizationCode, - Some(code), - client_id, - client_secret, - None, - None, - ) - .await - } - - pub async fn get_token_from_password( - &mut self, - username: String, - password: String, - client_id: u64, - client_secret: String, - ) -> Result { - self.get_oauth_token( - OAuth2GrantType::Password, - Some(password), - client_id, - client_secret, - None, - Some(username), - ) - .await - } - - pub async fn get_token_from_passkey( - &mut self, - username: String, - passkey: String, - client_id: u64, - client_secret: String, - ) -> Result { - self.get_oauth_token( - OAuth2GrantType::Passkey, - Some(passkey), - client_id, - client_secret, - None, - Some(username), - ) - .await - } - - pub async fn refresh_token( - &mut self, - refresh_token: String, - client_id: u64, - client_secret: String, - ) -> Result { - self.get_oauth_token( - OAuth2GrantType::RefreshToken, - Some(refresh_token), - client_id, - client_secret, - None, - None, - ) - .await - } - - pub async fn get_client_token( - &mut self, - client_id: u64, - client_secret: String, - ) -> Result { - self.get_oauth_token( - OAuth2GrantType::ClientCredentials, - None, - client_id, - client_secret, - None, - None, - ) - .await - } - - pub async fn get_server_token( - &mut self, - server_id: u64, - client_id: u64, - client_secret: String, - ) -> Result { - self.get_oauth_token( - OAuth2GrantType::ClientCredentials, - None, - client_id, - client_secret, - Some("server_id".to_string()), - Some(server_id.to_string()), - ) - .await - } - - async fn get_oauth_token( - &self, - grant_type: OAuth2GrantType, - grant_value: Option, - client_id: u64, - client_secret: String, - subject_key: Option, - subject_value: Option, - ) -> Result { - let code = if grant_type == OAuth2GrantType::AuthorizationCode { - grant_value.clone() - } else { - None - }; - - let refresh_token = if grant_type == OAuth2GrantType::RefreshToken { - grant_value.clone() - } else { - None - }; - - let mut require_username = false; - - let password = if grant_type == OAuth2GrantType::Password { - require_username = true; - grant_value.clone() - } else { - None - }; - - let passkey = if grant_type == OAuth2GrantType::Passkey { - require_username = true; - grant_value.clone() - } else { - None - }; - - let username = if require_username && subject_value.is_some() { - subject_value.clone() - } else { - None - }; - - let request_body = OAuth2TokenRequest { - grant_type, - code, - refresh_token, - username, - password, - passkey, - client_id: Some(client_id.to_string()), - client_secret: Some(client_secret.clone()), - redirect_uri: None, - }; - - let params = if subject_key.is_some() && subject_value.is_some() { - format!("?{}={}", subject_key.unwrap(), subject_value.unwrap()) - } else { - "".to_string() - }; - - let url = format!("{}/v1/oauth2/token{}", self.base_url, params); - let headers = self.headers(); - let response = self - .http - .post(url) - .headers(headers) - .form(&request_body) - .send() - .await?; - - if response.status() != 200 { - return Err(Error::msg(format!( - "Failed to get token: {}", - response.status() - ))); - } - - Ok(response.json().await?) - } - - pub async fn get_user_info(&self) -> Result { - let url = format!("{}/v1/oauth2/userinfo", self.base_url); - let headers = self.headers(); - let response = self.http.get(url).headers(headers).send().await?; - - Ok(response.json().await?) - } - - pub async fn get_games(&self, page: Option) -> Result> { - let page = page.unwrap_or(1); - let url = format!("{}/v1/packages?page={}", self.base_url, page); - let headers = self.headers(); - let response = self.http.get(url).headers(headers).send().await?; - - Ok(response.json().await?) - } - - pub async fn get_game(&self, id: u64) -> Result { - let url = format!("{}/v1/packages/{}", self.base_url, id); - let headers = self.headers(); - let response = self.http.get(url).headers(headers).send().await?; - - Ok(response.json().await?) - } -} diff --git a/src/apis/configuration.rs b/src/apis/configuration.rs new file mode 100644 index 0000000..c1b63de --- /dev/null +++ b/src/apis/configuration.rs @@ -0,0 +1,51 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + + + +#[derive(Debug, Clone)] +pub struct Configuration { + pub base_path: String, + pub user_agent: Option, + pub client: reqwest::Client, + pub basic_auth: Option, + pub oauth_access_token: Option, + pub bearer_access_token: Option, + pub api_key: Option, +} + +pub type BasicAuth = (String, Option); + +#[derive(Debug, Clone)] +pub struct ApiKey { + pub prefix: Option, + pub key: String, +} + + +impl Configuration { + pub fn new() -> Configuration { + Configuration::default() + } +} + +impl Default for Configuration { + fn default() -> Self { + Configuration { + base_path: "http://localhost".to_owned(), + user_agent: Some("OpenAPI-Generator/1.1.0/rust".to_owned()), + client: reqwest::Client::new(), + basic_auth: None, + oauth_access_token: None, + bearer_access_token: None, + api_key: None, + } + } +} diff --git a/src/apis/mod.rs b/src/apis/mod.rs new file mode 100644 index 0000000..9b4e9fb --- /dev/null +++ b/src/apis/mod.rs @@ -0,0 +1,117 @@ +use std::error; +use std::fmt; + +#[derive(Debug, Clone)] +pub struct ResponseContent { + pub status: reqwest::StatusCode, + pub content: String, + pub entity: Option, +} + +#[derive(Debug)] +pub enum Error { + Reqwest(reqwest::Error), + Serde(serde_json::Error), + Io(std::io::Error), + ResponseError(ResponseContent), +} + +impl fmt::Display for Error { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let (module, e) = match self { + Error::Reqwest(e) => ("reqwest", e.to_string()), + Error::Serde(e) => ("serde", e.to_string()), + Error::Io(e) => ("IO", e.to_string()), + Error::ResponseError(e) => ("response", format!("status code {}", e.status)), + }; + write!(f, "error in {}: {}", module, e) + } +} + +impl error::Error for Error { + fn source(&self) -> Option<&(dyn error::Error + 'static)> { + Some(match self { + Error::Reqwest(e) => e, + Error::Serde(e) => e, + Error::Io(e) => e, + Error::ResponseError(_) => return None, + }) + } +} + +impl From for Error { + fn from(e: reqwest::Error) -> Self { + Error::Reqwest(e) + } +} + +impl From for Error { + fn from(e: serde_json::Error) -> Self { + Error::Serde(e) + } +} + +impl From for Error { + fn from(e: std::io::Error) -> Self { + Error::Io(e) + } +} + +pub fn urlencode>(s: T) -> String { + ::url::form_urlencoded::byte_serialize(s.as_ref().as_bytes()).collect() +} + +pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String, String)> { + if let serde_json::Value::Object(object) = value { + let mut params = vec![]; + + for (key, value) in object { + match value { + serde_json::Value::Object(_) => params.append(&mut parse_deep_object( + &format!("{}[{}]", prefix, key), + value, + )), + serde_json::Value::Array(array) => { + for (i, value) in array.iter().enumerate() { + params.append(&mut parse_deep_object( + &format!("{}[{}][{}]", prefix, key, i), + value, + )); + } + }, + serde_json::Value::String(s) => params.push((format!("{}[{}]", prefix, key), s.clone())), + _ => params.push((format!("{}[{}]", prefix, key), value.to_string())), + } + } + + return params; + } + + unimplemented!("Only objects are supported with style=deepObject") +} + +/// Internal use only +/// A content type supported by this client. +#[allow(dead_code)] +enum ContentType { + Json, + Text, + Unsupported(String) +} + +impl From<&str> for ContentType { + fn from(content_type: &str) -> Self { + if content_type.starts_with("application") && content_type.contains("json") { + return Self::Json; + } else if content_type.starts_with("text/plain") { + return Self::Text; + } else { + return Self::Unsupported(content_type.to_string()); + } + } +} + +pub mod tribufu_generated_api; + +pub mod configuration; + diff --git a/src/apis/tribufu_generated_api.rs b/src/apis/tribufu_generated_api.rs new file mode 100644 index 0000000..2322174 --- /dev/null +++ b/src/apis/tribufu_generated_api.rs @@ -0,0 +1,4148 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + + +use async_trait::async_trait; +use reqwest; +use std::sync::Arc; +use serde::{Deserialize, Serialize, de::Error as _}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; +use crate::apis::ContentType; + +#[async_trait] +pub trait TribufuGeneratedApi: Send + Sync { + + /// POST /v1/oauth2/authorize + /// + /// 🔒 Required permissions: tribufu.identity.oauth2.authorize + async fn authorize<'authorize_request>(&self, authorize_request: Option) -> Result<(), Error>; + + /// PUT /v1/users/{id}/email + /// + /// This endpoint is not available with an api key, only with a bearer token.

🔒 Required permissions: tribufu.identity.user.email.update + async fn change_email<'id, 'body>(&self, id: &'id str, body: Option) -> Result<(), Error>; + + /// PUT /v1/users/{id}/password + /// + /// This endpoint is not available with an api key, only with a bearer token.

🔒 Required permissions: tribufu.identity.user.password.update + async fn change_password<'id, 'body>(&self, id: &'id str, body: Option) -> Result<(), Error>; + + /// PUT /v1/servers/{id}/claim + /// + /// This endpoint is not available with an api key, only with a bearer token.

🔒 Required permissions: tribufu.community.game.server.claim + async fn claim_game_server<'id, 'body>(&self, id: &'id str, body: Option) -> Result<(), Error>; + + /// POST /v1/utils/base64 + /// + /// 🔒 Required permissions: tribufu.utils.convert.base64 + async fn convert_base64<'crypto_view_model>(&self, crypto_view_model: Option) -> Result>; + + /// POST /v1/servers + /// + /// 🔒 Required permissions: tribufu.community.game.server.create + async fn create_game_server<'body>(&self, body: Option) -> Result<(), Error>; + + /// POST /v1/clusters + /// + /// 🔒 Required permissions: tribufu.community.game.server.cluster.create + async fn create_game_server_cluster<'body>(&self, body: Option) -> Result<(), Error>; + + /// POST /v1/groups + /// + /// 🔒 Required permissions: tribufu.community.group.create + async fn create_group<'body>(&self, body: Option) -> Result<(), Error>; + + /// POST /v1/oauth2/token + /// + /// + async fn create_token<'token_request>(&self, token_request: Option) -> Result>; + + /// DELETE /v1/servers/{id} + /// + /// 🔒 Required permissions: tribufu.community.game.server.delete + async fn delete_game_server<'id>(&self, id: &'id str) -> Result<(), Error>; + + /// DELETE /v1/clusters/{id} + /// + /// 🔒 Required permissions: tribufu.community.game.server.cluster.delete + async fn delete_game_server_cluster<'id>(&self, id: &'id str) -> Result<(), Error>; + + /// DELETE /v1/groups/{id} + /// + /// 🔒 Required permissions: tribufu.community.group.delete + async fn delete_group<'id>(&self, id: &'id str) -> Result<(), Error>; + + /// GET /v1/utils/flake + /// + /// 🔒 Required permissions: tribufu.utils.generate.flake + async fn generate_flake_id<'amount>(&self, amount: Option) -> Result, Error>; + + /// GET /v1/utils/flake/{timestamp} + /// + /// 🔒 Required permissions: tribufu.utils.generate.flake.timestamp + async fn generate_flake_id_from_timestamp<'timestamp, 'amount>(&self, timestamp: &'timestamp str, amount: Option) -> Result, Error>; + + /// GET /v1/utils/password + /// + /// 🔒 Required permissions: tribufu.utils.generate.password + async fn generate_password<'length, 'symbols>(&self, length: Option, symbols: Option) -> Result>; + + /// GET /v1/utils/uuid + /// + /// 🔒 Required permissions: tribufu.utils.generate.uuid + async fn generate_uuid<'version, 'amount>(&self, version: Option, amount: Option) -> Result, Error>; + + /// GET /v1/oauth2/clientinfo + /// + /// + async fn get_client_info<>(&self, ) -> Result<(), Error>; + + /// GET /v1/geoip + /// + /// 🔒 Required permissions: tribufu.geoip.current + async fn get_current_ip_address<>(&self, ) -> Result, Error>; + + /// GET /v1/games/{id} + /// + /// 🔒 Required permissions: tribufu.community.game.get + async fn get_game_by_id<'id>(&self, id: &'id str) -> Result>; + + /// GET /v1/games/{id}/clusters + /// + /// 🔒 Required permissions: tribufu.community.game.server.cluster.list + async fn get_game_clusters_by_game_id<'id, 'page, 'limit>(&self, id: &'id str, page: Option, limit: Option) -> Result, Error>; + + /// GET /v1/games/{id}/items + /// + /// 🔒 Required permissions: tribufu.community.game.item.list + async fn get_game_items<'id, 'page, 'limit>(&self, id: &'id str, page: Option, limit: Option) -> Result, Error>; + + /// GET /v1/servers/address/{address}:{port} + /// + /// 🔒 Required permissions: tribufu.community.game.server.get.address + async fn get_game_server_by_address_and_query_port<'address, 'port>(&self, address: &'address str, port: i32) -> Result>; + + /// GET /v1/servers/{id} + /// + /// 🔒 Required permissions: tribufu.community.game.server.get + async fn get_game_server_by_id<'id>(&self, id: &'id str) -> Result>; + + /// GET /v1/clusters/{id} + /// + /// 🔒 Required permissions: tribufu.community.game.server.cluster.get + async fn get_game_server_cluster_by_id<'id>(&self, id: &'id str) -> Result>; + + /// GET /v1/clusters + /// + /// 🔒 Required permissions: tribufu.community.game.server.cluster.list + async fn get_game_server_clusters<'page, 'limit>(&self, page: Option, limit: Option) -> Result, Error>; + + /// GET /v1/servers + /// + /// 🔒 Required permissions: tribufu.community.game.server.list + async fn get_game_servers<'page, 'limit>(&self, page: Option, limit: Option) -> Result, Error>; + + /// GET /v1/servers/country/{country} + /// + /// 🔒 Required permissions: tribufu.community.game.server.list.country + async fn get_game_servers_by_country<'country, 'page, 'limit>(&self, country: &'country str, page: Option, limit: Option) -> Result, Error>; + + /// GET /v1/games/{id}/servers + /// + /// 🔒 Required permissions: tribufu.community.game.server.list + async fn get_game_servers_by_game_id<'id, 'page, 'limit>(&self, id: &'id str, page: Option, limit: Option) -> Result, Error>; + + /// GET /v1/servers/countries + /// + /// 🔒 Required permissions: tribufu.community.game.server.country.list + async fn get_game_servers_countries<>(&self, ) -> Result, Error>; + + /// GET /v1/servers/metrics + /// + /// 🔒 Required permissions: tribufu.community.game.server.metric.get + async fn get_game_servers_metrics<>(&self, ) -> Result>; + + /// GET /v1/games + /// + /// 🔒 Required permissions: tribufu.community.game.list + async fn get_games<>(&self, ) -> Result, Error>; + + /// GET /v1/groups/{id} + /// + /// 🔒 Required permissions: tribufu.community.group.get + async fn get_group_by_id<'id>(&self, id: &'id str) -> Result>; + + /// GET /v1/groups/tag/{tag} + /// + /// 🔒 Required permissions: tribufu.community.group.get.tag + async fn get_group_by_tag<'tag>(&self, tag: &'tag str) -> Result>; + + /// GET /v1/groups/uuid/{uuid} + /// + /// 🔒 Required permissions: tribufu.community.group.get.uuid + async fn get_group_by_uuid<'uuid>(&self, uuid: &str) -> Result>; + + /// GET /v1/groups/{id}/games + /// + /// 🔒 Required permissions: tribufu.community.group.game.list + async fn get_group_games<'id>(&self, id: &'id str) -> Result, Error>; + + /// GET /v1/groups/{id}/members + /// + /// 🔒 Required permissions: tribufu.community.group.member.list + async fn get_group_members<'id>(&self, id: &'id str) -> Result, Error>; + + /// GET /v1/groups + /// + /// 🔒 Required permissions: tribufu.community.group.list + async fn get_groups<'page, 'limit>(&self, page: Option, limit: Option) -> Result, Error>; + + /// GET /v1/geoip/addresses/{address} + /// + /// 🔒 Required permissions: tribufu.geoip.address.get + async fn get_ip_address<'address>(&self, address: &'address str) -> Result>; + + /// GET /v1/geoip/addresses + /// + /// 🔒 Required permissions: tribufu.geoip.address.list + async fn get_ip_addresses<'page, 'limit>(&self, page: Option, limit: Option) -> Result, Error>; + + /// GET /v1/leaderboard + /// + /// 🔒 Required permissions: tribufu.community.leaderboard.get + async fn get_leaderboard<'order>(&self, order: Option) -> Result, Error>; + + /// GET /v1/me + /// + /// + async fn get_me<>(&self, ) -> Result>; + + /// GET /v1/packages/{id} + /// + /// 🔒 Required permissions: tribufu.community.package.get + async fn get_package_by_id<'id>(&self, id: &'id str) -> Result>; + + /// GET /v1/packages + /// + /// 🔒 Required permissions: tribufu.community.package.list + async fn get_packages<'page, 'limit>(&self, page: Option, limit: Option) -> Result, Error>; + + /// GET /v1/oauth2/jwks + /// + /// 🔒 Required permissions: tribufu.identity.oauth2.client.keys + async fn get_public_keys<>(&self, ) -> Result<(), Error>; + + /// GET /v1/subscriptions/{id} + /// + /// 🔒 Required permissions: tribufu.store.subscription.get + async fn get_subscription_by_id<'id>(&self, id: &'id str) -> Result>; + + /// GET /v1/subscriptions + /// + /// 🔒 Required permissions: tribufu.store.subscription.list + async fn get_subscriptions<'page, 'limit>(&self, page: Option, limit: Option) -> Result, Error>; + + /// GET /v1/users/{id}/accounts + /// + /// 🔒 Required permissions: tribufu.identity.user.account.list + async fn get_user_accounts<'id>(&self, id: &'id str) -> Result, Error>; + + /// GET /v1/users/{id} + /// + /// 🔒 Required permissions: tribufu.community.profile.get + async fn get_user_by_id<'id>(&self, id: &'id str) -> Result>; + + /// GET /v1/users/name/{name} + /// + /// 🔒 Required permissions: tribufu.community.profile.get.name + async fn get_user_by_name<'name>(&self, name: &'name str) -> Result>; + + /// GET /v1/users/uuid/{uuid} + /// + /// 🔒 Required permissions: tribufu.community.profile.get.uuid + async fn get_user_by_uuid<'uuid>(&self, uuid: &str) -> Result>; + + /// GET /v1/users/{id}/friends + /// + /// 🔒 Required permissions: tribufu.community.profile.friend.list + async fn get_user_friends<'id>(&self, id: &'id str) -> Result, Error>; + + /// GET /v1/users/{id}/games + /// + /// 🔒 Required permissions: tribufu.community.profile.game.list + async fn get_user_games<'id>(&self, id: &'id str) -> Result, Error>; + + /// GET /v1/users/{id}/groups + /// + /// 🔒 Required permissions: tribufu.community.profile.group.list + async fn get_user_groups<'id>(&self, id: &'id str) -> Result, Error>; + + /// GET /v1/oauth2/userinfo + /// + /// 🔒 Required permissions: tribufu.identity.oauth2.user.info + async fn get_user_info<>(&self, ) -> Result>; + + /// GET /v1/users/{id}/punishments + /// + /// 🔒 Required permissions: tribufu.community.profile.punishment.list + async fn get_user_punishments<'id>(&self, id: &'id str) -> Result, Error>; + + /// GET /v1/users/{id}/servers + /// + /// 🔒 Required permissions: tribufu.community.profile.game.server.list + async fn get_user_servers<'id, 'page, 'limit>(&self, id: &'id str, page: Option, limit: Option) -> Result, Error>; + + /// GET /v1/users + /// + /// 🔒 Required permissions: tribufu.community.profile.list + async fn get_users<'page, 'limit>(&self, page: Option, limit: Option) -> Result, Error>; + + /// POST /v1/utils/argon2 + /// + /// 🔒 Required permissions: tribufu.utils.hash.argon2 + async fn hash_argon2<'hash_view_model>(&self, hash_view_model: Option) -> Result>; + + /// POST /v1/utils/bcrypt + /// + /// 🔒 Required permissions: tribufu.utils.hash.bcrypt + async fn hash_bcrypt<'hash_view_model>(&self, hash_view_model: Option) -> Result>; + + /// POST /v1/utils/md5 + /// + /// 🔒 Required permissions: tribufu.utils.hash.md5 + async fn hash_md5<'hash_view_model>(&self, hash_view_model: Option) -> Result>; + + /// POST /v1/utils/sha256 + /// + /// 🔒 Required permissions: tribufu.utils.hash.sha256 + async fn hash_sha256<'hash_view_model>(&self, hash_view_model: Option) -> Result>; + + /// POST /v1/oauth2/introspect + /// + /// 🔒 Required permissions: tribufu.identity.oauth2.token.introspect + async fn introspect_token<'introspect_request>(&self, introspect_request: Option) -> Result<(), Error>; + + /// POST /v1/login + /// + /// 🔒 Required permissions: tribufu.identity.token.create + async fn login<'login_request>(&self, login_request: Option) -> Result>; + + /// POST /v1/logout + /// + /// 🔒 Required permissions: tribufu.identity.token.revoke + async fn logout<>(&self, ) -> Result<(), Error>; + + /// POST /v1/refresh + /// + /// 🔒 Required permissions: tribufu.identity.token.refresh + async fn refresh<'refresh_request>(&self, refresh_request: Option) -> Result>; + + /// POST /v1/register + /// + /// 🔒 Required permissions: tribufu.identity.user.create + async fn register<'register_request>(&self, register_request: Option) -> Result>; + + /// POST /v1/oauth2/revoke + /// + /// 🔒 Required permissions: tribufu.identity.oauth2.token.revoke + async fn revoke_token<'revoke_request>(&self, revoke_request: Option) -> Result<(), Error>; + + /// POST /v1/search + /// + /// 🔒 Required permissions: tribufu.community.search + async fn search<'search_request>(&self, search_request: Option) -> Result, Error>; + + /// PUT /v1/servers/{id} + /// + /// 🔒 Required permissions: tribufu.community.game.server.update + async fn update_game_server<'id, 'body>(&self, id: &'id str, body: Option) -> Result<(), Error>; + + /// PUT /v1/clusters/{id} + /// + /// 🔒 Required permissions: tribufu.community.game.server.cluster.update + async fn update_game_server_cluster<'id, 'body>(&self, id: &'id str, body: Option) -> Result<(), Error>; + + /// PUT /v1/groups/{id} + /// + /// 🔒 Required permissions: tribufu.community.group.update + async fn update_group<'id, 'body>(&self, id: &'id str, body: Option) -> Result<(), Error>; + + /// PUT /v1/users/{id}/profile + /// + /// 🔒 Required permissions: tribufu.community.profile.update + async fn update_user_profile<'id, 'update_profile>(&self, id: &'id str, update_profile: Option) -> Result>; +} + +pub struct TribufuGeneratedApiClient { + configuration: Arc +} + +impl TribufuGeneratedApiClient { + pub fn new(configuration: Arc) -> Self { + Self { configuration } + } +} + + + +#[async_trait] +impl TribufuGeneratedApi for TribufuGeneratedApiClient { + /// 🔒 Required permissions: tribufu.identity.oauth2.authorize + async fn authorize<'authorize_request>(&self, authorize_request: Option) -> Result<(), Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/oauth2/authorize", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&authorize_request); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + Ok(()) + } else { + let local_var_entity: Option = 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)) + } + } + + /// This endpoint is not available with an api key, only with a bearer token.

🔒 Required permissions: tribufu.identity.user.email.update + async fn change_email<'id, 'body>(&self, id: &'id str, body: Option) -> Result<(), Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/users/{id}/email", local_var_configuration.base_path, id=crate::apis::urlencode(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 { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&body); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + Ok(()) + } else { + let local_var_entity: Option = 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)) + } + } + + /// This endpoint is not available with an api key, only with a bearer token.

🔒 Required permissions: tribufu.identity.user.password.update + async fn change_password<'id, 'body>(&self, id: &'id str, body: Option) -> Result<(), Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/users/{id}/password", local_var_configuration.base_path, id=crate::apis::urlencode(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 { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&body); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + Ok(()) + } else { + let local_var_entity: Option = 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)) + } + } + + /// This endpoint is not available with an api key, only with a bearer token.

🔒 Required permissions: tribufu.community.game.server.claim + async fn claim_game_server<'id, 'body>(&self, id: &'id str, body: Option) -> Result<(), Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/servers/{id}/claim", local_var_configuration.base_path, id=crate::apis::urlencode(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 { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&body); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + Ok(()) + } else { + let local_var_entity: Option = 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)) + } + } + + /// 🔒 Required permissions: tribufu.utils.convert.base64 + async fn convert_base64<'crypto_view_model>(&self, crypto_view_model: Option) -> Result> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/utils/base64", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&crypto_view_model); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CryptoViewModel`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `models::CryptoViewModel`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.community.game.server.create + async fn create_game_server<'body>(&self, body: Option) -> Result<(), Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/servers", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&body); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + Ok(()) + } else { + let local_var_entity: Option = 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)) + } + } + + /// 🔒 Required permissions: tribufu.community.game.server.cluster.create + async fn create_game_server_cluster<'body>(&self, body: Option) -> Result<(), Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/clusters", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&body); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + Ok(()) + } else { + let local_var_entity: Option = 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)) + } + } + + /// 🔒 Required permissions: tribufu.community.group.create + async fn create_group<'body>(&self, body: Option) -> Result<(), Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/groups", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&body); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + Ok(()) + } else { + let local_var_entity: Option = 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)) + } + } + + async fn create_token<'token_request>(&self, token_request: Option) -> Result> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/oauth2/token", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&token_request); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::TokenResponse`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `models::TokenResponse`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.community.game.server.delete + async fn delete_game_server<'id>(&self, id: &'id str) -> Result<(), Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/servers/{id}", local_var_configuration.base_path, id=crate::apis::urlencode(id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + Ok(()) + } else { + let local_var_entity: Option = 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)) + } + } + + /// 🔒 Required permissions: tribufu.community.game.server.cluster.delete + async fn delete_game_server_cluster<'id>(&self, id: &'id str) -> Result<(), Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/clusters/{id}", local_var_configuration.base_path, id=crate::apis::urlencode(id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + Ok(()) + } else { + let local_var_entity: Option = 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)) + } + } + + /// 🔒 Required permissions: tribufu.community.group.delete + async fn delete_group<'id>(&self, id: &'id str) -> Result<(), Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/groups/{id}", local_var_configuration.base_path, id=crate::apis::urlencode(id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + Ok(()) + } else { + let local_var_entity: Option = 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)) + } + } + + /// 🔒 Required permissions: tribufu.utils.generate.flake + async fn generate_flake_id<'amount>(&self, amount: Option) -> Result, Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/utils/flake", 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) = amount { + local_var_req_builder = local_var_req_builder.query(&[("amount", &local_var_str.to_string())]); + } + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<String>`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `Vec<String>`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.utils.generate.flake.timestamp + async fn generate_flake_id_from_timestamp<'timestamp, 'amount>(&self, timestamp: &'timestamp str, amount: Option) -> Result, Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/utils/flake/{timestamp}", local_var_configuration.base_path, timestamp=crate::apis::urlencode(timestamp)); + 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) = amount { + local_var_req_builder = local_var_req_builder.query(&[("amount", &local_var_str.to_string())]); + } + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<String>`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `Vec<String>`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.utils.generate.password + async fn generate_password<'length, 'symbols>(&self, length: Option, symbols: Option) -> Result> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/utils/password", 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) = length { + local_var_req_builder = local_var_req_builder.query(&[("length", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = symbols { + local_var_req_builder = local_var_req_builder.query(&[("symbols", &local_var_str.to_string())]); + } + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::HashViewModel`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `models::HashViewModel`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.utils.generate.uuid + async fn generate_uuid<'version, 'amount>(&self, version: Option, amount: Option) -> Result, Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/utils/uuid", 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) = version { + local_var_req_builder = local_var_req_builder.query(&[("version", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = amount { + local_var_req_builder = local_var_req_builder.query(&[("amount", &local_var_str.to_string())]); + } + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<uuid::Uuid>`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `Vec<uuid::Uuid>`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + async fn get_client_info<>(&self, ) -> Result<(), Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/oauth2/clientinfo", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + Ok(()) + } else { + let local_var_entity: Option = 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)) + } + } + + /// 🔒 Required permissions: tribufu.geoip.current + async fn get_current_ip_address<>(&self, ) -> Result, Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/geoip", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::IpAddress>`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `Vec<models::IpAddress>`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.community.game.get + async fn get_game_by_id<'id>(&self, id: &'id str) -> Result> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/games/{id}", local_var_configuration.base_path, id=crate::apis::urlencode(id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Game`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `models::Game`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.community.game.server.cluster.list + async fn get_game_clusters_by_game_id<'id, 'page, 'limit>(&self, id: &'id str, page: Option, limit: Option) -> Result, Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/games/{id}/clusters", local_var_configuration.base_path, id=crate::apis::urlencode(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_str) = page { + local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = limit { + local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + } + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GameServerCluster>`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `Vec<models::GameServerCluster>`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.community.game.item.list + async fn get_game_items<'id, 'page, 'limit>(&self, id: &'id str, page: Option, limit: Option) -> Result, Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/games/{id}/items", local_var_configuration.base_path, id=crate::apis::urlencode(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_str) = page { + local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = limit { + local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + } + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<serde_json::Value>`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `Vec<serde_json::Value>`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.community.game.server.get.address + async fn get_game_server_by_address_and_query_port<'address, 'port>(&self, address: &'address str, port: i32) -> Result> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/servers/address/{address}:{port}", local_var_configuration.base_path, address=crate::apis::urlencode(address), port=port); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GameServer`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `models::GameServer`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.community.game.server.get + async fn get_game_server_by_id<'id>(&self, id: &'id str) -> Result> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/servers/{id}", local_var_configuration.base_path, id=crate::apis::urlencode(id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GameServer`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `models::GameServer`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.community.game.server.cluster.get + async fn get_game_server_cluster_by_id<'id>(&self, id: &'id str) -> Result> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/clusters/{id}", local_var_configuration.base_path, id=crate::apis::urlencode(id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GameServerCluster`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `models::GameServerCluster`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.community.game.server.cluster.list + async fn get_game_server_clusters<'page, 'limit>(&self, page: Option, limit: Option) -> Result, Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/clusters", 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) = page { + local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = limit { + local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + } + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GameServerCluster>`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `Vec<models::GameServerCluster>`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.community.game.server.list + async fn get_game_servers<'page, 'limit>(&self, page: Option, limit: Option) -> Result, Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/servers", 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) = page { + local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = limit { + local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + } + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GameServer>`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `Vec<models::GameServer>`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.community.game.server.list.country + async fn get_game_servers_by_country<'country, 'page, 'limit>(&self, country: &'country str, page: Option, limit: Option) -> Result, Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/servers/country/{country}", local_var_configuration.base_path, country=crate::apis::urlencode(country)); + 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) = page { + local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = limit { + local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + } + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GameServer>`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `Vec<models::GameServer>`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.community.game.server.list + async fn get_game_servers_by_game_id<'id, 'page, 'limit>(&self, id: &'id str, page: Option, limit: Option) -> Result, Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/games/{id}/servers", local_var_configuration.base_path, id=crate::apis::urlencode(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_str) = page { + local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = limit { + local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + } + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GameServer>`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `Vec<models::GameServer>`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.community.game.server.country.list + async fn get_game_servers_countries<>(&self, ) -> Result, Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/servers/countries", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `std::collections::HashMap<String, i32>`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `std::collections::HashMap<String, i32>`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.community.game.server.metric.get + async fn get_game_servers_metrics<>(&self, ) -> Result> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/servers/metrics", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ServerMetrics`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `models::ServerMetrics`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.community.game.list + async fn get_games<>(&self, ) -> Result, Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/games", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Game>`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `Vec<models::Game>`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.community.group.get + async fn get_group_by_id<'id>(&self, id: &'id str) -> Result> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/groups/{id}", local_var_configuration.base_path, id=crate::apis::urlencode(id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Group`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `models::Group`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.community.group.get.tag + async fn get_group_by_tag<'tag>(&self, tag: &'tag str) -> Result> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/groups/tag/{tag}", local_var_configuration.base_path, tag=crate::apis::urlencode(tag)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Group`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `models::Group`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.community.group.get.uuid + async fn get_group_by_uuid<'uuid>(&self, uuid: &str) -> Result> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/groups/uuid/{uuid}", local_var_configuration.base_path, uuid=crate::apis::urlencode(uuid)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Group`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `models::Group`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.community.group.game.list + async fn get_group_games<'id>(&self, id: &'id str) -> Result, Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/groups/{id}/games", local_var_configuration.base_path, id=crate::apis::urlencode(id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GroupGame>`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `Vec<models::GroupGame>`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.community.group.member.list + async fn get_group_members<'id>(&self, id: &'id str) -> Result, Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/groups/{id}/members", local_var_configuration.base_path, id=crate::apis::urlencode(id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GroupMember>`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `Vec<models::GroupMember>`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.community.group.list + async fn get_groups<'page, 'limit>(&self, page: Option, limit: Option) -> Result, Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/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()); + + if let Some(ref local_var_str) = page { + local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = limit { + local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + } + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Group>`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `Vec<models::Group>`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.geoip.address.get + async fn get_ip_address<'address>(&self, address: &'address str) -> Result> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/geoip/addresses/{address}", local_var_configuration.base_path, address=crate::apis::urlencode(address)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::IpAddress`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `models::IpAddress`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.geoip.address.list + async fn get_ip_addresses<'page, 'limit>(&self, page: Option, limit: Option) -> Result, Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/geoip/addresses", 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) = page { + local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = limit { + local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + } + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::IpAddress>`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `Vec<models::IpAddress>`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.community.leaderboard.get + async fn get_leaderboard<'order>(&self, order: Option) -> Result, Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/leaderboard", 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) = order { + local_var_req_builder = local_var_req_builder.query(&[("Order", &local_var_str.to_string())]); + } + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::LeaderboardItem>`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `Vec<models::LeaderboardItem>`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + async fn get_me<>(&self, ) -> Result> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/me", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UserInfo`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `models::UserInfo`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.community.package.get + async fn get_package_by_id<'id>(&self, id: &'id str) -> Result> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/packages/{id}", local_var_configuration.base_path, id=crate::apis::urlencode(id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Package`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `models::Package`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.community.package.list + async fn get_packages<'page, 'limit>(&self, page: Option, limit: Option) -> Result, Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/packages", 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) = page { + local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = limit { + local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + } + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Package>`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `Vec<models::Package>`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.identity.oauth2.client.keys + async fn get_public_keys<>(&self, ) -> Result<(), Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/oauth2/jwks", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + Ok(()) + } else { + let local_var_entity: Option = 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)) + } + } + + /// 🔒 Required permissions: tribufu.store.subscription.get + async fn get_subscription_by_id<'id>(&self, id: &'id str) -> Result> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/subscriptions/{id}", local_var_configuration.base_path, id=crate::apis::urlencode(id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Subscription`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `models::Subscription`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.store.subscription.list + async fn get_subscriptions<'page, 'limit>(&self, page: Option, limit: Option) -> Result, Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/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()); + + if let Some(ref local_var_str) = page { + local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = limit { + local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + } + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Subscription>`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `Vec<models::Subscription>`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.identity.user.account.list + async fn get_user_accounts<'id>(&self, id: &'id str) -> Result, Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/users/{id}/accounts", local_var_configuration.base_path, id=crate::apis::urlencode(id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Account>`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `Vec<models::Account>`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.community.profile.get + async fn get_user_by_id<'id>(&self, id: &'id str) -> Result> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/users/{id}", local_var_configuration.base_path, id=crate::apis::urlencode(id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Profile`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `models::Profile`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.community.profile.get.name + async fn get_user_by_name<'name>(&self, name: &'name str) -> Result> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/users/name/{name}", local_var_configuration.base_path, name=crate::apis::urlencode(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 { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Profile`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `models::Profile`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.community.profile.get.uuid + async fn get_user_by_uuid<'uuid>(&self, uuid: &str) -> Result> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/users/uuid/{uuid}", local_var_configuration.base_path, uuid=crate::apis::urlencode(uuid)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Profile`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `models::Profile`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.community.profile.friend.list + async fn get_user_friends<'id>(&self, id: &'id str) -> Result, Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/users/{id}/friends", local_var_configuration.base_path, id=crate::apis::urlencode(id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<serde_json::Value>`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `Vec<serde_json::Value>`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.community.profile.game.list + async fn get_user_games<'id>(&self, id: &'id str) -> Result, Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/users/{id}/games", local_var_configuration.base_path, id=crate::apis::urlencode(id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::ProfileGame>`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `Vec<models::ProfileGame>`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.community.profile.group.list + async fn get_user_groups<'id>(&self, id: &'id str) -> Result, Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/users/{id}/groups", local_var_configuration.base_path, id=crate::apis::urlencode(id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::ProfileGroup>`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `Vec<models::ProfileGroup>`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.identity.oauth2.user.info + async fn get_user_info<>(&self, ) -> Result> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/oauth2/userinfo", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::UserInfo`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `models::UserInfo`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.community.profile.punishment.list + async fn get_user_punishments<'id>(&self, id: &'id str) -> Result, Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/users/{id}/punishments", local_var_configuration.base_path, id=crate::apis::urlencode(id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<serde_json::Value>`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `Vec<serde_json::Value>`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.community.profile.game.server.list + async fn get_user_servers<'id, 'page, 'limit>(&self, id: &'id str, page: Option, limit: Option) -> Result, Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/users/{id}/servers", local_var_configuration.base_path, id=crate::apis::urlencode(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_str) = page { + local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = limit { + local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + } + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::GameServer>`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `Vec<models::GameServer>`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.community.profile.list + async fn get_users<'page, 'limit>(&self, page: Option, limit: Option) -> Result, Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/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()); + + if let Some(ref local_var_str) = page { + local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]); + } + if let Some(ref local_var_str) = limit { + local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]); + } + 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()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Profile>`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `Vec<models::Profile>`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.utils.hash.argon2 + async fn hash_argon2<'hash_view_model>(&self, hash_view_model: Option) -> Result> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/utils/argon2", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&hash_view_model); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::HashViewModel`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `models::HashViewModel`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.utils.hash.bcrypt + async fn hash_bcrypt<'hash_view_model>(&self, hash_view_model: Option) -> Result> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/utils/bcrypt", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&hash_view_model); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::HashViewModel`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `models::HashViewModel`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.utils.hash.md5 + async fn hash_md5<'hash_view_model>(&self, hash_view_model: Option) -> Result> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/utils/md5", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&hash_view_model); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::HashViewModel`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `models::HashViewModel`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.utils.hash.sha256 + async fn hash_sha256<'hash_view_model>(&self, hash_view_model: Option) -> Result> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/utils/sha256", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&hash_view_model); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::HashViewModel`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `models::HashViewModel`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.identity.oauth2.token.introspect + async fn introspect_token<'introspect_request>(&self, introspect_request: Option) -> Result<(), Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/oauth2/introspect", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&introspect_request); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + Ok(()) + } else { + let local_var_entity: Option = 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)) + } + } + + /// 🔒 Required permissions: tribufu.identity.token.create + async fn login<'login_request>(&self, login_request: Option) -> Result> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/login", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&login_request); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LoginResponse`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `models::LoginResponse`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.identity.token.revoke + async fn logout<>(&self, ) -> Result<(), Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/logout", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + Ok(()) + } else { + let local_var_entity: Option = 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)) + } + } + + /// 🔒 Required permissions: tribufu.identity.token.refresh + async fn refresh<'refresh_request>(&self, refresh_request: Option) -> Result> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/refresh", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&refresh_request); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LoginResponse`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `models::LoginResponse`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.identity.user.create + async fn register<'register_request>(&self, register_request: Option) -> Result> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/register", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(®ister_request); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LoginResponse`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `models::LoginResponse`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.identity.oauth2.token.revoke + async fn revoke_token<'revoke_request>(&self, revoke_request: Option) -> Result<(), Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/oauth2/revoke", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&revoke_request); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + Ok(()) + } else { + let local_var_entity: Option = 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)) + } + } + + /// 🔒 Required permissions: tribufu.community.search + async fn search<'search_request>(&self, search_request: Option) -> Result, Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/search", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&search_request); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<serde_json::Value>`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `Vec<serde_json::Value>`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + + /// 🔒 Required permissions: tribufu.community.game.server.update + async fn update_game_server<'id, 'body>(&self, id: &'id str, body: Option) -> Result<(), Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/servers/{id}", local_var_configuration.base_path, id=crate::apis::urlencode(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 { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&body); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + Ok(()) + } else { + let local_var_entity: Option = 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)) + } + } + + /// 🔒 Required permissions: tribufu.community.game.server.cluster.update + async fn update_game_server_cluster<'id, 'body>(&self, id: &'id str, body: Option) -> Result<(), Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/clusters/{id}", local_var_configuration.base_path, id=crate::apis::urlencode(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 { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&body); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + Ok(()) + } else { + let local_var_entity: Option = 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)) + } + } + + /// 🔒 Required permissions: tribufu.community.group.update + async fn update_group<'id, 'body>(&self, id: &'id str, body: Option) -> Result<(), Error> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/groups/{id}", local_var_configuration.base_path, id=crate::apis::urlencode(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 { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&body); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + Ok(()) + } else { + let local_var_entity: Option = 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)) + } + } + + /// 🔒 Required permissions: tribufu.community.profile.update + async fn update_user_profile<'id, 'update_profile>(&self, id: &'id str, update_profile: Option) -> Result> { + let local_var_configuration = &self.configuration; + + let local_var_client = &local_var_configuration.client; + + let local_var_uri_str = format!("{}/v1/users/{id}/profile", local_var_configuration.base_path, id=crate::apis::urlencode(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 { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + if let Some(ref local_var_apikey) = local_var_configuration.api_key { + let local_var_key = local_var_apikey.key.clone(); + let local_var_value = match local_var_apikey.prefix { + Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key), + None => local_var_key, + }; + local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value); + }; + local_var_req_builder = local_var_req_builder.json(&update_profile); + + let local_var_req = local_var_req_builder.build()?; + let local_var_resp = local_var_client.execute(local_var_req).await?; + + let local_var_status = local_var_resp.status(); + let local_var_content_type = local_var_resp + .headers() + .get("content-type") + .and_then(|v| v.to_str().ok()) + .unwrap_or("application/octet-stream"); + let local_var_content_type = super::ContentType::from(local_var_content_type); + let local_var_content = local_var_resp.text().await?; + + if !local_var_status.is_client_error() && !local_var_status.is_server_error() { + match local_var_content_type { + ContentType::Json => serde_json::from_str(&local_var_content).map_err(Error::from), + ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Profile`"))), + ContentType::Unsupported(local_var_unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{local_var_unknown_type}` content type response that cannot be converted to `models::Profile`")))), + } + } else { + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + Err(Error::ResponseError(local_var_error)) + } + } + +} + +/// struct for typed errors of method [`authorize`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum AuthorizeError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`change_email`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ChangeEmailError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`change_password`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ChangePasswordError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`claim_game_server`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ClaimGameServerError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`convert_base64`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ConvertBase64Error { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`create_game_server`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum CreateGameServerError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`create_game_server_cluster`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum CreateGameServerClusterError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`create_group`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum CreateGroupError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`create_token`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum CreateTokenError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`delete_game_server`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DeleteGameServerError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`delete_game_server_cluster`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DeleteGameServerClusterError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`delete_group`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DeleteGroupError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`generate_flake_id`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GenerateFlakeIdError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`generate_flake_id_from_timestamp`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GenerateFlakeIdFromTimestampError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`generate_password`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GeneratePasswordError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`generate_uuid`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GenerateUuidError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_client_info`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetClientInfoError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_current_ip_address`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetCurrentIpAddressError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_game_by_id`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetGameByIdError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_game_clusters_by_game_id`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetGameClustersByGameIdError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_game_items`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetGameItemsError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_game_server_by_address_and_query_port`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetGameServerByAddressAndQueryPortError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_game_server_by_id`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetGameServerByIdError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_game_server_cluster_by_id`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetGameServerClusterByIdError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_game_server_clusters`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetGameServerClustersError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_game_servers`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetGameServersError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_game_servers_by_country`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetGameServersByCountryError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_game_servers_by_game_id`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetGameServersByGameIdError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_game_servers_countries`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetGameServersCountriesError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_game_servers_metrics`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetGameServersMetricsError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_games`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetGamesError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_group_by_id`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetGroupByIdError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_group_by_tag`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetGroupByTagError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_group_by_uuid`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetGroupByUuidError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_group_games`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetGroupGamesError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_group_members`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetGroupMembersError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_groups`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetGroupsError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_ip_address`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetIpAddressError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_ip_addresses`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetIpAddressesError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_leaderboard`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetLeaderboardError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_me`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetMeError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_package_by_id`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetPackageByIdError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_packages`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetPackagesError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_public_keys`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetPublicKeysError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_subscription_by_id`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetSubscriptionByIdError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_subscriptions`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetSubscriptionsError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_user_accounts`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetUserAccountsError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_user_by_id`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetUserByIdError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_user_by_name`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetUserByNameError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_user_by_uuid`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetUserByUuidError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_user_friends`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetUserFriendsError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_user_games`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetUserGamesError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_user_groups`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetUserGroupsError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_user_info`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetUserInfoError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_user_punishments`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetUserPunishmentsError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_user_servers`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetUserServersError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`get_users`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetUsersError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`hash_argon2`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum HashArgon2Error { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`hash_bcrypt`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum HashBcryptError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`hash_md5`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum HashMd5Error { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`hash_sha256`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum HashSha256Error { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`introspect_token`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum IntrospectTokenError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`login`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum LoginError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`logout`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum LogoutError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`refresh`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum RefreshError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`register`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum RegisterError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`revoke_token`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum RevokeTokenError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`search`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum SearchError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`update_game_server`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum UpdateGameServerError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`update_game_server_cluster`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum UpdateGameServerClusterError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`update_group`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum UpdateGroupError { + UnknownValue(serde_json::Value), +} + +/// struct for typed errors of method [`update_user_profile`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum UpdateUserProfileError { + UnknownValue(serde_json::Value), +} + diff --git a/src/constants/Cargo.toml b/src/constants/Cargo.toml deleted file mode 100644 index 1e60de3..0000000 --- a/src/constants/Cargo.toml +++ /dev/null @@ -1,16 +0,0 @@ -[package] -name = "tribufu-constants" -version = "0.1.0" -description = "Tribufu Constants" -repository = "https://github.com/Tribufu/TribufuRust" -authors = ["Tribufu "] -license = "MIT" -edition = "2021" -publish = true - -[lib] -name = "tribufu_constants" -crate-type = ["rlib"] -path = "lib.rs" - -[dependencies] diff --git a/src/constants/lib.rs b/src/constants/lib.rs deleted file mode 100644 index e0fcb7e..0000000 --- a/src/constants/lib.rs +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright (c) Tribufu. All Rights Reserved. - -pub const VERSION: &str = env!("CARGO_PKG_VERSION"); diff --git a/src/lib.rs b/src/lib.rs index d5ea72e..b0d81a9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,111 @@ // Copyright (c) Tribufu. All Rights Reserved. +// SPDX-License-Identifier: MIT -pub use tribufu_api::*; -pub use tribufu_constants::VERSION; -pub use tribufu_types as types; +#![allow(unused_imports)] +#![allow(clippy::too_many_arguments)] + +use crate::apis::configuration::{ApiKey, Configuration}; +use crate::apis::tribufu_generated_api::TribufuGeneratedApiClient; +use reqwest::Client; +use std::env::{self, consts}; +use std::sync::Arc; + +pub mod apis; +pub mod models; + +/// Use this to interact with the Tribufu API. +pub struct TribufuApi; + +impl TribufuApi { + /// The default base URL for the Tribufu API. + pub const DEFAULT_BASE_URL: &'static str = "https://api.tribufu.com"; + + /// Create a TribufuApi instance. + pub fn new(api_key: Option) -> TribufuGeneratedApiClient { + let configuration = Self::create_configuration(api_key); + let configuration_arc = Arc::new(configuration); + TribufuGeneratedApiClient::new(configuration_arc) + } + + /// Create a TribufuApi with the default options. + pub fn default() -> TribufuGeneratedApiClient { + Self::new(None) + } + + /// Create a TribufuApi with the given API key. + /// + /// An API key gives you public read only access to the Tribufu API. + pub fn with_api_key(api_key: String) -> TribufuGeneratedApiClient { + Self::new(Some(api_key)) + } + + /// Try to create a TribufuApi from environment variables. + /// + /// This will only work if the environment variables are set. + pub fn from_env(prefix: Option<&str>) -> Option { + let prefix = prefix.unwrap_or("TRIBUFU"); + let api_key_var = format!("{}_API_KEY", prefix); + if let Ok(api_key) = env::var(api_key_var) { + if !api_key.trim().is_empty() { + return Some(Self::with_api_key(api_key)); + } + } + None + } + + /// Create a TribufuApi from environment variables or the default API. + /// + /// This will fallback to the default API if the environment variables are not set. + pub fn from_env_or_default(prefix: Option<&str>) -> TribufuGeneratedApiClient { + Self::from_env(prefix).unwrap_or_else(Self::default) + } + + /// Gets the version of the Tribufu API client. + pub fn get_version() -> String { + env!("CARGO_PKG_VERSION").to_owned() + } + + /// Gets the user agent string for the Tribufu API client. + pub fn get_user_agent() -> String { + let version = Self::get_version(); + format!("Tribufu/{} ({}; {})", version, consts::OS, consts::ARCH) + } + + /// Checks if debug mode is enabled. + pub fn debug_enabled() -> bool { + cfg!(debug_assertions) + } + + /// Get the base URL for the Tribufu API. + fn get_base_url() -> String { + if let Ok(base_url) = env::var("TRIBUFU_API_URL") { + if Self::debug_enabled() && !base_url.trim().is_empty() { + return base_url; + } + } + + Self::DEFAULT_BASE_URL.to_string() + } + + /// Creates a configuration for the Tribufu API client. + fn create_configuration(api_key: Option) -> Configuration { + let base_path = Self::get_base_url(); + let user_agent = Some(Self::get_user_agent()); + + let api_key_obj = if let Some(api_key) = api_key { + Some(ApiKey { + prefix: Some("ApiKey".to_owned()), + key: api_key, + }) + } else { + None + }; + + Configuration { + base_path, + user_agent, + api_key: api_key_obj, + ..Default::default() + } + } +} diff --git a/src/models/account.rs b/src/models/account.rs new file mode 100644 index 0000000..6d76e4b --- /dev/null +++ b/src/models/account.rs @@ -0,0 +1,48 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Account { + #[serde(rename = "id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub id: Option>, + #[serde(rename = "name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub name: Option>, + #[serde(rename = "provider", skip_serializing_if = "Option::is_none")] + pub provider: Option, + #[serde(rename = "user_id", skip_serializing_if = "Option::is_none")] + pub user_id: Option, + #[serde(rename = "authorized", skip_serializing_if = "Option::is_none")] + pub authorized: Option, + #[serde(rename = "fields", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub fields: Option>, + #[serde(rename = "created", skip_serializing_if = "Option::is_none")] + pub created: Option, + #[serde(rename = "updated", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub updated: Option>, +} + +impl Account { + pub fn new() -> Account { + Account { + id: None, + name: None, + provider: None, + user_id: None, + authorized: None, + fields: None, + created: None, + updated: None, + } + } +} + diff --git a/src/models/application.rs b/src/models/application.rs new file mode 100644 index 0000000..e395e0e --- /dev/null +++ b/src/models/application.rs @@ -0,0 +1,84 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Application { + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub name: Option>, + #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub description: Option>, + #[serde(rename = "type", skip_serializing_if = "Option::is_none")] + pub r#type: Option, + #[serde(rename = "organization_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub organization_id: Option>, + #[serde(rename = "icon_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub icon_url: Option>, + #[serde(rename = "banner_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub banner_url: Option>, + #[serde(rename = "capsule_image_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub capsule_image_url: Option>, + #[serde(rename = "library_image_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub library_image_url: Option>, + #[serde(rename = "parent_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub parent_id: Option>, + #[serde(rename = "slug", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub slug: Option>, + #[serde(rename = "visibility", skip_serializing_if = "Option::is_none")] + pub visibility: Option, + #[serde(rename = "password", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub password: Option>, + #[serde(rename = "primary", skip_serializing_if = "Option::is_none")] + pub primary: Option, + #[serde(rename = "user_count", skip_serializing_if = "Option::is_none")] + pub user_count: Option, + #[serde(rename = "achievement_count", skip_serializing_if = "Option::is_none")] + pub achievement_count: Option, + #[serde(rename = "badge_count", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub badge_count: Option>, + #[serde(rename = "download_count", skip_serializing_if = "Option::is_none")] + pub download_count: Option, + #[serde(rename = "created", skip_serializing_if = "Option::is_none")] + pub created: Option, + #[serde(rename = "updated", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub updated: Option>, +} + +impl Application { + pub fn new() -> Application { + Application { + id: None, + name: None, + description: None, + r#type: None, + organization_id: None, + icon_url: None, + banner_url: None, + capsule_image_url: None, + library_image_url: None, + parent_id: None, + slug: None, + visibility: None, + password: None, + primary: None, + user_count: None, + achievement_count: None, + badge_count: None, + download_count: None, + created: None, + updated: None, + } + } +} + diff --git a/src/models/application_type.rs b/src/models/application_type.rs new file mode 100644 index 0000000..7f0d437 --- /dev/null +++ b/src/models/application_type.rs @@ -0,0 +1,38 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum ApplicationType { + #[serde(rename = "application")] + Application, + #[serde(rename = "game")] + Game, + +} + +impl std::fmt::Display for ApplicationType { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + match self { + Self::Application => write!(f, "application"), + Self::Game => write!(f, "game"), + } + } +} + +impl Default for ApplicationType { + fn default() -> ApplicationType { + Self::Application + } +} + diff --git a/src/models/authorize_request.rs b/src/models/authorize_request.rs new file mode 100644 index 0000000..59ec297 --- /dev/null +++ b/src/models/authorize_request.rs @@ -0,0 +1,45 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct AuthorizeRequest { + #[serde(rename = "response_type", skip_serializing_if = "Option::is_none")] + pub response_type: Option, + #[serde(rename = "client_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub client_id: Option>, + #[serde(rename = "code_challenge", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub code_challenge: Option>, + #[serde(rename = "code_challenge_method", skip_serializing_if = "Option::is_none")] + pub code_challenge_method: Option, + #[serde(rename = "redirect_uri", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub redirect_uri: Option>, + #[serde(rename = "scope", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub scope: Option>, + #[serde(rename = "state", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub state: Option>, +} + +impl AuthorizeRequest { + pub fn new() -> AuthorizeRequest { + AuthorizeRequest { + response_type: None, + client_id: None, + code_challenge: None, + code_challenge_method: None, + redirect_uri: None, + scope: None, + state: None, + } + } +} + diff --git a/src/models/code_challenge_method.rs b/src/models/code_challenge_method.rs new file mode 100644 index 0000000..6279001 --- /dev/null +++ b/src/models/code_challenge_method.rs @@ -0,0 +1,38 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum CodeChallengeMethod { + #[serde(rename = "plain")] + Plain, + #[serde(rename = "S256")] + S256, + +} + +impl std::fmt::Display for CodeChallengeMethod { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + match self { + Self::Plain => write!(f, "plain"), + Self::S256 => write!(f, "S256"), + } + } +} + +impl Default for CodeChallengeMethod { + fn default() -> CodeChallengeMethod { + Self::Plain + } +} + diff --git a/src/models/crypto_view_model.rs b/src/models/crypto_view_model.rs new file mode 100644 index 0000000..b3bf759 --- /dev/null +++ b/src/models/crypto_view_model.rs @@ -0,0 +1,30 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct CryptoViewModel { + #[serde(rename = "encoded", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub encoded: Option>, + #[serde(rename = "decoded", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub decoded: Option>, +} + +impl CryptoViewModel { + pub fn new() -> CryptoViewModel { + CryptoViewModel { + encoded: None, + decoded: None, + } + } +} + diff --git a/src/models/game.rs b/src/models/game.rs new file mode 100644 index 0000000..5a0a010 --- /dev/null +++ b/src/models/game.rs @@ -0,0 +1,117 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Game { + #[serde(rename = "game_port", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub game_port: Option>, + #[serde(rename = "query_port", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub query_port: Option>, + #[serde(rename = "rcon_port", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub rcon_port: Option>, + #[serde(rename = "server_count", skip_serializing_if = "Option::is_none")] + pub server_count: Option, + #[serde(rename = "steam_app_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub steam_app_id: Option>, + #[serde(rename = "steam_server_app_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub steam_server_app_id: Option>, + #[serde(rename = "enable_servers", skip_serializing_if = "Option::is_none")] + pub enable_servers: Option, + #[serde(rename = "rust_gamedig_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub rust_gamedig_id: Option>, + #[serde(rename = "node_gamedig_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub node_gamedig_id: Option>, + #[serde(rename = "server_connect_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub server_connect_url: Option>, + #[serde(rename = "server_tags", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub server_tags: Option>, + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub name: Option>, + #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub description: Option>, + #[serde(rename = "type", skip_serializing_if = "Option::is_none")] + pub r#type: Option, + #[serde(rename = "organization_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub organization_id: Option>, + #[serde(rename = "icon_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub icon_url: Option>, + #[serde(rename = "banner_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub banner_url: Option>, + #[serde(rename = "capsule_image_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub capsule_image_url: Option>, + #[serde(rename = "library_image_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub library_image_url: Option>, + #[serde(rename = "parent_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub parent_id: Option>, + #[serde(rename = "slug", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub slug: Option>, + #[serde(rename = "visibility", skip_serializing_if = "Option::is_none")] + pub visibility: Option, + #[serde(rename = "password", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub password: Option>, + #[serde(rename = "primary", skip_serializing_if = "Option::is_none")] + pub primary: Option, + #[serde(rename = "user_count", skip_serializing_if = "Option::is_none")] + pub user_count: Option, + #[serde(rename = "achievement_count", skip_serializing_if = "Option::is_none")] + pub achievement_count: Option, + #[serde(rename = "badge_count", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub badge_count: Option>, + #[serde(rename = "download_count", skip_serializing_if = "Option::is_none")] + pub download_count: Option, + #[serde(rename = "created", skip_serializing_if = "Option::is_none")] + pub created: Option, + #[serde(rename = "updated", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub updated: Option>, +} + +impl Game { + pub fn new() -> Game { + Game { + game_port: None, + query_port: None, + rcon_port: None, + server_count: None, + steam_app_id: None, + steam_server_app_id: None, + enable_servers: None, + rust_gamedig_id: None, + node_gamedig_id: None, + server_connect_url: None, + server_tags: None, + id: None, + name: None, + description: None, + r#type: None, + organization_id: None, + icon_url: None, + banner_url: None, + capsule_image_url: None, + library_image_url: None, + parent_id: None, + slug: None, + visibility: None, + password: None, + primary: None, + user_count: None, + achievement_count: None, + badge_count: None, + download_count: None, + created: None, + updated: None, + } + } +} + diff --git a/src/models/game_server.rs b/src/models/game_server.rs new file mode 100644 index 0000000..7d1026f --- /dev/null +++ b/src/models/game_server.rs @@ -0,0 +1,117 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct GameServer { + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub name: Option>, + #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub description: Option>, + #[serde(rename = "address", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub address: Option>, + #[serde(rename = "game_port", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub game_port: Option>, + #[serde(rename = "query_port", skip_serializing_if = "Option::is_none")] + pub query_port: Option, + #[serde(rename = "game_id", skip_serializing_if = "Option::is_none")] + pub game_id: Option, + #[serde(rename = "game_icon_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub game_icon_url: Option>, + #[serde(rename = "version", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub version: Option>, + #[serde(rename = "featured", skip_serializing_if = "Option::is_none")] + pub featured: Option, + #[serde(rename = "cluster_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub cluster_id: Option>, + #[serde(rename = "website_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub website_url: Option>, + #[serde(rename = "banner_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub banner_url: Option>, + #[serde(rename = "owner_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub owner_id: Option>, + #[serde(rename = "uptime", skip_serializing_if = "Option::is_none")] + pub uptime: Option, + #[serde(rename = "status", skip_serializing_if = "Option::is_none")] + pub status: Option, + #[serde(rename = "ping", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub ping: Option>, + #[serde(rename = "map", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub map: Option>, + #[serde(rename = "used_slots", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub used_slots: Option>, + #[serde(rename = "max_slots", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub max_slots: Option>, + #[serde(rename = "motd", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub motd: Option>, + #[serde(rename = "players", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub players: Option>, + #[serde(rename = "last_online", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub last_online: Option>, + #[serde(rename = "country", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub country: Option>, + #[serde(rename = "steam", skip_serializing_if = "Option::is_none")] + pub steam: Option, + #[serde(rename = "discord_server_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub discord_server_id: Option>, + #[serde(rename = "youtube_video_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub youtube_video_url: Option>, + #[serde(rename = "tags", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub tags: Option>, + #[serde(rename = "comment_count", skip_serializing_if = "Option::is_none")] + pub comment_count: Option, + #[serde(rename = "created", skip_serializing_if = "Option::is_none")] + pub created: Option, + #[serde(rename = "updated", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub updated: Option>, +} + +impl GameServer { + pub fn new() -> GameServer { + GameServer { + id: None, + name: None, + description: None, + address: None, + game_port: None, + query_port: None, + game_id: None, + game_icon_url: None, + version: None, + featured: None, + cluster_id: None, + website_url: None, + banner_url: None, + owner_id: None, + uptime: None, + status: None, + ping: None, + map: None, + used_slots: None, + max_slots: None, + motd: None, + players: None, + last_online: None, + country: None, + steam: None, + discord_server_id: None, + youtube_video_url: None, + tags: None, + comment_count: None, + created: None, + updated: None, + } + } +} + diff --git a/src/models/game_server_cluster.rs b/src/models/game_server_cluster.rs new file mode 100644 index 0000000..7ab5c67 --- /dev/null +++ b/src/models/game_server_cluster.rs @@ -0,0 +1,66 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct GameServerCluster { + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub name: Option>, + #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub description: Option>, + #[serde(rename = "game_id", skip_serializing_if = "Option::is_none")] + pub game_id: Option, + #[serde(rename = "website_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub website_url: Option>, + #[serde(rename = "banner_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub banner_url: Option>, + #[serde(rename = "owner_id", skip_serializing_if = "Option::is_none")] + pub owner_id: Option, + #[serde(rename = "discord_server_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub discord_server_id: Option>, + #[serde(rename = "youtube_video_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub youtube_video_url: Option>, + #[serde(rename = "tags", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub tags: Option>, + #[serde(rename = "comment_count", skip_serializing_if = "Option::is_none")] + pub comment_count: Option, + #[serde(rename = "server_count", skip_serializing_if = "Option::is_none")] + pub server_count: Option, + #[serde(rename = "created", skip_serializing_if = "Option::is_none")] + pub created: Option, + #[serde(rename = "updated", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub updated: Option>, +} + +impl GameServerCluster { + pub fn new() -> GameServerCluster { + GameServerCluster { + id: None, + name: None, + description: None, + game_id: None, + website_url: None, + banner_url: None, + owner_id: None, + discord_server_id: None, + youtube_video_url: None, + tags: None, + comment_count: None, + server_count: None, + created: None, + updated: None, + } + } +} + diff --git a/src/models/grant_type.rs b/src/models/grant_type.rs new file mode 100644 index 0000000..25efa8b --- /dev/null +++ b/src/models/grant_type.rs @@ -0,0 +1,44 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum GrantType { + #[serde(rename = "authorization_code")] + AuthorizationCode, + #[serde(rename = "client_credentials")] + ClientCredentials, + #[serde(rename = "password")] + Password, + #[serde(rename = "refresh_token")] + RefreshToken, + +} + +impl std::fmt::Display for GrantType { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + match self { + Self::AuthorizationCode => write!(f, "authorization_code"), + Self::ClientCredentials => write!(f, "client_credentials"), + Self::Password => write!(f, "password"), + Self::RefreshToken => write!(f, "refresh_token"), + } + } +} + +impl Default for GrantType { + fn default() -> GrantType { + Self::AuthorizationCode + } +} + diff --git a/src/models/group.rs b/src/models/group.rs new file mode 100644 index 0000000..76b96b2 --- /dev/null +++ b/src/models/group.rs @@ -0,0 +1,72 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Group { + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "uuid", skip_serializing_if = "Option::is_none")] + pub uuid: Option, + #[serde(rename = "name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub name: Option>, + #[serde(rename = "tag", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub tag: Option>, + #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub description: Option>, + #[serde(rename = "type", skip_serializing_if = "Option::is_none")] + pub r#type: Option, + #[serde(rename = "privacy", skip_serializing_if = "Option::is_none")] + pub privacy: Option, + #[serde(rename = "owner_id", skip_serializing_if = "Option::is_none")] + pub owner_id: Option, + #[serde(rename = "verified", skip_serializing_if = "Option::is_none")] + pub verified: Option, + #[serde(rename = "photo_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub photo_url: Option>, + #[serde(rename = "banner_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub banner_url: Option>, + #[serde(rename = "member_count", skip_serializing_if = "Option::is_none")] + pub member_count: Option, + #[serde(rename = "follower_count", skip_serializing_if = "Option::is_none")] + pub follower_count: Option, + #[serde(rename = "view_count", skip_serializing_if = "Option::is_none")] + pub view_count: Option, + #[serde(rename = "created", skip_serializing_if = "Option::is_none")] + pub created: Option, + #[serde(rename = "updated", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub updated: Option>, +} + +impl Group { + pub fn new() -> Group { + Group { + id: None, + uuid: None, + name: None, + tag: None, + description: None, + r#type: None, + privacy: None, + owner_id: None, + verified: None, + photo_url: None, + banner_url: None, + member_count: None, + follower_count: None, + view_count: None, + created: None, + updated: None, + } + } +} + diff --git a/src/models/group_game.rs b/src/models/group_game.rs new file mode 100644 index 0000000..30a2504 --- /dev/null +++ b/src/models/group_game.rs @@ -0,0 +1,45 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct GroupGame { + #[serde(rename = "group_id", skip_serializing_if = "Option::is_none")] + pub group_id: Option, + #[serde(rename = "group", skip_serializing_if = "Option::is_none")] + pub group: Option>, + #[serde(rename = "application_id", skip_serializing_if = "Option::is_none")] + pub application_id: Option, + #[serde(rename = "application", skip_serializing_if = "Option::is_none")] + pub application: Option>, + #[serde(rename = "stats", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub stats: Option>, + #[serde(rename = "acquired", skip_serializing_if = "Option::is_none")] + pub acquired: Option, + #[serde(rename = "last_used", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub last_used: Option>, +} + +impl GroupGame { + pub fn new() -> GroupGame { + GroupGame { + group_id: None, + group: None, + application_id: None, + application: None, + stats: None, + acquired: None, + last_used: None, + } + } +} + diff --git a/src/models/group_member.rs b/src/models/group_member.rs new file mode 100644 index 0000000..54349cb --- /dev/null +++ b/src/models/group_member.rs @@ -0,0 +1,51 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct GroupMember { + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "uuid", skip_serializing_if = "Option::is_none")] + pub uuid: Option, + #[serde(rename = "name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub name: Option>, + #[serde(rename = "display_name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub display_name: Option>, + #[serde(rename = "verified", skip_serializing_if = "Option::is_none")] + pub verified: Option, + #[serde(rename = "photo_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub photo_url: Option>, + #[serde(rename = "last_online", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub last_online: Option>, + #[serde(rename = "rank", skip_serializing_if = "Option::is_none")] + pub rank: Option, + #[serde(rename = "since", skip_serializing_if = "Option::is_none")] + pub since: Option, +} + +impl GroupMember { + pub fn new() -> GroupMember { + GroupMember { + id: None, + uuid: None, + name: None, + display_name: None, + verified: None, + photo_url: None, + last_online: None, + rank: None, + since: None, + } + } +} + diff --git a/src/models/group_rank.rs b/src/models/group_rank.rs new file mode 100644 index 0000000..8781fdf --- /dev/null +++ b/src/models/group_rank.rs @@ -0,0 +1,41 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum GroupRank { + #[serde(rename = "member")] + Member, + #[serde(rename = "leader")] + Leader, + #[serde(rename = "owner")] + Owner, + +} + +impl std::fmt::Display for GroupRank { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + match self { + Self::Member => write!(f, "member"), + Self::Leader => write!(f, "leader"), + Self::Owner => write!(f, "owner"), + } + } +} + +impl Default for GroupRank { + fn default() -> GroupRank { + Self::Member + } +} + diff --git a/src/models/hash_view_model.rs b/src/models/hash_view_model.rs new file mode 100644 index 0000000..0fb0ed1 --- /dev/null +++ b/src/models/hash_view_model.rs @@ -0,0 +1,27 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct HashViewModel { + #[serde(rename = "value", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub value: Option>, +} + +impl HashViewModel { + pub fn new() -> HashViewModel { + HashViewModel { + value: None, + } + } +} + diff --git a/src/models/introspect_request.rs b/src/models/introspect_request.rs new file mode 100644 index 0000000..8b55f4e --- /dev/null +++ b/src/models/introspect_request.rs @@ -0,0 +1,30 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct IntrospectRequest { + #[serde(rename = "token", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub token: Option>, + #[serde(rename = "token_type_hint", skip_serializing_if = "Option::is_none")] + pub token_type_hint: Option, +} + +impl IntrospectRequest { + pub fn new() -> IntrospectRequest { + IntrospectRequest { + token: None, + token_type_hint: None, + } + } +} + diff --git a/src/models/ip_address.rs b/src/models/ip_address.rs new file mode 100644 index 0000000..01db6ba --- /dev/null +++ b/src/models/ip_address.rs @@ -0,0 +1,78 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct IpAddress { + #[serde(rename = "address", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub address: Option>, + #[serde(rename = "version", skip_serializing_if = "Option::is_none")] + pub version: Option, + #[serde(rename = "network", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub network: Option>, + #[serde(rename = "reserved", skip_serializing_if = "Option::is_none")] + pub reserved: Option, + #[serde(rename = "asn", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub asn: Option>, + #[serde(rename = "isp", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub isp: Option>, + #[serde(rename = "continent", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub continent: Option>, + #[serde(rename = "country", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub country: Option>, + #[serde(rename = "region", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub region: Option>, + #[serde(rename = "city", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub city: Option>, + #[serde(rename = "postal_code", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub postal_code: Option>, + #[serde(rename = "calling_code", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub calling_code: Option>, + #[serde(rename = "tld", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub tld: Option>, + #[serde(rename = "language", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub language: Option>, + #[serde(rename = "timezone", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub timezone: Option>, + #[serde(rename = "currency", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub currency: Option>, + #[serde(rename = "latitude", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub latitude: Option>, + #[serde(rename = "longitude", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub longitude: Option>, +} + +impl IpAddress { + pub fn new() -> IpAddress { + IpAddress { + address: None, + version: None, + network: None, + reserved: None, + asn: None, + isp: None, + continent: None, + country: None, + region: None, + city: None, + postal_code: None, + calling_code: None, + tld: None, + language: None, + timezone: None, + currency: None, + latitude: None, + longitude: None, + } + } +} + diff --git a/src/models/leaderboard_item.rs b/src/models/leaderboard_item.rs new file mode 100644 index 0000000..3bbfa7e --- /dev/null +++ b/src/models/leaderboard_item.rs @@ -0,0 +1,42 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct LeaderboardItem { + #[serde(rename = "name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub name: Option>, + #[serde(rename = "display_name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub display_name: Option>, + #[serde(rename = "photo_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub photo_url: Option>, + #[serde(rename = "level", skip_serializing_if = "Option::is_none")] + pub level: Option, + #[serde(rename = "experience", skip_serializing_if = "Option::is_none")] + pub experience: Option, + #[serde(rename = "points", skip_serializing_if = "Option::is_none")] + pub points: Option, +} + +impl LeaderboardItem { + pub fn new() -> LeaderboardItem { + LeaderboardItem { + name: None, + display_name: None, + photo_url: None, + level: None, + experience: None, + points: None, + } + } +} + diff --git a/src/models/leaderboard_order.rs b/src/models/leaderboard_order.rs new file mode 100644 index 0000000..a705d2a --- /dev/null +++ b/src/models/leaderboard_order.rs @@ -0,0 +1,38 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum LeaderboardOrder { + #[serde(rename = "level")] + Level, + #[serde(rename = "points")] + Points, + +} + +impl std::fmt::Display for LeaderboardOrder { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + match self { + Self::Level => write!(f, "level"), + Self::Points => write!(f, "points"), + } + } +} + +impl Default for LeaderboardOrder { + fn default() -> LeaderboardOrder { + Self::Level + } +} + diff --git a/src/models/login_provider.rs b/src/models/login_provider.rs new file mode 100644 index 0000000..c358bda --- /dev/null +++ b/src/models/login_provider.rs @@ -0,0 +1,53 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum LoginProvider { + #[serde(rename = "steam")] + Steam, + #[serde(rename = "epic")] + Epic, + #[serde(rename = "discord")] + Discord, + #[serde(rename = "microsoft")] + Microsoft, + #[serde(rename = "playstation")] + Playstation, + #[serde(rename = "google")] + Google, + #[serde(rename = "apple")] + Apple, + +} + +impl std::fmt::Display for LoginProvider { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + match self { + Self::Steam => write!(f, "steam"), + Self::Epic => write!(f, "epic"), + Self::Discord => write!(f, "discord"), + Self::Microsoft => write!(f, "microsoft"), + Self::Playstation => write!(f, "playstation"), + Self::Google => write!(f, "google"), + Self::Apple => write!(f, "apple"), + } + } +} + +impl Default for LoginProvider { + fn default() -> LoginProvider { + Self::Steam + } +} + diff --git a/src/models/login_request.rs b/src/models/login_request.rs new file mode 100644 index 0000000..8665e6a --- /dev/null +++ b/src/models/login_request.rs @@ -0,0 +1,30 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct LoginRequest { + #[serde(rename = "login", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub login: Option>, + #[serde(rename = "password", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub password: Option>, +} + +impl LoginRequest { + pub fn new() -> LoginRequest { + LoginRequest { + login: None, + password: None, + } + } +} + diff --git a/src/models/login_response.rs b/src/models/login_response.rs new file mode 100644 index 0000000..f816e09 --- /dev/null +++ b/src/models/login_response.rs @@ -0,0 +1,36 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct LoginResponse { + #[serde(rename = "user", skip_serializing_if = "Option::is_none")] + pub user: Option>, + #[serde(rename = "access_token", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub access_token: Option>, + #[serde(rename = "refresh_token", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub refresh_token: Option>, + #[serde(rename = "expires_in", skip_serializing_if = "Option::is_none")] + pub expires_in: Option, +} + +impl LoginResponse { + pub fn new() -> LoginResponse { + LoginResponse { + user: None, + access_token: None, + refresh_token: None, + expires_in: None, + } + } +} + diff --git a/src/models/mod.rs b/src/models/mod.rs new file mode 100644 index 0000000..f1e76a9 --- /dev/null +++ b/src/models/mod.rs @@ -0,0 +1,84 @@ +pub mod account; +pub use self::account::Account; +pub mod application; +pub use self::application::Application; +pub mod application_type; +pub use self::application_type::ApplicationType; +pub mod authorize_request; +pub use self::authorize_request::AuthorizeRequest; +pub mod code_challenge_method; +pub use self::code_challenge_method::CodeChallengeMethod; +pub mod crypto_view_model; +pub use self::crypto_view_model::CryptoViewModel; +pub mod game; +pub use self::game::Game; +pub mod game_server; +pub use self::game_server::GameServer; +pub mod game_server_cluster; +pub use self::game_server_cluster::GameServerCluster; +pub mod grant_type; +pub use self::grant_type::GrantType; +pub mod group; +pub use self::group::Group; +pub mod group_game; +pub use self::group_game::GroupGame; +pub mod group_member; +pub use self::group_member::GroupMember; +pub mod group_rank; +pub use self::group_rank::GroupRank; +pub mod hash_view_model; +pub use self::hash_view_model::HashViewModel; +pub mod introspect_request; +pub use self::introspect_request::IntrospectRequest; +pub mod ip_address; +pub use self::ip_address::IpAddress; +pub mod leaderboard_item; +pub use self::leaderboard_item::LeaderboardItem; +pub mod leaderboard_order; +pub use self::leaderboard_order::LeaderboardOrder; +pub mod login_provider; +pub use self::login_provider::LoginProvider; +pub mod login_request; +pub use self::login_request::LoginRequest; +pub mod login_response; +pub use self::login_response::LoginResponse; +pub mod package; +pub use self::package::Package; +pub mod profile; +pub use self::profile::Profile; +pub mod profile_game; +pub use self::profile_game::ProfileGame; +pub mod profile_group; +pub use self::profile_group::ProfileGroup; +pub mod refresh_request; +pub use self::refresh_request::RefreshRequest; +pub mod register_request; +pub use self::register_request::RegisterRequest; +pub mod response_type; +pub use self::response_type::ResponseType; +pub mod revoke_request; +pub use self::revoke_request::RevokeRequest; +pub mod search_request; +pub use self::search_request::SearchRequest; +pub mod search_type; +pub use self::search_type::SearchType; +pub mod server_metrics; +pub use self::server_metrics::ServerMetrics; +pub mod server_status; +pub use self::server_status::ServerStatus; +pub mod subscription; +pub use self::subscription::Subscription; +pub mod token_hint_type; +pub use self::token_hint_type::TokenHintType; +pub mod token_request; +pub use self::token_request::TokenRequest; +pub mod token_response; +pub use self::token_response::TokenResponse; +pub mod token_type; +pub use self::token_type::TokenType; +pub mod update_profile; +pub use self::update_profile::UpdateProfile; +pub mod user_info; +pub use self::user_info::UserInfo; +pub mod user_type; +pub use self::user_type::UserType; diff --git a/src/models/package.rs b/src/models/package.rs new file mode 100644 index 0000000..0d8e0b1 --- /dev/null +++ b/src/models/package.rs @@ -0,0 +1,60 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Package { + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub name: Option>, + #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub description: Option>, + #[serde(rename = "image_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub image_url: Option>, + #[serde(rename = "author_id", skip_serializing_if = "Option::is_none")] + pub author_id: Option, + #[serde(rename = "version", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub version: Option>, + #[serde(rename = "file_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub file_url: Option>, + #[serde(rename = "raw_size", skip_serializing_if = "Option::is_none")] + pub raw_size: Option, + #[serde(rename = "download_count", skip_serializing_if = "Option::is_none")] + pub download_count: Option, + #[serde(rename = "last_download", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub last_download: Option>, + #[serde(rename = "created", skip_serializing_if = "Option::is_none")] + pub created: Option, + #[serde(rename = "updated", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub updated: Option>, +} + +impl Package { + pub fn new() -> Package { + Package { + id: None, + name: None, + description: None, + image_url: None, + author_id: None, + version: None, + file_url: None, + raw_size: None, + download_count: None, + last_download: None, + created: None, + updated: None, + } + } +} + diff --git a/src/models/profile.rs b/src/models/profile.rs new file mode 100644 index 0000000..d44904a --- /dev/null +++ b/src/models/profile.rs @@ -0,0 +1,78 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Profile { + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "uuid", skip_serializing_if = "Option::is_none")] + pub uuid: Option, + #[serde(rename = "name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub name: Option>, + #[serde(rename = "display_name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub display_name: Option>, + #[serde(rename = "verified", skip_serializing_if = "Option::is_none")] + pub verified: Option, + #[serde(rename = "level", skip_serializing_if = "Option::is_none")] + pub level: Option, + #[serde(rename = "experience", skip_serializing_if = "Option::is_none")] + pub experience: Option, + #[serde(rename = "public_birthday", skip_serializing_if = "Option::is_none")] + pub public_birthday: Option, + #[serde(rename = "birthday", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub birthday: Option>, + #[serde(rename = "points", skip_serializing_if = "Option::is_none")] + pub points: Option, + #[serde(rename = "location", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub location: Option>, + #[serde(rename = "photo_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub photo_url: Option>, + #[serde(rename = "banner_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub banner_url: Option>, + #[serde(rename = "last_online", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub last_online: Option>, + #[serde(rename = "biography", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub biography: Option>, + #[serde(rename = "view_count", skip_serializing_if = "Option::is_none")] + pub view_count: Option, + #[serde(rename = "created", skip_serializing_if = "Option::is_none")] + pub created: Option, + #[serde(rename = "updated", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub updated: Option>, +} + +impl Profile { + pub fn new() -> Profile { + Profile { + id: None, + uuid: None, + name: None, + display_name: None, + verified: None, + level: None, + experience: None, + public_birthday: None, + birthday: None, + points: None, + location: None, + photo_url: None, + banner_url: None, + last_online: None, + biography: None, + view_count: None, + created: None, + updated: None, + } + } +} + diff --git a/src/models/profile_game.rs b/src/models/profile_game.rs new file mode 100644 index 0000000..14861c8 --- /dev/null +++ b/src/models/profile_game.rs @@ -0,0 +1,57 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProfileGame { + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub name: Option>, + #[serde(rename = "capsule_image_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub capsule_image_url: Option>, + #[serde(rename = "library_image_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub library_image_url: Option>, + #[serde(rename = "slug", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub slug: Option>, + #[serde(rename = "time_used", skip_serializing_if = "Option::is_none")] + pub time_used: Option, + #[serde(rename = "unlocked_achievements", skip_serializing_if = "Option::is_none")] + pub unlocked_achievements: Option, + #[serde(rename = "total_achievements", skip_serializing_if = "Option::is_none")] + pub total_achievements: Option, + #[serde(rename = "stats", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub stats: Option>, + #[serde(rename = "acquired", skip_serializing_if = "Option::is_none")] + pub acquired: Option, + #[serde(rename = "last_used", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub last_used: Option>, +} + +impl ProfileGame { + pub fn new() -> ProfileGame { + ProfileGame { + id: None, + name: None, + capsule_image_url: None, + library_image_url: None, + slug: None, + time_used: None, + unlocked_achievements: None, + total_achievements: None, + stats: None, + acquired: None, + last_used: None, + } + } +} + diff --git a/src/models/profile_group.rs b/src/models/profile_group.rs new file mode 100644 index 0000000..7b55912 --- /dev/null +++ b/src/models/profile_group.rs @@ -0,0 +1,54 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ProfileGroup { + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "uuid", skip_serializing_if = "Option::is_none")] + pub uuid: Option, + #[serde(rename = "name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub name: Option>, + #[serde(rename = "tag", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub tag: Option>, + #[serde(rename = "privacy", skip_serializing_if = "Option::is_none")] + pub privacy: Option, + #[serde(rename = "verified", skip_serializing_if = "Option::is_none")] + pub verified: Option, + #[serde(rename = "photo_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub photo_url: Option>, + #[serde(rename = "member_count", skip_serializing_if = "Option::is_none")] + pub member_count: Option, + #[serde(rename = "rank", skip_serializing_if = "Option::is_none")] + pub rank: Option, + #[serde(rename = "since", skip_serializing_if = "Option::is_none")] + pub since: Option, +} + +impl ProfileGroup { + pub fn new() -> ProfileGroup { + ProfileGroup { + id: None, + uuid: None, + name: None, + tag: None, + privacy: None, + verified: None, + photo_url: None, + member_count: None, + rank: None, + since: None, + } + } +} + diff --git a/src/models/refresh_request.rs b/src/models/refresh_request.rs new file mode 100644 index 0000000..dda194c --- /dev/null +++ b/src/models/refresh_request.rs @@ -0,0 +1,27 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct RefreshRequest { + #[serde(rename = "refresh_token", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub refresh_token: Option>, +} + +impl RefreshRequest { + pub fn new() -> RefreshRequest { + RefreshRequest { + refresh_token: None, + } + } +} + diff --git a/src/models/register_request.rs b/src/models/register_request.rs new file mode 100644 index 0000000..7b5fda8 --- /dev/null +++ b/src/models/register_request.rs @@ -0,0 +1,36 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct RegisterRequest { + #[serde(rename = "uuid", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub uuid: Option>, + #[serde(rename = "name")] + pub name: String, + #[serde(rename = "email", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub email: Option>, + #[serde(rename = "password")] + pub password: String, +} + +impl RegisterRequest { + pub fn new(name: String, password: String) -> RegisterRequest { + RegisterRequest { + uuid: None, + name, + email: None, + password, + } + } +} + diff --git a/src/models/response_type.rs b/src/models/response_type.rs new file mode 100644 index 0000000..217d266 --- /dev/null +++ b/src/models/response_type.rs @@ -0,0 +1,38 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum ResponseType { + #[serde(rename = "code")] + Code, + #[serde(rename = "token")] + Token, + +} + +impl std::fmt::Display for ResponseType { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + match self { + Self::Code => write!(f, "code"), + Self::Token => write!(f, "token"), + } + } +} + +impl Default for ResponseType { + fn default() -> ResponseType { + Self::Code + } +} + diff --git a/src/models/revoke_request.rs b/src/models/revoke_request.rs new file mode 100644 index 0000000..4e27b96 --- /dev/null +++ b/src/models/revoke_request.rs @@ -0,0 +1,30 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct RevokeRequest { + #[serde(rename = "token", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub token: Option>, + #[serde(rename = "token_type_hint", skip_serializing_if = "Option::is_none")] + pub token_type_hint: Option, +} + +impl RevokeRequest { + pub fn new() -> RevokeRequest { + RevokeRequest { + token: None, + token_type_hint: None, + } + } +} + diff --git a/src/models/search_request.rs b/src/models/search_request.rs new file mode 100644 index 0000000..c80a894 --- /dev/null +++ b/src/models/search_request.rs @@ -0,0 +1,36 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct SearchRequest { + #[serde(rename = "type", skip_serializing_if = "Option::is_none")] + pub r#type: Option, + #[serde(rename = "query", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub query: Option>, + #[serde(rename = "page", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub page: Option>, + #[serde(rename = "game_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub game_id: Option>, +} + +impl SearchRequest { + pub fn new() -> SearchRequest { + SearchRequest { + r#type: None, + query: None, + page: None, + game_id: None, + } + } +} + diff --git a/src/models/search_type.rs b/src/models/search_type.rs new file mode 100644 index 0000000..2d936a5 --- /dev/null +++ b/src/models/search_type.rs @@ -0,0 +1,44 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum SearchType { + #[serde(rename = "user")] + User, + #[serde(rename = "group")] + Group, + #[serde(rename = "server")] + Server, + #[serde(rename = "cluster")] + Cluster, + +} + +impl std::fmt::Display for SearchType { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + match self { + Self::User => write!(f, "user"), + Self::Group => write!(f, "group"), + Self::Server => write!(f, "server"), + Self::Cluster => write!(f, "cluster"), + } + } +} + +impl Default for SearchType { + fn default() -> SearchType { + Self::User + } +} + diff --git a/src/models/server_metrics.rs b/src/models/server_metrics.rs new file mode 100644 index 0000000..77a70ba --- /dev/null +++ b/src/models/server_metrics.rs @@ -0,0 +1,33 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct ServerMetrics { + #[serde(rename = "server_count", skip_serializing_if = "Option::is_none")] + pub server_count: Option, + #[serde(rename = "package_count", skip_serializing_if = "Option::is_none")] + pub package_count: Option, + #[serde(rename = "country_count", skip_serializing_if = "Option::is_none")] + pub country_count: Option, +} + +impl ServerMetrics { + pub fn new() -> ServerMetrics { + ServerMetrics { + server_count: None, + package_count: None, + country_count: None, + } + } +} + diff --git a/src/models/server_status.rs b/src/models/server_status.rs new file mode 100644 index 0000000..dcf32c3 --- /dev/null +++ b/src/models/server_status.rs @@ -0,0 +1,41 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum ServerStatus { + #[serde(rename = "unknown")] + Unknown, + #[serde(rename = "offline")] + Offline, + #[serde(rename = "online")] + Online, + +} + +impl std::fmt::Display for ServerStatus { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + match self { + Self::Unknown => write!(f, "unknown"), + Self::Offline => write!(f, "offline"), + Self::Online => write!(f, "online"), + } + } +} + +impl Default for ServerStatus { + fn default() -> ServerStatus { + Self::Unknown + } +} + diff --git a/src/models/subscription.rs b/src/models/subscription.rs new file mode 100644 index 0000000..c5d876f --- /dev/null +++ b/src/models/subscription.rs @@ -0,0 +1,45 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct Subscription { + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub name: Option>, + #[serde(rename = "description", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub description: Option>, + #[serde(rename = "image_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub image_url: Option>, + #[serde(rename = "prices", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub prices: Option>>, + #[serde(rename = "created", skip_serializing_if = "Option::is_none")] + pub created: Option, + #[serde(rename = "updated", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub updated: Option>, +} + +impl Subscription { + pub fn new() -> Subscription { + Subscription { + id: None, + name: None, + description: None, + image_url: None, + prices: None, + created: None, + updated: None, + } + } +} + diff --git a/src/models/token_hint_type.rs b/src/models/token_hint_type.rs new file mode 100644 index 0000000..c1875a1 --- /dev/null +++ b/src/models/token_hint_type.rs @@ -0,0 +1,38 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum TokenHintType { + #[serde(rename = "access_token")] + AccessToken, + #[serde(rename = "refresh_token")] + RefreshToken, + +} + +impl std::fmt::Display for TokenHintType { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + match self { + Self::AccessToken => write!(f, "access_token"), + Self::RefreshToken => write!(f, "refresh_token"), + } + } +} + +impl Default for TokenHintType { + fn default() -> TokenHintType { + Self::AccessToken + } +} + diff --git a/src/models/token_request.rs b/src/models/token_request.rs new file mode 100644 index 0000000..7f05d62 --- /dev/null +++ b/src/models/token_request.rs @@ -0,0 +1,48 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct TokenRequest { + #[serde(rename = "grant_type", skip_serializing_if = "Option::is_none")] + pub grant_type: Option, + #[serde(rename = "code", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub code: Option>, + #[serde(rename = "username", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub username: Option>, + #[serde(rename = "password", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub password: Option>, + #[serde(rename = "refresh_token", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub refresh_token: Option>, + #[serde(rename = "client_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub client_id: Option>, + #[serde(rename = "redirect_uri", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub redirect_uri: Option>, + #[serde(rename = "code_verifier", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub code_verifier: Option>, +} + +impl TokenRequest { + pub fn new() -> TokenRequest { + TokenRequest { + grant_type: None, + code: None, + username: None, + password: None, + refresh_token: None, + client_id: None, + redirect_uri: None, + code_verifier: None, + } + } +} + diff --git a/src/models/token_response.rs b/src/models/token_response.rs new file mode 100644 index 0000000..0a0bebb --- /dev/null +++ b/src/models/token_response.rs @@ -0,0 +1,42 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct TokenResponse { + #[serde(rename = "token_type", skip_serializing_if = "Option::is_none")] + pub token_type: Option, + #[serde(rename = "access_token", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub access_token: Option>, + #[serde(rename = "refresh_token", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub refresh_token: Option>, + #[serde(rename = "scope", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub scope: Option>, + #[serde(rename = "state", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub state: Option>, + #[serde(rename = "expires_in", skip_serializing_if = "Option::is_none")] + pub expires_in: Option, +} + +impl TokenResponse { + pub fn new() -> TokenResponse { + TokenResponse { + token_type: None, + access_token: None, + refresh_token: None, + scope: None, + state: None, + expires_in: None, + } + } +} + diff --git a/src/models/token_type.rs b/src/models/token_type.rs new file mode 100644 index 0000000..fda55ca --- /dev/null +++ b/src/models/token_type.rs @@ -0,0 +1,35 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum TokenType { + #[serde(rename = "bearer")] + Bearer, + +} + +impl std::fmt::Display for TokenType { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + match self { + Self::Bearer => write!(f, "bearer"), + } + } +} + +impl Default for TokenType { + fn default() -> TokenType { + Self::Bearer + } +} + diff --git a/src/models/update_profile.rs b/src/models/update_profile.rs new file mode 100644 index 0000000..6b025dc --- /dev/null +++ b/src/models/update_profile.rs @@ -0,0 +1,30 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct UpdateProfile { + #[serde(rename = "display_name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub display_name: Option>, + #[serde(rename = "biography", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub biography: Option>, +} + +impl UpdateProfile { + pub fn new() -> UpdateProfile { + UpdateProfile { + display_name: None, + biography: None, + } + } +} + diff --git a/src/models/user_info.rs b/src/models/user_info.rs new file mode 100644 index 0000000..e81dadb --- /dev/null +++ b/src/models/user_info.rs @@ -0,0 +1,99 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct UserInfo { + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] + pub id: Option, + #[serde(rename = "uuid", skip_serializing_if = "Option::is_none")] + pub uuid: Option, + #[serde(rename = "name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub name: Option>, + #[serde(rename = "display_name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub display_name: Option>, + #[serde(rename = "email", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub email: Option>, + #[serde(rename = "type", skip_serializing_if = "Option::is_none")] + pub r#type: Option, + #[serde(rename = "flags", skip_serializing_if = "Option::is_none")] + pub flags: Option, + #[serde(rename = "permissions", skip_serializing_if = "Option::is_none")] + pub permissions: Option, + #[serde(rename = "verified", skip_serializing_if = "Option::is_none")] + pub verified: Option, + #[serde(rename = "level", skip_serializing_if = "Option::is_none")] + pub level: Option, + #[serde(rename = "experience", skip_serializing_if = "Option::is_none")] + pub experience: Option, + #[serde(rename = "public_birthday", skip_serializing_if = "Option::is_none")] + pub public_birthday: Option, + #[serde(rename = "birthday", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub birthday: Option>, + #[serde(rename = "points", skip_serializing_if = "Option::is_none")] + pub points: Option, + #[serde(rename = "location", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub location: Option>, + #[serde(rename = "language", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub language: Option>, + #[serde(rename = "timezone", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub timezone: Option>, + #[serde(rename = "currency", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub currency: Option>, + #[serde(rename = "photo_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub photo_url: Option>, + #[serde(rename = "banner_url", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub banner_url: Option>, + #[serde(rename = "last_online", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub last_online: Option>, + #[serde(rename = "biography", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub biography: Option>, + #[serde(rename = "view_count", skip_serializing_if = "Option::is_none")] + pub view_count: Option, + #[serde(rename = "created", skip_serializing_if = "Option::is_none")] + pub created: Option, + #[serde(rename = "updated", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + pub updated: Option>, +} + +impl UserInfo { + pub fn new() -> UserInfo { + UserInfo { + id: None, + uuid: None, + name: None, + display_name: None, + email: None, + r#type: None, + flags: None, + permissions: None, + verified: None, + level: None, + experience: None, + public_birthday: None, + birthday: None, + points: None, + location: None, + language: None, + timezone: None, + currency: None, + photo_url: None, + banner_url: None, + last_online: None, + biography: None, + view_count: None, + created: None, + updated: None, + } + } +} + diff --git a/src/models/user_type.rs b/src/models/user_type.rs new file mode 100644 index 0000000..e6962b5 --- /dev/null +++ b/src/models/user_type.rs @@ -0,0 +1,38 @@ +/* + * Tribufu API + * + * REST API to access Tribufu services. + * + * The version of the OpenAPI document: 1.1.0 + * Contact: contact@tribufu.com + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +/// +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum UserType { + #[serde(rename = "user")] + User, + #[serde(rename = "bot")] + Bot, + +} + +impl std::fmt::Display for UserType { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + match self { + Self::User => write!(f, "user"), + Self::Bot => write!(f, "bot"), + } + } +} + +impl Default for UserType { + fn default() -> UserType { + Self::User + } +} + diff --git a/src/types/Cargo.toml b/src/types/Cargo.toml deleted file mode 100644 index 0c27ce2..0000000 --- a/src/types/Cargo.toml +++ /dev/null @@ -1,22 +0,0 @@ -[package] -name = "tribufu-types" -version = "0.1.0" -description = "Tribufu Types" -repository = "https://github.com/Tribufu/TribufuRust" -authors = ["Tribufu "] -license = "MIT" -edition = "2021" -publish = true - -[lib] -name = "tribufu_types" -crate-type = ["rlib"] -path = "lib.rs" - -[dependencies] -chrono = { version = "0.4.22", features = ["serde", "rustc-serialize"] } -derive_more = "0.99.17" -mintaka-error = { version = "0.0.1" } -serde = { version = "1.0", features = ["derive"] } -serde_json = { version = "1.0", features = ["raw_value"] } -serde_with = "3.4.0" diff --git a/src/types/games.rs b/src/types/games.rs deleted file mode 100644 index e34c3ad..0000000 --- a/src/types/games.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Tribufu. All Rights Reserved. - -use chrono::NaiveDateTime; -use serde::{Deserialize, Serialize}; -use serde_with::{serde_as, DisplayFromStr}; - -#[serde_as] -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct Game { - #[serde_as(as = "DisplayFromStr")] - pub id: u64, - pub name: String, - pub description: Option, - pub icon_url: Option, - pub banner_url: Option, - pub capsule_image_url: Option, - pub library_image_url: Option, - pub slug: Option, - pub game_port: Option, - pub query_port: Option, - pub rcon_port: Option, - pub steam_app_id: Option, - pub steam_server_app_id: Option, - pub rust_gamedig_id: Option, - pub node_gamedig_id: Option, - pub server_connect_url: Option, - pub created: NaiveDateTime, - pub updated: Option, -} diff --git a/src/types/lib.rs b/src/types/lib.rs deleted file mode 100644 index 2b62ff2..0000000 --- a/src/types/lib.rs +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright (c) Tribufu. All Rights Reserved. - -pub mod games; -pub mod oauth2; -pub mod servers; -pub mod users; diff --git a/src/types/oauth2.rs b/src/types/oauth2.rs deleted file mode 100644 index 0c74a83..0000000 --- a/src/types/oauth2.rs +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright (c) Tribufu. All Rights Reserved. - -use serde::{Deserialize, Serialize}; - -#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq, Eq)] -#[serde(rename_all = "snake_case")] -pub enum OAuth2ResponseType { - Code, - Token, -} - -#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq, Eq)] -#[serde(rename_all = "snake_case")] -pub enum OAuth2ClientType { - Confidential, - Public, -} - -#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq, Eq)] -#[serde(rename_all = "snake_case")] -pub enum OAuth2TokenHintType { - AccessToken, - RefreshToken, -} - -#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq, Eq)] -#[serde(rename_all = "snake_case")] -pub enum OAuth2GrantType { - AuthorizationCode, - ClientCredentials, - DeviceCode, - Passkey, - Password, - RefreshToken, -} - -#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq, Eq)] -#[serde(rename_all = "snake_case")] -pub enum OAuth2AuthorizeError { - AccessDenied, - InvalidRequest, - InvalidScope, - ServerError, - TemporarilyUnavailable, - UnauthorizedClient, - UnsupportedResponseType, -} - -#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq, Eq)] -#[serde(rename_all = "snake_case")] -pub enum OAuth2TokenType { - Bearer, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct OAuth2AuthorizeRequest { - pub response_type: OAuth2ResponseType, - pub client_id: String, - pub client_secret: Option, - pub redirect_uri: String, - pub scope: Option, - pub state: Option, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct OAuth2CodeResponse { - pub code: String, - - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct OAuth2ErrorResponse { - pub error: OAuth2AuthorizeError, - - #[serde(skip_serializing_if = "Option::is_none")] - pub error_description: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - pub error_uri: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct OAuth2TokenRequest { - pub grant_type: OAuth2GrantType, - - #[serde(skip_serializing_if = "Option::is_none")] - pub code: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - pub refresh_token: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - pub username: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - pub password: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - pub passkey: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - pub client_id: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - pub client_secret: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - pub redirect_uri: Option, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct OAuth2TokenResponse { - pub token_type: OAuth2TokenType, - - pub access_token: String, - - #[serde(skip_serializing_if = "Option::is_none")] - pub refresh_token: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - pub scope: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - pub state: Option, - - pub expires_in: u64, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct OAuth2RevokeRequest { - pub token: String, - pub token_type_hint: OAuth2TokenHintType, -} - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct OAuth2IntrospectionResponse { - pub active: bool, - - #[serde(skip_serializing_if = "Option::is_none")] - pub client_id: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - pub username: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - pub scope: Option, - - #[serde(skip_serializing_if = "Option::is_none")] - pub exp: Option, -} - -impl OAuth2IntrospectionResponse { - pub fn inative() -> Self { - Self { - active: false, - client_id: None, - username: None, - scope: None, - exp: None, - } - } -} diff --git a/src/types/servers.rs b/src/types/servers.rs deleted file mode 100644 index d35c7bc..0000000 --- a/src/types/servers.rs +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) Tribufu. All Rights Reserved. - -use crate::users::MiniProfile; -use chrono::NaiveDateTime; -use serde::{Deserialize, Serialize}; -use serde_json::Value; -use serde_with::{serde_as, DisplayFromStr}; - -#[serde_as] -#[derive(Debug, Serialize, Deserialize)] -pub struct Server { - #[serde_as(as = "DisplayFromStr")] - pub id: u64, - pub name: String, - pub description: Option, - pub address: String, - pub game_port: Option, - pub query_port: u16, - #[serde(skip_serializing_if = "Option::is_none")] - pub rcon_port: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub rcon_password: Option, - #[serde_as(as = "DisplayFromStr")] - pub package_id: u64, - pub package_icon_url: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub package: Option, - pub version: Option, - pub cluster_id: Option, - pub website_url: Option, - pub banner_url: Option, - pub owner_id: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub owner: Option, - #[serde(skip)] - pub uptime: f64, - pub last_online: Option, - #[serde(flatten)] - pub stats: ServerStats, - pub country: Option, - pub steam: bool, - pub discord_server_id: Option, - pub youtube_video_url: Option, - pub tags: Option, - pub comment_count: u32, - #[serde(skip)] - pub secret: Option, - pub created: NaiveDateTime, - pub updated: Option, -} - -#[repr(u8)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)] -#[serde(rename_all = "lowercase")] -pub enum ServerStatus { - Unknown, - Offline, - Online, -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct ServerStats { - pub status: ServerStatus, - pub ping: Option, - pub map: Option, - pub used_slots: Option, - pub max_slots: Option, - pub motd: Option, - pub players: Option, -} - -#[serde_as] -#[derive(Debug, Serialize, Deserialize)] -pub struct ServerPackage { - #[serde_as(as = "DisplayFromStr")] - pub id: u64, - pub name: String, - pub slug: Option, - pub rust_gamedig_id: Option, - pub node_gamedig_id: Option, - pub server_connect_url: Option, -} diff --git a/src/types/users.rs b/src/types/users.rs deleted file mode 100644 index f8a9cc3..0000000 --- a/src/types/users.rs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Tribufu. All Rights Reserved. - -use chrono::{NaiveDate, NaiveDateTime}; -use serde::{Deserialize, Serialize}; -use serde_with::{serde_as, DisplayFromStr}; - -#[repr(u8)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)] -#[serde(rename_all = "snake_case")] -pub enum UserType { - User = 0, - Bot = 1, - Org = 2, -} - -#[serde_as] -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct Profile { - #[serde_as(as = "DisplayFromStr")] - pub id: u64, - pub uuid: String, - pub name: String, - pub display_name: String, - #[serde(rename = "type")] - pub kind: UserType, - pub public_flags: u64, - pub verified: bool, - pub level: u32, - pub experience: f64, - pub public_birthday: bool, - pub birthday: Option, - pub points: f64, - pub location: Option, - pub photo_url: Option, - pub banner_url: Option, - pub last_online: Option, - pub biography: Option, - pub view_count: u32, - pub created: NaiveDateTime, - pub updated: Option, -} - -#[serde_as] -#[derive(Debug, Serialize, Deserialize)] -pub struct MiniProfile { - #[serde_as(as = "DisplayFromStr")] - pub id: u64, - pub uuid: String, - pub name: String, - pub display_name: String, - #[serde(rename = "type")] - pub kind: UserType, - pub verified: bool, - pub photo_url: String, -} diff --git a/vendor/openapi-generator/LICENSE b/vendor/openapi-generator/LICENSE new file mode 100644 index 0000000..310853b --- /dev/null +++ b/vendor/openapi-generator/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + Copyright 2018 SmartBear Software + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/openapi-generator/openapi-generator-cli.jar b/vendor/openapi-generator/openapi-generator-cli.jar new file mode 100644 index 0000000..f373b7a Binary files /dev/null and b/vendor/openapi-generator/openapi-generator-cli.jar differ