Adds renaming games functionality
This commit is contained in:
@@ -120,6 +120,15 @@ pub enum PostTokenError {
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`rename_game_post`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum RenameGamePostError {
|
||||
Status401(models::Failure),
|
||||
Status422(models::Failure),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`user_get`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
@@ -550,6 +559,35 @@ pub async fn post_token(configuration: &configuration::Configuration, ) -> Resul
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn rename_game_post(configuration: &configuration::Configuration, rename_game_request_body: Option<models::RenameGameRequestBody>) -> Result<(), Error<RenameGamePostError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_rename_game_request_body = rename_game_request_body;
|
||||
|
||||
let uri_str = format!("{}/rename_game", configuration.base_path);
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
if let Some(ref token) = configuration.bearer_access_token {
|
||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||
};
|
||||
req_builder = req_builder.json(&p_rename_game_request_body);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
|
||||
let status = resp.status();
|
||||
|
||||
if !status.is_client_error() && !status.is_server_error() {
|
||||
Ok(())
|
||||
} else {
|
||||
let content = resp.text().await?;
|
||||
let entity: Option<RenameGamePostError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
||||
/// Get a user from primary id
|
||||
pub async fn user_get(configuration: &configuration::Configuration, user_id: Option<models::UserId>) -> Result<models::User, Error<UserGetError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
|
||||
Reference in New Issue
Block a user