Upgrade Rust SDK to spec 1.17.0

This commit is contained in:
VRCCat
2024-04-15 22:18:47 +00:00
parent 0bac2026bb
commit fd93366a00
11 changed files with 165 additions and 13 deletions

View File

@ -45,6 +45,7 @@ docs/FinishFileDataUploadRequest.md
docs/FriendStatus.md docs/FriendStatus.md
docs/FriendsApi.md docs/FriendsApi.md
docs/Group.md docs/Group.md
docs/GroupAccessType.md
docs/GroupAnnouncement.md docs/GroupAnnouncement.md
docs/GroupAuditLogEntry.md docs/GroupAuditLogEntry.md
docs/GroupGallery.md docs/GroupGallery.md
@ -199,6 +200,7 @@ src/models/file_version_upload_status.rs
src/models/finish_file_data_upload_request.rs src/models/finish_file_data_upload_request.rs
src/models/friend_status.rs src/models/friend_status.rs
src/models/group.rs src/models/group.rs
src/models/group_access_type.rs
src/models/group_announcement.rs src/models/group_announcement.rs
src/models/group_audit_log_entry.rs src/models/group_audit_log_entry.rs
src/models/group_gallery.rs src/models/group_gallery.rs

View File

@ -1,6 +1,6 @@
[package] [package]
name = "vrchatapi" name = "vrchatapi"
version = "1.16.8" version = "1.17.0"
authors = ["vrchatapi.lpv0t@aries.fyi"] authors = ["vrchatapi.lpv0t@aries.fyi"]
description = "VRChat API Client for Rust" description = "VRChat API Client for Rust"
license = "MIT" license = "MIT"

10
docs/GroupAccessType.md Normal file
View File

