generate api for rust

This commit is contained in:
Quaternions 2024-12-03 19:13:29 -08:00
parent dd193e6e8f
commit 42935ce990
29 changed files with 1607 additions and 0 deletions

View File

@ -12,3 +12,8 @@
``` ```
By default, the project opens at `localhost:8080`. By default, the project opens at `localhost:8080`.
## How to generate rust api from this directory
```bash
openapi-generator-cli generate -g rust -i openapi.yaml -o validation/api`
```

3
validation/api/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/target/
**/*.rs.bk
Cargo.lock

View 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

View File

@ -0,0 +1,26 @@
.gitignore
.openapi-generator-ignore
.travis.yml
Cargo.toml
README.md
docs/Error.md
docs/Id.md
docs/Pagination.md
docs/Submission.md
docs/SubmissionCreate.md
docs/SubmissionFilter.md
docs/SubmissionsApi.md
docs/User.md
git_push.sh
src/apis/configuration.rs
src/apis/mod.rs
src/apis/submissions_api.rs
src/lib.rs
src/models/error.rs
src/models/id.rs
src/models/mod.rs
src/models/pagination.rs
src/models/submission.rs
src/models/submission_create.rs
src/models/submission_filter.rs
src/models/user.rs

View File

@ -0,0 +1 @@
7.10.0

View File

@ -0,0 +1 @@
language: rust

16
validation/api/Cargo.toml Normal file
View File

@ -0,0 +1,16 @@
[package]
name = "openapi"
version = "0.1.0"
authors = ["OpenAPI Generator team and contributors"]
description = "Browse and manage map submissions in the staging pipeline."
# Override this license by providing a License Object in the OpenAPI.
license = "Unlicense"
edition = "2021"
[dependencies]
serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0"
serde_repr = "^0.1"
url = "^2.5"
uuid = { version = "^1.8", features = ["serde", "v4"] }
reqwest = { version = "^0.12", features = ["json", "multipart"] }

64
validation/api/README.md Normal file
View File

@ -0,0 +1,64 @@
# Rust API client for openapi
Browse and manage map submissions in the staging pipeline.
## Overview
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://openapis.org) from a remote server, you can easily generate an API client.
- API version: 0.1.0
- Package version: 0.1.0
- Generator version: 7.10.0
- Build package: `org.openapitools.codegen.languages.RustClientCodegen`
## Installation
Put the package under your project folder in a directory named `openapi` and add the following to `Cargo.toml` under `[dependencies]`:
```
openapi = { path = "./openapi" }
```
## Documentation for API Endpoints
All URIs are relative to *https://submissions.strafes.net/v1*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*SubmissionsApi* | [**action_submission_publish**](docs/SubmissionsApi.md#action_submission_publish) | **PATCH** /submissions/{SubmissionID}/status/publish | Role Validator changes status from Publishing -> Published
*SubmissionsApi* | [**action_submission_reject**](docs/SubmissionsApi.md#action_submission_reject) | **PATCH** /submissions/{SubmissionID}/status/reject | Role Reviewer changes status from Submitted -> Rejected
*SubmissionsApi* | [**action_submission_request_changes**](docs/SubmissionsApi.md#action_submission_request_changes) | **PATCH** /submissions/{SubmissionID}/status/request-changes | Role Reviewer changes status from Validated|Accepted|Submitted -> ChangesRequested
*SubmissionsApi* | [**action_submission_revoke**](docs/SubmissionsApi.md#action_submission_revoke) | **PATCH** /submissions/{SubmissionID}/status/revoke | Role Submitter changes status from Submitted|ChangesRequested -> UnderConstruction
*SubmissionsApi* | [**action_submission_submit**](docs/SubmissionsApi.md#action_submission_submit) | **PATCH** /submissions/{SubmissionID}/status/submit | Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitted
*SubmissionsApi* | [**action_submission_trigger_publish**](docs/SubmissionsApi.md#action_submission_trigger_publish) | **PATCH** /submissions/{SubmissionID}/status/trigger-publish | Role Admin changes status from Validated -> Publishing
*SubmissionsApi* | [**action_submission_trigger_validate**](docs/SubmissionsApi.md#action_submission_trigger_validate) | **PATCH** /submissions/{SubmissionID}/status/trigger-validate | Role Reviewer triggers validation and changes status from Submitted|Accepted -> Validating
*SubmissionsApi* | [**action_submission_validate**](docs/SubmissionsApi.md#action_submission_validate) | **PATCH** /submissions/{SubmissionID}/status/validate | Role Validator changes status from Validating -> Validated
*SubmissionsApi* | [**create_submission**](docs/SubmissionsApi.md#create_submission) | **POST** /submissions | Create new submission
*SubmissionsApi* | [**get_submission**](docs/SubmissionsApi.md#get_submission) | **GET** /submissions/{SubmissionID} | Retrieve map with ID
*SubmissionsApi* | [**list_submissions**](docs/SubmissionsApi.md#list_submissions) | **GET** /submissions | Get list of submissions
*SubmissionsApi* | [**patch_submission_completed**](docs/SubmissionsApi.md#patch_submission_completed) | **PATCH** /submissions/{SubmissionID}/completed | Retrieve map with ID
*SubmissionsApi* | [**patch_submission_model**](docs/SubmissionsApi.md#patch_submission_model) | **PATCH** /submissions/{SubmissionID}/model | Update model following role restrictions
## Documentation For Models
- [Error](docs/Error.md)
- [Id](docs/Id.md)
- [Pagination](docs/Pagination.md)
- [Submission](docs/Submission.md)
- [SubmissionCreate](docs/SubmissionCreate.md)
- [SubmissionFilter](docs/SubmissionFilter.md)
- [User](docs/User.md)
To get access to the crate's generated documentation, use:
```
cargo doc --open
```
## Author

View File

@ -0,0 +1,12 @@
# Error
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**code** | **i64** | |
**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)

11
validation/api/docs/Id.md Normal file
View File

@ -0,0 +1,11 @@
# Id
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | Option<**i64**> | | [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,12 @@
# Pagination
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**page** | **i32** | |
**limit** | **i32** | |
[[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,22 @@
# Submission
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | Option<**i64**> | | [optional]
**display_name** | Option<**String**> | | [optional]
**creator** | Option<**String**> | | [optional]
**game_id** | Option<**i32**> | | [optional]
**date** | Option<**i64**> | | [optional]
**submitter** | Option<**i64**> | | [optional]
**asset_id** | Option<**i64**> | | [optional]
**asset_version** | Option<**i64**> | | [optional]
**completed** | Option<**bool**> | | [optional]
**submission_type** | Option<**i32**> | | [optional]
**target_asset_id** | Option<**i64**> | | [optional]
**status_id** | Option<**i32**> | | [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,18 @@
# SubmissionCreate
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**display_name** | Option<**String**> | | [optional]
**creator** | Option<**String**> | | [optional]
**game_id** | Option<**i32**> | | [optional]
**submitter** | Option<**i64**> | | [optional]
**asset_id** | Option<**i64**> | | [optional]
**asset_version** | Option<**i64**> | | [optional]
**submission_type** | Option<**i32**> | | [optional]
**target_asset_id** | Option<**i64**> | | [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,15 @@
# SubmissionFilter
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | Option<**i64**> | | [optional]
**display_name** | Option<**String**> | | [optional]
**creator** | Option<**String**> | | [optional]
**game_id** | Option<**i32**> | | [optional]
**date** | Option<**i64**> | | [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,388 @@
# \SubmissionsApi
All URIs are relative to *https://submissions.strafes.net/v1*
Method | HTTP request | Description
------------- | ------------- | -------------
[**action_submission_publish**](SubmissionsApi.md#action_submission_publish) | **PATCH** /submissions/{SubmissionID}/status/publish | Role Validator changes status from Publishing -> Published
[**action_submission_reject**](SubmissionsApi.md#action_submission_reject) | **PATCH** /submissions/{SubmissionID}/status/reject | Role Reviewer changes status from Submitted -> Rejected
[**action_submission_request_changes**](SubmissionsApi.md#action_submission_request_changes) | **PATCH** /submissions/{SubmissionID}/status/request-changes | Role Reviewer changes status from Validated|Accepted|Submitted -> ChangesRequested
[**action_submission_revoke**](SubmissionsApi.md#action_submission_revoke) | **PATCH** /submissions/{SubmissionID}/status/revoke | Role Submitter changes status from Submitted|ChangesRequested -> UnderConstruction
[**action_submission_submit**](SubmissionsApi.md#action_submission_submit) | **PATCH** /submissions/{SubmissionID}/status/submit | Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitted
[**action_submission_trigger_publish**](SubmissionsApi.md#action_submission_trigger_publish) | **PATCH** /submissions/{SubmissionID}/status/trigger-publish | Role Admin changes status from Validated -> Publishing
[**action_submission_trigger_validate**](SubmissionsApi.md#action_submission_trigger_validate) | **PATCH** /submissions/{SubmissionID}/status/trigger-validate | Role Reviewer triggers validation and changes status from Submitted|Accepted -> Validating
[**action_submission_validate**](SubmissionsApi.md#action_submission_validate) | **PATCH** /submissions/{SubmissionID}/status/validate | Role Validator changes status from Validating -> Validated
[**create_submission**](SubmissionsApi.md#create_submission) | **POST** /submissions | Create new submission
[**get_submission**](SubmissionsApi.md#get_submission) | **GET** /submissions/{SubmissionID} | Retrieve map with ID
[**list_submissions**](SubmissionsApi.md#list_submissions) | **GET** /submissions | Get list of submissions
[**patch_submission_completed**](SubmissionsApi.md#patch_submission_completed) | **PATCH** /submissions/{SubmissionID}/completed | Retrieve map with ID
[**patch_submission_model**](SubmissionsApi.md#patch_submission_model) | **PATCH** /submissions/{SubmissionID}/model | Update model following role restrictions
## action_submission_publish
> action_submission_publish(submission_id)
Role Validator changes status from Publishing -> Published
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**submission_id** | **i64** | | [required] |
### Return type
(empty response body)
### Authorization
[cookieAuth](../README.md#cookieAuth)
### 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)
## action_submission_reject
> action_submission_reject(submission_id)
Role Reviewer changes status from Submitted -> Rejected
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**submission_id** | **i64** | | [required] |
### Return type
(empty response body)
### Authorization
[cookieAuth](../README.md#cookieAuth)
### 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)
## action_submission_request_changes
> action_submission_request_changes(submission_id)
Role Reviewer changes status from Validated|Accepted|Submitted -> ChangesRequested
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**submission_id** | **i64** | | [required] |
### Return type
(empty response body)
### Authorization
[cookieAuth](../README.md#cookieAuth)
### 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)
## action_submission_revoke
> action_submission_revoke(submission_id)
Role Submitter changes status from Submitted|ChangesRequested -> UnderConstruction
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**submission_id** | **i64** | | [required] |
### Return type
(empty response body)
### Authorization
[cookieAuth](../README.md#cookieAuth)
### 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)
## action_submission_submit
> action_submission_submit(submission_id)
Role Submitter changes status from UnderConstruction|ChangesRequested -> Submitted
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**submission_id** | **i64** | | [required] |
### Return type
(empty response body)
### Authorization
[cookieAuth](../README.md#cookieAuth)
### 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)
## action_submission_trigger_publish
> action_submission_trigger_publish(submission_id)
Role Admin changes status from Validated -> Publishing
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**submission_id** | **i64** | | [required] |
### Return type
(empty response body)
### Authorization
[cookieAuth](../README.md#cookieAuth)
### 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)
## action_submission_trigger_validate
> action_submission_trigger_validate(submission_id)
Role Reviewer triggers validation and changes status from Submitted|Accepted -> Validating
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**submission_id** | **i64** | | [required] |
### Return type
(empty response body)
### Authorization
[cookieAuth](../README.md#cookieAuth)
### 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)
## action_submission_validate
> action_submission_validate(submission_id)
Role Validator changes status from Validating -> Validated
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**submission_id** | **i64** | | [required] |
### Return type
(empty response body)
### Authorization
[cookieAuth](../README.md#cookieAuth)
### 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)
## create_submission
> models::Id create_submission(submission_create)
Create new submission
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**submission_create** | Option<[**SubmissionCreate**](SubmissionCreate.md)> | | |
### Return type
[**models::Id**](Id.md)
### Authorization
[cookieAuth](../README.md#cookieAuth)
### 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_submission
> models::Submission get_submission(submission_id)
Retrieve map with ID
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**submission_id** | **i64** | | [required] |
### Return type
[**models::Submission**](Submission.md)
### Authorization
[cookieAuth](../README.md#cookieAuth)
### 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)
## list_submissions
> Vec<models::Submission> list_submissions(page, filter)
Get list of submissions
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**page** | [**Pagination**](.md) | | [required] |
**filter** | Option<[**SubmissionFilter**](.md)> | | |
### Return type
[**Vec<models::Submission>**](Submission.md)
### Authorization
[cookieAuth](../README.md#cookieAuth)
### 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)
## patch_submission_completed
> patch_submission_completed(submission_id)
Retrieve map with ID
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**submission_id** | **i64** | | [required] |
### Return type
(empty response body)
### Authorization
[cookieAuth](../README.md#cookieAuth)
### 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)
## patch_submission_model
> patch_submission_model(submission_id, model_id, version_id)
Update model following role restrictions
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**submission_id** | **i64** | | [required] |
**model_id** | **i64** | | [required] |
**version_id** | **i64** | | [required] |
### Return type
(empty response body)
### Authorization
[cookieAuth](../README.md#cookieAuth)
### 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,13 @@
# User
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | Option<**i64**> | | [optional]
**username** | Option<**String**> | | [optional]
**state_id** | Option<**i32**> | | [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,57 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
git_user_id=$1
git_repo_id=$2
release_note=$3
git_host=$4
if [ "$git_host" = "" ]; then
git_host="github.com"
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
fi
if [ "$git_user_id" = "" ]; then
git_user_id="GIT_USER_ID"
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
fi
if [ "$git_repo_id" = "" ]; then
git_repo_id="GIT_REPO_ID"
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
fi
if [ "$release_note" = "" ]; then
release_note="Minor update"
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
fi
# Initialize the local directory as a Git repository
git init
# Adds the files in the local repository and stages them for commit.
git add .
# Commits the tracked changes and prepares them to be pushed to a remote repository.
git commit -m "$release_note"
# Sets the new remote
git_remote=$(git remote)
if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
fi
fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'

View File

@ -0,0 +1,51 @@
/*
* StrafesNET Submissions - OpenAPI 3.1
*
* Browse and manage map submissions in the staging pipeline.
*
* The version of the OpenAPI document: 0.1.0
*
* 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: "https://submissions.strafes.net/v1".to_owned(),
user_agent: Some("OpenAPI-Generator/0.1.0/rust".to_owned()),
client: reqwest::Client::new(),
basic_auth: None,
oauth_access_token: None,
bearer_access_token: None,
api_key: None,
}
}
}

View File

@ -0,0 +1,95 @@
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")
}
pub mod submissions_api;
pub mod configuration;

View File

@ -0,0 +1,480 @@
/*
* StrafesNET Submissions - OpenAPI 3.1
*
* Browse and manage map submissions in the staging pipeline.
*
* The version of the OpenAPI document: 0.1.0
*
* Generated by: https://openapi-generator.tech
*/
use reqwest;
use serde::{Deserialize, Serialize};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration};
/// struct for typed errors of method [`action_submission_publish`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ActionSubmissionPublishError {
DefaultResponse(models::Error),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`action_submission_reject`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ActionSubmissionRejectError {
DefaultResponse(models::Error),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`action_submission_request_changes`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ActionSubmissionRequestChangesError {
DefaultResponse(models::Error),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`action_submission_revoke`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ActionSubmissionRevokeError {
DefaultResponse(models::Error),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`action_submission_submit`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ActionSubmissionSubmitError {
DefaultResponse(models::Error),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`action_submission_trigger_publish`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ActionSubmissionTriggerPublishError {
DefaultResponse(models::Error),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`action_submission_trigger_validate`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ActionSubmissionTriggerValidateError {
DefaultResponse(models::Error),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`action_submission_validate`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ActionSubmissionValidateError {
DefaultResponse(models::Error),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_submission`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateSubmissionError {
DefaultResponse(models::Error),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_submission`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetSubmissionError {
DefaultResponse(models::Error),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`list_submissions`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListSubmissionsError {
DefaultResponse(models::Error),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`patch_submission_completed`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PatchSubmissionCompletedError {
DefaultResponse(models::Error),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`patch_submission_model`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PatchSubmissionModelError {
DefaultResponse(models::Error),
UnknownValue(serde_json::Value),
}
pub async fn action_submission_publish(configuration: &configuration::Configuration, submission_id: i64) -> Result<(), Error<ActionSubmissionPublishError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/submissions/{SubmissionID}/status/publish", local_var_configuration.base_path, SubmissionID=submission_id);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(())
} else {
let local_var_entity: Option<ActionSubmissionPublishError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
pub async fn action_submission_reject(configuration: &configuration::Configuration, submission_id: i64) -> Result<(), Error<ActionSubmissionRejectError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/submissions/{SubmissionID}/status/reject", local_var_configuration.base_path, SubmissionID=submission_id);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(())
} else {
let local_var_entity: Option<ActionSubmissionRejectError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
pub async fn action_submission_request_changes(configuration: &configuration::Configuration, submission_id: i64) -> Result<(), Error<ActionSubmissionRequestChangesError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/submissions/{SubmissionID}/status/request-changes", local_var_configuration.base_path, SubmissionID=submission_id);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(())
} else {
let local_var_entity: Option<ActionSubmissionRequestChangesError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
pub async fn action_submission_revoke(configuration: &configuration::Configuration, submission_id: i64) -> Result<(), Error<ActionSubmissionRevokeError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/submissions/{SubmissionID}/status/revoke", local_var_configuration.base_path, SubmissionID=submission_id);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(())
} else {
let local_var_entity: Option<ActionSubmissionRevokeError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
pub async fn action_submission_submit(configuration: &configuration::Configuration, submission_id: i64) -> Result<(), Error<ActionSubmissionSubmitError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/submissions/{SubmissionID}/status/submit", local_var_configuration.base_path, SubmissionID=submission_id);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(())
} else {
let local_var_entity: Option<ActionSubmissionSubmitError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
pub async fn action_submission_trigger_publish(configuration: &configuration::Configuration, submission_id: i64) -> Result<(), Error<ActionSubmissionTriggerPublishError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/submissions/{SubmissionID}/status/trigger-publish", local_var_configuration.base_path, SubmissionID=submission_id);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(())
} else {
let local_var_entity: Option<ActionSubmissionTriggerPublishError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
pub async fn action_submission_trigger_validate(configuration: &configuration::Configuration, submission_id: i64) -> Result<(), Error<ActionSubmissionTriggerValidateError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/submissions/{SubmissionID}/status/trigger-validate", local_var_configuration.base_path, SubmissionID=submission_id);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(())
} else {
let local_var_entity: Option<ActionSubmissionTriggerValidateError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
pub async fn action_submission_validate(configuration: &configuration::Configuration, submission_id: i64) -> Result<(), Error<ActionSubmissionValidateError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/submissions/{SubmissionID}/status/validate", local_var_configuration.base_path, SubmissionID=submission_id);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(())
} else {
let local_var_entity: Option<ActionSubmissionValidateError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
pub async fn create_submission(configuration: &configuration::Configuration, submission_create: Option<models::SubmissionCreate>) -> Result<models::Id, Error<CreateSubmissionError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/submissions", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
local_var_req_builder = local_var_req_builder.json(&submission_create);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<CreateSubmissionError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
pub async fn get_submission(configuration: &configuration::Configuration, submission_id: i64) -> Result<models::Submission, Error<GetSubmissionError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/submissions/{SubmissionID}", local_var_configuration.base_path, SubmissionID=submission_id);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetSubmissionError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
pub async fn list_submissions(configuration: &configuration::Configuration, page: models::Pagination, filter: Option<models::SubmissionFilter>) -> Result<Vec<models::Submission>, Error<ListSubmissionsError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/submissions", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("page", &page.to_string())]);
if let Some(ref local_var_str) = filter {
local_var_req_builder = local_var_req_builder.query(&[("filter", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<ListSubmissionsError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
pub async fn patch_submission_completed(configuration: &configuration::Configuration, submission_id: i64) -> Result<(), Error<PatchSubmissionCompletedError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/submissions/{SubmissionID}/completed", local_var_configuration.base_path, SubmissionID=submission_id);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(())
} else {
let local_var_entity: Option<PatchSubmissionCompletedError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
pub async fn patch_submission_model(configuration: &configuration::Configuration, submission_id: i64, model_id: i64, version_id: i64) -> Result<(), Error<PatchSubmissionModelError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/submissions/{SubmissionID}/model", local_var_configuration.base_path, SubmissionID=submission_id);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("ModelID", &model_id.to_string())]);
local_var_req_builder = local_var_req_builder.query(&[("VersionID", &version_id.to_string())]);
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(())
} else {
let local_var_entity: Option<PatchSubmissionModelError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}

11
validation/api/src/lib.rs Normal file
View 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;

View File

@ -0,0 +1,32 @@
/*
* StrafesNET Submissions - OpenAPI 3.1
*
* Browse and manage map submissions in the staging pipeline.
*
* The version of the OpenAPI document: 0.1.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// Error : Represents error object
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Error {
#[serde(rename = "code")]
pub code: i64,
#[serde(rename = "message")]
pub message: String,
}
impl Error {
/// Represents error object
pub fn new(code: i64, message: String) -> Error {
Error {
code,
message,
}
}
}

View File

@ -0,0 +1,27 @@
/*
* StrafesNET Submissions - OpenAPI 3.1
*
* Browse and manage map submissions in the staging pipeline.
*
* The version of the OpenAPI document: 0.1.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Id {
#[serde(rename = "ID", skip_serializing_if = "Option::is_none")]
pub id: Option<i64>,
}
impl Id {
pub fn new() -> Id {
Id {
id: None,
}
}
}

View File

@ -0,0 +1,14 @@
pub mod error;
pub use self::error::Error;
pub mod id;
pub use self::id::Id;
pub mod pagination;
pub use self::pagination::Pagination;
pub mod submission;
pub use self::submission::Submission;
pub mod submission_create;
pub use self::submission_create::SubmissionCreate;
pub mod submission_filter;
pub use self::submission_filter::SubmissionFilter;
pub mod user;
pub use self::user::User;

View File

@ -0,0 +1,30 @@
/*
* StrafesNET Submissions - OpenAPI 3.1
*
* Browse and manage map submissions in the staging pipeline.
*
* The version of the OpenAPI document: 0.1.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Pagination {
#[serde(rename = "Page")]
pub page: i32,
#[serde(rename = "Limit")]
pub limit: i32,
}
impl Pagination {
pub fn new(page: i32, limit: i32) -> Pagination {
Pagination {
page,
limit,
}
}
}

View File

@ -0,0 +1,60 @@
/*
* StrafesNET Submissions - OpenAPI 3.1
*
* Browse and manage map submissions in the staging pipeline.
*
* The version of the OpenAPI document: 0.1.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Submission {
#[serde(rename = "ID", skip_serializing_if = "Option::is_none")]
pub id: Option<i64>,
#[serde(rename = "DisplayName", skip_serializing_if = "Option::is_none")]
pub display_name: Option<String>,
#[serde(rename = "Creator", skip_serializing_if = "Option::is_none")]
pub creator: Option<String>,
#[serde(rename = "GameID", skip_serializing_if = "Option::is_none")]
pub game_id: Option<i32>,
#[serde(rename = "Date", skip_serializing_if = "Option::is_none")]
pub date: Option<i64>,
#[serde(rename = "Submitter", skip_serializing_if = "Option::is_none")]
pub submitter: Option<i64>,
#[serde(rename = "AssetID", skip_serializing_if = "Option::is_none")]
pub asset_id: Option<i64>,
#[serde(rename = "AssetVersion", skip_serializing_if = "Option::is_none")]
pub asset_version: Option<i64>,
#[serde(rename = "Completed", skip_serializing_if = "Option::is_none")]
pub completed: Option<bool>,
#[serde(rename = "SubmissionType", skip_serializing_if = "Option::is_none")]
pub submission_type: Option<i32>,
#[serde(rename = "TargetAssetID", skip_serializing_if = "Option::is_none")]
pub target_asset_id: Option<i64>,
#[serde(rename = "StatusID", skip_serializing_if = "Option::is_none")]
pub status_id: Option<i32>,
}
impl Submission {
pub fn new() -> Submission {
Submission {
id: None,
display_name: None,
creator: None,
game_id: None,
date: None,
submitter: None,
asset_id: None,
asset_version: None,
completed: None,
submission_type: None,
target_asset_id: None,
status_id: None,
}
}
}

View File

@ -0,0 +1,48 @@
/*
* StrafesNET Submissions - OpenAPI 3.1
*
* Browse and manage map submissions in the staging pipeline.
*
* The version of the OpenAPI document: 0.1.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct SubmissionCreate {
#[serde(rename = "DisplayName", skip_serializing_if = "Option::is_none")]
pub display_name: Option<String>,
#[serde(rename = "Creator", skip_serializing_if = "Option::is_none")]
pub creator: Option<String>,
#[serde(rename = "GameID", skip_serializing_if = "Option::is_none")]
pub game_id: Option<i32>,
#[serde(rename = "Submitter", skip_serializing_if = "Option::is_none")]
pub submitter: Option<i64>,
#[serde(rename = "AssetID", skip_serializing_if = "Option::is_none")]
pub asset_id: Option<i64>,
#[serde(rename = "AssetVersion", skip_serializing_if = "Option::is_none")]
pub asset_version: Option<i64>,
#[serde(rename = "SubmissionType", skip_serializing_if = "Option::is_none")]
pub submission_type: Option<i32>,
#[serde(rename = "TargetAssetID", skip_serializing_if = "Option::is_none")]
pub target_asset_id: Option<i64>,
}
impl SubmissionCreate {
pub fn new() -> SubmissionCreate {
SubmissionCreate {
display_name: None,
creator: None,
game_id: None,
submitter: None,
asset_id: None,
asset_version: None,
submission_type: None,
target_asset_id: None,
}
}
}

View File

@ -0,0 +1,39 @@
/*
* StrafesNET Submissions - OpenAPI 3.1
*
* Browse and manage map submissions in the staging pipeline.
*
* The version of the OpenAPI document: 0.1.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct SubmissionFilter {
#[serde(rename = "ID", skip_serializing_if = "Option::is_none")]
pub id: Option<i64>,
#[serde(rename = "DisplayName", skip_serializing_if = "Option::is_none")]
pub display_name: Option<String>,
#[serde(rename = "Creator", skip_serializing_if = "Option::is_none")]
pub creator: Option<String>,
#[serde(rename = "GameID", skip_serializing_if = "Option::is_none")]
pub game_id: Option<i32>,
#[serde(rename = "Date", skip_serializing_if = "Option::is_none")]
pub date: Option<i64>,
}
impl SubmissionFilter {
pub fn new() -> SubmissionFilter {
SubmissionFilter {
id: None,
display_name: None,
creator: None,
game_id: None,
date: None,
}
}
}

View File

@ -0,0 +1,33 @@
/*
* StrafesNET Submissions - OpenAPI 3.1
*
* Browse and manage map submissions in the staging pipeline.
*
* The version of the OpenAPI document: 0.1.0
*
* 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", skip_serializing_if = "Option::is_none")]
pub id: Option<i64>,
#[serde(rename = "Username", skip_serializing_if = "Option::is_none")]
pub username: Option<String>,
#[serde(rename = "StateID", skip_serializing_if = "Option::is_none")]
pub state_id: Option<i32>,
}
impl User {
pub fn new() -> User {
User {
id: None,
username: None,
state_id: None,
}
}
}