forked from Roflin/gamenight
Adds renaming games functionality
This commit is contained in:
@@ -14,6 +14,7 @@ docs/GetGamenightRequestBody.md
|
||||
docs/Login.md
|
||||
docs/Participants.md
|
||||
docs/Registration.md
|
||||
docs/RenameGameRequestBody.md
|
||||
docs/Token.md
|
||||
docs/User.md
|
||||
docs/UserId.md
|
||||
@@ -34,6 +35,7 @@ src/models/login.rs
|
||||
src/models/mod.rs
|
||||
src/models/participants.rs
|
||||
src/models/registration.rs
|
||||
src/models/rename_game_request_body.rs
|
||||
src/models/token.rs
|
||||
src/models/user.rs
|
||||
src/models/user_id.rs
|
||||
|
||||
@@ -1 +1 @@
|
||||
7.13.0
|
||||
7.14.0
|
||||
|
||||
@@ -10,7 +10,7 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generat
|
||||
|
||||
- API version: 1.0
|
||||
- Package version: 0.1.0
|
||||
- Generator version: 7.13.0
|
||||
- Generator version: 7.14.0
|
||||
- Build package: `org.openapitools.codegen.languages.RustClientCodegen`
|
||||
|
||||
## Installation
|
||||
@@ -39,6 +39,7 @@ Class | Method | HTTP request | Description
|
||||
*DefaultApi* | [**post_gamenight**](docs/DefaultApi.md#post_gamenight) | **POST** /gamenight |
|
||||
*DefaultApi* | [**post_register**](docs/DefaultApi.md#post_register) | **POST** /user |
|
||||
*DefaultApi* | [**post_token**](docs/DefaultApi.md#post_token) | **POST** /token |
|
||||
*DefaultApi* | [**rename_game_post**](docs/DefaultApi.md#rename_game_post) | **POST** /rename_game |
|
||||
*DefaultApi* | [**user_get**](docs/DefaultApi.md#user_get) | **GET** /user |
|
||||
|
||||
|
||||
@@ -55,6 +56,7 @@ Class | Method | HTTP request | Description
|
||||
- [Login](docs/Login.md)
|
||||
- [Participants](docs/Participants.md)
|
||||
- [Registration](docs/Registration.md)
|
||||
- [RenameGameRequestBody](docs/RenameGameRequestBody.md)
|
||||
- [Token](docs/Token.md)
|
||||
- [User](docs/User.md)
|
||||
- [UserId](docs/UserId.md)
|
||||
|
||||
@@ -16,6 +16,7 @@ Method | HTTP request | Description
|
||||
[**post_gamenight**](DefaultApi.md#post_gamenight) | **POST** /gamenight |
|
||||
[**post_register**](DefaultApi.md#post_register) | **POST** /user |
|
||||
[**post_token**](DefaultApi.md#post_token) | **POST** /token |
|
||||
[**rename_game_post**](DefaultApi.md#rename_game_post) | **POST** /rename_game |
|
||||
[**user_get**](DefaultApi.md#user_get) | **GET** /user |
|
||||
|
||||
|
||||
@@ -359,6 +360,34 @@ This endpoint does not need any parameter.
|
||||
[[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)
|
||||
|
||||
|
||||
## rename_game_post
|
||||
|
||||
> rename_game_post(rename_game_request_body)
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Required | Notes
|
||||
------------- | ------------- | ------------- | ------------- | -------------
|
||||
**rename_game_request_body** | Option<[**RenameGameRequestBody**](RenameGameRequestBody.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)
|
||||
|
||||
|
||||
## user_get
|
||||
|
||||
> models::User user_get(user_id)
|
||||
|
||||
12
gamenight-api-client-rs/docs/RenameGameRequestBody.md
Normal file
12
gamenight-api-client-rs/docs/RenameGameRequestBody.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# RenameGameRequestBody
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **String** | |
|
||||
**name** | **String** | |
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -20,6 +20,8 @@ pub mod participants;
|
||||
pub use self::participants::Participants;
|
||||
pub mod registration;
|
||||
pub use self::registration::Registration;
|
||||
pub mod rename_game_request_body;
|
||||
pub use self::rename_game_request_body::RenameGameRequestBody;
|
||||
pub mod token;
|
||||
pub use self::token::Token;
|
||||
pub mod user;
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Gamenight
|
||||
*
|
||||
* Api specifaction for a Gamenight server
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0
|
||||
* Contact: dennis@brentj.es
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use crate::models;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct RenameGameRequestBody {
|
||||
#[serde(rename = "id")]
|
||||
pub id: String,
|
||||
#[serde(rename = "name")]
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
impl RenameGameRequestBody {
|
||||
pub fn new(id: String, name: String) -> RenameGameRequestBody {
|
||||
RenameGameRequestBody {
|
||||
id,
|
||||
name,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user