From 025a2c012b7d260068de8b2e46d1b24c2a2a64d0 Mon Sep 17 00:00:00 2001 From: VRCCat Date: Thu, 17 Nov 2022 21:24:53 +0000 Subject: [PATCH] Upgrade Rust SDK to spec 1.9.0 --- Cargo.toml | 2 +- docs/AvatarsApi.md | 31 +++++++++++++++++++++++ src/apis/avatars_api.rs | 37 ++++++++++++++++++++++++++++ src/models/player_moderation_type.rs | 6 ----- 4 files changed, 69 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2ef8ec8..f780c74 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "vrchatapi" -version = "1.8.0" +version = "1.9.0" authors = ["OpenAPI Generator team and contributors"] license = "MIT" edition = "2018" diff --git a/docs/AvatarsApi.md b/docs/AvatarsApi.md index 3b64327..83c2fe4 100644 --- a/docs/AvatarsApi.md +++ b/docs/AvatarsApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**delete_avatar**](AvatarsApi.md#delete_avatar) | **DELETE** /avatars/{avatarId} | Delete Avatar [**get_avatar**](AvatarsApi.md#get_avatar) | **GET** /avatars/{avatarId} | Get Avatar [**get_favorited_avatars**](AvatarsApi.md#get_favorited_avatars) | **GET** /avatars/favorites | List Favorited Avatars +[**get_own_avatar**](AvatarsApi.md#get_own_avatar) | **GET** /users/{userId}/avatar | Get Own Avatar [**search_avatars**](AvatarsApi.md#search_avatars) | **GET** /avatars | Search Avatars [**select_avatar**](AvatarsApi.md#select_avatar) | **PUT** /avatars/{avatarId}/select | Select Avatar [**select_fallback_avatar**](AvatarsApi.md#select_fallback_avatar) | **PUT** /avatars/{avatarId}/selectFallback | Select Fallback Avatar @@ -147,6 +148,36 @@ Name | Type | Description | Required | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +## get_own_avatar + +> crate::models::Avatar get_own_avatar(user_id) +Get Own Avatar + +Get the current avatar for the user. This will return an error for any other user than the one logged in. + +### Parameters + + +Name | Type | Description | Required | Notes +------------- | ------------- | ------------- | ------------- | ------------- +**user_id** | **String** | | [required] | + +### Return type + +[**crate::models::Avatar**](Avatar.md) + +### Authorization + +[apiKeyCookie](../README.md#apiKeyCookie), [authCookie](../README.md#authCookie) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + ## search_avatars > Vec search_avatars(featured, sort, user, user_id, n, order, offset, tag, notag, release_status, max_unity_version, min_unity_version, platform) diff --git a/src/apis/avatars_api.rs b/src/apis/avatars_api.rs index 118835c..f372f1f 100644 --- a/src/apis/avatars_api.rs +++ b/src/apis/avatars_api.rs @@ -48,6 +48,15 @@ pub enum GetFavoritedAvatarsError { UnknownValue(serde_json::Value), } +/// struct for typed errors of method [`get_own_avatar`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum GetOwnAvatarError { + Status401(crate::models::Error), + Status403(crate::models::Error), + UnknownValue(serde_json::Value), +} + /// struct for typed errors of method [`search_avatars`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -237,6 +246,34 @@ pub fn get_favorited_avatars(configuration: &configuration::Configuration, featu } } +/// Get the current avatar for the user. This will return an error for any other user than the one logged in. +pub 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()); + + if let Some(ref local_var_user_agent) = local_var_configuration.user_agent { + local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); + } + + let local_var_req = local_var_req_builder.build()?; + let mut local_var_resp = local_var_client.execute(local_var_req)?; + + let local_var_status = local_var_resp.status(); + let local_var_content = local_var_resp.text()?; + + 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 }; + 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 fn search_avatars(configuration: &configuration::Configuration, featured: Option, sort: Option<&str>, user: Option<&str>, user_id: Option<&str>, n: Option, order: Option<&str>, offset: Option, tag: Option<&str>, notag: Option<&str>, release_status: Option<&str>, max_unity_version: Option<&str>, min_unity_version: Option<&str>, platform: Option<&str>) -> Result, Error> { let local_var_configuration = configuration; diff --git a/src/models/player_moderation_type.rs b/src/models/player_moderation_type.rs index 79d7758..9bd7d2d 100644 --- a/src/models/player_moderation_type.rs +++ b/src/models/player_moderation_type.rs @@ -18,10 +18,6 @@ pub enum PlayerModerationType { Block, #[serde(rename = "unblock")] Unblock, - #[serde(rename = "hideAvatar")] - HideAvatar, - #[serde(rename = "showAvatar")] - ShowAvatar, #[serde(rename = "interactOn")] InteractOn, #[serde(rename = "interactOff")] @@ -36,8 +32,6 @@ impl ToString for PlayerModerationType { Self::Unmute => String::from("unmute"), Self::Block => String::from("block"), Self::Unblock => String::from("unblock"), - Self::HideAvatar => String::from("hideAvatar"), - Self::ShowAvatar => String::from("showAvatar"), Self::InteractOn => String::from("interactOn"), Self::InteractOff => String::from("interactOff"), }