/* * 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 /// /// <b>🔒 Required permissions:</b> <code>tribufu.identity.oauth2.authorize</code> async fn authorize<'authorize_request>(&self, authorize_request: Option<models::AuthorizeRequest>) -> Result<(), Error<AuthorizeError>>; /// PUT /v1/users/{id}/email /// /// This endpoint is not available with an api key, only with a bearer token.<br/><br/><b>🔒 Required permissions:</b> <code>tribufu.identity.user.email.update</code> async fn change_email<'id, 'body>(&self, id: &'id str, body: Option<serde_json::Value>) -> Result<(), Error<ChangeEmailError>>; /// PUT /v1/users/{id}/password /// /// This endpoint is not available with an api key, only with a bearer token.<br/><br/><b>🔒 Required permissions:</b> <code>tribufu.identity.user.password.update</code> async fn change_password<'id, 'body>(&self, id: &'id str, body: Option<serde_json::Value>) -> Result<(), Error<ChangePasswordError>>; /// PUT /v1/servers/{id}/claim /// /// This endpoint is not available with an api key, only with a bearer token.<br/><br/><b>🔒 Required permissions:</b> <code>tribufu.community.game.server.claim</code> async fn claim_game_server<'id, 'body>(&self, id: &'id str, body: Option<serde_json::Value>) -> Result<(), Error<ClaimGameServerError>>; /// POST /v1/utils/base64 /// /// <b>🔒 Required permissions:</b> <code>tribufu.utils.convert.base64</code> async fn convert_base64<'crypto_view_model>(&self, crypto_view_model: Option<models::CryptoViewModel>) -> Result<models::CryptoViewModel, Error<ConvertBase64Error>>; /// POST /v1/servers /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.create</code> async fn create_game_server<'body>(&self, body: Option<serde_json::Value>) -> Result<(), Error<CreateGameServerError>>; /// POST /v1/clusters /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.create</code> async fn create_game_server_cluster<'body>(&self, body: Option<serde_json::Value>) -> Result<(), Error<CreateGameServerClusterError>>; /// POST /v1/groups /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.group.create</code> async fn create_group<'body>(&self, body: Option<serde_json::Value>) -> Result<(), Error<CreateGroupError>>; /// POST /v1/oauth2/token /// /// async fn create_token<'token_request>(&self, token_request: Option<models::TokenRequest>) -> Result<models::TokenResponse, Error<CreateTokenError>>; /// DELETE /v1/servers/{id} /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.delete</code> async fn delete_game_server<'id>(&self, id: &'id str) -> Result<(), Error<DeleteGameServerError>>; /// DELETE /v1/clusters/{id} /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.delete</code> async fn delete_game_server_cluster<'id>(&self, id: &'id str) -> Result<(), Error<DeleteGameServerClusterError>>; /// DELETE /v1/groups/{id} /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.group.delete</code> async fn delete_group<'id>(&self, id: &'id str) -> Result<(), Error<DeleteGroupError>>; /// GET /v1/utils/flake /// /// <b>🔒 Required permissions:</b> <code>tribufu.utils.generate.flake</code> async fn generate_flake_id<'amount>(&self, amount: Option<i32>) -> Result<Vec<String>, Error<GenerateFlakeIdError>>; /// GET /v1/utils/flake/{timestamp} /// /// <b>🔒 Required permissions:</b> <code>tribufu.utils.generate.flake.timestamp</code> async fn generate_flake_id_from_timestamp<'timestamp, 'amount>(&self, timestamp: &'timestamp str, amount: Option<i32>) -> Result<Vec<String>, Error<GenerateFlakeIdFromTimestampError>>; /// GET /v1/utils/password /// /// <b>🔒 Required permissions:</b> <code>tribufu.utils.generate.password</code> async fn generate_password<'length, 'symbols>(&self, length: Option<i32>, symbols: Option<bool>) -> Result<models::HashViewModel, Error<GeneratePasswordError>>; /// GET /v1/utils/uuid /// /// <b>🔒 Required permissions:</b> <code>tribufu.utils.generate.uuid</code> async fn generate_uuid<'version, 'amount>(&self, version: Option<i32>, amount: Option<i32>) -> Result<Vec<uuid::Uuid>, Error<GenerateUuidError>>; /// GET /v1/oauth2/clientinfo /// /// async fn get_client_info<>(&self, ) -> Result<(), Error<GetClientInfoError>>; /// GET /v1/geoip /// /// <b>🔒 Required permissions:</b> <code>tribufu.geoip.current</code> async fn get_current_ip_address<>(&self, ) -> Result<Vec<models::IpAddress>, Error<GetCurrentIpAddressError>>; /// GET /v1/games/{id} /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.get</code> async fn get_game_by_id<'id>(&self, id: &'id str) -> Result<models::Game, Error<GetGameByIdError>>; /// GET /v1/games/{id}/clusters /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.list</code> async fn get_game_clusters_by_game_id<'id, 'page, 'limit>(&self, id: &'id str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::GameServerCluster>, Error<GetGameClustersByGameIdError>>; /// GET /v1/games/{id}/items /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.item.list</code> async fn get_game_items<'id, 'page, 'limit>(&self, id: &'id str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<serde_json::Value>, Error<GetGameItemsError>>; /// GET /v1/servers/address/{address}:{port} /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.get.address</code> async fn get_game_server_by_address_and_query_port<'address, 'port>(&self, address: &'address str, port: i32) -> Result<models::GameServer, Error<GetGameServerByAddressAndQueryPortError>>; /// GET /v1/servers/{id} /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.get</code> async fn get_game_server_by_id<'id>(&self, id: &'id str) -> Result<models::GameServer, Error<GetGameServerByIdError>>; /// GET /v1/clusters/{id} /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.get</code> async fn get_game_server_cluster_by_id<'id>(&self, id: &'id str) -> Result<models::GameServerCluster, Error<GetGameServerClusterByIdError>>; /// GET /v1/clusters /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.list</code> async fn get_game_server_clusters<'page, 'limit>(&self, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::GameServerCluster>, Error<GetGameServerClustersError>>; /// GET /v1/servers /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.list</code> async fn get_game_servers<'page, 'limit>(&self, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::GameServer>, Error<GetGameServersError>>; /// GET /v1/servers/country/{country} /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.list.country</code> async fn get_game_servers_by_country<'country, 'page, 'limit>(&self, country: &'country str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::GameServer>, Error<GetGameServersByCountryError>>; /// GET /v1/games/{id}/servers /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.list</code> async fn get_game_servers_by_game_id<'id, 'page, 'limit>(&self, id: &'id str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::GameServer>, Error<GetGameServersByGameIdError>>; /// GET /v1/servers/countries /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.country.list</code> async fn get_game_servers_countries<>(&self, ) -> Result<std::collections::HashMap<String, i32>, Error<GetGameServersCountriesError>>; /// GET /v1/servers/metrics /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.metric.get</code> async fn get_game_servers_metrics<>(&self, ) -> Result<models::ServerMetrics, Error<GetGameServersMetricsError>>; /// GET /v1/games /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.list</code> async fn get_games<>(&self, ) -> Result<Vec<models::Game>, Error<GetGamesError>>; /// GET /v1/groups/{id} /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.group.get</code> async fn get_group_by_id<'id>(&self, id: &'id str) -> Result<models::Group, Error<GetGroupByIdError>>; /// GET /v1/groups/tag/{tag} /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.group.get.tag</code> async fn get_group_by_tag<'tag>(&self, tag: &'tag str) -> Result<models::Group, Error<GetGroupByTagError>>; /// GET /v1/groups/uuid/{uuid} /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.group.get.uuid</code> async fn get_group_by_uuid<'uuid>(&self, uuid: &str) -> Result<models::Group, Error<GetGroupByUuidError>>; /// GET /v1/groups/{id}/games /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.group.game.list</code> async fn get_group_games<'id>(&self, id: &'id str) -> Result<Vec<models::GroupGame>, Error<GetGroupGamesError>>; /// GET /v1/groups/{id}/members /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.group.member.list</code> async fn get_group_members<'id>(&self, id: &'id str) -> Result<Vec<models::GroupMember>, Error<GetGroupMembersError>>; /// GET /v1/groups /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.group.list</code> async fn get_groups<'page, 'limit>(&self, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Group>, Error<GetGroupsError>>; /// GET /v1/geoip/addresses/{address} /// /// <b>🔒 Required permissions:</b> <code>tribufu.geoip.address.get</code> async fn get_ip_address<'address>(&self, address: &'address str) -> Result<models::IpAddress, Error<GetIpAddressError>>; /// GET /v1/geoip/addresses /// /// <b>🔒 Required permissions:</b> <code>tribufu.geoip.address.list</code> async fn get_ip_addresses<'page, 'limit>(&self, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::IpAddress>, Error<GetIpAddressesError>>; /// GET /v1/leaderboard /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.leaderboard.get</code> async fn get_leaderboard<'order>(&self, order: Option<models::LeaderboardOrder>) -> Result<Vec<models::LeaderboardItem>, Error<GetLeaderboardError>>; /// GET /v1/me /// /// async fn get_me<>(&self, ) -> Result<models::UserInfo, Error<GetMeError>>; /// GET /v1/packages/{id} /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.package.get</code> async fn get_package_by_id<'id>(&self, id: &'id str) -> Result<models::Package, Error<GetPackageByIdError>>; /// GET /v1/packages /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.package.list</code> async fn get_packages<'page, 'limit>(&self, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Package>, Error<GetPackagesError>>; /// GET /v1/oauth2/jwks /// /// <b>🔒 Required permissions:</b> <code>tribufu.identity.oauth2.client.keys</code> async fn get_public_keys<>(&self, ) -> Result<(), Error<GetPublicKeysError>>; /// GET /v1/subscriptions/{id} /// /// <b>🔒 Required permissions:</b> <code>tribufu.store.subscription.get</code> async fn get_subscription_by_id<'id>(&self, id: &'id str) -> Result<models::Subscription, Error<GetSubscriptionByIdError>>; /// GET /v1/subscriptions /// /// <b>🔒 Required permissions:</b> <code>tribufu.store.subscription.list</code> async fn get_subscriptions<'page, 'limit>(&self, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Subscription>, Error<GetSubscriptionsError>>; /// GET /v1/users/{id}/accounts /// /// <b>🔒 Required permissions:</b> <code>tribufu.identity.user.account.list</code> async fn get_user_accounts<'id>(&self, id: &'id str) -> Result<Vec<models::Account>, Error<GetUserAccountsError>>; /// GET /v1/users/{id} /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.profile.get</code> async fn get_user_by_id<'id>(&self, id: &'id str) -> Result<models::Profile, Error<GetUserByIdError>>; /// GET /v1/users/name/{name} /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.profile.get.name</code> async fn get_user_by_name<'name>(&self, name: &'name str) -> Result<models::Profile, Error<GetUserByNameError>>; /// GET /v1/users/uuid/{uuid} /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.profile.get.uuid</code> async fn get_user_by_uuid<'uuid>(&self, uuid: &str) -> Result<models::Profile, Error<GetUserByUuidError>>; /// GET /v1/users/{id}/friends /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.profile.friend.list</code> async fn get_user_friends<'id>(&self, id: &'id str) -> Result<Vec<serde_json::Value>, Error<GetUserFriendsError>>; /// GET /v1/users/{id}/games /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.profile.game.list</code> async fn get_user_games<'id>(&self, id: &'id str) -> Result<Vec<models::ProfileGame>, Error<GetUserGamesError>>; /// GET /v1/users/{id}/groups /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.profile.group.list</code> async fn get_user_groups<'id>(&self, id: &'id str) -> Result<Vec<models::ProfileGroup>, Error<GetUserGroupsError>>; /// GET /v1/oauth2/userinfo /// /// <b>🔒 Required permissions:</b> <code>tribufu.identity.oauth2.user.info</code> async fn get_user_info<>(&self, ) -> Result<models::UserInfo, Error<GetUserInfoError>>; /// GET /v1/users/{id}/punishments /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.profile.punishment.list</code> async fn get_user_punishments<'id>(&self, id: &'id str) -> Result<Vec<serde_json::Value>, Error<GetUserPunishmentsError>>; /// GET /v1/users/{id}/servers /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.profile.game.server.list</code> async fn get_user_servers<'id, 'page, 'limit>(&self, id: &'id str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::GameServer>, Error<GetUserServersError>>; /// GET /v1/users /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.profile.list</code> async fn get_users<'page, 'limit>(&self, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Profile>, Error<GetUsersError>>; /// POST /v1/utils/argon2 /// /// <b>🔒 Required permissions:</b> <code>tribufu.utils.hash.argon2</code> async fn hash_argon2<'hash_view_model>(&self, hash_view_model: Option<models::HashViewModel>) -> Result<models::HashViewModel, Error<HashArgon2Error>>; /// POST /v1/utils/bcrypt /// /// <b>🔒 Required permissions:</b> <code>tribufu.utils.hash.bcrypt</code> async fn hash_bcrypt<'hash_view_model>(&self, hash_view_model: Option<models::HashViewModel>) -> Result<models::HashViewModel, Error<HashBcryptError>>; /// POST /v1/utils/md5 /// /// <b>🔒 Required permissions:</b> <code>tribufu.utils.hash.md5</code> async fn hash_md5<'hash_view_model>(&self, hash_view_model: Option<models::HashViewModel>) -> Result<models::HashViewModel, Error<HashMd5Error>>; /// POST /v1/utils/sha256 /// /// <b>🔒 Required permissions:</b> <code>tribufu.utils.hash.sha256</code> async fn hash_sha256<'hash_view_model>(&self, hash_view_model: Option<models::HashViewModel>) -> Result<models::HashViewModel, Error<HashSha256Error>>; /// POST /v1/oauth2/introspect /// /// <b>🔒 Required permissions:</b> <code>tribufu.identity.oauth2.token.introspect</code> async fn introspect_token<'introspect_request>(&self, introspect_request: Option<models::IntrospectRequest>) -> Result<(), Error<IntrospectTokenError>>; /// POST /v1/login /// /// <b>🔒 Required permissions:</b> <code>tribufu.identity.token.create</code> async fn login<'login_request>(&self, login_request: Option<models::LoginRequest>) -> Result<models::LoginResponse, Error<LoginError>>; /// POST /v1/logout /// /// <b>🔒 Required permissions:</b> <code>tribufu.identity.token.revoke</code> async fn logout<>(&self, ) -> Result<(), Error<LogoutError>>; /// POST /v1/refresh /// /// <b>🔒 Required permissions:</b> <code>tribufu.identity.token.refresh</code> async fn refresh<'refresh_request>(&self, refresh_request: Option<models::RefreshRequest>) -> Result<models::LoginResponse, Error<RefreshError>>; /// POST /v1/register /// /// <b>🔒 Required permissions:</b> <code>tribufu.identity.user.create</code> async fn register<'register_request>(&self, register_request: Option<models::RegisterRequest>) -> Result<models::LoginResponse, Error<RegisterError>>; /// POST /v1/oauth2/revoke /// /// <b>🔒 Required permissions:</b> <code>tribufu.identity.oauth2.token.revoke</code> async fn revoke_token<'revoke_request>(&self, revoke_request: Option<models::RevokeRequest>) -> Result<(), Error<RevokeTokenError>>; /// POST /v1/search /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.search</code> async fn search<'search_request>(&self, search_request: Option<models::SearchRequest>) -> Result<Vec<serde_json::Value>, Error<SearchError>>; /// PUT /v1/servers/{id} /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.update</code> async fn update_game_server<'id, 'body>(&self, id: &'id str, body: Option<serde_json::Value>) -> Result<(), Error<UpdateGameServerError>>; /// PUT /v1/clusters/{id} /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.update</code> async fn update_game_server_cluster<'id, 'body>(&self, id: &'id str, body: Option<serde_json::Value>) -> Result<(), Error<UpdateGameServerClusterError>>; /// PUT /v1/groups/{id} /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.group.update</code> async fn update_group<'id, 'body>(&self, id: &'id str, body: Option<serde_json::Value>) -> Result<(), Error<UpdateGroupError>>; /// PUT /v1/users/{id}/profile /// /// <b>🔒 Required permissions:</b> <code>tribufu.community.profile.update</code> async fn update_user_profile<'id, 'update_profile>(&self, id: &'id str, update_profile: Option<models::UpdateProfile>) -> Result<models::Profile, Error<UpdateUserProfileError>>; } pub struct TribufuGeneratedApiClient { configuration: Arc<configuration::Configuration> } impl TribufuGeneratedApiClient { pub fn new(configuration: Arc<configuration::Configuration>) -> Self { Self { configuration } } } #[async_trait] impl TribufuGeneratedApi for TribufuGeneratedApiClient { /// <b>🔒 Required permissions:</b> <code>tribufu.identity.oauth2.authorize</code> async fn authorize<'authorize_request>(&self, authorize_request: Option<models::AuthorizeRequest>) -> Result<(), Error<AuthorizeError>> { 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<AuthorizeError> = 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.<br/><br/><b>🔒 Required permissions:</b> <code>tribufu.identity.user.email.update</code> async fn change_email<'id, 'body>(&self, id: &'id str, body: Option<serde_json::Value>) -> Result<(), Error<ChangeEmailError>> { 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<ChangeEmailError> = 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.<br/><br/><b>🔒 Required permissions:</b> <code>tribufu.identity.user.password.update</code> async fn change_password<'id, 'body>(&self, id: &'id str, body: Option<serde_json::Value>) -> Result<(), Error<ChangePasswordError>> { 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<ChangePasswordError> = 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.<br/><br/><b>🔒 Required permissions:</b> <code>tribufu.community.game.server.claim</code> async fn claim_game_server<'id, 'body>(&self, id: &'id str, body: Option<serde_json::Value>) -> Result<(), Error<ClaimGameServerError>> { 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<ClaimGameServerError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.utils.convert.base64</code> async fn convert_base64<'crypto_view_model>(&self, crypto_view_model: Option<models::CryptoViewModel>) -> Result<models::CryptoViewModel, Error<ConvertBase64Error>> { 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<ConvertBase64Error> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.create</code> async fn create_game_server<'body>(&self, body: Option<serde_json::Value>) -> Result<(), Error<CreateGameServerError>> { 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<CreateGameServerError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.create</code> async fn create_game_server_cluster<'body>(&self, body: Option<serde_json::Value>) -> Result<(), Error<CreateGameServerClusterError>> { 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<CreateGameServerClusterError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.group.create</code> async fn create_group<'body>(&self, body: Option<serde_json::Value>) -> Result<(), Error<CreateGroupError>> { 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<CreateGroupError> = 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<models::TokenRequest>) -> Result<models::TokenResponse, Error<CreateTokenError>> { 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<CreateTokenError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.delete</code> async fn delete_game_server<'id>(&self, id: &'id str) -> Result<(), Error<DeleteGameServerError>> { 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<DeleteGameServerError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.delete</code> async fn delete_game_server_cluster<'id>(&self, id: &'id str) -> Result<(), Error<DeleteGameServerClusterError>> { 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<DeleteGameServerClusterError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.group.delete</code> async fn delete_group<'id>(&self, id: &'id str) -> Result<(), Error<DeleteGroupError>> { 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<DeleteGroupError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.utils.generate.flake</code> async fn generate_flake_id<'amount>(&self, amount: Option<i32>) -> Result<Vec<String>, Error<GenerateFlakeIdError>> { 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<GenerateFlakeIdError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.utils.generate.flake.timestamp</code> async fn generate_flake_id_from_timestamp<'timestamp, 'amount>(&self, timestamp: &'timestamp str, amount: Option<i32>) -> Result<Vec<String>, Error<GenerateFlakeIdFromTimestampError>> { 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<GenerateFlakeIdFromTimestampError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.utils.generate.password</code> async fn generate_password<'length, 'symbols>(&self, length: Option<i32>, symbols: Option<bool>) -> Result<models::HashViewModel, Error<GeneratePasswordError>> { 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<GeneratePasswordError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.utils.generate.uuid</code> async fn generate_uuid<'version, 'amount>(&self, version: Option<i32>, amount: Option<i32>) -> Result<Vec<uuid::Uuid>, Error<GenerateUuidError>> { 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<GenerateUuidError> = 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<GetClientInfoError>> { 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<GetClientInfoError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.geoip.current</code> async fn get_current_ip_address<>(&self, ) -> Result<Vec<models::IpAddress>, Error<GetCurrentIpAddressError>> { 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<GetCurrentIpAddressError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.get</code> async fn get_game_by_id<'id>(&self, id: &'id str) -> Result<models::Game, Error<GetGameByIdError>> { 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<GetGameByIdError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.list</code> async fn get_game_clusters_by_game_id<'id, 'page, 'limit>(&self, id: &'id str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::GameServerCluster>, Error<GetGameClustersByGameIdError>> { 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<GetGameClustersByGameIdError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.item.list</code> async fn get_game_items<'id, 'page, 'limit>(&self, id: &'id str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<serde_json::Value>, Error<GetGameItemsError>> { 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<GetGameItemsError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.get.address</code> async fn get_game_server_by_address_and_query_port<'address, 'port>(&self, address: &'address str, port: i32) -> Result<models::GameServer, Error<GetGameServerByAddressAndQueryPortError>> { 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<GetGameServerByAddressAndQueryPortError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.get</code> async fn get_game_server_by_id<'id>(&self, id: &'id str) -> Result<models::GameServer, Error<GetGameServerByIdError>> { 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<GetGameServerByIdError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.get</code> async fn get_game_server_cluster_by_id<'id>(&self, id: &'id str) -> Result<models::GameServerCluster, Error<GetGameServerClusterByIdError>> { 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<GetGameServerClusterByIdError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.list</code> async fn get_game_server_clusters<'page, 'limit>(&self, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::GameServerCluster>, Error<GetGameServerClustersError>> { 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<GetGameServerClustersError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.list</code> async fn get_game_servers<'page, 'limit>(&self, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::GameServer>, Error<GetGameServersError>> { 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<GetGameServersError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.list.country</code> async fn get_game_servers_by_country<'country, 'page, 'limit>(&self, country: &'country str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::GameServer>, Error<GetGameServersByCountryError>> { 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<GetGameServersByCountryError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.list</code> async fn get_game_servers_by_game_id<'id, 'page, 'limit>(&self, id: &'id str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::GameServer>, Error<GetGameServersByGameIdError>> { 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<GetGameServersByGameIdError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.country.list</code> async fn get_game_servers_countries<>(&self, ) -> Result<std::collections::HashMap<String, i32>, Error<GetGameServersCountriesError>> { 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<GetGameServersCountriesError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.metric.get</code> async fn get_game_servers_metrics<>(&self, ) -> Result<models::ServerMetrics, Error<GetGameServersMetricsError>> { 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<GetGameServersMetricsError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.list</code> async fn get_games<>(&self, ) -> Result<Vec<models::Game>, Error<GetGamesError>> { 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<GetGamesError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.group.get</code> async fn get_group_by_id<'id>(&self, id: &'id str) -> Result<models::Group, Error<GetGroupByIdError>> { 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<GetGroupByIdError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.group.get.tag</code> async fn get_group_by_tag<'tag>(&self, tag: &'tag str) -> Result<models::Group, Error<GetGroupByTagError>> { 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<GetGroupByTagError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.group.get.uuid</code> async fn get_group_by_uuid<'uuid>(&self, uuid: &str) -> Result<models::Group, Error<GetGroupByUuidError>> { 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<GetGroupByUuidError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.group.game.list</code> async fn get_group_games<'id>(&self, id: &'id str) -> Result<Vec<models::GroupGame>, Error<GetGroupGamesError>> { 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<GetGroupGamesError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.group.member.list</code> async fn get_group_members<'id>(&self, id: &'id str) -> Result<Vec<models::GroupMember>, Error<GetGroupMembersError>> { 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<GetGroupMembersError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.group.list</code> async fn get_groups<'page, 'limit>(&self, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Group>, Error<GetGroupsError>> { 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<GetGroupsError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.geoip.address.get</code> async fn get_ip_address<'address>(&self, address: &'address str) -> Result<models::IpAddress, Error<GetIpAddressError>> { 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<GetIpAddressError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.geoip.address.list</code> async fn get_ip_addresses<'page, 'limit>(&self, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::IpAddress>, Error<GetIpAddressesError>> { 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<GetIpAddressesError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.leaderboard.get</code> async fn get_leaderboard<'order>(&self, order: Option<models::LeaderboardOrder>) -> Result<Vec<models::LeaderboardItem>, Error<GetLeaderboardError>> { 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<GetLeaderboardError> = 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<models::UserInfo, Error<GetMeError>> { 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<GetMeError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.package.get</code> async fn get_package_by_id<'id>(&self, id: &'id str) -> Result<models::Package, Error<GetPackageByIdError>> { 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<GetPackageByIdError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.package.list</code> async fn get_packages<'page, 'limit>(&self, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Package>, Error<GetPackagesError>> { 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<GetPackagesError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.identity.oauth2.client.keys</code> async fn get_public_keys<>(&self, ) -> Result<(), Error<GetPublicKeysError>> { 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<GetPublicKeysError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.store.subscription.get</code> async fn get_subscription_by_id<'id>(&self, id: &'id str) -> Result<models::Subscription, Error<GetSubscriptionByIdError>> { 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<GetSubscriptionByIdError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.store.subscription.list</code> async fn get_subscriptions<'page, 'limit>(&self, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Subscription>, Error<GetSubscriptionsError>> { 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<GetSubscriptionsError> = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.identity.user.account.list</code> async fn get_user_accounts<'id>(&self, id: &'id str) -> Result<Vec<models::Account>, Error<GetUserAccountsError>> { 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<GetUserAccountsError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.profile.get</code> async fn get_user_by_id<'id>(&self, id: &'id str) -> Result<models::Profile, Error<GetUserByIdError>> { 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<GetUserByIdError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.profile.get.name</code> async fn get_user_by_name<'name>(&self, name: &'name str) -> Result<models::Profile, Error<GetUserByNameError>> { 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<GetUserByNameError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.profile.get.uuid</code> async fn get_user_by_uuid<'uuid>(&self, uuid: &str) -> Result<models::Profile, Error<GetUserByUuidError>> { 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<GetUserByUuidError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.profile.friend.list</code> async fn get_user_friends<'id>(&self, id: &'id str) -> Result<Vec<serde_json::Value>, Error<GetUserFriendsError>> { 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<GetUserFriendsError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.profile.game.list</code> async fn get_user_games<'id>(&self, id: &'id str) -> Result<Vec<models::ProfileGame>, Error<GetUserGamesError>> { 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<GetUserGamesError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.profile.group.list</code> async fn get_user_groups<'id>(&self, id: &'id str) -> Result<Vec<models::ProfileGroup>, Error<GetUserGroupsError>> { 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<GetUserGroupsError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.identity.oauth2.user.info</code> async fn get_user_info<>(&self, ) -> Result<models::UserInfo, Error<GetUserInfoError>> { 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<GetUserInfoError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.profile.punishment.list</code> async fn get_user_punishments<'id>(&self, id: &'id str) -> Result<Vec<serde_json::Value>, Error<GetUserPunishmentsError>> { 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<GetUserPunishmentsError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.profile.game.server.list</code> async fn get_user_servers<'id, 'page, 'limit>(&self, id: &'id str, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::GameServer>, Error<GetUserServersError>> { 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<GetUserServersError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.profile.list</code> async fn get_users<'page, 'limit>(&self, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::Profile>, Error<GetUsersError>> { 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<GetUsersError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.utils.hash.argon2</code> async fn hash_argon2<'hash_view_model>(&self, hash_view_model: Option<models::HashViewModel>) -> Result<models::HashViewModel, Error<HashArgon2Error>> { 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<HashArgon2Error> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.utils.hash.bcrypt</code> async fn hash_bcrypt<'hash_view_model>(&self, hash_view_model: Option<models::HashViewModel>) -> Result<models::HashViewModel, Error<HashBcryptError>> { 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<HashBcryptError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.utils.hash.md5</code> async fn hash_md5<'hash_view_model>(&self, hash_view_model: Option<models::HashViewModel>) -> Result<models::HashViewModel, Error<HashMd5Error>> { 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<HashMd5Error> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.utils.hash.sha256</code> async fn hash_sha256<'hash_view_model>(&self, hash_view_model: Option<models::HashViewModel>) -> Result<models::HashViewModel, Error<HashSha256Error>> { 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<HashSha256Error> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.identity.oauth2.token.introspect</code> async fn introspect_token<'introspect_request>(&self, introspect_request: Option<models::IntrospectRequest>) -> Result<(), Error<IntrospectTokenError>> { 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<IntrospectTokenError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.identity.token.create</code> async fn login<'login_request>(&self, login_request: Option<models::LoginRequest>) -> Result<models::LoginResponse, Error<LoginError>> { 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<LoginError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.identity.token.revoke</code> async fn logout<>(&self, ) -> Result<(), Error<LogoutError>> { 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<LogoutError> = serde_json::from_str(&local_var_content).ok(); let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.identity.token.refresh</code> async fn refresh<'refresh_request>(&self, refresh_request: Option<models::RefreshRequest>) -> Result<models::LoginResponse, Error<RefreshError>> { 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<RefreshError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.identity.user.create</code> async fn register<'register_request>(&self, register_request: Option<models::RegisterRequest>) -> Result<models::LoginResponse, Error<RegisterError>> { 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<RegisterError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.identity.oauth2.token.revoke</code> async fn revoke_token<'revoke_request>(&self, revoke_request: Option<models::RevokeRequest>) -> Result<(), Error<RevokeTokenError>> { 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<RevokeTokenError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.search</code> async fn search<'search_request>(&self, search_request: Option<models::SearchRequest>) -> Result<Vec<serde_json::Value>, Error<SearchError>> { 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<SearchError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.update</code> async fn update_game_server<'id, 'body>(&self, id: &'id str, body: Option<serde_json::Value>) -> Result<(), Error<UpdateGameServerError>> { 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<UpdateGameServerError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.game.server.cluster.update</code> async fn update_game_server_cluster<'id, 'body>(&self, id: &'id str, body: Option<serde_json::Value>) -> Result<(), Error<UpdateGameServerClusterError>> { 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<UpdateGameServerClusterError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.group.update</code> async fn update_group<'id, 'body>(&self, id: &'id str, body: Option<serde_json::Value>) -> Result<(), Error<UpdateGroupError>> { 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<UpdateGroupError> = 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)) } } /// <b>🔒 Required permissions:</b> <code>tribufu.community.profile.update</code> async fn update_user_profile<'id, 'update_profile>(&self, id: &'id str, update_profile: Option<models::UpdateProfile>) -> Result<models::Profile, Error<UpdateUserProfileError>> { 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<UpdateUserProfileError> = 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), }