Added Location and location ownership/rights to gamenight.

This commit is contained in:
2025-12-24 14:48:54 +01:00
parent 8a48119c80
commit ff88029a4b
57 changed files with 3034 additions and 995 deletions

View File

@@ -4,6 +4,8 @@ Cargo.toml
README.md
docs/AddGameRequestBody.md
docs/AddGamenightRequestBody.md
docs/AddLocationRequestBody.md
docs/AuthorizeLocationRequestBody.md
docs/DefaultApi.md
docs/Failure.md
docs/Game.md
@@ -11,6 +13,8 @@ docs/GameId.md
docs/Gamenight.md
docs/GamenightId.md
docs/GetGamenightRequestBody.md
docs/Location.md
docs/LocationId.md
docs/Login.md
docs/Participants.md
docs/Registration.md
@@ -25,12 +29,16 @@ src/apis/mod.rs
src/lib.rs
src/models/add_game_request_body.rs
src/models/add_gamenight_request_body.rs
src/models/add_location_request_body.rs
src/models/authorize_location_request_body.rs
src/models/failure.rs
src/models/game.rs
src/models/game_id.rs
src/models/gamenight.rs
src/models/gamenight_id.rs
src/models/get_gamenight_request_body.rs
src/models/location.rs
src/models/location_id.rs
src/models/login.rs
src/models/mod.rs
src/models/participants.rs

View File

@@ -1 +1 @@
7.14.0
7.17.0

View File

@@ -12,3 +12,8 @@ serde_json = "^1.0"
serde_repr = "^0.1"
url = "^2.5"
reqwest = { version = "^0.12", default-features = false, features = ["json", "multipart"] }
[features]
default = ["native-tls"]
native-tls = ["reqwest/native-tls"]
rustls-tls = ["reqwest/rustls-tls"]

View File

