/* * VRChat API Documentation * * * Contact: vrchatapi.lpv0t@aries.fyi * Generated by: https://openapi-generator.tech */ use reqwest; #[allow(unused_imports)] 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 [`create_instance`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum CreateInstanceError { Status401(crate::models::Error), UnknownValue(serde_json::Value), } /// struct for typed errors of method [`get_instance`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum GetInstanceError { Status401(crate::models::Error), UnknownValue(serde_json::Value), } /// struct for typed errors of method [`get_instance_by_short_name`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum GetInstanceByShortNameError { Status401(crate::models::Error), Status404(crate::models::Error), UnknownValue(serde_json::Value), } /// struct for typed errors of method [`get_short_name`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum GetShortNameError { Status401(crate::models::Error), UnknownValue(serde_json::Value), } /// struct for typed errors of method [`send_self_invite`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] pub enum SendSelfInviteError { Status401(crate::models::Error), 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 + Clone + core::fmt::Debug>, world_id: &str, instance_id: &str, hard_close: Option, closed_at: Option) -> Result> { let local_var_uri_str = format!("{}/instances/{worldId}:{instanceId}", configuration.base_path, worldId=crate::apis::urlencode(world_id), instanceId=crate::apis::urlencode(instance_id)); #[allow(unused_mut)] let mut local_var_req_builder = configuration.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_str) = closed_at { local_var_req_builder = local_var_req_builder.query(&[("closedAt", &local_var_str.to_string())]); } crate::request(configuration, local_var_req_builder, None::<()>).await } /// Create an instance pub async fn create_instance(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, create_instance_request: crate::models::CreateInstanceRequest) -> Result> { let local_var_uri_str = format!("{}/instances", configuration.base_path); #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::POST, local_var_uri_str.as_str()); crate::request(configuration, local_var_req_builder, Some(create_instance_request)).await } /// 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 + Clone + core::fmt::Debug>, world_id: &str, instance_id: &str) -> Result> { let local_var_uri_str = format!("{}/instances/{worldId}:{instanceId}", configuration.base_path, worldId=crate::apis::urlencode(world_id), instanceId=crate::apis::urlencode(instance_id)); #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); crate::request(configuration, local_var_req_builder, None::<()>).await } /// 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 + Clone + core::fmt::Debug>, short_name: &str) -> Result> { let local_var_uri_str = format!("{}/instances/s/{shortName}", configuration.base_path, shortName=crate::apis::urlencode(short_name)); #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); crate::request(configuration, local_var_req_builder, None::<()>).await } /// Returns an instance short name. pub async fn get_short_name(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, world_id: &str, instance_id: &str) -> Result> { let local_var_uri_str = format!("{}/instances/{worldId}:{instanceId}/shortName", configuration.base_path, worldId=crate::apis::urlencode(world_id), instanceId=crate::apis::urlencode(instance_id)); #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::GET, local_var_uri_str.as_str()); crate::request(configuration, local_var_req_builder, None::<()>).await } /// Sends an invite to the instance to yourself. pub async fn send_self_invite(configuration: &configuration::Configuration + Clone + core::fmt::Debug>, world_id: &str, instance_id: &str) -> Result> { let local_var_uri_str = format!("{}/instances/{worldId}:{instanceId}/invite", configuration.base_path, worldId=crate::apis::urlencode(world_id), instanceId=crate::apis::urlencode(instance_id)); #[allow(unused_mut)] let mut local_var_req_builder = configuration.client.request(reqwest::Method::POST, local_var_uri_str.as_str()); crate::request(configuration, local_var_req_builder, None::<()>).await }