@ -0,0 +1,10 @@
# GroupAccessType
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -14,7 +14,7 @@ Name | Type | Description | Notes
**location** | **String** | InstanceID can be \"offline\" on User profiles if you are not friends with that user and \"private\" if you are friends and user is in private instance. | **location** | **String** | InstanceID can be \"offline\" on User profiles if you are not friends with that user and \"private\" if you are friends and user is in private instance. |
**n_users** | **i32** | | **n_users** | **i32** | |
**name** | **String** | | **name** | **String** | |
**owner_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] **owner_id** | Option<**String**> | A groupId if the instance type is \"group\", null if instance type is public, or a userId otherwise | [optional]
**permanent** | **bool** | | [default to false] **permanent** | **bool** | | [default to false]
**photon_region** | [**crate::models::Region**](Region.md) | | **photon_region** | [**crate::models::Region**](Region.md) | |
**platforms** | [**crate::models::InstancePlatforms**](InstancePlatforms.md) | | **platforms** | [**crate::models::InstancePlatforms**](InstancePlatforms.md) | |
@ -30,11 +30,16 @@ Name | Type | Description | Notes
**queue_enabled** | **bool** | | **queue_enabled** | **bool** | |
**queue_size** | **i32** | | **queue_size** | **i32** | |
**recommended_capacity** | **i32** | | **recommended_capacity** | **i32** | |
**role_restricted** | **bool** | | **role_restricted** | Option<**bool**> | | [optional]
**strict** | **bool** | | **strict** | **bool** | |
**user_count** | **i32** | | **user_count** | **i32** | |
**world** | [**crate::models::World**](World.md) | | **world** | [**crate::models::World**](World.md) | |
**users** | Option<[**Vec<crate::models::LimitedUser>**](LimitedUser.md)> | The users field is present on instances created by the requesting user. | [optional] **users** | Option<[**Vec<crate::models::LimitedUser>**](LimitedUser.md)> | The users field is present on instances created by the requesting user. | [optional]
**group_access_type** | Option<[**crate::models::GroupAccessType**](GroupAccessType.md)> | | [optional]
**has_capacity_for_you** | Option<**bool**> | | [optional]
**nonce** | Option<**String**> | | [optional]
**closed_at** | Option<**String**> | | [optional]
**hard_close** | Option<**bool**> | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -4,6 +4,7 @@ All URIs are relative to *https://api.vrchat.cloud/api/1*
Method | HTTP request | Description Method | HTTP request | Description
------------- | ------------- | ------------- ------------- | ------------- | -------------
[**close_instance**](InstancesApi.md#close_instance) | **DELETE** /instances/{worldId}:{instanceId} | Close Instance
[**get_instance**](InstancesApi.md#get_instance) | **GET** /instances/{worldId}:{instanceId} | Get Instance [**get_instance**](InstancesApi.md#get_instance) | **GET** /instances/{worldId}:{instanceId} | Get Instance
[**get_instance_by_short_name**](InstancesApi.md#get_instance_by_short_name) | **GET** /instances/s/{shortName} | Get Instance By Short Name [**get_instance_by_short_name**](InstancesApi.md#get_instance_by_short_name) | **GET** /instances/s/{shortName} | Get Instance By Short Name
[**get_short_name**](InstancesApi.md#get_short_name) | **GET** /instances/{worldId}:{instanceId}/shortName | Get Instance Short Name [**get_short_name**](InstancesApi.md#get_short_name) | **GET** /instances/{worldId}:{instanceId}/shortName | Get Instance Short Name
@ -11,6 +12,38 @@ Method | HTTP request | Description
## close_instance
> crate::models::Instance close_instance(world_id, instance_id, hard_close)
Close Instance
Close an instance. 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.
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**world_id** | **String** | Must be a valid world ID. | [required] |
**instance_id** | **String** | Must be a valid instance ID. | [required] |
**hard_close** | Option<**bool**> | Whether to hard close the instance. Defaults to false. | |
### Return type
[**crate::models::Instance**](Instance.md)
### Authorization
[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)
## get_instance ## get_instance
> crate::models::Instance get_instance(world_id, instance_id) > crate::models::Instance get_instance(world_id, instance_id)

View File

@ -26,6 +26,7 @@ pub enum DeleteFriendRequestError {
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)] #[serde(untagged)]
pub enum FriendError { pub enum FriendError {
Status400(crate::models::Error),
Status401(crate::models::Error), Status401(crate::models::Error),
Status404(crate::models::Error), Status404(crate::models::Error),
UnknownValue(serde_json::Value), UnknownValue(serde_json::Value),

View File

@ -80,8 +80,9 @@ pub enum CreateGroupGalleryError {
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)] #[serde(untagged)]
pub enum CreateGroupInviteError { pub enum CreateGroupInviteError {
Status400(), Status400(crate::models::Error),
Status401(crate::models::Error), Status401(crate::models::Error),
Status403(crate::models::Error),
Status404(crate::models::Error), Status404(crate::models::Error),
UnknownValue(serde_json::Value), UnknownValue(serde_json::Value),
} }
@ -237,6 +238,7 @@ pub enum GetGroupPermissionsError {
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)] #[serde(untagged)]
pub enum GetGroupRequestsError { pub enum GetGroupRequestsError {
Status400(crate::models::Error),
Status403(crate::models::Error), Status403(crate::models::Error),
Status404(crate::models::Error), Status404(crate::models::Error),
UnknownValue(serde_json::Value), UnknownValue(serde_json::Value),

View File

@ -13,6 +13,16 @@ use crate::apis::ResponseContent;
use super::{Error, configuration}; use super::{Error, configuration};
/// struct for typed errors of method [`close_instance`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CloseInstanceError {
Status401(crate::models::Error),
Status403(crate::models::Error),
Status404(crate::models::Error),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_instance`] /// struct for typed errors of method [`get_instance`]
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)] #[serde(untagged)]
@ -47,6 +57,37 @@ pub enum SendSelfInviteError {
} }
/// Close an instance. 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 fn close_instance(configuration: &configuration::Configuration, world_id: &str, instance_id: &str, hard_close: Option<bool>) -> Result<crate::models::Instance, Error<CloseInstanceError>> {
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());
if let Some(ref local_var_str) = hard_close {
local_var_req_builder = local_var_req_builder.query(&[("hardClose", &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());
}
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<CloseInstanceError> = serde_json::from_str(&local_var_content).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\"! /// 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 fn get_instance(configuration: &configuration::Configuration, world_id: &str, instance_id: &str) -> Result<crate::models::Instance, Error<GetInstanceError>> { pub fn get_instance(configuration: &configuration::Configuration, world_id: &str, instance_id: &str) -> Result<crate::models::Instance, Error<GetInstanceError>> {
let local_var_configuration = configuration; let local_var_configuration = configuration;

View File

@ -0,0 +1,41 @@
/*
* VRChat API Documentation
*
*
* Contact: vrchatapi.lpv0t@aries.fyi
* Generated by: https://openapi-generator.tech
*/
/// GroupAccessType : Group access type when the instance type is \"group\"
/// Group access type when the instance type is \"group\"
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum GroupAccessType {
#[serde(rename = "public")]
Public,
#[serde(rename = "plus")]
Plus,
#[serde(rename = "member")]
Member,
}
impl ToString for GroupAccessType {
fn to_string(&self) -> String {
match self {
Self::Public => String::from("public"),
Self::Plus => String::from("plus"),
Self::Member => String::from("member"),
}
}
}
impl Default for GroupAccessType {
fn default() -> GroupAccessType {
Self::Public
}
}

View File

@ -35,9 +35,9 @@ pub struct Instance {
pub n_users: i32, pub n_users: i32,
#[serde(rename = "name")] #[serde(rename = "name")]
pub name: String, pub name: 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. /// A groupId if the instance type is \"group\", null if instance type is public, or a userId otherwise
#[serde(rename = "ownerId", 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<String>, pub owner_id: Option<Option<String>>,
#[serde(rename = "permanent")] #[serde(rename = "permanent")]
pub permanent: bool, pub permanent: bool,
#[serde(rename = "photonRegion")] #[serde(rename = "photonRegion")]
@ -48,8 +48,8 @@ pub struct Instance {
pub region: crate::models::Region, pub region: crate::models::Region,
#[serde(rename = "secureName")] #[serde(rename = "secureName")]
pub secure_name: String, pub secure_name: String,
#[serde(rename = "shortName", 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<String>, pub short_name: Option<Option<String>>,
/// 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")] #[serde(rename = "tags")]
pub tags: Vec<String>, pub tags: Vec<String>,
@ -73,8 +73,8 @@ pub struct Instance {
pub queue_size: i32, pub queue_size: i32,
#[serde(rename = "recommendedCapacity")] #[serde(rename = "recommendedCapacity")]
pub recommended_capacity: i32, pub recommended_capacity: i32,
#[serde(rename = "roleRestricted")] #[serde(rename = "roleRestricted", skip_serializing_if = "Option::is_none")]
pub role_restricted: bool, pub role_restricted: Option<bool>,
#[serde(rename = "strict")] #[serde(rename = "strict")]
pub strict: bool, pub strict: bool,
#[serde(rename = "userCount")] #[serde(rename = "userCount")]
@ -84,11 +84,21 @@ pub struct Instance {
/// The users field is present on instances created by the requesting user. /// The users field is present on instances created by the requesting user.
#[serde(rename = "users", skip_serializing_if = "Option::is_none")] #[serde(rename = "users", skip_serializing_if = "Option::is_none")]
pub users: Option<Vec<crate::models::LimitedUser>>, pub users: Option<Vec<crate::models::LimitedUser>>,
#[serde(rename = "groupAccessType", skip_serializing_if = "Option::is_none")]
pub group_access_type: Option<crate::models::GroupAccessType>,
#[serde(rename = "hasCapacityForYou", skip_serializing_if = "Option::is_none")]
pub has_capacity_for_you: Option<bool>,
#[serde(rename = "nonce", skip_serializing_if = "Option::is_none")]
pub nonce: Option<String>,
#[serde(rename = "closedAt", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub closed_at: Option<Option<String>>,
#[serde(rename = "hardClose", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub hard_close: Option<Option<bool>>,
} }
impl Instance { 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. /// * `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: crate::models::Region, platforms: crate::models::InstancePlatforms, region: crate::models::Region, secure_name: String, tags: Vec<String>, r#type: crate::models::InstanceType, world_id: String, queue_enabled: bool, queue_size: i32, recommended_capacity: i32, role_restricted: bool, strict: bool, user_count: i32, world: crate::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: crate::models::Region, platforms: crate::models::InstancePlatforms, region: crate::models::Region, secure_name: String, tags: Vec<String>, r#type: crate::models::InstanceType, world_id: String, queue_enabled: bool, queue_size: i32, recommended_capacity: i32, strict: bool, user_count: i32, world: crate::models::World) -> Instance {
Instance { Instance {
active, active,
can_request_invite, can_request_invite,
@ -116,11 +126,16 @@ impl Instance {
queue_enabled, queue_enabled,
queue_size, queue_size,
recommended_capacity, recommended_capacity,
role_restricted, role_restricted: None,
strict, strict,
user_count, user_count,
world: Box::new(world), world: Box::new(world),
users: None, users: None,
group_access_type: None,
has_capacity_for_you: None,
nonce: None,
closed_at: None,
hard_close: None,
} }
} }
} }

View File

@ -76,6 +76,8 @@ pub mod friend_status;
pub use self::friend_status::FriendStatus; pub use self::friend_status::FriendStatus;
pub mod group; pub mod group;
pub use self::group::Group; pub use self::group::Group;
pub mod group_access_type;
pub use self::group_access_type::GroupAccessType;
pub mod group_announcement; pub mod group_announcement;
pub use self::group_announcement::GroupAnnouncement; pub use self::group_announcement::GroupAnnouncement;
pub mod group_audit_log_entry; pub mod group_audit_log_entry;