@@ -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.14.0
- Generator version: 7.17.0
- Build package: `org.openapitools.codegen.languages.RustClientCodegen`
## Installation
@@ -27,6 +27,7 @@ All URIs are relative to *http://localhost:8080*
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_get**](docs/DefaultApi.md#game_get) | **GET** /game |
*DefaultApi* | [**game_post**](docs/DefaultApi.md#game_post) | **POST** /game |
@@ -36,6 +37,10 @@ Class | Method | HTTP request | Description
*DefaultApi* | [**get_token**](docs/DefaultApi.md#get_token) | **GET** /token |
*DefaultApi* | [**join_post**](docs/DefaultApi.md#join_post) | **POST** /join |
*DefaultApi* | [**leave_post**](docs/DefaultApi.md#leave_post) | **POST** /leave |
*DefaultApi* | [**location_authorize_post**](docs/DefaultApi.md#location_authorize_post) | **POST** /location_authorize |
*DefaultApi* | [**location_get**](docs/DefaultApi.md#location_get) | **GET** /location |
*DefaultApi* | [**location_post**](docs/DefaultApi.md#location_post) | **POST** /location |
*DefaultApi* | [**locations_get**](docs/DefaultApi.md#locations_get) | **GET** /locations |
*DefaultApi* | [**own_post**](docs/DefaultApi.md#own_post) | **POST** /own |
*DefaultApi* | [**owned_games_get**](docs/DefaultApi.md#owned_games_get) | **GET** /owned_games |
*DefaultApi* | [**participants_get**](docs/DefaultApi.md#participants_get) | **GET** /participants | Get all participants for a gamenight
@@ -44,18 +49,23 @@ Class | Method | HTTP request | Description
*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 |
*DefaultApi* | [**users_get**](docs/DefaultApi.md#users_get) | **GET** /users |
## Documentation For Models
- [AddGameRequestBody](docs/AddGameRequestBody.md)
- [AddGamenightRequestBody](docs/AddGamenightRequestBody.md)
- [AddLocationRequestBody](docs/AddLocationRequestBody.md)
- [AuthorizeLocationRequestBody](docs/AuthorizeLocationRequestBody.md)
- [Failure](docs/Failure.md)
- [Game](docs/Game.md)
- [GameId](docs/GameId.md)
- [Gamenight](docs/Gamenight.md)
- [GamenightId](docs/GamenightId.md)
- [GetGamenightRequestBody](docs/GetGamenightRequestBody.md)
- [Location](docs/Location.md)
- [LocationId](docs/LocationId.md)
- [Login](docs/Login.md)
- [Participants](docs/Participants.md)
- [Registration](docs/Registration.md)

View File

@@ -0,0 +1,13 @@
# AddLocation
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **String** | |
**address** | Option<**String**> | | [optional]
**note** | Option<**String**> | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,13 @@
# AddLocationRequestBody
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**name** | **String** | |
**address** | Option<**String**> | | [optional]
**note** | Option<**String**> | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,13 @@
# AuthorizeLocationRequestBody
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**location_id** | **String** | |
**user_id** | **String** | |
**op** | **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)

View File

@@ -4,6 +4,7 @@ All URIs are relative to *http://localhost:8080*
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_get**](DefaultApi.md#game_get) | **GET** /game |
[**game_post**](DefaultApi.md#game_post) | **POST** /game |
@@ -13,6 +14,10 @@ Method | HTTP request | Description
[**get_token**](DefaultApi.md#get_token) | **GET** /token |
[**join_post**](DefaultApi.md#join_post) | **POST** /join |
[**leave_post**](DefaultApi.md#leave_post) | **POST** /leave |
[**location_authorize_post**](DefaultApi.md#location_authorize_post) | **POST** /location_authorize |
[**location_get**](DefaultApi.md#location_get) | **GET** /location |
[**location_post**](DefaultApi.md#location_post) | **POST** /location |
[**locations_get**](DefaultApi.md#locations_get) | **GET** /locations |
[**own_post**](DefaultApi.md#own_post) | **POST** /own |
[**owned_games_get**](DefaultApi.md#owned_games_get) | **GET** /owned_games |
[**participants_get**](DefaultApi.md#participants_get) | **GET** /participants | Get all participants for a gamenight
@@ -21,9 +26,38 @@ Method | HTTP request | Description
[**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 |
[**users_get**](DefaultApi.md#users_get) | **GET** /users |
## authorized_location_user_ids_get
> Vec<models::UserId> authorized_location_user_ids_get(location_id)
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**location_id** | Option<[**LocationId**](LocationId.md)> | | |
### Return type
[**Vec<models::UserId>**](UserId.md)
### 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)
## disown_post
> disown_post(game_id)
@@ -274,6 +308,115 @@ 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)
## location_authorize_post
> location_authorize_post(authorize_location_request_body)
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**authorize_location_request_body** | Option<[**AuthorizeLocationRequestBody**](AuthorizeLocationRequestBody.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)
## location_get
> models::Location location_get(location_id)
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**location_id** | Option<[**LocationId**](LocationId.md)> | | |
### Return type
[**models::Location**](Location.md)
### 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)
## location_post
> models::LocationId location_post(add_location_request_body)
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**add_location_request_body** | Option<[**AddLocationRequestBody**](AddLocationRequestBody.md)> | | |
### Return type
[**models::LocationId**](LocationId.md)
### 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)
## locations_get
> Vec<models::Location> locations_get()
### Parameters
This endpoint does not need any parameter.
### Return type
[**Vec<models::Location>**](Location.md)
### Authorization
[JWT-Auth](../README.md#JWT-Auth)
### HTTP request headers
- **Content-Type**: Not defined
- **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)
## own_post
> own_post(game_id)
@@ -504,3 +647,28 @@ 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)
## users_get
> Vec<models::User> users_get()
### Parameters
This endpoint does not need any parameter.
### Return type
[**Vec<models::User>**](User.md)
### Authorization
[JWT-Auth](../README.md#JWT-Auth)
### HTTP request headers
- **Content-Type**: Not defined
- **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)

View File

@@ -0,0 +1,14 @@
# Location
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **String** | |
**name** | **String** | |
**address** | Option<**String**> | | [optional]
**note** | Option<**String**> | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,11 @@
# LocationId
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**location_id** | **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)

View File

@@ -15,6 +15,15 @@ use crate::{apis::ResponseContent, models};
use super::{Error, configuration, ContentType};
/// struct for typed errors of method [`authorized_location_user_ids_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AuthorizedLocationUserIdsGetError {
Status401(models::Failure),
Status422(models::Failure),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`disown_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
@@ -95,6 +104,42 @@ pub enum LeavePostError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`location_authorize_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum LocationAuthorizePostError {
Status401(models::Failure),
Status422(models::Failure),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`location_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum LocationGetError {
Status401(models::Failure),
Status422(models::Failure),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`location_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum LocationPostError {
Status401(models::Failure),
Status422(models::Failure),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`locations_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum LocationsGetError {
Status401(models::Failure),
Status422(models::Failure),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`own_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
@@ -166,10 +211,59 @@ pub enum UserGetError {
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`users_get`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UsersGetError {
Status400(models::Failure),
Status401(models::Failure),
UnknownValue(serde_json::Value),
}
pub async fn authorized_location_user_ids_get(configuration: &configuration::Configuration, location_id: Option<models::LocationId>) -> Result<Vec<models::UserId>, Error<AuthorizedLocationUserIdsGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_location_id = location_id;
let uri_str = format!("{}/authorized_location_user_ids", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &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_location_id);
let req = req_builder.build()?;
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() {
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 `Vec&lt;models::UserId&gt;`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::UserId&gt;`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<AuthorizedLocationUserIdsGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn disown_post(configuration: &configuration::Configuration, game_id: Option<models::GameId>) -> Result<(), Error<DisownPostError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_game_id = game_id;
let p_body_game_id = game_id;
let uri_str = format!("{}/disown", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
@@ -180,7 +274,7 @@ pub async fn disown_post(configuration: &configuration::Configuration, game_id:
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_game_id);
req_builder = req_builder.json(&p_body_game_id);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
@@ -198,7 +292,7 @@ pub async fn disown_post(configuration: &configuration::Configuration, game_id:
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_game_id = game_id;
let p_body_game_id = game_id;
let uri_str = format!("{}/game", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
@@ -209,7 +303,7 @@ pub async fn game_get(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_game_id);
req_builder = req_builder.json(&p_body_game_id);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
@@ -238,7 +332,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>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_add_game_request_body = add_game_request_body;
let p_body_add_game_request_body = add_game_request_body;
let uri_str = format!("{}/game", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
@@ -249,7 +343,7 @@ pub async fn game_post(configuration: &configuration::Configuration, add_game_re
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_add_game_request_body);
req_builder = req_builder.json(&p_body_add_game_request_body);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
@@ -304,7 +398,7 @@ pub async fn games_get(configuration: &configuration::Configuration, ) -> Result
pub async fn get_gamenight(configuration: &configuration::Configuration, get_gamenight_request_body: Option<models::GetGamenightRequestBody>) -> Result<models::Gamenight, Error<GetGamenightError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_get_gamenight_request_body = get_gamenight_request_body;
let p_body_get_gamenight_request_body = get_gamenight_request_body;
let uri_str = format!("{}/gamenight", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
@@ -315,7 +409,7 @@ pub async fn get_gamenight(configuration: &configuration::Configuration, get_gam
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_get_gamenight_request_body);
req_builder = req_builder.json(&p_body_get_gamenight_request_body);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
@@ -383,7 +477,7 @@ pub async fn get_gamenights(configuration: &configuration::Configuration, ) -> R
/// Submit your credentials to get a JWT-token to use with the rest of the api.
pub async fn get_token(configuration: &configuration::Configuration, login: Option<models::Login>) -> Result<models::Token, Error<GetTokenError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_login = login;
let p_body_login = login;
let uri_str = format!("{}/token", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
@@ -391,7 +485,7 @@ pub async fn get_token(configuration: &configuration::Configuration, login: Opti
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = req_builder.json(&p_login);
req_builder = req_builder.json(&p_body_login);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
@@ -420,7 +514,7 @@ pub async fn get_token(configuration: &configuration::Configuration, login: Opti
pub async fn join_post(configuration: &configuration::Configuration, gamenight_id: Option<models::GamenightId>) -> Result<(), Error<JoinPostError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_gamenight_id = gamenight_id;
let p_body_gamenight_id = gamenight_id;
let uri_str = format!("{}/join", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
@@ -431,7 +525,7 @@ pub async fn join_post(configuration: &configuration::Configuration, gamenight_i
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_gamenight_id);
req_builder = req_builder.json(&p_body_gamenight_id);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
@@ -449,7 +543,7 @@ pub async fn join_post(configuration: &configuration::Configuration, gamenight_i
pub async fn leave_post(configuration: &configuration::Configuration, gamenight_id: Option<models::GamenightId>) -> Result<(), Error<LeavePostError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_gamenight_id = gamenight_id;
let p_body_gamenight_id = gamenight_id;
let uri_str = format!("{}/leave", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
@@ -460,7 +554,7 @@ pub async fn leave_post(configuration: &configuration::Configuration, gamenight_
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_gamenight_id);
req_builder = req_builder.json(&p_body_gamenight_id);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
@@ -476,9 +570,155 @@ pub async fn leave_post(configuration: &configuration::Configuration, gamenight_
}
}
pub async fn location_authorize_post(configuration: &configuration::Configuration, authorize_location_request_body: Option<models::AuthorizeLocationRequestBody>) -> Result<(), Error<LocationAuthorizePostError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_authorize_location_request_body = authorize_location_request_body;
let uri_str = format!("{}/location_authorize", 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_body_authorize_location_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<LocationAuthorizePostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn location_get(configuration: &configuration::Configuration, location_id: Option<models::LocationId>) -> Result<models::Location, Error<LocationGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_location_id = location_id;
let uri_str = format!("{}/location", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &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_location_id);
let req = req_builder.build()?;
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() {
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::Location`"))),
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::Location`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<LocationGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn location_post(configuration: &configuration::Configuration, add_location_request_body: Option<models::AddLocationRequestBody>) -> Result<models::LocationId, Error<LocationPostError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_add_location_request_body = add_location_request_body;
let uri_str = format!("{}/location", 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_body_add_location_request_body);
let req = req_builder.build()?;
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() {
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::LocationId`"))),
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::LocationId`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<LocationPostError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn locations_get(configuration: &configuration::Configuration, ) -> Result<Vec<models::Location>, Error<LocationsGetError>> {
let uri_str = format!("{}/locations", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &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());
};
let req = req_builder.build()?;
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() {
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 `Vec&lt;models::Location&gt;`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::Location&gt;`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<LocationsGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
pub async fn own_post(configuration: &configuration::Configuration, game_id: Option<models::GameId>) -> Result<(), Error<OwnPostError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_game_id = game_id;
let p_body_game_id = game_id;
let uri_str = format!("{}/own", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
@@ -489,7 +729,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_game_id);
req_builder = req_builder.json(&p_body_game_id);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
@@ -507,7 +747,7 @@ pub async fn own_post(configuration: &configuration::Configuration, game_id: Opt
pub async fn owned_games_get(configuration: &configuration::Configuration, user_id: Option<models::UserId>) -> Result<Vec<String>, Error<OwnedGamesGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_user_id = user_id;
let p_body_user_id = user_id;
let uri_str = format!("{}/owned_games", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
@@ -518,7 +758,7 @@ pub async fn owned_games_get(configuration: &configuration::Configuration, user_
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_user_id);
req_builder = req_builder.json(&p_body_user_id);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
@@ -548,7 +788,7 @@ pub async fn owned_games_get(configuration: &configuration::Configuration, user_
/// Retrieve the participants of a single gamenight by id.
pub async fn participants_get(configuration: &configuration::Configuration, gamenight_id: Option<models::GamenightId>) -> Result<models::Participants, Error<ParticipantsGetError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_gamenight_id = gamenight_id;
let p_body_gamenight_id = gamenight_id;
let uri_str = format!("{}/participants", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
@@ -559,7 +799,7 @@ pub async fn participants_get(configuration: &configuration::Configuration, game
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_gamenight_id);
req_builder = req_builder.json(&p_body_gamenight_id);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
@@ -589,7 +829,7 @@ pub async fn participants_get(configuration: &configuration::Configuration, game
/// Add a gamenight by providing a name and a date, only available when providing an JWT token.
pub async fn post_gamenight(configuration: &configuration::Configuration, add_gamenight_request_body: Option<models::AddGamenightRequestBody>) -> Result<(), Error<PostGamenightError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_add_gamenight_request_body = add_gamenight_request_body;
let p_body_add_gamenight_request_body = add_gamenight_request_body;
let uri_str = format!("{}/gamenight", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
@@ -600,7 +840,7 @@ pub async fn post_gamenight(configuration: &configuration::Configuration, add_ga
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_add_gamenight_request_body);
req_builder = req_builder.json(&p_body_add_gamenight_request_body);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
@@ -619,7 +859,7 @@ pub async fn post_gamenight(configuration: &configuration::Configuration, add_ga
/// Create a new user given a registration token and user information, username and email must be unique, and password and password_repeat must match.
pub async fn post_register(configuration: &configuration::Configuration, registration: Option<models::Registration>) -> Result<(), Error<PostRegisterError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_registration = registration;
let p_body_registration = registration;
let uri_str = format!("{}/user", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
@@ -630,7 +870,7 @@ pub async fn post_register(configuration: &configuration::Configuration, registr
if let Some(ref token) = configuration.bearer_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
req_builder = req_builder.json(&p_registration);
req_builder = req_builder.json(&p_body_registration);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
@@ -686,7 +926,7 @@ 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 p_body_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);
@@ -697,7 +937,7 @@ pub async fn rename_game_post(configuration: &configuration::Configuration, rena
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);
req_builder = req_builder.json(&p_body_rename_game_request_body);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
@@ -716,7 +956,7 @@ pub async fn rename_game_post(configuration: &configuration::Configuration, rena
/// 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
let p_user_id = user_id;
let p_body_user_id = user_id;
let uri_str = format!("{}/user", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
@@ -727,7 +967,7 @@ pub async fn user_get(configuration: &configuration::Configuration, user_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_user_id);
req_builder = req_builder.json(&p_body_user_id);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
@@ -754,3 +994,40 @@ pub async fn user_get(configuration: &configuration::Configuration, user_id: Opt
}
}
pub async fn users_get(configuration: &configuration::Configuration, ) -> Result<Vec<models::User>, Error<UsersGetError>> {
let uri_str = format!("{}/users", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &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());
};
let req = req_builder.build()?;
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() {
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 `Vec&lt;models::User&gt;`"))),
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;models::User&gt;`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<UsersGetError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}

View File

@@ -0,0 +1,33 @@
/*
* 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 AddLocation {
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "address", skip_serializing_if = "Option::is_none")]
pub address: Option<String>,
#[serde(rename = "note", skip_serializing_if = "Option::is_none")]
pub note: Option<String>,
}
impl AddLocation {
pub fn new(name: String) -> AddLocation {
AddLocation {
name,
address: None,
note: None,
}
}
}

View File

@@ -0,0 +1,33 @@
/*
* 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 AddLocationRequestBody {
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "address", skip_serializing_if = "Option::is_none")]
pub address: Option<String>,
#[serde(rename = "note", skip_serializing_if = "Option::is_none")]
pub note: Option<String>,
}
impl AddLocationRequestBody {
pub fn new(name: String) -> AddLocationRequestBody {
AddLocationRequestBody {
name,
address: None,
note: None,
}
}
}

View File

@@ -0,0 +1,47 @@
/*
* 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 AuthorizeLocationRequestBody {
#[serde(rename = "location_id")]
pub location_id: String,
#[serde(rename = "user_id")]
pub user_id: String,
#[serde(rename = "op")]
pub op: Op,
}
impl AuthorizeLocationRequestBody {
pub fn new(location_id: String, user_id: String, op: Op) -> AuthorizeLocationRequestBody {
AuthorizeLocationRequestBody {
location_id,
user_id,
op,
}
}
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Op {
#[serde(rename = "grant")]
Grant,
#[serde(rename = "revoke")]
Revoke,
}
impl Default for Op {
fn default() -> Op {
Self::Grant
}
}

View File

@@ -0,0 +1,36 @@
/*
* 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 Location {
#[serde(rename = "id")]
pub id: String,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "address", skip_serializing_if = "Option::is_none")]
pub address: Option<String>,
#[serde(rename = "note", skip_serializing_if = "Option::is_none")]
pub note: Option<String>,
}
impl Location {
pub fn new(id: String, name: String) -> Location {
Location {
id,
name,
address: None,
note: None,
}
}
}

View File

@@ -0,0 +1,27 @@
/*
* 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 LocationId {
#[serde(rename = "location_id")]
pub location_id: String,
}
impl LocationId {
pub fn new(location_id: String) -> LocationId {
LocationId {
location_id,
}
}
}

View File

@@ -2,6 +2,10 @@ pub mod add_game_request_body;
pub use self::add_game_request_body::AddGameRequestBody;
pub mod add_gamenight_request_body;
pub use self::add_gamenight_request_body::AddGamenightRequestBody;
pub mod add_location_request_body;
pub use self::add_location_request_body::AddLocationRequestBody;
pub mod authorize_location_request_body;
pub use self::authorize_location_request_body::AuthorizeLocationRequestBody;
pub mod failure;
pub use self::failure::Failure;
pub mod game;
@@ -14,6 +18,10 @@ pub mod gamenight_id;
pub use self::gamenight_id::GamenightId;
pub mod get_gamenight_request_body;
pub use self::get_gamenight_request_body::GetGamenightRequestBody;
pub mod location;
pub use self::location::Location;
pub mod location_id;
pub use self::location_id::LocationId;
pub mod login;
pub use self::login::Login;
pub mod participants;