Upgrade Rust SDK to spec 1.16.0

This commit is contained in:
VRCCat
2024-01-05 16:48:26 +00:00
parent 5546022b9d
commit 605dc4c3fa
6 changed files with 186 additions and 0 deletions

View File

@ -298,6 +298,14 @@ pub enum RespondGroupJoinRequestError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`search_groups`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SearchGroupsError {
Status401(crate::models::Error),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`unban_group_member`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
@ -1255,6 +1263,43 @@ pub fn respond_group_join_request(configuration: &configuration::Configuration,
}
}
/// Searches Groups by name or shortCode
pub fn search_groups(configuration: &configuration::Configuration, query: Option<&str>, offset: Option<i32>, n: Option<i32>) -> Result<Vec<crate::models::LimitedGroup>, Error<SearchGroupsError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/groups", local_var_configuration.base_path);
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_str) = query {
local_var_req_builder = local_var_req_builder.query(&[("query", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = offset {
local_var_req_builder = local_var_req_builder.query(&[("offset", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = n {
local_var_req_builder = local_var_req_builder.query(&[("n", &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<SearchGroupsError> = 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))
}
}
/// Unbans a user from a Group.
pub fn unban_group_member(configuration: &configuration::Configuration, group_id: &str, user_id: &str) -> Result<crate::models::GroupMember, Error<UnbanGroupMemberError>> {
let local_var_configuration = configuration;