Skip to content

Commit

Permalink
Upgrade Rust SDK to spec 1.17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
VRCCat committed Apr 15, 2024
1 parent 0bac202 commit fd93366
Show file tree
Hide file tree
Showing 11 changed files with 165 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ docs/FinishFileDataUploadRequest.md
docs/FriendStatus.md
docs/FriendsApi.md
docs/Group.md
docs/GroupAccessType.md
docs/GroupAnnouncement.md
docs/GroupAuditLogEntry.md
docs/GroupGallery.md
Expand Down Expand Up @@ -199,6 +200,7 @@ src/models/file_version_upload_status.rs
src/models/finish_file_data_upload_request.rs
src/models/friend_status.rs
src/models/group.rs
src/models/group_access_type.rs
src/models/group_announcement.rs
src/models/group_audit_log_entry.rs
src/models/group_gallery.rs
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "vrchatapi"
version = "1.16.8"
version = "1.17.0"
authors = ["[email protected]"]
description = "VRChat API Client for Rust"
license = "MIT"
Expand Down
10 changes: 10 additions & 0 deletions docs/GroupAccessType.md
Original file line number Diff line number Diff line change
@@ -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)


9 changes: 7 additions & 2 deletions docs/Instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
**n_users** | **i32** | |
**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]
**photon_region** | [**crate::models::Region**](Region.md) | |
**platforms** | [**crate::models::InstancePlatforms**](InstancePlatforms.md) | |
Expand All @@ -30,11 +30,16 @@ Name | Type | Description | Notes
**queue_enabled** | **bool** | |
**queue_size** | **i32** | |
**recommended_capacity** | **i32** | |
**role_restricted** | **bool** | |
**role_restricted** | Option<**bool**> | | [optional]
**strict** | **bool** | |
**user_count** | **i32** | |
**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]
**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)

Expand Down
33 changes: 33 additions & 0 deletions docs/InstancesApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,46 @@ All URIs are relative to *https://api.vrchat.cloud/api/1*

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_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
[**send_self_invite**](InstancesApi.md#send_self_invite) | **POST** /instances/{worldId}:{instanceId}/invite | Send Self Invite



## 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

> crate::models::Instance get_instance(world_id, instance_id)
Expand Down
1 change: 1 addition & 0 deletions src/apis/friends_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pub enum DeleteFriendRequestError {
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum FriendError {
Status400(crate::models::Error),
Status401(crate::models::Error),
Status404(crate::models::Error),
UnknownValue(serde_json::Value),
Expand Down
4 changes: 3 additions & 1 deletion src/apis/groups_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ pub enum CreateGroupGalleryError {
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateGroupInviteError {
Status400(),
Status400(crate::models::Error),
Status401(crate::models::Error),
Status403(crate::models::Error),
Status404(crate::models::Error),
UnknownValue(serde_json::Value),
}
Expand Down Expand Up @@ -237,6 +238,7 @@ pub enum GetGroupPermissionsError {
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetGroupRequestsError {
Status400(crate::models::Error),
Status403(crate::models::Error),
Status404(crate::models::Error),
UnknownValue(serde_json::Value),
Expand Down
41 changes: 41 additions & 0 deletions src/apis/instances_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ use crate::apis::ResponseContent;
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`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
Expand Down Expand Up @@ -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\"!
pub fn get_instance(configuration: &configuration::Configuration, world_id: &str, instance_id: &str) -> Result<crate::models::Instance, Error<GetInstanceError>> {
let local_var_configuration = configuration;
Expand Down
41 changes: 41 additions & 0 deletions src/models/group_access_type.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* VRChat API Documentation
*
*
* Contact: [email protected]
* 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
}
}




33 changes: 24 additions & 9 deletions src/models/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ pub struct Instance {
pub n_users: i32,
#[serde(rename = "name")]
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.
#[serde(rename = "ownerId", skip_serializing_if = "Option::is_none")]
pub owner_id: Option<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")]
pub owner_id: Option<Option<String>>,
#[serde(rename = "permanent")]
pub permanent: bool,
#[serde(rename = "photonRegion")]
Expand All @@ -48,8 +48,8 @@ pub struct Instance {
pub region: crate::models::Region,
#[serde(rename = "secureName")]
pub secure_name: String,
#[serde(rename = "shortName", skip_serializing_if = "Option::is_none")]
pub short_name: Option<String>,
#[serde(rename = "shortName", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
pub short_name: Option<Option<String>>,
/// The tags array on Instances usually contain the language tags of the people in the instance.
#[serde(rename = "tags")]
pub tags: Vec<String>,
Expand All @@ -73,8 +73,8 @@ pub struct Instance {
pub queue_size: i32,
#[serde(rename = "recommendedCapacity")]
pub recommended_capacity: i32,
#[serde(rename = "roleRestricted")]
pub role_restricted: bool,
#[serde(rename = "roleRestricted", skip_serializing_if = "Option::is_none")]
pub role_restricted: Option<bool>,
#[serde(rename = "strict")]
pub strict: bool,
#[serde(rename = "userCount")]
Expand All @@ -84,11 +84,21 @@ pub struct Instance {
/// The users field is present on instances created by the requesting user.
#[serde(rename = "users", skip_serializing_if = "Option::is_none")]
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 {
/// * `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 {
active,
can_request_invite,
Expand Down Expand Up @@ -116,11 +126,16 @@ impl Instance {
queue_enabled,
queue_size,
recommended_capacity,
role_restricted,
role_restricted: None,
strict,
user_count,
world: Box::new(world),
users: None,
group_access_type: None,
has_capacity_for_you: None,
nonce: None,
closed_at: None,
hard_close: None,
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/models/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ pub mod friend_status;
pub use self::friend_status::FriendStatus;
pub mod group;
pub use self::group::Group;
pub mod group_access_type;
pub use self::group_access_type::GroupAccessType;
pub mod group_announcement;
pub use self::group_announcement::GroupAnnouncement;
pub mod group_audit_log_entry;
Expand Down

0 comments on commit fd93366

Please sign in to comment.