Implemented deleting games as admin.
This commit is contained in:
@@ -29,6 +29,7 @@ Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*DefaultApi* | [**authorized_location_user_ids_get**](docs/DefaultApi.md#authorized_location_user_ids_get) | **GET** /authorized_location_user_ids |
|
||||
*DefaultApi* | [**disown_post**](docs/DefaultApi.md#disown_post) | **POST** /disown |
|
||||
*DefaultApi* | [**game_delete**](docs/DefaultApi.md#game_delete) | **DELETE** /game |
|
||||
*DefaultApi* | [**game_get**](docs/DefaultApi.md#game_get) | **GET** /game |
|
||||
*DefaultApi* | [**game_post**](docs/DefaultApi.md#game_post) | **POST** /game |
|
||||
*DefaultApi* | [**games_get**](docs/DefaultApi.md#games_get) | **GET** /games |
|
||||
|
||||
@@ -6,6 +6,7 @@ Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**authorized_location_user_ids_get**](DefaultApi.md#authorized_location_user_ids_get) | **GET** /authorized_location_user_ids |
|
||||
[**disown_post**](DefaultApi.md#disown_post) | **POST** /disown |
|
||||
[**game_delete**](DefaultApi.md#game_delete) | **DELETE** /game |
|
||||
[**game_get**](DefaultApi.md#game_get) | **GET** /game |
|
||||
[**game_post**](DefaultApi.md#game_post) | **POST** /game |
|
||||
[**games_get**](DefaultApi.md#games_get) | **GET** /games |
|
||||
@@ -86,6 +87,34 @@ Name | Type | Description | Required | Notes
|
||||
[[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)
|
||||
|
||||
|
||||
## game_delete
|
||||
|
||||
> game_delete(game_id)
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Required | Notes
|
||||
------------- | ------------- | ------------- | ------------- | -------------
|
||||
**game_id** | Option<[**GameId**](GameId.md)> | | |
|
||||
|
||||
### Return type
|
||||
|
||||
(empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[JWT-Auth](../README.md#JWT-Auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **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)
|
||||
|
||||
|
||||
## game_get
|
||||
|
||||
> models::Game game_get(game_id)
|
||||
|
||||
@@ -33,6 +33,15 @@ pub enum DisownPostError {
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`game_delete`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum GameDeleteError {
|
||||
Status401(models::Failure),
|
||||
Status422(models::Failure),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`game_get`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
@@ -290,6 +299,35 @@ pub async fn disown_post(configuration: &configuration::Configuration, game_id:
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn game_delete(configuration: &configuration::Configuration, game_id: Option<models::GameId>) -> Result<(), Error<GameDeleteError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_body_game_id = game_id;
|
||||
|
||||
let uri_str = format!("{}/game", configuration.base_path);
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &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_body_game_id);
|
||||
|
||||
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<GameDeleteError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn game_get(configuration: &configuration::Configuration, game_id: Option<models::GameId>) -> Result<models::Game, Error<GameGetError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_body_game_id = game_id;
|
||||
|
||||
Reference in New Issue
Block a user