forked from Roflin/gamenight
Implements leaving on the client side
This commit is contained in:
5
gamenight-api-client-rs/.gitignore
vendored
5
gamenight-api-client-rs/.gitignore
vendored
@@ -1,8 +1,3 @@
|
||||
/target/
|
||||
**/*.rs.bk
|
||||
Cargo.lock
|
||||
.openapi-generator-ignore
|
||||
.openapi-generator/
|
||||
.travis.yml
|
||||
docs/
|
||||
src/
|
||||
|
||||
23
gamenight-api-client-rs/.openapi-generator-ignore
Normal file
23
gamenight-api-client-rs/.openapi-generator-ignore
Normal file
@@ -0,0 +1,23 @@
|
||||
# OpenAPI Generator Ignore
|
||||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
||||
|
||||
# Use this file to prevent files from being overwritten by the generator.
|
||||
# The patterns follow closely to .gitignore or .dockerignore.
|
||||
|
||||
# As an example, the C# client generator defines ApiClient.cs.
|
||||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
||||
#ApiClient.cs
|
||||
|
||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||
#foo/*/qux
|
||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||
|
||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||
#foo/**/qux
|
||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||
|
||||
# You can also negate patterns with an exclamation (!).
|
||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||
#docs/*.md
|
||||
# Then explicitly reverse the ignore rule for a single file:
|
||||
#!docs/README.md
|
||||
33
gamenight-api-client-rs/.openapi-generator/FILES
Normal file
33
gamenight-api-client-rs/.openapi-generator/FILES
Normal file
@@ -0,0 +1,33 @@
|
||||
.gitignore
|
||||
.travis.yml
|
||||
Cargo.toml
|
||||
README.md
|
||||
docs/AddGamenightRequestBody.md
|
||||
docs/DefaultApi.md
|
||||
docs/Failure.md
|
||||
docs/Gamenight.md
|
||||
docs/GamenightId.md
|
||||
docs/GetGamenightRequestBody.md
|
||||
docs/Login.md
|
||||
docs/Participants.md
|
||||
docs/Registration.md
|
||||
docs/Token.md
|
||||
docs/User.md
|
||||
docs/UserId.md
|
||||
git_push.sh
|
||||
src/apis/configuration.rs
|
||||
src/apis/default_api.rs
|
||||
src/apis/mod.rs
|
||||
src/lib.rs
|
||||
src/models/add_gamenight_request_body.rs
|
||||
src/models/failure.rs
|
||||
src/models/gamenight.rs
|
||||
src/models/gamenight_id.rs
|
||||
src/models/get_gamenight_request_body.rs
|
||||
src/models/login.rs
|
||||
src/models/mod.rs
|
||||
src/models/participants.rs
|
||||
src/models/registration.rs
|
||||
src/models/token.rs
|
||||
src/models/user.rs
|
||||
src/models/user_id.rs
|
||||
1
gamenight-api-client-rs/.openapi-generator/VERSION
Normal file
1
gamenight-api-client-rs/.openapi-generator/VERSION
Normal file
@@ -0,0 +1 @@
|
||||
7.13.0
|
||||
1
gamenight-api-client-rs/.travis.yml
Normal file
1
gamenight-api-client-rs/.travis.yml
Normal file
@@ -0,0 +1 @@
|
||||
language: rust
|
||||
@@ -31,6 +31,7 @@ Class | Method | HTTP request | Description
|
||||
*DefaultApi* | [**get_gamenights**](docs/DefaultApi.md#get_gamenights) | **GET** /gamenights | Get a all gamenights
|
||||
*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* | [**participants_get**](docs/DefaultApi.md#participants_get) | **GET** /participants | Get all participants for a gamenight
|
||||
*DefaultApi* | [**post_gamenight**](docs/DefaultApi.md#post_gamenight) | **POST** /gamenight |
|
||||
*DefaultApi* | [**post_register**](docs/DefaultApi.md#post_register) | **POST** /user |
|
||||
|
||||
12
gamenight-api-client-rs/docs/AddGamenightRequestBody.md
Normal file
12
gamenight-api-client-rs/docs/AddGamenightRequestBody.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# AddGamenightRequestBody
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**name** | Option<**String**> | | [optional]
|
||||
**datetime** | 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)
|
||||
|
||||
|
||||
278
gamenight-api-client-rs/docs/DefaultApi.md
Normal file
278
gamenight-api-client-rs/docs/DefaultApi.md
Normal file
@@ -0,0 +1,278 @@
|
||||
# \DefaultApi
|
||||
|
||||
All URIs are relative to *http://localhost:8080*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**get_gamenight**](DefaultApi.md#get_gamenight) | **GET** /gamenight |
|
||||
[**get_gamenights**](DefaultApi.md#get_gamenights) | **GET** /gamenights | Get a all gamenights
|
||||
[**get_token**](DefaultApi.md#get_token) | **GET** /token |
|
||||
[**join_post**](DefaultApi.md#join_post) | **POST** /join |
|
||||
[**leave_post**](DefaultApi.md#leave_post) | **POST** /leave |
|
||||
[**participants_get**](DefaultApi.md#participants_get) | **GET** /participants | Get all participants for a gamenight
|
||||
[**post_gamenight**](DefaultApi.md#post_gamenight) | **POST** /gamenight |
|
||||
[**post_register**](DefaultApi.md#post_register) | **POST** /user |
|
||||
[**user_get**](DefaultApi.md#user_get) | **GET** /user |
|
||||
|
||||
|
||||
|
||||
## get_gamenight
|
||||
|
||||
> models::Gamenight get_gamenight(get_gamenight_request_body)
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Required | Notes
|
||||
------------- | ------------- | ------------- | ------------- | -------------
|
||||
**get_gamenight_request_body** | Option<[**GetGamenightRequestBody**](GetGamenightRequestBody.md)> | | |
|
||||
|
||||
### Return type
|
||||
|
||||
[**models::Gamenight**](Gamenight.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)
|
||||
|
||||
|
||||
## get_gamenights
|
||||
|
||||
> Vec<models::Gamenight> get_gamenights()
|
||||
Get a all gamenights
|
||||
|
||||
Retrieve the list of gamenights on this gamenight server. Requires authorization.
|
||||
|
||||
### Parameters
|
||||
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
[**Vec<models::Gamenight>**](Gamenight.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)
|
||||
|
||||
|
||||
## get_token
|
||||
|
||||
> models::Token get_token(login)
|
||||
|
||||
|
||||
Submit your credentials to get a JWT-token to use with the rest of the api.
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Required | Notes
|
||||
------------- | ------------- | ------------- | ------------- | -------------
|
||||
**login** | Option<[**Login**](Login.md)> | | |
|
||||
|
||||
### Return type
|
||||
|
||||
[**models::Token**](Token.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### 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)
|
||||
|
||||
|
||||
## join_post
|
||||
|
||||
> join_post(gamenight_id)
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Required | Notes
|
||||
------------- | ------------- | ------------- | ------------- | -------------
|
||||
**gamenight_id** | Option<[**GamenightId**](GamenightId.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)
|
||||
|
||||
|
||||
## leave_post
|
||||
|
||||
> leave_post(gamenight_id)
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Required | Notes
|
||||
------------- | ------------- | ------------- | ------------- | -------------
|
||||
**gamenight_id** | Option<[**GamenightId**](GamenightId.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)
|
||||
|
||||
|
||||
## participants_get
|
||||
|
||||
> models::Participants participants_get(gamenight_id)
|
||||
Get all participants for a gamenight
|
||||
|
||||
Retrieve the participants of a single gamenight by id.
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Required | Notes
|
||||
------------- | ------------- | ------------- | ------------- | -------------
|
||||
**gamenight_id** | Option<[**GamenightId**](GamenightId.md)> | | |
|
||||
|
||||
### Return type
|
||||
|
||||
[**models::Participants**](Participants.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)
|
||||
|
||||
|
||||
## post_gamenight
|
||||
|
||||
> post_gamenight(add_gamenight_request_body)
|
||||
|
||||
|
||||
Add a gamenight by providing a name and a date, only available when providing an JWT token.
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Required | Notes
|
||||
------------- | ------------- | ------------- | ------------- | -------------
|
||||
**add_gamenight_request_body** | Option<[**AddGamenightRequestBody**](AddGamenightRequestBody.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)
|
||||
|
||||
|
||||
## post_register
|
||||
|
||||
> post_register(registration)
|
||||
|
||||
|
||||
Create a new user given a registration token and user information, username and email must be unique, and password and password_repeat must match.
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Required | Notes
|
||||
------------- | ------------- | ------------- | ------------- | -------------
|
||||
**registration** | Option<[**Registration**](Registration.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)
|
||||
|
||||
|
||||
Get a user from primary id
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Required | Notes
|
||||
------------- | ------------- | ------------- | ------------- | -------------
|
||||
**user_id** | Option<[**UserId**](UserId.md)> | | |
|
||||
|
||||
### Return type
|
||||
|
||||
[**models::User**](User.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)
|
||||
|
||||
11
gamenight-api-client-rs/docs/Failure.md
Normal file
11
gamenight-api-client-rs/docs/Failure.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# Failure
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**message** | 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)
|
||||
|
||||
|
||||
14
gamenight-api-client-rs/docs/Gamenight.md
Normal file
14
gamenight-api-client-rs/docs/Gamenight.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# Gamenight
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **String** | |
|
||||
**name** | **String** | |
|
||||
**datetime** | **String** | |
|
||||
**owner_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)
|
||||
|
||||
|
||||
11
gamenight-api-client-rs/docs/GamenightId.md
Normal file
11
gamenight-api-client-rs/docs/GamenightId.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# GamenightId
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**gamenight_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)
|
||||
|
||||
|
||||
11
gamenight-api-client-rs/docs/GetGamenightRequest.md
Normal file
11
gamenight-api-client-rs/docs/GetGamenightRequest.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# GetGamenightRequest
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | 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)
|
||||
|
||||
|
||||
11
gamenight-api-client-rs/docs/GetGamenightRequestBody.md
Normal file
11
gamenight-api-client-rs/docs/GetGamenightRequestBody.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# GetGamenightRequestBody
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | 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)
|
||||
|
||||
|
||||
11
gamenight-api-client-rs/docs/GetToken401Response.md
Normal file
11
gamenight-api-client-rs/docs/GetToken401Response.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# GetToken401Response
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**message** | **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)
|
||||
|
||||
|
||||
12
gamenight-api-client-rs/docs/Login.md
Normal file
12
gamenight-api-client-rs/docs/Login.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# Login
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**username** | **String** | |
|
||||
**password** | **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)
|
||||
|
||||
|
||||
11
gamenight-api-client-rs/docs/Participants.md
Normal file
11
gamenight-api-client-rs/docs/Participants.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# Participants
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**participants** | **Vec<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)
|
||||
|
||||
|
||||
15
gamenight-api-client-rs/docs/Registration.md
Normal file
15
gamenight-api-client-rs/docs/Registration.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# Registration
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**username** | **String** | |
|
||||
**email** | **String** | |
|
||||
**password** | **String** | |
|
||||
**password_repeat** | **String** | |
|
||||
**registration_token** | **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)
|
||||
|
||||
|
||||
11
gamenight-api-client-rs/docs/Token.md
Normal file
11
gamenight-api-client-rs/docs/Token.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# Token
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**jwt_token** | 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)
|
||||
|
||||
|
||||
13
gamenight-api-client-rs/docs/User.md
Normal file
13
gamenight-api-client-rs/docs/User.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# User
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **String** | |
|
||||
**username** | **String** | |
|
||||
**email** | 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)
|
||||
|
||||
|
||||
11
gamenight-api-client-rs/docs/UserId.md
Normal file
11
gamenight-api-client-rs/docs/UserId.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# UserId
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**user_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)
|
||||
|
||||
|
||||
51
gamenight-api-client-rs/src/apis/configuration.rs
Normal file
51
gamenight-api-client-rs/src/apis/configuration.rs
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Configuration {
|
||||
pub base_path: String,
|
||||
pub user_agent: Option<String>,
|
||||
pub client: reqwest::Client,
|
||||
pub basic_auth: Option<BasicAuth>,
|
||||
pub oauth_access_token: Option<String>,
|
||||
pub bearer_access_token: Option<String>,
|
||||
pub api_key: Option<ApiKey>,
|
||||
}
|
||||
|
||||
pub type BasicAuth = (String, Option<String>);
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ApiKey {
|
||||
pub prefix: Option<String>,
|
||||
pub key: String,
|
||||
}
|
||||
|
||||
|
||||
impl Configuration {
|
||||
pub fn new() -> Configuration {
|
||||
Configuration::default()
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Configuration {
|
||||
fn default() -> Self {
|
||||
Configuration {
|
||||
base_path: "http://localhost:8080".to_owned(),
|
||||
user_agent: Some("OpenAPI-Generator/1.0/rust".to_owned()),
|
||||
client: reqwest::Client::new(),
|
||||
basic_auth: None,
|
||||
oauth_access_token: None,
|
||||
bearer_access_token: None,
|
||||
api_key: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
414
gamenight-api-client-rs/src/apis/default_api.rs
Normal file
414
gamenight-api-client-rs/src/apis/default_api.rs
Normal file
@@ -0,0 +1,414 @@
|
||||
/*
|
||||
* 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 reqwest;
|
||||
use serde::{Deserialize, Serialize, de::Error as _};
|
||||
use crate::{apis::ResponseContent, models};
|
||||
use super::{Error, configuration, ContentType};
|
||||
|
||||
|
||||
/// struct for typed errors of method [`get_gamenight`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum GetGamenightError {
|
||||
Status401(models::Failure),
|
||||
Status422(models::Failure),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`get_gamenights`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum GetGamenightsError {
|
||||
Status400(models::Failure),
|
||||
Status401(models::Failure),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`get_token`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum GetTokenError {
|
||||
Status401(models::Failure),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`join_post`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum JoinPostError {
|
||||
Status401(models::Failure),
|
||||
Status422(models::Failure),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`leave_post`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum LeavePostError {
|
||||
Status401(models::Failure),
|
||||
Status422(models::Failure),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`participants_get`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum ParticipantsGetError {
|
||||
Status400(models::Failure),
|
||||
Status401(models::Failure),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`post_gamenight`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum PostGamenightError {
|
||||
Status401(models::Failure),
|
||||
Status422(models::Failure),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`post_register`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum PostRegisterError {
|
||||
Status422(models::Failure),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`user_get`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum UserGetError {
|
||||
Status401(models::Failure),
|
||||
Status404(models::Failure),
|
||||
Status422(models::Failure),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
|
||||
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 uri_str = format!("{}/gamenight", 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_get_gamenight_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::Gamenight`"))),
|
||||
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::Gamenight`")))),
|
||||
}
|
||||
} else {
|
||||
let content = resp.text().await?;
|
||||
let entity: Option<GetGamenightError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
||||
/// Retrieve the list of gamenights on this gamenight server. Requires authorization.
|
||||
pub async fn get_gamenights(configuration: &configuration::Configuration, ) -> Result<Vec<models::Gamenight>, Error<GetGamenightsError>> {
|
||||
|
||||
let uri_str = format!("{}/gamenights", 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<models::Gamenight>`"))),
|
||||
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<models::Gamenight>`")))),
|
||||
}
|
||||
} else {
|
||||
let content = resp.text().await?;
|
||||
let entity: Option<GetGamenightsError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
||||
/// 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 uri_str = format!("{}/token", 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());
|
||||
}
|
||||
req_builder = req_builder.json(&p_login);
|
||||
|
||||
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::Token`"))),
|
||||
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::Token`")))),
|
||||
}
|
||||
} else {
|
||||
let content = resp.text().await?;
|
||||
let entity: Option<GetTokenError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
||||
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 uri_str = format!("{}/join", 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_gamenight_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<JoinPostError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
||||
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 uri_str = format!("{}/leave", 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_gamenight_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<LeavePostError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
||||
/// 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 uri_str = format!("{}/participants", 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_gamenight_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::Participants`"))),
|
||||
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::Participants`")))),
|
||||
}
|
||||
} else {
|
||||
let content = resp.text().await?;
|
||||
let entity: Option<ParticipantsGetError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
||||
/// 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 uri_str = format!("{}/gamenight", 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_add_gamenight_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<PostGamenightError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
||||
/// 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 uri_str = format!("{}/user", 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_registration);
|
||||
|
||||
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<PostRegisterError> = 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
|
||||
let p_user_id = user_id;
|
||||
|
||||
let uri_str = format!("{}/user", 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_user_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::User`"))),
|
||||
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::User`")))),
|
||||
}
|
||||
} else {
|
||||
let content = resp.text().await?;
|
||||
let entity: Option<UserGetError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
||||
116
gamenight-api-client-rs/src/apis/mod.rs
Normal file
116
gamenight-api-client-rs/src/apis/mod.rs
Normal file
@@ -0,0 +1,116 @@
|
||||
use std::error;
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ResponseContent<T> {
|
||||
pub status: reqwest::StatusCode,
|
||||
pub content: String,
|
||||
pub entity: Option<T>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Error<T> {
|
||||
Reqwest(reqwest::Error),
|
||||
Serde(serde_json::Error),
|
||||
Io(std::io::Error),
|
||||
ResponseError(ResponseContent<T>),
|
||||
}
|
||||
|
||||
impl <T> fmt::Display for Error<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let (module, e) = match self {
|
||||
Error::Reqwest(e) => ("reqwest", e.to_string()),
|
||||
Error::Serde(e) => ("serde", e.to_string()),
|
||||
Error::Io(e) => ("IO", e.to_string()),
|
||||
Error::ResponseError(e) => ("response", format!("status code {}", e.status)),
|
||||
};
|
||||
write!(f, "error in {}: {}", module, e)
|
||||
}
|
||||
}
|
||||
|
||||
impl <T: fmt::Debug> error::Error for Error<T> {
|
||||
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
|
||||
Some(match self {
|
||||
Error::Reqwest(e) => e,
|
||||
Error::Serde(e) => e,
|
||||
Error::Io(e) => e,
|
||||
Error::ResponseError(_) => return None,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl <T> From<reqwest::Error> for Error<T> {
|
||||
fn from(e: reqwest::Error) -> Self {
|
||||
Error::Reqwest(e)
|
||||
}
|
||||
}
|
||||
|
||||
impl <T> From<serde_json::Error> for Error<T> {
|
||||
fn from(e: serde_json::Error) -> Self {
|
||||
Error::Serde(e)
|
||||
}
|
||||
}
|
||||
|
||||
impl <T> From<std::io::Error> for Error<T> {
|
||||
fn from(e: std::io::Error) -> Self {
|
||||
Error::Io(e)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn urlencode<T: AsRef<str>>(s: T) -> String {
|
||||
::url::form_urlencoded::byte_serialize(s.as_ref().as_bytes()).collect()
|
||||
}
|
||||
|
||||
pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String, String)> {
|
||||
if let serde_json::Value::Object(object) = value {
|
||||
let mut params = vec![];
|
||||
|
||||
for (key, value) in object {
|
||||
match value {
|
||||
serde_json::Value::Object(_) => params.append(&mut parse_deep_object(
|
||||
&format!("{}[{}]", prefix, key),
|
||||
value,
|
||||
)),
|
||||
serde_json::Value::Array(array) => {
|
||||
for (i, value) in array.iter().enumerate() {
|
||||
params.append(&mut parse_deep_object(
|
||||
&format!("{}[{}][{}]", prefix, key, i),
|
||||
value,
|
||||
));
|
||||
}
|
||||
},
|
||||
serde_json::Value::String(s) => params.push((format!("{}[{}]", prefix, key), s.clone())),
|
||||
_ => params.push((format!("{}[{}]", prefix, key), value.to_string())),
|
||||
}
|
||||
}
|
||||
|
||||
return params;
|
||||
}
|
||||
|
||||
unimplemented!("Only objects are supported with style=deepObject")
|
||||
}
|
||||
|
||||
/// Internal use only
|
||||
/// A content type supported by this client.
|
||||
#[allow(dead_code)]
|
||||
enum ContentType {
|
||||
Json,
|
||||
Text,
|
||||
Unsupported(String)
|
||||
}
|
||||
|
||||
impl From<&str> for ContentType {
|
||||
fn from(content_type: &str) -> Self {
|
||||
if content_type.starts_with("application") && content_type.contains("json") {
|
||||
return Self::Json;
|
||||
} else if content_type.starts_with("text/plain") {
|
||||
return Self::Text;
|
||||
} else {
|
||||
return Self::Unsupported(content_type.to_string());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub mod default_api;
|
||||
|
||||
pub mod configuration;
|
||||
11
gamenight-api-client-rs/src/lib.rs
Normal file
11
gamenight-api-client-rs/src/lib.rs
Normal file
@@ -0,0 +1,11 @@
|
||||
#![allow(unused_imports)]
|
||||
#![allow(clippy::too_many_arguments)]
|
||||
|
||||
extern crate serde_repr;
|
||||
extern crate serde;
|
||||
extern crate serde_json;
|
||||
extern crate url;
|
||||
extern crate reqwest;
|
||||
|
||||
pub mod apis;
|
||||
pub mod models;
|
||||
@@ -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 AddGamenightRequestBody {
|
||||
#[serde(rename = "name", skip_serializing_if = "Option::is_none")]
|
||||
pub name: Option<String>,
|
||||
#[serde(rename = "datetime", skip_serializing_if = "Option::is_none")]
|
||||
pub datetime: Option<String>,
|
||||
}
|
||||
|
||||
impl AddGamenightRequestBody {
|
||||
pub fn new() -> AddGamenightRequestBody {
|
||||
AddGamenightRequestBody {
|
||||
name: None,
|
||||
datetime: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
29
gamenight-api-client-rs/src/models/failure.rs
Normal file
29
gamenight-api-client-rs/src/models/failure.rs
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* 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};
|
||||
|
||||
/// Failure : Failure Reason
|
||||
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct Failure {
|
||||
#[serde(rename = "message", skip_serializing_if = "Option::is_none")]
|
||||
pub message: Option<String>,
|
||||
}
|
||||
|
||||
impl Failure {
|
||||
/// Failure Reason
|
||||
pub fn new() -> Failure {
|
||||
Failure {
|
||||
message: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
36
gamenight-api-client-rs/src/models/gamenight.rs
Normal file
36
gamenight-api-client-rs/src/models/gamenight.rs
Normal 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 Gamenight {
|
||||
#[serde(rename = "id")]
|
||||
pub id: String,
|
||||
#[serde(rename = "name")]
|
||||
pub name: String,
|
||||
#[serde(rename = "datetime")]
|
||||
pub datetime: String,
|
||||
#[serde(rename = "owner_id")]
|
||||
pub owner_id: String,
|
||||
}
|
||||
|
||||
impl Gamenight {
|
||||
pub fn new(id: String, name: String, datetime: String, owner_id: String) -> Gamenight {
|
||||
Gamenight {
|
||||
id,
|
||||
name,
|
||||
datetime,
|
||||
owner_id,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
27
gamenight-api-client-rs/src/models/gamenight_id.rs
Normal file
27
gamenight-api-client-rs/src/models/gamenight_id.rs
Normal 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 GamenightId {
|
||||
#[serde(rename = "gamenight_id")]
|
||||
pub gamenight_id: String,
|
||||
}
|
||||
|
||||
impl GamenightId {
|
||||
pub fn new(gamenight_id: String) -> GamenightId {
|
||||
GamenightId {
|
||||
gamenight_id,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
27
gamenight-api-client-rs/src/models/get_gamenight_request.rs
Normal file
27
gamenight-api-client-rs/src/models/get_gamenight_request.rs
Normal 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 GetGamenightRequest {
|
||||
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
||||
pub id: Option<String>,
|
||||
}
|
||||
|
||||
impl GetGamenightRequest {
|
||||
pub fn new() -> GetGamenightRequest {
|
||||
GetGamenightRequest {
|
||||
id: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 GetGamenightRequestBody {
|
||||
#[serde(rename = "id", skip_serializing_if = "Option::is_none")]
|
||||
pub id: Option<String>,
|
||||
}
|
||||
|
||||
impl GetGamenightRequestBody {
|
||||
pub fn new() -> GetGamenightRequestBody {
|
||||
GetGamenightRequestBody {
|
||||
id: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
27
gamenight-api-client-rs/src/models/get_token_401_response.rs
Normal file
27
gamenight-api-client-rs/src/models/get_token_401_response.rs
Normal 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 GetToken401Response {
|
||||
#[serde(rename = "message")]
|
||||
pub message: String,
|
||||
}
|
||||
|
||||
impl GetToken401Response {
|
||||
pub fn new(message: String) -> GetToken401Response {
|
||||
GetToken401Response {
|
||||
message,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
30
gamenight-api-client-rs/src/models/login.rs
Normal file
30
gamenight-api-client-rs/src/models/login.rs
Normal file
@@ -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 Login {
|
||||
#[serde(rename = "username")]
|
||||
pub username: String,
|
||||
#[serde(rename = "password")]
|
||||
pub password: String,
|
||||
}
|
||||
|
||||
impl Login {
|
||||
pub fn new(username: String, password: String) -> Login {
|
||||
Login {
|
||||
username,
|
||||
password,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
22
gamenight-api-client-rs/src/models/mod.rs
Normal file
22
gamenight-api-client-rs/src/models/mod.rs
Normal file
@@ -0,0 +1,22 @@
|
||||
pub mod add_gamenight_request_body;
|
||||
pub use self::add_gamenight_request_body::AddGamenightRequestBody;
|
||||
pub mod failure;
|
||||
pub use self::failure::Failure;
|
||||
pub mod gamenight;
|
||||
pub use self::gamenight::Gamenight;
|
||||
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 login;
|
||||
pub use self::login::Login;
|
||||
pub mod participants;
|
||||
pub use self::participants::Participants;
|
||||
pub mod registration;
|
||||
pub use self::registration::Registration;
|
||||
pub mod token;
|
||||
pub use self::token::Token;
|
||||
pub mod user;
|
||||
pub use self::user::User;
|
||||
pub mod user_id;
|
||||
pub use self::user_id::UserId;
|
||||
27
gamenight-api-client-rs/src/models/participants.rs
Normal file
27
gamenight-api-client-rs/src/models/participants.rs
Normal 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 Participants {
|
||||
#[serde(rename = "participants")]
|
||||
pub participants: Vec<String>,
|
||||
}
|
||||
|
||||
impl Participants {
|
||||
pub fn new(participants: Vec<String>) -> Participants {
|
||||
Participants {
|
||||
participants,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
39
gamenight-api-client-rs/src/models/registration.rs
Normal file
39
gamenight-api-client-rs/src/models/registration.rs
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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 Registration {
|
||||
#[serde(rename = "username")]
|
||||
pub username: String,
|
||||
#[serde(rename = "email")]
|
||||
pub email: String,
|
||||
#[serde(rename = "password")]
|
||||
pub password: String,
|
||||
#[serde(rename = "password_repeat")]
|
||||
pub password_repeat: String,
|
||||
#[serde(rename = "registration_token")]
|
||||
pub registration_token: String,
|
||||
}
|
||||
|
||||
impl Registration {
|
||||
pub fn new(username: String, email: String, password: String, password_repeat: String, registration_token: String) -> Registration {
|
||||
Registration {
|
||||
username,
|
||||
email,
|
||||
password,
|
||||
password_repeat,
|
||||
registration_token,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
27
gamenight-api-client-rs/src/models/token.rs
Normal file
27
gamenight-api-client-rs/src/models/token.rs
Normal 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 Token {
|
||||
#[serde(rename = "jwt_token", skip_serializing_if = "Option::is_none")]
|
||||
pub jwt_token: Option<String>,
|
||||
}
|
||||
|
||||
impl Token {
|
||||
pub fn new() -> Token {
|
||||
Token {
|
||||
jwt_token: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
33
gamenight-api-client-rs/src/models/user.rs
Normal file
33
gamenight-api-client-rs/src/models/user.rs
Normal 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 User {
|
||||
#[serde(rename = "id")]
|
||||
pub id: String,
|
||||
#[serde(rename = "username")]
|
||||
pub username: String,
|
||||
#[serde(rename = "email", skip_serializing_if = "Option::is_none")]
|
||||
pub email: Option<String>,
|
||||
}
|
||||
|
||||
impl User {
|
||||
pub fn new(id: String, username: String) -> User {
|
||||
User {
|
||||
id,
|
||||
username,
|
||||
email: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
27
gamenight-api-client-rs/src/models/user_id.rs
Normal file
27
gamenight-api-client-rs/src/models/user_id.rs
Normal 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 UserId {
|
||||
#[serde(rename = "user_id")]
|
||||
pub user_id: String,
|
||||
}
|
||||
|
||||
impl UserId {
|
||||
pub fn new(user_id: String) -> UserId {
|
||||
UserId {
|
||||
user_id,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user