Added owning games and not willing to travel with them.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Gamenight
|
||||
*
|
||||
* Api specifaction for a Gamenight server
|
||||
* Api specification for a Gamenight server
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0
|
||||
* Contact: dennis@brentj.es
|
||||
@@ -330,7 +330,7 @@ pub async fn game_get(configuration: &configuration::Configuration, game_id: Opt
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn game_post(configuration: &configuration::Configuration, add_game_request_body: Option<models::AddGameRequestBody>) -> Result<(), Error<GamePostError>> {
|
||||
pub async fn game_post(configuration: &configuration::Configuration, add_game_request_body: Option<models::AddGameRequestBody>) -> Result<models::GameId, Error<GamePostError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_body_add_game_request_body = add_game_request_body;
|
||||
|
||||
@@ -349,9 +349,20 @@ pub async fn game_post(configuration: &configuration::Configuration, add_game_re
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
|
||||
let status = resp.status();
|
||||
let content_type = resp
|
||||
.headers()
|
||||
.get("content-type")
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.unwrap_or("application/octet-stream");
|
||||
let content_type = super::ContentType::from(content_type);
|
||||
|
||||
if !status.is_client_error() && !status.is_server_error() {
|
||||
Ok(())
|
||||
let content = resp.text().await?;
|
||||
match content_type {
|
||||
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
||||
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GameId`"))),
|
||||
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::GameId`")))),
|
||||
}
|
||||
} else {
|
||||
let content = resp.text().await?;
|
||||
let entity: Option<GamePostError> = serde_json::from_str(&content).ok();
|
||||
@@ -716,9 +727,9 @@ pub async fn locations_get(configuration: &configuration::Configuration, ) -> Re
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn own_post(configuration: &configuration::Configuration, game_id: Option<models::GameId>) -> Result<(), Error<OwnPostError>> {
|
||||
pub async fn own_post(configuration: &configuration::Configuration, own_game_request_body: Option<models::OwnGameRequestBody>) -> Result<(), Error<OwnPostError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_body_game_id = game_id;
|
||||
let p_body_own_game_request_body = own_game_request_body;
|
||||
|
||||
let uri_str = format!("{}/own", configuration.base_path);
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
|
||||
@@ -729,7 +740,7 @@ pub async fn own_post(configuration: &configuration::Configuration, game_id: Opt
|
||||
if let Some(ref token) = configuration.bearer_access_token {
|
||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||
};
|
||||
req_builder = req_builder.json(&p_body_game_id);
|
||||
req_builder = req_builder.json(&p_body_own_game_request_body);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
|
||||
Reference in New Issue
Block a user