From 5427c1d213515080744700052775900ecf45d4df Mon Sep 17 00:00:00 2001 From: 0xkubectl Date: Tue, 23 Jul 2024 16:08:05 +0200 Subject: [PATCH 01/10] fix: Patch openapi spec instead of writing custom code - add fmt after generate run - add set -eux -o pipefail for better logs --- generate.sh | 31 ++++++++++++++++++++----------- patches/0001_fix_2fa.patch | 36 ++++++++++++++++++++++++++++++++++++ patches/2FA_Current_User.rs | 12 ------------ 3 files changed, 56 insertions(+), 23 deletions(-) create mode 100644 patches/0001_fix_2fa.patch delete mode 100644 patches/2FA_Current_User.rs diff --git a/generate.sh b/generate.sh index b11be0f..33f495e 100755 --- a/generate.sh +++ b/generate.sh @@ -1,17 +1,29 @@ #!/usr/bin/env bash +set -eux -o pipefail -# Generate Client +# clean up old files rm src/apis src/models docs -rf +# Download OpenAPI spec +wget https://raw.githubusercontent.com/vrchatapi/specification/gh-pages/openapi.yaml -O openapi.yaml + +# patch openapi.yaml +for p in patches/*.patch; do + patch -p1 openapi.yaml $p +done + +# Generate client ./node_modules/\@openapitools/openapi-generator-cli/main.js generate \ -g rust \ ---additional-properties=packageName=vrchatapi,supportAsync=true \ +--additional-properties=packageName=vrchatapi,supportAsync=true,avoidBoxedModels=true \ --git-user-id=vrchatapi \ --git-repo-id=vrchatapi-rust \ -o . \ --i https://raw.githubusercontent.com/vrchatapi/specification/gh-pages/openapi.yaml \ +-i openapi.yaml \ --http-user-agent="vrchatapi-rust" -#--global-property debugOperations=true + +# Remove openapi.yaml +rm openapi.yaml # Update entire description (replace entire line, match the random data there) line in Cargo.toml sed -i 's/^description = ".*"/description = "VRChat API Client for Rust"/' Cargo.toml @@ -24,16 +36,13 @@ find src -type f -exec sed -i '/The version of the OpenAPI document/d' {} \; find src -type f -exec sed -i '/^\s*\/\/\/\s*$/d' {} \; # Cookie storage -sed -i 's/Client::new()/Client::builder().cookie_store(true).build().unwrap()/g' src/apis/configuration.rs +sed -i 's/Client::new()/Client::builder().cookie_store(true).build().expect("Failed to build client")/g' src/apis/configuration.rs sed -i 's/features = \["json", "multipart"\]/features = \["json", "cookies", "multipart"\]/g' Cargo.toml -#Fix example +# Fix example printf "\n[dev-dependencies]\ntokio = { version = '1', features = ['macros', 'rt-multi-thread'] }" >> Cargo.toml -# https://github.com/vrchatapi/specification/issues/241 -cat patches/2FA_Current_User.rs >> src/models/current_user.rs -sed -i 's/pub use self::current_user::CurrentUser;/pub use self::current_user::{EitherUserOrTwoFactor, CurrentUser};/g' src/models/mod.rs -sed -i 's/Result>/Result>/g' src/apis/authentication_api.rs - +# Format and test cargo build +cargo fmt cargo test diff --git a/patches/0001_fix_2fa.patch b/patches/0001_fix_2fa.patch new file mode 100644 index 0000000..435b5ba --- /dev/null +++ b/patches/0001_fix_2fa.patch @@ -0,0 +1,36 @@ +diff --git a/openapi.yaml b/openapi_2fa.yaml +https://github.com/vrchatapi/specification/issues/241 +--- a/openapi.yaml ++++ b/openapi_2fa.yaml +@@ -3997,6 +3997,20 @@ components: + - friendKey + title: CurrentUser + type: object ++ TwoFactorRequired: ++ title: TwoFactorRequired ++ type: object ++ properties: ++ requiresTwoFactorAuth: ++ type: array ++ items: ++ type: string ++ enum: ++ - totp ++ - otp ++ - emailOtp ++ required: ++ - requiresTwoFactorAuth + TwoFactorAuthCode: + title: TwoFactorAuthCode + type: object +@@ -8139,7 +8153,9 @@ components: + content: + application/json: + schema: +- $ref: '#/components/schemas/CurrentUser' ++ oneOf: ++ - $ref: '#/components/schemas/CurrentUser' ++ - $ref: '#/components/schemas/TwoFactorRequired' + headers: + Set-Cookie: + schema: diff --git a/patches/2FA_Current_User.rs b/patches/2FA_Current_User.rs deleted file mode 100644 index 967fc3b..0000000 --- a/patches/2FA_Current_User.rs +++ /dev/null @@ -1,12 +0,0 @@ -#[derive(Serialize, Deserialize)] -#[serde(untagged)] -pub enum EitherUserOrTwoFactor{ - CurrentUser(CurrentUser), - RequiresTwoFactorAuth(RequiresTwoFactorAuth), -} - -#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize, Deserialize)] -pub struct RequiresTwoFactorAuth{ - #[serde(rename = "requiresTwoFactorAuth")] - pub requires_two_factor_auth: Vec -} \ No newline at end of file From f0d7753e5527e104ce57d17658d58ada9b329deb Mon Sep 17 00:00:00 2001 From: 0xkubectl Date: Tue, 23 Jul 2024 16:08:58 +0200 Subject: [PATCH 02/10] chore: generation --- .openapi-generator/FILES | 4 + docs/AuthenticationApi.md | 4 +- docs/GetCurrentUser200Response.md | 12 + docs/Group.md | 4 +- docs/TwoFactorRequired.md | 11 + examples/online.rs | 52 +- src/apis/authentication_api.rs | 203 ++- src/apis/avatars_api.rs | 315 +++-- src/apis/configuration.rs | 9 +- src/apis/economy_api.rs | 122 +- src/apis/favorites_api.rs | 228 +++- src/apis/files_api.rs | 281 +++- src/apis/friends_api.rs | 134 +- src/apis/groups_api.rs | 1209 +++++++++++++---- src/apis/instances_api.rs | 174 ++- src/apis/invite_api.rs | 236 +++- src/apis/mod.rs | 16 +- src/apis/notifications_api.rs | 155 ++- src/apis/permissions_api.rs | 53 +- src/apis/playermoderation_api.rs | 166 ++- src/apis/system_api.rs | 162 ++- src/apis/users_api.rs | 194 ++- src/apis/worlds_api.rs | 500 +++++-- src/lib.rs | 2 +- src/models/account_deletion_log.rs | 8 +- src/models/add_favorite_request.rs | 7 +- src/models/add_group_gallery_image_request.rs | 5 +- src/models/api_config.rs | 121 +- src/models/api_config_announcement.rs | 6 +- src/models/api_config_download_url_list.rs | 9 +- src/models/api_config_events.rs | 14 +- src/models/api_health.rs | 1 - src/models/avatar.rs | 26 +- src/models/avatar_unity_package_url_object.rs | 1 - src/models/badge.rs | 30 +- src/models/ban_group_member_request.rs | 5 +- src/models/create_avatar_request.rs | 1 - src/models/create_file_request.rs | 1 - src/models/create_file_version_request.rs | 1 - .../create_group_announcement_request.rs | 1 - src/models/create_group_gallery_request.rs | 29 +- src/models/create_group_invite_request.rs | 6 +- src/models/create_group_post_request.rs | 8 +- src/models/create_group_request.rs | 21 +- src/models/create_group_role_request.rs | 1 - src/models/create_instance_request.rs | 14 +- src/models/create_world_request.rs | 1 - src/models/current_user.rs | 107 +- src/models/current_user_presence.rs | 64 +- src/models/deployment_group.rs | 2 - src/models/developer_type.rs | 2 - src/models/dynamic_content_row.rs | 9 +- src/models/error.rs | 7 +- src/models/favorite.rs | 10 +- src/models/favorite_group.rs | 14 +- src/models/favorite_group_visibility.rs | 2 - src/models/favorite_type.rs | 2 - src/models/file.rs | 13 +- src/models/file_data.rs | 12 +- src/models/file_status.rs | 2 - src/models/file_upload_url.rs | 7 +- src/models/file_version.rs | 9 +- src/models/file_version_upload_status.rs | 12 +- src/models/finish_file_data_upload_request.rs | 3 +- src/models/friend_status.rs | 1 - src/models/get_current_user_200_response.rs | 38 + src/models/group.rs | 59 +- src/models/group_access_type.rs | 2 - src/models/group_announcement.rs | 36 +- src/models/group_audit_log_entry.rs | 1 - src/models/group_gallery.rs | 29 +- src/models/group_gallery_image.rs | 1 - src/models/group_instance.rs | 12 +- src/models/group_join_request_action.rs | 2 - src/models/group_join_state.rs | 2 - src/models/group_limited_member.rs | 46 +- src/models/group_member.rs | 48 +- src/models/group_member_limited_user.rs | 15 +- src/models/group_member_status.rs | 2 - src/models/group_my_member.rs | 36 +- src/models/group_permission.rs | 6 +- src/models/group_post.rs | 8 +- src/models/group_post_visibility.rs | 2 - src/models/group_privacy.rs | 2 - src/models/group_role.rs | 1 - src/models/group_role_template.rs | 2 - src/models/group_search_sort.rs | 2 - src/models/group_user_visibility.rs | 2 - src/models/info_push.rs | 19 +- src/models/info_push_data.rs | 9 +- src/models/info_push_data_article.rs | 7 +- src/models/info_push_data_article_content.rs | 3 +- src/models/info_push_data_clickable.rs | 1 - src/models/instance.rs | 66 +- src/models/instance_platforms.rs | 1 - src/models/instance_region.rs | 2 - src/models/instance_short_name_response.rs | 1 - src/models/instance_type.rs | 4 +- src/models/invite_message.rs | 13 +- src/models/invite_message_type.rs | 4 +- src/models/invite_request.rs | 1 - src/models/invite_response.rs | 5 +- src/models/license.rs | 8 +- src/models/license_action.rs | 2 - src/models/license_group.rs | 10 +- src/models/license_type.rs | 2 - src/models/limited_group.rs | 36 +- src/models/limited_unity_package.rs | 3 +- src/models/limited_user.rs | 24 +- src/models/limited_user_groups.rs | 43 +- src/models/limited_world.rs | 37 +- src/models/mime_type.rs | 2 - src/models/mod.rs | 6 +- src/models/moderate_user_request.rs | 6 +- src/models/notification.rs | 12 +- src/models/notification_detail_invite.rs | 1 - .../notification_detail_invite_response.rs | 6 +- .../notification_detail_request_invite.rs | 1 - ...fication_detail_request_invite_response.rs | 1 - .../notification_detail_vote_to_kick.rs | 1 - src/models/notification_type.rs | 2 - src/models/order_option.rs | 2 - .../paginated_group_audit_log_entry_list.rs | 1 - src/models/past_display_name.rs | 1 - src/models/permission.rs | 10 +- src/models/player_moderation.rs | 11 +- src/models/player_moderation_type.rs | 2 - src/models/region.rs | 2 - src/models/release_status.rs | 2 - src/models/represented_group.rs | 29 +- src/models/request_invite_request.rs | 5 +- src/models/respond_group_join_request.rs | 1 - src/models/response.rs | 1 - src/models/sent_notification.rs | 13 +- src/models/sort_option.rs | 2 - src/models/subscription.rs | 12 +- src/models/subscription_period.rs | 2 - src/models/success.rs | 7 +- src/models/transaction.rs | 21 +- src/models/transaction_agreement.rs | 22 +- src/models/transaction_status.rs | 2 - src/models/transaction_steam_info.rs | 15 +- src/models/transaction_steam_wallet_info.rs | 10 +- src/models/two_factor_auth_code.rs | 5 +- src/models/two_factor_email_code.rs | 5 +- src/models/two_factor_required.rs | 39 + src/models/unity_package.rs | 24 +- src/models/update_avatar_request.rs | 1 - src/models/update_favorite_group_request.rs | 1 - src/models/update_group_gallery_request.rs | 29 +- src/models/update_group_member_request.rs | 6 +- src/models/update_group_request.rs | 15 +- src/models/update_group_role_request.rs | 1 - src/models/update_invite_message_request.rs | 5 +- src/models/update_user_request.rs | 1 - src/models/update_world_request.rs | 1 - src/models/user.rs | 43 +- src/models/user_exists.rs | 5 +- src/models/user_state.rs | 2 - src/models/user_status.rs | 2 - src/models/user_subscription.rs | 20 +- src/models/verify2_fa_email_code_result.rs | 5 +- src/models/verify2_fa_result.rs | 5 +- src/models/verify_auth_token_result.rs | 6 +- src/models/world.rs | 34 +- src/models/world_metadata.rs | 6 +- src/models/world_publish_status.rs | 5 +- 167 files changed, 4478 insertions(+), 1495 deletions(-) create mode 100644 docs/GetCurrentUser200Response.md create mode 100644 docs/TwoFactorRequired.md create mode 100644 src/models/get_current_user_200_response.rs create mode 100644 src/models/two_factor_required.rs diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 873d216..64cc5e5 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -47,6 +47,7 @@ docs/FilesApi.md docs/FinishFileDataUploadRequest.md docs/FriendStatus.md docs/FriendsApi.md +docs/GetCurrentUser200Response.md docs/Group.md docs/GroupAccessType.md docs/GroupAnnouncement.md @@ -132,6 +133,7 @@ docs/TransactionSteamInfo.md docs/TransactionSteamWalletInfo.md docs/TwoFactorAuthCode.md docs/TwoFactorEmailCode.md +docs/TwoFactorRequired.md docs/UnityPackage.md docs/UpdateAvatarRequest.md docs/UpdateFavoriteGroupRequest.md @@ -215,6 +217,7 @@ src/models/file_version.rs src/models/file_version_upload_status.rs src/models/finish_file_data_upload_request.rs src/models/friend_status.rs +src/models/get_current_user_200_response.rs src/models/group.rs src/models/group_access_type.rs src/models/group_announcement.rs @@ -294,6 +297,7 @@ src/models/transaction_steam_info.rs src/models/transaction_steam_wallet_info.rs src/models/two_factor_auth_code.rs src/models/two_factor_email_code.rs +src/models/two_factor_required.rs src/models/unity_package.rs src/models/update_avatar_request.rs src/models/update_favorite_group_request.rs diff --git a/docs/AuthenticationApi.md b/docs/AuthenticationApi.md index f818677..805d6d9 100644 --- a/docs/AuthenticationApi.md +++ b/docs/AuthenticationApi.md @@ -80,7 +80,7 @@ Name | Type | Description | Required | Notes ## get_current_user -> models::CurrentUser get_current_user() +> models::GetCurrentUser200Response get_current_user() Login and/or Get Current User Info This endpoint does the following two operations: 1) Checks if you are already logged in by looking for a valid `auth` cookie. If you are have a valid auth cookie then no additional auth-related actions are taken. If you are **not** logged in then it will log you in with the `Authorization` header and set the `auth` cookie. The `auth` cookie will only be sent once. 2) If logged in, this function will also return the CurrentUser object containing detailed information about the currently logged in user. The auth string after `Authorization: Basic {string}` is a base64-encoded string of the username and password, both individually url-encoded, and then joined with a colon. > base64(urlencode(username):urlencode(password)) **WARNING: Session Limit:** Each authentication with login credentials counts as a separate session, out of which you have a limited amount. Make sure to save and reuse the `auth` cookie if you are often restarting the program. The provided API libraries automatically save cookies during runtime, but does not persist during restart. While it can be fine to use username/password during development, expect in production to very fast run into the rate-limit and be temporarily blocked from making new sessions until older ones expire. The exact number of simultaneous sessions is unknown/undisclosed. @@ -91,7 +91,7 @@ This endpoint does not need any parameter. ### Return type -[**models::CurrentUser**](CurrentUser.md) +[**models::GetCurrentUser200Response**](getCurrentUser_200_response.md) ### Authorization diff --git a/docs/GetCurrentUser200Response.md b/docs/GetCurrentUser200Response.md new file mode 100644 index 0000000..b3bcbd7 --- /dev/null +++ b/docs/GetCurrentUser200Response.md @@ -0,0 +1,12 @@ +# GetCurrentUser200Response + +## Enum Variants + +| Name | Description | +|---- | -----| +| CurrentUser | | +| TwoFactorRequired | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/Group.md b/docs/Group.md index 2d93040..7f2859b 100644 --- a/docs/Group.md +++ b/docs/Group.md @@ -22,9 +22,9 @@ Name | Type | Description | Notes **member_count_synced_at** | Option<**String**> | | [optional] **is_verified** | Option<**bool**> | | [optional][default to false] **join_state** | Option<[**models::GroupJoinState**](GroupJoinState.md)> | | [optional] -**tags** | Option<**Vec**> | | [optional] +**tags** | Option<**Vec**> | | [optional] **transfer_target_id** | Option<**String**> | A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. | [optional] -**galleries** | Option<[**Vec**](GroupGallery.md)> | | [optional] +**galleries** | Option<[**Vec**](GroupGallery.md)> | | [optional] **created_at** | Option<**String**> | | [optional] **updated_at** | Option<**String**> | | [optional] **last_post_created_at** | Option<**String**> | | [optional] diff --git a/docs/TwoFactorRequired.md b/docs/TwoFactorRequired.md new file mode 100644 index 0000000..275574b --- /dev/null +++ b/docs/TwoFactorRequired.md @@ -0,0 +1,11 @@ +# TwoFactorRequired + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**requires_two_factor_auth** | **Vec** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/examples/online.rs b/examples/online.rs index 387bcfb..f75f52f 100644 --- a/examples/online.rs +++ b/examples/online.rs @@ -2,14 +2,50 @@ pub use vrchatapi::apis; #[tokio::main] async fn main() { - let mut config = apis::configuration::Configuration::default(); - config.basic_auth = Some((String::from("username"), Some(String::from("password")))); + let config = apis::configuration::Configuration { + // credentials do not belong in source code, use arguments or environment variables + basic_auth: Some((String::from("username"), Some(String::from("password")))), + ..Default::default() + }; - match apis::authentication_api::get_current_user(&config).await.unwrap() { - vrchatapi::models::EitherUserOrTwoFactor::CurrentUser(me) => println!("Username: {}", me.username.unwrap()), - vrchatapi::models::EitherUserOrTwoFactor::RequiresTwoFactorAuth(requires_auth) => println!("The Username requires Auth: {:?}", requires_auth.requires_two_factor_auth) - } + let current_user = match apis::authentication_api::get_current_user(&config) + .await + .expect("Failed to get current user") + { + vrchatapi::models::GetCurrentUser200Response::CurrentUser(user) => user, + vrchatapi::models::GetCurrentUser200Response::TwoFactorRequired(_two_factor_resp) => { + // The API returns you a list of methods to verify your 2FA, this determines what function to call next + // this example assumes you have a TOTP code - let online = apis::system_api::get_current_online_users(&config).await.unwrap(); + let code = "123456"; // grab this via stdin or generate it + + let resp = apis::authentication_api::verify2_fa( + &config, + vrchatapi::models::TwoFactorAuthCode { + code: code.to_string(), + }, + ) + .await + .expect("Failed to get 2FA response"); + + if !resp.verified { + panic!("Failed to verify 2FA"); + } + + match apis::authentication_api::get_current_user(&config) + .await + .expect("Failed to get current user") + { + vrchatapi::models::GetCurrentUser200Response::CurrentUser(user) => user, + _ => panic!("Got 2FA response, even after verifying 2FA"), + } + } + }; + + println!("Current User: {:?}", current_user.display_name); + + let online = apis::system_api::get_current_online_users(&config) + .await + .expect("Failed to get online users"); println!("Current Online Users: {}", online); -} \ No newline at end of file +} diff --git a/src/apis/authentication_api.rs b/src/apis/authentication_api.rs index 7b63769..5a2e4a9 100644 --- a/src/apis/authentication_api.rs +++ b/src/apis/authentication_api.rs @@ -6,12 +6,10 @@ * Generated by: https://openapi-generator.tech */ - +use super::{configuration, Error}; +use crate::{apis::ResponseContent, models}; use reqwest; use serde::{Deserialize, Serialize}; -use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; - /// struct for typed errors of method [`check_user_exists`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -77,30 +75,41 @@ pub enum VerifyRecoveryCodeError { UnknownValue(serde_json::Value), } - /// Checks if a user by a given `username`, `displayName` or `email` exist. This is used during registration to check if a username has already been taken, during change of displayName to check if a displayName is available, and during change of email to check if the email is already used. In the later two cases the `excludeUserId` is used to exclude oneself, otherwise the result would always be true. It is **REQUIRED** to include **AT LEAST** `username`, `displayName` **or** `email` query parameter. Although they can be combined - in addition with `excludeUserId` (generally to exclude yourself) - to further fine-tune the search. -pub async fn check_user_exists(configuration: &configuration::Configuration, email: Option<&str>, display_name: Option<&str>, username: Option<&str>, exclude_user_id: Option<&str>) -> Result> { +pub async fn check_user_exists( + configuration: &configuration::Configuration, + email: Option<&str>, + display_name: Option<&str>, + username: Option<&str>, + exclude_user_id: Option<&str>, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/auth/exists", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = email { - local_var_req_builder = local_var_req_builder.query(&[("email", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("email", &local_var_str.to_string())]); } if let Some(ref local_var_str) = display_name { - local_var_req_builder = local_var_req_builder.query(&[("displayName", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("displayName", &local_var_str.to_string())]); } if let Some(ref local_var_str) = username { - local_var_req_builder = local_var_req_builder.query(&[("username", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("username", &local_var_str.to_string())]); } if let Some(ref local_var_str) = exclude_user_id { - local_var_req_builder = local_var_req_builder.query(&[("excludeUserId", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("excludeUserId", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -112,23 +121,37 @@ pub async fn check_user_exists(configuration: &configuration::Configuration, ema if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Deletes the account with given ID. Normal users only have permission to delete their own account. Account deletion is 14 days from this request, and will be cancelled if you do an authenticated request with the account afterwards. **VRC+ NOTE:** Despite the 14-days cooldown, any VRC+ subscription will be cancelled **immediately**. **METHOD NOTE:** Despite this being a Delete action, the method type required is PUT. -pub async fn delete_user(configuration: &configuration::Configuration, user_id: &str) -> Result> { +pub async fn delete_user( + configuration: &configuration::Configuration, + user_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/users/{userId}/delete", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/users/{userId}/delete", + local_var_configuration.base_path, + userId = crate::apis::urlencode(user_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -140,26 +163,38 @@ pub async fn delete_user(configuration: &configuration::Configuration, user_id: if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// This endpoint does the following two operations: 1) Checks if you are already logged in by looking for a valid `auth` cookie. If you are have a valid auth cookie then no additional auth-related actions are taken. If you are **not** logged in then it will log you in with the `Authorization` header and set the `auth` cookie. The `auth` cookie will only be sent once. 2) If logged in, this function will also return the CurrentUser object containing detailed information about the currently logged in user. The auth string after `Authorization: Basic {string}` is a base64-encoded string of the username and password, both individually url-encoded, and then joined with a colon. > base64(urlencode(username):urlencode(password)) **WARNING: Session Limit:** Each authentication with login credentials counts as a separate session, out of which you have a limited amount. Make sure to save and reuse the `auth` cookie if you are often restarting the program. The provided API libraries automatically save cookies during runtime, but does not persist during restart. While it can be fine to use username/password during development, expect in production to very fast run into the rate-limit and be temporarily blocked from making new sessions until older ones expire. The exact number of simultaneous sessions is unknown/undisclosed. -pub async fn get_current_user(configuration: &configuration::Configuration, ) -> Result> { +pub async fn get_current_user( + configuration: &configuration::Configuration, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/auth/user", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); + local_var_req_builder = local_var_req_builder.basic_auth( + local_var_auth_conf.0.to_owned(), + local_var_auth_conf.1.to_owned(), + ); }; let local_var_req = local_var_req_builder.build()?; @@ -171,23 +206,32 @@ pub async fn get_current_user(configuration: &configuration::Configuration, ) -> if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Invalidates the login session. -pub async fn logout(configuration: &configuration::Configuration, ) -> Result> { +pub async fn logout( + configuration: &configuration::Configuration, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/logout", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -200,22 +244,34 @@ pub async fn logout(configuration: &configuration::Configuration, ) -> Result = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Finishes the login sequence with a normal 2FA-generated code for accounts with 2FA-protection enabled. -pub async fn verify2_fa(configuration: &configuration::Configuration, two_factor_auth_code: models::TwoFactorAuthCode) -> Result> { +pub async fn verify2_fa( + configuration: &configuration::Configuration, + two_factor_auth_code: models::TwoFactorAuthCode, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/auth/twofactorauth/totp/verify", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/auth/twofactorauth/totp/verify", + local_var_configuration.base_path + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&two_factor_auth_code); @@ -228,23 +284,36 @@ pub async fn verify2_fa(configuration: &configuration::Configuration, two_factor if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Finishes the login sequence with an 2FA email code. -pub async fn verify2_fa_email_code(configuration: &configuration::Configuration, two_factor_email_code: models::TwoFactorEmailCode) -> Result> { +pub async fn verify2_fa_email_code( + configuration: &configuration::Configuration, + two_factor_email_code: models::TwoFactorEmailCode, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/auth/twofactorauth/emailotp/verify", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/auth/twofactorauth/emailotp/verify", + local_var_configuration.base_path + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&two_factor_email_code); @@ -257,23 +326,32 @@ pub async fn verify2_fa_email_code(configuration: &configuration::Configuration, if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Verify whether the currently provided Auth Token is valid. -pub async fn verify_auth_token(configuration: &configuration::Configuration, ) -> Result> { +pub async fn verify_auth_token( + configuration: &configuration::Configuration, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/auth", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -285,23 +363,36 @@ pub async fn verify_auth_token(configuration: &configuration::Configuration, ) - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Finishes the login sequence with an OTP (One Time Password) recovery code for accounts with 2FA-protection enabled. -pub async fn verify_recovery_code(configuration: &configuration::Configuration, two_factor_auth_code: models::TwoFactorAuthCode) -> Result> { +pub async fn verify_recovery_code( + configuration: &configuration::Configuration, + two_factor_auth_code: models::TwoFactorAuthCode, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/auth/twofactorauth/otp/verify", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/auth/twofactorauth/otp/verify", + local_var_configuration.base_path + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&two_factor_auth_code); @@ -314,9 +405,13 @@ pub async fn verify_recovery_code(configuration: &configuration::Configuration, if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } - diff --git a/src/apis/avatars_api.rs b/src/apis/avatars_api.rs index c6595ce..69cc726 100644 --- a/src/apis/avatars_api.rs +++ b/src/apis/avatars_api.rs @@ -6,12 +6,10 @@ * Generated by: https://openapi-generator.tech */ - +use super::{configuration, Error}; +use crate::{apis::ResponseContent, models}; use reqwest; use serde::{Deserialize, Serialize}; -use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; - /// struct for typed errors of method [`create_avatar`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -93,18 +91,22 @@ pub enum UpdateAvatarError { UnknownValue(serde_json::Value), } - /// Create an avatar. It's possible to optionally specify a ID if you want a custom one. Attempting to create an Avatar with an already claimed ID will result in a DB error. -pub async fn create_avatar(configuration: &configuration::Configuration, create_avatar_request: Option) -> Result> { +pub async fn create_avatar( + configuration: &configuration::Configuration, + create_avatar_request: Option, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/avatars", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&create_avatar_request); @@ -117,23 +119,37 @@ pub async fn create_avatar(configuration: &configuration::Configuration, create_ if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Delete an avatar. Notice an avatar is never fully \"deleted\", only its ReleaseStatus is set to \"hidden\" and the linked Files are deleted. The AvatarID is permanently reserved. -pub async fn delete_avatar(configuration: &configuration::Configuration, avatar_id: &str) -> Result> { +pub async fn delete_avatar( + configuration: &configuration::Configuration, + avatar_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/avatars/{avatarId}", local_var_configuration.base_path, avatarId=crate::apis::urlencode(avatar_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/avatars/{avatarId}", + local_var_configuration.base_path, + avatarId = crate::apis::urlencode(avatar_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -145,23 +161,37 @@ pub async fn delete_avatar(configuration: &configuration::Configuration, avatar_ if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Get information about a specific Avatar. -pub async fn get_avatar(configuration: &configuration::Configuration, avatar_id: &str) -> Result> { +pub async fn get_avatar( + configuration: &configuration::Configuration, + avatar_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/avatars/{avatarId}", local_var_configuration.base_path, avatarId=crate::apis::urlencode(avatar_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/avatars/{avatarId}", + local_var_configuration.base_path, + avatarId = crate::apis::urlencode(avatar_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -173,62 +203,95 @@ pub async fn get_avatar(configuration: &configuration::Configuration, avatar_id: if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Search and list favorited avatars by query filters. -pub async fn get_favorited_avatars(configuration: &configuration::Configuration, featured: Option, sort: Option, n: Option, order: Option, offset: Option, search: Option<&str>, tag: Option<&str>, notag: Option<&str>, release_status: Option, max_unity_version: Option<&str>, min_unity_version: Option<&str>, platform: Option<&str>, user_id: Option<&str>) -> Result, Error> { +pub async fn get_favorited_avatars( + configuration: &configuration::Configuration, + featured: Option, + sort: Option, + n: Option, + order: Option, + offset: Option, + search: Option<&str>, + tag: Option<&str>, + notag: Option<&str>, + release_status: Option, + max_unity_version: Option<&str>, + min_unity_version: Option<&str>, + platform: Option<&str>, + user_id: Option<&str>, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/avatars/favorites", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = featured { - local_var_req_builder = local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); } if let Some(ref local_var_str) = sort { - local_var_req_builder = local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); } if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = order { - local_var_req_builder = local_var_req_builder.query(&[("order", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("order", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_str) = search { - local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("search", &local_var_str.to_string())]); } if let Some(ref local_var_str) = tag { local_var_req_builder = local_var_req_builder.query(&[("tag", &local_var_str.to_string())]); } if let Some(ref local_var_str) = notag { - local_var_req_builder = local_var_req_builder.query(&[("notag", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("notag", &local_var_str.to_string())]); } if let Some(ref local_var_str) = release_status { - local_var_req_builder = local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]); } if let Some(ref local_var_str) = max_unity_version { - local_var_req_builder = local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]); } if let Some(ref local_var_str) = min_unity_version { - local_var_req_builder = local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]); } if let Some(ref local_var_str) = platform { - local_var_req_builder = local_var_req_builder.query(&[("platform", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("platform", &local_var_str.to_string())]); } if let Some(ref local_var_str) = user_id { - local_var_req_builder = local_var_req_builder.query(&[("userId", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("userId", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -240,23 +303,37 @@ pub async fn get_favorited_avatars(configuration: &configuration::Configuration, if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Get the current avatar for the user. This will return an error for any other user than the one logged in. -pub async fn get_own_avatar(configuration: &configuration::Configuration, user_id: &str) -> Result> { +pub async fn get_own_avatar( + configuration: &configuration::Configuration, + user_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/users/{userId}/avatar", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/users/{userId}/avatar", + local_var_configuration.base_path, + userId = crate::apis::urlencode(user_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -268,62 +345,95 @@ pub async fn get_own_avatar(configuration: &configuration::Configuration, user_i if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Search and list avatars by query filters. You can only search your own or featured avatars. It is not possible as a normal user to search other peoples avatars. -pub async fn search_avatars(configuration: &configuration::Configuration, featured: Option, sort: Option, user: Option<&str>, user_id: Option<&str>, n: Option, order: Option, offset: Option, tag: Option<&str>, notag: Option<&str>, release_status: Option, max_unity_version: Option<&str>, min_unity_version: Option<&str>, platform: Option<&str>) -> Result, Error> { +pub async fn search_avatars( + configuration: &configuration::Configuration, + featured: Option, + sort: Option, + user: Option<&str>, + user_id: Option<&str>, + n: Option, + order: Option, + offset: Option, + tag: Option<&str>, + notag: Option<&str>, + release_status: Option, + max_unity_version: Option<&str>, + min_unity_version: Option<&str>, + platform: Option<&str>, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/avatars", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = featured { - local_var_req_builder = local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); } if let Some(ref local_var_str) = sort { - local_var_req_builder = local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); } if let Some(ref local_var_str) = user { - local_var_req_builder = local_var_req_builder.query(&[("user", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("user", &local_var_str.to_string())]); } if let Some(ref local_var_str) = user_id { - local_var_req_builder = local_var_req_builder.query(&[("userId", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("userId", &local_var_str.to_string())]); } if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = order { - local_var_req_builder = local_var_req_builder.query(&[("order", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("order", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_str) = tag { local_var_req_builder = local_var_req_builder.query(&[("tag", &local_var_str.to_string())]); } if let Some(ref local_var_str) = notag { - local_var_req_builder = local_var_req_builder.query(&[("notag", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("notag", &local_var_str.to_string())]); } if let Some(ref local_var_str) = release_status { - local_var_req_builder = local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]); } if let Some(ref local_var_str) = max_unity_version { - local_var_req_builder = local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]); } if let Some(ref local_var_str) = min_unity_version { - local_var_req_builder = local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]); } if let Some(ref local_var_str) = platform { - local_var_req_builder = local_var_req_builder.query(&[("platform", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("platform", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -335,23 +445,37 @@ pub async fn search_avatars(configuration: &configuration::Configuration, featur if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Switches into that avatar. -pub async fn select_avatar(configuration: &configuration::Configuration, avatar_id: &str) -> Result> { +pub async fn select_avatar( + configuration: &configuration::Configuration, + avatar_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/avatars/{avatarId}/select", local_var_configuration.base_path, avatarId=crate::apis::urlencode(avatar_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/avatars/{avatarId}/select", + local_var_configuration.base_path, + avatarId = crate::apis::urlencode(avatar_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -363,23 +487,37 @@ pub async fn select_avatar(configuration: &configuration::Configuration, avatar_ if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Switches into that avatar as your fallback avatar. -pub async fn select_fallback_avatar(configuration: &configuration::Configuration, avatar_id: &str) -> Result> { +pub async fn select_fallback_avatar( + configuration: &configuration::Configuration, + avatar_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/avatars/{avatarId}/selectFallback", local_var_configuration.base_path, avatarId=crate::apis::urlencode(avatar_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/avatars/{avatarId}/selectFallback", + local_var_configuration.base_path, + avatarId = crate::apis::urlencode(avatar_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -391,23 +529,38 @@ pub async fn select_fallback_avatar(configuration: &configuration::Configuration if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Update information about a specific avatar. -pub async fn update_avatar(configuration: &configuration::Configuration, avatar_id: &str, update_avatar_request: Option) -> Result> { +pub async fn update_avatar( + configuration: &configuration::Configuration, + avatar_id: &str, + update_avatar_request: Option, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/avatars/{avatarId}", local_var_configuration.base_path, avatarId=crate::apis::urlencode(avatar_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/avatars/{avatarId}", + local_var_configuration.base_path, + avatarId = crate::apis::urlencode(avatar_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&update_avatar_request); @@ -420,9 +573,13 @@ pub async fn update_avatar(configuration: &configuration::Configuration, avatar_ if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } - diff --git a/src/apis/configuration.rs b/src/apis/configuration.rs index 4496c7b..f291efa 100644 --- a/src/apis/configuration.rs +++ b/src/apis/configuration.rs @@ -6,8 +6,6 @@ * Generated by: https://openapi-generator.tech */ - - #[derive(Debug, Clone)] pub struct Configuration { pub base_path: String, @@ -28,7 +26,6 @@ pub struct ApiKey { pub key: String, } - impl Configuration { pub fn new() -> Configuration { Configuration::default() @@ -40,12 +37,14 @@ impl Default for Configuration { Configuration { base_path: "https://vrchat.com/api/1".to_owned(), user_agent: Some("vrchatapi-rust".to_owned()), - client: reqwest::Client::builder().cookie_store(true).build().unwrap(), + client: reqwest::Client::builder() + .cookie_store(true) + .build() + .expect("Failed to build client"), basic_auth: None, oauth_access_token: None, bearer_access_token: None, api_key: None, - } } } diff --git a/src/apis/economy_api.rs b/src/apis/economy_api.rs index ae46112..c440110 100644 --- a/src/apis/economy_api.rs +++ b/src/apis/economy_api.rs @@ -6,12 +6,10 @@ * Generated by: https://openapi-generator.tech */ - +use super::{configuration, Error}; +use crate::{apis::ResponseContent, models}; use reqwest; use serde::{Deserialize, Serialize}; -use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; - /// struct for typed errors of method [`get_current_subscriptions`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -53,18 +51,24 @@ pub enum GetSubscriptionsError { UnknownValue(serde_json::Value), } - /// Get a list of all current user subscriptions. -pub async fn get_current_subscriptions(configuration: &configuration::Configuration, ) -> Result, Error> { +pub async fn get_current_subscriptions( + configuration: &configuration::Configuration, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/auth/user/subscription", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/auth/user/subscription", + local_var_configuration.base_path + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -76,23 +80,37 @@ pub async fn get_current_subscriptions(configuration: &configuration::Configurat if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Get a single License Group by given ID. -pub async fn get_license_group(configuration: &configuration::Configuration, license_group_id: &str) -> Result> { +pub async fn get_license_group( + configuration: &configuration::Configuration, + license_group_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/licenseGroups/{licenseGroupId}", local_var_configuration.base_path, licenseGroupId=crate::apis::urlencode(license_group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/licenseGroups/{licenseGroupId}", + local_var_configuration.base_path, + licenseGroupId = crate::apis::urlencode(license_group_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -104,23 +122,37 @@ pub async fn get_license_group(configuration: &configuration::Configuration, lic if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Get a single Steam transactions by ID. This returns the exact same information as `getSteamTransactions`, so no point in using this endpoint. -pub async fn get_steam_transaction(configuration: &configuration::Configuration, transaction_id: &str) -> Result> { +pub async fn get_steam_transaction( + configuration: &configuration::Configuration, + transaction_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/Steam/transactions/{transactionId}", local_var_configuration.base_path, transactionId=crate::apis::urlencode(transaction_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/Steam/transactions/{transactionId}", + local_var_configuration.base_path, + transactionId = crate::apis::urlencode(transaction_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -132,23 +164,32 @@ pub async fn get_steam_transaction(configuration: &configuration::Configuration, if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Get all own Steam transactions. -pub async fn get_steam_transactions(configuration: &configuration::Configuration, ) -> Result, Error> { +pub async fn get_steam_transactions( + configuration: &configuration::Configuration, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/Steam/transactions", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -160,23 +201,32 @@ pub async fn get_steam_transactions(configuration: &configuration::Configuration if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// List all existing Subscriptions. For example, \"vrchatplus-monthly\" and \"vrchatplus-yearly\". -pub async fn get_subscriptions(configuration: &configuration::Configuration, ) -> Result, Error> { +pub async fn get_subscriptions( + configuration: &configuration::Configuration, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/subscriptions", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -188,9 +238,13 @@ pub async fn get_subscriptions(configuration: &configuration::Configuration, ) - if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + 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)) } } - diff --git a/src/apis/favorites_api.rs b/src/apis/favorites_api.rs index 1b8b37e..aeb9f93 100644 --- a/src/apis/favorites_api.rs +++ b/src/apis/favorites_api.rs @@ -6,12 +6,10 @@ * Generated by: https://openapi-generator.tech */ - +use super::{configuration, Error}; +use crate::{apis::ResponseContent, models}; use reqwest; use serde::{Deserialize, Serialize}; -use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; - /// struct for typed errors of method [`add_favorite`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -77,18 +75,22 @@ pub enum UpdateFavoriteGroupError { UnknownValue(serde_json::Value), } - /// Add a new favorite. Friend groups are named `group_0` through `group_3`. Avatar and World groups are named `avatars1` to `avatars4` and `worlds1` to `worlds4`. You cannot add people whom you are not friends with to your friends list. Destroying a friendship removes the person as favorite on both sides. -pub async fn add_favorite(configuration: &configuration::Configuration, add_favorite_request: Option) -> Result> { +pub async fn add_favorite( + configuration: &configuration::Configuration, + add_favorite_request: Option, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/favorites", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&add_favorite_request); @@ -101,23 +103,41 @@ pub async fn add_favorite(configuration: &configuration::Configuration, add_favo if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Clear ALL contents of a specific favorite group. -pub async fn clear_favorite_group(configuration: &configuration::Configuration, favorite_group_type: &str, favorite_group_name: &str, user_id: &str) -> Result> { +pub async fn clear_favorite_group( + configuration: &configuration::Configuration, + favorite_group_type: &str, + favorite_group_name: &str, + user_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/favorite/group/{favoriteGroupType}/{favoriteGroupName}/{userId}", local_var_configuration.base_path, favoriteGroupType=crate::apis::urlencode(favorite_group_type), favoriteGroupName=crate::apis::urlencode(favorite_group_name), userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/favorite/group/{favoriteGroupType}/{favoriteGroupName}/{userId}", + local_var_configuration.base_path, + favoriteGroupType = crate::apis::urlencode(favorite_group_type), + favoriteGroupName = crate::apis::urlencode(favorite_group_name), + userId = crate::apis::urlencode(user_id) + ); + let 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()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -129,23 +149,37 @@ pub async fn clear_favorite_group(configuration: &configuration::Configuration, if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Return information about a specific Favorite. -pub async fn get_favorite(configuration: &configuration::Configuration, favorite_id: &str) -> Result> { +pub async fn get_favorite( + configuration: &configuration::Configuration, + favorite_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/favorites/{favoriteId}", local_var_configuration.base_path, favoriteId=crate::apis::urlencode(favorite_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/favorites/{favoriteId}", + local_var_configuration.base_path, + favoriteId = crate::apis::urlencode(favorite_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -157,23 +191,41 @@ pub async fn get_favorite(configuration: &configuration::Configuration, favorite if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Fetch information about a specific favorite group. -pub async fn get_favorite_group(configuration: &configuration::Configuration, favorite_group_type: &str, favorite_group_name: &str, user_id: &str) -> Result> { +pub async fn get_favorite_group( + configuration: &configuration::Configuration, + favorite_group_type: &str, + favorite_group_name: &str, + user_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/favorite/group/{favoriteGroupType}/{favoriteGroupName}/{userId}", local_var_configuration.base_path, favoriteGroupType=crate::apis::urlencode(favorite_group_type), favoriteGroupName=crate::apis::urlencode(favorite_group_name), userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/favorite/group/{favoriteGroupType}/{favoriteGroupName}/{userId}", + local_var_configuration.base_path, + favoriteGroupType = crate::apis::urlencode(favorite_group_type), + favoriteGroupName = crate::apis::urlencode(favorite_group_name), + userId = crate::apis::urlencode(user_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -185,32 +237,46 @@ pub async fn get_favorite_group(configuration: &configuration::Configuration, fa if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Return a list of favorite groups owned by a user. Returns the same information as `getFavoriteGroups`. -pub async fn get_favorite_groups(configuration: &configuration::Configuration, n: Option, offset: Option, owner_id: Option<&str>) -> Result, Error> { +pub async fn get_favorite_groups( + configuration: &configuration::Configuration, + n: Option, + offset: Option, + owner_id: Option<&str>, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/favorite/groups", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_str) = owner_id { - local_var_req_builder = local_var_req_builder.query(&[("ownerId", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("ownerId", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -222,35 +288,50 @@ pub async fn get_favorite_groups(configuration: &configuration::Configuration, n if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Returns a list of favorites. -pub async fn get_favorites(configuration: &configuration::Configuration, n: Option, offset: Option, r#type: Option<&str>, tag: Option<&str>) -> Result, Error> { +pub async fn get_favorites( + configuration: &configuration::Configuration, + n: Option, + offset: Option, + r#type: Option<&str>, + tag: Option<&str>, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/favorites", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_str) = r#type { - local_var_req_builder = local_var_req_builder.query(&[("type", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("type", &local_var_str.to_string())]); } if let Some(ref local_var_str) = tag { local_var_req_builder = local_var_req_builder.query(&[("tag", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -262,23 +343,37 @@ pub async fn get_favorites(configuration: &configuration::Configuration, n: Opti if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Remove a favorite from your favorites list. -pub async fn remove_favorite(configuration: &configuration::Configuration, favorite_id: &str) -> Result> { +pub async fn remove_favorite( + configuration: &configuration::Configuration, + favorite_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/favorites/{favoriteId}", local_var_configuration.base_path, favoriteId=crate::apis::urlencode(favorite_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/favorites/{favoriteId}", + local_var_configuration.base_path, + favoriteId = crate::apis::urlencode(favorite_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -290,23 +385,42 @@ pub async fn remove_favorite(configuration: &configuration::Configuration, favor if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Update information about a specific favorite group. -pub async fn update_favorite_group(configuration: &configuration::Configuration, favorite_group_type: &str, favorite_group_name: &str, user_id: &str, update_favorite_group_request: Option) -> Result<(), Error> { +pub async fn update_favorite_group( + configuration: &configuration::Configuration, + favorite_group_type: &str, + favorite_group_name: &str, + user_id: &str, + update_favorite_group_request: Option, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/favorite/group/{favoriteGroupType}/{favoriteGroupName}/{userId}", local_var_configuration.base_path, favoriteGroupType=crate::apis::urlencode(favorite_group_type), favoriteGroupName=crate::apis::urlencode(favorite_group_name), userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/favorite/group/{favoriteGroupType}/{favoriteGroupName}/{userId}", + local_var_configuration.base_path, + favoriteGroupType = crate::apis::urlencode(favorite_group_type), + favoriteGroupName = crate::apis::urlencode(favorite_group_name), + userId = crate::apis::urlencode(user_id) + ); + let 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()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&update_favorite_group_request); @@ -319,9 +433,13 @@ pub async fn update_favorite_group(configuration: &configuration::Configuration, if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } - diff --git a/src/apis/files_api.rs b/src/apis/files_api.rs index edff673..09646c8 100644 --- a/src/apis/files_api.rs +++ b/src/apis/files_api.rs @@ -6,12 +6,10 @@ * Generated by: https://openapi-generator.tech */ - +use super::{configuration, Error}; +use crate::{apis::ResponseContent, models}; use reqwest; use serde::{Deserialize, Serialize}; -use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; - /// struct for typed errors of method [`create_file`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -89,18 +87,22 @@ pub enum StartFileDataUploadError { UnknownValue(serde_json::Value), } - /// Creates a new File object -pub async fn create_file(configuration: &configuration::Configuration, create_file_request: Option) -> Result> { +pub async fn create_file( + configuration: &configuration::Configuration, + create_file_request: Option, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/file", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&create_file_request); @@ -113,23 +115,38 @@ pub async fn create_file(configuration: &configuration::Configuration, create_fi if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Creates a new FileVersion. Once a Version has been created, proceed to the `/file/{fileId}/{versionId}/file/start` endpoint to start a file upload. -pub async fn create_file_version(configuration: &configuration::Configuration, file_id: &str, create_file_version_request: Option) -> Result> { +pub async fn create_file_version( + configuration: &configuration::Configuration, + file_id: &str, + create_file_version_request: Option, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/file/{fileId}", local_var_configuration.base_path, fileId=crate::apis::urlencode(file_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/file/{fileId}", + local_var_configuration.base_path, + fileId = crate::apis::urlencode(file_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&create_file_version_request); @@ -142,23 +159,37 @@ pub async fn create_file_version(configuration: &configuration::Configuration, f if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Deletes a File object. -pub async fn delete_file(configuration: &configuration::Configuration, file_id: &str) -> Result> { +pub async fn delete_file( + configuration: &configuration::Configuration, + file_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/file/{fileId}", local_var_configuration.base_path, fileId=crate::apis::urlencode(file_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/file/{fileId}", + local_var_configuration.base_path, + fileId = crate::apis::urlencode(file_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -170,23 +201,39 @@ pub async fn delete_file(configuration: &configuration::Configuration, file_id: if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Delete a specific version of a file. You can only delete the latest version. -pub async fn delete_file_version(configuration: &configuration::Configuration, file_id: &str, version_id: i32) -> Result> { +pub async fn delete_file_version( + configuration: &configuration::Configuration, + file_id: &str, + version_id: i32, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/file/{fileId}/{versionId}", local_var_configuration.base_path, fileId=crate::apis::urlencode(file_id), versionId=version_id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/file/{fileId}/{versionId}", + local_var_configuration.base_path, + fileId = crate::apis::urlencode(file_id), + versionId = version_id + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -198,23 +245,39 @@ pub async fn delete_file_version(configuration: &configuration::Configuration, f if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Downloads the file with the provided version number. **Version Note:** Version 0 is always when the file was created. The real data is usually always located in version 1 and up. **Extension Note:** Files are not guaranteed to have a file extensions. UnityPackage files tends to have it, images through this endpoint do not. You are responsible for appending file extension from the `extension` field when neccesary. -pub async fn download_file_version(configuration: &configuration::Configuration, file_id: &str, version_id: i32) -> Result<(), Error> { +pub async fn download_file_version( + configuration: &configuration::Configuration, + file_id: &str, + version_id: i32, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/file/{fileId}/{versionId}", local_var_configuration.base_path, fileId=crate::apis::urlencode(file_id), versionId=version_id); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/file/{fileId}/{versionId}", + local_var_configuration.base_path, + fileId = crate::apis::urlencode(file_id), + versionId = version_id + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -226,23 +289,42 @@ pub async fn download_file_version(configuration: &configuration::Configuration, if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Finish an upload of a FileData. This will mark it as \"complete\". After uploading the `file` for Avatars and Worlds you then have to upload a `signature` file. -pub async fn finish_file_data_upload(configuration: &configuration::Configuration, file_id: &str, version_id: i32, file_type: &str, finish_file_data_upload_request: Option) -> Result> { +pub async fn finish_file_data_upload( + configuration: &configuration::Configuration, + file_id: &str, + version_id: i32, + file_type: &str, + finish_file_data_upload_request: Option, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/file/{fileId}/{versionId}/{fileType}/finish", local_var_configuration.base_path, fileId=crate::apis::urlencode(file_id), versionId=version_id, fileType=crate::apis::urlencode(file_type)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/file/{fileId}/{versionId}/{fileType}/finish", + local_var_configuration.base_path, + fileId = crate::apis::urlencode(file_id), + versionId = version_id, + fileType = crate::apis::urlencode(file_type) + ); + let 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()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&finish_file_data_upload_request); @@ -255,23 +337,37 @@ pub async fn finish_file_data_upload(configuration: &configuration::Configuratio if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Shows general information about the \"File\" object. Each File can have several \"Version\"'s, and each Version can have multiple real files or \"Data\" blobs. -pub async fn get_file(configuration: &configuration::Configuration, file_id: &str) -> Result> { +pub async fn get_file( + configuration: &configuration::Configuration, + file_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/file/{fileId}", local_var_configuration.base_path, fileId=crate::apis::urlencode(file_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/file/{fileId}", + local_var_configuration.base_path, + fileId = crate::apis::urlencode(file_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -284,22 +380,39 @@ pub async fn get_file(configuration: &configuration::Configuration, file_id: &st serde_json::from_str(&local_var_content).map_err(Error::from) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Retrieves the upload status for file upload. Can currently only be accessed when `status` is `waiting`. Trying to access it on a file version already uploaded currently times out. -pub async fn get_file_data_upload_status(configuration: &configuration::Configuration, file_id: &str, version_id: i32, file_type: &str) -> Result> { +pub async fn get_file_data_upload_status( + configuration: &configuration::Configuration, + file_id: &str, + version_id: i32, + file_type: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/file/{fileId}/{versionId}/{fileType}/status", local_var_configuration.base_path, fileId=crate::apis::urlencode(file_id), versionId=version_id, fileType=crate::apis::urlencode(file_type)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/file/{fileId}/{versionId}/{fileType}/status", + local_var_configuration.base_path, + fileId = crate::apis::urlencode(file_id), + versionId = version_id, + fileType = crate::apis::urlencode(file_type) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -311,35 +424,50 @@ pub async fn get_file_data_upload_status(configuration: &configuration::Configur if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Returns a list of files -pub async fn get_files(configuration: &configuration::Configuration, tag: Option<&str>, user_id: Option<&str>, n: Option, offset: Option) -> Result, Error> { +pub async fn get_files( + configuration: &configuration::Configuration, + tag: Option<&str>, + user_id: Option<&str>, + n: Option, + offset: Option, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/files", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = tag { local_var_req_builder = local_var_req_builder.query(&[("tag", &local_var_str.to_string())]); } if let Some(ref local_var_str) = user_id { - local_var_req_builder = local_var_req_builder.query(&[("userId", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("userId", &local_var_str.to_string())]); } if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -352,25 +480,44 @@ pub async fn get_files(configuration: &configuration::Configuration, tag: Option serde_json::from_str(&local_var_content).map_err(Error::from) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Starts an upload of a specific FilePart. This endpoint will return an AWS URL which you can PUT data to. You need to call this and receive a new AWS API URL for each `partNumber`. Please see AWS's REST documentation on \"PUT Object to S3\" on how to upload. Once all parts has been uploaded, proceed to `/finish` endpoint. **Note:** `nextPartNumber` seems like it is always ignored. Despite it returning 0, first partNumber is always 1. -pub async fn start_file_data_upload(configuration: &configuration::Configuration, file_id: &str, version_id: i32, file_type: &str, part_number: Option) -> Result> { +pub async fn start_file_data_upload( + configuration: &configuration::Configuration, + file_id: &str, + version_id: i32, + file_type: &str, + part_number: Option, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/file/{fileId}/{versionId}/{fileType}/start", local_var_configuration.base_path, fileId=crate::apis::urlencode(file_id), versionId=version_id, fileType=crate::apis::urlencode(file_type)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/file/{fileId}/{versionId}/{fileType}/start", + local_var_configuration.base_path, + fileId = crate::apis::urlencode(file_id), + versionId = version_id, + fileType = crate::apis::urlencode(file_type) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_str) = part_number { - local_var_req_builder = local_var_req_builder.query(&[("partNumber", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("partNumber", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -382,9 +529,13 @@ pub async fn start_file_data_upload(configuration: &configuration::Configuration if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } - diff --git a/src/apis/friends_api.rs b/src/apis/friends_api.rs index edd1f90..98ef77d 100644 --- a/src/apis/friends_api.rs +++ b/src/apis/friends_api.rs @@ -6,12 +6,10 @@ * Generated by: https://openapi-generator.tech */ - +use super::{configuration, Error}; +use crate::{apis::ResponseContent, models}; use reqwest; use serde::{Deserialize, Serialize}; -use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; - /// struct for typed errors of method [`delete_friend_request`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -57,18 +55,26 @@ pub enum UnfriendError { UnknownValue(serde_json::Value), } - /// Deletes an outgoing pending friend request to another user. To delete an incoming friend request, use the `deleteNotification` endpoint instead. -pub async fn delete_friend_request(configuration: &configuration::Configuration, user_id: &str) -> Result> { +pub async fn delete_friend_request( + configuration: &configuration::Configuration, + user_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/user/{userId}/friendRequest", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/user/{userId}/friendRequest", + local_var_configuration.base_path, + userId = crate::apis::urlencode(user_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -80,23 +86,37 @@ pub async fn delete_friend_request(configuration: &configuration::Configuration, if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Send a friend request to another user. -pub async fn friend(configuration: &configuration::Configuration, user_id: &str) -> Result> { +pub async fn friend( + configuration: &configuration::Configuration, + user_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/user/{userId}/friendRequest", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/user/{userId}/friendRequest", + local_var_configuration.base_path, + userId = crate::apis::urlencode(user_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -109,22 +129,35 @@ pub async fn friend(configuration: &configuration::Configuration, user_id: &str) serde_json::from_str(&local_var_content).map_err(Error::from) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Retrieve if the user is currently a friend with a given user, if they have an outgoing friend request, and if they have an incoming friend request. The proper way to receive and accept friend request is by checking if the user has an incoming `Notification` of type `friendRequest`, and then accepting that notification. -pub async fn get_friend_status(configuration: &configuration::Configuration, user_id: &str) -> Result> { +pub async fn get_friend_status( + configuration: &configuration::Configuration, + user_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/user/{userId}/friendStatus", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/user/{userId}/friendStatus", + local_var_configuration.base_path, + userId = crate::apis::urlencode(user_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -136,32 +169,46 @@ pub async fn get_friend_status(configuration: &configuration::Configuration, use if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// List information about friends. -pub async fn get_friends(configuration: &configuration::Configuration, offset: Option, n: Option, offline: Option) -> Result, Error> { +pub async fn get_friends( + configuration: &configuration::Configuration, + offset: Option, + n: Option, + offline: Option, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/auth/user/friends", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = offset { - local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offline { - local_var_req_builder = local_var_req_builder.query(&[("offline", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("offline", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -173,23 +220,37 @@ pub async fn get_friends(configuration: &configuration::Configuration, offset: O if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Unfriend a user by ID. -pub async fn unfriend(configuration: &configuration::Configuration, user_id: &str) -> Result> { +pub async fn unfriend( + configuration: &configuration::Configuration, + user_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/auth/user/friends/{userId}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/auth/user/friends/{userId}", + local_var_configuration.base_path, + userId = crate::apis::urlencode(user_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -202,8 +263,11 @@ pub async fn unfriend(configuration: &configuration::Configuration, user_id: &st serde_json::from_str(&local_var_content).map_err(Error::from) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } - diff --git a/src/apis/groups_api.rs b/src/apis/groups_api.rs index 2bc86e6..b785784 100644 --- a/src/apis/groups_api.rs +++ b/src/apis/groups_api.rs @@ -6,12 +6,10 @@ * Generated by: https://openapi-generator.tech */ - +use super::{configuration, Error}; +use crate::{apis::ResponseContent, models}; use reqwest; use serde::{Deserialize, Serialize}; -use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; - /// struct for typed errors of method [`add_group_gallery_image`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -399,18 +397,29 @@ pub enum UpdateGroupRoleError { UnknownValue(serde_json::Value), } - /// Adds an image to a Group gallery. -pub async fn add_group_gallery_image(configuration: &configuration::Configuration, group_id: &str, group_gallery_id: &str, add_group_gallery_image_request: models::AddGroupGalleryImageRequest) -> Result> { +pub async fn add_group_gallery_image( + configuration: &configuration::Configuration, + group_id: &str, + group_gallery_id: &str, + add_group_gallery_image_request: models::AddGroupGalleryImageRequest, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/galleries/{groupGalleryId}/images", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), groupGalleryId=crate::apis::urlencode(group_gallery_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/galleries/{groupGalleryId}/images", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id), + groupGalleryId = crate::apis::urlencode(group_gallery_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&add_group_gallery_image_request); @@ -423,23 +432,41 @@ pub async fn add_group_gallery_image(configuration: &configuration::Configuratio if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Adds a Role to a Group Member -pub async fn add_group_member_role(configuration: &configuration::Configuration, group_id: &str, user_id: &str, group_role_id: &str) -> Result, Error> { +pub async fn add_group_member_role( + configuration: &configuration::Configuration, + group_id: &str, + user_id: &str, + group_role_id: &str, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/members/{userId}/roles/{groupRoleId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), userId=crate::apis::urlencode(user_id), groupRoleId=crate::apis::urlencode(group_role_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/members/{userId}/roles/{groupRoleId}", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id), + userId = crate::apis::urlencode(user_id), + groupRoleId = crate::apis::urlencode(group_role_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()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -451,23 +478,38 @@ pub async fn add_group_member_role(configuration: &configuration::Configuration, if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + 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)) } } /// Create a post in a Group. -pub async fn add_group_post(configuration: &configuration::Configuration, group_id: &str, create_group_post_request: models::CreateGroupPostRequest) -> Result> { +pub async fn add_group_post( + configuration: &configuration::Configuration, + group_id: &str, + create_group_post_request: models::CreateGroupPostRequest, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/posts", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/posts", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&create_group_post_request); @@ -480,23 +522,38 @@ pub async fn add_group_post(configuration: &configuration::Configuration, group_ if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Bans a user from a Group. -pub async fn ban_group_member(configuration: &configuration::Configuration, group_id: &str, ban_group_member_request: models::BanGroupMemberRequest) -> Result> { +pub async fn ban_group_member( + configuration: &configuration::Configuration, + group_id: &str, + ban_group_member_request: models::BanGroupMemberRequest, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/bans", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/bans", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&ban_group_member_request); @@ -509,23 +566,37 @@ pub async fn ban_group_member(configuration: &configuration::Configuration, grou if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Cancels a request sent to join the group. -pub async fn cancel_group_request(configuration: &configuration::Configuration, group_id: &str) -> Result<(), Error> { +pub async fn cancel_group_request( + configuration: &configuration::Configuration, + group_id: &str, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/requests", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/requests", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_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()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -537,23 +608,33 @@ pub async fn cancel_group_request(configuration: &configuration::Configuration, if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Creates a Group and returns a Group object. **Requires VRC+ Subscription.** -pub async fn create_group(configuration: &configuration::Configuration, create_group_request: models::CreateGroupRequest) -> Result> { +pub async fn create_group( + configuration: &configuration::Configuration, + create_group_request: models::CreateGroupRequest, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/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()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&create_group_request); @@ -566,23 +647,38 @@ pub async fn create_group(configuration: &configuration::Configuration, create_g if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Creates an Announcement for a Group. -pub async fn create_group_announcement(configuration: &configuration::Configuration, group_id: &str, create_group_announcement_request: models::CreateGroupAnnouncementRequest) -> Result> { +pub async fn create_group_announcement( + configuration: &configuration::Configuration, + group_id: &str, + create_group_announcement_request: models::CreateGroupAnnouncementRequest, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/announcement", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/announcement", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&create_group_announcement_request); @@ -595,23 +691,38 @@ pub async fn create_group_announcement(configuration: &configuration::Configurat if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + 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)) } } /// Creates a gallery for a Group. -pub async fn create_group_gallery(configuration: &configuration::Configuration, group_id: &str, create_group_gallery_request: models::CreateGroupGalleryRequest) -> Result> { +pub async fn create_group_gallery( + configuration: &configuration::Configuration, + group_id: &str, + create_group_gallery_request: models::CreateGroupGalleryRequest, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/galleries", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/galleries", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&create_group_gallery_request); @@ -624,23 +735,38 @@ pub async fn create_group_gallery(configuration: &configuration::Configuration, if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + 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)) } } /// Sends an invite to a user to join the group. -pub async fn create_group_invite(configuration: &configuration::Configuration, group_id: &str, create_group_invite_request: models::CreateGroupInviteRequest) -> Result<(), Error> { +pub async fn create_group_invite( + configuration: &configuration::Configuration, + group_id: &str, + create_group_invite_request: models::CreateGroupInviteRequest, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/invites", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/invites", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&create_group_invite_request); @@ -653,23 +779,38 @@ pub async fn create_group_invite(configuration: &configuration::Configuration, g if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Create a Group role. -pub async fn create_group_role(configuration: &configuration::Configuration, group_id: &str, create_group_role_request: models::CreateGroupRoleRequest) -> Result> { +pub async fn create_group_role( + configuration: &configuration::Configuration, + group_id: &str, + create_group_role_request: models::CreateGroupRoleRequest, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/roles", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/roles", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&create_group_role_request); @@ -682,23 +823,37 @@ pub async fn create_group_role(configuration: &configuration::Configuration, gro if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Deletes a Group. -pub async fn delete_group(configuration: &configuration::Configuration, group_id: &str) -> Result> { +pub async fn delete_group( + configuration: &configuration::Configuration, + group_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_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()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -710,23 +865,37 @@ pub async fn delete_group(configuration: &configuration::Configuration, group_id if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Deletes the announcement for a Group. -pub async fn delete_group_announcement(configuration: &configuration::Configuration, group_id: &str) -> Result> { +pub async fn delete_group_announcement( + configuration: &configuration::Configuration, + group_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/announcement", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/announcement", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_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()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -738,23 +907,39 @@ pub async fn delete_group_announcement(configuration: &configuration::Configurat if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + 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)) } } /// Deletes a gallery for a Group. -pub async fn delete_group_gallery(configuration: &configuration::Configuration, group_id: &str, group_gallery_id: &str) -> Result> { +pub async fn delete_group_gallery( + configuration: &configuration::Configuration, + group_id: &str, + group_gallery_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/galleries/{groupGalleryId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), groupGalleryId=crate::apis::urlencode(group_gallery_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/galleries/{groupGalleryId}", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id), + groupGalleryId = crate::apis::urlencode(group_gallery_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()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -766,23 +951,41 @@ pub async fn delete_group_gallery(configuration: &configuration::Configuration, if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + 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)) } } /// Deletes an image from a Group gallery. -pub async fn delete_group_gallery_image(configuration: &configuration::Configuration, group_id: &str, group_gallery_id: &str, group_gallery_image_id: &str) -> Result> { +pub async fn delete_group_gallery_image( + configuration: &configuration::Configuration, + group_id: &str, + group_gallery_id: &str, + group_gallery_image_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/galleries/{groupGalleryId}/images/{groupGalleryImageId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), groupGalleryId=crate::apis::urlencode(group_gallery_id), groupGalleryImageId=crate::apis::urlencode(group_gallery_image_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/galleries/{groupGalleryId}/images/{groupGalleryImageId}", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id), + groupGalleryId = crate::apis::urlencode(group_gallery_id), + groupGalleryImageId = crate::apis::urlencode(group_gallery_image_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()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -794,23 +997,39 @@ pub async fn delete_group_gallery_image(configuration: &configuration::Configura if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Deletes an Group invite sent to a User -pub async fn delete_group_invite(configuration: &configuration::Configuration, group_id: &str, user_id: &str) -> Result<(), Error> { +pub async fn delete_group_invite( + configuration: &configuration::Configuration, + group_id: &str, + user_id: &str, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/invites/{userId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/invites/{userId}", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id), + userId = crate::apis::urlencode(user_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -822,23 +1041,39 @@ pub async fn delete_group_invite(configuration: &configuration::Configuration, g if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Delete a Group post -pub async fn delete_group_post(configuration: &configuration::Configuration, group_id: &str, notification_id: &str) -> Result> { +pub async fn delete_group_post( + configuration: &configuration::Configuration, + group_id: &str, + notification_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/posts/{notificationId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), notificationId=crate::apis::urlencode(notification_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/posts/{notificationId}", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id), + notificationId = crate::apis::urlencode(notification_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()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -850,23 +1085,39 @@ pub async fn delete_group_post(configuration: &configuration::Configuration, gro if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Deletes a Group Role by ID and returns the remaining roles. -pub async fn delete_group_role(configuration: &configuration::Configuration, group_id: &str, group_role_id: &str) -> Result, Error> { +pub async fn delete_group_role( + configuration: &configuration::Configuration, + group_id: &str, + group_role_id: &str, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/roles/{groupRoleId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), groupRoleId=crate::apis::urlencode(group_role_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/roles/{groupRoleId}", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id), + groupRoleId = crate::apis::urlencode(group_role_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()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -878,26 +1129,42 @@ pub async fn delete_group_role(configuration: &configuration::Configuration, gro if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Returns a single Group by ID. -pub async fn get_group(configuration: &configuration::Configuration, group_id: &str, include_roles: Option) -> Result> { +pub async fn get_group( + configuration: &configuration::Configuration, + group_id: &str, + include_roles: Option, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = include_roles { - local_var_req_builder = local_var_req_builder.query(&[("includeRoles", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("includeRoles", &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()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -910,22 +1177,35 @@ pub async fn get_group(configuration: &configuration::Configuration, group_id: & serde_json::from_str(&local_var_content).map_err(Error::from) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Returns the announcement for a Group. If no announcement has been made, then it returns **empty object**. If an announcement exists, then it will always return all fields except `imageId` and `imageUrl` which may be null. -pub async fn get_group_announcements(configuration: &configuration::Configuration, group_id: &str) -> Result> { +pub async fn get_group_announcements( + configuration: &configuration::Configuration, + group_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/announcement", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/announcement", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -937,35 +1217,56 @@ pub async fn get_group_announcements(configuration: &configuration::Configuratio if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Returns a list of audit logs for a Group. -pub async fn get_group_audit_logs(configuration: &configuration::Configuration, group_id: &str, n: Option, offset: Option, start_date: Option, end_date: Option) -> Result> { +pub async fn get_group_audit_logs( + configuration: &configuration::Configuration, + group_id: &str, + n: Option, + offset: Option, + start_date: Option, + end_date: Option, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/auditLogs", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/auditLogs", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_str) = start_date { - local_var_req_builder = local_var_req_builder.query(&[("startDate", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("startDate", &local_var_str.to_string())]); } if let Some(ref local_var_str) = end_date { - local_var_req_builder = local_var_req_builder.query(&[("endDate", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("endDate", &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()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -977,29 +1278,46 @@ pub async fn get_group_audit_logs(configuration: &configuration::Configuration, if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + 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)) } } /// Returns a list of banned users for a Group. -pub async fn get_group_bans(configuration: &configuration::Configuration, group_id: &str, n: Option, offset: Option) -> Result, Error> { +pub async fn get_group_bans( + configuration: &configuration::Configuration, + group_id: &str, + n: Option, + offset: Option, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/bans", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/bans", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1011,32 +1329,53 @@ pub async fn get_group_bans(configuration: &configuration::Configuration, group_ if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Returns a list of images for a Group gallery. -pub async fn get_group_gallery_images(configuration: &configuration::Configuration, group_id: &str, group_gallery_id: &str, n: Option, offset: Option, approved: Option) -> Result, Error> { +pub async fn get_group_gallery_images( + configuration: &configuration::Configuration, + group_id: &str, + group_gallery_id: &str, + n: Option, + offset: Option, + approved: Option, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/galleries/{groupGalleryId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), groupGalleryId=crate::apis::urlencode(group_gallery_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/galleries/{groupGalleryId}", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id), + groupGalleryId = crate::apis::urlencode(group_gallery_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) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_str) = approved { - local_var_req_builder = local_var_req_builder.query(&[("approved", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("approved", &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()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1048,23 +1387,37 @@ pub async fn get_group_gallery_images(configuration: &configuration::Configurati if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Returns a list of group instances -pub async fn get_group_instances(configuration: &configuration::Configuration, group_id: &str) -> Result, Error> { +pub async fn get_group_instances( + configuration: &configuration::Configuration, + group_id: &str, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/instances", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/instances", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1076,29 +1429,46 @@ pub async fn get_group_instances(configuration: &configuration::Configuration, g if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Returns a list of members that have been invited to the Group. -pub async fn get_group_invites(configuration: &configuration::Configuration, group_id: &str, n: Option, offset: Option) -> Result, Error> { +pub async fn get_group_invites( + configuration: &configuration::Configuration, + group_id: &str, + n: Option, + offset: Option, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/invites", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/invites", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1110,23 +1480,39 @@ pub async fn get_group_invites(configuration: &configuration::Configuration, gro if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Returns a LimitedGroup Member. -pub async fn get_group_member(configuration: &configuration::Configuration, group_id: &str, user_id: &str) -> Result> { +pub async fn get_group_member( + configuration: &configuration::Configuration, + group_id: &str, + user_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/members/{userId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/members/{userId}", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id), + userId = crate::apis::urlencode(user_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1138,32 +1524,51 @@ pub async fn get_group_member(configuration: &configuration::Configuration, grou if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Returns a List of all **other** Group Members. This endpoint will never return the user calling the endpoint. Information about the user calling the endpoint must be found in the `myMember` field of the Group object. -pub async fn get_group_members(configuration: &configuration::Configuration, group_id: &str, n: Option, offset: Option, sort: Option) -> Result, Error> { +pub async fn get_group_members( + configuration: &configuration::Configuration, + group_id: &str, + n: Option, + offset: Option, + sort: Option, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/members", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/members", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_str) = sort { - local_var_req_builder = local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1175,23 +1580,37 @@ pub async fn get_group_members(configuration: &configuration::Configuration, gro if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Returns a List of all possible/available permissions for a Group. -pub async fn get_group_permissions(configuration: &configuration::Configuration, group_id: &str) -> Result, Error> { +pub async fn get_group_permissions( + configuration: &configuration::Configuration, + group_id: &str, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/permissions", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/permissions", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1203,32 +1622,51 @@ pub async fn get_group_permissions(configuration: &configuration::Configuration, if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Get posts from a Group -pub async fn get_group_post(configuration: &configuration::Configuration, group_id: &str, n: Option, offset: Option, public_only: Option) -> Result> { +pub async fn get_group_post( + configuration: &configuration::Configuration, + group_id: &str, + n: Option, + offset: Option, + public_only: Option, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/posts", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/posts", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_str) = public_only { - local_var_req_builder = local_var_req_builder.query(&[("publicOnly", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("publicOnly", &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()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1240,32 +1678,51 @@ pub async fn get_group_post(configuration: &configuration::Configuration, group_ if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Returns a list of members that have requested to join the Group. -pub async fn get_group_requests(configuration: &configuration::Configuration, group_id: &str, n: Option, offset: Option, blocked: Option) -> Result, Error> { +pub async fn get_group_requests( + configuration: &configuration::Configuration, + group_id: &str, + n: Option, + offset: Option, + blocked: Option, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/requests", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/requests", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_str) = blocked { - local_var_req_builder = local_var_req_builder.query(&[("blocked", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("blocked", &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()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1277,23 +1734,37 @@ pub async fn get_group_requests(configuration: &configuration::Configuration, gr if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Returns a Group Role by ID. -pub async fn get_group_roles(configuration: &configuration::Configuration, group_id: &str) -> Result, Error> { +pub async fn get_group_roles( + configuration: &configuration::Configuration, + group_id: &str, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/roles", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/roles", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1305,23 +1776,37 @@ pub async fn get_group_roles(configuration: &configuration::Configuration, group if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Join a Group by ID and returns the member object. -pub async fn join_group(configuration: &configuration::Configuration, group_id: &str) -> Result> { +pub async fn join_group( + configuration: &configuration::Configuration, + group_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/join", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/join", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1333,23 +1818,39 @@ pub async fn join_group(configuration: &configuration::Configuration, group_id: if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Kicks a Group Member from the Group. The current user must have the \"Remove Group Members\" permission. -pub async fn kick_group_member(configuration: &configuration::Configuration, group_id: &str, user_id: &str) -> Result<(), Error> { +pub async fn kick_group_member( + configuration: &configuration::Configuration, + group_id: &str, + user_id: &str, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/members/{userId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/members/{userId}", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id), + userId = crate::apis::urlencode(user_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1361,23 +1862,37 @@ pub async fn kick_group_member(configuration: &configuration::Configuration, gro if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Leave a group by ID. -pub async fn leave_group(configuration: &configuration::Configuration, group_id: &str) -> Result<(), Error> { +pub async fn leave_group( + configuration: &configuration::Configuration, + group_id: &str, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/leave", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/leave", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1389,23 +1904,41 @@ pub async fn leave_group(configuration: &configuration::Configuration, group_id: if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Removes a Role from a Group Member -pub async fn remove_group_member_role(configuration: &configuration::Configuration, group_id: &str, user_id: &str, group_role_id: &str) -> Result, Error> { +pub async fn remove_group_member_role( + configuration: &configuration::Configuration, + group_id: &str, + user_id: &str, + group_role_id: &str, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/members/{userId}/roles/{groupRoleId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), userId=crate::apis::urlencode(user_id), groupRoleId=crate::apis::urlencode(group_role_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/members/{userId}/roles/{groupRoleId}", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id), + userId = crate::apis::urlencode(user_id), + groupRoleId = crate::apis::urlencode(group_role_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()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1417,23 +1950,40 @@ pub async fn remove_group_member_role(configuration: &configuration::Configurati if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Responds to a Group Join Request with Accept/Deny -pub async fn respond_group_join_request(configuration: &configuration::Configuration, group_id: &str, user_id: &str, respond_group_join_request: models::RespondGroupJoinRequest) -> Result<(), Error> { +pub async fn respond_group_join_request( + configuration: &configuration::Configuration, + group_id: &str, + user_id: &str, + respond_group_join_request: models::RespondGroupJoinRequest, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/requests/{userId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/requests/{userId}", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id), + userId = crate::apis::urlencode(user_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&respond_group_join_request); @@ -1446,32 +1996,46 @@ pub async fn respond_group_join_request(configuration: &configuration::Configura if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Searches Groups by name or shortCode -pub async fn search_groups(configuration: &configuration::Configuration, query: Option<&str>, offset: Option, n: Option) -> Result, Error> { +pub async fn search_groups( + configuration: &configuration::Configuration, + query: Option<&str>, + offset: Option, + n: Option, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/groups", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = query { - local_var_req_builder = local_var_req_builder.query(&[("query", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("query", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &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()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1483,23 +2047,39 @@ pub async fn search_groups(configuration: &configuration::Configuration, query: if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Unbans a user from a Group. -pub async fn unban_group_member(configuration: &configuration::Configuration, group_id: &str, user_id: &str) -> Result> { +pub async fn unban_group_member( + configuration: &configuration::Configuration, + group_id: &str, + user_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/bans/{userId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/bans/{userId}", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id), + userId = crate::apis::urlencode(user_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1511,23 +2091,38 @@ pub async fn unban_group_member(configuration: &configuration::Configuration, gr if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Updates a Group and returns it. -pub async fn update_group(configuration: &configuration::Configuration, group_id: &str, update_group_request: Option) -> Result> { +pub async fn update_group( + configuration: &configuration::Configuration, + group_id: &str, + update_group_request: Option, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_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()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&update_group_request); @@ -1540,23 +2135,40 @@ pub async fn update_group(configuration: &configuration::Configuration, group_id if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Updates a gallery for a Group. -pub async fn update_group_gallery(configuration: &configuration::Configuration, group_id: &str, group_gallery_id: &str, update_group_gallery_request: Option) -> Result> { +pub async fn update_group_gallery( + configuration: &configuration::Configuration, + group_id: &str, + group_gallery_id: &str, + update_group_gallery_request: Option, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/galleries/{groupGalleryId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), groupGalleryId=crate::apis::urlencode(group_gallery_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/galleries/{groupGalleryId}", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id), + groupGalleryId = crate::apis::urlencode(group_gallery_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()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&update_group_gallery_request); @@ -1569,23 +2181,40 @@ pub async fn update_group_gallery(configuration: &configuration::Configuration, if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + 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)) } } /// Updates a Group Member -pub async fn update_group_member(configuration: &configuration::Configuration, group_id: &str, user_id: &str, update_group_member_request: Option) -> Result> { +pub async fn update_group_member( + configuration: &configuration::Configuration, + group_id: &str, + user_id: &str, + update_group_member_request: Option, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/members/{userId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/members/{userId}", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id), + userId = crate::apis::urlencode(user_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&update_group_member_request); @@ -1598,23 +2227,40 @@ pub async fn update_group_member(configuration: &configuration::Configuration, g if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Edits a Group post -pub async fn update_group_post(configuration: &configuration::Configuration, group_id: &str, notification_id: &str, create_group_post_request: models::CreateGroupPostRequest) -> Result> { +pub async fn update_group_post( + configuration: &configuration::Configuration, + group_id: &str, + notification_id: &str, + create_group_post_request: models::CreateGroupPostRequest, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/posts/{notificationId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), notificationId=crate::apis::urlencode(notification_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/posts/{notificationId}", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id), + notificationId = crate::apis::urlencode(notification_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&create_group_post_request); @@ -1627,23 +2273,40 @@ pub async fn update_group_post(configuration: &configuration::Configuration, gro if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Updates a group role by ID. -pub async fn update_group_role(configuration: &configuration::Configuration, group_id: &str, group_role_id: &str, update_group_role_request: Option) -> Result, Error> { +pub async fn update_group_role( + configuration: &configuration::Configuration, + group_id: &str, + group_role_id: &str, + update_group_role_request: Option, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/groups/{groupId}/roles/{groupRoleId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), groupRoleId=crate::apis::urlencode(group_role_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/groups/{groupId}/roles/{groupRoleId}", + local_var_configuration.base_path, + groupId = crate::apis::urlencode(group_id), + groupRoleId = crate::apis::urlencode(group_role_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()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&update_group_role_request); @@ -1656,9 +2319,13 @@ pub async fn update_group_role(configuration: &configuration::Configuration, gro if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } - diff --git a/src/apis/instances_api.rs b/src/apis/instances_api.rs index fdff048..89a55ca 100644 --- a/src/apis/instances_api.rs +++ b/src/apis/instances_api.rs @@ -6,12 +6,10 @@ * Generated by: https://openapi-generator.tech */ - +use super::{configuration, Error}; +use crate::{apis::ResponseContent, models}; use reqwest; use serde::{Deserialize, Serialize}; -use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; - /// struct for typed errors of method [`close_instance`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -64,24 +62,38 @@ pub enum SendSelfInviteError { UnknownValue(serde_json::Value), } - /// Close an instance or update the closedAt time when it will be closed. You can only close an instance if the ownerId is yourself or if the instance owner is a group and you have the `group-instance-moderate` permission. -pub async fn close_instance(configuration: &configuration::Configuration, world_id: &str, instance_id: &str, hard_close: Option, closed_at: Option) -> Result> { +pub async fn close_instance( + configuration: &configuration::Configuration, + world_id: &str, + instance_id: &str, + hard_close: Option, + closed_at: Option, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/instances/{worldId}:{instanceId}", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id), instanceId=crate::apis::urlencode(instance_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/instances/{worldId}:{instanceId}", + local_var_configuration.base_path, + worldId = crate::apis::urlencode(world_id), + instanceId = crate::apis::urlencode(instance_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_str) = hard_close { - local_var_req_builder = local_var_req_builder.query(&[("hardClose", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("hardClose", &local_var_str.to_string())]); } if let Some(ref local_var_str) = closed_at { - local_var_req_builder = local_var_req_builder.query(&[("closedAt", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("closedAt", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -93,23 +105,33 @@ pub async fn close_instance(configuration: &configuration::Configuration, world_ if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Create an instance -pub async fn create_instance(configuration: &configuration::Configuration, create_instance_request: models::CreateInstanceRequest) -> Result> { +pub async fn create_instance( + configuration: &configuration::Configuration, + create_instance_request: models::CreateInstanceRequest, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/instances", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&create_instance_request); @@ -122,23 +144,39 @@ pub async fn create_instance(configuration: &configuration::Configuration, creat if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Returns an instance. Please read [Instances Tutorial](https://vrchatapi.github.io/tutorials/instances/) for more information on Instances. If an invalid instanceId is provided, this endpoint will simply return \"null\"! -pub async fn get_instance(configuration: &configuration::Configuration, world_id: &str, instance_id: &str) -> Result> { +pub async fn get_instance( + configuration: &configuration::Configuration, + world_id: &str, + instance_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/instances/{worldId}:{instanceId}", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id), instanceId=crate::apis::urlencode(instance_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/instances/{worldId}:{instanceId}", + local_var_configuration.base_path, + worldId = crate::apis::urlencode(world_id), + instanceId = crate::apis::urlencode(instance_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -150,23 +188,37 @@ pub async fn get_instance(configuration: &configuration::Configuration, world_id if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Returns an instance. Please read [Instances Tutorial](https://vrchatapi.github.io/tutorials/instances/) for more information on Instances. -pub async fn get_instance_by_short_name(configuration: &configuration::Configuration, short_name: &str) -> Result> { +pub async fn get_instance_by_short_name( + configuration: &configuration::Configuration, + short_name: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/instances/s/{shortName}", local_var_configuration.base_path, shortName=crate::apis::urlencode(short_name)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/instances/s/{shortName}", + local_var_configuration.base_path, + shortName = crate::apis::urlencode(short_name) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -178,23 +230,39 @@ pub async fn get_instance_by_short_name(configuration: &configuration::Configura if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Returns an instance short name. -pub async fn get_short_name(configuration: &configuration::Configuration, world_id: &str, instance_id: &str) -> Result> { +pub async fn get_short_name( + configuration: &configuration::Configuration, + world_id: &str, + instance_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/instances/{worldId}:{instanceId}/shortName", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id), instanceId=crate::apis::urlencode(instance_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/instances/{worldId}:{instanceId}/shortName", + local_var_configuration.base_path, + worldId = crate::apis::urlencode(world_id), + instanceId = crate::apis::urlencode(instance_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -206,23 +274,39 @@ pub async fn get_short_name(configuration: &configuration::Configuration, world_ if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Sends an invite to the instance to yourself. -pub async fn send_self_invite(configuration: &configuration::Configuration, world_id: &str, instance_id: &str) -> Result> { +pub async fn send_self_invite( + configuration: &configuration::Configuration, + world_id: &str, + instance_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/instances/{worldId}:{instanceId}/invite", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id), instanceId=crate::apis::urlencode(instance_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/instances/{worldId}:{instanceId}/invite", + local_var_configuration.base_path, + worldId = crate::apis::urlencode(world_id), + instanceId = crate::apis::urlencode(instance_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -234,9 +318,13 @@ pub async fn send_self_invite(configuration: &configuration::Configuration, worl if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } - diff --git a/src/apis/invite_api.rs b/src/apis/invite_api.rs index 5e7a82b..01d7e4c 100644 --- a/src/apis/invite_api.rs +++ b/src/apis/invite_api.rs @@ -6,12 +6,10 @@ * Generated by: https://openapi-generator.tech */ - +use super::{configuration, Error}; +use crate::{apis::ResponseContent, models}; use reqwest; use serde::{Deserialize, Serialize}; -use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; - /// struct for typed errors of method [`get_invite_message`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -86,18 +84,30 @@ pub enum UpdateInviteMessageError { UnknownValue(serde_json::Value), } - /// Returns a single Invite Message. This returns the exact same information but less than `getInviteMessages`. Admin Credentials are required to view messages of other users! Message type refers to a different collection of messages, used during different types of responses. * `message` = Message during a normal invite * `response` = Message when replying to a message * `request` = Message when requesting an invite * `requestResponse` = Message when replying to a request for invite -pub async fn get_invite_message(configuration: &configuration::Configuration, user_id: &str, message_type: models::InviteMessageType, slot: i32) -> Result> { +pub async fn get_invite_message( + configuration: &configuration::Configuration, + user_id: &str, + message_type: models::InviteMessageType, + slot: i32, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/message/{userId}/{messageType}/{slot}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id), messageType=message_type.to_string(), slot=slot); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/message/{userId}/{messageType}/{slot}", + local_var_configuration.base_path, + userId = crate::apis::urlencode(user_id), + messageType = message_type.to_string(), + slot = slot + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -109,23 +119,39 @@ pub async fn get_invite_message(configuration: &configuration::Configuration, us if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Returns a list of all the users Invite Messages. Admin Credentials are required to view messages of other users! Message type refers to a different collection of messages, used during different types of responses. * `message` = Message during a normal invite * `response` = Message when replying to a message * `request` = Message when requesting an invite * `requestResponse` = Message when replying to a request for invite -pub async fn get_invite_messages(configuration: &configuration::Configuration, user_id: &str, message_type: models::InviteMessageType) -> Result, Error> { +pub async fn get_invite_messages( + configuration: &configuration::Configuration, + user_id: &str, + message_type: models::InviteMessageType, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/message/{userId}/{messageType}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id), messageType=message_type.to_string()); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/message/{userId}/{messageType}", + local_var_configuration.base_path, + userId = crate::apis::urlencode(user_id), + messageType = message_type.to_string() + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -137,23 +163,39 @@ pub async fn get_invite_messages(configuration: &configuration::Configuration, u if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Sends self an invite to an instance -pub async fn invite_myself_to(configuration: &configuration::Configuration, world_id: &str, instance_id: &str) -> Result> { +pub async fn invite_myself_to( + configuration: &configuration::Configuration, + world_id: &str, + instance_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/invite/myself/to/{worldId}:{instanceId}", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id), instanceId=crate::apis::urlencode(instance_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/invite/myself/to/{worldId}:{instanceId}", + local_var_configuration.base_path, + worldId = crate::apis::urlencode(world_id), + instanceId = crate::apis::urlencode(instance_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -165,23 +207,38 @@ pub async fn invite_myself_to(configuration: &configuration::Configuration, worl if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Sends an invite to a user. Returns the Notification of type `invite` that was sent. -pub async fn invite_user(configuration: &configuration::Configuration, user_id: &str, invite_request: models::InviteRequest) -> Result> { +pub async fn invite_user( + configuration: &configuration::Configuration, + user_id: &str, + invite_request: models::InviteRequest, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/invite/{userId}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/invite/{userId}", + local_var_configuration.base_path, + userId = crate::apis::urlencode(user_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&invite_request); @@ -194,23 +251,38 @@ pub async fn invite_user(configuration: &configuration::Configuration, user_id: if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Requests an invite from a user. Returns the Notification of type `requestInvite` that was sent. -pub async fn request_invite(configuration: &configuration::Configuration, user_id: &str, request_invite_request: Option) -> Result> { +pub async fn request_invite( + configuration: &configuration::Configuration, + user_id: &str, + request_invite_request: Option, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/requestInvite/{userId}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/requestInvite/{userId}", + local_var_configuration.base_path, + userId = crate::apis::urlencode(user_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&request_invite_request); @@ -223,23 +295,41 @@ pub async fn request_invite(configuration: &configuration::Configuration, user_i if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Resets a single Invite Message back to its original message, and then returns a list of all of them. Admin Credentials are required to update messages of other users! Resetting a message respects the rate-limit, so it is not possible to reset within the 60 minutes countdown. Resetting it does however not set the rate-limit to 60 like when editing it. It is possible to edit it right after resetting it. Trying to edit a message before the cooldown timer expires results in a 429 \"Too Fast Error\". Message type refers to a different collection of messages, used during different types of responses. * `message` = Message during a normal invite * `response` = Message when replying to a message * `request` = Message when requesting an invite * `requestResponse` = Message when replying to a request for invite The DELETE endpoint does not have/require any request body. -pub async fn reset_invite_message(configuration: &configuration::Configuration, user_id: &str, message_type: models::InviteMessageType, slot: i32) -> Result, Error> { +pub async fn reset_invite_message( + configuration: &configuration::Configuration, + user_id: &str, + message_type: models::InviteMessageType, + slot: i32, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/message/{userId}/{messageType}/{slot}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id), messageType=message_type.to_string(), slot=slot); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/message/{userId}/{messageType}/{slot}", + local_var_configuration.base_path, + userId = crate::apis::urlencode(user_id), + messageType = message_type.to_string(), + slot = slot + ); + let 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()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -251,23 +341,38 @@ pub async fn reset_invite_message(configuration: &configuration::Configuration, if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Respond to an invite request by sending a world invite to the requesting user. `:notificationId` is the ID of the requesting notification. -pub async fn respond_invite(configuration: &configuration::Configuration, notification_id: &str, invite_response: models::InviteResponse) -> Result> { +pub async fn respond_invite( + configuration: &configuration::Configuration, + notification_id: &str, + invite_response: models::InviteResponse, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/invite/{notificationId}/response", local_var_configuration.base_path, notificationId=crate::apis::urlencode(notification_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/invite/{notificationId}/response", + local_var_configuration.base_path, + notificationId = crate::apis::urlencode(notification_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&invite_response); @@ -280,23 +385,42 @@ pub async fn respond_invite(configuration: &configuration::Configuration, notifi if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Updates a single Invite Message and then returns a list of all of them. Admin Credentials are required to update messages of other users! Updating a message automatically sets the cooldown timer to 60 minutes. Trying to edit a message before the cooldown timer expires results in a 429 \"Too Fast Error\". Message type refers to a different collection of messages, used during different types of responses. * `message` = Message during a normal invite * `response` = Message when replying to a message * `request` = Message when requesting an invite * `requestResponse` = Message when replying to a request for invite -pub async fn update_invite_message(configuration: &configuration::Configuration, user_id: &str, message_type: models::InviteMessageType, slot: i32, update_invite_message_request: Option) -> Result, Error> { +pub async fn update_invite_message( + configuration: &configuration::Configuration, + user_id: &str, + message_type: models::InviteMessageType, + slot: i32, + update_invite_message_request: Option, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/message/{userId}/{messageType}/{slot}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id), messageType=message_type.to_string(), slot=slot); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/message/{userId}/{messageType}/{slot}", + local_var_configuration.base_path, + userId = crate::apis::urlencode(user_id), + messageType = message_type.to_string(), + slot = slot + ); + let 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()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&update_invite_message_request); @@ -309,9 +433,13 @@ pub async fn update_invite_message(configuration: &configuration::Configuration, if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } - diff --git a/src/apis/mod.rs b/src/apis/mod.rs index 9e080ff..7b80d97 100644 --- a/src/apis/mod.rs +++ b/src/apis/mod.rs @@ -16,7 +16,7 @@ pub enum Error { ResponseError(ResponseContent), } -impl fmt::Display for Error { +impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let (module, e) = match self { Error::Reqwest(e) => ("reqwest", e.to_string()), @@ -28,7 +28,7 @@ impl fmt::Display for Error { } } -impl error::Error for Error { +impl error::Error for Error { fn source(&self) -> Option<&(dyn error::Error + 'static)> { Some(match self { Error::Reqwest(e) => e, @@ -39,19 +39,19 @@ impl error::Error for Error { } } -impl From for Error { +impl From for Error { fn from(e: reqwest::Error) -> Self { Error::Reqwest(e) } } -impl From for Error { +impl From for Error { fn from(e: serde_json::Error) -> Self { Error::Serde(e) } } -impl From for Error { +impl From for Error { fn from(e: std::io::Error) -> Self { Error::Io(e) } @@ -78,8 +78,10 @@ pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String value, )); } - }, - serde_json::Value::String(s) => params.push((format!("{}[{}]", prefix, key), s.clone())), + } + serde_json::Value::String(s) => { + params.push((format!("{}[{}]", prefix, key), s.clone())) + } _ => params.push((format!("{}[{}]", prefix, key), value.to_string())), } } diff --git a/src/apis/notifications_api.rs b/src/apis/notifications_api.rs index eacc744..be73fb3 100644 --- a/src/apis/notifications_api.rs +++ b/src/apis/notifications_api.rs @@ -6,12 +6,10 @@ * Generated by: https://openapi-generator.tech */ - +use super::{configuration, Error}; +use crate::{apis::ResponseContent, models}; use reqwest; use serde::{Deserialize, Serialize}; -use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; - /// struct for typed errors of method [`accept_friend_request`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -54,18 +52,26 @@ pub enum MarkNotificationAsReadError { UnknownValue(serde_json::Value), } - /// Accept a friend request by notification `frq_` ID. Friend requests can be found using the NotificationsAPI `getNotifications` by filtering of type `friendRequest`. -pub async fn accept_friend_request(configuration: &configuration::Configuration, notification_id: &str) -> Result> { +pub async fn accept_friend_request( + configuration: &configuration::Configuration, + notification_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/auth/user/notifications/{notificationId}/accept", local_var_configuration.base_path, notificationId=crate::apis::urlencode(notification_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/auth/user/notifications/{notificationId}/accept", + local_var_configuration.base_path, + notificationId = crate::apis::urlencode(notification_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -77,23 +83,35 @@ pub async fn accept_friend_request(configuration: &configuration::Configuration, if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Clear **all** notifications. -pub async fn clear_notifications(configuration: &configuration::Configuration, ) -> Result> { +pub async fn clear_notifications( + configuration: &configuration::Configuration, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/auth/user/notifications/clear", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/auth/user/notifications/clear", + local_var_configuration.base_path + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -105,23 +123,37 @@ pub async fn clear_notifications(configuration: &configuration::Configuration, ) if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Delete a notification. -pub async fn delete_notification(configuration: &configuration::Configuration, notification_id: &str) -> Result> { +pub async fn delete_notification( + configuration: &configuration::Configuration, + notification_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/auth/user/notifications/{notificationId}/hide", local_var_configuration.base_path, notificationId=crate::apis::urlencode(notification_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/auth/user/notifications/{notificationId}/hide", + local_var_configuration.base_path, + notificationId = crate::apis::urlencode(notification_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -133,41 +165,64 @@ pub async fn delete_notification(configuration: &configuration::Configuration, n if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Retrieve all of the current user's notifications. -pub async fn get_notifications(configuration: &configuration::Configuration, r#type: Option<&str>, sent: Option, hidden: Option, after: Option<&str>, n: Option, offset: Option) -> Result, Error> { +pub async fn get_notifications( + configuration: &configuration::Configuration, + r#type: Option<&str>, + sent: Option, + hidden: Option, + after: Option<&str>, + n: Option, + offset: Option, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/auth/user/notifications", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/auth/user/notifications", + local_var_configuration.base_path + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = r#type { - local_var_req_builder = local_var_req_builder.query(&[("type", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("type", &local_var_str.to_string())]); } if let Some(ref local_var_str) = sent { - local_var_req_builder = local_var_req_builder.query(&[("sent", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("sent", &local_var_str.to_string())]); } if let Some(ref local_var_str) = hidden { - local_var_req_builder = local_var_req_builder.query(&[("hidden", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("hidden", &local_var_str.to_string())]); } if let Some(ref local_var_str) = after { - local_var_req_builder = local_var_req_builder.query(&[("after", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("after", &local_var_str.to_string())]); } if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -179,23 +234,37 @@ pub async fn get_notifications(configuration: &configuration::Configuration, r#t if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Mark a notification as seen. -pub async fn mark_notification_as_read(configuration: &configuration::Configuration, notification_id: &str) -> Result> { +pub async fn mark_notification_as_read( + configuration: &configuration::Configuration, + notification_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/auth/user/notifications/{notificationId}/see", local_var_configuration.base_path, notificationId=crate::apis::urlencode(notification_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/auth/user/notifications/{notificationId}/see", + local_var_configuration.base_path, + notificationId = crate::apis::urlencode(notification_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -207,9 +276,13 @@ pub async fn mark_notification_as_read(configuration: &configuration::Configurat if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } - diff --git a/src/apis/permissions_api.rs b/src/apis/permissions_api.rs index 4a02727..19df323 100644 --- a/src/apis/permissions_api.rs +++ b/src/apis/permissions_api.rs @@ -6,12 +6,10 @@ * Generated by: https://openapi-generator.tech */ - +use super::{configuration, Error}; +use crate::{apis::ResponseContent, models}; use reqwest; use serde::{Deserialize, Serialize}; -use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; - /// struct for typed errors of method [`get_assigned_permissions`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -29,18 +27,21 @@ pub enum GetPermissionError { UnknownValue(serde_json::Value), } - /// Returns a list of all permissions currently granted by the user. Permissions are assigned e.g. by subscribing to VRC+. -pub async fn get_assigned_permissions(configuration: &configuration::Configuration, ) -> Result, Error> { +pub async fn get_assigned_permissions( + configuration: &configuration::Configuration, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/auth/permissions", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -52,23 +53,37 @@ pub async fn get_assigned_permissions(configuration: &configuration::Configurati if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Returns a single permission. This endpoint is pretty useless, as it returns the exact same information as `/auth/permissions`. -pub async fn get_permission(configuration: &configuration::Configuration, permission_id: &str) -> Result> { +pub async fn get_permission( + configuration: &configuration::Configuration, + permission_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/permissions/{permissionId}", local_var_configuration.base_path, permissionId=crate::apis::urlencode(permission_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/permissions/{permissionId}", + local_var_configuration.base_path, + permissionId = crate::apis::urlencode(permission_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -80,9 +95,13 @@ pub async fn get_permission(configuration: &configuration::Configuration, permis if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } - diff --git a/src/apis/playermoderation_api.rs b/src/apis/playermoderation_api.rs index adafede..925bf68 100644 --- a/src/apis/playermoderation_api.rs +++ b/src/apis/playermoderation_api.rs @@ -6,12 +6,10 @@ * Generated by: https://openapi-generator.tech */ - +use super::{configuration, Error}; +use crate::{apis::ResponseContent, models}; use reqwest; use serde::{Deserialize, Serialize}; -use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; - /// struct for typed errors of method [`clear_all_player_moderations`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -63,18 +61,24 @@ pub enum UnmoderateUserError { UnknownValue(serde_json::Value), } - /// ⚠️ **This will delete every single player moderation you've ever made.** -pub async fn clear_all_player_moderations(configuration: &configuration::Configuration, ) -> Result> { +pub async fn clear_all_player_moderations( + configuration: &configuration::Configuration, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/auth/user/playermoderations", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/auth/user/playermoderations", + local_var_configuration.base_path + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -86,23 +90,37 @@ pub async fn clear_all_player_moderations(configuration: &configuration::Configu if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Deletes a specific player moderation based on it's `pmod_` ID. The website uses `unmoderateUser` instead. You can delete the same player moderation multiple times successfully. -pub async fn delete_player_moderation(configuration: &configuration::Configuration, player_moderation_id: &str) -> Result> { +pub async fn delete_player_moderation( + configuration: &configuration::Configuration, + player_moderation_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/auth/user/playermoderations/{playerModerationId}", local_var_configuration.base_path, playerModerationId=crate::apis::urlencode(player_moderation_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/auth/user/playermoderations/{playerModerationId}", + local_var_configuration.base_path, + playerModerationId = crate::apis::urlencode(player_moderation_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -114,23 +132,37 @@ pub async fn delete_player_moderation(configuration: &configuration::Configurati if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Returns a single Player Moderation. This returns the exact same amount of information as the more generalised `getPlayerModerations`. -pub async fn get_player_moderation(configuration: &configuration::Configuration, player_moderation_id: &str) -> Result> { +pub async fn get_player_moderation( + configuration: &configuration::Configuration, + player_moderation_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/auth/user/playermoderations/{playerModerationId}", local_var_configuration.base_path, playerModerationId=crate::apis::urlencode(player_moderation_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/auth/user/playermoderations/{playerModerationId}", + local_var_configuration.base_path, + playerModerationId = crate::apis::urlencode(player_moderation_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -142,29 +174,45 @@ pub async fn get_player_moderation(configuration: &configuration::Configuration, if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Returns a list of all player moderations made by **you**. This endpoint does not have pagination, and will return *all* results. Use query parameters to limit your query if needed. -pub async fn get_player_moderations(configuration: &configuration::Configuration, r#type: Option<&str>, target_user_id: Option<&str>) -> Result, Error> { +pub async fn get_player_moderations( + configuration: &configuration::Configuration, + r#type: Option<&str>, + target_user_id: Option<&str>, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/auth/user/playermoderations", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/auth/user/playermoderations", + local_var_configuration.base_path + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = r#type { - local_var_req_builder = local_var_req_builder.query(&[("type", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("type", &local_var_str.to_string())]); } if let Some(ref local_var_str) = target_user_id { - local_var_req_builder = local_var_req_builder.query(&[("targetUserId", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("targetUserId", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -176,23 +224,36 @@ pub async fn get_player_moderations(configuration: &configuration::Configuration if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Moderate a user, e.g. unmute them or show their avatar. Please see the [Player Moderation docs](https://vrchatapi.github.io/docs/api/#tag--playermoderation) on what playerModerations are, and how they differ from staff moderations. -pub async fn moderate_user(configuration: &configuration::Configuration, moderate_user_request: models::ModerateUserRequest) -> Result> { +pub async fn moderate_user( + configuration: &configuration::Configuration, + moderate_user_request: models::ModerateUserRequest, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/auth/user/playermoderations", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/auth/user/playermoderations", + local_var_configuration.base_path + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&moderate_user_request); @@ -205,23 +266,36 @@ pub async fn moderate_user(configuration: &configuration::Configuration, moderat if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Removes a player moderation previously added through `moderateUser`. E.g if you previously have shown their avatar, but now want to reset it to default. -pub async fn unmoderate_user(configuration: &configuration::Configuration, moderate_user_request: models::ModerateUserRequest) -> Result> { +pub async fn unmoderate_user( + configuration: &configuration::Configuration, + moderate_user_request: models::ModerateUserRequest, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/auth/user/unplayermoderate", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/auth/user/unplayermoderate", + local_var_configuration.base_path + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&moderate_user_request); @@ -234,9 +308,13 @@ pub async fn unmoderate_user(configuration: &configuration::Configuration, moder if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } - diff --git a/src/apis/system_api.rs b/src/apis/system_api.rs index cb965d1..c7020b3 100644 --- a/src/apis/system_api.rs +++ b/src/apis/system_api.rs @@ -6,12 +6,10 @@ * Generated by: https://openapi-generator.tech */ - +use super::{configuration, Error}; +use crate::{apis::ResponseContent, models}; use reqwest; use serde::{Deserialize, Serialize}; -use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; - /// struct for typed errors of method [`get_config`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -64,18 +62,21 @@ pub enum GetSystemTimeError { UnknownValue(serde_json::Value), } - /// API config contains configuration that the clients needs to work properly. Currently the most important value here is `clientApiKey` which is used for all other API endpoints. -pub async fn get_config(configuration: &configuration::Configuration, ) -> Result> { +pub async fn get_config( + configuration: &configuration::Configuration, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/config", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -87,29 +88,42 @@ pub async fn get_config(configuration: &configuration::Configuration, ) -> Resul if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Fetches the CSS code to the frontend React website. -pub async fn get_css(configuration: &configuration::Configuration, variant: Option<&str>, branch: Option<&str>) -> Result> { +pub async fn get_css( + configuration: &configuration::Configuration, + variant: Option<&str>, + branch: Option<&str>, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/css/app.css", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = variant { - local_var_req_builder = local_var_req_builder.query(&[("variant", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("variant", &local_var_str.to_string())]); } if let Some(ref local_var_str) = branch { - local_var_req_builder = local_var_req_builder.query(&[("branch", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("branch", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -122,22 +136,30 @@ pub async fn get_css(configuration: &configuration::Configuration, variant: Opti serde_json::from_str(&local_var_content).map_err(Error::from) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Returns the current number of online users. **NOTE:** The response type is not a JSON object, but a simple JSON integer. -pub async fn get_current_online_users(configuration: &configuration::Configuration, ) -> Result> { +pub async fn get_current_online_users( + configuration: &configuration::Configuration, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/visits", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -149,23 +171,32 @@ pub async fn get_current_online_users(configuration: &configuration::Configurati if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// ~~Gets the overall health status, the server name, and the current build version tag of the API.~~ **DEPRECATED:** VRChat has suddenly restricted this endpoint for unknown reasons, and now always return 401 Unauthorized. -pub async fn get_health(configuration: &configuration::Configuration, ) -> Result> { +pub async fn get_health( + configuration: &configuration::Configuration, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/health", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -177,29 +208,42 @@ pub async fn get_health(configuration: &configuration::Configuration, ) -> Resul if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// IPS (Info Push System) is a system for VRChat to push out dynamic information to the client. This is primarily used by the Quick-Menu info banners, but can also be used to e.g. alert you to update your game to the latest version. `include` is used to query what Information Pushes should be included in the response. If include is missing or empty, then no notices will normally be returned. This is an \"any of\" search. `require` is used to limit what Information Pushes should be included in the response. This is usually used in combination with `include`, and is an \"all of\" search. -pub async fn get_info_push(configuration: &configuration::Configuration, require: Option<&str>, include: Option<&str>) -> Result, Error> { +pub async fn get_info_push( + configuration: &configuration::Configuration, + require: Option<&str>, + include: Option<&str>, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/infoPush", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = require { - local_var_req_builder = local_var_req_builder.query(&[("require", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("require", &local_var_str.to_string())]); } if let Some(ref local_var_str) = include { - local_var_req_builder = local_var_req_builder.query(&[("include", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("include", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -211,29 +255,42 @@ pub async fn get_info_push(configuration: &configuration::Configuration, require if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Fetches the JavaScript code to the frontend React website. -pub async fn get_java_script(configuration: &configuration::Configuration, variant: Option<&str>, branch: Option<&str>) -> Result> { +pub async fn get_java_script( + configuration: &configuration::Configuration, + variant: Option<&str>, + branch: Option<&str>, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/js/app.js", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = variant { - local_var_req_builder = local_var_req_builder.query(&[("variant", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("variant", &local_var_str.to_string())]); } if let Some(ref local_var_str) = branch { - local_var_req_builder = local_var_req_builder.query(&[("branch", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("branch", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -245,23 +302,32 @@ pub async fn get_java_script(configuration: &configuration::Configuration, varia if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Returns the current time of the API server. **NOTE:** The response type is not a JSON object, but a simple JSON string. -pub async fn get_system_time(configuration: &configuration::Configuration, ) -> Result> { +pub async fn get_system_time( + configuration: &configuration::Configuration, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/time", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -273,9 +339,13 @@ pub async fn get_system_time(configuration: &configuration::Configuration, ) -> if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } - diff --git a/src/apis/users_api.rs b/src/apis/users_api.rs index 3c85d37..7b733b0 100644 --- a/src/apis/users_api.rs +++ b/src/apis/users_api.rs @@ -6,12 +6,10 @@ * Generated by: https://openapi-generator.tech */ - +use super::{configuration, Error}; +use crate::{apis::ResponseContent, models}; use reqwest; use serde::{Deserialize, Serialize}; -use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; - /// struct for typed errors of method [`get_user`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -70,18 +68,26 @@ pub enum UpdateUserError { UnknownValue(serde_json::Value), } - /// Get public user information about a specific user using their ID. -pub async fn get_user(configuration: &configuration::Configuration, user_id: &str) -> Result> { +pub async fn get_user( + configuration: &configuration::Configuration, + user_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/users/{userId}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/users/{userId}", + local_var_configuration.base_path, + userId = crate::apis::urlencode(user_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -94,22 +100,35 @@ pub async fn get_user(configuration: &configuration::Configuration, user_id: &st serde_json::from_str(&local_var_content).map_err(Error::from) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// ~~Get public user information about a specific user using their name.~~ **DEPRECATED:** VRChat API no longer return usernames of other users. [See issue by Tupper for more information](https://github.com/pypy-vrc/VRCX/issues/429). This endpoint now require Admin Credentials. -pub async fn get_user_by_name(configuration: &configuration::Configuration, username: &str) -> Result> { +pub async fn get_user_by_name( + configuration: &configuration::Configuration, + username: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/users/{username}/name", local_var_configuration.base_path, username=crate::apis::urlencode(username)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/users/{username}/name", + local_var_configuration.base_path, + username = crate::apis::urlencode(username) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -121,23 +140,37 @@ pub async fn get_user_by_name(configuration: &configuration::Configuration, user if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Returns a list of Groups the user has requested to be invited into. -pub async fn get_user_group_requests(configuration: &configuration::Configuration, user_id: &str) -> Result, Error> { +pub async fn get_user_group_requests( + configuration: &configuration::Configuration, + user_id: &str, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/users/{userId}/groups/requested", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/users/{userId}/groups/requested", + local_var_configuration.base_path, + userId = crate::apis::urlencode(user_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -149,23 +182,37 @@ pub async fn get_user_group_requests(configuration: &configuration::Configuratio if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Get user's public groups -pub async fn get_user_groups(configuration: &configuration::Configuration, user_id: &str) -> Result, Error> { +pub async fn get_user_groups( + configuration: &configuration::Configuration, + user_id: &str, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/users/{userId}/groups", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/users/{userId}/groups", + local_var_configuration.base_path, + userId = crate::apis::urlencode(user_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -177,23 +224,37 @@ pub async fn get_user_groups(configuration: &configuration::Configuration, user_ if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Returns the current group that the user is currently representing -pub async fn get_user_represented_group(configuration: &configuration::Configuration, user_id: &str) -> Result> { +pub async fn get_user_represented_group( + configuration: &configuration::Configuration, + user_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/users/{userId}/groups/represented", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/users/{userId}/groups/represented", + local_var_configuration.base_path, + userId = crate::apis::urlencode(user_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -205,35 +266,51 @@ pub async fn get_user_represented_group(configuration: &configuration::Configura if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Search and list any users by text query -pub async fn search_users(configuration: &configuration::Configuration, search: Option<&str>, developer_type: Option<&str>, n: Option, offset: Option) -> Result, Error> { +pub async fn search_users( + configuration: &configuration::Configuration, + search: Option<&str>, + developer_type: Option<&str>, + n: Option, + offset: Option, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/users", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = search { - local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("search", &local_var_str.to_string())]); } if let Some(ref local_var_str) = developer_type { - local_var_req_builder = local_var_req_builder.query(&[("developerType", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("developerType", &local_var_str.to_string())]); } if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -245,23 +322,38 @@ pub async fn search_users(configuration: &configuration::Configuration, search: if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Update a users information such as the email and birthday. -pub async fn update_user(configuration: &configuration::Configuration, user_id: &str, update_user_request: Option) -> Result> { +pub async fn update_user( + configuration: &configuration::Configuration, + user_id: &str, + update_user_request: Option, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/users/{userId}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/users/{userId}", + local_var_configuration.base_path, + userId = crate::apis::urlencode(user_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&update_user_request); @@ -274,9 +366,13 @@ pub async fn update_user(configuration: &configuration::Configuration, user_id: if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } - diff --git a/src/apis/worlds_api.rs b/src/apis/worlds_api.rs index 993304e..aae5cb0 100644 --- a/src/apis/worlds_api.rs +++ b/src/apis/worlds_api.rs @@ -6,12 +6,10 @@ * Generated by: https://openapi-generator.tech */ - +use super::{configuration, Error}; +use crate::{apis::ResponseContent, models}; use reqwest; use serde::{Deserialize, Serialize}; -use crate::{apis::ResponseContent, models}; -use super::{Error, configuration}; - /// struct for typed errors of method [`create_world`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -125,18 +123,22 @@ pub enum UpdateWorldError { UnknownValue(serde_json::Value), } - /// Create a new world. This endpoint requires `assetUrl` to be a valid File object with `.vrcw` file extension, and `imageUrl` to be a valid File object with an image file extension. -pub async fn create_world(configuration: &configuration::Configuration, create_world_request: Option) -> Result> { +pub async fn create_world( + configuration: &configuration::Configuration, + create_world_request: Option, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/worlds", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&create_world_request); @@ -149,23 +151,37 @@ pub async fn create_world(configuration: &configuration::Configuration, create_w if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Delete a world. Notice a world is never fully \"deleted\", only its ReleaseStatus is set to \"hidden\" and the linked Files are deleted. The WorldID is permanently reserved. -pub async fn delete_world(configuration: &configuration::Configuration, world_id: &str) -> Result<(), Error> { +pub async fn delete_world( + configuration: &configuration::Configuration, + world_id: &str, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/worlds/{worldId}", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/worlds/{worldId}", + local_var_configuration.base_path, + worldId = crate::apis::urlencode(world_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -177,59 +193,90 @@ pub async fn delete_world(configuration: &configuration::Configuration, world_id if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Search and list currently Active worlds by query filters. -pub async fn get_active_worlds(configuration: &configuration::Configuration, featured: Option, sort: Option, n: Option, order: Option, offset: Option, search: Option<&str>, tag: Option<&str>, notag: Option<&str>, release_status: Option, max_unity_version: Option<&str>, min_unity_version: Option<&str>, platform: Option<&str>) -> Result, Error> { +pub async fn get_active_worlds( + configuration: &configuration::Configuration, + featured: Option, + sort: Option, + n: Option, + order: Option, + offset: Option, + search: Option<&str>, + tag: Option<&str>, + notag: Option<&str>, + release_status: Option, + max_unity_version: Option<&str>, + min_unity_version: Option<&str>, + platform: Option<&str>, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/worlds/active", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = featured { - local_var_req_builder = local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); } if let Some(ref local_var_str) = sort { - local_var_req_builder = local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); } if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = order { - local_var_req_builder = local_var_req_builder.query(&[("order", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("order", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_str) = search { - local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("search", &local_var_str.to_string())]); } if let Some(ref local_var_str) = tag { local_var_req_builder = local_var_req_builder.query(&[("tag", &local_var_str.to_string())]); } if let Some(ref local_var_str) = notag { - local_var_req_builder = local_var_req_builder.query(&[("notag", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("notag", &local_var_str.to_string())]); } if let Some(ref local_var_str) = release_status { - local_var_req_builder = local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]); } if let Some(ref local_var_str) = max_unity_version { - local_var_req_builder = local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]); } if let Some(ref local_var_str) = min_unity_version { - local_var_req_builder = local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]); } if let Some(ref local_var_str) = platform { - local_var_req_builder = local_var_req_builder.query(&[("platform", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("platform", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -241,62 +288,95 @@ pub async fn get_active_worlds(configuration: &configuration::Configuration, fea if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Search and list favorited worlds by query filters. -pub async fn get_favorited_worlds(configuration: &configuration::Configuration, featured: Option, sort: Option, n: Option, order: Option, offset: Option, search: Option<&str>, tag: Option<&str>, notag: Option<&str>, release_status: Option, max_unity_version: Option<&str>, min_unity_version: Option<&str>, platform: Option<&str>, user_id: Option<&str>) -> Result, Error> { +pub async fn get_favorited_worlds( + configuration: &configuration::Configuration, + featured: Option, + sort: Option, + n: Option, + order: Option, + offset: Option, + search: Option<&str>, + tag: Option<&str>, + notag: Option<&str>, + release_status: Option, + max_unity_version: Option<&str>, + min_unity_version: Option<&str>, + platform: Option<&str>, + user_id: Option<&str>, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/worlds/favorites", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = featured { - local_var_req_builder = local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); } if let Some(ref local_var_str) = sort { - local_var_req_builder = local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); } if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = order { - local_var_req_builder = local_var_req_builder.query(&[("order", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("order", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_str) = search { - local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("search", &local_var_str.to_string())]); } if let Some(ref local_var_str) = tag { local_var_req_builder = local_var_req_builder.query(&[("tag", &local_var_str.to_string())]); } if let Some(ref local_var_str) = notag { - local_var_req_builder = local_var_req_builder.query(&[("notag", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("notag", &local_var_str.to_string())]); } if let Some(ref local_var_str) = release_status { - local_var_req_builder = local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]); } if let Some(ref local_var_str) = max_unity_version { - local_var_req_builder = local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]); } if let Some(ref local_var_str) = min_unity_version { - local_var_req_builder = local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]); } if let Some(ref local_var_str) = platform { - local_var_req_builder = local_var_req_builder.query(&[("platform", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("platform", &local_var_str.to_string())]); } if let Some(ref local_var_str) = user_id { - local_var_req_builder = local_var_req_builder.query(&[("userId", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("userId", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -308,62 +388,95 @@ pub async fn get_favorited_worlds(configuration: &configuration::Configuration, if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Search and list recently visited worlds by query filters. -pub async fn get_recent_worlds(configuration: &configuration::Configuration, featured: Option, sort: Option, n: Option, order: Option, offset: Option, search: Option<&str>, tag: Option<&str>, notag: Option<&str>, release_status: Option, max_unity_version: Option<&str>, min_unity_version: Option<&str>, platform: Option<&str>, user_id: Option<&str>) -> Result, Error> { +pub async fn get_recent_worlds( + configuration: &configuration::Configuration, + featured: Option, + sort: Option, + n: Option, + order: Option, + offset: Option, + search: Option<&str>, + tag: Option<&str>, + notag: Option<&str>, + release_status: Option, + max_unity_version: Option<&str>, + min_unity_version: Option<&str>, + platform: Option<&str>, + user_id: Option<&str>, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/worlds/recent", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = featured { - local_var_req_builder = local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); } if let Some(ref local_var_str) = sort { - local_var_req_builder = local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); } if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = order { - local_var_req_builder = local_var_req_builder.query(&[("order", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("order", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_str) = search { - local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("search", &local_var_str.to_string())]); } if let Some(ref local_var_str) = tag { local_var_req_builder = local_var_req_builder.query(&[("tag", &local_var_str.to_string())]); } if let Some(ref local_var_str) = notag { - local_var_req_builder = local_var_req_builder.query(&[("notag", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("notag", &local_var_str.to_string())]); } if let Some(ref local_var_str) = release_status { - local_var_req_builder = local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]); } if let Some(ref local_var_str) = max_unity_version { - local_var_req_builder = local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]); } if let Some(ref local_var_str) = min_unity_version { - local_var_req_builder = local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]); } if let Some(ref local_var_str) = platform { - local_var_req_builder = local_var_req_builder.query(&[("platform", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("platform", &local_var_str.to_string())]); } if let Some(ref local_var_str) = user_id { - local_var_req_builder = local_var_req_builder.query(&[("userId", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("userId", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -375,23 +488,37 @@ pub async fn get_recent_worlds(configuration: &configuration::Configuration, fea if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Get information about a specific World. Works unauthenticated but when so will always return `0` for certain fields. -pub async fn get_world(configuration: &configuration::Configuration, world_id: &str) -> Result> { +pub async fn get_world( + configuration: &configuration::Configuration, + world_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/worlds/{worldId}", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/worlds/{worldId}", + local_var_configuration.base_path, + worldId = crate::apis::urlencode(world_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -404,22 +531,37 @@ pub async fn get_world(configuration: &configuration::Configuration, world_id: & serde_json::from_str(&local_var_content).map_err(Error::from) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Returns a worlds instance. -pub async fn get_world_instance(configuration: &configuration::Configuration, world_id: &str, instance_id: &str) -> Result> { +pub async fn get_world_instance( + configuration: &configuration::Configuration, + world_id: &str, + instance_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/worlds/{worldId}/{instanceId}", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id), instanceId=crate::apis::urlencode(instance_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/worlds/{worldId}/{instanceId}", + local_var_configuration.base_path, + worldId = crate::apis::urlencode(world_id), + instanceId = crate::apis::urlencode(instance_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -431,23 +573,37 @@ pub async fn get_world_instance(configuration: &configuration::Configuration, wo if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Return a worlds custom metadata. This is currently believed to be unused. Metadata can be set with `updateWorld` and can be any arbitrary object. -pub async fn get_world_metadata(configuration: &configuration::Configuration, world_id: &str) -> Result> { +pub async fn get_world_metadata( + configuration: &configuration::Configuration, + world_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/worlds/{worldId}/metadata", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/worlds/{worldId}/metadata", + local_var_configuration.base_path, + worldId = crate::apis::urlencode(world_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -459,23 +615,37 @@ pub async fn get_world_metadata(configuration: &configuration::Configuration, wo if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Returns a worlds publish status. -pub async fn get_world_publish_status(configuration: &configuration::Configuration, world_id: &str) -> Result> { +pub async fn get_world_publish_status( + configuration: &configuration::Configuration, + world_id: &str, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/worlds/{worldId}/publish", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/worlds/{worldId}/publish", + local_var_configuration.base_path, + worldId = crate::apis::urlencode(world_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -487,23 +657,37 @@ pub async fn get_world_publish_status(configuration: &configuration::Configurati if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Publish a world. You can only publish one world per week. -pub async fn publish_world(configuration: &configuration::Configuration, world_id: &str) -> Result<(), Error> { +pub async fn publish_world( + configuration: &configuration::Configuration, + world_id: &str, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/worlds/{worldId}/publish", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/worlds/{worldId}/publish", + local_var_configuration.base_path, + worldId = crate::apis::urlencode(world_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -515,68 +699,105 @@ pub async fn publish_world(configuration: &configuration::Configuration, world_i if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Search and list any worlds by query filters. -pub async fn search_worlds(configuration: &configuration::Configuration, featured: Option, sort: Option, user: Option<&str>, user_id: Option<&str>, n: Option, order: Option, offset: Option, search: Option<&str>, tag: Option<&str>, notag: Option<&str>, release_status: Option, max_unity_version: Option<&str>, min_unity_version: Option<&str>, platform: Option<&str>, fuzzy: Option) -> Result, Error> { +pub async fn search_worlds( + configuration: &configuration::Configuration, + featured: Option, + sort: Option, + user: Option<&str>, + user_id: Option<&str>, + n: Option, + order: Option, + offset: Option, + search: Option<&str>, + tag: Option<&str>, + notag: Option<&str>, + release_status: Option, + max_unity_version: Option<&str>, + min_unity_version: Option<&str>, + platform: Option<&str>, + fuzzy: Option, +) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/worlds", local_var_configuration.base_path); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = featured { - local_var_req_builder = local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); } if let Some(ref local_var_str) = sort { - local_var_req_builder = local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); } if let Some(ref local_var_str) = user { - local_var_req_builder = local_var_req_builder.query(&[("user", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("user", &local_var_str.to_string())]); } if let Some(ref local_var_str) = user_id { - local_var_req_builder = local_var_req_builder.query(&[("userId", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("userId", &local_var_str.to_string())]); } if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = order { - local_var_req_builder = local_var_req_builder.query(&[("order", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("order", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_str) = search { - local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("search", &local_var_str.to_string())]); } if let Some(ref local_var_str) = tag { local_var_req_builder = local_var_req_builder.query(&[("tag", &local_var_str.to_string())]); } if let Some(ref local_var_str) = notag { - local_var_req_builder = local_var_req_builder.query(&[("notag", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("notag", &local_var_str.to_string())]); } if let Some(ref local_var_str) = release_status { - local_var_req_builder = local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]); } if let Some(ref local_var_str) = max_unity_version { - local_var_req_builder = local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]); } if let Some(ref local_var_str) = min_unity_version { - local_var_req_builder = local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]); } if let Some(ref local_var_str) = platform { - local_var_req_builder = local_var_req_builder.query(&[("platform", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("platform", &local_var_str.to_string())]); } if let Some(ref local_var_str) = fuzzy { - local_var_req_builder = local_var_req_builder.query(&[("fuzzy", &local_var_str.to_string())]); + local_var_req_builder = + local_var_req_builder.query(&[("fuzzy", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -588,23 +809,37 @@ pub async fn search_worlds(configuration: &configuration::Configuration, feature if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Unpublish a world. -pub async fn unpublish_world(configuration: &configuration::Configuration, world_id: &str) -> Result<(), Error> { +pub async fn unpublish_world( + configuration: &configuration::Configuration, + world_id: &str, +) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/worlds/{worldId}/publish", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/worlds/{worldId}/publish", + local_var_configuration.base_path, + worldId = crate::apis::urlencode(world_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -616,23 +851,38 @@ pub async fn unpublish_world(configuration: &configuration::Configuration, world if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } /// Update information about a specific World. -pub async fn update_world(configuration: &configuration::Configuration, world_id: &str, update_world_request: Option) -> Result> { +pub async fn update_world( + configuration: &configuration::Configuration, + world_id: &str, + update_world_request: Option, +) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!("{}/worlds/{worldId}", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id)); - let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!( + "{}/worlds/{worldId}", + local_var_configuration.base_path, + worldId = crate::apis::urlencode(world_id) + ); + let mut local_var_req_builder = + local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = + local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&update_world_request); @@ -645,9 +895,13 @@ pub async fn update_world(configuration: &configuration::Configuration, world_id if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; + let local_var_entity: Option = + serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { + status: local_var_status, + content: local_var_content, + entity: local_var_entity, + }; Err(Error::ResponseError(local_var_error)) } } - diff --git a/src/lib.rs b/src/lib.rs index a1837b9..d91a0d6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,10 +1,10 @@ #![allow(unused_imports)] #![allow(clippy::too_many_arguments)] +extern crate reqwest; extern crate serde; extern crate serde_json; extern crate url; -extern crate reqwest; pub mod apis; pub mod models; diff --git a/src/models/account_deletion_log.rs b/src/models/account_deletion_log.rs index 5d61480..3dc9853 100644 --- a/src/models/account_deletion_log.rs +++ b/src/models/account_deletion_log.rs @@ -15,7 +15,12 @@ pub struct AccountDeletionLog { #[serde(rename = "message", skip_serializing_if = "Option::is_none")] pub message: Option, /// When the deletion is scheduled to happen, standard is 14 days after the request. - #[serde(rename = "deletionScheduled", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "deletionScheduled", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub deletion_scheduled: Option>, /// Date and time of the deletion request. #[serde(rename = "dateTime", skip_serializing_if = "Option::is_none")] @@ -31,4 +36,3 @@ impl AccountDeletionLog { } } } - diff --git a/src/models/add_favorite_request.rs b/src/models/add_favorite_request.rs index 4aaea88..76071ed 100644 --- a/src/models/add_favorite_request.rs +++ b/src/models/add_favorite_request.rs @@ -22,7 +22,11 @@ pub struct AddFavoriteRequest { } impl AddFavoriteRequest { - pub fn new(r#type: models::FavoriteType, favorite_id: String, tags: Vec) -> AddFavoriteRequest { + pub fn new( + r#type: models::FavoriteType, + favorite_id: String, + tags: Vec, + ) -> AddFavoriteRequest { AddFavoriteRequest { r#type, favorite_id, @@ -30,4 +34,3 @@ impl AddFavoriteRequest { } } } - diff --git a/src/models/add_group_gallery_image_request.rs b/src/models/add_group_gallery_image_request.rs index af105f2..0718b56 100644 --- a/src/models/add_group_gallery_image_request.rs +++ b/src/models/add_group_gallery_image_request.rs @@ -17,9 +17,6 @@ pub struct AddGroupGalleryImageRequest { impl AddGroupGalleryImageRequest { pub fn new(file_id: String) -> AddGroupGalleryImageRequest { - AddGroupGalleryImageRequest { - file_id, - } + AddGroupGalleryImageRequest { file_id } } } - diff --git a/src/models/api_config.rs b/src/models/api_config.rs index 6cfd2b5..b80cc3e 100644 --- a/src/models/api_config.rs +++ b/src/models/api_config.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// ApiConfig : +/// ApiConfig : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ApiConfig { /// Unknown, probably voice optimization testing @@ -46,7 +46,10 @@ pub struct ApiConfig { #[serde(rename = "clientDisconnectTimeout")] pub client_disconnect_timeout: i32, /// Unknown - #[serde(rename = "clientNetDispatchThread", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "clientNetDispatchThread", + skip_serializing_if = "Option::is_none" + )] pub client_net_dispatch_thread: Option, /// Unknown #[serde(rename = "clientNetInThread", skip_serializing_if = "Option::is_none")] @@ -55,22 +58,37 @@ pub struct ApiConfig { #[serde(rename = "clientNetInThread2", skip_serializing_if = "Option::is_none")] pub client_net_in_thread2: Option, /// Unknown - #[serde(rename = "clientNetInThreadMobile", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "clientNetInThreadMobile", + skip_serializing_if = "Option::is_none" + )] pub client_net_in_thread_mobile: Option, /// Unknown - #[serde(rename = "clientNetInThreadMobile2", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "clientNetInThreadMobile2", + skip_serializing_if = "Option::is_none" + )] pub client_net_in_thread_mobile2: Option, /// Unknown #[serde(rename = "clientNetOutThread", skip_serializing_if = "Option::is_none")] pub client_net_out_thread: Option, /// Unknown - #[serde(rename = "clientNetOutThread2", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "clientNetOutThread2", + skip_serializing_if = "Option::is_none" + )] pub client_net_out_thread2: Option, /// Unknown - #[serde(rename = "clientNetOutThreadMobile", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "clientNetOutThreadMobile", + skip_serializing_if = "Option::is_none" + )] pub client_net_out_thread_mobile: Option, /// Unknown - #[serde(rename = "clientNetOutThreadMobile2", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "clientNetOutThreadMobile2", + skip_serializing_if = "Option::is_none" + )] pub client_net_out_thread_mobile2: Option, /// Unknown #[serde(rename = "clientQR", skip_serializing_if = "Option::is_none")] @@ -88,7 +106,10 @@ pub struct ApiConfig { #[serde(rename = "copyrightEmail")] pub copyright_email: String, /// Current version number of the Privacy Agreement - #[serde(rename = "currentPrivacyVersion", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "currentPrivacyVersion", + skip_serializing_if = "Option::is_none" + )] pub current_privacy_version: Option, /// Current version number of the Terms of Service #[serde(rename = "currentTOSVersion")] @@ -110,7 +131,10 @@ pub struct ApiConfig { #[serde(rename = "dis-countdown")] pub dis_countdown: String, /// Unknown - #[serde(rename = "disableAVProInProton", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "disableAVProInProton", + skip_serializing_if = "Option::is_none" + )] pub disable_av_pro_in_proton: Option, /// Toggles if copying avatars should be disabled #[serde(rename = "disableAvatarCopying")] @@ -164,7 +188,7 @@ pub struct ApiConfig { #[serde(rename = "downloadLinkWindows")] pub download_link_windows: String, #[serde(rename = "downloadUrls")] - pub download_urls: Box, + pub download_urls: models::ApiConfigDownloadUrlList, /// Array of DynamicWorldRow objects, used by the game to display the list of world rows #[serde(rename = "dynamicWorldRows")] pub dynamic_world_rows: Vec, @@ -178,7 +202,7 @@ pub struct ApiConfig { #[serde(rename = "economyState", skip_serializing_if = "Option::is_none")] pub economy_state: Option, #[serde(rename = "events")] - pub events: Box, + pub events: models::ApiConfigEvents, /// WorldID be \"offline\" on User profiles if you are not friends with that user. #[serde(rename = "homeWorldId")] pub home_world_id: String, @@ -263,7 +287,75 @@ pub struct ApiConfig { } impl ApiConfig { - pub fn new(voice_enable_degradation: bool, voice_enable_receiver_limiting: bool, address: String, announcements: Vec, app_name: String, available_language_codes: Vec, available_languages: Vec, build_version_tag: String, client_api_key: String, client_bps_ceiling: i32, client_disconnect_timeout: i32, client_reserved_player_bps: i32, client_sent_count_allowance: i32, contact_email: String, copyright_email: String, current_tos_version: i32, default_avatar: String, deployment_group: models::DeploymentGroup, dev_sdk_url: String, dev_sdk_version: String, dis_countdown: String, disable_avatar_copying: bool, disable_avatar_gating: bool, disable_community_labs: bool, disable_community_labs_promotion: bool, disable_email: bool, disable_event_stream: bool, disable_feedback_gating: bool, disable_frontend_builds: bool, disable_hello: bool, disable_oculus_subs: bool, disable_registration: bool, disable_steam_networking: bool, disable_two_factor_auth: bool, disable_udon: bool, disable_upgrade_account: bool, download_link_windows: String, download_urls: models::ApiConfigDownloadUrlList, dynamic_world_rows: Vec, events: models::ApiConfigEvents, home_world_id: String, homepage_redirect_target: String, hub_world_id: String, image_host_url_list: Vec, jobs_email: String, moderation_email: String, not_allowed_to_select_avatar_in_private_world_message: String, sdk_developer_faq_url: String, sdk_discord_url: String, sdk_not_allowed_to_publish_message: String, sdk_unity_version: String, server_name: String, string_host_url_list: Vec, support_email: String, time_out_world_id: String, tutorial_world_id: String, update_rate_ms_maximum: i32, update_rate_ms_minimum: i32, update_rate_ms_normal: i32, update_rate_ms_udon_manual: i32, upload_analysis_percent: i32, url_list: Vec, use_reliable_udp_for_voice: bool, vive_windows_url: String, white_listed_asset_urls: Vec, player_url_resolver_version: String, player_url_resolver_sha1: String) -> ApiConfig { + pub fn new( + voice_enable_degradation: bool, + voice_enable_receiver_limiting: bool, + address: String, + announcements: Vec, + app_name: String, + available_language_codes: Vec, + available_languages: Vec, + build_version_tag: String, + client_api_key: String, + client_bps_ceiling: i32, + client_disconnect_timeout: i32, + client_reserved_player_bps: i32, + client_sent_count_allowance: i32, + contact_email: String, + copyright_email: String, + current_tos_version: i32, + default_avatar: String, + deployment_group: models::DeploymentGroup, + dev_sdk_url: String, + dev_sdk_version: String, + dis_countdown: String, + disable_avatar_copying: bool, + disable_avatar_gating: bool, + disable_community_labs: bool, + disable_community_labs_promotion: bool, + disable_email: bool, + disable_event_stream: bool, + disable_feedback_gating: bool, + disable_frontend_builds: bool, + disable_hello: bool, + disable_oculus_subs: bool, + disable_registration: bool, + disable_steam_networking: bool, + disable_two_factor_auth: bool, + disable_udon: bool, + disable_upgrade_account: bool, + download_link_windows: String, + download_urls: models::ApiConfigDownloadUrlList, + dynamic_world_rows: Vec, + events: models::ApiConfigEvents, + home_world_id: String, + homepage_redirect_target: String, + hub_world_id: String, + image_host_url_list: Vec, + jobs_email: String, + moderation_email: String, + not_allowed_to_select_avatar_in_private_world_message: String, + sdk_developer_faq_url: String, + sdk_discord_url: String, + sdk_not_allowed_to_publish_message: String, + sdk_unity_version: String, + server_name: String, + string_host_url_list: Vec, + support_email: String, + time_out_world_id: String, + tutorial_world_id: String, + update_rate_ms_maximum: i32, + update_rate_ms_minimum: i32, + update_rate_ms_normal: i32, + update_rate_ms_udon_manual: i32, + upload_analysis_percent: i32, + url_list: Vec, + use_reliable_udp_for_voice: bool, + vive_windows_url: String, + white_listed_asset_urls: Vec, + player_url_resolver_version: String, + player_url_resolver_sha1: String, + ) -> ApiConfig { ApiConfig { voice_enable_degradation, voice_enable_receiver_limiting, @@ -316,12 +408,12 @@ impl ApiConfig { disable_udon, disable_upgrade_account, download_link_windows, - download_urls: Box::new(download_urls), + download_urls, dynamic_world_rows, economy_pause_end: None, economy_pause_start: None, economy_state: None, - events: Box::new(events), + events, home_world_id, homepage_redirect_target, hub_world_id, @@ -352,4 +444,3 @@ impl ApiConfig { } } } - diff --git a/src/models/api_config_announcement.rs b/src/models/api_config_announcement.rs index 1151757..084aa04 100644 --- a/src/models/api_config_announcement.rs +++ b/src/models/api_config_announcement.rs @@ -23,10 +23,6 @@ pub struct ApiConfigAnnouncement { impl ApiConfigAnnouncement { /// Public Announcement pub fn new(name: String, text: String) -> ApiConfigAnnouncement { - ApiConfigAnnouncement { - name, - text, - } + ApiConfigAnnouncement { name, text } } } - diff --git a/src/models/api_config_download_url_list.rs b/src/models/api_config_download_url_list.rs index e0eb3e4..595e3ff 100644 --- a/src/models/api_config_download_url_list.rs +++ b/src/models/api_config_download_url_list.rs @@ -31,7 +31,13 @@ pub struct ApiConfigDownloadUrlList { impl ApiConfigDownloadUrlList { /// Download links for various development assets. - pub fn new(sdk2: String, sdk3_avatars: String, sdk3_worlds: String, vcc: String, bootstrap: String) -> ApiConfigDownloadUrlList { + pub fn new( + sdk2: String, + sdk3_avatars: String, + sdk3_worlds: String, + vcc: String, + bootstrap: String, + ) -> ApiConfigDownloadUrlList { ApiConfigDownloadUrlList { sdk2, sdk3_avatars, @@ -41,4 +47,3 @@ impl ApiConfigDownloadUrlList { } } } - diff --git a/src/models/api_config_events.rs b/src/models/api_config_events.rs index 3ac327e..439f6f6 100644 --- a/src/models/api_config_events.rs +++ b/src/models/api_config_events.rs @@ -44,7 +44,18 @@ pub struct ApiConfigEvents { } impl ApiConfigEvents { - pub fn new(distance_close: i32, distance_factor: i32, distance_far: i32, group_distance: i32, maximum_bunch_size: i32, not_visible_factor: i32, player_order_bucket_size: i32, player_order_factor: i32, slow_update_factor_threshold: i32, view_segment_length: i32) -> ApiConfigEvents { + pub fn new( + distance_close: i32, + distance_factor: i32, + distance_far: i32, + group_distance: i32, + maximum_bunch_size: i32, + not_visible_factor: i32, + player_order_bucket_size: i32, + player_order_factor: i32, + slow_update_factor_threshold: i32, + view_segment_length: i32, + ) -> ApiConfigEvents { ApiConfigEvents { distance_close, distance_factor, @@ -59,4 +70,3 @@ impl ApiConfigEvents { } } } - diff --git a/src/models/api_health.rs b/src/models/api_health.rs index cd89ca1..565f16e 100644 --- a/src/models/api_health.rs +++ b/src/models/api_health.rs @@ -28,4 +28,3 @@ impl ApiHealth { } } } - diff --git a/src/models/avatar.rs b/src/models/avatar.rs index 77f35e0..c8e4a8d 100644 --- a/src/models/avatar.rs +++ b/src/models/avatar.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// Avatar : +/// Avatar : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Avatar { /// Not present from general serach `/avatars`, only on specific requests `/avatars/{avatarId}`. @@ -44,7 +44,7 @@ pub struct Avatar { #[serde(rename = "unityPackageUrl")] pub unity_package_url: String, #[serde(rename = "unityPackageUrlObject")] - pub unity_package_url_object: Box, + pub unity_package_url_object: models::AvatarUnityPackageUrlObject, #[serde(rename = "unityPackages")] pub unity_packages: Vec, #[serde(rename = "updated_at")] @@ -54,7 +54,24 @@ pub struct Avatar { } impl Avatar { - pub fn new(author_id: String, author_name: String, created_at: String, description: String, featured: bool, id: String, image_url: String, name: String, release_status: models::ReleaseStatus, tags: Vec, thumbnail_image_url: String, unity_package_url: String, unity_package_url_object: models::AvatarUnityPackageUrlObject, unity_packages: Vec, updated_at: String, version: i32) -> Avatar { + pub fn new( + author_id: String, + author_name: String, + created_at: String, + description: String, + featured: bool, + id: String, + image_url: String, + name: String, + release_status: models::ReleaseStatus, + tags: Vec, + thumbnail_image_url: String, + unity_package_url: String, + unity_package_url_object: models::AvatarUnityPackageUrlObject, + unity_packages: Vec, + updated_at: String, + version: i32, + ) -> Avatar { Avatar { asset_url: None, asset_url_object: None, @@ -70,11 +87,10 @@ impl Avatar { tags, thumbnail_image_url, unity_package_url, - unity_package_url_object: Box::new(unity_package_url_object), + unity_package_url_object, unity_packages, updated_at, version, } } } - diff --git a/src/models/avatar_unity_package_url_object.rs b/src/models/avatar_unity_package_url_object.rs index 7c58797..83ec97d 100644 --- a/src/models/avatar_unity_package_url_object.rs +++ b/src/models/avatar_unity_package_url_object.rs @@ -24,4 +24,3 @@ impl AvatarUnityPackageUrlObject { } } } - diff --git a/src/models/badge.rs b/src/models/badge.rs index b04849b..0c30d0e 100644 --- a/src/models/badge.rs +++ b/src/models/badge.rs @@ -12,7 +12,12 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Badge { /// only present in CurrentUser badges - #[serde(rename = "assignedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "assignedAt", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub assigned_at: Option>, #[serde(rename = "badgeDescription")] pub badge_description: String, @@ -24,17 +29,33 @@ pub struct Badge { #[serde(rename = "badgeName")] pub badge_name: String, /// only present in CurrentUser badges - #[serde(rename = "hidden", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "hidden", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub hidden: Option>, #[serde(rename = "showcased")] pub showcased: bool, /// only present in CurrentUser badges - #[serde(rename = "updatedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "updatedAt", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub updated_at: Option>, } impl Badge { - pub fn new(badge_description: String, badge_id: String, badge_image_url: String, badge_name: String, showcased: bool) -> Badge { + pub fn new( + badge_description: String, + badge_id: String, + badge_image_url: String, + badge_name: String, + showcased: bool, + ) -> Badge { Badge { assigned_at: None, badge_description, @@ -47,4 +68,3 @@ impl Badge { } } } - diff --git a/src/models/ban_group_member_request.rs b/src/models/ban_group_member_request.rs index 0cd9205..d2e8630 100644 --- a/src/models/ban_group_member_request.rs +++ b/src/models/ban_group_member_request.rs @@ -18,9 +18,6 @@ pub struct BanGroupMemberRequest { impl BanGroupMemberRequest { pub fn new(user_id: String) -> BanGroupMemberRequest { - BanGroupMemberRequest { - user_id, - } + BanGroupMemberRequest { user_id } } } - diff --git a/src/models/create_avatar_request.rs b/src/models/create_avatar_request.rs index 5e8c888..3b032ae 100644 --- a/src/models/create_avatar_request.rs +++ b/src/models/create_avatar_request.rs @@ -49,4 +49,3 @@ impl CreateAvatarRequest { } } } - diff --git a/src/models/create_file_request.rs b/src/models/create_file_request.rs index f9edc05..52e1861 100644 --- a/src/models/create_file_request.rs +++ b/src/models/create_file_request.rs @@ -31,4 +31,3 @@ impl CreateFileRequest { } } } - diff --git a/src/models/create_file_version_request.rs b/src/models/create_file_version_request.rs index 99ba461..40fe50f 100644 --- a/src/models/create_file_version_request.rs +++ b/src/models/create_file_version_request.rs @@ -31,4 +31,3 @@ impl CreateFileVersionRequest { } } } - diff --git a/src/models/create_group_announcement_request.rs b/src/models/create_group_announcement_request.rs index 22f941a..9d9bbfb 100644 --- a/src/models/create_group_announcement_request.rs +++ b/src/models/create_group_announcement_request.rs @@ -34,4 +34,3 @@ impl CreateGroupAnnouncementRequest { } } } - diff --git a/src/models/create_group_gallery_request.rs b/src/models/create_group_gallery_request.rs index cbe1249..edb1afd 100644 --- a/src/models/create_group_gallery_request.rs +++ b/src/models/create_group_gallery_request.rs @@ -20,13 +20,33 @@ pub struct CreateGroupGalleryRequest { /// Whether the gallery is members only. #[serde(rename = "membersOnly", skip_serializing_if = "Option::is_none")] pub members_only: Option, - #[serde(rename = "roleIdsToView", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "roleIdsToView", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub role_ids_to_view: Option>>, - #[serde(rename = "roleIdsToSubmit", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "roleIdsToSubmit", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub role_ids_to_submit: Option>>, - #[serde(rename = "roleIdsToAutoApprove", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "roleIdsToAutoApprove", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub role_ids_to_auto_approve: Option>>, - #[serde(rename = "roleIdsToManage", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "roleIdsToManage", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub role_ids_to_manage: Option>>, } @@ -43,4 +63,3 @@ impl CreateGroupGalleryRequest { } } } - diff --git a/src/models/create_group_invite_request.rs b/src/models/create_group_invite_request.rs index 0c3487b..ba17230 100644 --- a/src/models/create_group_invite_request.rs +++ b/src/models/create_group_invite_request.rs @@ -14,7 +14,10 @@ pub struct CreateGroupInviteRequest { /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. #[serde(rename = "userId")] pub user_id: String, - #[serde(rename = "confirmOverrideBlock", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "confirmOverrideBlock", + skip_serializing_if = "Option::is_none" + )] pub confirm_override_block: Option, } @@ -26,4 +29,3 @@ impl CreateGroupInviteRequest { } } } - diff --git a/src/models/create_group_post_request.rs b/src/models/create_group_post_request.rs index e35a3a9..f9a15f9 100644 --- a/src/models/create_group_post_request.rs +++ b/src/models/create_group_post_request.rs @@ -29,7 +29,12 @@ pub struct CreateGroupPostRequest { } impl CreateGroupPostRequest { - pub fn new(title: String, text: String, send_notification: bool, visibility: models::GroupPostVisibility) -> CreateGroupPostRequest { + pub fn new( + title: String, + text: String, + send_notification: bool, + visibility: models::GroupPostVisibility, + ) -> CreateGroupPostRequest { CreateGroupPostRequest { title, text, @@ -40,4 +45,3 @@ impl CreateGroupPostRequest { } } } - diff --git a/src/models/create_group_request.rs b/src/models/create_group_request.rs index 3348ecb..9dd2f4e 100644 --- a/src/models/create_group_request.rs +++ b/src/models/create_group_request.rs @@ -19,9 +19,19 @@ pub struct CreateGroupRequest { pub description: Option, #[serde(rename = "joinState", skip_serializing_if = "Option::is_none")] pub join_state: Option, - #[serde(rename = "iconId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "iconId", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub icon_id: Option>, - #[serde(rename = "bannerId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "bannerId", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub banner_id: Option>, #[serde(rename = "privacy", skip_serializing_if = "Option::is_none")] pub privacy: Option, @@ -30,7 +40,11 @@ pub struct CreateGroupRequest { } impl CreateGroupRequest { - pub fn new(name: String, short_code: String, role_template: models::GroupRoleTemplate) -> CreateGroupRequest { + pub fn new( + name: String, + short_code: String, + role_template: models::GroupRoleTemplate, + ) -> CreateGroupRequest { CreateGroupRequest { name, short_code, @@ -43,4 +57,3 @@ impl CreateGroupRequest { } } } - diff --git a/src/models/create_group_role_request.rs b/src/models/create_group_role_request.rs index 72a9f1d..4d4eeed 100644 --- a/src/models/create_group_role_request.rs +++ b/src/models/create_group_role_request.rs @@ -34,4 +34,3 @@ impl CreateGroupRoleRequest { } } } - diff --git a/src/models/create_instance_request.rs b/src/models/create_instance_request.rs index 5ded5ef..bc67c97 100644 --- a/src/models/create_instance_request.rs +++ b/src/models/create_instance_request.rs @@ -19,7 +19,12 @@ pub struct CreateInstanceRequest { #[serde(rename = "region")] pub region: models::InstanceRegion, /// A groupId if the instance type is \"group\", null if instance type is public, or a userId otherwise - #[serde(rename = "ownerId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "ownerId", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub owner_id: Option>, /// Group roleIds that are allowed to join if the type is \"group\" and groupAccessType is \"member\" #[serde(rename = "roleIds", skip_serializing_if = "Option::is_none")] @@ -42,7 +47,11 @@ pub struct CreateInstanceRequest { } impl CreateInstanceRequest { - pub fn new(world_id: String, r#type: models::InstanceType, region: models::InstanceRegion) -> CreateInstanceRequest { + pub fn new( + world_id: String, + r#type: models::InstanceType, + region: models::InstanceRegion, + ) -> CreateInstanceRequest { CreateInstanceRequest { world_id, r#type, @@ -58,4 +67,3 @@ impl CreateInstanceRequest { } } } - diff --git a/src/models/create_world_request.rs b/src/models/create_world_request.rs index 7f84409..557d60e 100644 --- a/src/models/create_world_request.rs +++ b/src/models/create_world_request.rs @@ -64,4 +64,3 @@ impl CreateWorldRequest { } } } - diff --git a/src/models/current_user.rs b/src/models/current_user.rs index c3b8668..019f0ed 100644 --- a/src/models/current_user.rs +++ b/src/models/current_user.rs @@ -13,11 +13,24 @@ use serde::{Deserialize, Serialize}; pub struct CurrentUser { #[serde(rename = "acceptedTOSVersion")] pub accepted_tos_version: i32, - #[serde(rename = "acceptedPrivacyVersion", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "acceptedPrivacyVersion", + skip_serializing_if = "Option::is_none" + )] pub accepted_privacy_version: Option, - #[serde(rename = "accountDeletionDate", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "accountDeletionDate", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub account_deletion_date: Option>, - #[serde(rename = "accountDeletionLog", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "accountDeletionLog", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub account_deletion_log: Option>>, #[serde(rename = "activeFriends", skip_serializing_if = "Option::is_none")] pub active_friends: Option>, @@ -60,11 +73,24 @@ pub struct CurrentUser { pub friends: Vec, #[serde(rename = "hasBirthday")] pub has_birthday: bool, - #[serde(rename = "hideContentFilterSettings", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "hideContentFilterSettings", + skip_serializing_if = "Option::is_none" + )] pub hide_content_filter_settings: Option, - #[serde(rename = "userLanguage", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "userLanguage", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub user_language: Option>, - #[serde(rename = "userLanguageCode", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "userLanguageCode", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub user_language_code: Option>, #[serde(rename = "hasEmail")] pub has_email: bool, @@ -112,7 +138,7 @@ pub struct CurrentUser { #[serde(rename = "pastDisplayNames")] pub past_display_names: Vec, #[serde(rename = "presence", skip_serializing_if = "Option::is_none")] - pub presence: Option>, + pub presence: Option, #[serde(rename = "profilePicOverride")] pub profile_pic_override: String, #[serde(rename = "profilePicOverrideThumbnail")] @@ -137,7 +163,12 @@ pub struct CurrentUser { pub tags: Vec, #[serde(rename = "twoFactorAuthEnabled")] pub two_factor_auth_enabled: bool, - #[serde(rename = "twoFactorAuthEnabledDate", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "twoFactorAuthEnabledDate", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub two_factor_auth_enabled_date: Option>, #[serde(rename = "unsubscribe")] pub unsubscribe: bool, @@ -151,7 +182,52 @@ pub struct CurrentUser { } impl CurrentUser { - pub fn new(accepted_tos_version: i32, allow_avatar_copying: bool, bio: String, bio_links: Vec, current_avatar: String, current_avatar_asset_url: String, current_avatar_image_url: String, current_avatar_thumbnail_image_url: String, current_avatar_tags: Vec, date_joined: String, developer_type: models::DeveloperType, display_name: String, email_verified: bool, friend_group_names: Vec, friend_key: String, friends: Vec, has_birthday: bool, has_email: bool, has_logged_in_from_client: bool, has_pending_email: bool, home_location: String, id: String, is_friend: bool, last_login: String, last_mobile: Option, last_platform: String, obfuscated_email: String, obfuscated_pending_email: String, oculus_id: String, past_display_names: Vec, profile_pic_override: String, profile_pic_override_thumbnail: String, pronouns: String, state: models::UserState, status: models::UserStatus, status_description: String, status_first_time: bool, status_history: Vec, steam_details: serde_json::Value, steam_id: String, tags: Vec, two_factor_auth_enabled: bool, unsubscribe: bool, user_icon: String) -> CurrentUser { + pub fn new( + accepted_tos_version: i32, + allow_avatar_copying: bool, + bio: String, + bio_links: Vec, + current_avatar: String, + current_avatar_asset_url: String, + current_avatar_image_url: String, + current_avatar_thumbnail_image_url: String, + current_avatar_tags: Vec, + date_joined: String, + developer_type: models::DeveloperType, + display_name: String, + email_verified: bool, + friend_group_names: Vec, + friend_key: String, + friends: Vec, + has_birthday: bool, + has_email: bool, + has_logged_in_from_client: bool, + has_pending_email: bool, + home_location: String, + id: String, + is_friend: bool, + last_login: String, + last_mobile: Option, + last_platform: String, + obfuscated_email: String, + obfuscated_pending_email: String, + oculus_id: String, + past_display_names: Vec, + profile_pic_override: String, + profile_pic_override_thumbnail: String, + pronouns: String, + state: models::UserState, + status: models::UserStatus, + status_description: String, + status_first_time: bool, + status_history: Vec, + steam_details: serde_json::Value, + steam_id: String, + tags: Vec, + two_factor_auth_enabled: bool, + unsubscribe: bool, + user_icon: String, + ) -> CurrentUser { CurrentUser { accepted_tos_version, accepted_privacy_version: None, @@ -221,16 +297,3 @@ impl CurrentUser { } } } - -#[derive(Serialize, Deserialize)] -#[serde(untagged)] -pub enum EitherUserOrTwoFactor{ - CurrentUser(CurrentUser), - RequiresTwoFactorAuth(RequiresTwoFactorAuth), -} - -#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize, Deserialize)] -pub struct RequiresTwoFactorAuth{ - #[serde(rename = "requiresTwoFactorAuth")] - pub requires_two_factor_auth: Vec -} \ No newline at end of file diff --git a/src/models/current_user_presence.rs b/src/models/current_user_presence.rs index d177463..b45e42e 100644 --- a/src/models/current_user_presence.rs +++ b/src/models/current_user_presence.rs @@ -11,31 +11,76 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CurrentUserPresence { - #[serde(rename = "avatarThumbnail", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "avatarThumbnail", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub avatar_thumbnail: Option>, #[serde(rename = "displayName", skip_serializing_if = "Option::is_none")] pub display_name: Option, - #[serde(rename = "groups", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "groups", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub groups: Option>>, /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, - #[serde(rename = "instance", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "instance", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub instance: Option>, /// either an InstanceType or an empty string - #[serde(rename = "instanceType", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "instanceType", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub instance_type: Option>, - #[serde(rename = "isRejoining", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "isRejoining", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub is_rejoining: Option>, /// either a Platform or an empty string - #[serde(rename = "platform", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "platform", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub platform: Option>, - #[serde(rename = "profilePicOverride", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "profilePicOverride", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub profile_pic_override: Option>, /// either a UserStatus or empty string - #[serde(rename = "status", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "status", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub status: Option>, - #[serde(rename = "travelingToInstance", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "travelingToInstance", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub traveling_to_instance: Option>, /// WorldID be \"offline\" on User profiles if you are not friends with that user. #[serde(rename = "travelingToWorld", skip_serializing_if = "Option::is_none")] @@ -64,4 +109,3 @@ impl CurrentUserPresence { } } } - diff --git a/src/models/deployment_group.rs b/src/models/deployment_group.rs index 24d032a..1b60620 100644 --- a/src/models/deployment_group.rs +++ b/src/models/deployment_group.rs @@ -21,7 +21,6 @@ pub enum DeploymentGroup { Grape, #[serde(rename = "cherry")] Cherry, - } impl std::fmt::Display for DeploymentGroup { @@ -40,4 +39,3 @@ impl Default for DeploymentGroup { Self::Blue } } - diff --git a/src/models/developer_type.rs b/src/models/developer_type.rs index c0f9520..326ca0f 100644 --- a/src/models/developer_type.rs +++ b/src/models/developer_type.rs @@ -21,7 +21,6 @@ pub enum DeveloperType { Internal, #[serde(rename = "moderator")] Moderator, - } impl std::fmt::Display for DeveloperType { @@ -40,4 +39,3 @@ impl Default for DeveloperType { Self::None } } - diff --git a/src/models/dynamic_content_row.rs b/src/models/dynamic_content_row.rs index 7300c57..a38490c 100644 --- a/src/models/dynamic_content_row.rs +++ b/src/models/dynamic_content_row.rs @@ -33,7 +33,13 @@ pub struct DynamicContentRow { } impl DynamicContentRow { - pub fn new(name: String, platform: String, sort_heading: String, sort_order: String, sort_ownership: String) -> DynamicContentRow { + pub fn new( + name: String, + platform: String, + sort_heading: String, + sort_order: String, + sort_ownership: String, + ) -> DynamicContentRow { DynamicContentRow { index: None, name, @@ -46,4 +52,3 @@ impl DynamicContentRow { } } } - diff --git a/src/models/error.rs b/src/models/error.rs index 7612690..34cdb5b 100644 --- a/src/models/error.rs +++ b/src/models/error.rs @@ -12,14 +12,11 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Error { #[serde(rename = "error", skip_serializing_if = "Option::is_none")] - pub error: Option>, + pub error: Option, } impl Error { pub fn new() -> Error { - Error { - error: None, - } + Error { error: None } } } - diff --git a/src/models/favorite.rs b/src/models/favorite.rs index 7f9584e..a28e2aa 100644 --- a/src/models/favorite.rs +++ b/src/models/favorite.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// Favorite : +/// Favorite : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Favorite { /// MUST be either AvatarID, UserID or WorldID. @@ -24,7 +24,12 @@ pub struct Favorite { } impl Favorite { - pub fn new(favorite_id: String, id: String, tags: Vec, r#type: models::FavoriteType) -> Favorite { + pub fn new( + favorite_id: String, + id: String, + tags: Vec, + r#type: models::FavoriteType, + ) -> Favorite { Favorite { favorite_id, id, @@ -33,4 +38,3 @@ impl Favorite { } } } - diff --git a/src/models/favorite_group.rs b/src/models/favorite_group.rs index 2afd531..728674f 100644 --- a/src/models/favorite_group.rs +++ b/src/models/favorite_group.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// FavoriteGroup : +/// FavoriteGroup : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct FavoriteGroup { #[serde(rename = "displayName")] @@ -32,7 +32,16 @@ pub struct FavoriteGroup { } impl FavoriteGroup { - pub fn new(display_name: String, id: String, name: String, owner_display_name: String, owner_id: String, tags: Vec, r#type: models::FavoriteType, visibility: models::FavoriteGroupVisibility) -> FavoriteGroup { + pub fn new( + display_name: String, + id: String, + name: String, + owner_display_name: String, + owner_id: String, + tags: Vec, + r#type: models::FavoriteType, + visibility: models::FavoriteGroupVisibility, + ) -> FavoriteGroup { FavoriteGroup { display_name, id, @@ -45,4 +54,3 @@ impl FavoriteGroup { } } } - diff --git a/src/models/favorite_group_visibility.rs b/src/models/favorite_group_visibility.rs index 246c2fc..ccac213 100644 --- a/src/models/favorite_group_visibility.rs +++ b/src/models/favorite_group_visibility.rs @@ -17,7 +17,6 @@ pub enum FavoriteGroupVisibility { Friends, #[serde(rename = "public")] Public, - } impl std::fmt::Display for FavoriteGroupVisibility { @@ -35,4 +34,3 @@ impl Default for FavoriteGroupVisibility { Self::Private } } - diff --git a/src/models/favorite_type.rs b/src/models/favorite_type.rs index cd30edb..d0f5d63 100644 --- a/src/models/favorite_type.rs +++ b/src/models/favorite_type.rs @@ -17,7 +17,6 @@ pub enum FavoriteType { Friend, #[serde(rename = "avatar")] Avatar, - } impl std::fmt::Display for FavoriteType { @@ -35,4 +34,3 @@ impl Default for FavoriteType { Self::World } } - diff --git a/src/models/file.rs b/src/models/file.rs index 4f203f0..f34119f 100644 --- a/src/models/file.rs +++ b/src/models/file.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// File : +/// File : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct File { #[serde(rename = "extension")] @@ -30,7 +30,15 @@ pub struct File { } impl File { - pub fn new(extension: String, id: String, mime_type: models::MimeType, name: String, owner_id: String, tags: Vec, versions: Vec) -> File { + pub fn new( + extension: String, + id: String, + mime_type: models::MimeType, + name: String, + owner_id: String, + tags: Vec, + versions: Vec, + ) -> File { File { extension, id, @@ -42,4 +50,3 @@ impl File { } } } - diff --git a/src/models/file_data.rs b/src/models/file_data.rs index c15ee83..3a80655 100644 --- a/src/models/file_data.rs +++ b/src/models/file_data.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// FileData : +/// FileData : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct FileData { #[serde(rename = "category")] @@ -29,7 +29,14 @@ pub struct FileData { } impl FileData { - pub fn new(category: Category, file_name: String, size_in_bytes: i32, status: models::FileStatus, upload_id: String, url: String) -> FileData { + pub fn new( + category: Category, + file_name: String, + size_in_bytes: i32, + status: models::FileStatus, + upload_id: String, + url: String, + ) -> FileData { FileData { category, file_name, @@ -56,4 +63,3 @@ impl Default for Category { Self::Multipart } } - diff --git a/src/models/file_status.rs b/src/models/file_status.rs index 9c296f3..d565753 100644 --- a/src/models/file_status.rs +++ b/src/models/file_status.rs @@ -19,7 +19,6 @@ pub enum FileStatus { None, #[serde(rename = "queued")] Queued, - } impl std::fmt::Display for FileStatus { @@ -38,4 +37,3 @@ impl Default for FileStatus { Self::Waiting } } - diff --git a/src/models/file_upload_url.rs b/src/models/file_upload_url.rs index 6d4dc43..5085bca 100644 --- a/src/models/file_upload_url.rs +++ b/src/models/file_upload_url.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// FileUploadUrl : +/// FileUploadUrl : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct FileUploadUrl { #[serde(rename = "url")] @@ -18,9 +18,6 @@ pub struct FileUploadUrl { impl FileUploadUrl { pub fn new(url: String) -> FileUploadUrl { - FileUploadUrl { - url, - } + FileUploadUrl { url } } } - diff --git a/src/models/file_version.rs b/src/models/file_version.rs index befc3e0..742426c 100644 --- a/src/models/file_version.rs +++ b/src/models/file_version.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// FileVersion : +/// FileVersion : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct FileVersion { #[serde(rename = "created_at")] @@ -18,11 +18,11 @@ pub struct FileVersion { #[serde(rename = "deleted", skip_serializing_if = "Option::is_none")] pub deleted: Option, #[serde(rename = "delta", skip_serializing_if = "Option::is_none")] - pub delta: Option>, + pub delta: Option, #[serde(rename = "file", skip_serializing_if = "Option::is_none")] - pub file: Option>, + pub file: Option, #[serde(rename = "signature", skip_serializing_if = "Option::is_none")] - pub signature: Option>, + pub signature: Option, #[serde(rename = "status")] pub status: models::FileStatus, /// Incremental version counter, can only be increased. @@ -43,4 +43,3 @@ impl FileVersion { } } } - diff --git a/src/models/file_version_upload_status.rs b/src/models/file_version_upload_status.rs index 41ed9d2..7448e50 100644 --- a/src/models/file_version_upload_status.rs +++ b/src/models/file_version_upload_status.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// FileVersionUploadStatus : +/// FileVersionUploadStatus : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct FileVersionUploadStatus { #[serde(rename = "uploadId")] @@ -28,7 +28,14 @@ pub struct FileVersionUploadStatus { } impl FileVersionUploadStatus { - pub fn new(upload_id: String, file_name: String, next_part_number: f64, max_parts: f64, parts: Vec, etags: Vec) -> FileVersionUploadStatus { + pub fn new( + upload_id: String, + file_name: String, + next_part_number: f64, + max_parts: f64, + parts: Vec, + etags: Vec, + ) -> FileVersionUploadStatus { FileVersionUploadStatus { upload_id, file_name, @@ -39,4 +46,3 @@ impl FileVersionUploadStatus { } } } - diff --git a/src/models/finish_file_data_upload_request.rs b/src/models/finish_file_data_upload_request.rs index 5ec9d0e..2a753c2 100644 --- a/src/models/finish_file_data_upload_request.rs +++ b/src/models/finish_file_data_upload_request.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// FinishFileDataUploadRequest : +/// FinishFileDataUploadRequest : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct FinishFileDataUploadRequest { /// Array of ETags uploaded. @@ -32,4 +32,3 @@ impl FinishFileDataUploadRequest { } } } - diff --git a/src/models/friend_status.rs b/src/models/friend_status.rs index 72c3720..0f8a6e4 100644 --- a/src/models/friend_status.rs +++ b/src/models/friend_status.rs @@ -28,4 +28,3 @@ impl FriendStatus { } } } - diff --git a/src/models/get_current_user_200_response.rs b/src/models/get_current_user_200_response.rs new file mode 100644 index 0000000..869beea --- /dev/null +++ b/src/models/get_current_user_200_response.rs @@ -0,0 +1,38 @@ +/* + * VRChat API Documentation + * + * + * Contact: vrchatapi.lpv0t@aries.fyi + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetCurrentUser200Response { + CurrentUser(models::CurrentUser), + TwoFactorRequired(models::TwoFactorRequired), +} + +impl Default for GetCurrentUser200Response { + fn default() -> Self { + Self::CurrentUser(Default::default()) + } +} +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum RequiresTwoFactorAuth { + #[serde(rename = "totp")] + Totp, + #[serde(rename = "otp")] + Otp, + #[serde(rename = "emailOtp")] + EmailOtp, +} + +impl Default for RequiresTwoFactorAuth { + fn default() -> RequiresTwoFactorAuth { + Self::Totp + } +} diff --git a/src/models/group.rs b/src/models/group.rs index 3b94caa..8376c10 100644 --- a/src/models/group.rs +++ b/src/models/group.rs @@ -21,28 +21,56 @@ pub struct Group { pub discriminator: Option, #[serde(rename = "description", skip_serializing_if = "Option::is_none")] pub description: Option, - #[serde(rename = "iconUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "iconUrl", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub icon_url: Option>, - #[serde(rename = "bannerUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "bannerUrl", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub banner_url: Option>, #[serde(rename = "privacy", skip_serializing_if = "Option::is_none")] pub privacy: Option, /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. #[serde(rename = "ownerId", skip_serializing_if = "Option::is_none")] pub owner_id: Option, - #[serde(rename = "rules", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "rules", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub rules: Option>, #[serde(rename = "links", skip_serializing_if = "Option::is_none")] pub links: Option>, #[serde(rename = "languages", skip_serializing_if = "Option::is_none")] pub languages: Option>, - #[serde(rename = "iconId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "iconId", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub icon_id: Option>, - #[serde(rename = "bannerId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "bannerId", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub banner_id: Option>, #[serde(rename = "memberCount", skip_serializing_if = "Option::is_none")] pub member_count: Option, - #[serde(rename = "memberCountSyncedAt", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "memberCountSyncedAt", + skip_serializing_if = "Option::is_none" + )] pub member_count_synced_at: Option, #[serde(rename = "isVerified", skip_serializing_if = "Option::is_none")] pub is_verified: Option, @@ -59,16 +87,26 @@ pub struct Group { pub created_at: Option, #[serde(rename = "updatedAt", skip_serializing_if = "Option::is_none")] pub updated_at: Option, - #[serde(rename = "lastPostCreatedAt", skip_serializing_if = "Option::is_none")] - pub last_post_created_at: Option, + #[serde( + rename = "lastPostCreatedAt", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub last_post_created_at: Option>, #[serde(rename = "onlineMemberCount", skip_serializing_if = "Option::is_none")] pub online_member_count: Option, #[serde(rename = "membershipStatus", skip_serializing_if = "Option::is_none")] pub membership_status: Option, #[serde(rename = "myMember", skip_serializing_if = "Option::is_none")] - pub my_member: Option>, + pub my_member: Option, /// Only returned if ?includeRoles=true is specified. - #[serde(rename = "roles", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "roles", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub roles: Option>>, } @@ -106,4 +144,3 @@ impl Group { } } } - diff --git a/src/models/group_access_type.rs b/src/models/group_access_type.rs index 084c70c..57d23c2 100644 --- a/src/models/group_access_type.rs +++ b/src/models/group_access_type.rs @@ -19,7 +19,6 @@ pub enum GroupAccessType { Plus, #[serde(rename = "members")] Members, - } impl std::fmt::Display for GroupAccessType { @@ -37,4 +36,3 @@ impl Default for GroupAccessType { Self::Public } } - diff --git a/src/models/group_announcement.rs b/src/models/group_announcement.rs index 89eddee..130b797 100644 --- a/src/models/group_announcement.rs +++ b/src/models/group_announcement.rs @@ -18,17 +18,42 @@ pub struct GroupAnnouncement { /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. #[serde(rename = "authorId", skip_serializing_if = "Option::is_none")] pub author_id: Option, - #[serde(rename = "title", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "title", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub title: Option>, - #[serde(rename = "text", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "text", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub text: Option>, #[serde(rename = "imageId", skip_serializing_if = "Option::is_none")] pub image_id: Option, - #[serde(rename = "imageUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "imageUrl", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub image_url: Option>, - #[serde(rename = "createdAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "createdAt", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub created_at: Option>, - #[serde(rename = "updatedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "updatedAt", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub updated_at: Option>, } @@ -47,4 +72,3 @@ impl GroupAnnouncement { } } } - diff --git a/src/models/group_audit_log_entry.rs b/src/models/group_audit_log_entry.rs index 861985f..fa1c3d6 100644 --- a/src/models/group_audit_log_entry.rs +++ b/src/models/group_audit_log_entry.rs @@ -51,4 +51,3 @@ impl GroupAuditLogEntry { } } } - diff --git a/src/models/group_gallery.rs b/src/models/group_gallery.rs index 3381c82..2515881 100644 --- a/src/models/group_gallery.rs +++ b/src/models/group_gallery.rs @@ -22,13 +22,33 @@ pub struct GroupGallery { /// Whether the gallery is members only. #[serde(rename = "membersOnly", skip_serializing_if = "Option::is_none")] pub members_only: Option, - #[serde(rename = "roleIdsToView", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "roleIdsToView", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub role_ids_to_view: Option>>, - #[serde(rename = "roleIdsToSubmit", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "roleIdsToSubmit", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub role_ids_to_submit: Option>>, - #[serde(rename = "roleIdsToAutoApprove", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "roleIdsToAutoApprove", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub role_ids_to_auto_approve: Option>>, - #[serde(rename = "roleIdsToManage", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "roleIdsToManage", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub role_ids_to_manage: Option>>, #[serde(rename = "createdAt", skip_serializing_if = "Option::is_none")] pub created_at: Option, @@ -52,4 +72,3 @@ impl GroupGallery { } } } - diff --git a/src/models/group_gallery_image.rs b/src/models/group_gallery_image.rs index bde5170..c06ee0c 100644 --- a/src/models/group_gallery_image.rs +++ b/src/models/group_gallery_image.rs @@ -51,4 +51,3 @@ impl GroupGalleryImage { } } } - diff --git a/src/models/group_instance.rs b/src/models/group_instance.rs index a983594..2dc0224 100644 --- a/src/models/group_instance.rs +++ b/src/models/group_instance.rs @@ -17,19 +17,23 @@ pub struct GroupInstance { #[serde(rename = "location")] pub location: String, #[serde(rename = "world")] - pub world: Box, + pub world: models::World, #[serde(rename = "memberCount")] pub member_count: i32, } impl GroupInstance { - pub fn new(instance_id: String, location: String, world: models::World, member_count: i32) -> GroupInstance { + pub fn new( + instance_id: String, + location: String, + world: models::World, + member_count: i32, + ) -> GroupInstance { GroupInstance { instance_id, location, - world: Box::new(world), + world, member_count, } } } - diff --git a/src/models/group_join_request_action.rs b/src/models/group_join_request_action.rs index fefdab2..755c9ae 100644 --- a/src/models/group_join_request_action.rs +++ b/src/models/group_join_request_action.rs @@ -15,7 +15,6 @@ pub enum GroupJoinRequestAction { Accept, #[serde(rename = "reject")] Reject, - } impl std::fmt::Display for GroupJoinRequestAction { @@ -32,4 +31,3 @@ impl Default for GroupJoinRequestAction { Self::Accept } } - diff --git a/src/models/group_join_state.rs b/src/models/group_join_state.rs index 435a6ea..55b7597 100644 --- a/src/models/group_join_state.rs +++ b/src/models/group_join_state.rs @@ -19,7 +19,6 @@ pub enum GroupJoinState { Request, #[serde(rename = "open")] Open, - } impl std::fmt::Display for GroupJoinState { @@ -38,4 +37,3 @@ impl Default for GroupJoinState { Self::Closed } } - diff --git a/src/models/group_limited_member.rs b/src/models/group_limited_member.rs index 828d933..c079e26 100644 --- a/src/models/group_limited_member.rs +++ b/src/models/group_limited_member.rs @@ -25,26 +25,57 @@ pub struct GroupLimitedMember { pub role_ids: Option>, #[serde(rename = "mRoleIds", skip_serializing_if = "Option::is_none")] pub m_role_ids: Option>, - #[serde(rename = "joinedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "joinedAt", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub joined_at: Option>, #[serde(rename = "membershipStatus", skip_serializing_if = "Option::is_none")] pub membership_status: Option, #[serde(rename = "visibility", skip_serializing_if = "Option::is_none")] pub visibility: Option, - #[serde(rename = "isSubscribedToAnnouncements", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "isSubscribedToAnnouncements", + skip_serializing_if = "Option::is_none" + )] pub is_subscribed_to_announcements: Option, /// Only visible via the /groups/:groupId/members endpoint, **not** when fetching a specific user. - #[serde(rename = "createdAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "createdAt", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub created_at: Option>, /// Only visible via the /groups/:groupId/members endpoint, **not** when fetching a specific user. - #[serde(rename = "bannedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "bannedAt", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub banned_at: Option>, /// Only visible via the /groups/:groupId/members endpoint, **not** when fetching a specific user. - #[serde(rename = "managerNotes", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "managerNotes", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub manager_notes: Option>, - #[serde(rename = "lastPostReadAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "lastPostReadAt", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub last_post_read_at: Option>, - #[serde(rename = "hasJoinedFromPurchase", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "hasJoinedFromPurchase", + skip_serializing_if = "Option::is_none" + )] pub has_joined_from_purchase: Option, } @@ -69,4 +100,3 @@ impl GroupLimitedMember { } } } - diff --git a/src/models/group_member.rs b/src/models/group_member.rs index 6ef8489..f1a8f32 100644 --- a/src/models/group_member.rs +++ b/src/models/group_member.rs @@ -22,31 +22,62 @@ pub struct GroupMember { #[serde(rename = "isRepresenting", skip_serializing_if = "Option::is_none")] pub is_representing: Option, #[serde(rename = "user", skip_serializing_if = "Option::is_none")] - pub user: Option>, + pub user: Option, #[serde(rename = "roleIds", skip_serializing_if = "Option::is_none")] pub role_ids: Option>, #[serde(rename = "mRoleIds", skip_serializing_if = "Option::is_none")] pub m_role_ids: Option>, - #[serde(rename = "joinedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "joinedAt", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub joined_at: Option>, #[serde(rename = "membershipStatus", skip_serializing_if = "Option::is_none")] pub membership_status: Option, #[serde(rename = "visibility", skip_serializing_if = "Option::is_none")] pub visibility: Option, - #[serde(rename = "isSubscribedToAnnouncements", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "isSubscribedToAnnouncements", + skip_serializing_if = "Option::is_none" + )] pub is_subscribed_to_announcements: Option, /// Only visible via the /groups/:groupId/members endpoint, **not** when fetching a specific user. - #[serde(rename = "createdAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "createdAt", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub created_at: Option>, /// Only visible via the /groups/:groupId/members endpoint, **not** when fetching a specific user. - #[serde(rename = "bannedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "bannedAt", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub banned_at: Option>, /// Only visible via the /groups/:groupId/members endpoint, **not** when fetching a specific user. - #[serde(rename = "managerNotes", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "managerNotes", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub manager_notes: Option>, - #[serde(rename = "lastPostReadAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "lastPostReadAt", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub last_post_read_at: Option>, - #[serde(rename = "hasJoinedFromPurchase", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "hasJoinedFromPurchase", + skip_serializing_if = "Option::is_none" + )] pub has_joined_from_purchase: Option, } @@ -72,4 +103,3 @@ impl GroupMember { } } } - diff --git a/src/models/group_member_limited_user.rs b/src/models/group_member_limited_user.rs index 4606edd..56c08d7 100644 --- a/src/models/group_member_limited_user.rs +++ b/src/models/group_member_limited_user.rs @@ -17,13 +17,23 @@ pub struct GroupMemberLimitedUser { pub id: Option, #[serde(rename = "displayName", skip_serializing_if = "Option::is_none")] pub display_name: Option, - #[serde(rename = "thumbnailUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "thumbnailUrl", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub thumbnail_url: Option>, #[serde(rename = "iconUrl", skip_serializing_if = "Option::is_none")] pub icon_url: Option, #[serde(rename = "profilePicOverride", skip_serializing_if = "Option::is_none")] pub profile_pic_override: Option, - #[serde(rename = "currentAvatarThumbnailImageUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "currentAvatarThumbnailImageUrl", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub current_avatar_thumbnail_image_url: Option>, #[serde(rename = "currentAvatarTags", skip_serializing_if = "Option::is_none")] pub current_avatar_tags: Option>, @@ -43,4 +53,3 @@ impl GroupMemberLimitedUser { } } } - diff --git a/src/models/group_member_status.rs b/src/models/group_member_status.rs index 6ccbf78..82a0afd 100644 --- a/src/models/group_member_status.rs +++ b/src/models/group_member_status.rs @@ -23,7 +23,6 @@ pub enum GroupMemberStatus { Banned, #[serde(rename = "userblocked")] Userblocked, - } impl std::fmt::Display for GroupMemberStatus { @@ -44,4 +43,3 @@ impl Default for GroupMemberStatus { Self::Inactive } } - diff --git a/src/models/group_my_member.rs b/src/models/group_my_member.rs index 33ae2af..5b550e6 100644 --- a/src/models/group_my_member.rs +++ b/src/models/group_my_member.rs @@ -20,8 +20,13 @@ pub struct GroupMyMember { pub user_id: Option, #[serde(rename = "roleIds", skip_serializing_if = "Option::is_none")] pub role_ids: Option>, - #[serde(rename = "acceptedByDisplayName", skip_serializing_if = "Option::is_none")] - pub accepted_by_display_name: Option, + #[serde( + rename = "acceptedByDisplayName", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub accepted_by_display_name: Option>, /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. #[serde(rename = "acceptedById", skip_serializing_if = "Option::is_none")] pub accepted_by_id: Option, @@ -31,7 +36,10 @@ pub struct GroupMyMember { pub manager_notes: Option, #[serde(rename = "membershipStatus", skip_serializing_if = "Option::is_none")] pub membership_status: Option, - #[serde(rename = "isSubscribedToAnnouncements", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "isSubscribedToAnnouncements", + skip_serializing_if = "Option::is_none" + )] pub is_subscribed_to_announcements: Option, #[serde(rename = "visibility", skip_serializing_if = "Option::is_none")] pub visibility: Option, @@ -39,14 +47,27 @@ pub struct GroupMyMember { pub is_representing: Option, #[serde(rename = "joinedAt", skip_serializing_if = "Option::is_none")] pub joined_at: Option, - #[serde(rename = "bannedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "bannedAt", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub banned_at: Option>, #[serde(rename = "has2FA", skip_serializing_if = "Option::is_none")] pub has2_fa: Option, - #[serde(rename = "hasJoinedFromPurchase", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "hasJoinedFromPurchase", + skip_serializing_if = "Option::is_none" + )] pub has_joined_from_purchase: Option, - #[serde(rename = "lastPostReadAt", skip_serializing_if = "Option::is_none")] - pub last_post_read_at: Option, + #[serde( + rename = "lastPostReadAt", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] + pub last_post_read_at: Option>, #[serde(rename = "mRoleIds", skip_serializing_if = "Option::is_none")] pub m_role_ids: Option>, #[serde(rename = "permissions", skip_serializing_if = "Option::is_none")] @@ -78,4 +99,3 @@ impl GroupMyMember { } } } - diff --git a/src/models/group_permission.rs b/src/models/group_permission.rs index 2c1f68c..b40008a 100644 --- a/src/models/group_permission.rs +++ b/src/models/group_permission.rs @@ -22,7 +22,10 @@ pub struct GroupPermission { #[serde(rename = "help", skip_serializing_if = "Option::is_none")] pub help: Option, /// Whether this permission is a \"management\" permission. - #[serde(rename = "isManagementPermission", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "isManagementPermission", + skip_serializing_if = "Option::is_none" + )] pub is_management_permission: Option, /// Whether the user is allowed to add this permission to a role. #[serde(rename = "allowedToAdd", skip_serializing_if = "Option::is_none")] @@ -41,4 +44,3 @@ impl GroupPermission { } } } - diff --git a/src/models/group_post.rs b/src/models/group_post.rs index 6b8c06f..5d94b42 100644 --- a/src/models/group_post.rs +++ b/src/models/group_post.rs @@ -31,7 +31,12 @@ pub struct GroupPost { pub text: Option, #[serde(rename = "imageId", skip_serializing_if = "Option::is_none")] pub image_id: Option, - #[serde(rename = "imageUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "imageUrl", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub image_url: Option>, #[serde(rename = "createdAt", skip_serializing_if = "Option::is_none")] pub created_at: Option, @@ -57,4 +62,3 @@ impl GroupPost { } } } - diff --git a/src/models/group_post_visibility.rs b/src/models/group_post_visibility.rs index a41d4b7..f8238a8 100644 --- a/src/models/group_post_visibility.rs +++ b/src/models/group_post_visibility.rs @@ -15,7 +15,6 @@ pub enum GroupPostVisibility { Group, #[serde(rename = "public")] Public, - } impl std::fmt::Display for GroupPostVisibility { @@ -32,4 +31,3 @@ impl Default for GroupPostVisibility { Self::Group } } - diff --git a/src/models/group_privacy.rs b/src/models/group_privacy.rs index 7a4ccec..2ea289d 100644 --- a/src/models/group_privacy.rs +++ b/src/models/group_privacy.rs @@ -15,7 +15,6 @@ pub enum GroupPrivacy { Default, #[serde(rename = "private")] Private, - } impl std::fmt::Display for GroupPrivacy { @@ -32,4 +31,3 @@ impl Default for GroupPrivacy { Self::Default } } - diff --git a/src/models/group_role.rs b/src/models/group_role.rs index 7b92517..55c8cca 100644 --- a/src/models/group_role.rs +++ b/src/models/group_role.rs @@ -55,4 +55,3 @@ impl GroupRole { } } } - diff --git a/src/models/group_role_template.rs b/src/models/group_role_template.rs index 350764e..51279a0 100644 --- a/src/models/group_role_template.rs +++ b/src/models/group_role_template.rs @@ -19,7 +19,6 @@ pub enum GroupRoleTemplate { ManagedInvite, #[serde(rename = "managedRequest")] ManagedRequest, - } impl std::fmt::Display for GroupRoleTemplate { @@ -38,4 +37,3 @@ impl Default for GroupRoleTemplate { Self::Default } } - diff --git a/src/models/group_search_sort.rs b/src/models/group_search_sort.rs index 7804b91..fa8687f 100644 --- a/src/models/group_search_sort.rs +++ b/src/models/group_search_sort.rs @@ -15,7 +15,6 @@ pub enum GroupSearchSort { Asc, #[serde(rename = "joinedAt:desc")] Desc, - } impl std::fmt::Display for GroupSearchSort { @@ -32,4 +31,3 @@ impl Default for GroupSearchSort { Self::Asc } } - diff --git a/src/models/group_user_visibility.rs b/src/models/group_user_visibility.rs index 170b660..959ada3 100644 --- a/src/models/group_user_visibility.rs +++ b/src/models/group_user_visibility.rs @@ -17,7 +17,6 @@ pub enum GroupUserVisibility { Hidden, #[serde(rename = "friends")] Friends, - } impl std::fmt::Display for GroupUserVisibility { @@ -35,4 +34,3 @@ impl Default for GroupUserVisibility { Self::Visible } } - diff --git a/src/models/info_push.rs b/src/models/info_push.rs index 4820756..950887d 100644 --- a/src/models/info_push.rs +++ b/src/models/info_push.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// InfoPush : +/// InfoPush : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct InfoPush { #[serde(rename = "id")] @@ -23,7 +23,7 @@ pub struct InfoPush { #[serde(rename = "tags")] pub tags: Vec, #[serde(rename = "data")] - pub data: Box, + pub data: models::InfoPushData, /// Unknown usage, MD5 #[serde(rename = "hash")] pub hash: String, @@ -38,14 +38,24 @@ pub struct InfoPush { } impl InfoPush { - pub fn new(id: String, is_enabled: bool, release_status: models::ReleaseStatus, priority: i32, tags: Vec, data: models::InfoPushData, hash: String, created_at: String, updated_at: String) -> InfoPush { + pub fn new( + id: String, + is_enabled: bool, + release_status: models::ReleaseStatus, + priority: i32, + tags: Vec, + data: models::InfoPushData, + hash: String, + created_at: String, + updated_at: String, + ) -> InfoPush { InfoPush { id, is_enabled, release_status, priority, tags, - data: Box::new(data), + data, hash, created_at, updated_at, @@ -54,4 +64,3 @@ impl InfoPush { } } } - diff --git a/src/models/info_push_data.rs b/src/models/info_push_data.rs index a1327b9..ef6a8ea 100644 --- a/src/models/info_push_data.rs +++ b/src/models/info_push_data.rs @@ -9,11 +9,11 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// InfoPushData : +/// InfoPushData : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct InfoPushData { #[serde(rename = "contentList", skip_serializing_if = "Option::is_none")] - pub content_list: Option>, + pub content_list: Option, #[serde(rename = "description", skip_serializing_if = "Option::is_none")] pub description: Option, #[serde(rename = "imageUrl", skip_serializing_if = "Option::is_none")] @@ -21,13 +21,13 @@ pub struct InfoPushData { #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, #[serde(rename = "onPressed", skip_serializing_if = "Option::is_none")] - pub on_pressed: Option>, + pub on_pressed: Option, #[serde(rename = "template", skip_serializing_if = "Option::is_none")] pub template: Option, #[serde(rename = "version", skip_serializing_if = "Option::is_none")] pub version: Option, #[serde(rename = "article", skip_serializing_if = "Option::is_none")] - pub article: Option>, + pub article: Option, } impl InfoPushData { @@ -44,4 +44,3 @@ impl InfoPushData { } } } - diff --git a/src/models/info_push_data_article.rs b/src/models/info_push_data_article.rs index 0970fe1..4550dff 100644 --- a/src/models/info_push_data_article.rs +++ b/src/models/info_push_data_article.rs @@ -12,14 +12,11 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct InfoPushDataArticle { #[serde(rename = "content", skip_serializing_if = "Option::is_none")] - pub content: Option>, + pub content: Option, } impl InfoPushDataArticle { pub fn new() -> InfoPushDataArticle { - InfoPushDataArticle { - content: None, - } + InfoPushDataArticle { content: None } } } - diff --git a/src/models/info_push_data_article_content.rs b/src/models/info_push_data_article_content.rs index 1780437..56030d2 100644 --- a/src/models/info_push_data_article_content.rs +++ b/src/models/info_push_data_article_content.rs @@ -16,7 +16,7 @@ pub struct InfoPushDataArticleContent { #[serde(rename = "imageUrl", skip_serializing_if = "Option::is_none")] pub image_url: Option, #[serde(rename = "onPressed", skip_serializing_if = "Option::is_none")] - pub on_pressed: Option>, + pub on_pressed: Option, } impl InfoPushDataArticleContent { @@ -28,4 +28,3 @@ impl InfoPushDataArticleContent { } } } - diff --git a/src/models/info_push_data_clickable.rs b/src/models/info_push_data_clickable.rs index a736f90..28a1ca6 100644 --- a/src/models/info_push_data_clickable.rs +++ b/src/models/info_push_data_clickable.rs @@ -43,4 +43,3 @@ impl Default for Command { Self::OpenUrl } } - diff --git a/src/models/instance.rs b/src/models/instance.rs index 4e4e107..3864802 100644 --- a/src/models/instance.rs +++ b/src/models/instance.rs @@ -36,21 +36,31 @@ pub struct Instance { #[serde(rename = "name")] pub name: String, /// A groupId if the instance type is \"group\", null if instance type is public, or a userId otherwise - #[serde(rename = "ownerId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "ownerId", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub owner_id: Option>, #[serde(rename = "permanent")] pub permanent: bool, #[serde(rename = "photonRegion")] pub photon_region: models::Region, #[serde(rename = "platforms")] - pub platforms: Box, + pub platforms: models::InstancePlatforms, #[serde(rename = "region")] pub region: models::InstanceRegion, #[serde(rename = "secureName")] pub secure_name: String, - #[serde(rename = "shortName", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "shortName", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub short_name: Option>, - /// The tags array on Instances usually contain the language tags of the people in the instance. + /// The tags array on Instances usually contain the language tags of the people in the instance. #[serde(rename = "tags")] pub tags: Vec, #[serde(rename = "type")] @@ -80,7 +90,7 @@ pub struct Instance { #[serde(rename = "userCount")] pub user_count: i32, #[serde(rename = "world")] - pub world: Box, + pub world: models::World, /// The users field is present on instances created by the requesting user. #[serde(rename = "users", skip_serializing_if = "Option::is_none")] pub users: Option>, @@ -90,15 +100,50 @@ pub struct Instance { pub has_capacity_for_you: Option, #[serde(rename = "nonce", skip_serializing_if = "Option::is_none")] pub nonce: Option, - #[serde(rename = "closedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "closedAt", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub closed_at: Option>, - #[serde(rename = "hardClose", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "hardClose", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub hard_close: Option>, } impl Instance { /// * `hidden` field is only present if InstanceType is `hidden` aka \"Friends+\", and is instance creator. * `friends` field is only present if InstanceType is `friends` aka \"Friends\", and is instance creator. * `private` field is only present if InstanceType is `private` aka \"Invite\" or \"Invite+\", and is instance creator. - pub fn new(active: bool, can_request_invite: bool, capacity: i32, client_number: String, full: bool, id: String, instance_id: String, location: String, n_users: i32, name: String, permanent: bool, photon_region: models::Region, platforms: models::InstancePlatforms, region: models::InstanceRegion, secure_name: String, tags: Vec, r#type: models::InstanceType, world_id: String, queue_enabled: bool, queue_size: i32, recommended_capacity: i32, strict: bool, user_count: i32, world: models::World) -> Instance { + pub fn new( + active: bool, + can_request_invite: bool, + capacity: i32, + client_number: String, + full: bool, + id: String, + instance_id: String, + location: String, + n_users: i32, + name: String, + permanent: bool, + photon_region: models::Region, + platforms: models::InstancePlatforms, + region: models::InstanceRegion, + secure_name: String, + tags: Vec, + r#type: models::InstanceType, + world_id: String, + queue_enabled: bool, + queue_size: i32, + recommended_capacity: i32, + strict: bool, + user_count: i32, + world: models::World, + ) -> Instance { Instance { active, can_request_invite, @@ -113,7 +158,7 @@ impl Instance { owner_id: None, permanent, photon_region, - platforms: Box::new(platforms), + platforms, region, secure_name, short_name: None, @@ -129,7 +174,7 @@ impl Instance { role_restricted: None, strict, user_count, - world: Box::new(world), + world, users: None, group_access_type: None, has_capacity_for_you: None, @@ -139,4 +184,3 @@ impl Instance { } } } - diff --git a/src/models/instance_platforms.rs b/src/models/instance_platforms.rs index 4d65645..8198cc8 100644 --- a/src/models/instance_platforms.rs +++ b/src/models/instance_platforms.rs @@ -25,4 +25,3 @@ impl InstancePlatforms { } } } - diff --git a/src/models/instance_region.rs b/src/models/instance_region.rs index 8377128..4884c95 100644 --- a/src/models/instance_region.rs +++ b/src/models/instance_region.rs @@ -21,7 +21,6 @@ pub enum InstanceRegion { Eu, #[serde(rename = "jp")] Jp, - } impl std::fmt::Display for InstanceRegion { @@ -40,4 +39,3 @@ impl Default for InstanceRegion { Self::Us } } - diff --git a/src/models/instance_short_name_response.rs b/src/models/instance_short_name_response.rs index 78240ba..cd362cb 100644 --- a/src/models/instance_short_name_response.rs +++ b/src/models/instance_short_name_response.rs @@ -25,4 +25,3 @@ impl InstanceShortNameResponse { } } } - diff --git a/src/models/instance_type.rs b/src/models/instance_type.rs index 62e65e5..17c822f 100644 --- a/src/models/instance_type.rs +++ b/src/models/instance_type.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// InstanceType : +/// InstanceType : #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum InstanceType { #[serde(rename = "public")] @@ -22,7 +22,6 @@ pub enum InstanceType { Private, #[serde(rename = "group")] Group, - } impl std::fmt::Display for InstanceType { @@ -42,4 +41,3 @@ impl Default for InstanceType { Self::Public } } - diff --git a/src/models/invite_message.rs b/src/models/invite_message.rs index 3943e90..6b271d7 100644 --- a/src/models/invite_message.rs +++ b/src/models/invite_message.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// InviteMessage : +/// InviteMessage : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct InviteMessage { #[serde(rename = "canBeUpdated")] @@ -30,7 +30,15 @@ pub struct InviteMessage { } impl InviteMessage { - pub fn new(can_be_updated: bool, id: String, message: String, message_type: models::InviteMessageType, remaining_cooldown_minutes: i32, slot: i32, updated_at: String) -> InviteMessage { + pub fn new( + can_be_updated: bool, + id: String, + message: String, + message_type: models::InviteMessageType, + remaining_cooldown_minutes: i32, + slot: i32, + updated_at: String, + ) -> InviteMessage { InviteMessage { can_be_updated, id, @@ -42,4 +50,3 @@ impl InviteMessage { } } } - diff --git a/src/models/invite_message_type.rs b/src/models/invite_message_type.rs index 3495fb2..f34e2fb 100644 --- a/src/models/invite_message_type.rs +++ b/src/models/invite_message_type.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// InviteMessageType : +/// InviteMessageType : #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum InviteMessageType { #[serde(rename = "message")] @@ -20,7 +20,6 @@ pub enum InviteMessageType { Request, #[serde(rename = "requestResponse")] RequestResponse, - } impl std::fmt::Display for InviteMessageType { @@ -39,4 +38,3 @@ impl Default for InviteMessageType { Self::Message } } - diff --git a/src/models/invite_request.rs b/src/models/invite_request.rs index 99e045c..37a060c 100644 --- a/src/models/invite_request.rs +++ b/src/models/invite_request.rs @@ -26,4 +26,3 @@ impl InviteRequest { } } } - diff --git a/src/models/invite_response.rs b/src/models/invite_response.rs index ede5719..659c009 100644 --- a/src/models/invite_response.rs +++ b/src/models/invite_response.rs @@ -17,9 +17,6 @@ pub struct InviteResponse { impl InviteResponse { pub fn new(response_slot: i32) -> InviteResponse { - InviteResponse { - response_slot, - } + InviteResponse { response_slot } } } - diff --git a/src/models/license.rs b/src/models/license.rs index d4252b5..8ff200a 100644 --- a/src/models/license.rs +++ b/src/models/license.rs @@ -23,7 +23,12 @@ pub struct License { } impl License { - pub fn new(for_id: String, for_type: models::LicenseType, for_name: String, for_action: models::LicenseAction) -> License { + pub fn new( + for_id: String, + for_type: models::LicenseType, + for_name: String, + for_action: models::LicenseAction, + ) -> License { License { for_id, for_type, @@ -32,4 +37,3 @@ impl License { } } } - diff --git a/src/models/license_action.rs b/src/models/license_action.rs index 5f77da5..40c7119 100644 --- a/src/models/license_action.rs +++ b/src/models/license_action.rs @@ -15,7 +15,6 @@ pub enum LicenseAction { Wear, #[serde(rename = "have")] Have, - } impl std::fmt::Display for LicenseAction { @@ -32,4 +31,3 @@ impl Default for LicenseAction { Self::Wear } } - diff --git a/src/models/license_group.rs b/src/models/license_group.rs index 1759e7e..94bc999 100644 --- a/src/models/license_group.rs +++ b/src/models/license_group.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// LicenseGroup : +/// LicenseGroup : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct LicenseGroup { #[serde(rename = "id")] @@ -23,7 +23,12 @@ pub struct LicenseGroup { } impl LicenseGroup { - pub fn new(id: String, name: String, description: String, licenses: Vec) -> LicenseGroup { + pub fn new( + id: String, + name: String, + description: String, + licenses: Vec, + ) -> LicenseGroup { LicenseGroup { id, name, @@ -32,4 +37,3 @@ impl LicenseGroup { } } } - diff --git a/src/models/license_type.rs b/src/models/license_type.rs index 481a199..718cc2a 100644 --- a/src/models/license_type.rs +++ b/src/models/license_type.rs @@ -19,7 +19,6 @@ pub enum LicenseType { Permission, #[serde(rename = "product")] Product, - } impl std::fmt::Display for LicenseType { @@ -38,4 +37,3 @@ impl Default for LicenseType { Self::Avatar } } - diff --git a/src/models/limited_group.rs b/src/models/limited_group.rs index 59df18f..e2b6ed5 100644 --- a/src/models/limited_group.rs +++ b/src/models/limited_group.rs @@ -21,18 +21,43 @@ pub struct LimitedGroup { pub discriminator: Option, #[serde(rename = "description", skip_serializing_if = "Option::is_none")] pub description: Option, - #[serde(rename = "iconUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "iconUrl", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub icon_url: Option>, - #[serde(rename = "bannerUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "bannerUrl", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub banner_url: Option>, /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. #[serde(rename = "ownerId", skip_serializing_if = "Option::is_none")] pub owner_id: Option, - #[serde(rename = "rules", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "rules", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub rules: Option>, - #[serde(rename = "iconId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "iconId", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub icon_id: Option>, - #[serde(rename = "bannerId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "bannerId", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub banner_id: Option>, #[serde(rename = "memberCount", skip_serializing_if = "Option::is_none")] pub member_count: Option, @@ -71,4 +96,3 @@ impl LimitedGroup { } } } - diff --git a/src/models/limited_unity_package.rs b/src/models/limited_unity_package.rs index d671080..8923bf7 100644 --- a/src/models/limited_unity_package.rs +++ b/src/models/limited_unity_package.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// LimitedUnityPackage : +/// LimitedUnityPackage : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct LimitedUnityPackage { /// This can be `standalonewindows` or `android`, but can also pretty much be any random Unity verison such as `2019.2.4-801-Release` or `2019.2.2-772-Release` or even `unknownplatform`. @@ -27,4 +27,3 @@ impl LimitedUnityPackage { } } } - diff --git a/src/models/limited_user.rs b/src/models/limited_user.rs index d444f30..24ccaa5 100644 --- a/src/models/limited_user.rs +++ b/src/models/limited_user.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// LimitedUser : +/// LimitedUser : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct LimitedUser { #[serde(rename = "bio", skip_serializing_if = "Option::is_none")] @@ -17,10 +17,16 @@ pub struct LimitedUser { #[serde(rename = "bioLinks", skip_serializing_if = "Option::is_none")] pub bio_links: Option>, /// When profilePicOverride is not empty, use it instead. - #[serde(rename = "currentAvatarImageUrl", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "currentAvatarImageUrl", + skip_serializing_if = "Option::is_none" + )] pub current_avatar_image_url: Option, /// When profilePicOverride is not empty, use it instead. - #[serde(rename = "currentAvatarThumbnailImageUrl", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "currentAvatarThumbnailImageUrl", + skip_serializing_if = "Option::is_none" + )] pub current_avatar_thumbnail_image_url: Option, #[serde(rename = "currentAvatarTags", skip_serializing_if = "Option::is_none")] pub current_avatar_tags: Option>, @@ -61,7 +67,16 @@ pub struct LimitedUser { } impl LimitedUser { - pub fn new(developer_type: models::DeveloperType, display_name: String, id: String, is_friend: bool, last_platform: String, status: models::UserStatus, status_description: String, tags: Vec) -> LimitedUser { + pub fn new( + developer_type: models::DeveloperType, + display_name: String, + id: String, + is_friend: bool, + last_platform: String, + status: models::UserStatus, + status_description: String, + tags: Vec, + ) -> LimitedUser { LimitedUser { bio: None, bio_links: None, @@ -86,4 +101,3 @@ impl LimitedUser { } } } - diff --git a/src/models/limited_user_groups.rs b/src/models/limited_user_groups.rs index df37168..e1f9a90 100644 --- a/src/models/limited_user_groups.rs +++ b/src/models/limited_user_groups.rs @@ -21,17 +21,42 @@ pub struct LimitedUserGroups { pub discriminator: Option, #[serde(rename = "description", skip_serializing_if = "Option::is_none")] pub description: Option, - #[serde(rename = "iconId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "iconId", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub icon_id: Option>, - #[serde(rename = "iconUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "iconUrl", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub icon_url: Option>, - #[serde(rename = "bannerId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "bannerId", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub banner_id: Option>, - #[serde(rename = "bannerUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "bannerUrl", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub banner_url: Option>, #[serde(rename = "privacy", skip_serializing_if = "Option::is_none")] pub privacy: Option, - #[serde(rename = "lastPostCreatedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "lastPostCreatedAt", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub last_post_created_at: Option>, /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. #[serde(rename = "ownerId", skip_serializing_if = "Option::is_none")] @@ -46,7 +71,12 @@ pub struct LimitedUserGroups { pub is_representing: Option, #[serde(rename = "mutualGroup", skip_serializing_if = "Option::is_none")] pub mutual_group: Option, - #[serde(rename = "lastPostReadAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "lastPostReadAt", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub last_post_read_at: Option>, } @@ -74,4 +104,3 @@ impl LimitedUserGroups { } } } - diff --git a/src/models/limited_world.rs b/src/models/limited_world.rs index de89bac..42ddf14 100644 --- a/src/models/limited_world.rs +++ b/src/models/limited_world.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// LimitedWorld : +/// LimitedWorld : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct LimitedWorld { /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. @@ -19,7 +19,10 @@ pub struct LimitedWorld { pub author_name: String, #[serde(rename = "capacity")] pub capacity: i32, - #[serde(rename = "recommendedCapacity", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "recommendedCapacity", + skip_serializing_if = "Option::is_none" + )] pub recommended_capacity: Option, #[serde(rename = "created_at")] pub created_at: String, @@ -44,7 +47,12 @@ pub struct LimitedWorld { pub organization: String, #[serde(rename = "popularity")] pub popularity: i32, - #[serde(rename = "previewYoutubeId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "previewYoutubeId", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub preview_youtube_id: Option>, #[serde(rename = "publicationDate")] pub publication_date: String, @@ -63,7 +71,27 @@ pub struct LimitedWorld { } impl LimitedWorld { - pub fn new(author_id: String, author_name: String, capacity: i32, created_at: String, favorites: i32, heat: i32, id: String, image_url: String, labs_publication_date: String, name: String, occupants: i32, organization: String, popularity: i32, publication_date: String, release_status: models::ReleaseStatus, tags: Vec, thumbnail_image_url: String, unity_packages: Vec, updated_at: String) -> LimitedWorld { + pub fn new( + author_id: String, + author_name: String, + capacity: i32, + created_at: String, + favorites: i32, + heat: i32, + id: String, + image_url: String, + labs_publication_date: String, + name: String, + occupants: i32, + organization: String, + popularity: i32, + publication_date: String, + release_status: models::ReleaseStatus, + tags: Vec, + thumbnail_image_url: String, + unity_packages: Vec, + updated_at: String, + ) -> LimitedWorld { LimitedWorld { author_id, author_name, @@ -91,4 +119,3 @@ impl LimitedWorld { } } } - diff --git a/src/models/mime_type.rs b/src/models/mime_type.rs index 537cacf..5d40575 100644 --- a/src/models/mime_type.rs +++ b/src/models/mime_type.rs @@ -39,7 +39,6 @@ pub enum MimeType { ApplicationSlashXRsyncDelta, #[serde(rename = "application/octet-stream")] ApplicationSlashOctetStream, - } impl std::fmt::Display for MimeType { @@ -68,4 +67,3 @@ impl Default for MimeType { Self::ImageSlashJpeg } } - diff --git a/src/models/mod.rs b/src/models/mod.rs index 7a6c28e..65d5f05 100644 --- a/src/models/mod.rs +++ b/src/models/mod.rs @@ -45,7 +45,7 @@ pub use self::create_instance_request::CreateInstanceRequest; pub mod create_world_request; pub use self::create_world_request::CreateWorldRequest; pub mod current_user; -pub use self::current_user::{EitherUserOrTwoFactor, CurrentUser}; +pub use self::current_user::CurrentUser; pub mod current_user_presence; pub use self::current_user_presence::CurrentUserPresence; pub mod deployment_group; @@ -80,6 +80,8 @@ pub mod finish_file_data_upload_request; pub use self::finish_file_data_upload_request::FinishFileDataUploadRequest; pub mod friend_status; pub use self::friend_status::FriendStatus; +pub mod get_current_user_200_response; +pub use self::get_current_user_200_response::GetCurrentUser200Response; pub mod group; pub use self::group::Group; pub mod group_access_type; @@ -236,6 +238,8 @@ pub mod two_factor_auth_code; pub use self::two_factor_auth_code::TwoFactorAuthCode; pub mod two_factor_email_code; pub use self::two_factor_email_code::TwoFactorEmailCode; +pub mod two_factor_required; +pub use self::two_factor_required::TwoFactorRequired; pub mod unity_package; pub use self::unity_package::UnityPackage; pub mod update_avatar_request; diff --git a/src/models/moderate_user_request.rs b/src/models/moderate_user_request.rs index 298a5fd..90afe6c 100644 --- a/src/models/moderate_user_request.rs +++ b/src/models/moderate_user_request.rs @@ -20,10 +20,6 @@ pub struct ModerateUserRequest { impl ModerateUserRequest { pub fn new(moderated: String, r#type: models::PlayerModerationType) -> ModerateUserRequest { - ModerateUserRequest { - moderated, - r#type, - } + ModerateUserRequest { moderated, r#type } } } - diff --git a/src/models/notification.rs b/src/models/notification.rs index 064d8b0..8246eee 100644 --- a/src/models/notification.rs +++ b/src/models/notification.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// Notification : +/// Notification : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Notification { #[serde(rename = "created_at")] @@ -38,7 +38,14 @@ pub struct Notification { } impl Notification { - pub fn new(created_at: String, details: String, id: String, message: String, sender_user_id: String, r#type: models::NotificationType) -> Notification { + pub fn new( + created_at: String, + details: String, + id: String, + message: String, + sender_user_id: String, + r#type: models::NotificationType, + ) -> Notification { Notification { created_at, details, @@ -52,4 +59,3 @@ impl Notification { } } } - diff --git a/src/models/notification_detail_invite.rs b/src/models/notification_detail_invite.rs index b4b6445..970ebb2 100644 --- a/src/models/notification_detail_invite.rs +++ b/src/models/notification_detail_invite.rs @@ -29,4 +29,3 @@ impl NotificationDetailInvite { } } } - diff --git a/src/models/notification_detail_invite_response.rs b/src/models/notification_detail_invite_response.rs index f231bcd..783aff9 100644 --- a/src/models/notification_detail_invite_response.rs +++ b/src/models/notification_detail_invite_response.rs @@ -18,11 +18,13 @@ pub struct NotificationDetailInviteResponse { } impl NotificationDetailInviteResponse { - pub fn new(in_response_to: String, response_message: String) -> NotificationDetailInviteResponse { + pub fn new( + in_response_to: String, + response_message: String, + ) -> NotificationDetailInviteResponse { NotificationDetailInviteResponse { in_response_to, response_message, } } } - diff --git a/src/models/notification_detail_request_invite.rs b/src/models/notification_detail_request_invite.rs index 0c36c63..9729470 100644 --- a/src/models/notification_detail_request_invite.rs +++ b/src/models/notification_detail_request_invite.rs @@ -27,4 +27,3 @@ impl NotificationDetailRequestInvite { } } } - diff --git a/src/models/notification_detail_request_invite_response.rs b/src/models/notification_detail_request_invite_response.rs index d8c90bb..36e99b6 100644 --- a/src/models/notification_detail_request_invite_response.rs +++ b/src/models/notification_detail_request_invite_response.rs @@ -26,4 +26,3 @@ impl NotificationDetailRequestInviteResponse { } } } - diff --git a/src/models/notification_detail_vote_to_kick.rs b/src/models/notification_detail_vote_to_kick.rs index 7352345..f417254 100644 --- a/src/models/notification_detail_vote_to_kick.rs +++ b/src/models/notification_detail_vote_to_kick.rs @@ -27,4 +27,3 @@ impl NotificationDetailVoteToKick { } } } - diff --git a/src/models/notification_type.rs b/src/models/notification_type.rs index e5decf8..af39a7e 100644 --- a/src/models/notification_type.rs +++ b/src/models/notification_type.rs @@ -25,7 +25,6 @@ pub enum NotificationType { RequestInviteResponse, #[serde(rename = "votetokick")] Votetokick, - } impl std::fmt::Display for NotificationType { @@ -47,4 +46,3 @@ impl Default for NotificationType { Self::FriendRequest } } - diff --git a/src/models/order_option.rs b/src/models/order_option.rs index e0edb6d..7ea5c5c 100644 --- a/src/models/order_option.rs +++ b/src/models/order_option.rs @@ -15,7 +15,6 @@ pub enum OrderOption { Ascending, #[serde(rename = "descending")] Descending, - } impl std::fmt::Display for OrderOption { @@ -32,4 +31,3 @@ impl Default for OrderOption { Self::Ascending } } - diff --git a/src/models/paginated_group_audit_log_entry_list.rs b/src/models/paginated_group_audit_log_entry_list.rs index c801d35..43bd343 100644 --- a/src/models/paginated_group_audit_log_entry_list.rs +++ b/src/models/paginated_group_audit_log_entry_list.rs @@ -30,4 +30,3 @@ impl PaginatedGroupAuditLogEntryList { } } } - diff --git a/src/models/past_display_name.rs b/src/models/past_display_name.rs index 62bdf29..f9e7340 100644 --- a/src/models/past_display_name.rs +++ b/src/models/past_display_name.rs @@ -25,4 +25,3 @@ impl PastDisplayName { } } } - diff --git a/src/models/permission.rs b/src/models/permission.rs index e37afd2..83e8855 100644 --- a/src/models/permission.rs +++ b/src/models/permission.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// Permission : +/// Permission : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Permission { #[serde(rename = "id")] @@ -26,7 +26,12 @@ pub struct Permission { } impl Permission { - pub fn new(id: String, owner_display_name: String, name: String, owner_id: String) -> Permission { + pub fn new( + id: String, + owner_display_name: String, + name: String, + owner_id: String, + ) -> Permission { Permission { id, owner_display_name, @@ -36,4 +41,3 @@ impl Permission { } } } - diff --git a/src/models/player_moderation.rs b/src/models/player_moderation.rs index 1b2082e..377cd26 100644 --- a/src/models/player_moderation.rs +++ b/src/models/player_moderation.rs @@ -30,7 +30,15 @@ pub struct PlayerModeration { } impl PlayerModeration { - pub fn new(created: String, id: String, source_display_name: String, source_user_id: String, target_display_name: String, target_user_id: String, r#type: models::PlayerModerationType) -> PlayerModeration { + pub fn new( + created: String, + id: String, + source_display_name: String, + source_user_id: String, + target_display_name: String, + target_user_id: String, + r#type: models::PlayerModerationType, + ) -> PlayerModeration { PlayerModeration { created, id, @@ -42,4 +50,3 @@ impl PlayerModeration { } } } - diff --git a/src/models/player_moderation_type.rs b/src/models/player_moderation_type.rs index d9cfcff..996d02e 100644 --- a/src/models/player_moderation_type.rs +++ b/src/models/player_moderation_type.rs @@ -23,7 +23,6 @@ pub enum PlayerModerationType { InteractOn, #[serde(rename = "interactOff")] InteractOff, - } impl std::fmt::Display for PlayerModerationType { @@ -44,4 +43,3 @@ impl Default for PlayerModerationType { Self::Mute } } - diff --git a/src/models/region.rs b/src/models/region.rs index 25c132f..f25ed76 100644 --- a/src/models/region.rs +++ b/src/models/region.rs @@ -25,7 +25,6 @@ pub enum Region { Jp, #[serde(rename = "unknown")] Unknown, - } impl std::fmt::Display for Region { @@ -46,4 +45,3 @@ impl Default for Region { Self::Us } } - diff --git a/src/models/release_status.rs b/src/models/release_status.rs index 661b25e..ab27aa6 100644 --- a/src/models/release_status.rs +++ b/src/models/release_status.rs @@ -19,7 +19,6 @@ pub enum ReleaseStatus { Hidden, #[serde(rename = "all")] All, - } impl std::fmt::Display for ReleaseStatus { @@ -38,4 +37,3 @@ impl Default for ReleaseStatus { Self::Public } } - diff --git a/src/models/represented_group.rs b/src/models/represented_group.rs index 01ccd45..0b345f8 100644 --- a/src/models/represented_group.rs +++ b/src/models/represented_group.rs @@ -19,13 +19,33 @@ pub struct RepresentedGroup { pub discriminator: Option, #[serde(rename = "description", skip_serializing_if = "Option::is_none")] pub description: Option, - #[serde(rename = "iconId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "iconId", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub icon_id: Option>, - #[serde(rename = "iconUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "iconUrl", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub icon_url: Option>, - #[serde(rename = "bannerId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "bannerId", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub banner_id: Option>, - #[serde(rename = "bannerUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "bannerUrl", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub banner_url: Option>, #[serde(rename = "privacy", skip_serializing_if = "Option::is_none")] pub privacy: Option, @@ -62,4 +82,3 @@ impl RepresentedGroup { } } } - diff --git a/src/models/request_invite_request.rs b/src/models/request_invite_request.rs index c52de69..330a7f9 100644 --- a/src/models/request_invite_request.rs +++ b/src/models/request_invite_request.rs @@ -17,9 +17,6 @@ pub struct RequestInviteRequest { impl RequestInviteRequest { pub fn new() -> RequestInviteRequest { - RequestInviteRequest { - message_slot: None, - } + RequestInviteRequest { message_slot: None } } } - diff --git a/src/models/respond_group_join_request.rs b/src/models/respond_group_join_request.rs index bed29c9..094900c 100644 --- a/src/models/respond_group_join_request.rs +++ b/src/models/respond_group_join_request.rs @@ -26,4 +26,3 @@ impl RespondGroupJoinRequest { } } } - diff --git a/src/models/response.rs b/src/models/response.rs index 7d72400..7e8fdab 100644 --- a/src/models/response.rs +++ b/src/models/response.rs @@ -25,4 +25,3 @@ impl Response { } } } - diff --git a/src/models/sent_notification.rs b/src/models/sent_notification.rs index 07ba5ac..878bd3b 100644 --- a/src/models/sent_notification.rs +++ b/src/models/sent_notification.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// SentNotification : +/// SentNotification : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct SentNotification { #[serde(rename = "created_at")] @@ -34,7 +34,15 @@ pub struct SentNotification { } impl SentNotification { - pub fn new(created_at: String, details: serde_json::Value, id: String, message: String, receiver_user_id: String, sender_user_id: String, r#type: models::NotificationType) -> SentNotification { + pub fn new( + created_at: String, + details: serde_json::Value, + id: String, + message: String, + receiver_user_id: String, + sender_user_id: String, + r#type: models::NotificationType, + ) -> SentNotification { SentNotification { created_at, details, @@ -47,4 +55,3 @@ impl SentNotification { } } } - diff --git a/src/models/sort_option.rs b/src/models/sort_option.rs index 7d4f786..74d99e9 100644 --- a/src/models/sort_option.rs +++ b/src/models/sort_option.rs @@ -47,7 +47,6 @@ pub enum SortOption { Magic, #[serde(rename = "name")] Name, - } impl std::fmt::Display for SortOption { @@ -80,4 +79,3 @@ impl Default for SortOption { Self::Popularity } } - diff --git a/src/models/subscription.rs b/src/models/subscription.rs index aba7cc0..28684e2 100644 --- a/src/models/subscription.rs +++ b/src/models/subscription.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// Subscription : +/// Subscription : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Subscription { #[serde(rename = "id")] @@ -35,7 +35,14 @@ pub struct Subscription { } impl Subscription { - pub fn new(id: String, steam_item_id: String, amount: f64, description: String, period: models::SubscriptionPeriod, tier: f64) -> Subscription { + pub fn new( + id: String, + steam_item_id: String, + amount: f64, + description: String, + period: models::SubscriptionPeriod, + tier: f64, + ) -> Subscription { Subscription { id, steam_item_id, @@ -50,4 +57,3 @@ impl Subscription { } } } - diff --git a/src/models/subscription_period.rs b/src/models/subscription_period.rs index 386e44a..dd90a35 100644 --- a/src/models/subscription_period.rs +++ b/src/models/subscription_period.rs @@ -21,7 +21,6 @@ pub enum SubscriptionPeriod { Month, #[serde(rename = "year")] Year, - } impl std::fmt::Display for SubscriptionPeriod { @@ -41,4 +40,3 @@ impl Default for SubscriptionPeriod { Self::Hour } } - diff --git a/src/models/success.rs b/src/models/success.rs index 4e52df7..96d2091 100644 --- a/src/models/success.rs +++ b/src/models/success.rs @@ -12,14 +12,11 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Success { #[serde(rename = "success", skip_serializing_if = "Option::is_none")] - pub success: Option>, + pub success: Option, } impl Success { pub fn new() -> Success { - Success { - success: None, - } + Success { success: None } } } - diff --git a/src/models/transaction.rs b/src/models/transaction.rs index 8ea976e..53cb21b 100644 --- a/src/models/transaction.rs +++ b/src/models/transaction.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// Transaction : +/// Transaction : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Transaction { #[serde(rename = "id")] @@ -22,7 +22,7 @@ pub struct Transaction { #[serde(rename = "status")] pub status: models::TransactionStatus, #[serde(rename = "subscription")] - pub subscription: Box, + pub subscription: models::Subscription, #[serde(rename = "sandbox")] pub sandbox: bool, #[serde(rename = "created_at")] @@ -30,9 +30,9 @@ pub struct Transaction { #[serde(rename = "updated_at")] pub updated_at: String, #[serde(rename = "steam", skip_serializing_if = "Option::is_none")] - pub steam: Option>, + pub steam: Option, #[serde(rename = "agreement", skip_serializing_if = "Option::is_none")] - pub agreement: Option>, + pub agreement: Option, #[serde(rename = "error")] pub error: String, #[serde(rename = "isGift", skip_serializing_if = "Option::is_none")] @@ -42,13 +42,21 @@ pub struct Transaction { } impl Transaction { - pub fn new(id: String, status: models::TransactionStatus, subscription: models::Subscription, sandbox: bool, created_at: String, updated_at: String, error: String) -> Transaction { + pub fn new( + id: String, + status: models::TransactionStatus, + subscription: models::Subscription, + sandbox: bool, + created_at: String, + updated_at: String, + error: String, + ) -> Transaction { Transaction { id, user_id: None, user_display_name: None, status, - subscription: Box::new(subscription), + subscription, sandbox, created_at, updated_at, @@ -60,4 +68,3 @@ impl Transaction { } } } - diff --git a/src/models/transaction_agreement.rs b/src/models/transaction_agreement.rs index cfb4b46..c09cdd5 100644 --- a/src/models/transaction_agreement.rs +++ b/src/models/transaction_agreement.rs @@ -53,7 +53,26 @@ pub struct TransactionAgreement { impl TransactionAgreement { /// Represents a single Transaction, which is likely between VRChat and Steam. - pub fn new(agreement_id: String, item_id: f64, agreement: String, status: String, period: String, frequency: f64, billing_type: String, start_date: String, end_date: String, recurring_amt: f64, currency: String, time_created: String, next_payment: String, last_payment: String, last_amount: f64, last_amount_vat: f64, outstanding: f64, failed_attempts: f64) -> TransactionAgreement { + pub fn new( + agreement_id: String, + item_id: f64, + agreement: String, + status: String, + period: String, + frequency: f64, + billing_type: String, + start_date: String, + end_date: String, + recurring_amt: f64, + currency: String, + time_created: String, + next_payment: String, + last_payment: String, + last_amount: f64, + last_amount_vat: f64, + outstanding: f64, + failed_attempts: f64, + ) -> TransactionAgreement { TransactionAgreement { agreement_id, item_id, @@ -76,4 +95,3 @@ impl TransactionAgreement { } } } - diff --git a/src/models/transaction_status.rs b/src/models/transaction_status.rs index 18e6942..0dc71eb 100644 --- a/src/models/transaction_status.rs +++ b/src/models/transaction_status.rs @@ -19,7 +19,6 @@ pub enum TransactionStatus { Expired, #[serde(rename = "chargeback")] Chargeback, - } impl std::fmt::Display for TransactionStatus { @@ -38,4 +37,3 @@ impl Default for TransactionStatus { Self::Active } } - diff --git a/src/models/transaction_steam_info.rs b/src/models/transaction_steam_info.rs index 8ef17cd..05f9a15 100644 --- a/src/models/transaction_steam_info.rs +++ b/src/models/transaction_steam_info.rs @@ -9,11 +9,11 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// TransactionSteamInfo : +/// TransactionSteamInfo : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct TransactionSteamInfo { #[serde(rename = "walletInfo")] - pub wallet_info: Box, + pub wallet_info: models::TransactionSteamWalletInfo, /// Steam User ID #[serde(rename = "steamId")] pub steam_id: String, @@ -29,9 +29,15 @@ pub struct TransactionSteamInfo { } impl TransactionSteamInfo { - pub fn new(wallet_info: models::TransactionSteamWalletInfo, steam_id: String, order_id: String, steam_url: String, trans_id: String) -> TransactionSteamInfo { + pub fn new( + wallet_info: models::TransactionSteamWalletInfo, + steam_id: String, + order_id: String, + steam_url: String, + trans_id: String, + ) -> TransactionSteamInfo { TransactionSteamInfo { - wallet_info: Box::new(wallet_info), + wallet_info, steam_id, order_id, steam_url, @@ -39,4 +45,3 @@ impl TransactionSteamInfo { } } } - diff --git a/src/models/transaction_steam_wallet_info.rs b/src/models/transaction_steam_wallet_info.rs index 5234d06..7025960 100644 --- a/src/models/transaction_steam_wallet_info.rs +++ b/src/models/transaction_steam_wallet_info.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// TransactionSteamWalletInfo : +/// TransactionSteamWalletInfo : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct TransactionSteamWalletInfo { #[serde(rename = "state")] @@ -23,7 +23,12 @@ pub struct TransactionSteamWalletInfo { } impl TransactionSteamWalletInfo { - pub fn new(state: String, country: String, currency: String, status: String) -> TransactionSteamWalletInfo { + pub fn new( + state: String, + country: String, + currency: String, + status: String, + ) -> TransactionSteamWalletInfo { TransactionSteamWalletInfo { state, country, @@ -32,4 +37,3 @@ impl TransactionSteamWalletInfo { } } } - diff --git a/src/models/two_factor_auth_code.rs b/src/models/two_factor_auth_code.rs index 0c1aa3a..b44d0ac 100644 --- a/src/models/two_factor_auth_code.rs +++ b/src/models/two_factor_auth_code.rs @@ -17,9 +17,6 @@ pub struct TwoFactorAuthCode { impl TwoFactorAuthCode { pub fn new(code: String) -> TwoFactorAuthCode { - TwoFactorAuthCode { - code, - } + TwoFactorAuthCode { code } } } - diff --git a/src/models/two_factor_email_code.rs b/src/models/two_factor_email_code.rs index 6c35ef0..9c20b96 100644 --- a/src/models/two_factor_email_code.rs +++ b/src/models/two_factor_email_code.rs @@ -17,9 +17,6 @@ pub struct TwoFactorEmailCode { impl TwoFactorEmailCode { pub fn new(code: String) -> TwoFactorEmailCode { - TwoFactorEmailCode { - code, - } + TwoFactorEmailCode { code } } } - diff --git a/src/models/two_factor_required.rs b/src/models/two_factor_required.rs new file mode 100644 index 0000000..e5e6dce --- /dev/null +++ b/src/models/two_factor_required.rs @@ -0,0 +1,39 @@ +/* + * VRChat API Documentation + * + * + * Contact: vrchatapi.lpv0t@aries.fyi + * Generated by: https://openapi-generator.tech + */ + +use crate::models; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] +pub struct TwoFactorRequired { + #[serde(rename = "requiresTwoFactorAuth")] + pub requires_two_factor_auth: Vec, +} + +impl TwoFactorRequired { + pub fn new(requires_two_factor_auth: Vec) -> TwoFactorRequired { + TwoFactorRequired { + requires_two_factor_auth, + } + } +} +#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] +pub enum RequiresTwoFactorAuth { + #[serde(rename = "totp")] + Totp, + #[serde(rename = "otp")] + Otp, + #[serde(rename = "emailOtp")] + EmailOtp, +} + +impl Default for RequiresTwoFactorAuth { + fn default() -> RequiresTwoFactorAuth { + Self::Totp + } +} diff --git a/src/models/unity_package.rs b/src/models/unity_package.rs index 2d2f5d2..1dad163 100644 --- a/src/models/unity_package.rs +++ b/src/models/unity_package.rs @@ -9,12 +9,17 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// UnityPackage : +/// UnityPackage : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UnityPackage { #[serde(rename = "id")] pub id: String, - #[serde(rename = "assetUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "assetUrl", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub asset_url: Option>, #[serde(rename = "assetUrlObject", skip_serializing_if = "Option::is_none")] pub asset_url_object: Option, @@ -33,7 +38,12 @@ pub struct UnityPackage { pub unity_sort_number: Option, #[serde(rename = "unityVersion")] pub unity_version: String, - #[serde(rename = "impostorUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "impostorUrl", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub impostor_url: Option>, #[serde(rename = "scanStatus", skip_serializing_if = "Option::is_none")] pub scan_status: Option, @@ -42,7 +52,12 @@ pub struct UnityPackage { } impl UnityPackage { - pub fn new(id: String, asset_version: i32, platform: String, unity_version: String) -> UnityPackage { + pub fn new( + id: String, + asset_version: i32, + platform: String, + unity_version: String, + ) -> UnityPackage { UnityPackage { id, asset_url: None, @@ -60,4 +75,3 @@ impl UnityPackage { } } } - diff --git a/src/models/update_avatar_request.rs b/src/models/update_avatar_request.rs index e0e6aac..4de3ba5 100644 --- a/src/models/update_avatar_request.rs +++ b/src/models/update_avatar_request.rs @@ -49,4 +49,3 @@ impl UpdateAvatarRequest { } } } - diff --git a/src/models/update_favorite_group_request.rs b/src/models/update_favorite_group_request.rs index 12ff3e0..c0cb54c 100644 --- a/src/models/update_favorite_group_request.rs +++ b/src/models/update_favorite_group_request.rs @@ -29,4 +29,3 @@ impl UpdateFavoriteGroupRequest { } } } - diff --git a/src/models/update_group_gallery_request.rs b/src/models/update_group_gallery_request.rs index 946b454..1f950c2 100644 --- a/src/models/update_group_gallery_request.rs +++ b/src/models/update_group_gallery_request.rs @@ -20,13 +20,33 @@ pub struct UpdateGroupGalleryRequest { /// Whether the gallery is members only. #[serde(rename = "membersOnly", skip_serializing_if = "Option::is_none")] pub members_only: Option, - #[serde(rename = "roleIdsToView", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "roleIdsToView", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub role_ids_to_view: Option>>, - #[serde(rename = "roleIdsToSubmit", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "roleIdsToSubmit", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub role_ids_to_submit: Option>>, - #[serde(rename = "roleIdsToAutoApprove", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "roleIdsToAutoApprove", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub role_ids_to_auto_approve: Option>>, - #[serde(rename = "roleIdsToManage", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "roleIdsToManage", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub role_ids_to_manage: Option>>, } @@ -43,4 +63,3 @@ impl UpdateGroupGalleryRequest { } } } - diff --git a/src/models/update_group_member_request.rs b/src/models/update_group_member_request.rs index ac65ede..1636970 100644 --- a/src/models/update_group_member_request.rs +++ b/src/models/update_group_member_request.rs @@ -13,7 +13,10 @@ use serde::{Deserialize, Serialize}; pub struct UpdateGroupMemberRequest { #[serde(rename = "visibility", skip_serializing_if = "Option::is_none")] pub visibility: Option, - #[serde(rename = "isSubscribedToAnnouncements", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "isSubscribedToAnnouncements", + skip_serializing_if = "Option::is_none" + )] pub is_subscribed_to_announcements: Option, #[serde(rename = "managerNotes", skip_serializing_if = "Option::is_none")] pub manager_notes: Option, @@ -28,4 +31,3 @@ impl UpdateGroupMemberRequest { } } } - diff --git a/src/models/update_group_request.rs b/src/models/update_group_request.rs index 7abe9a4..5faabe2 100644 --- a/src/models/update_group_request.rs +++ b/src/models/update_group_request.rs @@ -19,9 +19,19 @@ pub struct UpdateGroupRequest { pub description: Option, #[serde(rename = "joinState", skip_serializing_if = "Option::is_none")] pub join_state: Option, - #[serde(rename = "iconId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "iconId", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub icon_id: Option>, - #[serde(rename = "bannerId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "bannerId", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub banner_id: Option>, /// 3 letter language code #[serde(rename = "languages", skip_serializing_if = "Option::is_none")] @@ -50,4 +60,3 @@ impl UpdateGroupRequest { } } } - diff --git a/src/models/update_group_role_request.rs b/src/models/update_group_role_request.rs index e6e0d3f..4d08eed 100644 --- a/src/models/update_group_role_request.rs +++ b/src/models/update_group_role_request.rs @@ -34,4 +34,3 @@ impl UpdateGroupRoleRequest { } } } - diff --git a/src/models/update_invite_message_request.rs b/src/models/update_invite_message_request.rs index 3fed8c6..6bc2d8a 100644 --- a/src/models/update_invite_message_request.rs +++ b/src/models/update_invite_message_request.rs @@ -17,9 +17,6 @@ pub struct UpdateInviteMessageRequest { impl UpdateInviteMessageRequest { pub fn new(message: String) -> UpdateInviteMessageRequest { - UpdateInviteMessageRequest { - message, - } + UpdateInviteMessageRequest { message } } } - diff --git a/src/models/update_user_request.rs b/src/models/update_user_request.rs index d0c3d8b..5f85e3c 100644 --- a/src/models/update_user_request.rs +++ b/src/models/update_user_request.rs @@ -53,4 +53,3 @@ impl UpdateUserRequest { } } } - diff --git a/src/models/update_world_request.rs b/src/models/update_world_request.rs index d20c350..5ed6683 100644 --- a/src/models/update_world_request.rs +++ b/src/models/update_world_request.rs @@ -60,4 +60,3 @@ impl UpdateWorldRequest { } } } - diff --git a/src/models/user.rs b/src/models/user.rs index d679ada..f37e465 100644 --- a/src/models/user.rs +++ b/src/models/user.rs @@ -36,7 +36,10 @@ pub struct User { pub display_name: String, #[serde(rename = "friendKey")] pub friend_key: String, - #[serde(rename = "friendRequestStatus", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "friendRequestStatus", + skip_serializing_if = "Option::is_none" + )] pub friend_request_status: Option, /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. #[serde(rename = "id")] @@ -77,9 +80,15 @@ pub struct User { pub status_description: String, #[serde(rename = "tags")] pub tags: Vec, - #[serde(rename = "travelingToInstance", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "travelingToInstance", + skip_serializing_if = "Option::is_none" + )] pub traveling_to_instance: Option, - #[serde(rename = "travelingToLocation", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "travelingToLocation", + skip_serializing_if = "Option::is_none" + )] pub traveling_to_location: Option, #[serde(rename = "travelingToWorld", skip_serializing_if = "Option::is_none")] pub traveling_to_world: Option, @@ -94,7 +103,32 @@ pub struct User { } impl User { - pub fn new(allow_avatar_copying: bool, bio: String, bio_links: Vec, current_avatar_image_url: String, current_avatar_thumbnail_image_url: String, current_avatar_tags: Vec, date_joined: String, developer_type: models::DeveloperType, display_name: String, friend_key: String, id: String, is_friend: bool, last_activity: String, last_login: String, last_platform: String, platform: String, profile_pic_override: String, profile_pic_override_thumbnail: String, pronouns: String, state: models::UserState, status: models::UserStatus, status_description: String, tags: Vec, user_icon: String) -> User { + pub fn new( + allow_avatar_copying: bool, + bio: String, + bio_links: Vec, + current_avatar_image_url: String, + current_avatar_thumbnail_image_url: String, + current_avatar_tags: Vec, + date_joined: String, + developer_type: models::DeveloperType, + display_name: String, + friend_key: String, + id: String, + is_friend: bool, + last_activity: String, + last_login: String, + last_platform: String, + platform: String, + profile_pic_override: String, + profile_pic_override_thumbnail: String, + pronouns: String, + state: models::UserState, + status: models::UserStatus, + status_description: String, + tags: Vec, + user_icon: String, + ) -> User { User { allow_avatar_copying, badges: None, @@ -133,4 +167,3 @@ impl User { } } } - diff --git a/src/models/user_exists.rs b/src/models/user_exists.rs index b1675a9..89480e8 100644 --- a/src/models/user_exists.rs +++ b/src/models/user_exists.rs @@ -20,9 +20,6 @@ pub struct UserExists { impl UserExists { /// Status object representing if a queried user by username or userId exists or not. This model is primarily used by the `/auth/exists` endpoint, which in turn is used during registration. Please see the documentation on that endpoint for more information on usage. pub fn new(user_exists: bool) -> UserExists { - UserExists { - user_exists, - } + UserExists { user_exists } } } - diff --git a/src/models/user_state.rs b/src/models/user_state.rs index 334e774..a683c96 100644 --- a/src/models/user_state.rs +++ b/src/models/user_state.rs @@ -19,7 +19,6 @@ pub enum UserState { Active, #[serde(rename = "online")] Online, - } impl std::fmt::Display for UserState { @@ -37,4 +36,3 @@ impl Default for UserState { Self::Offline } } - diff --git a/src/models/user_status.rs b/src/models/user_status.rs index acdec06..966cdf8 100644 --- a/src/models/user_status.rs +++ b/src/models/user_status.rs @@ -23,7 +23,6 @@ pub enum UserStatus { Busy, #[serde(rename = "offline")] Offline, - } impl std::fmt::Display for UserStatus { @@ -43,4 +42,3 @@ impl Default for UserStatus { Self::Active } } - diff --git a/src/models/user_subscription.rs b/src/models/user_subscription.rs index 6c8fa42..65ca94b 100644 --- a/src/models/user_subscription.rs +++ b/src/models/user_subscription.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// UserSubscription : +/// UserSubscription : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UserSubscription { #[serde(rename = "id")] @@ -48,7 +48,22 @@ pub struct UserSubscription { } impl UserSubscription { - pub fn new(id: String, transaction_id: String, store: String, amount: f64, description: String, period: models::SubscriptionPeriod, tier: f64, active: bool, status: models::TransactionStatus, expires: String, created_at: String, updated_at: String, license_groups: Vec, is_gift: bool) -> UserSubscription { + pub fn new( + id: String, + transaction_id: String, + store: String, + amount: f64, + description: String, + period: models::SubscriptionPeriod, + tier: f64, + active: bool, + status: models::TransactionStatus, + expires: String, + created_at: String, + updated_at: String, + license_groups: Vec, + is_gift: bool, + ) -> UserSubscription { UserSubscription { id, transaction_id, @@ -69,4 +84,3 @@ impl UserSubscription { } } } - diff --git a/src/models/verify2_fa_email_code_result.rs b/src/models/verify2_fa_email_code_result.rs index da6e29e..1ac94ab 100644 --- a/src/models/verify2_fa_email_code_result.rs +++ b/src/models/verify2_fa_email_code_result.rs @@ -17,9 +17,6 @@ pub struct Verify2FaEmailCodeResult { impl Verify2FaEmailCodeResult { pub fn new(verified: bool) -> Verify2FaEmailCodeResult { - Verify2FaEmailCodeResult { - verified, - } + Verify2FaEmailCodeResult { verified } } } - diff --git a/src/models/verify2_fa_result.rs b/src/models/verify2_fa_result.rs index bc22e5c..511cbc1 100644 --- a/src/models/verify2_fa_result.rs +++ b/src/models/verify2_fa_result.rs @@ -17,9 +17,6 @@ pub struct Verify2FaResult { impl Verify2FaResult { pub fn new(verified: bool) -> Verify2FaResult { - Verify2FaResult { - verified, - } + Verify2FaResult { verified } } } - diff --git a/src/models/verify_auth_token_result.rs b/src/models/verify_auth_token_result.rs index 1e5f491..7e942b4 100644 --- a/src/models/verify_auth_token_result.rs +++ b/src/models/verify_auth_token_result.rs @@ -19,10 +19,6 @@ pub struct VerifyAuthTokenResult { impl VerifyAuthTokenResult { pub fn new(ok: bool, token: String) -> VerifyAuthTokenResult { - VerifyAuthTokenResult { - ok, - token, - } + VerifyAuthTokenResult { ok, token } } } - diff --git a/src/models/world.rs b/src/models/world.rs index 733e3b8..424e2ba 100644 --- a/src/models/world.rs +++ b/src/models/world.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// World : +/// World : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct World { /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. @@ -52,7 +52,12 @@ pub struct World { pub organization: String, #[serde(rename = "popularity")] pub popularity: i32, - #[serde(rename = "previewYoutubeId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] + #[serde( + rename = "previewYoutubeId", + default, + with = "::serde_with::rust::double_option", + skip_serializing_if = "Option::is_none" + )] pub preview_youtube_id: Option>, /// Will always be `0` when unauthenticated. #[serde(rename = "privateOccupants", skip_serializing_if = "Option::is_none")] @@ -82,7 +87,29 @@ pub struct World { } impl World { - pub fn new(author_id: String, author_name: String, capacity: i32, recommended_capacity: i32, created_at: String, description: String, featured: bool, heat: i32, id: String, image_url: String, labs_publication_date: String, name: String, organization: String, popularity: i32, publication_date: String, release_status: models::ReleaseStatus, tags: Vec, thumbnail_image_url: String, updated_at: String, version: i32, visits: i32) -> World { + pub fn new( + author_id: String, + author_name: String, + capacity: i32, + recommended_capacity: i32, + created_at: String, + description: String, + featured: bool, + heat: i32, + id: String, + image_url: String, + labs_publication_date: String, + name: String, + organization: String, + popularity: i32, + publication_date: String, + release_status: models::ReleaseStatus, + tags: Vec, + thumbnail_image_url: String, + updated_at: String, + version: i32, + visits: i32, + ) -> World { World { author_id, author_name, @@ -117,4 +144,3 @@ impl World { } } } - diff --git a/src/models/world_metadata.rs b/src/models/world_metadata.rs index c6acf86..88531a1 100644 --- a/src/models/world_metadata.rs +++ b/src/models/world_metadata.rs @@ -20,10 +20,6 @@ pub struct WorldMetadata { impl WorldMetadata { pub fn new(id: String, metadata: serde_json::Value) -> WorldMetadata { - WorldMetadata { - id, - metadata, - } + WorldMetadata { id, metadata } } } - diff --git a/src/models/world_publish_status.rs b/src/models/world_publish_status.rs index bf6a7d2..0947c1b 100644 --- a/src/models/world_publish_status.rs +++ b/src/models/world_publish_status.rs @@ -17,9 +17,6 @@ pub struct WorldPublishStatus { impl WorldPublishStatus { pub fn new(can_publish: bool) -> WorldPublishStatus { - WorldPublishStatus { - can_publish, - } + WorldPublishStatus { can_publish } } } - From 9be568c4fddd3139a0c6ce1a78befa7717ef7d81 Mon Sep 17 00:00:00 2001 From: 0xkubectl Date: Sat, 27 Jul 2024 01:47:33 +0200 Subject: [PATCH 03/10] fix: remove unrelated changes --- generate.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/generate.sh b/generate.sh index 33f495e..45cba23 100755 --- a/generate.sh +++ b/generate.sh @@ -15,7 +15,7 @@ done # Generate client ./node_modules/\@openapitools/openapi-generator-cli/main.js generate \ -g rust \ ---additional-properties=packageName=vrchatapi,supportAsync=true,avoidBoxedModels=true \ +--additional-properties=packageName=vrchatapi,supportAsync=true \ --git-user-id=vrchatapi \ --git-repo-id=vrchatapi-rust \ -o . \ @@ -36,7 +36,7 @@ find src -type f -exec sed -i '/The version of the OpenAPI document/d' {} \; find src -type f -exec sed -i '/^\s*\/\/\/\s*$/d' {} \; # Cookie storage -sed -i 's/Client::new()/Client::builder().cookie_store(true).build().expect("Failed to build client")/g' src/apis/configuration.rs +sed -i 's/Client::new()/Client::builder().cookie_store(true).build().unwrap()/g' src/apis/configuration.rs sed -i 's/features = \["json", "multipart"\]/features = \["json", "cookies", "multipart"\]/g' Cargo.toml # Fix example @@ -44,5 +44,4 @@ printf "\n[dev-dependencies]\ntokio = { version = '1', features = ['macros', 'rt # Format and test cargo build -cargo fmt cargo test From ddc9fd2557a02dab7ce222ab18fa86de189afc26 Mon Sep 17 00:00:00 2001 From: 0xkubectl Date: Sat, 27 Jul 2024 01:48:06 +0200 Subject: [PATCH 04/10] chore: generate --- docs/UserExists.md | 1 + src/apis/authentication_api.rs | 203 +-- src/apis/avatars_api.rs | 315 ++--- src/apis/configuration.rs | 9 +- src/apis/economy_api.rs | 122 +- src/apis/favorites_api.rs | 228 +--- src/apis/files_api.rs | 281 +--- src/apis/friends_api.rs | 134 +- src/apis/groups_api.rs | 1209 ++++------------- src/apis/instances_api.rs | 174 +-- src/apis/invite_api.rs | 236 +--- src/apis/mod.rs | 16 +- src/apis/notifications_api.rs | 155 +-- src/apis/permissions_api.rs | 53 +- src/apis/playermoderation_api.rs | 166 +-- src/apis/system_api.rs | 162 +-- src/apis/users_api.rs | 194 +-- src/apis/worlds_api.rs | 500 ++----- src/lib.rs | 2 +- src/models/account_deletion_log.rs | 8 +- src/models/add_favorite_request.rs | 7 +- src/models/add_group_gallery_image_request.rs | 5 +- src/models/api_config.rs | 121 +- src/models/api_config_announcement.rs | 6 +- src/models/api_config_download_url_list.rs | 9 +- src/models/api_config_events.rs | 14 +- src/models/api_health.rs | 1 + src/models/avatar.rs | 26 +- src/models/avatar_unity_package_url_object.rs | 1 + src/models/badge.rs | 30 +- src/models/ban_group_member_request.rs | 5 +- src/models/create_avatar_request.rs | 1 + src/models/create_file_request.rs | 1 + src/models/create_file_version_request.rs | 1 + .../create_group_announcement_request.rs | 1 + src/models/create_group_gallery_request.rs | 29 +- src/models/create_group_invite_request.rs | 6 +- src/models/create_group_post_request.rs | 8 +- src/models/create_group_request.rs | 21 +- src/models/create_group_role_request.rs | 1 + src/models/create_instance_request.rs | 14 +- src/models/create_world_request.rs | 1 + src/models/current_user.rs | 95 +- src/models/current_user_presence.rs | 64 +- src/models/deployment_group.rs | 2 + src/models/developer_type.rs | 2 + src/models/dynamic_content_row.rs | 9 +- src/models/error.rs | 7 +- src/models/favorite.rs | 10 +- src/models/favorite_group.rs | 14 +- src/models/favorite_group_visibility.rs | 2 + src/models/favorite_type.rs | 2 + src/models/file.rs | 13 +- src/models/file_data.rs | 12 +- src/models/file_status.rs | 2 + src/models/file_upload_url.rs | 7 +- src/models/file_version.rs | 9 +- src/models/file_version_upload_status.rs | 12 +- src/models/finish_file_data_upload_request.rs | 3 +- src/models/friend_status.rs | 1 + src/models/get_current_user_200_response.rs | 5 +- src/models/group.rs | 57 +- src/models/group_access_type.rs | 2 + src/models/group_announcement.rs | 36 +- src/models/group_audit_log_entry.rs | 1 + src/models/group_gallery.rs | 29 +- src/models/group_gallery_image.rs | 1 + src/models/group_instance.rs | 12 +- src/models/group_join_request_action.rs | 2 + src/models/group_join_state.rs | 2 + src/models/group_limited_member.rs | 46 +- src/models/group_member.rs | 48 +- src/models/group_member_limited_user.rs | 15 +- src/models/group_member_status.rs | 2 + src/models/group_my_member.rs | 32 +- src/models/group_permission.rs | 6 +- src/models/group_post.rs | 8 +- src/models/group_post_visibility.rs | 2 + src/models/group_privacy.rs | 2 + src/models/group_role.rs | 1 + src/models/group_role_template.rs | 2 + src/models/group_search_sort.rs | 2 + src/models/group_user_visibility.rs | 2 + src/models/info_push.rs | 19 +- src/models/info_push_data.rs | 9 +- src/models/info_push_data_article.rs | 7 +- src/models/info_push_data_article_content.rs | 3 +- src/models/info_push_data_clickable.rs | 1 + src/models/instance.rs | 66 +- src/models/instance_platforms.rs | 1 + src/models/instance_region.rs | 2 + src/models/instance_short_name_response.rs | 1 + src/models/instance_type.rs | 4 +- src/models/invite_message.rs | 13 +- src/models/invite_message_type.rs | 4 +- src/models/invite_request.rs | 1 + src/models/invite_response.rs | 5 +- src/models/license.rs | 8 +- src/models/license_action.rs | 2 + src/models/license_group.rs | 10 +- src/models/license_type.rs | 2 + src/models/limited_group.rs | 36 +- src/models/limited_unity_package.rs | 3 +- src/models/limited_user.rs | 24 +- src/models/limited_user_groups.rs | 43 +- src/models/limited_world.rs | 37 +- src/models/mime_type.rs | 2 + src/models/moderate_user_request.rs | 6 +- src/models/notification.rs | 12 +- src/models/notification_detail_invite.rs | 1 + .../notification_detail_invite_response.rs | 6 +- .../notification_detail_request_invite.rs | 1 + ...fication_detail_request_invite_response.rs | 1 + .../notification_detail_vote_to_kick.rs | 1 + src/models/notification_type.rs | 2 + src/models/order_option.rs | 2 + .../paginated_group_audit_log_entry_list.rs | 1 + src/models/past_display_name.rs | 1 + src/models/permission.rs | 10 +- src/models/player_moderation.rs | 11 +- src/models/player_moderation_type.rs | 2 + src/models/region.rs | 2 + src/models/release_status.rs | 2 + src/models/represented_group.rs | 29 +- src/models/request_invite_request.rs | 5 +- src/models/respond_group_join_request.rs | 1 + src/models/response.rs | 1 + src/models/sent_notification.rs | 13 +- src/models/sort_option.rs | 2 + src/models/subscription.rs | 12 +- src/models/subscription_period.rs | 2 + src/models/success.rs | 7 +- src/models/transaction.rs | 21 +- src/models/transaction_agreement.rs | 22 +- src/models/transaction_status.rs | 2 + src/models/transaction_steam_info.rs | 15 +- src/models/transaction_steam_wallet_info.rs | 10 +- src/models/two_factor_auth_code.rs | 5 +- src/models/two_factor_email_code.rs | 5 +- src/models/two_factor_required.rs | 1 + src/models/unity_package.rs | 24 +- src/models/update_avatar_request.rs | 1 + src/models/update_favorite_group_request.rs | 1 + src/models/update_group_gallery_request.rs | 29 +- src/models/update_group_member_request.rs | 6 +- src/models/update_group_request.rs | 15 +- src/models/update_group_role_request.rs | 1 + src/models/update_invite_message_request.rs | 5 +- src/models/update_user_request.rs | 1 + src/models/update_world_request.rs | 1 + src/models/user.rs | 43 +- src/models/user_exists.rs | 11 +- src/models/user_state.rs | 2 + src/models/user_status.rs | 2 + src/models/user_subscription.rs | 20 +- src/models/verify2_fa_email_code_result.rs | 5 +- src/models/verify2_fa_result.rs | 5 +- src/models/verify_auth_token_result.rs | 6 +- src/models/world.rs | 34 +- src/models/world_metadata.rs | 6 +- src/models/world_publish_status.rs | 5 +- 161 files changed, 1477 insertions(+), 4321 deletions(-) diff --git a/docs/UserExists.md b/docs/UserExists.md index 17b947c..62fd89f 100644 --- a/docs/UserExists.md +++ b/docs/UserExists.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **user_exists** | **bool** | Status if a user exist with that username or userId. | [default to false] +**name_ok** | **bool** | Is the username valid? | [default to false] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/src/apis/authentication_api.rs b/src/apis/authentication_api.rs index 5a2e4a9..735bcea 100644 --- a/src/apis/authentication_api.rs +++ b/src/apis/authentication_api.rs @@ -6,10 +6,12 @@ * Generated by: https://openapi-generator.tech */ -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; + use reqwest; use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + /// struct for typed errors of method [`check_user_exists`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -75,41 +77,30 @@ pub enum VerifyRecoveryCodeError { UnknownValue(serde_json::Value), } + /// Checks if a user by a given `username`, `displayName` or `email` exist. This is used during registration to check if a username has already been taken, during change of displayName to check if a displayName is available, and during change of email to check if the email is already used. In the later two cases the `excludeUserId` is used to exclude oneself, otherwise the result would always be true. It is **REQUIRED** to include **AT LEAST** `username`, `displayName` **or** `email` query parameter. Although they can be combined - in addition with `excludeUserId` (generally to exclude yourself) - to further fine-tune the search. -pub async fn check_user_exists( - configuration: &configuration::Configuration, - email: Option<&str>, - display_name: Option<&str>, - username: Option<&str>, - exclude_user_id: Option<&str>, -) -> Result> { +pub async fn check_user_exists(configuration: &configuration::Configuration, email: Option<&str>, display_name: Option<&str>, username: Option<&str>, exclude_user_id: Option<&str>) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/auth/exists", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = email { - local_var_req_builder = - local_var_req_builder.query(&[("email", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("email", &local_var_str.to_string())]); } if let Some(ref local_var_str) = display_name { - local_var_req_builder = - local_var_req_builder.query(&[("displayName", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("displayName", &local_var_str.to_string())]); } if let Some(ref local_var_str) = username { - local_var_req_builder = - local_var_req_builder.query(&[("username", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("username", &local_var_str.to_string())]); } if let Some(ref local_var_str) = exclude_user_id { - local_var_req_builder = - local_var_req_builder.query(&[("excludeUserId", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("excludeUserId", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -121,37 +112,23 @@ pub async fn check_user_exists( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Deletes the account with given ID. Normal users only have permission to delete their own account. Account deletion is 14 days from this request, and will be cancelled if you do an authenticated request with the account afterwards. **VRC+ NOTE:** Despite the 14-days cooldown, any VRC+ subscription will be cancelled **immediately**. **METHOD NOTE:** Despite this being a Delete action, the method type required is PUT. -pub async fn delete_user( - configuration: &configuration::Configuration, - user_id: &str, -) -> Result> { +pub async fn delete_user(configuration: &configuration::Configuration, user_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/users/{userId}/delete", - local_var_configuration.base_path, - userId = crate::apis::urlencode(user_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/users/{userId}/delete", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -163,38 +140,26 @@ pub async fn delete_user( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// This endpoint does the following two operations: 1) Checks if you are already logged in by looking for a valid `auth` cookie. If you are have a valid auth cookie then no additional auth-related actions are taken. If you are **not** logged in then it will log you in with the `Authorization` header and set the `auth` cookie. The `auth` cookie will only be sent once. 2) If logged in, this function will also return the CurrentUser object containing detailed information about the currently logged in user. The auth string after `Authorization: Basic {string}` is a base64-encoded string of the username and password, both individually url-encoded, and then joined with a colon. > base64(urlencode(username):urlencode(password)) **WARNING: Session Limit:** Each authentication with login credentials counts as a separate session, out of which you have a limited amount. Make sure to save and reuse the `auth` cookie if you are often restarting the program. The provided API libraries automatically save cookies during runtime, but does not persist during restart. While it can be fine to use username/password during development, expect in production to very fast run into the rate-limit and be temporarily blocked from making new sessions until older ones expire. The exact number of simultaneous sessions is unknown/undisclosed. -pub async fn get_current_user( - configuration: &configuration::Configuration, -) -> Result> { +pub async fn get_current_user(configuration: &configuration::Configuration, ) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/auth/user", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth { - local_var_req_builder = local_var_req_builder.basic_auth( - local_var_auth_conf.0.to_owned(), - local_var_auth_conf.1.to_owned(), - ); + local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned()); }; let local_var_req = local_var_req_builder.build()?; @@ -206,32 +171,23 @@ pub async fn get_current_user( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Invalidates the login session. -pub async fn logout( - configuration: &configuration::Configuration, -) -> Result> { +pub async fn logout(configuration: &configuration::Configuration, ) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/logout", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -244,34 +200,22 @@ pub async fn logout( serde_json::from_str(&local_var_content).map_err(Error::from) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Finishes the login sequence with a normal 2FA-generated code for accounts with 2FA-protection enabled. -pub async fn verify2_fa( - configuration: &configuration::Configuration, - two_factor_auth_code: models::TwoFactorAuthCode, -) -> Result> { +pub async fn verify2_fa(configuration: &configuration::Configuration, two_factor_auth_code: models::TwoFactorAuthCode) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/auth/twofactorauth/totp/verify", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/auth/twofactorauth/totp/verify", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&two_factor_auth_code); @@ -284,36 +228,23 @@ pub async fn verify2_fa( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Finishes the login sequence with an 2FA email code. -pub async fn verify2_fa_email_code( - configuration: &configuration::Configuration, - two_factor_email_code: models::TwoFactorEmailCode, -) -> Result> { +pub async fn verify2_fa_email_code(configuration: &configuration::Configuration, two_factor_email_code: models::TwoFactorEmailCode) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/auth/twofactorauth/emailotp/verify", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/auth/twofactorauth/emailotp/verify", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&two_factor_email_code); @@ -326,32 +257,23 @@ pub async fn verify2_fa_email_code( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Verify whether the currently provided Auth Token is valid. -pub async fn verify_auth_token( - configuration: &configuration::Configuration, -) -> Result> { +pub async fn verify_auth_token(configuration: &configuration::Configuration, ) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/auth", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -363,36 +285,23 @@ pub async fn verify_auth_token( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Finishes the login sequence with an OTP (One Time Password) recovery code for accounts with 2FA-protection enabled. -pub async fn verify_recovery_code( - configuration: &configuration::Configuration, - two_factor_auth_code: models::TwoFactorAuthCode, -) -> Result> { +pub async fn verify_recovery_code(configuration: &configuration::Configuration, two_factor_auth_code: models::TwoFactorAuthCode) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/auth/twofactorauth/otp/verify", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/auth/twofactorauth/otp/verify", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&two_factor_auth_code); @@ -405,13 +314,9 @@ pub async fn verify_recovery_code( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } + diff --git a/src/apis/avatars_api.rs b/src/apis/avatars_api.rs index 69cc726..c6595ce 100644 --- a/src/apis/avatars_api.rs +++ b/src/apis/avatars_api.rs @@ -6,10 +6,12 @@ * Generated by: https://openapi-generator.tech */ -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; + use reqwest; use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + /// struct for typed errors of method [`create_avatar`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -91,22 +93,18 @@ pub enum UpdateAvatarError { UnknownValue(serde_json::Value), } + /// Create an avatar. It's possible to optionally specify a ID if you want a custom one. Attempting to create an Avatar with an already claimed ID will result in a DB error. -pub async fn create_avatar( - configuration: &configuration::Configuration, - create_avatar_request: Option, -) -> Result> { +pub async fn create_avatar(configuration: &configuration::Configuration, create_avatar_request: Option) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/avatars", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&create_avatar_request); @@ -119,37 +117,23 @@ pub async fn create_avatar( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Delete an avatar. Notice an avatar is never fully \"deleted\", only its ReleaseStatus is set to \"hidden\" and the linked Files are deleted. The AvatarID is permanently reserved. -pub async fn delete_avatar( - configuration: &configuration::Configuration, - avatar_id: &str, -) -> Result> { +pub async fn delete_avatar(configuration: &configuration::Configuration, avatar_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/avatars/{avatarId}", - local_var_configuration.base_path, - avatarId = crate::apis::urlencode(avatar_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/avatars/{avatarId}", local_var_configuration.base_path, avatarId=crate::apis::urlencode(avatar_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -161,37 +145,23 @@ pub async fn delete_avatar( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Get information about a specific Avatar. -pub async fn get_avatar( - configuration: &configuration::Configuration, - avatar_id: &str, -) -> Result> { +pub async fn get_avatar(configuration: &configuration::Configuration, avatar_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/avatars/{avatarId}", - local_var_configuration.base_path, - avatarId = crate::apis::urlencode(avatar_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/avatars/{avatarId}", local_var_configuration.base_path, avatarId=crate::apis::urlencode(avatar_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -203,95 +173,62 @@ pub async fn get_avatar( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Search and list favorited avatars by query filters. -pub async fn get_favorited_avatars( - configuration: &configuration::Configuration, - featured: Option, - sort: Option, - n: Option, - order: Option, - offset: Option, - search: Option<&str>, - tag: Option<&str>, - notag: Option<&str>, - release_status: Option, - max_unity_version: Option<&str>, - min_unity_version: Option<&str>, - platform: Option<&str>, - user_id: Option<&str>, -) -> Result, Error> { +pub async fn get_favorited_avatars(configuration: &configuration::Configuration, featured: Option, sort: Option, n: Option, order: Option, offset: Option, search: Option<&str>, tag: Option<&str>, notag: Option<&str>, release_status: Option, max_unity_version: Option<&str>, min_unity_version: Option<&str>, platform: Option<&str>, user_id: Option<&str>) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/avatars/favorites", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = featured { - local_var_req_builder = - local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); } if let Some(ref local_var_str) = sort { - local_var_req_builder = - local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); } if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = order { - local_var_req_builder = - local_var_req_builder.query(&[("order", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("order", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = - local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_str) = search { - local_var_req_builder = - local_var_req_builder.query(&[("search", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]); } if let Some(ref local_var_str) = tag { local_var_req_builder = local_var_req_builder.query(&[("tag", &local_var_str.to_string())]); } if let Some(ref local_var_str) = notag { - local_var_req_builder = - local_var_req_builder.query(&[("notag", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("notag", &local_var_str.to_string())]); } if let Some(ref local_var_str) = release_status { - local_var_req_builder = - local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]); } if let Some(ref local_var_str) = max_unity_version { - local_var_req_builder = - local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]); } if let Some(ref local_var_str) = min_unity_version { - local_var_req_builder = - local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]); } if let Some(ref local_var_str) = platform { - local_var_req_builder = - local_var_req_builder.query(&[("platform", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("platform", &local_var_str.to_string())]); } if let Some(ref local_var_str) = user_id { - local_var_req_builder = - local_var_req_builder.query(&[("userId", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("userId", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -303,37 +240,23 @@ pub async fn get_favorited_avatars( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Get the current avatar for the user. This will return an error for any other user than the one logged in. -pub async fn get_own_avatar( - configuration: &configuration::Configuration, - user_id: &str, -) -> Result> { +pub async fn get_own_avatar(configuration: &configuration::Configuration, user_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/users/{userId}/avatar", - local_var_configuration.base_path, - userId = crate::apis::urlencode(user_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/users/{userId}/avatar", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -345,95 +268,62 @@ pub async fn get_own_avatar( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Search and list avatars by query filters. You can only search your own or featured avatars. It is not possible as a normal user to search other peoples avatars. -pub async fn search_avatars( - configuration: &configuration::Configuration, - featured: Option, - sort: Option, - user: Option<&str>, - user_id: Option<&str>, - n: Option, - order: Option, - offset: Option, - tag: Option<&str>, - notag: Option<&str>, - release_status: Option, - max_unity_version: Option<&str>, - min_unity_version: Option<&str>, - platform: Option<&str>, -) -> Result, Error> { +pub async fn search_avatars(configuration: &configuration::Configuration, featured: Option, sort: Option, user: Option<&str>, user_id: Option<&str>, n: Option, order: Option, offset: Option, tag: Option<&str>, notag: Option<&str>, release_status: Option, max_unity_version: Option<&str>, min_unity_version: Option<&str>, platform: Option<&str>) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/avatars", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = featured { - local_var_req_builder = - local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); } if let Some(ref local_var_str) = sort { - local_var_req_builder = - local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); } if let Some(ref local_var_str) = user { - local_var_req_builder = - local_var_req_builder.query(&[("user", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("user", &local_var_str.to_string())]); } if let Some(ref local_var_str) = user_id { - local_var_req_builder = - local_var_req_builder.query(&[("userId", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("userId", &local_var_str.to_string())]); } if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = order { - local_var_req_builder = - local_var_req_builder.query(&[("order", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("order", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = - local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_str) = tag { local_var_req_builder = local_var_req_builder.query(&[("tag", &local_var_str.to_string())]); } if let Some(ref local_var_str) = notag { - local_var_req_builder = - local_var_req_builder.query(&[("notag", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("notag", &local_var_str.to_string())]); } if let Some(ref local_var_str) = release_status { - local_var_req_builder = - local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]); } if let Some(ref local_var_str) = max_unity_version { - local_var_req_builder = - local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]); } if let Some(ref local_var_str) = min_unity_version { - local_var_req_builder = - local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]); } if let Some(ref local_var_str) = platform { - local_var_req_builder = - local_var_req_builder.query(&[("platform", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("platform", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -445,37 +335,23 @@ pub async fn search_avatars( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Switches into that avatar. -pub async fn select_avatar( - configuration: &configuration::Configuration, - avatar_id: &str, -) -> Result> { +pub async fn select_avatar(configuration: &configuration::Configuration, avatar_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/avatars/{avatarId}/select", - local_var_configuration.base_path, - avatarId = crate::apis::urlencode(avatar_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/avatars/{avatarId}/select", local_var_configuration.base_path, avatarId=crate::apis::urlencode(avatar_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -487,37 +363,23 @@ pub async fn select_avatar( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Switches into that avatar as your fallback avatar. -pub async fn select_fallback_avatar( - configuration: &configuration::Configuration, - avatar_id: &str, -) -> Result> { +pub async fn select_fallback_avatar(configuration: &configuration::Configuration, avatar_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/avatars/{avatarId}/selectFallback", - local_var_configuration.base_path, - avatarId = crate::apis::urlencode(avatar_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/avatars/{avatarId}/selectFallback", local_var_configuration.base_path, avatarId=crate::apis::urlencode(avatar_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -529,38 +391,23 @@ pub async fn select_fallback_avatar( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Update information about a specific avatar. -pub async fn update_avatar( - configuration: &configuration::Configuration, - avatar_id: &str, - update_avatar_request: Option, -) -> Result> { +pub async fn update_avatar(configuration: &configuration::Configuration, avatar_id: &str, update_avatar_request: Option) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/avatars/{avatarId}", - local_var_configuration.base_path, - avatarId = crate::apis::urlencode(avatar_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/avatars/{avatarId}", local_var_configuration.base_path, avatarId=crate::apis::urlencode(avatar_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&update_avatar_request); @@ -573,13 +420,9 @@ pub async fn update_avatar( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } + diff --git a/src/apis/configuration.rs b/src/apis/configuration.rs index f291efa..4496c7b 100644 --- a/src/apis/configuration.rs +++ b/src/apis/configuration.rs @@ -6,6 +6,8 @@ * Generated by: https://openapi-generator.tech */ + + #[derive(Debug, Clone)] pub struct Configuration { pub base_path: String, @@ -26,6 +28,7 @@ pub struct ApiKey { pub key: String, } + impl Configuration { pub fn new() -> Configuration { Configuration::default() @@ -37,14 +40,12 @@ impl Default for Configuration { Configuration { base_path: "https://vrchat.com/api/1".to_owned(), user_agent: Some("vrchatapi-rust".to_owned()), - client: reqwest::Client::builder() - .cookie_store(true) - .build() - .expect("Failed to build client"), + client: reqwest::Client::builder().cookie_store(true).build().unwrap(), basic_auth: None, oauth_access_token: None, bearer_access_token: None, api_key: None, + } } } diff --git a/src/apis/economy_api.rs b/src/apis/economy_api.rs index c440110..ae46112 100644 --- a/src/apis/economy_api.rs +++ b/src/apis/economy_api.rs @@ -6,10 +6,12 @@ * Generated by: https://openapi-generator.tech */ -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; + use reqwest; use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + /// struct for typed errors of method [`get_current_subscriptions`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -51,24 +53,18 @@ pub enum GetSubscriptionsError { UnknownValue(serde_json::Value), } + /// Get a list of all current user subscriptions. -pub async fn get_current_subscriptions( - configuration: &configuration::Configuration, -) -> Result, Error> { +pub async fn get_current_subscriptions(configuration: &configuration::Configuration, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/auth/user/subscription", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/auth/user/subscription", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -80,37 +76,23 @@ pub async fn get_current_subscriptions( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Get a single License Group by given ID. -pub async fn get_license_group( - configuration: &configuration::Configuration, - license_group_id: &str, -) -> Result> { +pub async fn get_license_group(configuration: &configuration::Configuration, license_group_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/licenseGroups/{licenseGroupId}", - local_var_configuration.base_path, - licenseGroupId = crate::apis::urlencode(license_group_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/licenseGroups/{licenseGroupId}", local_var_configuration.base_path, licenseGroupId=crate::apis::urlencode(license_group_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -122,37 +104,23 @@ pub async fn get_license_group( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Get a single Steam transactions by ID. This returns the exact same information as `getSteamTransactions`, so no point in using this endpoint. -pub async fn get_steam_transaction( - configuration: &configuration::Configuration, - transaction_id: &str, -) -> Result> { +pub async fn get_steam_transaction(configuration: &configuration::Configuration, transaction_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/Steam/transactions/{transactionId}", - local_var_configuration.base_path, - transactionId = crate::apis::urlencode(transaction_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/Steam/transactions/{transactionId}", local_var_configuration.base_path, transactionId=crate::apis::urlencode(transaction_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -164,32 +132,23 @@ pub async fn get_steam_transaction( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Get all own Steam transactions. -pub async fn get_steam_transactions( - configuration: &configuration::Configuration, -) -> Result, Error> { +pub async fn get_steam_transactions(configuration: &configuration::Configuration, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/Steam/transactions", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -201,32 +160,23 @@ pub async fn get_steam_transactions( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// List all existing Subscriptions. For example, \"vrchatplus-monthly\" and \"vrchatplus-yearly\". -pub async fn get_subscriptions( - configuration: &configuration::Configuration, -) -> Result, Error> { +pub async fn get_subscriptions(configuration: &configuration::Configuration, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/subscriptions", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -238,13 +188,9 @@ pub async fn get_subscriptions( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } + diff --git a/src/apis/favorites_api.rs b/src/apis/favorites_api.rs index aeb9f93..1b8b37e 100644 --- a/src/apis/favorites_api.rs +++ b/src/apis/favorites_api.rs @@ -6,10 +6,12 @@ * Generated by: https://openapi-generator.tech */ -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; + use reqwest; use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + /// struct for typed errors of method [`add_favorite`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -75,22 +77,18 @@ pub enum UpdateFavoriteGroupError { UnknownValue(serde_json::Value), } + /// Add a new favorite. Friend groups are named `group_0` through `group_3`. Avatar and World groups are named `avatars1` to `avatars4` and `worlds1` to `worlds4`. You cannot add people whom you are not friends with to your friends list. Destroying a friendship removes the person as favorite on both sides. -pub async fn add_favorite( - configuration: &configuration::Configuration, - add_favorite_request: Option, -) -> Result> { +pub async fn add_favorite(configuration: &configuration::Configuration, add_favorite_request: Option) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/favorites", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&add_favorite_request); @@ -103,41 +101,23 @@ pub async fn add_favorite( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Clear ALL contents of a specific favorite group. -pub async fn clear_favorite_group( - configuration: &configuration::Configuration, - favorite_group_type: &str, - favorite_group_name: &str, - user_id: &str, -) -> Result> { +pub async fn clear_favorite_group(configuration: &configuration::Configuration, favorite_group_type: &str, favorite_group_name: &str, user_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/favorite/group/{favoriteGroupType}/{favoriteGroupName}/{userId}", - local_var_configuration.base_path, - favoriteGroupType = crate::apis::urlencode(favorite_group_type), - favoriteGroupName = crate::apis::urlencode(favorite_group_name), - userId = crate::apis::urlencode(user_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/favorite/group/{favoriteGroupType}/{favoriteGroupName}/{userId}", local_var_configuration.base_path, favoriteGroupType=crate::apis::urlencode(favorite_group_type), favoriteGroupName=crate::apis::urlencode(favorite_group_name), userId=crate::apis::urlencode(user_id)); + let 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()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -149,37 +129,23 @@ pub async fn clear_favorite_group( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Return information about a specific Favorite. -pub async fn get_favorite( - configuration: &configuration::Configuration, - favorite_id: &str, -) -> Result> { +pub async fn get_favorite(configuration: &configuration::Configuration, favorite_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/favorites/{favoriteId}", - local_var_configuration.base_path, - favoriteId = crate::apis::urlencode(favorite_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/favorites/{favoriteId}", local_var_configuration.base_path, favoriteId=crate::apis::urlencode(favorite_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -191,41 +157,23 @@ pub async fn get_favorite( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Fetch information about a specific favorite group. -pub async fn get_favorite_group( - configuration: &configuration::Configuration, - favorite_group_type: &str, - favorite_group_name: &str, - user_id: &str, -) -> Result> { +pub async fn get_favorite_group(configuration: &configuration::Configuration, favorite_group_type: &str, favorite_group_name: &str, user_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/favorite/group/{favoriteGroupType}/{favoriteGroupName}/{userId}", - local_var_configuration.base_path, - favoriteGroupType = crate::apis::urlencode(favorite_group_type), - favoriteGroupName = crate::apis::urlencode(favorite_group_name), - userId = crate::apis::urlencode(user_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/favorite/group/{favoriteGroupType}/{favoriteGroupName}/{userId}", local_var_configuration.base_path, favoriteGroupType=crate::apis::urlencode(favorite_group_type), favoriteGroupName=crate::apis::urlencode(favorite_group_name), userId=crate::apis::urlencode(user_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -237,46 +185,32 @@ pub async fn get_favorite_group( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Return a list of favorite groups owned by a user. Returns the same information as `getFavoriteGroups`. -pub async fn get_favorite_groups( - configuration: &configuration::Configuration, - n: Option, - offset: Option, - owner_id: Option<&str>, -) -> Result, Error> { +pub async fn get_favorite_groups(configuration: &configuration::Configuration, n: Option, offset: Option, owner_id: Option<&str>) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/favorite/groups", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = - local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_str) = owner_id { - local_var_req_builder = - local_var_req_builder.query(&[("ownerId", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("ownerId", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -288,50 +222,35 @@ pub async fn get_favorite_groups( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Returns a list of favorites. -pub async fn get_favorites( - configuration: &configuration::Configuration, - n: Option, - offset: Option, - r#type: Option<&str>, - tag: Option<&str>, -) -> Result, Error> { +pub async fn get_favorites(configuration: &configuration::Configuration, n: Option, offset: Option, r#type: Option<&str>, tag: Option<&str>) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/favorites", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = - local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_str) = r#type { - local_var_req_builder = - local_var_req_builder.query(&[("type", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("type", &local_var_str.to_string())]); } if let Some(ref local_var_str) = tag { local_var_req_builder = local_var_req_builder.query(&[("tag", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -343,37 +262,23 @@ pub async fn get_favorites( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Remove a favorite from your favorites list. -pub async fn remove_favorite( - configuration: &configuration::Configuration, - favorite_id: &str, -) -> Result> { +pub async fn remove_favorite(configuration: &configuration::Configuration, favorite_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/favorites/{favoriteId}", - local_var_configuration.base_path, - favoriteId = crate::apis::urlencode(favorite_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/favorites/{favoriteId}", local_var_configuration.base_path, favoriteId=crate::apis::urlencode(favorite_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -385,42 +290,23 @@ pub async fn remove_favorite( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Update information about a specific favorite group. -pub async fn update_favorite_group( - configuration: &configuration::Configuration, - favorite_group_type: &str, - favorite_group_name: &str, - user_id: &str, - update_favorite_group_request: Option, -) -> Result<(), Error> { +pub async fn update_favorite_group(configuration: &configuration::Configuration, favorite_group_type: &str, favorite_group_name: &str, user_id: &str, update_favorite_group_request: Option) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/favorite/group/{favoriteGroupType}/{favoriteGroupName}/{userId}", - local_var_configuration.base_path, - favoriteGroupType = crate::apis::urlencode(favorite_group_type), - favoriteGroupName = crate::apis::urlencode(favorite_group_name), - userId = crate::apis::urlencode(user_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/favorite/group/{favoriteGroupType}/{favoriteGroupName}/{userId}", local_var_configuration.base_path, favoriteGroupType=crate::apis::urlencode(favorite_group_type), favoriteGroupName=crate::apis::urlencode(favorite_group_name), userId=crate::apis::urlencode(user_id)); + let 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()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&update_favorite_group_request); @@ -433,13 +319,9 @@ pub async fn update_favorite_group( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } + diff --git a/src/apis/files_api.rs b/src/apis/files_api.rs index 09646c8..edff673 100644 --- a/src/apis/files_api.rs +++ b/src/apis/files_api.rs @@ -6,10 +6,12 @@ * Generated by: https://openapi-generator.tech */ -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; + use reqwest; use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + /// struct for typed errors of method [`create_file`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -87,22 +89,18 @@ pub enum StartFileDataUploadError { UnknownValue(serde_json::Value), } + /// Creates a new File object -pub async fn create_file( - configuration: &configuration::Configuration, - create_file_request: Option, -) -> Result> { +pub async fn create_file(configuration: &configuration::Configuration, create_file_request: Option) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/file", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&create_file_request); @@ -115,38 +113,23 @@ pub async fn create_file( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Creates a new FileVersion. Once a Version has been created, proceed to the `/file/{fileId}/{versionId}/file/start` endpoint to start a file upload. -pub async fn create_file_version( - configuration: &configuration::Configuration, - file_id: &str, - create_file_version_request: Option, -) -> Result> { +pub async fn create_file_version(configuration: &configuration::Configuration, file_id: &str, create_file_version_request: Option) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/file/{fileId}", - local_var_configuration.base_path, - fileId = crate::apis::urlencode(file_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/file/{fileId}", local_var_configuration.base_path, fileId=crate::apis::urlencode(file_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&create_file_version_request); @@ -159,37 +142,23 @@ pub async fn create_file_version( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Deletes a File object. -pub async fn delete_file( - configuration: &configuration::Configuration, - file_id: &str, -) -> Result> { +pub async fn delete_file(configuration: &configuration::Configuration, file_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/file/{fileId}", - local_var_configuration.base_path, - fileId = crate::apis::urlencode(file_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/file/{fileId}", local_var_configuration.base_path, fileId=crate::apis::urlencode(file_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -201,39 +170,23 @@ pub async fn delete_file( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Delete a specific version of a file. You can only delete the latest version. -pub async fn delete_file_version( - configuration: &configuration::Configuration, - file_id: &str, - version_id: i32, -) -> Result> { +pub async fn delete_file_version(configuration: &configuration::Configuration, file_id: &str, version_id: i32) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/file/{fileId}/{versionId}", - local_var_configuration.base_path, - fileId = crate::apis::urlencode(file_id), - versionId = version_id - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/file/{fileId}/{versionId}", local_var_configuration.base_path, fileId=crate::apis::urlencode(file_id), versionId=version_id); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -245,39 +198,23 @@ pub async fn delete_file_version( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Downloads the file with the provided version number. **Version Note:** Version 0 is always when the file was created. The real data is usually always located in version 1 and up. **Extension Note:** Files are not guaranteed to have a file extensions. UnityPackage files tends to have it, images through this endpoint do not. You are responsible for appending file extension from the `extension` field when neccesary. -pub async fn download_file_version( - configuration: &configuration::Configuration, - file_id: &str, - version_id: i32, -) -> Result<(), Error> { +pub async fn download_file_version(configuration: &configuration::Configuration, file_id: &str, version_id: i32) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/file/{fileId}/{versionId}", - local_var_configuration.base_path, - fileId = crate::apis::urlencode(file_id), - versionId = version_id - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/file/{fileId}/{versionId}", local_var_configuration.base_path, fileId=crate::apis::urlencode(file_id), versionId=version_id); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -289,42 +226,23 @@ pub async fn download_file_version( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Finish an upload of a FileData. This will mark it as \"complete\". After uploading the `file` for Avatars and Worlds you then have to upload a `signature` file. -pub async fn finish_file_data_upload( - configuration: &configuration::Configuration, - file_id: &str, - version_id: i32, - file_type: &str, - finish_file_data_upload_request: Option, -) -> Result> { +pub async fn finish_file_data_upload(configuration: &configuration::Configuration, file_id: &str, version_id: i32, file_type: &str, finish_file_data_upload_request: Option) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/file/{fileId}/{versionId}/{fileType}/finish", - local_var_configuration.base_path, - fileId = crate::apis::urlencode(file_id), - versionId = version_id, - fileType = crate::apis::urlencode(file_type) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/file/{fileId}/{versionId}/{fileType}/finish", local_var_configuration.base_path, fileId=crate::apis::urlencode(file_id), versionId=version_id, fileType=crate::apis::urlencode(file_type)); + let 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()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&finish_file_data_upload_request); @@ -337,37 +255,23 @@ pub async fn finish_file_data_upload( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Shows general information about the \"File\" object. Each File can have several \"Version\"'s, and each Version can have multiple real files or \"Data\" blobs. -pub async fn get_file( - configuration: &configuration::Configuration, - file_id: &str, -) -> Result> { +pub async fn get_file(configuration: &configuration::Configuration, file_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/file/{fileId}", - local_var_configuration.base_path, - fileId = crate::apis::urlencode(file_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/file/{fileId}", local_var_configuration.base_path, fileId=crate::apis::urlencode(file_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -380,39 +284,22 @@ pub async fn get_file( serde_json::from_str(&local_var_content).map_err(Error::from) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Retrieves the upload status for file upload. Can currently only be accessed when `status` is `waiting`. Trying to access it on a file version already uploaded currently times out. -pub async fn get_file_data_upload_status( - configuration: &configuration::Configuration, - file_id: &str, - version_id: i32, - file_type: &str, -) -> Result> { +pub async fn get_file_data_upload_status(configuration: &configuration::Configuration, file_id: &str, version_id: i32, file_type: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/file/{fileId}/{versionId}/{fileType}/status", - local_var_configuration.base_path, - fileId = crate::apis::urlencode(file_id), - versionId = version_id, - fileType = crate::apis::urlencode(file_type) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/file/{fileId}/{versionId}/{fileType}/status", local_var_configuration.base_path, fileId=crate::apis::urlencode(file_id), versionId=version_id, fileType=crate::apis::urlencode(file_type)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -424,50 +311,35 @@ pub async fn get_file_data_upload_status( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Returns a list of files -pub async fn get_files( - configuration: &configuration::Configuration, - tag: Option<&str>, - user_id: Option<&str>, - n: Option, - offset: Option, -) -> Result, Error> { +pub async fn get_files(configuration: &configuration::Configuration, tag: Option<&str>, user_id: Option<&str>, n: Option, offset: Option) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/files", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = tag { local_var_req_builder = local_var_req_builder.query(&[("tag", &local_var_str.to_string())]); } if let Some(ref local_var_str) = user_id { - local_var_req_builder = - local_var_req_builder.query(&[("userId", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("userId", &local_var_str.to_string())]); } if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = - local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -480,44 +352,25 @@ pub async fn get_files( serde_json::from_str(&local_var_content).map_err(Error::from) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Starts an upload of a specific FilePart. This endpoint will return an AWS URL which you can PUT data to. You need to call this and receive a new AWS API URL for each `partNumber`. Please see AWS's REST documentation on \"PUT Object to S3\" on how to upload. Once all parts has been uploaded, proceed to `/finish` endpoint. **Note:** `nextPartNumber` seems like it is always ignored. Despite it returning 0, first partNumber is always 1. -pub async fn start_file_data_upload( - configuration: &configuration::Configuration, - file_id: &str, - version_id: i32, - file_type: &str, - part_number: Option, -) -> Result> { +pub async fn start_file_data_upload(configuration: &configuration::Configuration, file_id: &str, version_id: i32, file_type: &str, part_number: Option) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/file/{fileId}/{versionId}/{fileType}/start", - local_var_configuration.base_path, - fileId = crate::apis::urlencode(file_id), - versionId = version_id, - fileType = crate::apis::urlencode(file_type) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/file/{fileId}/{versionId}/{fileType}/start", local_var_configuration.base_path, fileId=crate::apis::urlencode(file_id), versionId=version_id, fileType=crate::apis::urlencode(file_type)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_str) = part_number { - local_var_req_builder = - local_var_req_builder.query(&[("partNumber", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("partNumber", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -529,13 +382,9 @@ pub async fn start_file_data_upload( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } + diff --git a/src/apis/friends_api.rs b/src/apis/friends_api.rs index 98ef77d..edd1f90 100644 --- a/src/apis/friends_api.rs +++ b/src/apis/friends_api.rs @@ -6,10 +6,12 @@ * Generated by: https://openapi-generator.tech */ -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; + use reqwest; use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + /// struct for typed errors of method [`delete_friend_request`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -55,26 +57,18 @@ pub enum UnfriendError { UnknownValue(serde_json::Value), } + /// Deletes an outgoing pending friend request to another user. To delete an incoming friend request, use the `deleteNotification` endpoint instead. -pub async fn delete_friend_request( - configuration: &configuration::Configuration, - user_id: &str, -) -> Result> { +pub async fn delete_friend_request(configuration: &configuration::Configuration, user_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/user/{userId}/friendRequest", - local_var_configuration.base_path, - userId = crate::apis::urlencode(user_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/user/{userId}/friendRequest", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -86,37 +80,23 @@ pub async fn delete_friend_request( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Send a friend request to another user. -pub async fn friend( - configuration: &configuration::Configuration, - user_id: &str, -) -> Result> { +pub async fn friend(configuration: &configuration::Configuration, user_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/user/{userId}/friendRequest", - local_var_configuration.base_path, - userId = crate::apis::urlencode(user_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/user/{userId}/friendRequest", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -129,35 +109,22 @@ pub async fn friend( serde_json::from_str(&local_var_content).map_err(Error::from) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Retrieve if the user is currently a friend with a given user, if they have an outgoing friend request, and if they have an incoming friend request. The proper way to receive and accept friend request is by checking if the user has an incoming `Notification` of type `friendRequest`, and then accepting that notification. -pub async fn get_friend_status( - configuration: &configuration::Configuration, - user_id: &str, -) -> Result> { +pub async fn get_friend_status(configuration: &configuration::Configuration, user_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/user/{userId}/friendStatus", - local_var_configuration.base_path, - userId = crate::apis::urlencode(user_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/user/{userId}/friendStatus", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -169,46 +136,32 @@ pub async fn get_friend_status( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// List information about friends. -pub async fn get_friends( - configuration: &configuration::Configuration, - offset: Option, - n: Option, - offline: Option, -) -> Result, Error> { +pub async fn get_friends(configuration: &configuration::Configuration, offset: Option, n: Option, offline: Option) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/auth/user/friends", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = offset { - local_var_req_builder = - local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offline { - local_var_req_builder = - local_var_req_builder.query(&[("offline", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("offline", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -220,37 +173,23 @@ pub async fn get_friends( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Unfriend a user by ID. -pub async fn unfriend( - configuration: &configuration::Configuration, - user_id: &str, -) -> Result> { +pub async fn unfriend(configuration: &configuration::Configuration, user_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/auth/user/friends/{userId}", - local_var_configuration.base_path, - userId = crate::apis::urlencode(user_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/auth/user/friends/{userId}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -263,11 +202,8 @@ pub async fn unfriend( serde_json::from_str(&local_var_content).map_err(Error::from) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } + diff --git a/src/apis/groups_api.rs b/src/apis/groups_api.rs index b785784..2bc86e6 100644 --- a/src/apis/groups_api.rs +++ b/src/apis/groups_api.rs @@ -6,10 +6,12 @@ * Generated by: https://openapi-generator.tech */ -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; + use reqwest; use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + /// struct for typed errors of method [`add_group_gallery_image`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -397,29 +399,18 @@ pub enum UpdateGroupRoleError { UnknownValue(serde_json::Value), } + /// Adds an image to a Group gallery. -pub async fn add_group_gallery_image( - configuration: &configuration::Configuration, - group_id: &str, - group_gallery_id: &str, - add_group_gallery_image_request: models::AddGroupGalleryImageRequest, -) -> Result> { +pub async fn add_group_gallery_image(configuration: &configuration::Configuration, group_id: &str, group_gallery_id: &str, add_group_gallery_image_request: models::AddGroupGalleryImageRequest) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/galleries/{groupGalleryId}/images", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id), - groupGalleryId = crate::apis::urlencode(group_gallery_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/galleries/{groupGalleryId}/images", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), groupGalleryId=crate::apis::urlencode(group_gallery_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&add_group_gallery_image_request); @@ -432,41 +423,23 @@ pub async fn add_group_gallery_image( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Adds a Role to a Group Member -pub async fn add_group_member_role( - configuration: &configuration::Configuration, - group_id: &str, - user_id: &str, - group_role_id: &str, -) -> Result, Error> { +pub async fn add_group_member_role(configuration: &configuration::Configuration, group_id: &str, user_id: &str, group_role_id: &str) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/members/{userId}/roles/{groupRoleId}", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id), - userId = crate::apis::urlencode(user_id), - groupRoleId = crate::apis::urlencode(group_role_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/members/{userId}/roles/{groupRoleId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), userId=crate::apis::urlencode(user_id), groupRoleId=crate::apis::urlencode(group_role_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()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -478,38 +451,23 @@ pub async fn add_group_member_role( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Create a post in a Group. -pub async fn add_group_post( - configuration: &configuration::Configuration, - group_id: &str, - create_group_post_request: models::CreateGroupPostRequest, -) -> Result> { +pub async fn add_group_post(configuration: &configuration::Configuration, group_id: &str, create_group_post_request: models::CreateGroupPostRequest) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/posts", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/posts", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&create_group_post_request); @@ -522,38 +480,23 @@ pub async fn add_group_post( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Bans a user from a Group. -pub async fn ban_group_member( - configuration: &configuration::Configuration, - group_id: &str, - ban_group_member_request: models::BanGroupMemberRequest, -) -> Result> { +pub async fn ban_group_member(configuration: &configuration::Configuration, group_id: &str, ban_group_member_request: models::BanGroupMemberRequest) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/bans", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/bans", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&ban_group_member_request); @@ -566,37 +509,23 @@ pub async fn ban_group_member( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Cancels a request sent to join the group. -pub async fn cancel_group_request( - configuration: &configuration::Configuration, - group_id: &str, -) -> Result<(), Error> { +pub async fn cancel_group_request(configuration: &configuration::Configuration, group_id: &str) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/requests", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/requests", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_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()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -608,33 +537,23 @@ pub async fn cancel_group_request( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Creates a Group and returns a Group object. **Requires VRC+ Subscription.** -pub async fn create_group( - configuration: &configuration::Configuration, - create_group_request: models::CreateGroupRequest, -) -> Result> { +pub async fn create_group(configuration: &configuration::Configuration, create_group_request: models::CreateGroupRequest) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/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()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&create_group_request); @@ -647,38 +566,23 @@ pub async fn create_group( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Creates an Announcement for a Group. -pub async fn create_group_announcement( - configuration: &configuration::Configuration, - group_id: &str, - create_group_announcement_request: models::CreateGroupAnnouncementRequest, -) -> Result> { +pub async fn create_group_announcement(configuration: &configuration::Configuration, group_id: &str, create_group_announcement_request: models::CreateGroupAnnouncementRequest) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/announcement", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/announcement", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&create_group_announcement_request); @@ -691,38 +595,23 @@ pub async fn create_group_announcement( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Creates a gallery for a Group. -pub async fn create_group_gallery( - configuration: &configuration::Configuration, - group_id: &str, - create_group_gallery_request: models::CreateGroupGalleryRequest, -) -> Result> { +pub async fn create_group_gallery(configuration: &configuration::Configuration, group_id: &str, create_group_gallery_request: models::CreateGroupGalleryRequest) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/galleries", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/galleries", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&create_group_gallery_request); @@ -735,38 +624,23 @@ pub async fn create_group_gallery( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Sends an invite to a user to join the group. -pub async fn create_group_invite( - configuration: &configuration::Configuration, - group_id: &str, - create_group_invite_request: models::CreateGroupInviteRequest, -) -> Result<(), Error> { +pub async fn create_group_invite(configuration: &configuration::Configuration, group_id: &str, create_group_invite_request: models::CreateGroupInviteRequest) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/invites", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/invites", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&create_group_invite_request); @@ -779,38 +653,23 @@ pub async fn create_group_invite( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Create a Group role. -pub async fn create_group_role( - configuration: &configuration::Configuration, - group_id: &str, - create_group_role_request: models::CreateGroupRoleRequest, -) -> Result> { +pub async fn create_group_role(configuration: &configuration::Configuration, group_id: &str, create_group_role_request: models::CreateGroupRoleRequest) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/roles", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/roles", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&create_group_role_request); @@ -823,37 +682,23 @@ pub async fn create_group_role( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Deletes a Group. -pub async fn delete_group( - configuration: &configuration::Configuration, - group_id: &str, -) -> Result> { +pub async fn delete_group(configuration: &configuration::Configuration, group_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_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()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -865,37 +710,23 @@ pub async fn delete_group( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Deletes the announcement for a Group. -pub async fn delete_group_announcement( - configuration: &configuration::Configuration, - group_id: &str, -) -> Result> { +pub async fn delete_group_announcement(configuration: &configuration::Configuration, group_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/announcement", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/announcement", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_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()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -907,39 +738,23 @@ pub async fn delete_group_announcement( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Deletes a gallery for a Group. -pub async fn delete_group_gallery( - configuration: &configuration::Configuration, - group_id: &str, - group_gallery_id: &str, -) -> Result> { +pub async fn delete_group_gallery(configuration: &configuration::Configuration, group_id: &str, group_gallery_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/galleries/{groupGalleryId}", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id), - groupGalleryId = crate::apis::urlencode(group_gallery_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/galleries/{groupGalleryId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), groupGalleryId=crate::apis::urlencode(group_gallery_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()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -951,41 +766,23 @@ pub async fn delete_group_gallery( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Deletes an image from a Group gallery. -pub async fn delete_group_gallery_image( - configuration: &configuration::Configuration, - group_id: &str, - group_gallery_id: &str, - group_gallery_image_id: &str, -) -> Result> { +pub async fn delete_group_gallery_image(configuration: &configuration::Configuration, group_id: &str, group_gallery_id: &str, group_gallery_image_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/galleries/{groupGalleryId}/images/{groupGalleryImageId}", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id), - groupGalleryId = crate::apis::urlencode(group_gallery_id), - groupGalleryImageId = crate::apis::urlencode(group_gallery_image_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/galleries/{groupGalleryId}/images/{groupGalleryImageId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), groupGalleryId=crate::apis::urlencode(group_gallery_id), groupGalleryImageId=crate::apis::urlencode(group_gallery_image_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()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -997,39 +794,23 @@ pub async fn delete_group_gallery_image( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Deletes an Group invite sent to a User -pub async fn delete_group_invite( - configuration: &configuration::Configuration, - group_id: &str, - user_id: &str, -) -> Result<(), Error> { +pub async fn delete_group_invite(configuration: &configuration::Configuration, group_id: &str, user_id: &str) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/invites/{userId}", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id), - userId = crate::apis::urlencode(user_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/invites/{userId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), userId=crate::apis::urlencode(user_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1041,39 +822,23 @@ pub async fn delete_group_invite( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Delete a Group post -pub async fn delete_group_post( - configuration: &configuration::Configuration, - group_id: &str, - notification_id: &str, -) -> Result> { +pub async fn delete_group_post(configuration: &configuration::Configuration, group_id: &str, notification_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/posts/{notificationId}", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id), - notificationId = crate::apis::urlencode(notification_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/posts/{notificationId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), notificationId=crate::apis::urlencode(notification_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()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1085,39 +850,23 @@ pub async fn delete_group_post( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Deletes a Group Role by ID and returns the remaining roles. -pub async fn delete_group_role( - configuration: &configuration::Configuration, - group_id: &str, - group_role_id: &str, -) -> Result, Error> { +pub async fn delete_group_role(configuration: &configuration::Configuration, group_id: &str, group_role_id: &str) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/roles/{groupRoleId}", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id), - groupRoleId = crate::apis::urlencode(group_role_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/roles/{groupRoleId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), groupRoleId=crate::apis::urlencode(group_role_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()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1129,42 +878,26 @@ pub async fn delete_group_role( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Returns a single Group by ID. -pub async fn get_group( - configuration: &configuration::Configuration, - group_id: &str, - include_roles: Option, -) -> Result> { +pub async fn get_group(configuration: &configuration::Configuration, group_id: &str, include_roles: Option) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = include_roles { - local_var_req_builder = - local_var_req_builder.query(&[("includeRoles", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("includeRoles", &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()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1177,35 +910,22 @@ pub async fn get_group( serde_json::from_str(&local_var_content).map_err(Error::from) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Returns the announcement for a Group. If no announcement has been made, then it returns **empty object**. If an announcement exists, then it will always return all fields except `imageId` and `imageUrl` which may be null. -pub async fn get_group_announcements( - configuration: &configuration::Configuration, - group_id: &str, -) -> Result> { +pub async fn get_group_announcements(configuration: &configuration::Configuration, group_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/announcement", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/announcement", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1217,56 +937,35 @@ pub async fn get_group_announcements( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Returns a list of audit logs for a Group. -pub async fn get_group_audit_logs( - configuration: &configuration::Configuration, - group_id: &str, - n: Option, - offset: Option, - start_date: Option, - end_date: Option, -) -> Result> { +pub async fn get_group_audit_logs(configuration: &configuration::Configuration, group_id: &str, n: Option, offset: Option, start_date: Option, end_date: Option) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/auditLogs", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/auditLogs", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = - local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_str) = start_date { - local_var_req_builder = - local_var_req_builder.query(&[("startDate", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("startDate", &local_var_str.to_string())]); } if let Some(ref local_var_str) = end_date { - local_var_req_builder = - local_var_req_builder.query(&[("endDate", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("endDate", &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()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1278,46 +977,29 @@ pub async fn get_group_audit_logs( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Returns a list of banned users for a Group. -pub async fn get_group_bans( - configuration: &configuration::Configuration, - group_id: &str, - n: Option, - offset: Option, -) -> Result, Error> { +pub async fn get_group_bans(configuration: &configuration::Configuration, group_id: &str, n: Option, offset: Option) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/bans", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/bans", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = - local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1329,53 +1011,32 @@ pub async fn get_group_bans( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Returns a list of images for a Group gallery. -pub async fn get_group_gallery_images( - configuration: &configuration::Configuration, - group_id: &str, - group_gallery_id: &str, - n: Option, - offset: Option, - approved: Option, -) -> Result, Error> { +pub async fn get_group_gallery_images(configuration: &configuration::Configuration, group_id: &str, group_gallery_id: &str, n: Option, offset: Option, approved: Option) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/galleries/{groupGalleryId}", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id), - groupGalleryId = crate::apis::urlencode(group_gallery_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/galleries/{groupGalleryId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), groupGalleryId=crate::apis::urlencode(group_gallery_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) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = - local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_str) = approved { - local_var_req_builder = - local_var_req_builder.query(&[("approved", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("approved", &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()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1387,37 +1048,23 @@ pub async fn get_group_gallery_images( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Returns a list of group instances -pub async fn get_group_instances( - configuration: &configuration::Configuration, - group_id: &str, -) -> Result, Error> { +pub async fn get_group_instances(configuration: &configuration::Configuration, group_id: &str) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/instances", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/instances", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1429,46 +1076,29 @@ pub async fn get_group_instances( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Returns a list of members that have been invited to the Group. -pub async fn get_group_invites( - configuration: &configuration::Configuration, - group_id: &str, - n: Option, - offset: Option, -) -> Result, Error> { +pub async fn get_group_invites(configuration: &configuration::Configuration, group_id: &str, n: Option, offset: Option) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/invites", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/invites", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = - local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1480,39 +1110,23 @@ pub async fn get_group_invites( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Returns a LimitedGroup Member. -pub async fn get_group_member( - configuration: &configuration::Configuration, - group_id: &str, - user_id: &str, -) -> Result> { +pub async fn get_group_member(configuration: &configuration::Configuration, group_id: &str, user_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/members/{userId}", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id), - userId = crate::apis::urlencode(user_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/members/{userId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), userId=crate::apis::urlencode(user_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1524,51 +1138,32 @@ pub async fn get_group_member( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Returns a List of all **other** Group Members. This endpoint will never return the user calling the endpoint. Information about the user calling the endpoint must be found in the `myMember` field of the Group object. -pub async fn get_group_members( - configuration: &configuration::Configuration, - group_id: &str, - n: Option, - offset: Option, - sort: Option, -) -> Result, Error> { +pub async fn get_group_members(configuration: &configuration::Configuration, group_id: &str, n: Option, offset: Option, sort: Option) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/members", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/members", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = - local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_str) = sort { - local_var_req_builder = - local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1580,37 +1175,23 @@ pub async fn get_group_members( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Returns a List of all possible/available permissions for a Group. -pub async fn get_group_permissions( - configuration: &configuration::Configuration, - group_id: &str, -) -> Result, Error> { +pub async fn get_group_permissions(configuration: &configuration::Configuration, group_id: &str) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/permissions", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/permissions", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1622,51 +1203,32 @@ pub async fn get_group_permissions( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Get posts from a Group -pub async fn get_group_post( - configuration: &configuration::Configuration, - group_id: &str, - n: Option, - offset: Option, - public_only: Option, -) -> Result> { +pub async fn get_group_post(configuration: &configuration::Configuration, group_id: &str, n: Option, offset: Option, public_only: Option) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/posts", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/posts", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = - local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_str) = public_only { - local_var_req_builder = - local_var_req_builder.query(&[("publicOnly", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("publicOnly", &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()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1678,51 +1240,32 @@ pub async fn get_group_post( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Returns a list of members that have requested to join the Group. -pub async fn get_group_requests( - configuration: &configuration::Configuration, - group_id: &str, - n: Option, - offset: Option, - blocked: Option, -) -> Result, Error> { +pub async fn get_group_requests(configuration: &configuration::Configuration, group_id: &str, n: Option, offset: Option, blocked: Option) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/requests", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/requests", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = - local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_str) = blocked { - local_var_req_builder = - local_var_req_builder.query(&[("blocked", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("blocked", &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()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1734,37 +1277,23 @@ pub async fn get_group_requests( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Returns a Group Role by ID. -pub async fn get_group_roles( - configuration: &configuration::Configuration, - group_id: &str, -) -> Result, Error> { +pub async fn get_group_roles(configuration: &configuration::Configuration, group_id: &str) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/roles", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/roles", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1776,37 +1305,23 @@ pub async fn get_group_roles( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Join a Group by ID and returns the member object. -pub async fn join_group( - configuration: &configuration::Configuration, - group_id: &str, -) -> Result> { +pub async fn join_group(configuration: &configuration::Configuration, group_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/join", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/join", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1818,39 +1333,23 @@ pub async fn join_group( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Kicks a Group Member from the Group. The current user must have the \"Remove Group Members\" permission. -pub async fn kick_group_member( - configuration: &configuration::Configuration, - group_id: &str, - user_id: &str, -) -> Result<(), Error> { +pub async fn kick_group_member(configuration: &configuration::Configuration, group_id: &str, user_id: &str) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/members/{userId}", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id), - userId = crate::apis::urlencode(user_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/members/{userId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), userId=crate::apis::urlencode(user_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1862,37 +1361,23 @@ pub async fn kick_group_member( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Leave a group by ID. -pub async fn leave_group( - configuration: &configuration::Configuration, - group_id: &str, -) -> Result<(), Error> { +pub async fn leave_group(configuration: &configuration::Configuration, group_id: &str) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/leave", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/leave", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1904,41 +1389,23 @@ pub async fn leave_group( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Removes a Role from a Group Member -pub async fn remove_group_member_role( - configuration: &configuration::Configuration, - group_id: &str, - user_id: &str, - group_role_id: &str, -) -> Result, Error> { +pub async fn remove_group_member_role(configuration: &configuration::Configuration, group_id: &str, user_id: &str, group_role_id: &str) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/members/{userId}/roles/{groupRoleId}", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id), - userId = crate::apis::urlencode(user_id), - groupRoleId = crate::apis::urlencode(group_role_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/members/{userId}/roles/{groupRoleId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), userId=crate::apis::urlencode(user_id), groupRoleId=crate::apis::urlencode(group_role_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()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -1950,40 +1417,23 @@ pub async fn remove_group_member_role( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Responds to a Group Join Request with Accept/Deny -pub async fn respond_group_join_request( - configuration: &configuration::Configuration, - group_id: &str, - user_id: &str, - respond_group_join_request: models::RespondGroupJoinRequest, -) -> Result<(), Error> { +pub async fn respond_group_join_request(configuration: &configuration::Configuration, group_id: &str, user_id: &str, respond_group_join_request: models::RespondGroupJoinRequest) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/requests/{userId}", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id), - userId = crate::apis::urlencode(user_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/requests/{userId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), userId=crate::apis::urlencode(user_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&respond_group_join_request); @@ -1996,46 +1446,32 @@ pub async fn respond_group_join_request( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Searches Groups by name or shortCode -pub async fn search_groups( - configuration: &configuration::Configuration, - query: Option<&str>, - offset: Option, - n: Option, -) -> Result, Error> { +pub async fn search_groups(configuration: &configuration::Configuration, query: Option<&str>, offset: Option, n: Option) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/groups", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = query { - local_var_req_builder = - local_var_req_builder.query(&[("query", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("query", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = - local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &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()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -2047,39 +1483,23 @@ pub async fn search_groups( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Unbans a user from a Group. -pub async fn unban_group_member( - configuration: &configuration::Configuration, - group_id: &str, - user_id: &str, -) -> Result> { +pub async fn unban_group_member(configuration: &configuration::Configuration, group_id: &str, user_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/bans/{userId}", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id), - userId = crate::apis::urlencode(user_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/bans/{userId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), userId=crate::apis::urlencode(user_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -2091,38 +1511,23 @@ pub async fn unban_group_member( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Updates a Group and returns it. -pub async fn update_group( - configuration: &configuration::Configuration, - group_id: &str, - update_group_request: Option, -) -> Result> { +pub async fn update_group(configuration: &configuration::Configuration, group_id: &str, update_group_request: Option) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_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()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&update_group_request); @@ -2135,40 +1540,23 @@ pub async fn update_group( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Updates a gallery for a Group. -pub async fn update_group_gallery( - configuration: &configuration::Configuration, - group_id: &str, - group_gallery_id: &str, - update_group_gallery_request: Option, -) -> Result> { +pub async fn update_group_gallery(configuration: &configuration::Configuration, group_id: &str, group_gallery_id: &str, update_group_gallery_request: Option) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/galleries/{groupGalleryId}", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id), - groupGalleryId = crate::apis::urlencode(group_gallery_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/galleries/{groupGalleryId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), groupGalleryId=crate::apis::urlencode(group_gallery_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()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&update_group_gallery_request); @@ -2181,40 +1569,23 @@ pub async fn update_group_gallery( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Updates a Group Member -pub async fn update_group_member( - configuration: &configuration::Configuration, - group_id: &str, - user_id: &str, - update_group_member_request: Option, -) -> Result> { +pub async fn update_group_member(configuration: &configuration::Configuration, group_id: &str, user_id: &str, update_group_member_request: Option) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/members/{userId}", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id), - userId = crate::apis::urlencode(user_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/members/{userId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), userId=crate::apis::urlencode(user_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&update_group_member_request); @@ -2227,40 +1598,23 @@ pub async fn update_group_member( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Edits a Group post -pub async fn update_group_post( - configuration: &configuration::Configuration, - group_id: &str, - notification_id: &str, - create_group_post_request: models::CreateGroupPostRequest, -) -> Result> { +pub async fn update_group_post(configuration: &configuration::Configuration, group_id: &str, notification_id: &str, create_group_post_request: models::CreateGroupPostRequest) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/posts/{notificationId}", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id), - notificationId = crate::apis::urlencode(notification_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/posts/{notificationId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), notificationId=crate::apis::urlencode(notification_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&create_group_post_request); @@ -2273,40 +1627,23 @@ pub async fn update_group_post( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Updates a group role by ID. -pub async fn update_group_role( - configuration: &configuration::Configuration, - group_id: &str, - group_role_id: &str, - update_group_role_request: Option, -) -> Result, Error> { +pub async fn update_group_role(configuration: &configuration::Configuration, group_id: &str, group_role_id: &str, update_group_role_request: Option) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/groups/{groupId}/roles/{groupRoleId}", - local_var_configuration.base_path, - groupId = crate::apis::urlencode(group_id), - groupRoleId = crate::apis::urlencode(group_role_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/groups/{groupId}/roles/{groupRoleId}", local_var_configuration.base_path, groupId=crate::apis::urlencode(group_id), groupRoleId=crate::apis::urlencode(group_role_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()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&update_group_role_request); @@ -2319,13 +1656,9 @@ pub async fn update_group_role( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } + diff --git a/src/apis/instances_api.rs b/src/apis/instances_api.rs index 89a55ca..fdff048 100644 --- a/src/apis/instances_api.rs +++ b/src/apis/instances_api.rs @@ -6,10 +6,12 @@ * Generated by: https://openapi-generator.tech */ -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; + use reqwest; use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + /// struct for typed errors of method [`close_instance`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -62,38 +64,24 @@ pub enum SendSelfInviteError { UnknownValue(serde_json::Value), } + /// Close an instance or update the closedAt time when it will be closed. You can only close an instance if the ownerId is yourself or if the instance owner is a group and you have the `group-instance-moderate` permission. -pub async fn close_instance( - configuration: &configuration::Configuration, - world_id: &str, - instance_id: &str, - hard_close: Option, - closed_at: Option, -) -> Result> { +pub async fn close_instance(configuration: &configuration::Configuration, world_id: &str, instance_id: &str, hard_close: Option, closed_at: Option) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/instances/{worldId}:{instanceId}", - local_var_configuration.base_path, - worldId = crate::apis::urlencode(world_id), - instanceId = crate::apis::urlencode(instance_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/instances/{worldId}:{instanceId}", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id), instanceId=crate::apis::urlencode(instance_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_str) = hard_close { - local_var_req_builder = - local_var_req_builder.query(&[("hardClose", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("hardClose", &local_var_str.to_string())]); } if let Some(ref local_var_str) = closed_at { - local_var_req_builder = - local_var_req_builder.query(&[("closedAt", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("closedAt", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -105,33 +93,23 @@ pub async fn close_instance( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Create an instance -pub async fn create_instance( - configuration: &configuration::Configuration, - create_instance_request: models::CreateInstanceRequest, -) -> Result> { +pub async fn create_instance(configuration: &configuration::Configuration, create_instance_request: models::CreateInstanceRequest) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/instances", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&create_instance_request); @@ -144,39 +122,23 @@ pub async fn create_instance( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Returns an instance. Please read [Instances Tutorial](https://vrchatapi.github.io/tutorials/instances/) for more information on Instances. If an invalid instanceId is provided, this endpoint will simply return \"null\"! -pub async fn get_instance( - configuration: &configuration::Configuration, - world_id: &str, - instance_id: &str, -) -> Result> { +pub async fn get_instance(configuration: &configuration::Configuration, world_id: &str, instance_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/instances/{worldId}:{instanceId}", - local_var_configuration.base_path, - worldId = crate::apis::urlencode(world_id), - instanceId = crate::apis::urlencode(instance_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/instances/{worldId}:{instanceId}", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id), instanceId=crate::apis::urlencode(instance_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -188,37 +150,23 @@ pub async fn get_instance( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Returns an instance. Please read [Instances Tutorial](https://vrchatapi.github.io/tutorials/instances/) for more information on Instances. -pub async fn get_instance_by_short_name( - configuration: &configuration::Configuration, - short_name: &str, -) -> Result> { +pub async fn get_instance_by_short_name(configuration: &configuration::Configuration, short_name: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/instances/s/{shortName}", - local_var_configuration.base_path, - shortName = crate::apis::urlencode(short_name) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/instances/s/{shortName}", local_var_configuration.base_path, shortName=crate::apis::urlencode(short_name)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -230,39 +178,23 @@ pub async fn get_instance_by_short_name( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Returns an instance short name. -pub async fn get_short_name( - configuration: &configuration::Configuration, - world_id: &str, - instance_id: &str, -) -> Result> { +pub async fn get_short_name(configuration: &configuration::Configuration, world_id: &str, instance_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/instances/{worldId}:{instanceId}/shortName", - local_var_configuration.base_path, - worldId = crate::apis::urlencode(world_id), - instanceId = crate::apis::urlencode(instance_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/instances/{worldId}:{instanceId}/shortName", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id), instanceId=crate::apis::urlencode(instance_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -274,39 +206,23 @@ pub async fn get_short_name( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Sends an invite to the instance to yourself. -pub async fn send_self_invite( - configuration: &configuration::Configuration, - world_id: &str, - instance_id: &str, -) -> Result> { +pub async fn send_self_invite(configuration: &configuration::Configuration, world_id: &str, instance_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/instances/{worldId}:{instanceId}/invite", - local_var_configuration.base_path, - worldId = crate::apis::urlencode(world_id), - instanceId = crate::apis::urlencode(instance_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/instances/{worldId}:{instanceId}/invite", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id), instanceId=crate::apis::urlencode(instance_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -318,13 +234,9 @@ pub async fn send_self_invite( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } + diff --git a/src/apis/invite_api.rs b/src/apis/invite_api.rs index 01d7e4c..5e7a82b 100644 --- a/src/apis/invite_api.rs +++ b/src/apis/invite_api.rs @@ -6,10 +6,12 @@ * Generated by: https://openapi-generator.tech */ -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; + use reqwest; use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + /// struct for typed errors of method [`get_invite_message`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -84,30 +86,18 @@ pub enum UpdateInviteMessageError { UnknownValue(serde_json::Value), } + /// Returns a single Invite Message. This returns the exact same information but less than `getInviteMessages`. Admin Credentials are required to view messages of other users! Message type refers to a different collection of messages, used during different types of responses. * `message` = Message during a normal invite * `response` = Message when replying to a message * `request` = Message when requesting an invite * `requestResponse` = Message when replying to a request for invite -pub async fn get_invite_message( - configuration: &configuration::Configuration, - user_id: &str, - message_type: models::InviteMessageType, - slot: i32, -) -> Result> { +pub async fn get_invite_message(configuration: &configuration::Configuration, user_id: &str, message_type: models::InviteMessageType, slot: i32) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/message/{userId}/{messageType}/{slot}", - local_var_configuration.base_path, - userId = crate::apis::urlencode(user_id), - messageType = message_type.to_string(), - slot = slot - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/message/{userId}/{messageType}/{slot}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id), messageType=message_type.to_string(), slot=slot); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -119,39 +109,23 @@ pub async fn get_invite_message( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Returns a list of all the users Invite Messages. Admin Credentials are required to view messages of other users! Message type refers to a different collection of messages, used during different types of responses. * `message` = Message during a normal invite * `response` = Message when replying to a message * `request` = Message when requesting an invite * `requestResponse` = Message when replying to a request for invite -pub async fn get_invite_messages( - configuration: &configuration::Configuration, - user_id: &str, - message_type: models::InviteMessageType, -) -> Result, Error> { +pub async fn get_invite_messages(configuration: &configuration::Configuration, user_id: &str, message_type: models::InviteMessageType) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/message/{userId}/{messageType}", - local_var_configuration.base_path, - userId = crate::apis::urlencode(user_id), - messageType = message_type.to_string() - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/message/{userId}/{messageType}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id), messageType=message_type.to_string()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -163,39 +137,23 @@ pub async fn get_invite_messages( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Sends self an invite to an instance -pub async fn invite_myself_to( - configuration: &configuration::Configuration, - world_id: &str, - instance_id: &str, -) -> Result> { +pub async fn invite_myself_to(configuration: &configuration::Configuration, world_id: &str, instance_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/invite/myself/to/{worldId}:{instanceId}", - local_var_configuration.base_path, - worldId = crate::apis::urlencode(world_id), - instanceId = crate::apis::urlencode(instance_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/invite/myself/to/{worldId}:{instanceId}", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id), instanceId=crate::apis::urlencode(instance_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -207,38 +165,23 @@ pub async fn invite_myself_to( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Sends an invite to a user. Returns the Notification of type `invite` that was sent. -pub async fn invite_user( - configuration: &configuration::Configuration, - user_id: &str, - invite_request: models::InviteRequest, -) -> Result> { +pub async fn invite_user(configuration: &configuration::Configuration, user_id: &str, invite_request: models::InviteRequest) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/invite/{userId}", - local_var_configuration.base_path, - userId = crate::apis::urlencode(user_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/invite/{userId}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&invite_request); @@ -251,38 +194,23 @@ pub async fn invite_user( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Requests an invite from a user. Returns the Notification of type `requestInvite` that was sent. -pub async fn request_invite( - configuration: &configuration::Configuration, - user_id: &str, - request_invite_request: Option, -) -> Result> { +pub async fn request_invite(configuration: &configuration::Configuration, user_id: &str, request_invite_request: Option) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/requestInvite/{userId}", - local_var_configuration.base_path, - userId = crate::apis::urlencode(user_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/requestInvite/{userId}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&request_invite_request); @@ -295,41 +223,23 @@ pub async fn request_invite( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Resets a single Invite Message back to its original message, and then returns a list of all of them. Admin Credentials are required to update messages of other users! Resetting a message respects the rate-limit, so it is not possible to reset within the 60 minutes countdown. Resetting it does however not set the rate-limit to 60 like when editing it. It is possible to edit it right after resetting it. Trying to edit a message before the cooldown timer expires results in a 429 \"Too Fast Error\". Message type refers to a different collection of messages, used during different types of responses. * `message` = Message during a normal invite * `response` = Message when replying to a message * `request` = Message when requesting an invite * `requestResponse` = Message when replying to a request for invite The DELETE endpoint does not have/require any request body. -pub async fn reset_invite_message( - configuration: &configuration::Configuration, - user_id: &str, - message_type: models::InviteMessageType, - slot: i32, -) -> Result, Error> { +pub async fn reset_invite_message(configuration: &configuration::Configuration, user_id: &str, message_type: models::InviteMessageType, slot: i32) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/message/{userId}/{messageType}/{slot}", - local_var_configuration.base_path, - userId = crate::apis::urlencode(user_id), - messageType = message_type.to_string(), - slot = slot - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/message/{userId}/{messageType}/{slot}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id), messageType=message_type.to_string(), slot=slot); + let 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()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -341,38 +251,23 @@ pub async fn reset_invite_message( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Respond to an invite request by sending a world invite to the requesting user. `:notificationId` is the ID of the requesting notification. -pub async fn respond_invite( - configuration: &configuration::Configuration, - notification_id: &str, - invite_response: models::InviteResponse, -) -> Result> { +pub async fn respond_invite(configuration: &configuration::Configuration, notification_id: &str, invite_response: models::InviteResponse) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/invite/{notificationId}/response", - local_var_configuration.base_path, - notificationId = crate::apis::urlencode(notification_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/invite/{notificationId}/response", local_var_configuration.base_path, notificationId=crate::apis::urlencode(notification_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&invite_response); @@ -385,42 +280,23 @@ pub async fn respond_invite( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Updates a single Invite Message and then returns a list of all of them. Admin Credentials are required to update messages of other users! Updating a message automatically sets the cooldown timer to 60 minutes. Trying to edit a message before the cooldown timer expires results in a 429 \"Too Fast Error\". Message type refers to a different collection of messages, used during different types of responses. * `message` = Message during a normal invite * `response` = Message when replying to a message * `request` = Message when requesting an invite * `requestResponse` = Message when replying to a request for invite -pub async fn update_invite_message( - configuration: &configuration::Configuration, - user_id: &str, - message_type: models::InviteMessageType, - slot: i32, - update_invite_message_request: Option, -) -> Result, Error> { +pub async fn update_invite_message(configuration: &configuration::Configuration, user_id: &str, message_type: models::InviteMessageType, slot: i32, update_invite_message_request: Option) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/message/{userId}/{messageType}/{slot}", - local_var_configuration.base_path, - userId = crate::apis::urlencode(user_id), - messageType = message_type.to_string(), - slot = slot - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/message/{userId}/{messageType}/{slot}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id), messageType=message_type.to_string(), slot=slot); + let 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()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&update_invite_message_request); @@ -433,13 +309,9 @@ pub async fn update_invite_message( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } + diff --git a/src/apis/mod.rs b/src/apis/mod.rs index 7b80d97..9e080ff 100644 --- a/src/apis/mod.rs +++ b/src/apis/mod.rs @@ -16,7 +16,7 @@ pub enum Error { ResponseError(ResponseContent), } -impl fmt::Display for Error { +impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let (module, e) = match self { Error::Reqwest(e) => ("reqwest", e.to_string()), @@ -28,7 +28,7 @@ impl fmt::Display for Error { } } -impl error::Error for Error { +impl error::Error for Error { fn source(&self) -> Option<&(dyn error::Error + 'static)> { Some(match self { Error::Reqwest(e) => e, @@ -39,19 +39,19 @@ impl error::Error for Error { } } -impl From for Error { +impl From for Error { fn from(e: reqwest::Error) -> Self { Error::Reqwest(e) } } -impl From for Error { +impl From for Error { fn from(e: serde_json::Error) -> Self { Error::Serde(e) } } -impl From for Error { +impl From for Error { fn from(e: std::io::Error) -> Self { Error::Io(e) } @@ -78,10 +78,8 @@ pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String value, )); } - } - serde_json::Value::String(s) => { - params.push((format!("{}[{}]", prefix, key), s.clone())) - } + }, + serde_json::Value::String(s) => params.push((format!("{}[{}]", prefix, key), s.clone())), _ => params.push((format!("{}[{}]", prefix, key), value.to_string())), } } diff --git a/src/apis/notifications_api.rs b/src/apis/notifications_api.rs index be73fb3..eacc744 100644 --- a/src/apis/notifications_api.rs +++ b/src/apis/notifications_api.rs @@ -6,10 +6,12 @@ * Generated by: https://openapi-generator.tech */ -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; + use reqwest; use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + /// struct for typed errors of method [`accept_friend_request`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -52,26 +54,18 @@ pub enum MarkNotificationAsReadError { UnknownValue(serde_json::Value), } + /// Accept a friend request by notification `frq_` ID. Friend requests can be found using the NotificationsAPI `getNotifications` by filtering of type `friendRequest`. -pub async fn accept_friend_request( - configuration: &configuration::Configuration, - notification_id: &str, -) -> Result> { +pub async fn accept_friend_request(configuration: &configuration::Configuration, notification_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/auth/user/notifications/{notificationId}/accept", - local_var_configuration.base_path, - notificationId = crate::apis::urlencode(notification_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/auth/user/notifications/{notificationId}/accept", local_var_configuration.base_path, notificationId=crate::apis::urlencode(notification_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -83,35 +77,23 @@ pub async fn accept_friend_request( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Clear **all** notifications. -pub async fn clear_notifications( - configuration: &configuration::Configuration, -) -> Result> { +pub async fn clear_notifications(configuration: &configuration::Configuration, ) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/auth/user/notifications/clear", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/auth/user/notifications/clear", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -123,37 +105,23 @@ pub async fn clear_notifications( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Delete a notification. -pub async fn delete_notification( - configuration: &configuration::Configuration, - notification_id: &str, -) -> Result> { +pub async fn delete_notification(configuration: &configuration::Configuration, notification_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/auth/user/notifications/{notificationId}/hide", - local_var_configuration.base_path, - notificationId = crate::apis::urlencode(notification_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/auth/user/notifications/{notificationId}/hide", local_var_configuration.base_path, notificationId=crate::apis::urlencode(notification_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -165,64 +133,41 @@ pub async fn delete_notification( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Retrieve all of the current user's notifications. -pub async fn get_notifications( - configuration: &configuration::Configuration, - r#type: Option<&str>, - sent: Option, - hidden: Option, - after: Option<&str>, - n: Option, - offset: Option, -) -> Result, Error> { +pub async fn get_notifications(configuration: &configuration::Configuration, r#type: Option<&str>, sent: Option, hidden: Option, after: Option<&str>, n: Option, offset: Option) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/auth/user/notifications", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/auth/user/notifications", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = r#type { - local_var_req_builder = - local_var_req_builder.query(&[("type", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("type", &local_var_str.to_string())]); } if let Some(ref local_var_str) = sent { - local_var_req_builder = - local_var_req_builder.query(&[("sent", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("sent", &local_var_str.to_string())]); } if let Some(ref local_var_str) = hidden { - local_var_req_builder = - local_var_req_builder.query(&[("hidden", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("hidden", &local_var_str.to_string())]); } if let Some(ref local_var_str) = after { - local_var_req_builder = - local_var_req_builder.query(&[("after", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("after", &local_var_str.to_string())]); } if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = - local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -234,37 +179,23 @@ pub async fn get_notifications( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Mark a notification as seen. -pub async fn mark_notification_as_read( - configuration: &configuration::Configuration, - notification_id: &str, -) -> Result> { +pub async fn mark_notification_as_read(configuration: &configuration::Configuration, notification_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/auth/user/notifications/{notificationId}/see", - local_var_configuration.base_path, - notificationId = crate::apis::urlencode(notification_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/auth/user/notifications/{notificationId}/see", local_var_configuration.base_path, notificationId=crate::apis::urlencode(notification_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -276,13 +207,9 @@ pub async fn mark_notification_as_read( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } + diff --git a/src/apis/permissions_api.rs b/src/apis/permissions_api.rs index 19df323..4a02727 100644 --- a/src/apis/permissions_api.rs +++ b/src/apis/permissions_api.rs @@ -6,10 +6,12 @@ * Generated by: https://openapi-generator.tech */ -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; + use reqwest; use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + /// struct for typed errors of method [`get_assigned_permissions`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -27,21 +29,18 @@ pub enum GetPermissionError { UnknownValue(serde_json::Value), } + /// Returns a list of all permissions currently granted by the user. Permissions are assigned e.g. by subscribing to VRC+. -pub async fn get_assigned_permissions( - configuration: &configuration::Configuration, -) -> Result, Error> { +pub async fn get_assigned_permissions(configuration: &configuration::Configuration, ) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/auth/permissions", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -53,37 +52,23 @@ pub async fn get_assigned_permissions( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Returns a single permission. This endpoint is pretty useless, as it returns the exact same information as `/auth/permissions`. -pub async fn get_permission( - configuration: &configuration::Configuration, - permission_id: &str, -) -> Result> { +pub async fn get_permission(configuration: &configuration::Configuration, permission_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/permissions/{permissionId}", - local_var_configuration.base_path, - permissionId = crate::apis::urlencode(permission_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/permissions/{permissionId}", local_var_configuration.base_path, permissionId=crate::apis::urlencode(permission_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -95,13 +80,9 @@ pub async fn get_permission( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } + diff --git a/src/apis/playermoderation_api.rs b/src/apis/playermoderation_api.rs index 925bf68..adafede 100644 --- a/src/apis/playermoderation_api.rs +++ b/src/apis/playermoderation_api.rs @@ -6,10 +6,12 @@ * Generated by: https://openapi-generator.tech */ -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; + use reqwest; use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + /// struct for typed errors of method [`clear_all_player_moderations`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -61,24 +63,18 @@ pub enum UnmoderateUserError { UnknownValue(serde_json::Value), } + /// ⚠️ **This will delete every single player moderation you've ever made.** -pub async fn clear_all_player_moderations( - configuration: &configuration::Configuration, -) -> Result> { +pub async fn clear_all_player_moderations(configuration: &configuration::Configuration, ) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/auth/user/playermoderations", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/auth/user/playermoderations", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -90,37 +86,23 @@ pub async fn clear_all_player_moderations( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Deletes a specific player moderation based on it's `pmod_` ID. The website uses `unmoderateUser` instead. You can delete the same player moderation multiple times successfully. -pub async fn delete_player_moderation( - configuration: &configuration::Configuration, - player_moderation_id: &str, -) -> Result> { +pub async fn delete_player_moderation(configuration: &configuration::Configuration, player_moderation_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/auth/user/playermoderations/{playerModerationId}", - local_var_configuration.base_path, - playerModerationId = crate::apis::urlencode(player_moderation_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/auth/user/playermoderations/{playerModerationId}", local_var_configuration.base_path, playerModerationId=crate::apis::urlencode(player_moderation_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -132,37 +114,23 @@ pub async fn delete_player_moderation( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Returns a single Player Moderation. This returns the exact same amount of information as the more generalised `getPlayerModerations`. -pub async fn get_player_moderation( - configuration: &configuration::Configuration, - player_moderation_id: &str, -) -> Result> { +pub async fn get_player_moderation(configuration: &configuration::Configuration, player_moderation_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/auth/user/playermoderations/{playerModerationId}", - local_var_configuration.base_path, - playerModerationId = crate::apis::urlencode(player_moderation_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/auth/user/playermoderations/{playerModerationId}", local_var_configuration.base_path, playerModerationId=crate::apis::urlencode(player_moderation_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -174,45 +142,29 @@ pub async fn get_player_moderation( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Returns a list of all player moderations made by **you**. This endpoint does not have pagination, and will return *all* results. Use query parameters to limit your query if needed. -pub async fn get_player_moderations( - configuration: &configuration::Configuration, - r#type: Option<&str>, - target_user_id: Option<&str>, -) -> Result, Error> { +pub async fn get_player_moderations(configuration: &configuration::Configuration, r#type: Option<&str>, target_user_id: Option<&str>) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/auth/user/playermoderations", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/auth/user/playermoderations", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = r#type { - local_var_req_builder = - local_var_req_builder.query(&[("type", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("type", &local_var_str.to_string())]); } if let Some(ref local_var_str) = target_user_id { - local_var_req_builder = - local_var_req_builder.query(&[("targetUserId", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("targetUserId", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -224,36 +176,23 @@ pub async fn get_player_moderations( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Moderate a user, e.g. unmute them or show their avatar. Please see the [Player Moderation docs](https://vrchatapi.github.io/docs/api/#tag--playermoderation) on what playerModerations are, and how they differ from staff moderations. -pub async fn moderate_user( - configuration: &configuration::Configuration, - moderate_user_request: models::ModerateUserRequest, -) -> Result> { +pub async fn moderate_user(configuration: &configuration::Configuration, moderate_user_request: models::ModerateUserRequest) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/auth/user/playermoderations", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/auth/user/playermoderations", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&moderate_user_request); @@ -266,36 +205,23 @@ pub async fn moderate_user( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Removes a player moderation previously added through `moderateUser`. E.g if you previously have shown their avatar, but now want to reset it to default. -pub async fn unmoderate_user( - configuration: &configuration::Configuration, - moderate_user_request: models::ModerateUserRequest, -) -> Result> { +pub async fn unmoderate_user(configuration: &configuration::Configuration, moderate_user_request: models::ModerateUserRequest) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/auth/user/unplayermoderate", - local_var_configuration.base_path - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/auth/user/unplayermoderate", local_var_configuration.base_path); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&moderate_user_request); @@ -308,13 +234,9 @@ pub async fn unmoderate_user( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } + diff --git a/src/apis/system_api.rs b/src/apis/system_api.rs index c7020b3..cb965d1 100644 --- a/src/apis/system_api.rs +++ b/src/apis/system_api.rs @@ -6,10 +6,12 @@ * Generated by: https://openapi-generator.tech */ -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; + use reqwest; use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + /// struct for typed errors of method [`get_config`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -62,21 +64,18 @@ pub enum GetSystemTimeError { UnknownValue(serde_json::Value), } + /// API config contains configuration that the clients needs to work properly. Currently the most important value here is `clientApiKey` which is used for all other API endpoints. -pub async fn get_config( - configuration: &configuration::Configuration, -) -> Result> { +pub async fn get_config(configuration: &configuration::Configuration, ) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/config", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -88,42 +87,29 @@ pub async fn get_config( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Fetches the CSS code to the frontend React website. -pub async fn get_css( - configuration: &configuration::Configuration, - variant: Option<&str>, - branch: Option<&str>, -) -> Result> { +pub async fn get_css(configuration: &configuration::Configuration, variant: Option<&str>, branch: Option<&str>) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/css/app.css", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = variant { - local_var_req_builder = - local_var_req_builder.query(&[("variant", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("variant", &local_var_str.to_string())]); } if let Some(ref local_var_str) = branch { - local_var_req_builder = - local_var_req_builder.query(&[("branch", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("branch", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -136,30 +122,22 @@ pub async fn get_css( serde_json::from_str(&local_var_content).map_err(Error::from) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Returns the current number of online users. **NOTE:** The response type is not a JSON object, but a simple JSON integer. -pub async fn get_current_online_users( - configuration: &configuration::Configuration, -) -> Result> { +pub async fn get_current_online_users(configuration: &configuration::Configuration, ) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/visits", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -171,32 +149,23 @@ pub async fn get_current_online_users( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// ~~Gets the overall health status, the server name, and the current build version tag of the API.~~ **DEPRECATED:** VRChat has suddenly restricted this endpoint for unknown reasons, and now always return 401 Unauthorized. -pub async fn get_health( - configuration: &configuration::Configuration, -) -> Result> { +pub async fn get_health(configuration: &configuration::Configuration, ) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/health", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -208,42 +177,29 @@ pub async fn get_health( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// IPS (Info Push System) is a system for VRChat to push out dynamic information to the client. This is primarily used by the Quick-Menu info banners, but can also be used to e.g. alert you to update your game to the latest version. `include` is used to query what Information Pushes should be included in the response. If include is missing or empty, then no notices will normally be returned. This is an \"any of\" search. `require` is used to limit what Information Pushes should be included in the response. This is usually used in combination with `include`, and is an \"all of\" search. -pub async fn get_info_push( - configuration: &configuration::Configuration, - require: Option<&str>, - include: Option<&str>, -) -> Result, Error> { +pub async fn get_info_push(configuration: &configuration::Configuration, require: Option<&str>, include: Option<&str>) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/infoPush", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = require { - local_var_req_builder = - local_var_req_builder.query(&[("require", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("require", &local_var_str.to_string())]); } if let Some(ref local_var_str) = include { - local_var_req_builder = - local_var_req_builder.query(&[("include", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("include", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -255,42 +211,29 @@ pub async fn get_info_push( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Fetches the JavaScript code to the frontend React website. -pub async fn get_java_script( - configuration: &configuration::Configuration, - variant: Option<&str>, - branch: Option<&str>, -) -> Result> { +pub async fn get_java_script(configuration: &configuration::Configuration, variant: Option<&str>, branch: Option<&str>) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/js/app.js", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = variant { - local_var_req_builder = - local_var_req_builder.query(&[("variant", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("variant", &local_var_str.to_string())]); } if let Some(ref local_var_str) = branch { - local_var_req_builder = - local_var_req_builder.query(&[("branch", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("branch", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -302,32 +245,23 @@ pub async fn get_java_script( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Returns the current time of the API server. **NOTE:** The response type is not a JSON object, but a simple JSON string. -pub async fn get_system_time( - configuration: &configuration::Configuration, -) -> Result> { +pub async fn get_system_time(configuration: &configuration::Configuration, ) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/time", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -339,13 +273,9 @@ pub async fn get_system_time( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } + diff --git a/src/apis/users_api.rs b/src/apis/users_api.rs index 7b733b0..3c85d37 100644 --- a/src/apis/users_api.rs +++ b/src/apis/users_api.rs @@ -6,10 +6,12 @@ * Generated by: https://openapi-generator.tech */ -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; + use reqwest; use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + /// struct for typed errors of method [`get_user`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -68,26 +70,18 @@ pub enum UpdateUserError { UnknownValue(serde_json::Value), } + /// Get public user information about a specific user using their ID. -pub async fn get_user( - configuration: &configuration::Configuration, - user_id: &str, -) -> Result> { +pub async fn get_user(configuration: &configuration::Configuration, user_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/users/{userId}", - local_var_configuration.base_path, - userId = crate::apis::urlencode(user_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/users/{userId}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -100,35 +94,22 @@ pub async fn get_user( serde_json::from_str(&local_var_content).map_err(Error::from) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// ~~Get public user information about a specific user using their name.~~ **DEPRECATED:** VRChat API no longer return usernames of other users. [See issue by Tupper for more information](https://github.com/pypy-vrc/VRCX/issues/429). This endpoint now require Admin Credentials. -pub async fn get_user_by_name( - configuration: &configuration::Configuration, - username: &str, -) -> Result> { +pub async fn get_user_by_name(configuration: &configuration::Configuration, username: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/users/{username}/name", - local_var_configuration.base_path, - username = crate::apis::urlencode(username) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/users/{username}/name", local_var_configuration.base_path, username=crate::apis::urlencode(username)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -140,37 +121,23 @@ pub async fn get_user_by_name( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Returns a list of Groups the user has requested to be invited into. -pub async fn get_user_group_requests( - configuration: &configuration::Configuration, - user_id: &str, -) -> Result, Error> { +pub async fn get_user_group_requests(configuration: &configuration::Configuration, user_id: &str) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/users/{userId}/groups/requested", - local_var_configuration.base_path, - userId = crate::apis::urlencode(user_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/users/{userId}/groups/requested", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -182,37 +149,23 @@ pub async fn get_user_group_requests( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Get user's public groups -pub async fn get_user_groups( - configuration: &configuration::Configuration, - user_id: &str, -) -> Result, Error> { +pub async fn get_user_groups(configuration: &configuration::Configuration, user_id: &str) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/users/{userId}/groups", - local_var_configuration.base_path, - userId = crate::apis::urlencode(user_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/users/{userId}/groups", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -224,37 +177,23 @@ pub async fn get_user_groups( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Returns the current group that the user is currently representing -pub async fn get_user_represented_group( - configuration: &configuration::Configuration, - user_id: &str, -) -> Result> { +pub async fn get_user_represented_group(configuration: &configuration::Configuration, user_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/users/{userId}/groups/represented", - local_var_configuration.base_path, - userId = crate::apis::urlencode(user_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/users/{userId}/groups/represented", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -266,51 +205,35 @@ pub async fn get_user_represented_group( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Search and list any users by text query -pub async fn search_users( - configuration: &configuration::Configuration, - search: Option<&str>, - developer_type: Option<&str>, - n: Option, - offset: Option, -) -> Result, Error> { +pub async fn search_users(configuration: &configuration::Configuration, search: Option<&str>, developer_type: Option<&str>, n: Option, offset: Option) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/users", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = search { - local_var_req_builder = - local_var_req_builder.query(&[("search", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]); } if let Some(ref local_var_str) = developer_type { - local_var_req_builder = - local_var_req_builder.query(&[("developerType", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("developerType", &local_var_str.to_string())]); } if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = - local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -322,38 +245,23 @@ pub async fn search_users( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Update a users information such as the email and birthday. -pub async fn update_user( - configuration: &configuration::Configuration, - user_id: &str, - update_user_request: Option, -) -> Result> { +pub async fn update_user(configuration: &configuration::Configuration, user_id: &str, update_user_request: Option) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/users/{userId}", - local_var_configuration.base_path, - userId = crate::apis::urlencode(user_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/users/{userId}", local_var_configuration.base_path, userId=crate::apis::urlencode(user_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&update_user_request); @@ -366,13 +274,9 @@ pub async fn update_user( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } + diff --git a/src/apis/worlds_api.rs b/src/apis/worlds_api.rs index aae5cb0..993304e 100644 --- a/src/apis/worlds_api.rs +++ b/src/apis/worlds_api.rs @@ -6,10 +6,12 @@ * Generated by: https://openapi-generator.tech */ -use super::{configuration, Error}; -use crate::{apis::ResponseContent, models}; + use reqwest; use serde::{Deserialize, Serialize}; +use crate::{apis::ResponseContent, models}; +use super::{Error, configuration}; + /// struct for typed errors of method [`create_world`] #[derive(Debug, Clone, Serialize, Deserialize)] @@ -123,22 +125,18 @@ pub enum UpdateWorldError { UnknownValue(serde_json::Value), } + /// Create a new world. This endpoint requires `assetUrl` to be a valid File object with `.vrcw` file extension, and `imageUrl` to be a valid File object with an image file extension. -pub async fn create_world( - configuration: &configuration::Configuration, - create_world_request: Option, -) -> Result> { +pub async fn create_world(configuration: &configuration::Configuration, create_world_request: Option) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/worlds", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&create_world_request); @@ -151,37 +149,23 @@ pub async fn create_world( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Delete a world. Notice a world is never fully \"deleted\", only its ReleaseStatus is set to \"hidden\" and the linked Files are deleted. The WorldID is permanently reserved. -pub async fn delete_world( - configuration: &configuration::Configuration, - world_id: &str, -) -> Result<(), Error> { +pub async fn delete_world(configuration: &configuration::Configuration, world_id: &str) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/worlds/{worldId}", - local_var_configuration.base_path, - worldId = crate::apis::urlencode(world_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/worlds/{worldId}", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -193,90 +177,59 @@ pub async fn delete_world( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Search and list currently Active worlds by query filters. -pub async fn get_active_worlds( - configuration: &configuration::Configuration, - featured: Option, - sort: Option, - n: Option, - order: Option, - offset: Option, - search: Option<&str>, - tag: Option<&str>, - notag: Option<&str>, - release_status: Option, - max_unity_version: Option<&str>, - min_unity_version: Option<&str>, - platform: Option<&str>, -) -> Result, Error> { +pub async fn get_active_worlds(configuration: &configuration::Configuration, featured: Option, sort: Option, n: Option, order: Option, offset: Option, search: Option<&str>, tag: Option<&str>, notag: Option<&str>, release_status: Option, max_unity_version: Option<&str>, min_unity_version: Option<&str>, platform: Option<&str>) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/worlds/active", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = featured { - local_var_req_builder = - local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); } if let Some(ref local_var_str) = sort { - local_var_req_builder = - local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); } if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = order { - local_var_req_builder = - local_var_req_builder.query(&[("order", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("order", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = - local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_str) = search { - local_var_req_builder = - local_var_req_builder.query(&[("search", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]); } if let Some(ref local_var_str) = tag { local_var_req_builder = local_var_req_builder.query(&[("tag", &local_var_str.to_string())]); } if let Some(ref local_var_str) = notag { - local_var_req_builder = - local_var_req_builder.query(&[("notag", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("notag", &local_var_str.to_string())]); } if let Some(ref local_var_str) = release_status { - local_var_req_builder = - local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]); } if let Some(ref local_var_str) = max_unity_version { - local_var_req_builder = - local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]); } if let Some(ref local_var_str) = min_unity_version { - local_var_req_builder = - local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]); } if let Some(ref local_var_str) = platform { - local_var_req_builder = - local_var_req_builder.query(&[("platform", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("platform", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -288,95 +241,62 @@ pub async fn get_active_worlds( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Search and list favorited worlds by query filters. -pub async fn get_favorited_worlds( - configuration: &configuration::Configuration, - featured: Option, - sort: Option, - n: Option, - order: Option, - offset: Option, - search: Option<&str>, - tag: Option<&str>, - notag: Option<&str>, - release_status: Option, - max_unity_version: Option<&str>, - min_unity_version: Option<&str>, - platform: Option<&str>, - user_id: Option<&str>, -) -> Result, Error> { +pub async fn get_favorited_worlds(configuration: &configuration::Configuration, featured: Option, sort: Option, n: Option, order: Option, offset: Option, search: Option<&str>, tag: Option<&str>, notag: Option<&str>, release_status: Option, max_unity_version: Option<&str>, min_unity_version: Option<&str>, platform: Option<&str>, user_id: Option<&str>) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/worlds/favorites", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = featured { - local_var_req_builder = - local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); } if let Some(ref local_var_str) = sort { - local_var_req_builder = - local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); } if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = order { - local_var_req_builder = - local_var_req_builder.query(&[("order", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("order", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = - local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_str) = search { - local_var_req_builder = - local_var_req_builder.query(&[("search", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]); } if let Some(ref local_var_str) = tag { local_var_req_builder = local_var_req_builder.query(&[("tag", &local_var_str.to_string())]); } if let Some(ref local_var_str) = notag { - local_var_req_builder = - local_var_req_builder.query(&[("notag", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("notag", &local_var_str.to_string())]); } if let Some(ref local_var_str) = release_status { - local_var_req_builder = - local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]); } if let Some(ref local_var_str) = max_unity_version { - local_var_req_builder = - local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]); } if let Some(ref local_var_str) = min_unity_version { - local_var_req_builder = - local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]); } if let Some(ref local_var_str) = platform { - local_var_req_builder = - local_var_req_builder.query(&[("platform", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("platform", &local_var_str.to_string())]); } if let Some(ref local_var_str) = user_id { - local_var_req_builder = - local_var_req_builder.query(&[("userId", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("userId", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -388,95 +308,62 @@ pub async fn get_favorited_worlds( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Search and list recently visited worlds by query filters. -pub async fn get_recent_worlds( - configuration: &configuration::Configuration, - featured: Option, - sort: Option, - n: Option, - order: Option, - offset: Option, - search: Option<&str>, - tag: Option<&str>, - notag: Option<&str>, - release_status: Option, - max_unity_version: Option<&str>, - min_unity_version: Option<&str>, - platform: Option<&str>, - user_id: Option<&str>, -) -> Result, Error> { +pub async fn get_recent_worlds(configuration: &configuration::Configuration, featured: Option, sort: Option, n: Option, order: Option, offset: Option, search: Option<&str>, tag: Option<&str>, notag: Option<&str>, release_status: Option, max_unity_version: Option<&str>, min_unity_version: Option<&str>, platform: Option<&str>, user_id: Option<&str>) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/worlds/recent", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = featured { - local_var_req_builder = - local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); } if let Some(ref local_var_str) = sort { - local_var_req_builder = - local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); } if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = order { - local_var_req_builder = - local_var_req_builder.query(&[("order", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("order", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = - local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_str) = search { - local_var_req_builder = - local_var_req_builder.query(&[("search", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]); } if let Some(ref local_var_str) = tag { local_var_req_builder = local_var_req_builder.query(&[("tag", &local_var_str.to_string())]); } if let Some(ref local_var_str) = notag { - local_var_req_builder = - local_var_req_builder.query(&[("notag", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("notag", &local_var_str.to_string())]); } if let Some(ref local_var_str) = release_status { - local_var_req_builder = - local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]); } if let Some(ref local_var_str) = max_unity_version { - local_var_req_builder = - local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]); } if let Some(ref local_var_str) = min_unity_version { - local_var_req_builder = - local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]); } if let Some(ref local_var_str) = platform { - local_var_req_builder = - local_var_req_builder.query(&[("platform", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("platform", &local_var_str.to_string())]); } if let Some(ref local_var_str) = user_id { - local_var_req_builder = - local_var_req_builder.query(&[("userId", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("userId", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -488,37 +375,23 @@ pub async fn get_recent_worlds( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Get information about a specific World. Works unauthenticated but when so will always return `0` for certain fields. -pub async fn get_world( - configuration: &configuration::Configuration, - world_id: &str, -) -> Result> { +pub async fn get_world(configuration: &configuration::Configuration, world_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/worlds/{worldId}", - local_var_configuration.base_path, - worldId = crate::apis::urlencode(world_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/worlds/{worldId}", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -531,37 +404,22 @@ pub async fn get_world( serde_json::from_str(&local_var_content).map_err(Error::from) } else { let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Returns a worlds instance. -pub async fn get_world_instance( - configuration: &configuration::Configuration, - world_id: &str, - instance_id: &str, -) -> Result> { +pub async fn get_world_instance(configuration: &configuration::Configuration, world_id: &str, instance_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/worlds/{worldId}/{instanceId}", - local_var_configuration.base_path, - worldId = crate::apis::urlencode(world_id), - instanceId = crate::apis::urlencode(instance_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/worlds/{worldId}/{instanceId}", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id), instanceId=crate::apis::urlencode(instance_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -573,37 +431,23 @@ pub async fn get_world_instance( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Return a worlds custom metadata. This is currently believed to be unused. Metadata can be set with `updateWorld` and can be any arbitrary object. -pub async fn get_world_metadata( - configuration: &configuration::Configuration, - world_id: &str, -) -> Result> { +pub async fn get_world_metadata(configuration: &configuration::Configuration, world_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/worlds/{worldId}/metadata", - local_var_configuration.base_path, - worldId = crate::apis::urlencode(world_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/worlds/{worldId}/metadata", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -615,37 +459,23 @@ pub async fn get_world_metadata( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Returns a worlds publish status. -pub async fn get_world_publish_status( - configuration: &configuration::Configuration, - world_id: &str, -) -> Result> { +pub async fn get_world_publish_status(configuration: &configuration::Configuration, world_id: &str) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/worlds/{worldId}/publish", - local_var_configuration.base_path, - worldId = crate::apis::urlencode(world_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/worlds/{worldId}/publish", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -657,37 +487,23 @@ pub async fn get_world_publish_status( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Publish a world. You can only publish one world per week. -pub async fn publish_world( - configuration: &configuration::Configuration, - world_id: &str, -) -> Result<(), Error> { +pub async fn publish_world(configuration: &configuration::Configuration, world_id: &str) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/worlds/{worldId}/publish", - local_var_configuration.base_path, - worldId = crate::apis::urlencode(world_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/worlds/{worldId}/publish", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -699,105 +515,68 @@ pub async fn publish_world( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Search and list any worlds by query filters. -pub async fn search_worlds( - configuration: &configuration::Configuration, - featured: Option, - sort: Option, - user: Option<&str>, - user_id: Option<&str>, - n: Option, - order: Option, - offset: Option, - search: Option<&str>, - tag: Option<&str>, - notag: Option<&str>, - release_status: Option, - max_unity_version: Option<&str>, - min_unity_version: Option<&str>, - platform: Option<&str>, - fuzzy: Option, -) -> Result, Error> { +pub async fn search_worlds(configuration: &configuration::Configuration, featured: Option, sort: Option, user: Option<&str>, user_id: Option<&str>, n: Option, order: Option, offset: Option, search: Option<&str>, tag: Option<&str>, notag: Option<&str>, release_status: Option, max_unity_version: Option<&str>, min_unity_version: Option<&str>, platform: Option<&str>, fuzzy: Option) -> Result, Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; let local_var_uri_str = format!("{}/worlds", local_var_configuration.base_path); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str()); if let Some(ref local_var_str) = featured { - local_var_req_builder = - local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("featured", &local_var_str.to_string())]); } if let Some(ref local_var_str) = sort { - local_var_req_builder = - local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("sort", &local_var_str.to_string())]); } if let Some(ref local_var_str) = user { - local_var_req_builder = - local_var_req_builder.query(&[("user", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("user", &local_var_str.to_string())]); } if let Some(ref local_var_str) = user_id { - local_var_req_builder = - local_var_req_builder.query(&[("userId", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("userId", &local_var_str.to_string())]); } if let Some(ref local_var_str) = n { local_var_req_builder = local_var_req_builder.query(&[("n", &local_var_str.to_string())]); } if let Some(ref local_var_str) = order { - local_var_req_builder = - local_var_req_builder.query(&[("order", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("order", &local_var_str.to_string())]); } if let Some(ref local_var_str) = offset { - local_var_req_builder = - local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]); } if let Some(ref local_var_str) = search { - local_var_req_builder = - local_var_req_builder.query(&[("search", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("search", &local_var_str.to_string())]); } if let Some(ref local_var_str) = tag { local_var_req_builder = local_var_req_builder.query(&[("tag", &local_var_str.to_string())]); } if let Some(ref local_var_str) = notag { - local_var_req_builder = - local_var_req_builder.query(&[("notag", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("notag", &local_var_str.to_string())]); } if let Some(ref local_var_str) = release_status { - local_var_req_builder = - local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("releaseStatus", &local_var_str.to_string())]); } if let Some(ref local_var_str) = max_unity_version { - local_var_req_builder = - local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("maxUnityVersion", &local_var_str.to_string())]); } if let Some(ref local_var_str) = min_unity_version { - local_var_req_builder = - local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("minUnityVersion", &local_var_str.to_string())]); } if let Some(ref local_var_str) = platform { - local_var_req_builder = - local_var_req_builder.query(&[("platform", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("platform", &local_var_str.to_string())]); } if let Some(ref local_var_str) = fuzzy { - local_var_req_builder = - local_var_req_builder.query(&[("fuzzy", &local_var_str.to_string())]); + local_var_req_builder = local_var_req_builder.query(&[("fuzzy", &local_var_str.to_string())]); } if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -809,37 +588,23 @@ pub async fn search_worlds( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Unpublish a world. -pub async fn unpublish_world( - configuration: &configuration::Configuration, - world_id: &str, -) -> Result<(), Error> { +pub async fn unpublish_world(configuration: &configuration::Configuration, world_id: &str) -> Result<(), Error> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/worlds/{worldId}/publish", - local_var_configuration.base_path, - worldId = crate::apis::urlencode(world_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/worlds/{worldId}/publish", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } let local_var_req = local_var_req_builder.build()?; @@ -851,38 +616,23 @@ pub async fn unpublish_world( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { Ok(()) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } /// Update information about a specific World. -pub async fn update_world( - configuration: &configuration::Configuration, - world_id: &str, - update_world_request: Option, -) -> Result> { +pub async fn update_world(configuration: &configuration::Configuration, world_id: &str, update_world_request: Option) -> Result> { let local_var_configuration = configuration; let local_var_client = &local_var_configuration.client; - let local_var_uri_str = format!( - "{}/worlds/{worldId}", - local_var_configuration.base_path, - worldId = crate::apis::urlencode(world_id) - ); - let mut local_var_req_builder = - local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); + let local_var_uri_str = format!("{}/worlds/{worldId}", local_var_configuration.base_path, worldId=crate::apis::urlencode(world_id)); + let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str()); if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { - local_var_req_builder = - local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } local_var_req_builder = local_var_req_builder.json(&update_world_request); @@ -895,13 +645,9 @@ pub async fn update_world( if !local_var_status.is_client_error() && !local_var_status.is_server_error() { serde_json::from_str(&local_var_content).map_err(Error::from) } else { - let local_var_entity: Option = - serde_json::from_str(&local_var_content).ok(); - let local_var_error = ResponseContent { - status: local_var_status, - content: local_var_content, - entity: local_var_entity, - }; + let local_var_entity: Option = serde_json::from_str(&local_var_content).ok(); + let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity }; Err(Error::ResponseError(local_var_error)) } } + diff --git a/src/lib.rs b/src/lib.rs index d91a0d6..a1837b9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,10 +1,10 @@ #![allow(unused_imports)] #![allow(clippy::too_many_arguments)] -extern crate reqwest; extern crate serde; extern crate serde_json; extern crate url; +extern crate reqwest; pub mod apis; pub mod models; diff --git a/src/models/account_deletion_log.rs b/src/models/account_deletion_log.rs index 3dc9853..5d61480 100644 --- a/src/models/account_deletion_log.rs +++ b/src/models/account_deletion_log.rs @@ -15,12 +15,7 @@ pub struct AccountDeletionLog { #[serde(rename = "message", skip_serializing_if = "Option::is_none")] pub message: Option, /// When the deletion is scheduled to happen, standard is 14 days after the request. - #[serde( - rename = "deletionScheduled", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "deletionScheduled", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub deletion_scheduled: Option>, /// Date and time of the deletion request. #[serde(rename = "dateTime", skip_serializing_if = "Option::is_none")] @@ -36,3 +31,4 @@ impl AccountDeletionLog { } } } + diff --git a/src/models/add_favorite_request.rs b/src/models/add_favorite_request.rs index 76071ed..4aaea88 100644 --- a/src/models/add_favorite_request.rs +++ b/src/models/add_favorite_request.rs @@ -22,11 +22,7 @@ pub struct AddFavoriteRequest { } impl AddFavoriteRequest { - pub fn new( - r#type: models::FavoriteType, - favorite_id: String, - tags: Vec, - ) -> AddFavoriteRequest { + pub fn new(r#type: models::FavoriteType, favorite_id: String, tags: Vec) -> AddFavoriteRequest { AddFavoriteRequest { r#type, favorite_id, @@ -34,3 +30,4 @@ impl AddFavoriteRequest { } } } + diff --git a/src/models/add_group_gallery_image_request.rs b/src/models/add_group_gallery_image_request.rs index 0718b56..af105f2 100644 --- a/src/models/add_group_gallery_image_request.rs +++ b/src/models/add_group_gallery_image_request.rs @@ -17,6 +17,9 @@ pub struct AddGroupGalleryImageRequest { impl AddGroupGalleryImageRequest { pub fn new(file_id: String) -> AddGroupGalleryImageRequest { - AddGroupGalleryImageRequest { file_id } + AddGroupGalleryImageRequest { + file_id, + } } } + diff --git a/src/models/api_config.rs b/src/models/api_config.rs index b80cc3e..6cfd2b5 100644 --- a/src/models/api_config.rs +++ b/src/models/api_config.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// ApiConfig : +/// ApiConfig : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct ApiConfig { /// Unknown, probably voice optimization testing @@ -46,10 +46,7 @@ pub struct ApiConfig { #[serde(rename = "clientDisconnectTimeout")] pub client_disconnect_timeout: i32, /// Unknown - #[serde( - rename = "clientNetDispatchThread", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "clientNetDispatchThread", skip_serializing_if = "Option::is_none")] pub client_net_dispatch_thread: Option, /// Unknown #[serde(rename = "clientNetInThread", skip_serializing_if = "Option::is_none")] @@ -58,37 +55,22 @@ pub struct ApiConfig { #[serde(rename = "clientNetInThread2", skip_serializing_if = "Option::is_none")] pub client_net_in_thread2: Option, /// Unknown - #[serde( - rename = "clientNetInThreadMobile", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "clientNetInThreadMobile", skip_serializing_if = "Option::is_none")] pub client_net_in_thread_mobile: Option, /// Unknown - #[serde( - rename = "clientNetInThreadMobile2", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "clientNetInThreadMobile2", skip_serializing_if = "Option::is_none")] pub client_net_in_thread_mobile2: Option, /// Unknown #[serde(rename = "clientNetOutThread", skip_serializing_if = "Option::is_none")] pub client_net_out_thread: Option, /// Unknown - #[serde( - rename = "clientNetOutThread2", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "clientNetOutThread2", skip_serializing_if = "Option::is_none")] pub client_net_out_thread2: Option, /// Unknown - #[serde( - rename = "clientNetOutThreadMobile", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "clientNetOutThreadMobile", skip_serializing_if = "Option::is_none")] pub client_net_out_thread_mobile: Option, /// Unknown - #[serde( - rename = "clientNetOutThreadMobile2", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "clientNetOutThreadMobile2", skip_serializing_if = "Option::is_none")] pub client_net_out_thread_mobile2: Option, /// Unknown #[serde(rename = "clientQR", skip_serializing_if = "Option::is_none")] @@ -106,10 +88,7 @@ pub struct ApiConfig { #[serde(rename = "copyrightEmail")] pub copyright_email: String, /// Current version number of the Privacy Agreement - #[serde( - rename = "currentPrivacyVersion", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "currentPrivacyVersion", skip_serializing_if = "Option::is_none")] pub current_privacy_version: Option, /// Current version number of the Terms of Service #[serde(rename = "currentTOSVersion")] @@ -131,10 +110,7 @@ pub struct ApiConfig { #[serde(rename = "dis-countdown")] pub dis_countdown: String, /// Unknown - #[serde( - rename = "disableAVProInProton", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "disableAVProInProton", skip_serializing_if = "Option::is_none")] pub disable_av_pro_in_proton: Option, /// Toggles if copying avatars should be disabled #[serde(rename = "disableAvatarCopying")] @@ -188,7 +164,7 @@ pub struct ApiConfig { #[serde(rename = "downloadLinkWindows")] pub download_link_windows: String, #[serde(rename = "downloadUrls")] - pub download_urls: models::ApiConfigDownloadUrlList, + pub download_urls: Box, /// Array of DynamicWorldRow objects, used by the game to display the list of world rows #[serde(rename = "dynamicWorldRows")] pub dynamic_world_rows: Vec, @@ -202,7 +178,7 @@ pub struct ApiConfig { #[serde(rename = "economyState", skip_serializing_if = "Option::is_none")] pub economy_state: Option, #[serde(rename = "events")] - pub events: models::ApiConfigEvents, + pub events: Box, /// WorldID be \"offline\" on User profiles if you are not friends with that user. #[serde(rename = "homeWorldId")] pub home_world_id: String, @@ -287,75 +263,7 @@ pub struct ApiConfig { } impl ApiConfig { - pub fn new( - voice_enable_degradation: bool, - voice_enable_receiver_limiting: bool, - address: String, - announcements: Vec, - app_name: String, - available_language_codes: Vec, - available_languages: Vec, - build_version_tag: String, - client_api_key: String, - client_bps_ceiling: i32, - client_disconnect_timeout: i32, - client_reserved_player_bps: i32, - client_sent_count_allowance: i32, - contact_email: String, - copyright_email: String, - current_tos_version: i32, - default_avatar: String, - deployment_group: models::DeploymentGroup, - dev_sdk_url: String, - dev_sdk_version: String, - dis_countdown: String, - disable_avatar_copying: bool, - disable_avatar_gating: bool, - disable_community_labs: bool, - disable_community_labs_promotion: bool, - disable_email: bool, - disable_event_stream: bool, - disable_feedback_gating: bool, - disable_frontend_builds: bool, - disable_hello: bool, - disable_oculus_subs: bool, - disable_registration: bool, - disable_steam_networking: bool, - disable_two_factor_auth: bool, - disable_udon: bool, - disable_upgrade_account: bool, - download_link_windows: String, - download_urls: models::ApiConfigDownloadUrlList, - dynamic_world_rows: Vec, - events: models::ApiConfigEvents, - home_world_id: String, - homepage_redirect_target: String, - hub_world_id: String, - image_host_url_list: Vec, - jobs_email: String, - moderation_email: String, - not_allowed_to_select_avatar_in_private_world_message: String, - sdk_developer_faq_url: String, - sdk_discord_url: String, - sdk_not_allowed_to_publish_message: String, - sdk_unity_version: String, - server_name: String, - string_host_url_list: Vec, - support_email: String, - time_out_world_id: String, - tutorial_world_id: String, - update_rate_ms_maximum: i32, - update_rate_ms_minimum: i32, - update_rate_ms_normal: i32, - update_rate_ms_udon_manual: i32, - upload_analysis_percent: i32, - url_list: Vec, - use_reliable_udp_for_voice: bool, - vive_windows_url: String, - white_listed_asset_urls: Vec, - player_url_resolver_version: String, - player_url_resolver_sha1: String, - ) -> ApiConfig { + pub fn new(voice_enable_degradation: bool, voice_enable_receiver_limiting: bool, address: String, announcements: Vec, app_name: String, available_language_codes: Vec, available_languages: Vec, build_version_tag: String, client_api_key: String, client_bps_ceiling: i32, client_disconnect_timeout: i32, client_reserved_player_bps: i32, client_sent_count_allowance: i32, contact_email: String, copyright_email: String, current_tos_version: i32, default_avatar: String, deployment_group: models::DeploymentGroup, dev_sdk_url: String, dev_sdk_version: String, dis_countdown: String, disable_avatar_copying: bool, disable_avatar_gating: bool, disable_community_labs: bool, disable_community_labs_promotion: bool, disable_email: bool, disable_event_stream: bool, disable_feedback_gating: bool, disable_frontend_builds: bool, disable_hello: bool, disable_oculus_subs: bool, disable_registration: bool, disable_steam_networking: bool, disable_two_factor_auth: bool, disable_udon: bool, disable_upgrade_account: bool, download_link_windows: String, download_urls: models::ApiConfigDownloadUrlList, dynamic_world_rows: Vec, events: models::ApiConfigEvents, home_world_id: String, homepage_redirect_target: String, hub_world_id: String, image_host_url_list: Vec, jobs_email: String, moderation_email: String, not_allowed_to_select_avatar_in_private_world_message: String, sdk_developer_faq_url: String, sdk_discord_url: String, sdk_not_allowed_to_publish_message: String, sdk_unity_version: String, server_name: String, string_host_url_list: Vec, support_email: String, time_out_world_id: String, tutorial_world_id: String, update_rate_ms_maximum: i32, update_rate_ms_minimum: i32, update_rate_ms_normal: i32, update_rate_ms_udon_manual: i32, upload_analysis_percent: i32, url_list: Vec, use_reliable_udp_for_voice: bool, vive_windows_url: String, white_listed_asset_urls: Vec, player_url_resolver_version: String, player_url_resolver_sha1: String) -> ApiConfig { ApiConfig { voice_enable_degradation, voice_enable_receiver_limiting, @@ -408,12 +316,12 @@ impl ApiConfig { disable_udon, disable_upgrade_account, download_link_windows, - download_urls, + download_urls: Box::new(download_urls), dynamic_world_rows, economy_pause_end: None, economy_pause_start: None, economy_state: None, - events, + events: Box::new(events), home_world_id, homepage_redirect_target, hub_world_id, @@ -444,3 +352,4 @@ impl ApiConfig { } } } + diff --git a/src/models/api_config_announcement.rs b/src/models/api_config_announcement.rs index 084aa04..1151757 100644 --- a/src/models/api_config_announcement.rs +++ b/src/models/api_config_announcement.rs @@ -23,6 +23,10 @@ pub struct ApiConfigAnnouncement { impl ApiConfigAnnouncement { /// Public Announcement pub fn new(name: String, text: String) -> ApiConfigAnnouncement { - ApiConfigAnnouncement { name, text } + ApiConfigAnnouncement { + name, + text, + } } } + diff --git a/src/models/api_config_download_url_list.rs b/src/models/api_config_download_url_list.rs index 595e3ff..e0eb3e4 100644 --- a/src/models/api_config_download_url_list.rs +++ b/src/models/api_config_download_url_list.rs @@ -31,13 +31,7 @@ pub struct ApiConfigDownloadUrlList { impl ApiConfigDownloadUrlList { /// Download links for various development assets. - pub fn new( - sdk2: String, - sdk3_avatars: String, - sdk3_worlds: String, - vcc: String, - bootstrap: String, - ) -> ApiConfigDownloadUrlList { + pub fn new(sdk2: String, sdk3_avatars: String, sdk3_worlds: String, vcc: String, bootstrap: String) -> ApiConfigDownloadUrlList { ApiConfigDownloadUrlList { sdk2, sdk3_avatars, @@ -47,3 +41,4 @@ impl ApiConfigDownloadUrlList { } } } + diff --git a/src/models/api_config_events.rs b/src/models/api_config_events.rs index 439f6f6..3ac327e 100644 --- a/src/models/api_config_events.rs +++ b/src/models/api_config_events.rs @@ -44,18 +44,7 @@ pub struct ApiConfigEvents { } impl ApiConfigEvents { - pub fn new( - distance_close: i32, - distance_factor: i32, - distance_far: i32, - group_distance: i32, - maximum_bunch_size: i32, - not_visible_factor: i32, - player_order_bucket_size: i32, - player_order_factor: i32, - slow_update_factor_threshold: i32, - view_segment_length: i32, - ) -> ApiConfigEvents { + pub fn new(distance_close: i32, distance_factor: i32, distance_far: i32, group_distance: i32, maximum_bunch_size: i32, not_visible_factor: i32, player_order_bucket_size: i32, player_order_factor: i32, slow_update_factor_threshold: i32, view_segment_length: i32) -> ApiConfigEvents { ApiConfigEvents { distance_close, distance_factor, @@ -70,3 +59,4 @@ impl ApiConfigEvents { } } } + diff --git a/src/models/api_health.rs b/src/models/api_health.rs index 565f16e..cd89ca1 100644 --- a/src/models/api_health.rs +++ b/src/models/api_health.rs @@ -28,3 +28,4 @@ impl ApiHealth { } } } + diff --git a/src/models/avatar.rs b/src/models/avatar.rs index c8e4a8d..77f35e0 100644 --- a/src/models/avatar.rs +++ b/src/models/avatar.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// Avatar : +/// Avatar : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Avatar { /// Not present from general serach `/avatars`, only on specific requests `/avatars/{avatarId}`. @@ -44,7 +44,7 @@ pub struct Avatar { #[serde(rename = "unityPackageUrl")] pub unity_package_url: String, #[serde(rename = "unityPackageUrlObject")] - pub unity_package_url_object: models::AvatarUnityPackageUrlObject, + pub unity_package_url_object: Box, #[serde(rename = "unityPackages")] pub unity_packages: Vec, #[serde(rename = "updated_at")] @@ -54,24 +54,7 @@ pub struct Avatar { } impl Avatar { - pub fn new( - author_id: String, - author_name: String, - created_at: String, - description: String, - featured: bool, - id: String, - image_url: String, - name: String, - release_status: models::ReleaseStatus, - tags: Vec, - thumbnail_image_url: String, - unity_package_url: String, - unity_package_url_object: models::AvatarUnityPackageUrlObject, - unity_packages: Vec, - updated_at: String, - version: i32, - ) -> Avatar { + pub fn new(author_id: String, author_name: String, created_at: String, description: String, featured: bool, id: String, image_url: String, name: String, release_status: models::ReleaseStatus, tags: Vec, thumbnail_image_url: String, unity_package_url: String, unity_package_url_object: models::AvatarUnityPackageUrlObject, unity_packages: Vec, updated_at: String, version: i32) -> Avatar { Avatar { asset_url: None, asset_url_object: None, @@ -87,10 +70,11 @@ impl Avatar { tags, thumbnail_image_url, unity_package_url, - unity_package_url_object, + unity_package_url_object: Box::new(unity_package_url_object), unity_packages, updated_at, version, } } } + diff --git a/src/models/avatar_unity_package_url_object.rs b/src/models/avatar_unity_package_url_object.rs index 83ec97d..7c58797 100644 --- a/src/models/avatar_unity_package_url_object.rs +++ b/src/models/avatar_unity_package_url_object.rs @@ -24,3 +24,4 @@ impl AvatarUnityPackageUrlObject { } } } + diff --git a/src/models/badge.rs b/src/models/badge.rs index 0c30d0e..b04849b 100644 --- a/src/models/badge.rs +++ b/src/models/badge.rs @@ -12,12 +12,7 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Badge { /// only present in CurrentUser badges - #[serde( - rename = "assignedAt", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "assignedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub assigned_at: Option>, #[serde(rename = "badgeDescription")] pub badge_description: String, @@ -29,33 +24,17 @@ pub struct Badge { #[serde(rename = "badgeName")] pub badge_name: String, /// only present in CurrentUser badges - #[serde( - rename = "hidden", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "hidden", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub hidden: Option>, #[serde(rename = "showcased")] pub showcased: bool, /// only present in CurrentUser badges - #[serde( - rename = "updatedAt", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "updatedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub updated_at: Option>, } impl Badge { - pub fn new( - badge_description: String, - badge_id: String, - badge_image_url: String, - badge_name: String, - showcased: bool, - ) -> Badge { + pub fn new(badge_description: String, badge_id: String, badge_image_url: String, badge_name: String, showcased: bool) -> Badge { Badge { assigned_at: None, badge_description, @@ -68,3 +47,4 @@ impl Badge { } } } + diff --git a/src/models/ban_group_member_request.rs b/src/models/ban_group_member_request.rs index d2e8630..0cd9205 100644 --- a/src/models/ban_group_member_request.rs +++ b/src/models/ban_group_member_request.rs @@ -18,6 +18,9 @@ pub struct BanGroupMemberRequest { impl BanGroupMemberRequest { pub fn new(user_id: String) -> BanGroupMemberRequest { - BanGroupMemberRequest { user_id } + BanGroupMemberRequest { + user_id, + } } } + diff --git a/src/models/create_avatar_request.rs b/src/models/create_avatar_request.rs index 3b032ae..5e8c888 100644 --- a/src/models/create_avatar_request.rs +++ b/src/models/create_avatar_request.rs @@ -49,3 +49,4 @@ impl CreateAvatarRequest { } } } + diff --git a/src/models/create_file_request.rs b/src/models/create_file_request.rs index 52e1861..f9edc05 100644 --- a/src/models/create_file_request.rs +++ b/src/models/create_file_request.rs @@ -31,3 +31,4 @@ impl CreateFileRequest { } } } + diff --git a/src/models/create_file_version_request.rs b/src/models/create_file_version_request.rs index 40fe50f..99ba461 100644 --- a/src/models/create_file_version_request.rs +++ b/src/models/create_file_version_request.rs @@ -31,3 +31,4 @@ impl CreateFileVersionRequest { } } } + diff --git a/src/models/create_group_announcement_request.rs b/src/models/create_group_announcement_request.rs index 9d9bbfb..22f941a 100644 --- a/src/models/create_group_announcement_request.rs +++ b/src/models/create_group_announcement_request.rs @@ -34,3 +34,4 @@ impl CreateGroupAnnouncementRequest { } } } + diff --git a/src/models/create_group_gallery_request.rs b/src/models/create_group_gallery_request.rs index edb1afd..cbe1249 100644 --- a/src/models/create_group_gallery_request.rs +++ b/src/models/create_group_gallery_request.rs @@ -20,33 +20,13 @@ pub struct CreateGroupGalleryRequest { /// Whether the gallery is members only. #[serde(rename = "membersOnly", skip_serializing_if = "Option::is_none")] pub members_only: Option, - #[serde( - rename = "roleIdsToView", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "roleIdsToView", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub role_ids_to_view: Option>>, - #[serde( - rename = "roleIdsToSubmit", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "roleIdsToSubmit", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub role_ids_to_submit: Option>>, - #[serde( - rename = "roleIdsToAutoApprove", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "roleIdsToAutoApprove", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub role_ids_to_auto_approve: Option>>, - #[serde( - rename = "roleIdsToManage", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "roleIdsToManage", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub role_ids_to_manage: Option>>, } @@ -63,3 +43,4 @@ impl CreateGroupGalleryRequest { } } } + diff --git a/src/models/create_group_invite_request.rs b/src/models/create_group_invite_request.rs index ba17230..0c3487b 100644 --- a/src/models/create_group_invite_request.rs +++ b/src/models/create_group_invite_request.rs @@ -14,10 +14,7 @@ pub struct CreateGroupInviteRequest { /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. #[serde(rename = "userId")] pub user_id: String, - #[serde( - rename = "confirmOverrideBlock", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "confirmOverrideBlock", skip_serializing_if = "Option::is_none")] pub confirm_override_block: Option, } @@ -29,3 +26,4 @@ impl CreateGroupInviteRequest { } } } + diff --git a/src/models/create_group_post_request.rs b/src/models/create_group_post_request.rs index f9a15f9..e35a3a9 100644 --- a/src/models/create_group_post_request.rs +++ b/src/models/create_group_post_request.rs @@ -29,12 +29,7 @@ pub struct CreateGroupPostRequest { } impl CreateGroupPostRequest { - pub fn new( - title: String, - text: String, - send_notification: bool, - visibility: models::GroupPostVisibility, - ) -> CreateGroupPostRequest { + pub fn new(title: String, text: String, send_notification: bool, visibility: models::GroupPostVisibility) -> CreateGroupPostRequest { CreateGroupPostRequest { title, text, @@ -45,3 +40,4 @@ impl CreateGroupPostRequest { } } } + diff --git a/src/models/create_group_request.rs b/src/models/create_group_request.rs index 9dd2f4e..3348ecb 100644 --- a/src/models/create_group_request.rs +++ b/src/models/create_group_request.rs @@ -19,19 +19,9 @@ pub struct CreateGroupRequest { pub description: Option, #[serde(rename = "joinState", skip_serializing_if = "Option::is_none")] pub join_state: Option, - #[serde( - rename = "iconId", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "iconId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub icon_id: Option>, - #[serde( - rename = "bannerId", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "bannerId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub banner_id: Option>, #[serde(rename = "privacy", skip_serializing_if = "Option::is_none")] pub privacy: Option, @@ -40,11 +30,7 @@ pub struct CreateGroupRequest { } impl CreateGroupRequest { - pub fn new( - name: String, - short_code: String, - role_template: models::GroupRoleTemplate, - ) -> CreateGroupRequest { + pub fn new(name: String, short_code: String, role_template: models::GroupRoleTemplate) -> CreateGroupRequest { CreateGroupRequest { name, short_code, @@ -57,3 +43,4 @@ impl CreateGroupRequest { } } } + diff --git a/src/models/create_group_role_request.rs b/src/models/create_group_role_request.rs index 4d4eeed..72a9f1d 100644 --- a/src/models/create_group_role_request.rs +++ b/src/models/create_group_role_request.rs @@ -34,3 +34,4 @@ impl CreateGroupRoleRequest { } } } + diff --git a/src/models/create_instance_request.rs b/src/models/create_instance_request.rs index bc67c97..5ded5ef 100644 --- a/src/models/create_instance_request.rs +++ b/src/models/create_instance_request.rs @@ -19,12 +19,7 @@ pub struct CreateInstanceRequest { #[serde(rename = "region")] pub region: models::InstanceRegion, /// A groupId if the instance type is \"group\", null if instance type is public, or a userId otherwise - #[serde( - rename = "ownerId", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "ownerId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub owner_id: Option>, /// Group roleIds that are allowed to join if the type is \"group\" and groupAccessType is \"member\" #[serde(rename = "roleIds", skip_serializing_if = "Option::is_none")] @@ -47,11 +42,7 @@ pub struct CreateInstanceRequest { } impl CreateInstanceRequest { - pub fn new( - world_id: String, - r#type: models::InstanceType, - region: models::InstanceRegion, - ) -> CreateInstanceRequest { + pub fn new(world_id: String, r#type: models::InstanceType, region: models::InstanceRegion) -> CreateInstanceRequest { CreateInstanceRequest { world_id, r#type, @@ -67,3 +58,4 @@ impl CreateInstanceRequest { } } } + diff --git a/src/models/create_world_request.rs b/src/models/create_world_request.rs index 557d60e..7f84409 100644 --- a/src/models/create_world_request.rs +++ b/src/models/create_world_request.rs @@ -64,3 +64,4 @@ impl CreateWorldRequest { } } } + diff --git a/src/models/current_user.rs b/src/models/current_user.rs index 019f0ed..2c38325 100644 --- a/src/models/current_user.rs +++ b/src/models/current_user.rs @@ -13,24 +13,11 @@ use serde::{Deserialize, Serialize}; pub struct CurrentUser { #[serde(rename = "acceptedTOSVersion")] pub accepted_tos_version: i32, - #[serde( - rename = "acceptedPrivacyVersion", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "acceptedPrivacyVersion", skip_serializing_if = "Option::is_none")] pub accepted_privacy_version: Option, - #[serde( - rename = "accountDeletionDate", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "accountDeletionDate", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub account_deletion_date: Option>, - #[serde( - rename = "accountDeletionLog", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "accountDeletionLog", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub account_deletion_log: Option>>, #[serde(rename = "activeFriends", skip_serializing_if = "Option::is_none")] pub active_friends: Option>, @@ -73,24 +60,11 @@ pub struct CurrentUser { pub friends: Vec, #[serde(rename = "hasBirthday")] pub has_birthday: bool, - #[serde( - rename = "hideContentFilterSettings", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "hideContentFilterSettings", skip_serializing_if = "Option::is_none")] pub hide_content_filter_settings: Option, - #[serde( - rename = "userLanguage", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "userLanguage", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub user_language: Option>, - #[serde( - rename = "userLanguageCode", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "userLanguageCode", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub user_language_code: Option>, #[serde(rename = "hasEmail")] pub has_email: bool, @@ -138,7 +112,7 @@ pub struct CurrentUser { #[serde(rename = "pastDisplayNames")] pub past_display_names: Vec, #[serde(rename = "presence", skip_serializing_if = "Option::is_none")] - pub presence: Option, + pub presence: Option>, #[serde(rename = "profilePicOverride")] pub profile_pic_override: String, #[serde(rename = "profilePicOverrideThumbnail")] @@ -163,12 +137,7 @@ pub struct CurrentUser { pub tags: Vec, #[serde(rename = "twoFactorAuthEnabled")] pub two_factor_auth_enabled: bool, - #[serde( - rename = "twoFactorAuthEnabledDate", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "twoFactorAuthEnabledDate", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub two_factor_auth_enabled_date: Option>, #[serde(rename = "unsubscribe")] pub unsubscribe: bool, @@ -182,52 +151,7 @@ pub struct CurrentUser { } impl CurrentUser { - pub fn new( - accepted_tos_version: i32, - allow_avatar_copying: bool, - bio: String, - bio_links: Vec, - current_avatar: String, - current_avatar_asset_url: String, - current_avatar_image_url: String, - current_avatar_thumbnail_image_url: String, - current_avatar_tags: Vec, - date_joined: String, - developer_type: models::DeveloperType, - display_name: String, - email_verified: bool, - friend_group_names: Vec, - friend_key: String, - friends: Vec, - has_birthday: bool, - has_email: bool, - has_logged_in_from_client: bool, - has_pending_email: bool, - home_location: String, - id: String, - is_friend: bool, - last_login: String, - last_mobile: Option, - last_platform: String, - obfuscated_email: String, - obfuscated_pending_email: String, - oculus_id: String, - past_display_names: Vec, - profile_pic_override: String, - profile_pic_override_thumbnail: String, - pronouns: String, - state: models::UserState, - status: models::UserStatus, - status_description: String, - status_first_time: bool, - status_history: Vec, - steam_details: serde_json::Value, - steam_id: String, - tags: Vec, - two_factor_auth_enabled: bool, - unsubscribe: bool, - user_icon: String, - ) -> CurrentUser { + pub fn new(accepted_tos_version: i32, allow_avatar_copying: bool, bio: String, bio_links: Vec, current_avatar: String, current_avatar_asset_url: String, current_avatar_image_url: String, current_avatar_thumbnail_image_url: String, current_avatar_tags: Vec, date_joined: String, developer_type: models::DeveloperType, display_name: String, email_verified: bool, friend_group_names: Vec, friend_key: String, friends: Vec, has_birthday: bool, has_email: bool, has_logged_in_from_client: bool, has_pending_email: bool, home_location: String, id: String, is_friend: bool, last_login: String, last_mobile: Option, last_platform: String, obfuscated_email: String, obfuscated_pending_email: String, oculus_id: String, past_display_names: Vec, profile_pic_override: String, profile_pic_override_thumbnail: String, pronouns: String, state: models::UserState, status: models::UserStatus, status_description: String, status_first_time: bool, status_history: Vec, steam_details: serde_json::Value, steam_id: String, tags: Vec, two_factor_auth_enabled: bool, unsubscribe: bool, user_icon: String) -> CurrentUser { CurrentUser { accepted_tos_version, accepted_privacy_version: None, @@ -297,3 +221,4 @@ impl CurrentUser { } } } + diff --git a/src/models/current_user_presence.rs b/src/models/current_user_presence.rs index b45e42e..d177463 100644 --- a/src/models/current_user_presence.rs +++ b/src/models/current_user_presence.rs @@ -11,76 +11,31 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct CurrentUserPresence { - #[serde( - rename = "avatarThumbnail", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "avatarThumbnail", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub avatar_thumbnail: Option>, #[serde(rename = "displayName", skip_serializing_if = "Option::is_none")] pub display_name: Option, - #[serde( - rename = "groups", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "groups", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub groups: Option>>, /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, - #[serde( - rename = "instance", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "instance", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub instance: Option>, /// either an InstanceType or an empty string - #[serde( - rename = "instanceType", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "instanceType", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub instance_type: Option>, - #[serde( - rename = "isRejoining", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "isRejoining", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub is_rejoining: Option>, /// either a Platform or an empty string - #[serde( - rename = "platform", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "platform", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub platform: Option>, - #[serde( - rename = "profilePicOverride", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "profilePicOverride", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub profile_pic_override: Option>, /// either a UserStatus or empty string - #[serde( - rename = "status", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "status", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub status: Option>, - #[serde( - rename = "travelingToInstance", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "travelingToInstance", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub traveling_to_instance: Option>, /// WorldID be \"offline\" on User profiles if you are not friends with that user. #[serde(rename = "travelingToWorld", skip_serializing_if = "Option::is_none")] @@ -109,3 +64,4 @@ impl CurrentUserPresence { } } } + diff --git a/src/models/deployment_group.rs b/src/models/deployment_group.rs index 1b60620..24d032a 100644 --- a/src/models/deployment_group.rs +++ b/src/models/deployment_group.rs @@ -21,6 +21,7 @@ pub enum DeploymentGroup { Grape, #[serde(rename = "cherry")] Cherry, + } impl std::fmt::Display for DeploymentGroup { @@ -39,3 +40,4 @@ impl Default for DeploymentGroup { Self::Blue } } + diff --git a/src/models/developer_type.rs b/src/models/developer_type.rs index 326ca0f..c0f9520 100644 --- a/src/models/developer_type.rs +++ b/src/models/developer_type.rs @@ -21,6 +21,7 @@ pub enum DeveloperType { Internal, #[serde(rename = "moderator")] Moderator, + } impl std::fmt::Display for DeveloperType { @@ -39,3 +40,4 @@ impl Default for DeveloperType { Self::None } } + diff --git a/src/models/dynamic_content_row.rs b/src/models/dynamic_content_row.rs index a38490c..7300c57 100644 --- a/src/models/dynamic_content_row.rs +++ b/src/models/dynamic_content_row.rs @@ -33,13 +33,7 @@ pub struct DynamicContentRow { } impl DynamicContentRow { - pub fn new( - name: String, - platform: String, - sort_heading: String, - sort_order: String, - sort_ownership: String, - ) -> DynamicContentRow { + pub fn new(name: String, platform: String, sort_heading: String, sort_order: String, sort_ownership: String) -> DynamicContentRow { DynamicContentRow { index: None, name, @@ -52,3 +46,4 @@ impl DynamicContentRow { } } } + diff --git a/src/models/error.rs b/src/models/error.rs index 34cdb5b..7612690 100644 --- a/src/models/error.rs +++ b/src/models/error.rs @@ -12,11 +12,14 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Error { #[serde(rename = "error", skip_serializing_if = "Option::is_none")] - pub error: Option, + pub error: Option>, } impl Error { pub fn new() -> Error { - Error { error: None } + Error { + error: None, + } } } + diff --git a/src/models/favorite.rs b/src/models/favorite.rs index a28e2aa..7f9584e 100644 --- a/src/models/favorite.rs +++ b/src/models/favorite.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// Favorite : +/// Favorite : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Favorite { /// MUST be either AvatarID, UserID or WorldID. @@ -24,12 +24,7 @@ pub struct Favorite { } impl Favorite { - pub fn new( - favorite_id: String, - id: String, - tags: Vec, - r#type: models::FavoriteType, - ) -> Favorite { + pub fn new(favorite_id: String, id: String, tags: Vec, r#type: models::FavoriteType) -> Favorite { Favorite { favorite_id, id, @@ -38,3 +33,4 @@ impl Favorite { } } } + diff --git a/src/models/favorite_group.rs b/src/models/favorite_group.rs index 728674f..2afd531 100644 --- a/src/models/favorite_group.rs +++ b/src/models/favorite_group.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// FavoriteGroup : +/// FavoriteGroup : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct FavoriteGroup { #[serde(rename = "displayName")] @@ -32,16 +32,7 @@ pub struct FavoriteGroup { } impl FavoriteGroup { - pub fn new( - display_name: String, - id: String, - name: String, - owner_display_name: String, - owner_id: String, - tags: Vec, - r#type: models::FavoriteType, - visibility: models::FavoriteGroupVisibility, - ) -> FavoriteGroup { + pub fn new(display_name: String, id: String, name: String, owner_display_name: String, owner_id: String, tags: Vec, r#type: models::FavoriteType, visibility: models::FavoriteGroupVisibility) -> FavoriteGroup { FavoriteGroup { display_name, id, @@ -54,3 +45,4 @@ impl FavoriteGroup { } } } + diff --git a/src/models/favorite_group_visibility.rs b/src/models/favorite_group_visibility.rs index ccac213..246c2fc 100644 --- a/src/models/favorite_group_visibility.rs +++ b/src/models/favorite_group_visibility.rs @@ -17,6 +17,7 @@ pub enum FavoriteGroupVisibility { Friends, #[serde(rename = "public")] Public, + } impl std::fmt::Display for FavoriteGroupVisibility { @@ -34,3 +35,4 @@ impl Default for FavoriteGroupVisibility { Self::Private } } + diff --git a/src/models/favorite_type.rs b/src/models/favorite_type.rs index d0f5d63..cd30edb 100644 --- a/src/models/favorite_type.rs +++ b/src/models/favorite_type.rs @@ -17,6 +17,7 @@ pub enum FavoriteType { Friend, #[serde(rename = "avatar")] Avatar, + } impl std::fmt::Display for FavoriteType { @@ -34,3 +35,4 @@ impl Default for FavoriteType { Self::World } } + diff --git a/src/models/file.rs b/src/models/file.rs index f34119f..4f203f0 100644 --- a/src/models/file.rs +++ b/src/models/file.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// File : +/// File : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct File { #[serde(rename = "extension")] @@ -30,15 +30,7 @@ pub struct File { } impl File { - pub fn new( - extension: String, - id: String, - mime_type: models::MimeType, - name: String, - owner_id: String, - tags: Vec, - versions: Vec, - ) -> File { + pub fn new(extension: String, id: String, mime_type: models::MimeType, name: String, owner_id: String, tags: Vec, versions: Vec) -> File { File { extension, id, @@ -50,3 +42,4 @@ impl File { } } } + diff --git a/src/models/file_data.rs b/src/models/file_data.rs index 3a80655..c15ee83 100644 --- a/src/models/file_data.rs +++ b/src/models/file_data.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// FileData : +/// FileData : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct FileData { #[serde(rename = "category")] @@ -29,14 +29,7 @@ pub struct FileData { } impl FileData { - pub fn new( - category: Category, - file_name: String, - size_in_bytes: i32, - status: models::FileStatus, - upload_id: String, - url: String, - ) -> FileData { + pub fn new(category: Category, file_name: String, size_in_bytes: i32, status: models::FileStatus, upload_id: String, url: String) -> FileData { FileData { category, file_name, @@ -63,3 +56,4 @@ impl Default for Category { Self::Multipart } } + diff --git a/src/models/file_status.rs b/src/models/file_status.rs index d565753..9c296f3 100644 --- a/src/models/file_status.rs +++ b/src/models/file_status.rs @@ -19,6 +19,7 @@ pub enum FileStatus { None, #[serde(rename = "queued")] Queued, + } impl std::fmt::Display for FileStatus { @@ -37,3 +38,4 @@ impl Default for FileStatus { Self::Waiting } } + diff --git a/src/models/file_upload_url.rs b/src/models/file_upload_url.rs index 5085bca..6d4dc43 100644 --- a/src/models/file_upload_url.rs +++ b/src/models/file_upload_url.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// FileUploadUrl : +/// FileUploadUrl : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct FileUploadUrl { #[serde(rename = "url")] @@ -18,6 +18,9 @@ pub struct FileUploadUrl { impl FileUploadUrl { pub fn new(url: String) -> FileUploadUrl { - FileUploadUrl { url } + FileUploadUrl { + url, + } } } + diff --git a/src/models/file_version.rs b/src/models/file_version.rs index 742426c..befc3e0 100644 --- a/src/models/file_version.rs +++ b/src/models/file_version.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// FileVersion : +/// FileVersion : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct FileVersion { #[serde(rename = "created_at")] @@ -18,11 +18,11 @@ pub struct FileVersion { #[serde(rename = "deleted", skip_serializing_if = "Option::is_none")] pub deleted: Option, #[serde(rename = "delta", skip_serializing_if = "Option::is_none")] - pub delta: Option, + pub delta: Option>, #[serde(rename = "file", skip_serializing_if = "Option::is_none")] - pub file: Option, + pub file: Option>, #[serde(rename = "signature", skip_serializing_if = "Option::is_none")] - pub signature: Option, + pub signature: Option>, #[serde(rename = "status")] pub status: models::FileStatus, /// Incremental version counter, can only be increased. @@ -43,3 +43,4 @@ impl FileVersion { } } } + diff --git a/src/models/file_version_upload_status.rs b/src/models/file_version_upload_status.rs index 7448e50..41ed9d2 100644 --- a/src/models/file_version_upload_status.rs +++ b/src/models/file_version_upload_status.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// FileVersionUploadStatus : +/// FileVersionUploadStatus : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct FileVersionUploadStatus { #[serde(rename = "uploadId")] @@ -28,14 +28,7 @@ pub struct FileVersionUploadStatus { } impl FileVersionUploadStatus { - pub fn new( - upload_id: String, - file_name: String, - next_part_number: f64, - max_parts: f64, - parts: Vec, - etags: Vec, - ) -> FileVersionUploadStatus { + pub fn new(upload_id: String, file_name: String, next_part_number: f64, max_parts: f64, parts: Vec, etags: Vec) -> FileVersionUploadStatus { FileVersionUploadStatus { upload_id, file_name, @@ -46,3 +39,4 @@ impl FileVersionUploadStatus { } } } + diff --git a/src/models/finish_file_data_upload_request.rs b/src/models/finish_file_data_upload_request.rs index 2a753c2..5ec9d0e 100644 --- a/src/models/finish_file_data_upload_request.rs +++ b/src/models/finish_file_data_upload_request.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// FinishFileDataUploadRequest : +/// FinishFileDataUploadRequest : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct FinishFileDataUploadRequest { /// Array of ETags uploaded. @@ -32,3 +32,4 @@ impl FinishFileDataUploadRequest { } } } + diff --git a/src/models/friend_status.rs b/src/models/friend_status.rs index 0f8a6e4..72c3720 100644 --- a/src/models/friend_status.rs +++ b/src/models/friend_status.rs @@ -28,3 +28,4 @@ impl FriendStatus { } } } + diff --git a/src/models/get_current_user_200_response.rs b/src/models/get_current_user_200_response.rs index 869beea..b6adc3b 100644 --- a/src/models/get_current_user_200_response.rs +++ b/src/models/get_current_user_200_response.rs @@ -12,8 +12,8 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] #[serde(untagged)] pub enum GetCurrentUser200Response { - CurrentUser(models::CurrentUser), - TwoFactorRequired(models::TwoFactorRequired), + CurrentUser(Box), + TwoFactorRequired(Box), } impl Default for GetCurrentUser200Response { @@ -36,3 +36,4 @@ impl Default for RequiresTwoFactorAuth { Self::Totp } } + diff --git a/src/models/group.rs b/src/models/group.rs index 8376c10..54b7d78 100644 --- a/src/models/group.rs +++ b/src/models/group.rs @@ -21,56 +21,28 @@ pub struct Group { pub discriminator: Option, #[serde(rename = "description", skip_serializing_if = "Option::is_none")] pub description: Option, - #[serde( - rename = "iconUrl", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "iconUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub icon_url: Option>, - #[serde( - rename = "bannerUrl", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "bannerUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub banner_url: Option>, #[serde(rename = "privacy", skip_serializing_if = "Option::is_none")] pub privacy: Option, /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. #[serde(rename = "ownerId", skip_serializing_if = "Option::is_none")] pub owner_id: Option, - #[serde( - rename = "rules", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "rules", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub rules: Option>, #[serde(rename = "links", skip_serializing_if = "Option::is_none")] pub links: Option>, #[serde(rename = "languages", skip_serializing_if = "Option::is_none")] pub languages: Option>, - #[serde( - rename = "iconId", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "iconId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub icon_id: Option>, - #[serde( - rename = "bannerId", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "bannerId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub banner_id: Option>, #[serde(rename = "memberCount", skip_serializing_if = "Option::is_none")] pub member_count: Option, - #[serde( - rename = "memberCountSyncedAt", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "memberCountSyncedAt", skip_serializing_if = "Option::is_none")] pub member_count_synced_at: Option, #[serde(rename = "isVerified", skip_serializing_if = "Option::is_none")] pub is_verified: Option, @@ -87,26 +59,16 @@ pub struct Group { pub created_at: Option, #[serde(rename = "updatedAt", skip_serializing_if = "Option::is_none")] pub updated_at: Option, - #[serde( - rename = "lastPostCreatedAt", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "lastPostCreatedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub last_post_created_at: Option>, #[serde(rename = "onlineMemberCount", skip_serializing_if = "Option::is_none")] pub online_member_count: Option, #[serde(rename = "membershipStatus", skip_serializing_if = "Option::is_none")] pub membership_status: Option, #[serde(rename = "myMember", skip_serializing_if = "Option::is_none")] - pub my_member: Option, + pub my_member: Option>, /// Only returned if ?includeRoles=true is specified. - #[serde( - rename = "roles", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "roles", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub roles: Option>>, } @@ -144,3 +106,4 @@ impl Group { } } } + diff --git a/src/models/group_access_type.rs b/src/models/group_access_type.rs index 57d23c2..084c70c 100644 --- a/src/models/group_access_type.rs +++ b/src/models/group_access_type.rs @@ -19,6 +19,7 @@ pub enum GroupAccessType { Plus, #[serde(rename = "members")] Members, + } impl std::fmt::Display for GroupAccessType { @@ -36,3 +37,4 @@ impl Default for GroupAccessType { Self::Public } } + diff --git a/src/models/group_announcement.rs b/src/models/group_announcement.rs index 130b797..89eddee 100644 --- a/src/models/group_announcement.rs +++ b/src/models/group_announcement.rs @@ -18,42 +18,17 @@ pub struct GroupAnnouncement { /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. #[serde(rename = "authorId", skip_serializing_if = "Option::is_none")] pub author_id: Option, - #[serde( - rename = "title", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "title", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub title: Option>, - #[serde( - rename = "text", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "text", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub text: Option>, #[serde(rename = "imageId", skip_serializing_if = "Option::is_none")] pub image_id: Option, - #[serde( - rename = "imageUrl", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "imageUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub image_url: Option>, - #[serde( - rename = "createdAt", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "createdAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub created_at: Option>, - #[serde( - rename = "updatedAt", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "updatedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub updated_at: Option>, } @@ -72,3 +47,4 @@ impl GroupAnnouncement { } } } + diff --git a/src/models/group_audit_log_entry.rs b/src/models/group_audit_log_entry.rs index fa1c3d6..861985f 100644 --- a/src/models/group_audit_log_entry.rs +++ b/src/models/group_audit_log_entry.rs @@ -51,3 +51,4 @@ impl GroupAuditLogEntry { } } } + diff --git a/src/models/group_gallery.rs b/src/models/group_gallery.rs index 2515881..3381c82 100644 --- a/src/models/group_gallery.rs +++ b/src/models/group_gallery.rs @@ -22,33 +22,13 @@ pub struct GroupGallery { /// Whether the gallery is members only. #[serde(rename = "membersOnly", skip_serializing_if = "Option::is_none")] pub members_only: Option, - #[serde( - rename = "roleIdsToView", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "roleIdsToView", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub role_ids_to_view: Option>>, - #[serde( - rename = "roleIdsToSubmit", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "roleIdsToSubmit", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub role_ids_to_submit: Option>>, - #[serde( - rename = "roleIdsToAutoApprove", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "roleIdsToAutoApprove", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub role_ids_to_auto_approve: Option>>, - #[serde( - rename = "roleIdsToManage", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "roleIdsToManage", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub role_ids_to_manage: Option>>, #[serde(rename = "createdAt", skip_serializing_if = "Option::is_none")] pub created_at: Option, @@ -72,3 +52,4 @@ impl GroupGallery { } } } + diff --git a/src/models/group_gallery_image.rs b/src/models/group_gallery_image.rs index c06ee0c..bde5170 100644 --- a/src/models/group_gallery_image.rs +++ b/src/models/group_gallery_image.rs @@ -51,3 +51,4 @@ impl GroupGalleryImage { } } } + diff --git a/src/models/group_instance.rs b/src/models/group_instance.rs index 2dc0224..a983594 100644 --- a/src/models/group_instance.rs +++ b/src/models/group_instance.rs @@ -17,23 +17,19 @@ pub struct GroupInstance { #[serde(rename = "location")] pub location: String, #[serde(rename = "world")] - pub world: models::World, + pub world: Box, #[serde(rename = "memberCount")] pub member_count: i32, } impl GroupInstance { - pub fn new( - instance_id: String, - location: String, - world: models::World, - member_count: i32, - ) -> GroupInstance { + pub fn new(instance_id: String, location: String, world: models::World, member_count: i32) -> GroupInstance { GroupInstance { instance_id, location, - world, + world: Box::new(world), member_count, } } } + diff --git a/src/models/group_join_request_action.rs b/src/models/group_join_request_action.rs index 755c9ae..fefdab2 100644 --- a/src/models/group_join_request_action.rs +++ b/src/models/group_join_request_action.rs @@ -15,6 +15,7 @@ pub enum GroupJoinRequestAction { Accept, #[serde(rename = "reject")] Reject, + } impl std::fmt::Display for GroupJoinRequestAction { @@ -31,3 +32,4 @@ impl Default for GroupJoinRequestAction { Self::Accept } } + diff --git a/src/models/group_join_state.rs b/src/models/group_join_state.rs index 55b7597..435a6ea 100644 --- a/src/models/group_join_state.rs +++ b/src/models/group_join_state.rs @@ -19,6 +19,7 @@ pub enum GroupJoinState { Request, #[serde(rename = "open")] Open, + } impl std::fmt::Display for GroupJoinState { @@ -37,3 +38,4 @@ impl Default for GroupJoinState { Self::Closed } } + diff --git a/src/models/group_limited_member.rs b/src/models/group_limited_member.rs index c079e26..828d933 100644 --- a/src/models/group_limited_member.rs +++ b/src/models/group_limited_member.rs @@ -25,57 +25,26 @@ pub struct GroupLimitedMember { pub role_ids: Option>, #[serde(rename = "mRoleIds", skip_serializing_if = "Option::is_none")] pub m_role_ids: Option>, - #[serde( - rename = "joinedAt", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "joinedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub joined_at: Option>, #[serde(rename = "membershipStatus", skip_serializing_if = "Option::is_none")] pub membership_status: Option, #[serde(rename = "visibility", skip_serializing_if = "Option::is_none")] pub visibility: Option, - #[serde( - rename = "isSubscribedToAnnouncements", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "isSubscribedToAnnouncements", skip_serializing_if = "Option::is_none")] pub is_subscribed_to_announcements: Option, /// Only visible via the /groups/:groupId/members endpoint, **not** when fetching a specific user. - #[serde( - rename = "createdAt", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "createdAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub created_at: Option>, /// Only visible via the /groups/:groupId/members endpoint, **not** when fetching a specific user. - #[serde( - rename = "bannedAt", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "bannedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub banned_at: Option>, /// Only visible via the /groups/:groupId/members endpoint, **not** when fetching a specific user. - #[serde( - rename = "managerNotes", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "managerNotes", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub manager_notes: Option>, - #[serde( - rename = "lastPostReadAt", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "lastPostReadAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub last_post_read_at: Option>, - #[serde( - rename = "hasJoinedFromPurchase", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "hasJoinedFromPurchase", skip_serializing_if = "Option::is_none")] pub has_joined_from_purchase: Option, } @@ -100,3 +69,4 @@ impl GroupLimitedMember { } } } + diff --git a/src/models/group_member.rs b/src/models/group_member.rs index f1a8f32..6ef8489 100644 --- a/src/models/group_member.rs +++ b/src/models/group_member.rs @@ -22,62 +22,31 @@ pub struct GroupMember { #[serde(rename = "isRepresenting", skip_serializing_if = "Option::is_none")] pub is_representing: Option, #[serde(rename = "user", skip_serializing_if = "Option::is_none")] - pub user: Option, + pub user: Option>, #[serde(rename = "roleIds", skip_serializing_if = "Option::is_none")] pub role_ids: Option>, #[serde(rename = "mRoleIds", skip_serializing_if = "Option::is_none")] pub m_role_ids: Option>, - #[serde( - rename = "joinedAt", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "joinedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub joined_at: Option>, #[serde(rename = "membershipStatus", skip_serializing_if = "Option::is_none")] pub membership_status: Option, #[serde(rename = "visibility", skip_serializing_if = "Option::is_none")] pub visibility: Option, - #[serde( - rename = "isSubscribedToAnnouncements", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "isSubscribedToAnnouncements", skip_serializing_if = "Option::is_none")] pub is_subscribed_to_announcements: Option, /// Only visible via the /groups/:groupId/members endpoint, **not** when fetching a specific user. - #[serde( - rename = "createdAt", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "createdAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub created_at: Option>, /// Only visible via the /groups/:groupId/members endpoint, **not** when fetching a specific user. - #[serde( - rename = "bannedAt", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "bannedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub banned_at: Option>, /// Only visible via the /groups/:groupId/members endpoint, **not** when fetching a specific user. - #[serde( - rename = "managerNotes", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "managerNotes", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub manager_notes: Option>, - #[serde( - rename = "lastPostReadAt", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "lastPostReadAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub last_post_read_at: Option>, - #[serde( - rename = "hasJoinedFromPurchase", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "hasJoinedFromPurchase", skip_serializing_if = "Option::is_none")] pub has_joined_from_purchase: Option, } @@ -103,3 +72,4 @@ impl GroupMember { } } } + diff --git a/src/models/group_member_limited_user.rs b/src/models/group_member_limited_user.rs index 56c08d7..4606edd 100644 --- a/src/models/group_member_limited_user.rs +++ b/src/models/group_member_limited_user.rs @@ -17,23 +17,13 @@ pub struct GroupMemberLimitedUser { pub id: Option, #[serde(rename = "displayName", skip_serializing_if = "Option::is_none")] pub display_name: Option, - #[serde( - rename = "thumbnailUrl", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "thumbnailUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub thumbnail_url: Option>, #[serde(rename = "iconUrl", skip_serializing_if = "Option::is_none")] pub icon_url: Option, #[serde(rename = "profilePicOverride", skip_serializing_if = "Option::is_none")] pub profile_pic_override: Option, - #[serde( - rename = "currentAvatarThumbnailImageUrl", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "currentAvatarThumbnailImageUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub current_avatar_thumbnail_image_url: Option>, #[serde(rename = "currentAvatarTags", skip_serializing_if = "Option::is_none")] pub current_avatar_tags: Option>, @@ -53,3 +43,4 @@ impl GroupMemberLimitedUser { } } } + diff --git a/src/models/group_member_status.rs b/src/models/group_member_status.rs index 82a0afd..6ccbf78 100644 --- a/src/models/group_member_status.rs +++ b/src/models/group_member_status.rs @@ -23,6 +23,7 @@ pub enum GroupMemberStatus { Banned, #[serde(rename = "userblocked")] Userblocked, + } impl std::fmt::Display for GroupMemberStatus { @@ -43,3 +44,4 @@ impl Default for GroupMemberStatus { Self::Inactive } } + diff --git a/src/models/group_my_member.rs b/src/models/group_my_member.rs index 5b550e6..ab3a3c7 100644 --- a/src/models/group_my_member.rs +++ b/src/models/group_my_member.rs @@ -20,12 +20,7 @@ pub struct GroupMyMember { pub user_id: Option, #[serde(rename = "roleIds", skip_serializing_if = "Option::is_none")] pub role_ids: Option>, - #[serde( - rename = "acceptedByDisplayName", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "acceptedByDisplayName", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub accepted_by_display_name: Option>, /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. #[serde(rename = "acceptedById", skip_serializing_if = "Option::is_none")] @@ -36,10 +31,7 @@ pub struct GroupMyMember { pub manager_notes: Option, #[serde(rename = "membershipStatus", skip_serializing_if = "Option::is_none")] pub membership_status: Option, - #[serde( - rename = "isSubscribedToAnnouncements", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "isSubscribedToAnnouncements", skip_serializing_if = "Option::is_none")] pub is_subscribed_to_announcements: Option, #[serde(rename = "visibility", skip_serializing_if = "Option::is_none")] pub visibility: Option, @@ -47,26 +39,13 @@ pub struct GroupMyMember { pub is_representing: Option, #[serde(rename = "joinedAt", skip_serializing_if = "Option::is_none")] pub joined_at: Option, - #[serde( - rename = "bannedAt", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "bannedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub banned_at: Option>, #[serde(rename = "has2FA", skip_serializing_if = "Option::is_none")] pub has2_fa: Option, - #[serde( - rename = "hasJoinedFromPurchase", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "hasJoinedFromPurchase", skip_serializing_if = "Option::is_none")] pub has_joined_from_purchase: Option, - #[serde( - rename = "lastPostReadAt", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "lastPostReadAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub last_post_read_at: Option>, #[serde(rename = "mRoleIds", skip_serializing_if = "Option::is_none")] pub m_role_ids: Option>, @@ -99,3 +78,4 @@ impl GroupMyMember { } } } + diff --git a/src/models/group_permission.rs b/src/models/group_permission.rs index b40008a..2c1f68c 100644 --- a/src/models/group_permission.rs +++ b/src/models/group_permission.rs @@ -22,10 +22,7 @@ pub struct GroupPermission { #[serde(rename = "help", skip_serializing_if = "Option::is_none")] pub help: Option, /// Whether this permission is a \"management\" permission. - #[serde( - rename = "isManagementPermission", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "isManagementPermission", skip_serializing_if = "Option::is_none")] pub is_management_permission: Option, /// Whether the user is allowed to add this permission to a role. #[serde(rename = "allowedToAdd", skip_serializing_if = "Option::is_none")] @@ -44,3 +41,4 @@ impl GroupPermission { } } } + diff --git a/src/models/group_post.rs b/src/models/group_post.rs index 5d94b42..6b8c06f 100644 --- a/src/models/group_post.rs +++ b/src/models/group_post.rs @@ -31,12 +31,7 @@ pub struct GroupPost { pub text: Option, #[serde(rename = "imageId", skip_serializing_if = "Option::is_none")] pub image_id: Option, - #[serde( - rename = "imageUrl", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "imageUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub image_url: Option>, #[serde(rename = "createdAt", skip_serializing_if = "Option::is_none")] pub created_at: Option, @@ -62,3 +57,4 @@ impl GroupPost { } } } + diff --git a/src/models/group_post_visibility.rs b/src/models/group_post_visibility.rs index f8238a8..a41d4b7 100644 --- a/src/models/group_post_visibility.rs +++ b/src/models/group_post_visibility.rs @@ -15,6 +15,7 @@ pub enum GroupPostVisibility { Group, #[serde(rename = "public")] Public, + } impl std::fmt::Display for GroupPostVisibility { @@ -31,3 +32,4 @@ impl Default for GroupPostVisibility { Self::Group } } + diff --git a/src/models/group_privacy.rs b/src/models/group_privacy.rs index 2ea289d..7a4ccec 100644 --- a/src/models/group_privacy.rs +++ b/src/models/group_privacy.rs @@ -15,6 +15,7 @@ pub enum GroupPrivacy { Default, #[serde(rename = "private")] Private, + } impl std::fmt::Display for GroupPrivacy { @@ -31,3 +32,4 @@ impl Default for GroupPrivacy { Self::Default } } + diff --git a/src/models/group_role.rs b/src/models/group_role.rs index 55c8cca..7b92517 100644 --- a/src/models/group_role.rs +++ b/src/models/group_role.rs @@ -55,3 +55,4 @@ impl GroupRole { } } } + diff --git a/src/models/group_role_template.rs b/src/models/group_role_template.rs index 51279a0..350764e 100644 --- a/src/models/group_role_template.rs +++ b/src/models/group_role_template.rs @@ -19,6 +19,7 @@ pub enum GroupRoleTemplate { ManagedInvite, #[serde(rename = "managedRequest")] ManagedRequest, + } impl std::fmt::Display for GroupRoleTemplate { @@ -37,3 +38,4 @@ impl Default for GroupRoleTemplate { Self::Default } } + diff --git a/src/models/group_search_sort.rs b/src/models/group_search_sort.rs index fa8687f..7804b91 100644 --- a/src/models/group_search_sort.rs +++ b/src/models/group_search_sort.rs @@ -15,6 +15,7 @@ pub enum GroupSearchSort { Asc, #[serde(rename = "joinedAt:desc")] Desc, + } impl std::fmt::Display for GroupSearchSort { @@ -31,3 +32,4 @@ impl Default for GroupSearchSort { Self::Asc } } + diff --git a/src/models/group_user_visibility.rs b/src/models/group_user_visibility.rs index 959ada3..170b660 100644 --- a/src/models/group_user_visibility.rs +++ b/src/models/group_user_visibility.rs @@ -17,6 +17,7 @@ pub enum GroupUserVisibility { Hidden, #[serde(rename = "friends")] Friends, + } impl std::fmt::Display for GroupUserVisibility { @@ -34,3 +35,4 @@ impl Default for GroupUserVisibility { Self::Visible } } + diff --git a/src/models/info_push.rs b/src/models/info_push.rs index 950887d..4820756 100644 --- a/src/models/info_push.rs +++ b/src/models/info_push.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// InfoPush : +/// InfoPush : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct InfoPush { #[serde(rename = "id")] @@ -23,7 +23,7 @@ pub struct InfoPush { #[serde(rename = "tags")] pub tags: Vec, #[serde(rename = "data")] - pub data: models::InfoPushData, + pub data: Box, /// Unknown usage, MD5 #[serde(rename = "hash")] pub hash: String, @@ -38,24 +38,14 @@ pub struct InfoPush { } impl InfoPush { - pub fn new( - id: String, - is_enabled: bool, - release_status: models::ReleaseStatus, - priority: i32, - tags: Vec, - data: models::InfoPushData, - hash: String, - created_at: String, - updated_at: String, - ) -> InfoPush { + pub fn new(id: String, is_enabled: bool, release_status: models::ReleaseStatus, priority: i32, tags: Vec, data: models::InfoPushData, hash: String, created_at: String, updated_at: String) -> InfoPush { InfoPush { id, is_enabled, release_status, priority, tags, - data, + data: Box::new(data), hash, created_at, updated_at, @@ -64,3 +54,4 @@ impl InfoPush { } } } + diff --git a/src/models/info_push_data.rs b/src/models/info_push_data.rs index ef6a8ea..a1327b9 100644 --- a/src/models/info_push_data.rs +++ b/src/models/info_push_data.rs @@ -9,11 +9,11 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// InfoPushData : +/// InfoPushData : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct InfoPushData { #[serde(rename = "contentList", skip_serializing_if = "Option::is_none")] - pub content_list: Option, + pub content_list: Option>, #[serde(rename = "description", skip_serializing_if = "Option::is_none")] pub description: Option, #[serde(rename = "imageUrl", skip_serializing_if = "Option::is_none")] @@ -21,13 +21,13 @@ pub struct InfoPushData { #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, #[serde(rename = "onPressed", skip_serializing_if = "Option::is_none")] - pub on_pressed: Option, + pub on_pressed: Option>, #[serde(rename = "template", skip_serializing_if = "Option::is_none")] pub template: Option, #[serde(rename = "version", skip_serializing_if = "Option::is_none")] pub version: Option, #[serde(rename = "article", skip_serializing_if = "Option::is_none")] - pub article: Option, + pub article: Option>, } impl InfoPushData { @@ -44,3 +44,4 @@ impl InfoPushData { } } } + diff --git a/src/models/info_push_data_article.rs b/src/models/info_push_data_article.rs index 4550dff..0970fe1 100644 --- a/src/models/info_push_data_article.rs +++ b/src/models/info_push_data_article.rs @@ -12,11 +12,14 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct InfoPushDataArticle { #[serde(rename = "content", skip_serializing_if = "Option::is_none")] - pub content: Option, + pub content: Option>, } impl InfoPushDataArticle { pub fn new() -> InfoPushDataArticle { - InfoPushDataArticle { content: None } + InfoPushDataArticle { + content: None, + } } } + diff --git a/src/models/info_push_data_article_content.rs b/src/models/info_push_data_article_content.rs index 56030d2..1780437 100644 --- a/src/models/info_push_data_article_content.rs +++ b/src/models/info_push_data_article_content.rs @@ -16,7 +16,7 @@ pub struct InfoPushDataArticleContent { #[serde(rename = "imageUrl", skip_serializing_if = "Option::is_none")] pub image_url: Option, #[serde(rename = "onPressed", skip_serializing_if = "Option::is_none")] - pub on_pressed: Option, + pub on_pressed: Option>, } impl InfoPushDataArticleContent { @@ -28,3 +28,4 @@ impl InfoPushDataArticleContent { } } } + diff --git a/src/models/info_push_data_clickable.rs b/src/models/info_push_data_clickable.rs index 28a1ca6..a736f90 100644 --- a/src/models/info_push_data_clickable.rs +++ b/src/models/info_push_data_clickable.rs @@ -43,3 +43,4 @@ impl Default for Command { Self::OpenUrl } } + diff --git a/src/models/instance.rs b/src/models/instance.rs index 3864802..4e4e107 100644 --- a/src/models/instance.rs +++ b/src/models/instance.rs @@ -36,31 +36,21 @@ pub struct Instance { #[serde(rename = "name")] pub name: String, /// A groupId if the instance type is \"group\", null if instance type is public, or a userId otherwise - #[serde( - rename = "ownerId", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "ownerId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub owner_id: Option>, #[serde(rename = "permanent")] pub permanent: bool, #[serde(rename = "photonRegion")] pub photon_region: models::Region, #[serde(rename = "platforms")] - pub platforms: models::InstancePlatforms, + pub platforms: Box, #[serde(rename = "region")] pub region: models::InstanceRegion, #[serde(rename = "secureName")] pub secure_name: String, - #[serde( - rename = "shortName", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "shortName", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub short_name: Option>, - /// The tags array on Instances usually contain the language tags of the people in the instance. + /// The tags array on Instances usually contain the language tags of the people in the instance. #[serde(rename = "tags")] pub tags: Vec, #[serde(rename = "type")] @@ -90,7 +80,7 @@ pub struct Instance { #[serde(rename = "userCount")] pub user_count: i32, #[serde(rename = "world")] - pub world: models::World, + pub world: Box, /// The users field is present on instances created by the requesting user. #[serde(rename = "users", skip_serializing_if = "Option::is_none")] pub users: Option>, @@ -100,50 +90,15 @@ pub struct Instance { pub has_capacity_for_you: Option, #[serde(rename = "nonce", skip_serializing_if = "Option::is_none")] pub nonce: Option, - #[serde( - rename = "closedAt", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "closedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub closed_at: Option>, - #[serde( - rename = "hardClose", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "hardClose", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub hard_close: Option>, } impl Instance { /// * `hidden` field is only present if InstanceType is `hidden` aka \"Friends+\", and is instance creator. * `friends` field is only present if InstanceType is `friends` aka \"Friends\", and is instance creator. * `private` field is only present if InstanceType is `private` aka \"Invite\" or \"Invite+\", and is instance creator. - pub fn new( - active: bool, - can_request_invite: bool, - capacity: i32, - client_number: String, - full: bool, - id: String, - instance_id: String, - location: String, - n_users: i32, - name: String, - permanent: bool, - photon_region: models::Region, - platforms: models::InstancePlatforms, - region: models::InstanceRegion, - secure_name: String, - tags: Vec, - r#type: models::InstanceType, - world_id: String, - queue_enabled: bool, - queue_size: i32, - recommended_capacity: i32, - strict: bool, - user_count: i32, - world: models::World, - ) -> Instance { + pub fn new(active: bool, can_request_invite: bool, capacity: i32, client_number: String, full: bool, id: String, instance_id: String, location: String, n_users: i32, name: String, permanent: bool, photon_region: models::Region, platforms: models::InstancePlatforms, region: models::InstanceRegion, secure_name: String, tags: Vec, r#type: models::InstanceType, world_id: String, queue_enabled: bool, queue_size: i32, recommended_capacity: i32, strict: bool, user_count: i32, world: models::World) -> Instance { Instance { active, can_request_invite, @@ -158,7 +113,7 @@ impl Instance { owner_id: None, permanent, photon_region, - platforms, + platforms: Box::new(platforms), region, secure_name, short_name: None, @@ -174,7 +129,7 @@ impl Instance { role_restricted: None, strict, user_count, - world, + world: Box::new(world), users: None, group_access_type: None, has_capacity_for_you: None, @@ -184,3 +139,4 @@ impl Instance { } } } + diff --git a/src/models/instance_platforms.rs b/src/models/instance_platforms.rs index 8198cc8..4d65645 100644 --- a/src/models/instance_platforms.rs +++ b/src/models/instance_platforms.rs @@ -25,3 +25,4 @@ impl InstancePlatforms { } } } + diff --git a/src/models/instance_region.rs b/src/models/instance_region.rs index 4884c95..8377128 100644 --- a/src/models/instance_region.rs +++ b/src/models/instance_region.rs @@ -21,6 +21,7 @@ pub enum InstanceRegion { Eu, #[serde(rename = "jp")] Jp, + } impl std::fmt::Display for InstanceRegion { @@ -39,3 +40,4 @@ impl Default for InstanceRegion { Self::Us } } + diff --git a/src/models/instance_short_name_response.rs b/src/models/instance_short_name_response.rs index cd362cb..78240ba 100644 --- a/src/models/instance_short_name_response.rs +++ b/src/models/instance_short_name_response.rs @@ -25,3 +25,4 @@ impl InstanceShortNameResponse { } } } + diff --git a/src/models/instance_type.rs b/src/models/instance_type.rs index 17c822f..62e65e5 100644 --- a/src/models/instance_type.rs +++ b/src/models/instance_type.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// InstanceType : +/// InstanceType : #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum InstanceType { #[serde(rename = "public")] @@ -22,6 +22,7 @@ pub enum InstanceType { Private, #[serde(rename = "group")] Group, + } impl std::fmt::Display for InstanceType { @@ -41,3 +42,4 @@ impl Default for InstanceType { Self::Public } } + diff --git a/src/models/invite_message.rs b/src/models/invite_message.rs index 6b271d7..3943e90 100644 --- a/src/models/invite_message.rs +++ b/src/models/invite_message.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// InviteMessage : +/// InviteMessage : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct InviteMessage { #[serde(rename = "canBeUpdated")] @@ -30,15 +30,7 @@ pub struct InviteMessage { } impl InviteMessage { - pub fn new( - can_be_updated: bool, - id: String, - message: String, - message_type: models::InviteMessageType, - remaining_cooldown_minutes: i32, - slot: i32, - updated_at: String, - ) -> InviteMessage { + pub fn new(can_be_updated: bool, id: String, message: String, message_type: models::InviteMessageType, remaining_cooldown_minutes: i32, slot: i32, updated_at: String) -> InviteMessage { InviteMessage { can_be_updated, id, @@ -50,3 +42,4 @@ impl InviteMessage { } } } + diff --git a/src/models/invite_message_type.rs b/src/models/invite_message_type.rs index f34e2fb..3495fb2 100644 --- a/src/models/invite_message_type.rs +++ b/src/models/invite_message_type.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// InviteMessageType : +/// InviteMessageType : #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum InviteMessageType { #[serde(rename = "message")] @@ -20,6 +20,7 @@ pub enum InviteMessageType { Request, #[serde(rename = "requestResponse")] RequestResponse, + } impl std::fmt::Display for InviteMessageType { @@ -38,3 +39,4 @@ impl Default for InviteMessageType { Self::Message } } + diff --git a/src/models/invite_request.rs b/src/models/invite_request.rs index 37a060c..99e045c 100644 --- a/src/models/invite_request.rs +++ b/src/models/invite_request.rs @@ -26,3 +26,4 @@ impl InviteRequest { } } } + diff --git a/src/models/invite_response.rs b/src/models/invite_response.rs index 659c009..ede5719 100644 --- a/src/models/invite_response.rs +++ b/src/models/invite_response.rs @@ -17,6 +17,9 @@ pub struct InviteResponse { impl InviteResponse { pub fn new(response_slot: i32) -> InviteResponse { - InviteResponse { response_slot } + InviteResponse { + response_slot, + } } } + diff --git a/src/models/license.rs b/src/models/license.rs index 8ff200a..d4252b5 100644 --- a/src/models/license.rs +++ b/src/models/license.rs @@ -23,12 +23,7 @@ pub struct License { } impl License { - pub fn new( - for_id: String, - for_type: models::LicenseType, - for_name: String, - for_action: models::LicenseAction, - ) -> License { + pub fn new(for_id: String, for_type: models::LicenseType, for_name: String, for_action: models::LicenseAction) -> License { License { for_id, for_type, @@ -37,3 +32,4 @@ impl License { } } } + diff --git a/src/models/license_action.rs b/src/models/license_action.rs index 40c7119..5f77da5 100644 --- a/src/models/license_action.rs +++ b/src/models/license_action.rs @@ -15,6 +15,7 @@ pub enum LicenseAction { Wear, #[serde(rename = "have")] Have, + } impl std::fmt::Display for LicenseAction { @@ -31,3 +32,4 @@ impl Default for LicenseAction { Self::Wear } } + diff --git a/src/models/license_group.rs b/src/models/license_group.rs index 94bc999..1759e7e 100644 --- a/src/models/license_group.rs +++ b/src/models/license_group.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// LicenseGroup : +/// LicenseGroup : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct LicenseGroup { #[serde(rename = "id")] @@ -23,12 +23,7 @@ pub struct LicenseGroup { } impl LicenseGroup { - pub fn new( - id: String, - name: String, - description: String, - licenses: Vec, - ) -> LicenseGroup { + pub fn new(id: String, name: String, description: String, licenses: Vec) -> LicenseGroup { LicenseGroup { id, name, @@ -37,3 +32,4 @@ impl LicenseGroup { } } } + diff --git a/src/models/license_type.rs b/src/models/license_type.rs index 718cc2a..481a199 100644 --- a/src/models/license_type.rs +++ b/src/models/license_type.rs @@ -19,6 +19,7 @@ pub enum LicenseType { Permission, #[serde(rename = "product")] Product, + } impl std::fmt::Display for LicenseType { @@ -37,3 +38,4 @@ impl Default for LicenseType { Self::Avatar } } + diff --git a/src/models/limited_group.rs b/src/models/limited_group.rs index e2b6ed5..59df18f 100644 --- a/src/models/limited_group.rs +++ b/src/models/limited_group.rs @@ -21,43 +21,18 @@ pub struct LimitedGroup { pub discriminator: Option, #[serde(rename = "description", skip_serializing_if = "Option::is_none")] pub description: Option, - #[serde( - rename = "iconUrl", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "iconUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub icon_url: Option>, - #[serde( - rename = "bannerUrl", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "bannerUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub banner_url: Option>, /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. #[serde(rename = "ownerId", skip_serializing_if = "Option::is_none")] pub owner_id: Option, - #[serde( - rename = "rules", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "rules", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub rules: Option>, - #[serde( - rename = "iconId", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "iconId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub icon_id: Option>, - #[serde( - rename = "bannerId", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "bannerId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub banner_id: Option>, #[serde(rename = "memberCount", skip_serializing_if = "Option::is_none")] pub member_count: Option, @@ -96,3 +71,4 @@ impl LimitedGroup { } } } + diff --git a/src/models/limited_unity_package.rs b/src/models/limited_unity_package.rs index 8923bf7..d671080 100644 --- a/src/models/limited_unity_package.rs +++ b/src/models/limited_unity_package.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// LimitedUnityPackage : +/// LimitedUnityPackage : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct LimitedUnityPackage { /// This can be `standalonewindows` or `android`, but can also pretty much be any random Unity verison such as `2019.2.4-801-Release` or `2019.2.2-772-Release` or even `unknownplatform`. @@ -27,3 +27,4 @@ impl LimitedUnityPackage { } } } + diff --git a/src/models/limited_user.rs b/src/models/limited_user.rs index 24ccaa5..d444f30 100644 --- a/src/models/limited_user.rs +++ b/src/models/limited_user.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// LimitedUser : +/// LimitedUser : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct LimitedUser { #[serde(rename = "bio", skip_serializing_if = "Option::is_none")] @@ -17,16 +17,10 @@ pub struct LimitedUser { #[serde(rename = "bioLinks", skip_serializing_if = "Option::is_none")] pub bio_links: Option>, /// When profilePicOverride is not empty, use it instead. - #[serde( - rename = "currentAvatarImageUrl", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "currentAvatarImageUrl", skip_serializing_if = "Option::is_none")] pub current_avatar_image_url: Option, /// When profilePicOverride is not empty, use it instead. - #[serde( - rename = "currentAvatarThumbnailImageUrl", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "currentAvatarThumbnailImageUrl", skip_serializing_if = "Option::is_none")] pub current_avatar_thumbnail_image_url: Option, #[serde(rename = "currentAvatarTags", skip_serializing_if = "Option::is_none")] pub current_avatar_tags: Option>, @@ -67,16 +61,7 @@ pub struct LimitedUser { } impl LimitedUser { - pub fn new( - developer_type: models::DeveloperType, - display_name: String, - id: String, - is_friend: bool, - last_platform: String, - status: models::UserStatus, - status_description: String, - tags: Vec, - ) -> LimitedUser { + pub fn new(developer_type: models::DeveloperType, display_name: String, id: String, is_friend: bool, last_platform: String, status: models::UserStatus, status_description: String, tags: Vec) -> LimitedUser { LimitedUser { bio: None, bio_links: None, @@ -101,3 +86,4 @@ impl LimitedUser { } } } + diff --git a/src/models/limited_user_groups.rs b/src/models/limited_user_groups.rs index e1f9a90..df37168 100644 --- a/src/models/limited_user_groups.rs +++ b/src/models/limited_user_groups.rs @@ -21,42 +21,17 @@ pub struct LimitedUserGroups { pub discriminator: Option, #[serde(rename = "description", skip_serializing_if = "Option::is_none")] pub description: Option, - #[serde( - rename = "iconId", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "iconId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub icon_id: Option>, - #[serde( - rename = "iconUrl", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "iconUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub icon_url: Option>, - #[serde( - rename = "bannerId", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "bannerId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub banner_id: Option>, - #[serde( - rename = "bannerUrl", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "bannerUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub banner_url: Option>, #[serde(rename = "privacy", skip_serializing_if = "Option::is_none")] pub privacy: Option, - #[serde( - rename = "lastPostCreatedAt", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "lastPostCreatedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub last_post_created_at: Option>, /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. #[serde(rename = "ownerId", skip_serializing_if = "Option::is_none")] @@ -71,12 +46,7 @@ pub struct LimitedUserGroups { pub is_representing: Option, #[serde(rename = "mutualGroup", skip_serializing_if = "Option::is_none")] pub mutual_group: Option, - #[serde( - rename = "lastPostReadAt", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "lastPostReadAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub last_post_read_at: Option>, } @@ -104,3 +74,4 @@ impl LimitedUserGroups { } } } + diff --git a/src/models/limited_world.rs b/src/models/limited_world.rs index 42ddf14..de89bac 100644 --- a/src/models/limited_world.rs +++ b/src/models/limited_world.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// LimitedWorld : +/// LimitedWorld : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct LimitedWorld { /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. @@ -19,10 +19,7 @@ pub struct LimitedWorld { pub author_name: String, #[serde(rename = "capacity")] pub capacity: i32, - #[serde( - rename = "recommendedCapacity", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "recommendedCapacity", skip_serializing_if = "Option::is_none")] pub recommended_capacity: Option, #[serde(rename = "created_at")] pub created_at: String, @@ -47,12 +44,7 @@ pub struct LimitedWorld { pub organization: String, #[serde(rename = "popularity")] pub popularity: i32, - #[serde( - rename = "previewYoutubeId", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "previewYoutubeId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub preview_youtube_id: Option>, #[serde(rename = "publicationDate")] pub publication_date: String, @@ -71,27 +63,7 @@ pub struct LimitedWorld { } impl LimitedWorld { - pub fn new( - author_id: String, - author_name: String, - capacity: i32, - created_at: String, - favorites: i32, - heat: i32, - id: String, - image_url: String, - labs_publication_date: String, - name: String, - occupants: i32, - organization: String, - popularity: i32, - publication_date: String, - release_status: models::ReleaseStatus, - tags: Vec, - thumbnail_image_url: String, - unity_packages: Vec, - updated_at: String, - ) -> LimitedWorld { + pub fn new(author_id: String, author_name: String, capacity: i32, created_at: String, favorites: i32, heat: i32, id: String, image_url: String, labs_publication_date: String, name: String, occupants: i32, organization: String, popularity: i32, publication_date: String, release_status: models::ReleaseStatus, tags: Vec, thumbnail_image_url: String, unity_packages: Vec, updated_at: String) -> LimitedWorld { LimitedWorld { author_id, author_name, @@ -119,3 +91,4 @@ impl LimitedWorld { } } } + diff --git a/src/models/mime_type.rs b/src/models/mime_type.rs index 5d40575..537cacf 100644 --- a/src/models/mime_type.rs +++ b/src/models/mime_type.rs @@ -39,6 +39,7 @@ pub enum MimeType { ApplicationSlashXRsyncDelta, #[serde(rename = "application/octet-stream")] ApplicationSlashOctetStream, + } impl std::fmt::Display for MimeType { @@ -67,3 +68,4 @@ impl Default for MimeType { Self::ImageSlashJpeg } } + diff --git a/src/models/moderate_user_request.rs b/src/models/moderate_user_request.rs index 90afe6c..298a5fd 100644 --- a/src/models/moderate_user_request.rs +++ b/src/models/moderate_user_request.rs @@ -20,6 +20,10 @@ pub struct ModerateUserRequest { impl ModerateUserRequest { pub fn new(moderated: String, r#type: models::PlayerModerationType) -> ModerateUserRequest { - ModerateUserRequest { moderated, r#type } + ModerateUserRequest { + moderated, + r#type, + } } } + diff --git a/src/models/notification.rs b/src/models/notification.rs index 8246eee..064d8b0 100644 --- a/src/models/notification.rs +++ b/src/models/notification.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// Notification : +/// Notification : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Notification { #[serde(rename = "created_at")] @@ -38,14 +38,7 @@ pub struct Notification { } impl Notification { - pub fn new( - created_at: String, - details: String, - id: String, - message: String, - sender_user_id: String, - r#type: models::NotificationType, - ) -> Notification { + pub fn new(created_at: String, details: String, id: String, message: String, sender_user_id: String, r#type: models::NotificationType) -> Notification { Notification { created_at, details, @@ -59,3 +52,4 @@ impl Notification { } } } + diff --git a/src/models/notification_detail_invite.rs b/src/models/notification_detail_invite.rs index 970ebb2..b4b6445 100644 --- a/src/models/notification_detail_invite.rs +++ b/src/models/notification_detail_invite.rs @@ -29,3 +29,4 @@ impl NotificationDetailInvite { } } } + diff --git a/src/models/notification_detail_invite_response.rs b/src/models/notification_detail_invite_response.rs index 783aff9..f231bcd 100644 --- a/src/models/notification_detail_invite_response.rs +++ b/src/models/notification_detail_invite_response.rs @@ -18,13 +18,11 @@ pub struct NotificationDetailInviteResponse { } impl NotificationDetailInviteResponse { - pub fn new( - in_response_to: String, - response_message: String, - ) -> NotificationDetailInviteResponse { + pub fn new(in_response_to: String, response_message: String) -> NotificationDetailInviteResponse { NotificationDetailInviteResponse { in_response_to, response_message, } } } + diff --git a/src/models/notification_detail_request_invite.rs b/src/models/notification_detail_request_invite.rs index 9729470..0c36c63 100644 --- a/src/models/notification_detail_request_invite.rs +++ b/src/models/notification_detail_request_invite.rs @@ -27,3 +27,4 @@ impl NotificationDetailRequestInvite { } } } + diff --git a/src/models/notification_detail_request_invite_response.rs b/src/models/notification_detail_request_invite_response.rs index 36e99b6..d8c90bb 100644 --- a/src/models/notification_detail_request_invite_response.rs +++ b/src/models/notification_detail_request_invite_response.rs @@ -26,3 +26,4 @@ impl NotificationDetailRequestInviteResponse { } } } + diff --git a/src/models/notification_detail_vote_to_kick.rs b/src/models/notification_detail_vote_to_kick.rs index f417254..7352345 100644 --- a/src/models/notification_detail_vote_to_kick.rs +++ b/src/models/notification_detail_vote_to_kick.rs @@ -27,3 +27,4 @@ impl NotificationDetailVoteToKick { } } } + diff --git a/src/models/notification_type.rs b/src/models/notification_type.rs index af39a7e..e5decf8 100644 --- a/src/models/notification_type.rs +++ b/src/models/notification_type.rs @@ -25,6 +25,7 @@ pub enum NotificationType { RequestInviteResponse, #[serde(rename = "votetokick")] Votetokick, + } impl std::fmt::Display for NotificationType { @@ -46,3 +47,4 @@ impl Default for NotificationType { Self::FriendRequest } } + diff --git a/src/models/order_option.rs b/src/models/order_option.rs index 7ea5c5c..e0edb6d 100644 --- a/src/models/order_option.rs +++ b/src/models/order_option.rs @@ -15,6 +15,7 @@ pub enum OrderOption { Ascending, #[serde(rename = "descending")] Descending, + } impl std::fmt::Display for OrderOption { @@ -31,3 +32,4 @@ impl Default for OrderOption { Self::Ascending } } + diff --git a/src/models/paginated_group_audit_log_entry_list.rs b/src/models/paginated_group_audit_log_entry_list.rs index 43bd343..c801d35 100644 --- a/src/models/paginated_group_audit_log_entry_list.rs +++ b/src/models/paginated_group_audit_log_entry_list.rs @@ -30,3 +30,4 @@ impl PaginatedGroupAuditLogEntryList { } } } + diff --git a/src/models/past_display_name.rs b/src/models/past_display_name.rs index f9e7340..62bdf29 100644 --- a/src/models/past_display_name.rs +++ b/src/models/past_display_name.rs @@ -25,3 +25,4 @@ impl PastDisplayName { } } } + diff --git a/src/models/permission.rs b/src/models/permission.rs index 83e8855..e37afd2 100644 --- a/src/models/permission.rs +++ b/src/models/permission.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// Permission : +/// Permission : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Permission { #[serde(rename = "id")] @@ -26,12 +26,7 @@ pub struct Permission { } impl Permission { - pub fn new( - id: String, - owner_display_name: String, - name: String, - owner_id: String, - ) -> Permission { + pub fn new(id: String, owner_display_name: String, name: String, owner_id: String) -> Permission { Permission { id, owner_display_name, @@ -41,3 +36,4 @@ impl Permission { } } } + diff --git a/src/models/player_moderation.rs b/src/models/player_moderation.rs index 377cd26..1b2082e 100644 --- a/src/models/player_moderation.rs +++ b/src/models/player_moderation.rs @@ -30,15 +30,7 @@ pub struct PlayerModeration { } impl PlayerModeration { - pub fn new( - created: String, - id: String, - source_display_name: String, - source_user_id: String, - target_display_name: String, - target_user_id: String, - r#type: models::PlayerModerationType, - ) -> PlayerModeration { + pub fn new(created: String, id: String, source_display_name: String, source_user_id: String, target_display_name: String, target_user_id: String, r#type: models::PlayerModerationType) -> PlayerModeration { PlayerModeration { created, id, @@ -50,3 +42,4 @@ impl PlayerModeration { } } } + diff --git a/src/models/player_moderation_type.rs b/src/models/player_moderation_type.rs index 996d02e..d9cfcff 100644 --- a/src/models/player_moderation_type.rs +++ b/src/models/player_moderation_type.rs @@ -23,6 +23,7 @@ pub enum PlayerModerationType { InteractOn, #[serde(rename = "interactOff")] InteractOff, + } impl std::fmt::Display for PlayerModerationType { @@ -43,3 +44,4 @@ impl Default for PlayerModerationType { Self::Mute } } + diff --git a/src/models/region.rs b/src/models/region.rs index f25ed76..25c132f 100644 --- a/src/models/region.rs +++ b/src/models/region.rs @@ -25,6 +25,7 @@ pub enum Region { Jp, #[serde(rename = "unknown")] Unknown, + } impl std::fmt::Display for Region { @@ -45,3 +46,4 @@ impl Default for Region { Self::Us } } + diff --git a/src/models/release_status.rs b/src/models/release_status.rs index ab27aa6..661b25e 100644 --- a/src/models/release_status.rs +++ b/src/models/release_status.rs @@ -19,6 +19,7 @@ pub enum ReleaseStatus { Hidden, #[serde(rename = "all")] All, + } impl std::fmt::Display for ReleaseStatus { @@ -37,3 +38,4 @@ impl Default for ReleaseStatus { Self::Public } } + diff --git a/src/models/represented_group.rs b/src/models/represented_group.rs index 0b345f8..01ccd45 100644 --- a/src/models/represented_group.rs +++ b/src/models/represented_group.rs @@ -19,33 +19,13 @@ pub struct RepresentedGroup { pub discriminator: Option, #[serde(rename = "description", skip_serializing_if = "Option::is_none")] pub description: Option, - #[serde( - rename = "iconId", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "iconId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub icon_id: Option>, - #[serde( - rename = "iconUrl", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "iconUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub icon_url: Option>, - #[serde( - rename = "bannerId", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "bannerId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub banner_id: Option>, - #[serde( - rename = "bannerUrl", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "bannerUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub banner_url: Option>, #[serde(rename = "privacy", skip_serializing_if = "Option::is_none")] pub privacy: Option, @@ -82,3 +62,4 @@ impl RepresentedGroup { } } } + diff --git a/src/models/request_invite_request.rs b/src/models/request_invite_request.rs index 330a7f9..c52de69 100644 --- a/src/models/request_invite_request.rs +++ b/src/models/request_invite_request.rs @@ -17,6 +17,9 @@ pub struct RequestInviteRequest { impl RequestInviteRequest { pub fn new() -> RequestInviteRequest { - RequestInviteRequest { message_slot: None } + RequestInviteRequest { + message_slot: None, + } } } + diff --git a/src/models/respond_group_join_request.rs b/src/models/respond_group_join_request.rs index 094900c..bed29c9 100644 --- a/src/models/respond_group_join_request.rs +++ b/src/models/respond_group_join_request.rs @@ -26,3 +26,4 @@ impl RespondGroupJoinRequest { } } } + diff --git a/src/models/response.rs b/src/models/response.rs index 7e8fdab..7d72400 100644 --- a/src/models/response.rs +++ b/src/models/response.rs @@ -25,3 +25,4 @@ impl Response { } } } + diff --git a/src/models/sent_notification.rs b/src/models/sent_notification.rs index 878bd3b..07ba5ac 100644 --- a/src/models/sent_notification.rs +++ b/src/models/sent_notification.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// SentNotification : +/// SentNotification : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct SentNotification { #[serde(rename = "created_at")] @@ -34,15 +34,7 @@ pub struct SentNotification { } impl SentNotification { - pub fn new( - created_at: String, - details: serde_json::Value, - id: String, - message: String, - receiver_user_id: String, - sender_user_id: String, - r#type: models::NotificationType, - ) -> SentNotification { + pub fn new(created_at: String, details: serde_json::Value, id: String, message: String, receiver_user_id: String, sender_user_id: String, r#type: models::NotificationType) -> SentNotification { SentNotification { created_at, details, @@ -55,3 +47,4 @@ impl SentNotification { } } } + diff --git a/src/models/sort_option.rs b/src/models/sort_option.rs index 74d99e9..7d4f786 100644 --- a/src/models/sort_option.rs +++ b/src/models/sort_option.rs @@ -47,6 +47,7 @@ pub enum SortOption { Magic, #[serde(rename = "name")] Name, + } impl std::fmt::Display for SortOption { @@ -79,3 +80,4 @@ impl Default for SortOption { Self::Popularity } } + diff --git a/src/models/subscription.rs b/src/models/subscription.rs index 28684e2..aba7cc0 100644 --- a/src/models/subscription.rs +++ b/src/models/subscription.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// Subscription : +/// Subscription : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Subscription { #[serde(rename = "id")] @@ -35,14 +35,7 @@ pub struct Subscription { } impl Subscription { - pub fn new( - id: String, - steam_item_id: String, - amount: f64, - description: String, - period: models::SubscriptionPeriod, - tier: f64, - ) -> Subscription { + pub fn new(id: String, steam_item_id: String, amount: f64, description: String, period: models::SubscriptionPeriod, tier: f64) -> Subscription { Subscription { id, steam_item_id, @@ -57,3 +50,4 @@ impl Subscription { } } } + diff --git a/src/models/subscription_period.rs b/src/models/subscription_period.rs index dd90a35..386e44a 100644 --- a/src/models/subscription_period.rs +++ b/src/models/subscription_period.rs @@ -21,6 +21,7 @@ pub enum SubscriptionPeriod { Month, #[serde(rename = "year")] Year, + } impl std::fmt::Display for SubscriptionPeriod { @@ -40,3 +41,4 @@ impl Default for SubscriptionPeriod { Self::Hour } } + diff --git a/src/models/success.rs b/src/models/success.rs index 96d2091..4e52df7 100644 --- a/src/models/success.rs +++ b/src/models/success.rs @@ -12,11 +12,14 @@ use serde::{Deserialize, Serialize}; #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Success { #[serde(rename = "success", skip_serializing_if = "Option::is_none")] - pub success: Option, + pub success: Option>, } impl Success { pub fn new() -> Success { - Success { success: None } + Success { + success: None, + } } } + diff --git a/src/models/transaction.rs b/src/models/transaction.rs index 53cb21b..8ea976e 100644 --- a/src/models/transaction.rs +++ b/src/models/transaction.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// Transaction : +/// Transaction : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct Transaction { #[serde(rename = "id")] @@ -22,7 +22,7 @@ pub struct Transaction { #[serde(rename = "status")] pub status: models::TransactionStatus, #[serde(rename = "subscription")] - pub subscription: models::Subscription, + pub subscription: Box, #[serde(rename = "sandbox")] pub sandbox: bool, #[serde(rename = "created_at")] @@ -30,9 +30,9 @@ pub struct Transaction { #[serde(rename = "updated_at")] pub updated_at: String, #[serde(rename = "steam", skip_serializing_if = "Option::is_none")] - pub steam: Option, + pub steam: Option>, #[serde(rename = "agreement", skip_serializing_if = "Option::is_none")] - pub agreement: Option, + pub agreement: Option>, #[serde(rename = "error")] pub error: String, #[serde(rename = "isGift", skip_serializing_if = "Option::is_none")] @@ -42,21 +42,13 @@ pub struct Transaction { } impl Transaction { - pub fn new( - id: String, - status: models::TransactionStatus, - subscription: models::Subscription, - sandbox: bool, - created_at: String, - updated_at: String, - error: String, - ) -> Transaction { + pub fn new(id: String, status: models::TransactionStatus, subscription: models::Subscription, sandbox: bool, created_at: String, updated_at: String, error: String) -> Transaction { Transaction { id, user_id: None, user_display_name: None, status, - subscription, + subscription: Box::new(subscription), sandbox, created_at, updated_at, @@ -68,3 +60,4 @@ impl Transaction { } } } + diff --git a/src/models/transaction_agreement.rs b/src/models/transaction_agreement.rs index c09cdd5..cfb4b46 100644 --- a/src/models/transaction_agreement.rs +++ b/src/models/transaction_agreement.rs @@ -53,26 +53,7 @@ pub struct TransactionAgreement { impl TransactionAgreement { /// Represents a single Transaction, which is likely between VRChat and Steam. - pub fn new( - agreement_id: String, - item_id: f64, - agreement: String, - status: String, - period: String, - frequency: f64, - billing_type: String, - start_date: String, - end_date: String, - recurring_amt: f64, - currency: String, - time_created: String, - next_payment: String, - last_payment: String, - last_amount: f64, - last_amount_vat: f64, - outstanding: f64, - failed_attempts: f64, - ) -> TransactionAgreement { + pub fn new(agreement_id: String, item_id: f64, agreement: String, status: String, period: String, frequency: f64, billing_type: String, start_date: String, end_date: String, recurring_amt: f64, currency: String, time_created: String, next_payment: String, last_payment: String, last_amount: f64, last_amount_vat: f64, outstanding: f64, failed_attempts: f64) -> TransactionAgreement { TransactionAgreement { agreement_id, item_id, @@ -95,3 +76,4 @@ impl TransactionAgreement { } } } + diff --git a/src/models/transaction_status.rs b/src/models/transaction_status.rs index 0dc71eb..18e6942 100644 --- a/src/models/transaction_status.rs +++ b/src/models/transaction_status.rs @@ -19,6 +19,7 @@ pub enum TransactionStatus { Expired, #[serde(rename = "chargeback")] Chargeback, + } impl std::fmt::Display for TransactionStatus { @@ -37,3 +38,4 @@ impl Default for TransactionStatus { Self::Active } } + diff --git a/src/models/transaction_steam_info.rs b/src/models/transaction_steam_info.rs index 05f9a15..8ef17cd 100644 --- a/src/models/transaction_steam_info.rs +++ b/src/models/transaction_steam_info.rs @@ -9,11 +9,11 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// TransactionSteamInfo : +/// TransactionSteamInfo : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct TransactionSteamInfo { #[serde(rename = "walletInfo")] - pub wallet_info: models::TransactionSteamWalletInfo, + pub wallet_info: Box, /// Steam User ID #[serde(rename = "steamId")] pub steam_id: String, @@ -29,15 +29,9 @@ pub struct TransactionSteamInfo { } impl TransactionSteamInfo { - pub fn new( - wallet_info: models::TransactionSteamWalletInfo, - steam_id: String, - order_id: String, - steam_url: String, - trans_id: String, - ) -> TransactionSteamInfo { + pub fn new(wallet_info: models::TransactionSteamWalletInfo, steam_id: String, order_id: String, steam_url: String, trans_id: String) -> TransactionSteamInfo { TransactionSteamInfo { - wallet_info, + wallet_info: Box::new(wallet_info), steam_id, order_id, steam_url, @@ -45,3 +39,4 @@ impl TransactionSteamInfo { } } } + diff --git a/src/models/transaction_steam_wallet_info.rs b/src/models/transaction_steam_wallet_info.rs index 7025960..5234d06 100644 --- a/src/models/transaction_steam_wallet_info.rs +++ b/src/models/transaction_steam_wallet_info.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// TransactionSteamWalletInfo : +/// TransactionSteamWalletInfo : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct TransactionSteamWalletInfo { #[serde(rename = "state")] @@ -23,12 +23,7 @@ pub struct TransactionSteamWalletInfo { } impl TransactionSteamWalletInfo { - pub fn new( - state: String, - country: String, - currency: String, - status: String, - ) -> TransactionSteamWalletInfo { + pub fn new(state: String, country: String, currency: String, status: String) -> TransactionSteamWalletInfo { TransactionSteamWalletInfo { state, country, @@ -37,3 +32,4 @@ impl TransactionSteamWalletInfo { } } } + diff --git a/src/models/two_factor_auth_code.rs b/src/models/two_factor_auth_code.rs index b44d0ac..0c1aa3a 100644 --- a/src/models/two_factor_auth_code.rs +++ b/src/models/two_factor_auth_code.rs @@ -17,6 +17,9 @@ pub struct TwoFactorAuthCode { impl TwoFactorAuthCode { pub fn new(code: String) -> TwoFactorAuthCode { - TwoFactorAuthCode { code } + TwoFactorAuthCode { + code, + } } } + diff --git a/src/models/two_factor_email_code.rs b/src/models/two_factor_email_code.rs index 9c20b96..6c35ef0 100644 --- a/src/models/two_factor_email_code.rs +++ b/src/models/two_factor_email_code.rs @@ -17,6 +17,9 @@ pub struct TwoFactorEmailCode { impl TwoFactorEmailCode { pub fn new(code: String) -> TwoFactorEmailCode { - TwoFactorEmailCode { code } + TwoFactorEmailCode { + code, + } } } + diff --git a/src/models/two_factor_required.rs b/src/models/two_factor_required.rs index e5e6dce..b0e5225 100644 --- a/src/models/two_factor_required.rs +++ b/src/models/two_factor_required.rs @@ -37,3 +37,4 @@ impl Default for RequiresTwoFactorAuth { Self::Totp } } + diff --git a/src/models/unity_package.rs b/src/models/unity_package.rs index 1dad163..2d2f5d2 100644 --- a/src/models/unity_package.rs +++ b/src/models/unity_package.rs @@ -9,17 +9,12 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// UnityPackage : +/// UnityPackage : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UnityPackage { #[serde(rename = "id")] pub id: String, - #[serde( - rename = "assetUrl", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "assetUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub asset_url: Option>, #[serde(rename = "assetUrlObject", skip_serializing_if = "Option::is_none")] pub asset_url_object: Option, @@ -38,12 +33,7 @@ pub struct UnityPackage { pub unity_sort_number: Option, #[serde(rename = "unityVersion")] pub unity_version: String, - #[serde( - rename = "impostorUrl", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "impostorUrl", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub impostor_url: Option>, #[serde(rename = "scanStatus", skip_serializing_if = "Option::is_none")] pub scan_status: Option, @@ -52,12 +42,7 @@ pub struct UnityPackage { } impl UnityPackage { - pub fn new( - id: String, - asset_version: i32, - platform: String, - unity_version: String, - ) -> UnityPackage { + pub fn new(id: String, asset_version: i32, platform: String, unity_version: String) -> UnityPackage { UnityPackage { id, asset_url: None, @@ -75,3 +60,4 @@ impl UnityPackage { } } } + diff --git a/src/models/update_avatar_request.rs b/src/models/update_avatar_request.rs index 4de3ba5..e0e6aac 100644 --- a/src/models/update_avatar_request.rs +++ b/src/models/update_avatar_request.rs @@ -49,3 +49,4 @@ impl UpdateAvatarRequest { } } } + diff --git a/src/models/update_favorite_group_request.rs b/src/models/update_favorite_group_request.rs index c0cb54c..12ff3e0 100644 --- a/src/models/update_favorite_group_request.rs +++ b/src/models/update_favorite_group_request.rs @@ -29,3 +29,4 @@ impl UpdateFavoriteGroupRequest { } } } + diff --git a/src/models/update_group_gallery_request.rs b/src/models/update_group_gallery_request.rs index 1f950c2..946b454 100644 --- a/src/models/update_group_gallery_request.rs +++ b/src/models/update_group_gallery_request.rs @@ -20,33 +20,13 @@ pub struct UpdateGroupGalleryRequest { /// Whether the gallery is members only. #[serde(rename = "membersOnly", skip_serializing_if = "Option::is_none")] pub members_only: Option, - #[serde( - rename = "roleIdsToView", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "roleIdsToView", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub role_ids_to_view: Option>>, - #[serde( - rename = "roleIdsToSubmit", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "roleIdsToSubmit", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub role_ids_to_submit: Option>>, - #[serde( - rename = "roleIdsToAutoApprove", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "roleIdsToAutoApprove", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub role_ids_to_auto_approve: Option>>, - #[serde( - rename = "roleIdsToManage", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "roleIdsToManage", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub role_ids_to_manage: Option>>, } @@ -63,3 +43,4 @@ impl UpdateGroupGalleryRequest { } } } + diff --git a/src/models/update_group_member_request.rs b/src/models/update_group_member_request.rs index 1636970..ac65ede 100644 --- a/src/models/update_group_member_request.rs +++ b/src/models/update_group_member_request.rs @@ -13,10 +13,7 @@ use serde::{Deserialize, Serialize}; pub struct UpdateGroupMemberRequest { #[serde(rename = "visibility", skip_serializing_if = "Option::is_none")] pub visibility: Option, - #[serde( - rename = "isSubscribedToAnnouncements", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "isSubscribedToAnnouncements", skip_serializing_if = "Option::is_none")] pub is_subscribed_to_announcements: Option, #[serde(rename = "managerNotes", skip_serializing_if = "Option::is_none")] pub manager_notes: Option, @@ -31,3 +28,4 @@ impl UpdateGroupMemberRequest { } } } + diff --git a/src/models/update_group_request.rs b/src/models/update_group_request.rs index 5faabe2..7abe9a4 100644 --- a/src/models/update_group_request.rs +++ b/src/models/update_group_request.rs @@ -19,19 +19,9 @@ pub struct UpdateGroupRequest { pub description: Option, #[serde(rename = "joinState", skip_serializing_if = "Option::is_none")] pub join_state: Option, - #[serde( - rename = "iconId", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "iconId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub icon_id: Option>, - #[serde( - rename = "bannerId", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "bannerId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub banner_id: Option>, /// 3 letter language code #[serde(rename = "languages", skip_serializing_if = "Option::is_none")] @@ -60,3 +50,4 @@ impl UpdateGroupRequest { } } } + diff --git a/src/models/update_group_role_request.rs b/src/models/update_group_role_request.rs index 4d08eed..e6e0d3f 100644 --- a/src/models/update_group_role_request.rs +++ b/src/models/update_group_role_request.rs @@ -34,3 +34,4 @@ impl UpdateGroupRoleRequest { } } } + diff --git a/src/models/update_invite_message_request.rs b/src/models/update_invite_message_request.rs index 6bc2d8a..3fed8c6 100644 --- a/src/models/update_invite_message_request.rs +++ b/src/models/update_invite_message_request.rs @@ -17,6 +17,9 @@ pub struct UpdateInviteMessageRequest { impl UpdateInviteMessageRequest { pub fn new(message: String) -> UpdateInviteMessageRequest { - UpdateInviteMessageRequest { message } + UpdateInviteMessageRequest { + message, + } } } + diff --git a/src/models/update_user_request.rs b/src/models/update_user_request.rs index 5f85e3c..d0c3d8b 100644 --- a/src/models/update_user_request.rs +++ b/src/models/update_user_request.rs @@ -53,3 +53,4 @@ impl UpdateUserRequest { } } } + diff --git a/src/models/update_world_request.rs b/src/models/update_world_request.rs index 5ed6683..d20c350 100644 --- a/src/models/update_world_request.rs +++ b/src/models/update_world_request.rs @@ -60,3 +60,4 @@ impl UpdateWorldRequest { } } } + diff --git a/src/models/user.rs b/src/models/user.rs index f37e465..d679ada 100644 --- a/src/models/user.rs +++ b/src/models/user.rs @@ -36,10 +36,7 @@ pub struct User { pub display_name: String, #[serde(rename = "friendKey")] pub friend_key: String, - #[serde( - rename = "friendRequestStatus", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "friendRequestStatus", skip_serializing_if = "Option::is_none")] pub friend_request_status: Option, /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. #[serde(rename = "id")] @@ -80,15 +77,9 @@ pub struct User { pub status_description: String, #[serde(rename = "tags")] pub tags: Vec, - #[serde( - rename = "travelingToInstance", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "travelingToInstance", skip_serializing_if = "Option::is_none")] pub traveling_to_instance: Option, - #[serde( - rename = "travelingToLocation", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "travelingToLocation", skip_serializing_if = "Option::is_none")] pub traveling_to_location: Option, #[serde(rename = "travelingToWorld", skip_serializing_if = "Option::is_none")] pub traveling_to_world: Option, @@ -103,32 +94,7 @@ pub struct User { } impl User { - pub fn new( - allow_avatar_copying: bool, - bio: String, - bio_links: Vec, - current_avatar_image_url: String, - current_avatar_thumbnail_image_url: String, - current_avatar_tags: Vec, - date_joined: String, - developer_type: models::DeveloperType, - display_name: String, - friend_key: String, - id: String, - is_friend: bool, - last_activity: String, - last_login: String, - last_platform: String, - platform: String, - profile_pic_override: String, - profile_pic_override_thumbnail: String, - pronouns: String, - state: models::UserState, - status: models::UserStatus, - status_description: String, - tags: Vec, - user_icon: String, - ) -> User { + pub fn new(allow_avatar_copying: bool, bio: String, bio_links: Vec, current_avatar_image_url: String, current_avatar_thumbnail_image_url: String, current_avatar_tags: Vec, date_joined: String, developer_type: models::DeveloperType, display_name: String, friend_key: String, id: String, is_friend: bool, last_activity: String, last_login: String, last_platform: String, platform: String, profile_pic_override: String, profile_pic_override_thumbnail: String, pronouns: String, state: models::UserState, status: models::UserStatus, status_description: String, tags: Vec, user_icon: String) -> User { User { allow_avatar_copying, badges: None, @@ -167,3 +133,4 @@ impl User { } } } + diff --git a/src/models/user_exists.rs b/src/models/user_exists.rs index 89480e8..017b7e7 100644 --- a/src/models/user_exists.rs +++ b/src/models/user_exists.rs @@ -15,11 +15,18 @@ pub struct UserExists { /// Status if a user exist with that username or userId. #[serde(rename = "userExists")] pub user_exists: bool, + /// Is the username valid? + #[serde(rename = "nameOk")] + pub name_ok: bool, } impl UserExists { /// Status object representing if a queried user by username or userId exists or not. This model is primarily used by the `/auth/exists` endpoint, which in turn is used during registration. Please see the documentation on that endpoint for more information on usage. - pub fn new(user_exists: bool) -> UserExists { - UserExists { user_exists } + pub fn new(user_exists: bool, name_ok: bool) -> UserExists { + UserExists { + user_exists, + name_ok, + } } } + diff --git a/src/models/user_state.rs b/src/models/user_state.rs index a683c96..334e774 100644 --- a/src/models/user_state.rs +++ b/src/models/user_state.rs @@ -19,6 +19,7 @@ pub enum UserState { Active, #[serde(rename = "online")] Online, + } impl std::fmt::Display for UserState { @@ -36,3 +37,4 @@ impl Default for UserState { Self::Offline } } + diff --git a/src/models/user_status.rs b/src/models/user_status.rs index 966cdf8..acdec06 100644 --- a/src/models/user_status.rs +++ b/src/models/user_status.rs @@ -23,6 +23,7 @@ pub enum UserStatus { Busy, #[serde(rename = "offline")] Offline, + } impl std::fmt::Display for UserStatus { @@ -42,3 +43,4 @@ impl Default for UserStatus { Self::Active } } + diff --git a/src/models/user_subscription.rs b/src/models/user_subscription.rs index 65ca94b..6c8fa42 100644 --- a/src/models/user_subscription.rs +++ b/src/models/user_subscription.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// UserSubscription : +/// UserSubscription : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct UserSubscription { #[serde(rename = "id")] @@ -48,22 +48,7 @@ pub struct UserSubscription { } impl UserSubscription { - pub fn new( - id: String, - transaction_id: String, - store: String, - amount: f64, - description: String, - period: models::SubscriptionPeriod, - tier: f64, - active: bool, - status: models::TransactionStatus, - expires: String, - created_at: String, - updated_at: String, - license_groups: Vec, - is_gift: bool, - ) -> UserSubscription { + pub fn new(id: String, transaction_id: String, store: String, amount: f64, description: String, period: models::SubscriptionPeriod, tier: f64, active: bool, status: models::TransactionStatus, expires: String, created_at: String, updated_at: String, license_groups: Vec, is_gift: bool) -> UserSubscription { UserSubscription { id, transaction_id, @@ -84,3 +69,4 @@ impl UserSubscription { } } } + diff --git a/src/models/verify2_fa_email_code_result.rs b/src/models/verify2_fa_email_code_result.rs index 1ac94ab..da6e29e 100644 --- a/src/models/verify2_fa_email_code_result.rs +++ b/src/models/verify2_fa_email_code_result.rs @@ -17,6 +17,9 @@ pub struct Verify2FaEmailCodeResult { impl Verify2FaEmailCodeResult { pub fn new(verified: bool) -> Verify2FaEmailCodeResult { - Verify2FaEmailCodeResult { verified } + Verify2FaEmailCodeResult { + verified, + } } } + diff --git a/src/models/verify2_fa_result.rs b/src/models/verify2_fa_result.rs index 511cbc1..bc22e5c 100644 --- a/src/models/verify2_fa_result.rs +++ b/src/models/verify2_fa_result.rs @@ -17,6 +17,9 @@ pub struct Verify2FaResult { impl Verify2FaResult { pub fn new(verified: bool) -> Verify2FaResult { - Verify2FaResult { verified } + Verify2FaResult { + verified, + } } } + diff --git a/src/models/verify_auth_token_result.rs b/src/models/verify_auth_token_result.rs index 7e942b4..1e5f491 100644 --- a/src/models/verify_auth_token_result.rs +++ b/src/models/verify_auth_token_result.rs @@ -19,6 +19,10 @@ pub struct VerifyAuthTokenResult { impl VerifyAuthTokenResult { pub fn new(ok: bool, token: String) -> VerifyAuthTokenResult { - VerifyAuthTokenResult { ok, token } + VerifyAuthTokenResult { + ok, + token, + } } } + diff --git a/src/models/world.rs b/src/models/world.rs index 424e2ba..733e3b8 100644 --- a/src/models/world.rs +++ b/src/models/world.rs @@ -9,7 +9,7 @@ use crate::models; use serde::{Deserialize, Serialize}; -/// World : +/// World : #[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)] pub struct World { /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed. @@ -52,12 +52,7 @@ pub struct World { pub organization: String, #[serde(rename = "popularity")] pub popularity: i32, - #[serde( - rename = "previewYoutubeId", - default, - with = "::serde_with::rust::double_option", - skip_serializing_if = "Option::is_none" - )] + #[serde(rename = "previewYoutubeId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")] pub preview_youtube_id: Option>, /// Will always be `0` when unauthenticated. #[serde(rename = "privateOccupants", skip_serializing_if = "Option::is_none")] @@ -87,29 +82,7 @@ pub struct World { } impl World { - pub fn new( - author_id: String, - author_name: String, - capacity: i32, - recommended_capacity: i32, - created_at: String, - description: String, - featured: bool, - heat: i32, - id: String, - image_url: String, - labs_publication_date: String, - name: String, - organization: String, - popularity: i32, - publication_date: String, - release_status: models::ReleaseStatus, - tags: Vec, - thumbnail_image_url: String, - updated_at: String, - version: i32, - visits: i32, - ) -> World { + pub fn new(author_id: String, author_name: String, capacity: i32, recommended_capacity: i32, created_at: String, description: String, featured: bool, heat: i32, id: String, image_url: String, labs_publication_date: String, name: String, organization: String, popularity: i32, publication_date: String, release_status: models::ReleaseStatus, tags: Vec, thumbnail_image_url: String, updated_at: String, version: i32, visits: i32) -> World { World { author_id, author_name, @@ -144,3 +117,4 @@ impl World { } } } + diff --git a/src/models/world_metadata.rs b/src/models/world_metadata.rs index 88531a1..c6acf86 100644 --- a/src/models/world_metadata.rs +++ b/src/models/world_metadata.rs @@ -20,6 +20,10 @@ pub struct WorldMetadata { impl WorldMetadata { pub fn new(id: String, metadata: serde_json::Value) -> WorldMetadata { - WorldMetadata { id, metadata } + WorldMetadata { + id, + metadata, + } } } + diff --git a/src/models/world_publish_status.rs b/src/models/world_publish_status.rs index 0947c1b..bf6a7d2 100644 --- a/src/models/world_publish_status.rs +++ b/src/models/world_publish_status.rs @@ -17,6 +17,9 @@ pub struct WorldPublishStatus { impl WorldPublishStatus { pub fn new(can_publish: bool) -> WorldPublishStatus { - WorldPublishStatus { can_publish } + WorldPublishStatus { + can_publish, + } } } + From c77b0f795b5558473e5415615d5f43538ed4e87c Mon Sep 17 00:00:00 2001 From: kubectl Date: Sat, 27 Jul 2024 02:17:56 +0200 Subject: [PATCH 05/10] fix: adapt example to feature all verify 2fa methods --- examples/online.rs | 69 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 48 insertions(+), 21 deletions(-) diff --git a/examples/online.rs b/examples/online.rs index f75f52f..8abdfc1 100644 --- a/examples/online.rs +++ b/examples/online.rs @@ -1,4 +1,5 @@ pub use vrchatapi::apis; +use vrchatapi::models::TwoFactorEmailCode; #[tokio::main] async fn main() { @@ -8,40 +9,66 @@ async fn main() { ..Default::default() }; - let current_user = match apis::authentication_api::get_current_user(&config) + match apis::authentication_api::get_current_user(&config) .await .expect("Failed to get current user") { - vrchatapi::models::GetCurrentUser200Response::CurrentUser(user) => user, - vrchatapi::models::GetCurrentUser200Response::TwoFactorRequired(_two_factor_resp) => { + vrchatapi::models::GetCurrentUser200Response::CurrentUser(_user) => { + println!("Already logged in"); + } + vrchatapi::models::GetCurrentUser200Response::TwoFactorRequired(two_factor_resp) => { // The API returns you a list of methods to verify your 2FA, this determines what function to call next - // this example assumes you have a TOTP code + // There are only 2 ways the array of available methods looks, either ['emailOpt'] or ['otp', 'totp'] + // One deals with email verification, the other two with either TOTP or a recovery code generated from the VRChat website + + let code = "123456".to_owned(); // grab this via stdin / generate it / read it from email server + + let verified: bool; + if two_factor_resp + .requires_two_factor_auth + .contains(&vrchatapi::models::two_factor_required::RequiresTwoFactorAuth::EmailOtp) + { + let resp = apis::authentication_api::verify2_fa_email_code( + &config, + TwoFactorEmailCode::new(code.clone()), + ) + .await + .expect("Failed toemail 2FA response"); - let code = "123456"; // grab this via stdin or generate it + verified = resp.verified; + } else { + let resp = apis::authentication_api::verify2_fa( + &config, + vrchatapi::models::TwoFactorAuthCode { code }, + ) + .await + .expect("Failed to get totp 2FA response"); - let resp = apis::authentication_api::verify2_fa( - &config, - vrchatapi::models::TwoFactorAuthCode { - code: code.to_string(), - }, - ) - .await - .expect("Failed to get 2FA response"); + // If you have a recovery code, use this method instead + // let resp = apis::authentication_api::verify_recovery_code( + // &config, + // vrchatapi::models::two_factor_auth_code::TwoFactorAuthCode { code }, + // ) + // .await + // .expect("Failed to get recovery code 2FA response"); - if !resp.verified { - panic!("Failed to verify 2FA"); + verified = resp.verified; } - match apis::authentication_api::get_current_user(&config) - .await - .expect("Failed to get current user") - { - vrchatapi::models::GetCurrentUser200Response::CurrentUser(user) => user, - _ => panic!("Got 2FA response, even after verifying 2FA"), + if !verified { + panic!("Failed to verify 2FA"); } } }; + let current_user = match apis::authentication_api::get_current_user(&config) + .await + .expect("Failed to get current user") + { + vrchatapi::models::GetCurrentUser200Response::CurrentUser(user) => user, + _ => panic!("Got 2FA response, even after verifying 2FA"), + }; + println!("Current User: {:?}", current_user.display_name); let online = apis::system_api::get_current_online_users(&config) From 95670465eeddaab4435ccd74a5976f700094995d Mon Sep 17 00:00:00 2001 From: kubectl Date: Sat, 27 Jul 2024 03:06:06 +0200 Subject: [PATCH 06/10] fix: replace old patch with json patch version --- patches/0001_fix_2fa.json | 50 ++++++++++++++++++++++++++++++++++++++ patches/0001_fix_2fa.patch | 36 --------------------------- 2 files changed, 50 insertions(+), 36 deletions(-) create mode 100644 patches/0001_fix_2fa.json delete mode 100644 patches/0001_fix_2fa.patch diff --git a/patches/0001_fix_2fa.json b/patches/0001_fix_2fa.json new file mode 100644 index 0000000..508274a --- /dev/null +++ b/patches/0001_fix_2fa.json @@ -0,0 +1,50 @@ +[ + { + "op": "add", + "path": "/components/schemas/TwoFactorRequired", + "value": { + "title": "TwoFactorRequired", + "type": "object", + "properties": { + "requiresTwoFactorAuth": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "totp", + "otp", + "emailOtp" + ] + } + } + }, + "required": [ + "requiresTwoFactorAuth" + ] + } + }, + { + "op": "remove", + "path": "/components/schemas/UserExists/properties/nameOk" + }, + { + "op": "remove", + "path": "/components/schemas/UserExists/required/1" + }, + { + "op": "remove", + "path": "/components/responses/CurrentUserLoginResponse/content/application~1json/schema/$ref" + }, + { + "op": "add", + "path": "/components/responses/CurrentUserLoginResponse/content/application~1json/schema/oneOf", + "value": [ + { + "$ref": "#/components/schemas/CurrentUser" + }, + { + "$ref": "#/components/schemas/TwoFactorRequired" + } + ] + } +] \ No newline at end of file diff --git a/patches/0001_fix_2fa.patch b/patches/0001_fix_2fa.patch deleted file mode 100644 index 435b5ba..0000000 --- a/patches/0001_fix_2fa.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff --git a/openapi.yaml b/openapi_2fa.yaml -https://github.com/vrchatapi/specification/issues/241 ---- a/openapi.yaml -+++ b/openapi_2fa.yaml -@@ -3997,6 +3997,20 @@ components: - - friendKey - title: CurrentUser - type: object -+ TwoFactorRequired: -+ title: TwoFactorRequired -+ type: object -+ properties: -+ requiresTwoFactorAuth: -+ type: array -+ items: -+ type: string -+ enum: -+ - totp -+ - otp -+ - emailOtp -+ required: -+ - requiresTwoFactorAuth - TwoFactorAuthCode: - title: TwoFactorAuthCode - type: object -@@ -8139,7 +8153,9 @@ components: - content: - application/json: - schema: -- $ref: '#/components/schemas/CurrentUser' -+ oneOf: -+ - $ref: '#/components/schemas/CurrentUser' -+ - $ref: '#/components/schemas/TwoFactorRequired' - headers: - Set-Cookie: - schema: From 29733e11ae8f794adc94f9ab48ceeb66f80a33bb Mon Sep 17 00:00:00 2001 From: kubectl Date: Sat, 27 Jul 2024 03:06:36 +0200 Subject: [PATCH 07/10] fix: add small scripts to generate and apply the patch --- bin/apply_json_patch.js | 43 +++++++++++++++++++++++++++++++++++++++++ bin/gen_patch.js | 38 ++++++++++++++++++++++++++++++++++++ package.json | 5 ++++- 3 files changed, 85 insertions(+), 1 deletion(-) create mode 100755 bin/apply_json_patch.js create mode 100755 bin/gen_patch.js diff --git a/bin/apply_json_patch.js b/bin/apply_json_patch.js new file mode 100755 index 0000000..faf19d7 --- /dev/null +++ b/bin/apply_json_patch.js @@ -0,0 +1,43 @@ +#!/usr/bin/env node + +import { applyPatch } from 'rfc6902' +import { parse, stringify } from 'yaml' + +import fs, { cp } from 'node:fs'; + +const helpText = 'Usage: apply_json_patch.js [output_file]' + +var args = process.argv.slice(2); + +if (args.find(arg => arg === '--help')) { + console.log(helpText) + process.exit(0) +} + +if (args.length < 2) { + console.error('Missing arguments') + console.log(helpText) + process.exit(1) +} + +const patchFile = args[0] +const sourceFile = args[1] +const outputFile = args[2] || sourceFile + +try { + const patch = JSON.parse(fs.readFileSync(patchFile, 'utf8')) + const source = fs.readFileSync(sourceFile, 'utf8') + + const sourceJson = parse(source) + const results = applyPatch(sourceJson, patch) + + results.forEach((result, i) => { + if (result !== null) { + throw new Error('Patch failed at operation ' + i) + } + }) + + fs.writeFileSync(outputFile, stringify(sourceJson, { singleQuote: false, lineWidth: 0, })) +} catch (err) { + console.error(err) +} diff --git a/bin/gen_patch.js b/bin/gen_patch.js new file mode 100755 index 0000000..88c4d7a --- /dev/null +++ b/bin/gen_patch.js @@ -0,0 +1,38 @@ +#!/usr/bin/env node + +import { createPatch } from 'rfc6902' +import { parse } from 'yaml' +import fs from 'node:fs'; + +const helpText = 'Usage: gen_patch.js ' + +var args = process.argv.slice(2); + +if (args.find(arg => arg === '--help')) { + console.log(helpText) + process.exit(0) +} + +if (args.length < 3) { + console.error('Missing arguments') + console.log(helpText) + process.exit(1) +} + +const actualFile = args[0] +const patchedFile = args[1] +const outputFile = args[2] + +try { + const actual = fs.readFileSync(actualFile, 'utf8') + const patched = fs.readFileSync(patchedFile, 'utf8') + + const actualJson = parse(actual) + const patchedJson = parse(patched) + + const patch = createPatch(actualJson, patchedJson) + + fs.writeFileSync(outputFile, JSON.stringify(patch, null, 2)) +} catch (err) { + console.error(err) +} diff --git a/package.json b/package.json index 1383dec..b9df7ef 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,8 @@ { + "type": "module", "dependencies": { - "@openapitools/openapi-generator-cli": "^2.13.4" + "@openapitools/openapi-generator-cli": "^2.13.4", + "rfc6902": "^5.1.1", + "yaml": "^2.5.0" } } From b5ea1fc0a586a0972bc4a608f8d08d50ae076481 Mon Sep 17 00:00:00 2001 From: kubectl Date: Sat, 27 Jul 2024 03:07:16 +0200 Subject: [PATCH 08/10] fix: adapt generate script to use new sub scripts --- generate.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/generate.sh b/generate.sh index 45cba23..1462caa 100755 --- a/generate.sh +++ b/generate.sh @@ -1,4 +1,6 @@ #!/usr/bin/env bash +# This script assumes that all npm dependencies are installed (e.g. by a previous step in CI) + set -eux -o pipefail # clean up old files @@ -8,8 +10,8 @@ rm src/apis src/models docs -rf wget https://raw.githubusercontent.com/vrchatapi/specification/gh-pages/openapi.yaml -O openapi.yaml # patch openapi.yaml -for p in patches/*.patch; do - patch -p1 openapi.yaml $p +for p in patches/*.json; do + node bin/apply_json_patch.js $p openapi.yaml done # Generate client From 1ac4ac6ff2442178819d3a57520bdcfa3762e77f Mon Sep 17 00:00:00 2001 From: kubectl Date: Sat, 27 Jul 2024 03:07:28 +0200 Subject: [PATCH 09/10] chore: generate --- docs/UserExists.md | 1 - src/models/user_exists.rs | 6 +----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/docs/UserExists.md b/docs/UserExists.md index 62fd89f..17b947c 100644 --- a/docs/UserExists.md +++ b/docs/UserExists.md @@ -5,7 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **user_exists** | **bool** | Status if a user exist with that username or userId. | [default to false] -**name_ok** | **bool** | Is the username valid? | [default to false] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/src/models/user_exists.rs b/src/models/user_exists.rs index 017b7e7..b1675a9 100644 --- a/src/models/user_exists.rs +++ b/src/models/user_exists.rs @@ -15,17 +15,13 @@ pub struct UserExists { /// Status if a user exist with that username or userId. #[serde(rename = "userExists")] pub user_exists: bool, - /// Is the username valid? - #[serde(rename = "nameOk")] - pub name_ok: bool, } impl UserExists { /// Status object representing if a queried user by username or userId exists or not. This model is primarily used by the `/auth/exists` endpoint, which in turn is used during registration. Please see the documentation on that endpoint for more information on usage. - pub fn new(user_exists: bool, name_ok: bool) -> UserExists { + pub fn new(user_exists: bool) -> UserExists { UserExists { user_exists, - name_ok, } } } From d540c91628925661e7b2948bfc60f5e2389a8104 Mon Sep 17 00:00:00 2001 From: kubectl Date: Sat, 27 Jul 2024 03:12:59 +0200 Subject: [PATCH 10/10] fix: remove unintedend changes in patch --- patches/0001_fix_2fa.json | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/patches/0001_fix_2fa.json b/patches/0001_fix_2fa.json index 508274a..faef2a2 100644 --- a/patches/0001_fix_2fa.json +++ b/patches/0001_fix_2fa.json @@ -10,27 +10,13 @@ "type": "array", "items": { "type": "string", - "enum": [ - "totp", - "otp", - "emailOtp" - ] + "enum": ["totp", "otp", "emailOtp"] } } }, - "required": [ - "requiresTwoFactorAuth" - ] + "required": ["requiresTwoFactorAuth"] } }, - { - "op": "remove", - "path": "/components/schemas/UserExists/properties/nameOk" - }, - { - "op": "remove", - "path": "/components/schemas/UserExists/required/1" - }, { "op": "remove", "path": "/components/responses/CurrentUserLoginResponse/content/application~1json/schema/$ref" @@ -47,4 +33,4 @@ } ] } -] \ No newline at end of file +]