Upgrade Rust SDK to spec 1.9.0

This commit is contained in:
VRCCat
2022-11-17 21:24:53 +00:00
parent c4efedb997
commit 025a2c012b
4 changed files with 69 additions and 7 deletions

View File

@ -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"

View File

@ -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<crate::models::Avatar> search_avatars(featured, sort, user, user_id, n, order, offset, tag, notag, release_status, max_unity_version, min_unity_version, platform)

View File

@ -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<crate::models::Avatar, Error<GetOwnAvatarError>> {
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<GetOwnAvatarError> = serde_json::from_str(&local_var_content).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<bool>, sort: Option<&str>, user: Option<&str>, user_id: Option<&str>, n: Option<i32>, order: Option<&str>, offset: Option<i32>, tag: Option<&str>, notag: Option<&str>, release_status: Option<&str>, max_unity_version: Option<&str>, min_unity_version: Option<&str>, platform: Option<&str>) -> Result<Vec<crate::models::Avatar>, Error<SearchAvatarsError>> {
let local_var_configuration = configuration;

View File

@ -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"),
}