forked from loafle/openapi-generator-original
[rust]: Remove unmaintained samples and specs (#13193)
* [rust]: Remove unmaintained samples and specs * Fix checks * move test file * Fix test file
This commit is contained in:
parent
ed3666fbde
commit
6d82ac0806
@ -1,7 +1,7 @@
|
||||
generatorName: rust
|
||||
outputDir: samples/client/petstore/rust/reqwest/petstore-async
|
||||
library: reqwest
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/rust/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/rust
|
||||
additionalProperties:
|
||||
supportAsync: true
|
||||
|
@ -1,7 +1,7 @@
|
||||
generatorName: rust
|
||||
outputDir: samples/client/petstore/rust/reqwest/petstore-awsv4signature
|
||||
library: reqwest
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/petstore.yaml
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/rust/petstore.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/rust
|
||||
additionalProperties:
|
||||
supportAsync: false
|
||||
|
@ -1,9 +0,0 @@
|
||||
generatorName: rust
|
||||
outputDir: samples/client/petstore/rust/hyper/fileResponseTest
|
||||
library: hyper
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/fileResponseTest.json
|
||||
templateDir: modules/openapi-generator/src/main/resources/rust
|
||||
generateAliasAsModel: true
|
||||
additionalProperties:
|
||||
supportAsync: "false"
|
||||
packageName: fileResponseTest-hyper
|
@ -1,8 +0,0 @@
|
||||
generatorName: rust
|
||||
outputDir: samples/client/petstore/rust/hyper/rust-test
|
||||
library: hyper
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/rust/rust-test.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/rust
|
||||
additionalProperties:
|
||||
supportAsync: "false"
|
||||
packageName: rust-test-hyper
|
@ -1,8 +0,0 @@
|
||||
generatorName: rust
|
||||
outputDir: samples/client/petstore/rust/reqwest/fileResponseTest
|
||||
library: reqwest
|
||||
inputSpec: modules/openapi-generator/src/test/resources/2_0/fileResponseTest.json
|
||||
templateDir: modules/openapi-generator/src/main/resources/rust
|
||||
additionalProperties:
|
||||
supportAsync: "false"
|
||||
packageName: fileResponseTest-reqwest
|
@ -1,8 +0,0 @@
|
||||
generatorName: rust
|
||||
outputDir: samples/client/petstore/rust/reqwest/rust-test
|
||||
library: reqwest
|
||||
inputSpec: modules/openapi-generator/src/test/resources/3_0/rust/rust-test.yaml
|
||||
templateDir: modules/openapi-generator/src/main/resources/rust
|
||||
additionalProperties:
|
||||
supportAsync: "false"
|
||||
packageName: rust-test-reqwest
|
@ -1,33 +0,0 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"version": "1.0.0",
|
||||
"title": "File Response Test",
|
||||
"license": {
|
||||
"name": "Apache-2.0",
|
||||
"url": "https://www.apache.org/licenses/LICENSE-2.0.html"
|
||||
}
|
||||
},
|
||||
"basePath": "/v2",
|
||||
"schemes": [
|
||||
"http"
|
||||
],
|
||||
"paths": {
|
||||
"/tests/fileResponse": {
|
||||
"get": {
|
||||
"operationId": "fileresponsetest",
|
||||
"produces": [
|
||||
"application/octet-stream"
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OutputFileData",
|
||||
"schema": {
|
||||
"type": "file"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -599,6 +599,31 @@ paths:
|
||||
description: Invalid username supplied
|
||||
'404':
|
||||
description: User not found
|
||||
'/tests/fileResponse':
|
||||
get:
|
||||
tags:
|
||||
- testing
|
||||
summary: Returns an image file
|
||||
responses:
|
||||
'200':
|
||||
description: An image file
|
||||
content:
|
||||
image/jpeg:
|
||||
schema:
|
||||
type: string
|
||||
format: binary
|
||||
'/tests/typeTesting':
|
||||
get:
|
||||
tags:
|
||||
- testing
|
||||
summary: Route to test the TypeTesting schema
|
||||
responses:
|
||||
'200':
|
||||
description: The TypeTesting response
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/TypeTesting'
|
||||
externalDocs:
|
||||
description: Find out more about Swagger
|
||||
url: 'http://swagger.io'
|
||||
@ -791,3 +816,34 @@ components:
|
||||
- A
|
||||
- B
|
||||
type: string
|
||||
TypeTesting:
|
||||
description: Test handling of different field data types
|
||||
type: object
|
||||
required:
|
||||
- int32
|
||||
- int64
|
||||
- float
|
||||
- double
|
||||
- string
|
||||
- boolean
|
||||
- uuid
|
||||
properties:
|
||||
int32:
|
||||
type: integer
|
||||
format: int32
|
||||
int64:
|
||||
type: integer
|
||||
format: int64
|
||||
float:
|
||||
type: number
|
||||
format: float
|
||||
double:
|
||||
type: number
|
||||
format: double
|
||||
string:
|
||||
type: string
|
||||
boolean:
|
||||
type: boolean
|
||||
uuid:
|
||||
type: string
|
||||
format: uuid
|
||||
|
@ -1,31 +0,0 @@
|
||||
openapi: 3.0.1
|
||||
info:
|
||||
title: Rust client test spec
|
||||
description: Special testing for the Rust client generator
|
||||
version: 1.0.7
|
||||
paths:
|
||||
/dummy:
|
||||
get:
|
||||
summary: A dummy endpoint to make the spec valid.
|
||||
responses:
|
||||
'200':
|
||||
description: Success
|
||||
components:
|
||||
schemas:
|
||||
TypeTesting:
|
||||
description: Test handling of differing types (see \#3463)
|
||||
type: object
|
||||
properties:
|
||||
integer:
|
||||
type: integer
|
||||
long:
|
||||
type: long
|
||||
number:
|
||||
type: number
|
||||
float:
|
||||
type: float
|
||||
double:
|
||||
type: double
|
||||
uuid:
|
||||
type: string
|
||||
format: uuid
|
@ -1,3 +0,0 @@
|
||||
/target/
|
||||
**/*.rs.bk
|
||||
Cargo.lock
|
@ -1,23 +0,0 @@
|
||||
# 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
|
@ -1,13 +0,0 @@
|
||||
.gitignore
|
||||
.travis.yml
|
||||
Cargo.toml
|
||||
README.md
|
||||
docs/DefaultApi.md
|
||||
git_push.sh
|
||||
src/apis/client.rs
|
||||
src/apis/configuration.rs
|
||||
src/apis/default_api.rs
|
||||
src/apis/mod.rs
|
||||
src/apis/request.rs
|
||||
src/lib.rs
|
||||
src/models/mod.rs
|
@ -1 +0,0 @@
|
||||
5.0.0-SNAPSHOT
|
@ -1 +0,0 @@
|
||||
language: rust
|
@ -1,18 +0,0 @@
|
||||
[package]
|
||||
name = "fileResponseTest-hyper"
|
||||
version = "1.0.0"
|
||||
authors = ["OpenAPI Generator team and contributors"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
serde = "^1.0"
|
||||
serde_derive = "^1.0"
|
||||
serde_json = "^1.0"
|
||||
url = "1.5"
|
||||
hyper = "~0.11"
|
||||
serde_yaml = "0.7"
|
||||
base64 = "~0.7.0"
|
||||
futures = "0.1.23"
|
||||
|
||||
[dev-dependencies]
|
||||
tokio-core = "*"
|
@ -1,43 +0,0 @@
|
||||
# Rust API client for fileResponseTest-hyper
|
||||
|
||||
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
|
||||
## 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: 1.0.0
|
||||
- Package version: 1.0.0
|
||||
- Build package: org.openapitools.codegen.languages.RustClientCodegen
|
||||
|
||||
## Installation
|
||||
|
||||
Put the package under your project folder and add the following to `Cargo.toml` under `[dependencies]`:
|
||||
|
||||
```
|
||||
openapi = { path = "./generated" }
|
||||
```
|
||||
|
||||
## Documentation for API Endpoints
|
||||
|
||||
All URIs are relative to *http://localhost/v2*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*DefaultApi* | [**fileresponsetest**](docs/DefaultApi.md#fileresponsetest) | **Get** /tests/fileResponse |
|
||||
|
||||
|
||||
## Documentation For Models
|
||||
|
||||
|
||||
|
||||
To get access to the crate's generated documentation, use:
|
||||
|
||||
```
|
||||
cargo doc --open
|
||||
```
|
||||
|
||||
## Author
|
||||
|
||||
|
||||
|
@ -1,34 +0,0 @@
|
||||
# \DefaultApi
|
||||
|
||||
All URIs are relative to *http://localhost/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**fileresponsetest**](DefaultApi.md#fileresponsetest) | **Get** /tests/fileResponse |
|
||||
|
||||
|
||||
|
||||
## fileresponsetest
|
||||
|
||||
> std::path::PathBuf fileresponsetest()
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
[**std::path::PathBuf**](std::path::PathBuf.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/octet-stream
|
||||
|
||||
[[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)
|
||||
|
@ -1,58 +0,0 @@
|
||||
#!/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-pestore-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'
|
||||
|
@ -1,23 +0,0 @@
|
||||
use std::rc::Rc;
|
||||
|
||||
use hyper;
|
||||
use super::configuration::Configuration;
|
||||
|
||||
pub struct APIClient {
|
||||
default_api: Box<dyn crate::apis::DefaultApi>,
|
||||
}
|
||||
|
||||
impl APIClient {
|
||||
pub fn new<C: hyper::client::Connect>(configuration: Configuration<C>) -> APIClient {
|
||||
let rc = Rc::new(configuration);
|
||||
|
||||
APIClient {
|
||||
default_api: Box::new(crate::apis::DefaultApiClient::new(rc.clone())),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn default_api(&self) -> &dyn crate::apis::DefaultApi{
|
||||
self.default_api.as_ref()
|
||||
}
|
||||
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
/*
|
||||
* File Response Test
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use hyper;
|
||||
|
||||
pub struct Configuration<C: hyper::client::Connect> {
|
||||
pub base_path: String,
|
||||
pub user_agent: Option<String>,
|
||||
pub client: hyper::client::Client<C>,
|
||||
pub basic_auth: Option<BasicAuth>,
|
||||
pub oauth_access_token: Option<String>,
|
||||
pub api_key: Option<ApiKey>,
|
||||
// TODO: take an oauth2 token source, similar to the go one
|
||||
}
|
||||
|
||||
pub type BasicAuth = (String, Option<String>);
|
||||
|
||||
pub struct ApiKey {
|
||||
pub prefix: Option<String>,
|
||||
pub key: String,
|
||||
}
|
||||
|
||||
impl<C: hyper::client::Connect> Configuration<C> {
|
||||
pub fn new(client: hyper::client::Client<C>) -> Configuration<C> {
|
||||
Configuration {
|
||||
base_path: "http://localhost/v2".to_owned(),
|
||||
user_agent: Some("OpenAPI-Generator/1.0.0/rust".to_owned()),
|
||||
client: client,
|
||||
basic_auth: None,
|
||||
oauth_access_token: None,
|
||||
api_key: None,
|
||||
}
|
||||
}
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
/*
|
||||
* File Response Test
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use std::rc::Rc;
|
||||
use std::borrow::Borrow;
|
||||
#[allow(unused_imports)]
|
||||
use std::option::Option;
|
||||
|
||||
use hyper;
|
||||
use serde_json;
|
||||
use futures::Future;
|
||||
|
||||
use super::{Error, configuration};
|
||||
use super::request as __internal_request;
|
||||
|
||||
pub struct DefaultApiClient<C: hyper::client::Connect> {
|
||||
configuration: Rc<configuration::Configuration<C>>,
|
||||
}
|
||||
|
||||
impl<C: hyper::client::Connect> DefaultApiClient<C> {
|
||||
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> DefaultApiClient<C> {
|
||||
DefaultApiClient {
|
||||
configuration,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub trait DefaultApi {
|
||||
fn fileresponsetest(&self, ) -> Box<dyn Future<Item = std::path::PathBuf, Error = Error<serde_json::Value>>>;
|
||||
}
|
||||
|
||||
impl<C: hyper::client::Connect>DefaultApi for DefaultApiClient<C> {
|
||||
fn fileresponsetest(&self, ) -> Box<dyn Future<Item = std::path::PathBuf, Error = Error<serde_json::Value>>> {
|
||||
let mut req = __internal_request::Request::new(hyper::Method::Get, "/tests/fileResponse".to_string())
|
||||
;
|
||||
|
||||
req.execute(self.configuration.borrow())
|
||||
}
|
||||
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
use hyper;
|
||||
use serde;
|
||||
use serde_json;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Error<T> {
|
||||
UriError(hyper::error::UriError),
|
||||
Hyper(hyper::Error),
|
||||
Serde(serde_json::Error),
|
||||
ApiError(ApiError<T>),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ApiError<T> {
|
||||
pub code: hyper::StatusCode,
|
||||
pub content: Option<T>,
|
||||
}
|
||||
|
||||
impl<'de, T> From<(hyper::StatusCode, &'de [u8])> for Error<T>
|
||||
where T: serde::Deserialize<'de> {
|
||||
fn from(e: (hyper::StatusCode, &'de [u8])) -> Self {
|
||||
if e.1.len() == 0 {
|
||||
return Error::ApiError(ApiError{
|
||||
code: e.0,
|
||||
content: None,
|
||||
});
|
||||
}
|
||||
match serde_json::from_slice::<T>(e.1) {
|
||||
Ok(t) => Error::ApiError(ApiError{
|
||||
code: e.0,
|
||||
content: Some(t),
|
||||
}),
|
||||
Err(e) => {
|
||||
Error::from(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> From<hyper::Error> for Error<T> {
|
||||
fn from(e: hyper::Error) -> Self {
|
||||
return Error::Hyper(e)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> From<serde_json::Error> for Error<T> {
|
||||
fn from(e: serde_json::Error) -> Self {
|
||||
return Error::Serde(e)
|
||||
}
|
||||
}
|
||||
|
||||
mod request;
|
||||
|
||||
mod default_api;
|
||||
pub use self::default_api::{ DefaultApi, DefaultApiClient };
|
||||
|
||||
pub mod configuration;
|
||||
pub mod client;
|
@ -1,239 +0,0 @@
|
||||
use std::borrow::Cow;
|
||||
use std::collections::HashMap;
|
||||
|
||||
use super::{configuration, Error};
|
||||
use futures;
|
||||
use futures::{Future, Stream};
|
||||
use hyper;
|
||||
use hyper::header::UserAgent;
|
||||
use serde;
|
||||
use serde_json;
|
||||
|
||||
pub(crate) struct ApiKey {
|
||||
pub in_header: bool,
|
||||
pub in_query: bool,
|
||||
pub param_name: String,
|
||||
}
|
||||
|
||||
impl ApiKey {
|
||||
fn key(&self, prefix: &Option<String>, key: &str) -> String {
|
||||
match prefix {
|
||||
None => key.to_owned(),
|
||||
Some(ref prefix) => format!("{} {}", prefix, key),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub(crate) enum Auth {
|
||||
None,
|
||||
ApiKey(ApiKey),
|
||||
Basic,
|
||||
Oauth,
|
||||
}
|
||||
|
||||
pub(crate) struct Request {
|
||||
auth: Auth,
|
||||
method: hyper::Method,
|
||||
path: String,
|
||||
query_params: HashMap<String, String>,
|
||||
no_return_type: bool,
|
||||
path_params: HashMap<String, String>,
|
||||
form_params: HashMap<String, String>,
|
||||
header_params: HashMap<String, String>,
|
||||
// TODO: multiple body params are possible technically, but not supported here.
|
||||
serialized_body: Option<String>,
|
||||
}
|
||||
|
||||
impl Request {
|
||||
pub fn new(method: hyper::Method, path: String) -> Self {
|
||||
Request {
|
||||
auth: Auth::None,
|
||||
method: method,
|
||||
path: path,
|
||||
query_params: HashMap::new(),
|
||||
path_params: HashMap::new(),
|
||||
form_params: HashMap::new(),
|
||||
header_params: HashMap::new(),
|
||||
serialized_body: None,
|
||||
no_return_type: false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_body_param<T: serde::Serialize>(mut self, param: T) -> Self {
|
||||
self.serialized_body = Some(serde_json::to_string(¶m).unwrap());
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_header_param(mut self, basename: String, param: String) -> Self {
|
||||
self.header_params.insert(basename, param);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_query_param(mut self, basename: String, param: String) -> Self {
|
||||
self.query_params.insert(basename, param);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_path_param(mut self, basename: String, param: String) -> Self {
|
||||
self.path_params.insert(basename, param);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_form_param(mut self, basename: String, param: String) -> Self {
|
||||
self.form_params.insert(basename, param);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn returns_nothing(mut self) -> Self {
|
||||
self.no_return_type = true;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_auth(mut self, auth: Auth) -> Self {
|
||||
self.auth = auth;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn execute<'a, C, U>(
|
||||
self,
|
||||
conf: &configuration::Configuration<C>,
|
||||
) -> Box<dyn Future<Item = U, Error = Error<serde_json::Value>> + 'a>
|
||||
where
|
||||
C: hyper::client::Connect,
|
||||
U: Sized + 'a,
|
||||
for<'de> U: serde::Deserialize<'de>,
|
||||
{
|
||||
let mut query_string = ::url::form_urlencoded::Serializer::new("".to_owned());
|
||||
// raw_headers is for headers we don't know the proper type of (e.g. custom api key
|
||||
// headers); headers is for ones we do know the type of.
|
||||
let mut raw_headers = HashMap::new();
|
||||
let mut headers: hyper::header::Headers = hyper::header::Headers::new();
|
||||
|
||||
let mut path = self.path;
|
||||
for (k, v) in self.path_params {
|
||||
// replace {id} with the value of the id path param
|
||||
path = path.replace(&format!("{{{}}}", k), &v);
|
||||
}
|
||||
|
||||
for (k, v) in self.header_params {
|
||||
raw_headers.insert(k, v);
|
||||
}
|
||||
|
||||
for (key, val) in self.query_params {
|
||||
query_string.append_pair(&key, &val);
|
||||
}
|
||||
|
||||
match self.auth {
|
||||
Auth::ApiKey(apikey) => {
|
||||
if let Some(ref key) = conf.api_key {
|
||||
let val = apikey.key(&key.prefix, &key.key);
|
||||
if apikey.in_query {
|
||||
query_string.append_pair(&apikey.param_name, &val);
|
||||
}
|
||||
if apikey.in_header {
|
||||
raw_headers.insert(apikey.param_name, val);
|
||||
}
|
||||
}
|
||||
}
|
||||
Auth::Basic => {
|
||||
if let Some(ref auth_conf) = conf.basic_auth {
|
||||
let auth = hyper::header::Authorization(hyper::header::Basic {
|
||||
username: auth_conf.0.to_owned(),
|
||||
password: auth_conf.1.to_owned(),
|
||||
});
|
||||
headers.set(auth);
|
||||
}
|
||||
}
|
||||
Auth::Oauth => {
|
||||
if let Some(ref token) = conf.oauth_access_token {
|
||||
let auth = hyper::header::Authorization(hyper::header::Bearer {
|
||||
token: token.to_owned(),
|
||||
});
|
||||
headers.set(auth);
|
||||
}
|
||||
}
|
||||
Auth::None => {}
|
||||
}
|
||||
|
||||
let mut uri_str = format!("{}{}", conf.base_path, path);
|
||||
|
||||
let query_string_str = query_string.finish();
|
||||
if query_string_str != "" {
|
||||
uri_str += "?";
|
||||
uri_str += &query_string_str;
|
||||
}
|
||||
let uri: hyper::Uri = match uri_str.parse() {
|
||||
Err(e) => {
|
||||
return Box::new(futures::future::err(Error::UriError(e)));
|
||||
}
|
||||
Ok(u) => u,
|
||||
};
|
||||
|
||||
let mut req = hyper::Request::new(self.method, uri);
|
||||
{
|
||||
let req_headers = req.headers_mut();
|
||||
if let Some(ref user_agent) = conf.user_agent {
|
||||
req_headers.set(UserAgent::new(Cow::Owned(user_agent.clone())));
|
||||
}
|
||||
|
||||
req_headers.extend(headers.iter());
|
||||
|
||||
for (key, val) in raw_headers {
|
||||
req_headers.set_raw(key, val);
|
||||
}
|
||||
}
|
||||
|
||||
if self.form_params.len() > 0 {
|
||||
req.headers_mut().set(hyper::header::ContentType::form_url_encoded());
|
||||
let mut enc = ::url::form_urlencoded::Serializer::new("".to_owned());
|
||||
for (k, v) in self.form_params {
|
||||
enc.append_pair(&k, &v);
|
||||
}
|
||||
req.set_body(enc.finish());
|
||||
}
|
||||
|
||||
if let Some(body) = self.serialized_body {
|
||||
req.headers_mut().set(hyper::header::ContentType::json());
|
||||
req.headers_mut()
|
||||
.set(hyper::header::ContentLength(body.len() as u64));
|
||||
req.set_body(body);
|
||||
}
|
||||
|
||||
let no_ret_type = self.no_return_type;
|
||||
let res = conf.client
|
||||
.request(req)
|
||||
.map_err(|e| Error::from(e))
|
||||
.and_then(|resp| {
|
||||
let status = resp.status();
|
||||
resp.body()
|
||||
.concat2()
|
||||
.and_then(move |body| Ok((status, body)))
|
||||
.map_err(|e| Error::from(e))
|
||||
})
|
||||
.and_then(|(status, body)| {
|
||||
if status.is_success() {
|
||||
Ok(body)
|
||||
} else {
|
||||
Err(Error::from((status, &*body)))
|
||||
}
|
||||
});
|
||||
Box::new(
|
||||
res
|
||||
.and_then(move |body| {
|
||||
let parsed: Result<U, _> = if no_ret_type {
|
||||
// This is a hack; if there's no_ret_type, U is (), but serde_json gives an
|
||||
// error when deserializing "" into (), so deserialize 'null' into it
|
||||
// instead.
|
||||
// An alternate option would be to require U: Default, and then return
|
||||
// U::default() here instead since () implements that, but then we'd
|
||||
// need to impl default for all models.
|
||||
serde_json::from_str("null")
|
||||
} else {
|
||||
serde_json::from_slice(&body)
|
||||
};
|
||||
parsed.map_err(|e| Error::from(e))
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
|
||||
extern crate serde;
|
||||
extern crate serde_json;
|
||||
extern crate url;
|
||||
extern crate hyper;
|
||||
extern crate futures;
|
||||
|
||||
pub mod apis;
|
||||
pub mod models;
|
@ -13,6 +13,8 @@ docs/PetApi.md
|
||||
docs/PropertyTest.md
|
||||
docs/StoreApi.md
|
||||
docs/Tag.md
|
||||
docs/TestingApi.md
|
||||
docs/TypeTesting.md
|
||||
docs/User.md
|
||||
docs/UserApi.md
|
||||
git_push.sh
|
||||
@ -23,6 +25,7 @@ src/apis/mod.rs
|
||||
src/apis/pet_api.rs
|
||||
src/apis/request.rs
|
||||
src/apis/store_api.rs
|
||||
src/apis/testing_api.rs
|
||||
src/apis/user_api.rs
|
||||
src/lib.rs
|
||||
src/models/action_container.rs
|
||||
@ -34,4 +37,5 @@ src/models/order.rs
|
||||
src/models/pet.rs
|
||||
src/models/property_test.rs
|
||||
src/models/tag.rs
|
||||
src/models/type_testing.rs
|
||||
src/models/user.rs
|
||||
|
@ -38,6 +38,8 @@ Class | Method | HTTP request | Description
|
||||
*StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **Get** /store/inventory | Returns pet inventories by status
|
||||
*StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **Get** /store/order/{orderId} | Find purchase order by ID
|
||||
*StoreApi* | [**place_order**](docs/StoreApi.md#place_order) | **Post** /store/order | Place an order for a pet
|
||||
*TestingApi* | [**tests_file_response_get**](docs/TestingApi.md#tests_file_response_get) | **Get** /tests/fileResponse | Returns an image file
|
||||
*TestingApi* | [**tests_type_testing_get**](docs/TestingApi.md#tests_type_testing_get) | **Get** /tests/typeTesting | Route to test the TypeTesting schema
|
||||
*UserApi* | [**create_user**](docs/UserApi.md#create_user) | **Post** /user | Create user
|
||||
*UserApi* | [**create_users_with_array_input**](docs/UserApi.md#create_users_with_array_input) | **Post** /user/createWithArray | Creates list of users with given input array
|
||||
*UserApi* | [**create_users_with_list_input**](docs/UserApi.md#create_users_with_list_input) | **Post** /user/createWithList | Creates list of users with given input array
|
||||
@ -58,6 +60,7 @@ Class | Method | HTTP request | Description
|
||||
- [Pet](docs/Pet.md)
|
||||
- [PropertyTest](docs/PropertyTest.md)
|
||||
- [Tag](docs/Tag.md)
|
||||
- [TypeTesting](docs/TypeTesting.md)
|
||||
- [User](docs/User.md)
|
||||
|
||||
|
||||
|
@ -0,0 +1,60 @@
|
||||
# \DefaultApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**tests_file_response_get**](DefaultApi.md#tests_file_response_get) | **Get** /tests/fileResponse | Returns an image file
|
||||
[**tests_type_testing_get**](DefaultApi.md#tests_type_testing_get) | **Get** /tests/typeTesting | Route to test the TypeTesting schema
|
||||
|
||||
|
||||
|
||||
## tests_file_response_get
|
||||
|
||||
> std::path::PathBuf tests_file_response_get()
|
||||
Returns an image file
|
||||
|
||||
### Parameters
|
||||
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
[**std::path::PathBuf**](std::path::PathBuf.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: image/jpeg
|
||||
|
||||
[[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)
|
||||
|
||||
|
||||
## tests_type_testing_get
|
||||
|
||||
> crate::models::TypeTesting tests_type_testing_get()
|
||||
Route to test the TypeTesting schema
|
||||
|
||||
### Parameters
|
||||
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
[**crate::models::TypeTesting**](TypeTesting.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### 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)
|
||||
|
@ -0,0 +1,60 @@
|
||||
# \TestingApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**tests_file_response_get**](TestingApi.md#tests_file_response_get) | **Get** /tests/fileResponse | Returns an image file
|
||||
[**tests_type_testing_get**](TestingApi.md#tests_type_testing_get) | **Get** /tests/typeTesting | Route to test the TypeTesting schema
|
||||
|
||||
|
||||
|
||||
## tests_file_response_get
|
||||
|
||||
> std::path::PathBuf tests_file_response_get()
|
||||
Returns an image file
|
||||
|
||||
### Parameters
|
||||
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
[**std::path::PathBuf**](std::path::PathBuf.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: image/jpeg
|
||||
|
||||
[[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)
|
||||
|
||||
|
||||
## tests_type_testing_get
|
||||
|
||||
> crate::models::TypeTesting tests_type_testing_get()
|
||||
Route to test the TypeTesting schema
|
||||
|
||||
### Parameters
|
||||
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
[**crate::models::TypeTesting**](TypeTesting.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### 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)
|
||||
|
@ -4,12 +4,13 @@
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**integer** | Option<**i32**> | | [optional]
|
||||
**long** | Option<**i64**> | | [optional]
|
||||
**number** | Option<**f32**> | | [optional]
|
||||
**float** | Option<**f32**> | | [optional]
|
||||
**double** | Option<**f64**> | | [optional]
|
||||
**uuid** | Option<**String**> | | [optional]
|
||||
**int32** | **i32** | |
|
||||
**int64** | **i64** | |
|
||||
**float** | **f32** | |
|
||||
**double** | **f64** | |
|
||||
**string** | **String** | |
|
||||
**boolean** | **bool** | |
|
||||
**uuid** | [**uuid::Uuid**](uuid::Uuid.md) | |
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
@ -7,6 +7,7 @@ pub struct APIClient {
|
||||
fake_api: Box<dyn crate::apis::FakeApi>,
|
||||
pet_api: Box<dyn crate::apis::PetApi>,
|
||||
store_api: Box<dyn crate::apis::StoreApi>,
|
||||
testing_api: Box<dyn crate::apis::TestingApi>,
|
||||
user_api: Box<dyn crate::apis::UserApi>,
|
||||
}
|
||||
|
||||
@ -19,6 +20,7 @@ impl APIClient {
|
||||
fake_api: Box::new(crate::apis::FakeApiClient::new(rc.clone())),
|
||||
pet_api: Box::new(crate::apis::PetApiClient::new(rc.clone())),
|
||||
store_api: Box::new(crate::apis::StoreApiClient::new(rc.clone())),
|
||||
testing_api: Box::new(crate::apis::TestingApiClient::new(rc.clone())),
|
||||
user_api: Box::new(crate::apis::UserApiClient::new(rc.clone())),
|
||||
}
|
||||
}
|
||||
@ -35,6 +37,10 @@ impl APIClient {
|
||||
self.store_api.as_ref()
|
||||
}
|
||||
|
||||
pub fn testing_api(&self) -> &dyn crate::apis::TestingApi{
|
||||
self.testing_api.as_ref()
|
||||
}
|
||||
|
||||
pub fn user_api(&self) -> &dyn crate::apis::UserApi{
|
||||
self.user_api.as_ref()
|
||||
}
|
||||
|
@ -53,6 +53,8 @@ mod pet_api;
|
||||
pub use self::pet_api::{ PetApi, PetApiClient };
|
||||
mod store_api;
|
||||
pub use self::store_api::{ StoreApi, StoreApiClient };
|
||||
mod testing_api;
|
||||
pub use self::testing_api::{ TestingApi, TestingApiClient };
|
||||
mod user_api;
|
||||
pub use self::user_api::{ UserApi, UserApiClient };
|
||||
|
||||
|
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use std::rc::Rc;
|
||||
use std::borrow::Borrow;
|
||||
use std::pin::Pin;
|
||||
#[allow(unused_imports)]
|
||||
use std::option::Option;
|
||||
|
||||
use hyper;
|
||||
use futures::Future;
|
||||
|
||||
use super::{Error, configuration};
|
||||
use super::request as __internal_request;
|
||||
|
||||
pub struct TestingApiClient<C: hyper::client::connect::Connect>
|
||||
where C: Clone + std::marker::Send + Sync + 'static {
|
||||
configuration: Rc<configuration::Configuration<C>>,
|
||||
}
|
||||
|
||||
impl<C: hyper::client::connect::Connect> TestingApiClient<C>
|
||||
where C: Clone + std::marker::Send + Sync {
|
||||
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> TestingApiClient<C> {
|
||||
TestingApiClient {
|
||||
configuration,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub trait TestingApi {
|
||||
fn tests_file_response_get(&self, ) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>>>>;
|
||||
fn tests_type_testing_get(&self, ) -> Pin<Box<dyn Future<Output = Result<crate::models::TypeTesting, Error>>>>;
|
||||
}
|
||||
|
||||
impl<C: hyper::client::connect::Connect>TestingApi for TestingApiClient<C>
|
||||
where C: Clone + std::marker::Send + Sync {
|
||||
#[allow(unused_mut)]
|
||||
fn tests_file_response_get(&self, ) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>>>> {
|
||||
let mut req = __internal_request::Request::new(hyper::Method::GET, "/tests/fileResponse".to_string())
|
||||
;
|
||||
|
||||
req.execute(self.configuration.borrow())
|
||||
}
|
||||
|
||||
#[allow(unused_mut)]
|
||||
fn tests_type_testing_get(&self, ) -> Pin<Box<dyn Future<Output = Result<crate::models::TypeTesting, Error>>>> {
|
||||
let mut req = __internal_request::Request::new(hyper::Method::GET, "/tests/typeTesting".to_string())
|
||||
;
|
||||
|
||||
req.execute(self.configuration.borrow())
|
||||
}
|
||||
|
||||
}
|
@ -14,5 +14,7 @@ pub mod property_test;
|
||||
pub use self::property_test::PropertyTest;
|
||||
pub mod tag;
|
||||
pub use self::tag::Tag;
|
||||
pub mod type_testing;
|
||||
pub use self::type_testing::TypeTesting;
|
||||
pub mod user;
|
||||
pub use self::user::User;
|
||||
|
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/// TypeTesting : Test handling of different field data types
|
||||
|
||||
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
|
||||
pub struct TypeTesting {
|
||||
#[serde(rename = "int32")]
|
||||
pub int32: i32,
|
||||
#[serde(rename = "int64")]
|
||||
pub int64: i64,
|
||||
#[serde(rename = "float")]
|
||||
pub float: f32,
|
||||
#[serde(rename = "double")]
|
||||
pub double: f64,
|
||||
#[serde(rename = "string")]
|
||||
pub string: String,
|
||||
#[serde(rename = "boolean")]
|
||||
pub boolean: bool,
|
||||
#[serde(rename = "uuid")]
|
||||
pub uuid: uuid::Uuid,
|
||||
}
|
||||
|
||||
impl TypeTesting {
|
||||
/// Test handling of different field data types
|
||||
pub fn new(int32: i32, int64: i64, float: f32, double: f64, string: String, boolean: bool, uuid: uuid::Uuid) -> TypeTesting {
|
||||
TypeTesting {
|
||||
int32,
|
||||
int64,
|
||||
float,
|
||||
double,
|
||||
string,
|
||||
boolean,
|
||||
uuid,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,3 +0,0 @@
|
||||
/target/
|
||||
**/*.rs.bk
|
||||
Cargo.lock
|
@ -1,23 +0,0 @@
|
||||
# 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
|
@ -1,15 +0,0 @@
|
||||
.gitignore
|
||||
.travis.yml
|
||||
Cargo.toml
|
||||
README.md
|
||||
docs/DefaultApi.md
|
||||
docs/TypeTesting.md
|
||||
git_push.sh
|
||||
src/apis/client.rs
|
||||
src/apis/configuration.rs
|
||||
src/apis/default_api.rs
|
||||
src/apis/mod.rs
|
||||
src/apis/request.rs
|
||||
src/lib.rs
|
||||
src/models/mod.rs
|
||||
src/models/type_testing.rs
|
@ -1 +0,0 @@
|
||||
5.0.0-SNAPSHOT
|
@ -1 +0,0 @@
|
||||
language: rust
|
@ -1,18 +0,0 @@
|
||||
[package]
|
||||
name = "rust-test-hyper"
|
||||
version = "1.0.0"
|
||||
authors = ["OpenAPI Generator team and contributors"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
serde = "^1.0"
|
||||
serde_derive = "^1.0"
|
||||
serde_json = "^1.0"
|
||||
url = "1.5"
|
||||
hyper = "~0.11"
|
||||
serde_yaml = "0.7"
|
||||
base64 = "~0.7.0"
|
||||
futures = "0.1.23"
|
||||
|
||||
[dev-dependencies]
|
||||
tokio-core = "*"
|
@ -1,44 +0,0 @@
|
||||
# Rust API client for rust-test-hyper
|
||||
|
||||
Special testing for the Rust client generator
|
||||
|
||||
## 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: 1.0.7
|
||||
- Package version: 1.0.0
|
||||
- Build package: org.openapitools.codegen.languages.RustClientCodegen
|
||||
|
||||
## Installation
|
||||
|
||||
Put the package under your project folder and add the following to `Cargo.toml` under `[dependencies]`:
|
||||
|
||||
```
|
||||
openapi = { path = "./generated" }
|
||||
```
|
||||
|
||||
## Documentation for API Endpoints
|
||||
|
||||
All URIs are relative to *http://localhost*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*DefaultApi* | [**dummy_get**](docs/DefaultApi.md#dummy_get) | **Get** /dummy | A dummy endpoint to make the spec valid.
|
||||
|
||||
|
||||
## Documentation For Models
|
||||
|
||||
- [TypeTesting](docs/TypeTesting.md)
|
||||
|
||||
|
||||
To get access to the crate's generated documentation, use:
|
||||
|
||||
```
|
||||
cargo doc --open
|
||||
```
|
||||
|
||||
## Author
|
||||
|
||||
|
||||
|
@ -1,34 +0,0 @@
|
||||
# \DefaultApi
|
||||
|
||||
All URIs are relative to *http://localhost*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**dummy_get**](DefaultApi.md#dummy_get) | **Get** /dummy | A dummy endpoint to make the spec valid.
|
||||
|
||||
|
||||
|
||||
## dummy_get
|
||||
|
||||
> dummy_get()
|
||||
A dummy endpoint to make the spec valid.
|
||||
|
||||
### Parameters
|
||||
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
(empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[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)
|
||||
|
@ -1,58 +0,0 @@
|
||||
#!/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-pestore-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'
|
||||
|
@ -1,23 +0,0 @@
|
||||
use std::rc::Rc;
|
||||
|
||||
use hyper;
|
||||
use super::configuration::Configuration;
|
||||
|
||||
pub struct APIClient {
|
||||
default_api: Box<dyn crate::apis::DefaultApi>,
|
||||
}
|
||||
|
||||
impl APIClient {
|
||||
pub fn new<C: hyper::client::Connect>(configuration: Configuration<C>) -> APIClient {
|
||||
let rc = Rc::new(configuration);
|
||||
|
||||
APIClient {
|
||||
default_api: Box::new(crate::apis::DefaultApiClient::new(rc.clone())),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn default_api(&self) -> &dyn crate::apis::DefaultApi{
|
||||
self.default_api.as_ref()
|
||||
}
|
||||
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Rust client test spec
|
||||
*
|
||||
* Special testing for the Rust client generator
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.7
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use hyper;
|
||||
|
||||
pub struct Configuration<C: hyper::client::Connect> {
|
||||
pub base_path: String,
|
||||
pub user_agent: Option<String>,
|
||||
pub client: hyper::client::Client<C>,
|
||||
pub basic_auth: Option<BasicAuth>,
|
||||
pub oauth_access_token: Option<String>,
|
||||
pub api_key: Option<ApiKey>,
|
||||
// TODO: take an oauth2 token source, similar to the go one
|
||||
}
|
||||
|
||||
pub type BasicAuth = (String, Option<String>);
|
||||
|
||||
pub struct ApiKey {
|
||||
pub prefix: Option<String>,
|
||||
pub key: String,
|
||||
}
|
||||
|
||||
impl<C: hyper::client::Connect> Configuration<C> {
|
||||
pub fn new(client: hyper::client::Client<C>) -> Configuration<C> {
|
||||
Configuration {
|
||||
base_path: "http://localhost".to_owned(),
|
||||
user_agent: Some("OpenAPI-Generator/1.0.7/rust".to_owned()),
|
||||
client: client,
|
||||
basic_auth: None,
|
||||
oauth_access_token: None,
|
||||
api_key: None,
|
||||
}
|
||||
}
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Rust client test spec
|
||||
*
|
||||
* Special testing for the Rust client generator
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.7
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
use std::rc::Rc;
|
||||
use std::borrow::Borrow;
|
||||
#[allow(unused_imports)]
|
||||
use std::option::Option;
|
||||
|
||||
use hyper;
|
||||
use serde_json;
|
||||
use futures::Future;
|
||||
|
||||
use super::{Error, configuration};
|
||||
use super::request as __internal_request;
|
||||
|
||||
pub struct DefaultApiClient<C: hyper::client::Connect> {
|
||||
configuration: Rc<configuration::Configuration<C>>,
|
||||
}
|
||||
|
||||
impl<C: hyper::client::Connect> DefaultApiClient<C> {
|
||||
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> DefaultApiClient<C> {
|
||||
DefaultApiClient {
|
||||
configuration,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub trait DefaultApi {
|
||||
fn dummy_get(&self, ) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>>;
|
||||
}
|
||||
|
||||
impl<C: hyper::client::Connect>DefaultApi for DefaultApiClient<C> {
|
||||
fn dummy_get(&self, ) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>> {
|
||||
let mut req = __internal_request::Request::new(hyper::Method::Get, "/dummy".to_string())
|
||||
;
|
||||
req = req.returns_nothing();
|
||||
|
||||
req.execute(self.configuration.borrow())
|
||||
}
|
||||
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
use hyper;
|
||||
use serde;
|
||||
use serde_json;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Error<T> {
|
||||
UriError(hyper::error::UriError),
|
||||
Hyper(hyper::Error),
|
||||
Serde(serde_json::Error),
|
||||
ApiError(ApiError<T>),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ApiError<T> {
|
||||
pub code: hyper::StatusCode,
|
||||
pub content: Option<T>,
|
||||
}
|
||||
|
||||
impl<'de, T> From<(hyper::StatusCode, &'de [u8])> for Error<T>
|
||||
where T: serde::Deserialize<'de> {
|
||||
fn from(e: (hyper::StatusCode, &'de [u8])) -> Self {
|
||||
if e.1.len() == 0 {
|
||||
return Error::ApiError(ApiError{
|
||||
code: e.0,
|
||||
content: None,
|
||||
});
|
||||
}
|
||||
match serde_json::from_slice::<T>(e.1) {
|
||||
Ok(t) => Error::ApiError(ApiError{
|
||||
code: e.0,
|
||||
content: Some(t),
|
||||
}),
|
||||
Err(e) => {
|
||||
Error::from(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> From<hyper::Error> for Error<T> {
|
||||
fn from(e: hyper::Error) -> Self {
|
||||
return Error::Hyper(e)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> From<serde_json::Error> for Error<T> {
|
||||
fn from(e: serde_json::Error) -> Self {
|
||||
return Error::Serde(e)
|
||||
}
|
||||
}
|
||||
|
||||
mod request;
|
||||
|
||||
mod default_api;
|
||||
pub use self::default_api::{ DefaultApi, DefaultApiClient };
|
||||
|
||||
pub mod configuration;
|
||||
pub mod client;
|
@ -1,239 +0,0 @@
|
||||
use std::borrow::Cow;
|
||||
use std::collections::HashMap;
|
||||
|
||||
use super::{configuration, Error};
|
||||
use futures;
|
||||
use futures::{Future, Stream};
|
||||
use hyper;
|
||||
use hyper::header::UserAgent;
|
||||
use serde;
|
||||
use serde_json;
|
||||
|
||||
pub(crate) struct ApiKey {
|
||||
pub in_header: bool,
|
||||
pub in_query: bool,
|
||||
pub param_name: String,
|
||||
}
|
||||
|
||||
impl ApiKey {
|
||||
fn key(&self, prefix: &Option<String>, key: &str) -> String {
|
||||
match prefix {
|
||||
None => key.to_owned(),
|
||||
Some(ref prefix) => format!("{} {}", prefix, key),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub(crate) enum Auth {
|
||||
None,
|
||||
ApiKey(ApiKey),
|
||||
Basic,
|
||||
Oauth,
|
||||
}
|
||||
|
||||
pub(crate) struct Request {
|
||||
auth: Auth,
|
||||
method: hyper::Method,
|
||||
path: String,
|
||||
query_params: HashMap<String, String>,
|
||||
no_return_type: bool,
|
||||
path_params: HashMap<String, String>,
|
||||
form_params: HashMap<String, String>,
|
||||
header_params: HashMap<String, String>,
|
||||
// TODO: multiple body params are possible technically, but not supported here.
|
||||
serialized_body: Option<String>,
|
||||
}
|
||||
|
||||
impl Request {
|
||||
pub fn new(method: hyper::Method, path: String) -> Self {
|
||||
Request {
|
||||
auth: Auth::None,
|
||||
method: method,
|
||||
path: path,
|
||||
query_params: HashMap::new(),
|
||||
path_params: HashMap::new(),
|
||||
form_params: HashMap::new(),
|
||||
header_params: HashMap::new(),
|
||||
serialized_body: None,
|
||||
no_return_type: false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_body_param<T: serde::Serialize>(mut self, param: T) -> Self {
|
||||
self.serialized_body = Some(serde_json::to_string(¶m).unwrap());
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_header_param(mut self, basename: String, param: String) -> Self {
|
||||
self.header_params.insert(basename, param);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_query_param(mut self, basename: String, param: String) -> Self {
|
||||
self.query_params.insert(basename, param);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_path_param(mut self, basename: String, param: String) -> Self {
|
||||
self.path_params.insert(basename, param);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_form_param(mut self, basename: String, param: String) -> Self {
|
||||
self.form_params.insert(basename, param);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn returns_nothing(mut self) -> Self {
|
||||
self.no_return_type = true;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_auth(mut self, auth: Auth) -> Self {
|
||||
self.auth = auth;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn execute<'a, C, U>(
|
||||
self,
|
||||
conf: &configuration::Configuration<C>,
|
||||
) -> Box<dyn Future<Item = U, Error = Error<serde_json::Value>> + 'a>
|
||||
where
|
||||
C: hyper::client::Connect,
|
||||
U: Sized + 'a,
|
||||
for<'de> U: serde::Deserialize<'de>,
|
||||
{
|
||||
let mut query_string = ::url::form_urlencoded::Serializer::new("".to_owned());
|
||||
// raw_headers is for headers we don't know the proper type of (e.g. custom api key
|
||||
// headers); headers is for ones we do know the type of.
|
||||
let mut raw_headers = HashMap::new();
|
||||
let mut headers: hyper::header::Headers = hyper::header::Headers::new();
|
||||
|
||||
let mut path = self.path;
|
||||
for (k, v) in self.path_params {
|
||||
// replace {id} with the value of the id path param
|
||||
path = path.replace(&format!("{{{}}}", k), &v);
|
||||
}
|
||||
|
||||
for (k, v) in self.header_params {
|
||||
raw_headers.insert(k, v);
|
||||
}
|
||||
|
||||
for (key, val) in self.query_params {
|
||||
query_string.append_pair(&key, &val);
|
||||
}
|
||||
|
||||
match self.auth {
|
||||
Auth::ApiKey(apikey) => {
|
||||
if let Some(ref key) = conf.api_key {
|
||||
let val = apikey.key(&key.prefix, &key.key);
|
||||
if apikey.in_query {
|
||||
query_string.append_pair(&apikey.param_name, &val);
|
||||
}
|
||||
if apikey.in_header {
|
||||
raw_headers.insert(apikey.param_name, val);
|
||||
}
|
||||
}
|
||||
}
|
||||
Auth::Basic => {
|
||||
if let Some(ref auth_conf) = conf.basic_auth {
|
||||
let auth = hyper::header::Authorization(hyper::header::Basic {
|
||||
username: auth_conf.0.to_owned(),
|
||||
password: auth_conf.1.to_owned(),
|
||||
});
|
||||
headers.set(auth);
|
||||
}
|
||||
}
|
||||
Auth::Oauth => {
|
||||
if let Some(ref token) = conf.oauth_access_token {
|
||||
let auth = hyper::header::Authorization(hyper::header::Bearer {
|
||||
token: token.to_owned(),
|
||||
});
|
||||
headers.set(auth);
|
||||
}
|
||||
}
|
||||
Auth::None => {}
|
||||
}
|
||||
|
||||
let mut uri_str = format!("{}{}", conf.base_path, path);
|
||||
|
||||
let query_string_str = query_string.finish();
|
||||
if query_string_str != "" {
|
||||
uri_str += "?";
|
||||
uri_str += &query_string_str;
|
||||
}
|
||||
let uri: hyper::Uri = match uri_str.parse() {
|
||||
Err(e) => {
|
||||
return Box::new(futures::future::err(Error::UriError(e)));
|
||||
}
|
||||
Ok(u) => u,
|
||||
};
|
||||
|
||||
let mut req = hyper::Request::new(self.method, uri);
|
||||
{
|
||||
let req_headers = req.headers_mut();
|
||||
if let Some(ref user_agent) = conf.user_agent {
|
||||
req_headers.set(UserAgent::new(Cow::Owned(user_agent.clone())));
|
||||
}
|
||||
|
||||
req_headers.extend(headers.iter());
|
||||
|
||||
for (key, val) in raw_headers {
|
||||
req_headers.set_raw(key, val);
|
||||
}
|
||||
}
|
||||
|
||||
if self.form_params.len() > 0 {
|
||||
req.headers_mut().set(hyper::header::ContentType::form_url_encoded());
|
||||
let mut enc = ::url::form_urlencoded::Serializer::new("".to_owned());
|
||||
for (k, v) in self.form_params {
|
||||
enc.append_pair(&k, &v);
|
||||
}
|
||||
req.set_body(enc.finish());
|
||||
}
|
||||
|
||||
if let Some(body) = self.serialized_body {
|
||||
req.headers_mut().set(hyper::header::ContentType::json());
|
||||
req.headers_mut()
|
||||
.set(hyper::header::ContentLength(body.len() as u64));
|
||||
req.set_body(body);
|
||||
}
|
||||
|
||||
let no_ret_type = self.no_return_type;
|
||||
let res = conf.client
|
||||
.request(req)
|
||||
.map_err(|e| Error::from(e))
|
||||
.and_then(|resp| {
|
||||
let status = resp.status();
|
||||
resp.body()
|
||||
.concat2()
|
||||
.and_then(move |body| Ok((status, body)))
|
||||
.map_err(|e| Error::from(e))
|
||||
})
|
||||
.and_then(|(status, body)| {
|
||||
if status.is_success() {
|
||||
Ok(body)
|
||||
} else {
|
||||
Err(Error::from((status, &*body)))
|
||||
}
|
||||
});
|
||||
Box::new(
|
||||
res
|
||||
.and_then(move |body| {
|
||||
let parsed: Result<U, _> = if no_ret_type {
|
||||
// This is a hack; if there's no_ret_type, U is (), but serde_json gives an
|
||||
// error when deserializing "" into (), so deserialize 'null' into it
|
||||
// instead.
|
||||
// An alternate option would be to require U: Default, and then return
|
||||
// U::default() here instead since () implements that, but then we'd
|
||||
// need to impl default for all models.
|
||||
serde_json::from_str("null")
|
||||
} else {
|
||||
serde_json::from_slice(&body)
|
||||
};
|
||||
parsed.map_err(|e| Error::from(e))
|
||||
})
|
||||
)
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
|
||||
extern crate serde;
|
||||
extern crate serde_json;
|
||||
extern crate url;
|
||||
extern crate hyper;
|
||||
extern crate futures;
|
||||
|
||||
pub mod apis;
|
||||
pub mod models;
|
@ -1,2 +0,0 @@
|
||||
pub mod type_testing;
|
||||
pub use self::type_testing::TypeTesting;
|
@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Rust client test spec
|
||||
*
|
||||
* Special testing for the Rust client generator
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.7
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/// TypeTesting : Test handling of differing types (see \\#3463)
|
||||
|
||||
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct TypeTesting {
|
||||
#[serde(rename = "integer", skip_serializing_if = "Option::is_none")]
|
||||
pub integer: Option<i32>,
|
||||
#[serde(rename = "long", skip_serializing_if = "Option::is_none")]
|
||||
pub long: Option<i64>,
|
||||
#[serde(rename = "number", skip_serializing_if = "Option::is_none")]
|
||||
pub number: Option<f32>,
|
||||
#[serde(rename = "float", skip_serializing_if = "Option::is_none")]
|
||||
pub float: Option<f32>,
|
||||
#[serde(rename = "double", skip_serializing_if = "Option::is_none")]
|
||||
pub double: Option<f64>,
|
||||
#[serde(rename = "uuid", skip_serializing_if = "Option::is_none")]
|
||||
pub uuid: Option<String>,
|
||||
}
|
||||
|
||||
impl TypeTesting {
|
||||
/// Test handling of differing types (see \\#3463)
|
||||
pub fn new() -> TypeTesting {
|
||||
TypeTesting {
|
||||
integer: None,
|
||||
long: None,
|
||||
number: None,
|
||||
float: None,
|
||||
double: None,
|
||||
uuid: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,3 +0,0 @@
|
||||
/target/
|
||||
**/*.rs.bk
|
||||
Cargo.lock
|
@ -1,23 +0,0 @@
|
||||
# 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
|
@ -1,11 +0,0 @@
|
||||
.gitignore
|
||||
.travis.yml
|
||||
Cargo.toml
|
||||
README.md
|
||||
docs/DefaultApi.md
|
||||
git_push.sh
|
||||
src/apis/configuration.rs
|
||||
src/apis/default_api.rs
|
||||
src/apis/mod.rs
|
||||
src/lib.rs
|
||||
src/models/mod.rs
|
@ -1 +0,0 @@
|
||||
5.0.0-SNAPSHOT
|
@ -1 +0,0 @@
|
||||
language: rust
|
@ -1,14 +0,0 @@
|
||||
[package]
|
||||
name = "fileResponseTest-reqwest"
|
||||
version = "1.0.0"
|
||||
authors = ["OpenAPI Generator team and contributors"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
serde = "^1.0"
|
||||
serde_derive = "^1.0"
|
||||
serde_json = "^1.0"
|
||||
url = "1.5"
|
||||
reqwest = "~0.9"
|
||||
|
||||
[dev-dependencies]
|
@ -1,43 +0,0 @@
|
||||
# Rust API client for fileResponseTest-reqwest
|
||||
|
||||
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
|
||||
## 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: 1.0.0
|
||||
- Package version: 1.0.0
|
||||
- Build package: org.openapitools.codegen.languages.RustClientCodegen
|
||||
|
||||
## Installation
|
||||
|
||||
Put the package under your project folder and add the following to `Cargo.toml` under `[dependencies]`:
|
||||
|
||||
```
|
||||
openapi = { path = "./generated" }
|
||||
```
|
||||
|
||||
## Documentation for API Endpoints
|
||||
|
||||
All URIs are relative to *http://localhost/v2*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*DefaultApi* | [**fileresponsetest**](docs/DefaultApi.md#fileresponsetest) | **get** /tests/fileResponse |
|
||||
|
||||
|
||||
## Documentation For Models
|
||||
|
||||
|
||||
|
||||
To get access to the crate's generated documentation, use:
|
||||
|
||||
```
|
||||
cargo doc --open
|
||||
```
|
||||
|
||||
## Author
|
||||
|
||||
|
||||
|
@ -1,34 +0,0 @@
|
||||
# \DefaultApi
|
||||
|
||||
All URIs are relative to *http://localhost/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**fileresponsetest**](DefaultApi.md#fileresponsetest) | **get** /tests/fileResponse |
|
||||
|
||||
|
||||
|
||||
## fileresponsetest
|
||||
|
||||
> std::path::PathBuf fileresponsetest()
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
[**std::path::PathBuf**](std::path::PathBuf.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/octet-stream
|
||||
|
||||
[[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)
|
||||
|
@ -1,58 +0,0 @@
|
||||
#!/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-pestore-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'
|
||||
|
@ -1,22 +0,0 @@
|
||||
use std::rc::Rc;
|
||||
|
||||
use super::configuration::Configuration;
|
||||
|
||||
pub struct APIClient {
|
||||
default_api: Box<dyn crate::apis::default_api::DefaultApi>,
|
||||
}
|
||||
|
||||
impl APIClient {
|
||||
pub fn new(configuration: Configuration) -> APIClient {
|
||||
let rc = Rc::new(configuration);
|
||||
|
||||
APIClient {
|
||||
default_api: Box::new(crate::apis::default_api::DefaultApiClient::new(rc.clone())),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn default_api(&self) -> &dyn crate::apis::default_api::DefaultApi{
|
||||
self.default_api.as_ref()
|
||||
}
|
||||
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
/*
|
||||
* File Response Test
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
|
||||
use reqwest;
|
||||
|
||||
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>,
|
||||
// TODO: take an oauth2 token source, similar to the go one
|
||||
}
|
||||
|
||||
pub type BasicAuth = (String, Option<String>);
|
||||
|
||||
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/v2".to_owned(),
|
||||
user_agent: Some("OpenAPI-Generator/1.0.0/rust".to_owned()),
|
||||
client: reqwest::Client::new(),
|
||||
basic_auth: None,
|
||||
oauth_access_token: None,
|
||||
bearer_access_token: None,
|
||||
api_key: None,
|
||||
}
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
/*
|
||||
* File Response Test
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
|
||||
use reqwest;
|
||||
|
||||
use crate::apis::ResponseContent;
|
||||
use super::{Error, configuration};
|
||||
|
||||
|
||||
/// struct for typed errors of method `fileresponsetest`
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum FileresponsetestError {
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
|
||||
pub fn fileresponsetest(configuration: &configuration::Configuration, ) -> Result<std::path::PathBuf, Error<FileresponsetestError>> {
|
||||
|
||||
let client = &configuration.client;
|
||||
|
||||
let uri_str = format!("{}/tests/fileResponse", configuration.base_path);
|
||||
let mut req_builder = client.get(uri_str.as_str());
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let mut resp = client.execute(req)?;
|
||||
|
||||
let status = resp.status();
|
||||
let content = resp.text()?;
|
||||
|
||||
if status.is_success() {
|
||||
serde_json::from_str(&content).map_err(Error::from)
|
||||
} else {
|
||||
let entity: Option<FileresponsetestError> = serde_json::from_str(&content).ok();
|
||||
let error = ResponseContent { status, content, entity };
|
||||
Err(Error::ResponseError(error))
|
||||
}
|
||||
}
|
||||
|
@ -1,43 +0,0 @@
|
||||
use reqwest;
|
||||
use serde_json;
|
||||
|
||||
#[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> 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 mod default_api;
|
||||
|
||||
pub mod configuration;
|
@ -1,10 +0,0 @@
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
|
||||
extern crate serde;
|
||||
extern crate serde_json;
|
||||
extern crate url;
|
||||
extern crate reqwest;
|
||||
|
||||
pub mod apis;
|
||||
pub mod models;
|
@ -2,26 +2,38 @@
|
||||
.travis.yml
|
||||
Cargo.toml
|
||||
README.md
|
||||
docs/ActionContainer.md
|
||||
docs/ApiResponse.md
|
||||
docs/Baz.md
|
||||
docs/Category.md
|
||||
docs/FakeApi.md
|
||||
docs/Order.md
|
||||
docs/Pet.md
|
||||
docs/PetApi.md
|
||||
docs/PropertyTest.md
|
||||
docs/StoreApi.md
|
||||
docs/Tag.md
|
||||
docs/TestingApi.md
|
||||
docs/TypeTesting.md
|
||||
docs/User.md
|
||||
docs/UserApi.md
|
||||
git_push.sh
|
||||
src/apis/configuration.rs
|
||||
src/apis/fake_api.rs
|
||||
src/apis/mod.rs
|
||||
src/apis/pet_api.rs
|
||||
src/apis/store_api.rs
|
||||
src/apis/testing_api.rs
|
||||
src/apis/user_api.rs
|
||||
src/lib.rs
|
||||
src/models/action_container.rs
|
||||
src/models/api_response.rs
|
||||
src/models/baz.rs
|
||||
src/models/category.rs
|
||||
src/models/mod.rs
|
||||
src/models/order.rs
|
||||
src/models/pet.rs
|
||||
src/models/property_test.rs
|
||||
src/models/tag.rs
|
||||
src/models/type_testing.rs
|
||||
src/models/user.rs
|
||||
|
@ -25,6 +25,7 @@ All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*FakeApi* | [**test_nullable_required_param**](docs/FakeApi.md#test_nullable_required_param) | **GET** /fake/user/{username} | To test nullable required parameters
|
||||
*PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store
|
||||
*PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||
*PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status
|
||||
@ -37,6 +38,8 @@ Class | Method | HTTP request | Description
|
||||
*StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
*StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
*StoreApi* | [**place_order**](docs/StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet
|
||||
*TestingApi* | [**tests_file_response_get**](docs/TestingApi.md#tests_file_response_get) | **GET** /tests/fileResponse | Returns an image file
|
||||
*TestingApi* | [**tests_type_testing_get**](docs/TestingApi.md#tests_type_testing_get) | **GET** /tests/typeTesting | Route to test the TypeTesting schema
|
||||
*UserApi* | [**create_user**](docs/UserApi.md#create_user) | **POST** /user | Create user
|
||||
*UserApi* | [**create_users_with_array_input**](docs/UserApi.md#create_users_with_array_input) | **POST** /user/createWithArray | Creates list of users with given input array
|
||||
*UserApi* | [**create_users_with_list_input**](docs/UserApi.md#create_users_with_list_input) | **POST** /user/createWithList | Creates list of users with given input array
|
||||
@ -49,11 +52,15 @@ Class | Method | HTTP request | Description
|
||||
|
||||
## Documentation For Models
|
||||
|
||||
- [ActionContainer](docs/ActionContainer.md)
|
||||
- [ApiResponse](docs/ApiResponse.md)
|
||||
- [Baz](docs/Baz.md)
|
||||
- [Category](docs/Category.md)
|
||||
- [Order](docs/Order.md)
|
||||
- [Pet](docs/Pet.md)
|
||||
- [PropertyTest](docs/PropertyTest.md)
|
||||
- [Tag](docs/Tag.md)
|
||||
- [TypeTesting](docs/TypeTesting.md)
|
||||
- [User](docs/User.md)
|
||||
|
||||
|
||||
|
@ -0,0 +1,11 @@
|
||||
# ActionContainer
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**action** | [**crate::models::Baz**](Baz.md) | |
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -0,0 +1,10 @@
|
||||
# Baz
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -0,0 +1,41 @@
|
||||
# \FakeApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**test_nullable_required_param**](FakeApi.md#test_nullable_required_param) | **GET** /fake/user/{username} | To test nullable required parameters
|
||||
|
||||
|
||||
|
||||
## test_nullable_required_param
|
||||
|
||||
> test_nullable_required_param(username, dummy_required_nullable_param, uppercase)
|
||||
To test nullable required parameters
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Required | Notes
|
||||
------------- | ------------- | ------------- | ------------- | -------------
|
||||
**username** | **String** | The name that needs to be fetched. Use user1 for testing. | [required] |
|
||||
**dummy_required_nullable_param** | Option<**String**> | To test nullable required parameters | [required] |
|
||||
**uppercase** | Option<**String**> | To test parameter names in upper case | |
|
||||
|
||||
### Return type
|
||||
|
||||
(empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[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)
|
||||
|
@ -0,0 +1,11 @@
|
||||
# PropertyTest
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**uuid** | Option<[**uuid::Uuid**](uuid::Uuid.md)> | | [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)
|
||||
|
||||
|
@ -0,0 +1,60 @@
|
||||
# \TestingApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**tests_file_response_get**](TestingApi.md#tests_file_response_get) | **GET** /tests/fileResponse | Returns an image file
|
||||
[**tests_type_testing_get**](TestingApi.md#tests_type_testing_get) | **GET** /tests/typeTesting | Route to test the TypeTesting schema
|
||||
|
||||
|
||||
|
||||
## tests_file_response_get
|
||||
|
||||
> std::path::PathBuf tests_file_response_get()
|
||||
Returns an image file
|
||||
|
||||
### Parameters
|
||||
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
[**std::path::PathBuf**](std::path::PathBuf.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: image/jpeg
|
||||
|
||||
[[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)
|
||||
|
||||
|
||||
## tests_type_testing_get
|
||||
|
||||
> crate::models::TypeTesting tests_type_testing_get()
|
||||
Route to test the TypeTesting schema
|
||||
|
||||
### Parameters
|
||||
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
[**crate::models::TypeTesting**](TypeTesting.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### 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)
|
||||
|
@ -4,12 +4,13 @@
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**integer** | Option<**i32**> | | [optional]
|
||||
**long** | Option<**i64**> | | [optional]
|
||||
**number** | Option<**f32**> | | [optional]
|
||||
**float** | Option<**f32**> | | [optional]
|
||||
**double** | Option<**f64**> | | [optional]
|
||||
**uuid** | Option<**String**> | | [optional]
|
||||
**int32** | **i32** | |
|
||||
**int64** | **i64** | |
|
||||
**float** | **f32** | |
|
||||
**double** | **f64** | |
|
||||
**string** | **String** | |
|
||||
**boolean** | **bool** | |
|
||||
**uuid** | [**uuid::Uuid**](uuid::Uuid.md) | |
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
|
||||
use reqwest;
|
||||
|
||||
use crate::apis::ResponseContent;
|
||||
use super::{Error, configuration};
|
||||
|
||||
/// struct for passing parameters to the method [`test_nullable_required_param`]
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub struct TestNullableRequiredParamParams {
|
||||
/// The name that needs to be fetched. Use user1 for testing.
|
||||
pub username: String,
|
||||
/// To test nullable required parameters
|
||||
pub dummy_required_nullable_param: Option<String>,
|
||||
/// To test parameter names in upper case
|
||||
pub uppercase: Option<String>
|
||||
}
|
||||
|
||||
|
||||
/// struct for typed successes of method [`test_nullable_required_param`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum TestNullableRequiredParamSuccess {
|
||||
Status200(),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`test_nullable_required_param`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum TestNullableRequiredParamError {
|
||||
Status400(),
|
||||
Status404(),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
pub async fn test_nullable_required_param(configuration: &configuration::Configuration, params: TestNullableRequiredParamParams) -> Result<ResponseContent<TestNullableRequiredParamSuccess>, Error<TestNullableRequiredParamError>> {
|
||||
let local_var_configuration = configuration;
|
||||
|
||||
// unbox the parameters
|
||||
let username = params.username;
|
||||
let dummy_required_nullable_param = params.dummy_required_nullable_param;
|
||||
let uppercase = params.uppercase;
|
||||
|
||||
|
||||
let local_var_client = &local_var_configuration.client;
|
||||
|
||||
let local_var_uri_str = format!("{}/fake/user/{username}", local_var_configuration.base_path, username=crate::apis::urlencode(username));
|
||||
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());
|
||||
}
|
||||
match dummy_required_nullable_param {
|
||||
Some(local_var_param_value) => { local_var_req_builder = local_var_req_builder.header("dummy_required_nullable_param", local_var_param_value.to_string()); },
|
||||
None => { local_var_req_builder = local_var_req_builder.header("dummy_required_nullable_param", ""); },
|
||||
}
|
||||
if let Some(local_var_param_value) = uppercase {
|
||||
local_var_req_builder = local_var_req_builder.header("UPPERCASE", local_var_param_value.to_string());
|
||||
}
|
||||
|
||||
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() {
|
||||
let local_var_entity: Option<TestNullableRequiredParamSuccess> = serde_json::from_str(&local_var_content).ok();
|
||||
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
||||
Ok(local_var_result)
|
||||
} else {
|
||||
let local_var_entity: Option<TestNullableRequiredParamError> = 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))
|
||||
}
|
||||
}
|
||||
|
@ -61,8 +61,10 @@ pub fn urlencode<T: AsRef<str>>(s: T) -> String {
|
||||
::url::form_urlencoded::byte_serialize(s.as_ref().as_bytes()).collect()
|
||||
}
|
||||
|
||||
pub mod fake_api;
|
||||
pub mod pet_api;
|
||||
pub mod store_api;
|
||||
pub mod testing_api;
|
||||
pub mod user_api;
|
||||
|
||||
pub mod configuration;
|
||||
|
@ -0,0 +1,112 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
|
||||
use reqwest;
|
||||
|
||||
use crate::apis::ResponseContent;
|
||||
use super::{Error, configuration};
|
||||
|
||||
|
||||
/// struct for typed successes of method [`tests_file_response_get`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum TestsFileResponseGetSuccess {
|
||||
Status200(std::path::PathBuf),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed successes of method [`tests_type_testing_get`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum TestsTypeTestingGetSuccess {
|
||||
Status200(crate::models::TypeTesting),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`tests_file_response_get`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum TestsFileResponseGetError {
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`tests_type_testing_get`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum TestsTypeTestingGetError {
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
|
||||
pub async fn tests_file_response_get(configuration: &configuration::Configuration) -> Result<ResponseContent<TestsFileResponseGetSuccess>, Error<TestsFileResponseGetError>> {
|
||||
let local_var_configuration = configuration;
|
||||
|
||||
// unbox the parameters
|
||||
|
||||
|
||||
let local_var_client = &local_var_configuration.client;
|
||||
|
||||
let local_var_uri_str = format!("{}/tests/fileResponse", local_var_configuration.base_path);
|
||||
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() {
|
||||
let local_var_entity: Option<TestsFileResponseGetSuccess> = serde_json::from_str(&local_var_content).ok();
|
||||
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
||||
Ok(local_var_result)
|
||||
} else {
|
||||
let local_var_entity: Option<TestsFileResponseGetError> = 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 tests_type_testing_get(configuration: &configuration::Configuration) -> Result<ResponseContent<TestsTypeTestingGetSuccess>, Error<TestsTypeTestingGetError>> {
|
||||
let local_var_configuration = configuration;
|
||||
|
||||
// unbox the parameters
|
||||
|
||||
|
||||
let local_var_client = &local_var_configuration.client;
|
||||
|
||||
let local_var_uri_str = format!("{}/tests/typeTesting", local_var_configuration.base_path);
|
||||
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() {
|
||||
let local_var_entity: Option<TestsTypeTestingGetSuccess> = serde_json::from_str(&local_var_content).ok();
|
||||
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
||||
Ok(local_var_result)
|
||||
} else {
|
||||
let local_var_entity: Option<TestsTypeTestingGetError> = 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))
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
|
||||
pub struct ActionContainer {
|
||||
#[serde(rename = "action")]
|
||||
pub action: Box<crate::models::Baz>,
|
||||
}
|
||||
|
||||
impl ActionContainer {
|
||||
pub fn new(action: crate::models::Baz) -> ActionContainer {
|
||||
ActionContainer {
|
||||
action: Box::new(action),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
|
||||
///
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
|
||||
pub enum Baz {
|
||||
#[serde(rename = "A")]
|
||||
A,
|
||||
#[serde(rename = "B")]
|
||||
B,
|
||||
|
||||
}
|
||||
|
||||
impl ToString for Baz {
|
||||
fn to_string(&self) -> String {
|
||||
match self {
|
||||
Self::A => String::from("A"),
|
||||
Self::B => String::from("B"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Baz {
|
||||
fn default() -> Baz {
|
||||
Self::A
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,12 +1,20 @@
|
||||
pub mod action_container;
|
||||
pub use self::action_container::ActionContainer;
|
||||
pub mod api_response;
|
||||
pub use self::api_response::ApiResponse;
|
||||
pub mod baz;
|
||||
pub use self::baz::Baz;
|
||||
pub mod category;
|
||||
pub use self::category::Category;
|
||||
pub mod order;
|
||||
pub use self::order::Order;
|
||||
pub mod pet;
|
||||
pub use self::pet::Pet;
|
||||
pub mod property_test;
|
||||
pub use self::property_test::PropertyTest;
|
||||
pub mod tag;
|
||||
pub use self::tag::Tag;
|
||||
pub mod type_testing;
|
||||
pub use self::type_testing::TypeTesting;
|
||||
pub mod user;
|
||||
pub use self::user::User;
|
||||
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/// PropertyTest : A model to test various formats, e.g. UUID
|
||||
|
||||
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
|
||||
pub struct PropertyTest {
|
||||
#[serde(rename = "uuid", skip_serializing_if = "Option::is_none")]
|
||||
pub uuid: Option<uuid::Uuid>,
|
||||
}
|
||||
|
||||
impl PropertyTest {
|
||||
/// A model to test various formats, e.g. UUID
|
||||
pub fn new() -> PropertyTest {
|
||||
PropertyTest {
|
||||
uuid: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/// TypeTesting : Test handling of different field data types
|
||||
|
||||
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
|
||||
pub struct TypeTesting {
|
||||
#[serde(rename = "int32")]
|
||||
pub int32: i32,
|
||||
#[serde(rename = "int64")]
|
||||
pub int64: i64,
|
||||
#[serde(rename = "float")]
|
||||
pub float: f32,
|
||||
#[serde(rename = "double")]
|
||||
pub double: f64,
|
||||
#[serde(rename = "string")]
|
||||
pub string: String,
|
||||
#[serde(rename = "boolean")]
|
||||
pub boolean: bool,
|
||||
#[serde(rename = "uuid")]
|
||||
pub uuid: uuid::Uuid,
|
||||
}
|
||||
|
||||
impl TypeTesting {
|
||||
/// Test handling of different field data types
|
||||
pub fn new(int32: i32, int64: i64, float: f32, double: f64, string: String, boolean: bool, uuid: uuid::Uuid) -> TypeTesting {
|
||||
TypeTesting {
|
||||
int32,
|
||||
int64,
|
||||
float,
|
||||
double,
|
||||
string,
|
||||
boolean,
|
||||
uuid,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ fn test_pet() {
|
||||
new_pet.id = Option::Some(8787);
|
||||
|
||||
let new_pet_params = petstore_reqwest_async::apis::pet_api::AddPetParams {
|
||||
body: new_pet,
|
||||
pet: new_pet,
|
||||
};
|
||||
|
||||
// add pet
|
||||
@ -28,7 +28,7 @@ fn test_pet() {
|
||||
};
|
||||
|
||||
// get pet
|
||||
let pet_result = petstore_reqwest_async::apis::pet_api::get_pet_by_id(&config, get_pet_params);
|
||||
let _pet_result = petstore_reqwest_async::apis::pet_api::get_pet_by_id(&config, get_pet_params);
|
||||
|
||||
// TODO Testing async functions requires some additionnal testing crates.
|
||||
}
|
||||
|
@ -2,26 +2,38 @@
|
||||
.travis.yml
|
||||
Cargo.toml
|
||||
README.md
|
||||
docs/ActionContainer.md
|
||||
docs/ApiResponse.md
|
||||
docs/Baz.md
|
||||
docs/Category.md
|
||||
docs/FakeApi.md
|
||||
docs/Order.md
|
||||
docs/Pet.md
|
||||
docs/PetApi.md
|
||||
docs/PropertyTest.md
|
||||
docs/StoreApi.md
|
||||
docs/Tag.md
|
||||
docs/TestingApi.md
|
||||
docs/TypeTesting.md
|
||||
docs/User.md
|
||||
docs/UserApi.md
|
||||
git_push.sh
|
||||
src/apis/configuration.rs
|
||||
src/apis/fake_api.rs
|
||||
src/apis/mod.rs
|
||||
src/apis/pet_api.rs
|
||||
src/apis/store_api.rs
|
||||
src/apis/testing_api.rs
|
||||
src/apis/user_api.rs
|
||||
src/lib.rs
|
||||
src/models/action_container.rs
|
||||
src/models/api_response.rs
|
||||
src/models/baz.rs
|
||||
src/models/category.rs
|
||||
src/models/mod.rs
|
||||
src/models/order.rs
|
||||
src/models/pet.rs
|
||||
src/models/property_test.rs
|
||||
src/models/tag.rs
|
||||
src/models/type_testing.rs
|
||||
src/models/user.rs
|
||||
|
@ -25,6 +25,7 @@ All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*FakeApi* | [**test_nullable_required_param**](docs/FakeApi.md#test_nullable_required_param) | **GET** /fake/user/{username} | To test nullable required parameters
|
||||
*PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store
|
||||
*PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||
*PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status
|
||||
@ -37,6 +38,8 @@ Class | Method | HTTP request | Description
|
||||
*StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
*StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
*StoreApi* | [**place_order**](docs/StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet
|
||||
*TestingApi* | [**tests_file_response_get**](docs/TestingApi.md#tests_file_response_get) | **GET** /tests/fileResponse | Returns an image file
|
||||
*TestingApi* | [**tests_type_testing_get**](docs/TestingApi.md#tests_type_testing_get) | **GET** /tests/typeTesting | Route to test the TypeTesting schema
|
||||
*UserApi* | [**create_user**](docs/UserApi.md#create_user) | **POST** /user | Create user
|
||||
*UserApi* | [**create_users_with_array_input**](docs/UserApi.md#create_users_with_array_input) | **POST** /user/createWithArray | Creates list of users with given input array
|
||||
*UserApi* | [**create_users_with_list_input**](docs/UserApi.md#create_users_with_list_input) | **POST** /user/createWithList | Creates list of users with given input array
|
||||
@ -49,11 +52,15 @@ Class | Method | HTTP request | Description
|
||||
|
||||
## Documentation For Models
|
||||
|
||||
- [ActionContainer](docs/ActionContainer.md)
|
||||
- [ApiResponse](docs/ApiResponse.md)
|
||||
- [Baz](docs/Baz.md)
|
||||
- [Category](docs/Category.md)
|
||||
- [Order](docs/Order.md)
|
||||
- [Pet](docs/Pet.md)
|
||||
- [PropertyTest](docs/PropertyTest.md)
|
||||
- [Tag](docs/Tag.md)
|
||||
- [TypeTesting](docs/TypeTesting.md)
|
||||
- [User](docs/User.md)
|
||||
|
||||
|
||||
|
@ -0,0 +1,11 @@
|
||||
# ActionContainer
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**action** | [**crate::models::Baz**](Baz.md) | |
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -0,0 +1,10 @@
|
||||
# Baz
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -0,0 +1,41 @@
|
||||
# \FakeApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**test_nullable_required_param**](FakeApi.md#test_nullable_required_param) | **GET** /fake/user/{username} | To test nullable required parameters
|
||||
|
||||
|
||||
|
||||
## test_nullable_required_param
|
||||
|
||||
> test_nullable_required_param(username, dummy_required_nullable_param, uppercase)
|
||||
To test nullable required parameters
|
||||
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
|
||||
Name | Type | Description | Required | Notes
|
||||
------------- | ------------- | ------------- | ------------- | -------------
|
||||
**username** | **String** | The name that needs to be fetched. Use user1 for testing. | [required] |
|
||||
**dummy_required_nullable_param** | Option<**String**> | To test nullable required parameters | [required] |
|
||||
**uppercase** | Option<**String**> | To test parameter names in upper case | |
|
||||
|
||||
### Return type
|
||||
|
||||
(empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
[[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)
|
||||
|
@ -0,0 +1,11 @@
|
||||
# PropertyTest
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**uuid** | Option<[**uuid::Uuid**](uuid::Uuid.md)> | | [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)
|
||||
|
||||
|
@ -0,0 +1,60 @@
|
||||
# \TestingApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**tests_file_response_get**](TestingApi.md#tests_file_response_get) | **GET** /tests/fileResponse | Returns an image file
|
||||
[**tests_type_testing_get**](TestingApi.md#tests_type_testing_get) | **GET** /tests/typeTesting | Route to test the TypeTesting schema
|
||||
|
||||
|
||||
|
||||
## tests_file_response_get
|
||||
|
||||
> std::path::PathBuf tests_file_response_get()
|
||||
Returns an image file
|
||||
|
||||
### Parameters
|
||||
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
[**std::path::PathBuf**](std::path::PathBuf.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: image/jpeg
|
||||
|
||||
[[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)
|
||||
|
||||
|
||||
## tests_type_testing_get
|
||||
|
||||
> crate::models::TypeTesting tests_type_testing_get()
|
||||
Route to test the TypeTesting schema
|
||||
|
||||
### Parameters
|
||||
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
[**crate::models::TypeTesting**](TypeTesting.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### 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)
|
||||
|
@ -0,0 +1,17 @@
|
||||
# TypeTesting
|
||||
|
||||
## Properties
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**int32** | **i32** | |
|
||||
**int64** | **i64** | |
|
||||
**float** | **f32** | |
|
||||
**double** | **f64** | |
|
||||
**string** | **String** | |
|
||||
**boolean** | **bool** | |
|
||||
**uuid** | [**uuid::Uuid**](uuid::Uuid.md) | |
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
|
||||
use reqwest;
|
||||
|
||||
use crate::apis::ResponseContent;
|
||||
use super::{Error, configuration};
|
||||
|
||||
|
||||
/// struct for typed errors of method [`test_nullable_required_param`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum TestNullableRequiredParamError {
|
||||
Status400(),
|
||||
Status404(),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
pub fn test_nullable_required_param(configuration: &configuration::Configuration, username: &str, dummy_required_nullable_param: Option<&str>, uppercase: Option<&str>) -> Result<(), Error<TestNullableRequiredParamError>> {
|
||||
let local_var_configuration = configuration;
|
||||
|
||||
let local_var_client = &local_var_configuration.client;
|
||||
|
||||
let local_var_uri_str = format!("{}/fake/user/{username}", local_var_configuration.base_path, username=crate::apis::urlencode(username));
|
||||
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());
|
||||
}
|
||||
match dummy_required_nullable_param {
|
||||
Some(local_var_param_value) => { local_var_req_builder = local_var_req_builder.header("dummy_required_nullable_param", local_var_param_value.to_string()); },
|
||||
None => { local_var_req_builder = local_var_req_builder.header("dummy_required_nullable_param", ""); },
|
||||
}
|
||||
if let Some(local_var_param_value) = uppercase {
|
||||
local_var_req_builder = local_var_req_builder.header("UPPERCASE", local_var_param_value.to_string());
|
||||
}
|
||||
|
||||
let local_var_req = local_var_req_builder.build()?;
|
||||
let mut local_var_resp = local_var_client.execute(local_var_req)?;
|
||||
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text()?;
|
||||
|
||||
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||
Ok(())
|
||||
} else {
|
||||
let local_var_entity: Option<TestNullableRequiredParamError> = 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))
|
||||
}
|
||||
}
|
||||
|
@ -65,8 +65,10 @@ pub fn urlencode<T: AsRef<str>>(s: T) -> String {
|
||||
::url::form_urlencoded::byte_serialize(s.as_ref().as_bytes()).collect()
|
||||
}
|
||||
|
||||
pub mod fake_api;
|
||||
pub mod pet_api;
|
||||
pub mod store_api;
|
||||
pub mod testing_api;
|
||||
pub mod user_api;
|
||||
|
||||
pub mod configuration;
|
||||
|
@ -0,0 +1,86 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
|
||||
use reqwest;
|
||||
|
||||
use crate::apis::ResponseContent;
|
||||
use super::{Error, configuration};
|
||||
|
||||
|
||||
/// struct for typed errors of method [`tests_file_response_get`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum TestsFileResponseGetError {
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`tests_type_testing_get`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum TestsTypeTestingGetError {
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
|
||||
pub fn tests_file_response_get(configuration: &configuration::Configuration, ) -> Result<std::path::PathBuf, Error<TestsFileResponseGetError>> {
|
||||
let local_var_configuration = configuration;
|
||||
|
||||
let local_var_client = &local_var_configuration.client;
|
||||
|
||||
let local_var_uri_str = format!("{}/tests/fileResponse", local_var_configuration.base_path);
|
||||
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 mut local_var_resp = local_var_client.execute(local_var_req)?;
|
||||
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text()?;
|
||||
|
||||
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<TestsFileResponseGetError> = 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 fn tests_type_testing_get(configuration: &configuration::Configuration, ) -> Result<crate::models::TypeTesting, Error<TestsTypeTestingGetError>> {
|
||||
let local_var_configuration = configuration;
|
||||
|
||||
let local_var_client = &local_var_configuration.client;
|
||||
|
||||
let local_var_uri_str = format!("{}/tests/typeTesting", local_var_configuration.base_path);
|
||||
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 mut local_var_resp = local_var_client.execute(local_var_req)?;
|
||||
|
||||
let local_var_status = local_var_resp.status();
|
||||
let local_var_content = local_var_resp.text()?;
|
||||
|
||||
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<TestsTypeTestingGetError> = 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))
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
|
||||
pub struct ActionContainer {
|
||||
#[serde(rename = "action")]
|
||||
pub action: Box<crate::models::Baz>,
|
||||
}
|
||||
|
||||
impl ActionContainer {
|
||||
pub fn new(action: crate::models::Baz) -> ActionContainer {
|
||||
ActionContainer {
|
||||
action: Box::new(action),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
|
||||
///
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
|
||||
pub enum Baz {
|
||||
#[serde(rename = "A")]
|
||||
A,
|
||||
#[serde(rename = "B")]
|
||||
B,
|
||||
|
||||
}
|
||||
|
||||
impl ToString for Baz {
|
||||
fn to_string(&self) -> String {
|
||||
match self {
|
||||
Self::A => String::from("A"),
|
||||
Self::B => String::from("B"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Baz {
|
||||
fn default() -> Baz {
|
||||
Self::A
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,12 +1,20 @@
|
||||
pub mod action_container;
|
||||
pub use self::action_container::ActionContainer;
|
||||
pub mod api_response;
|
||||
pub use self::api_response::ApiResponse;
|
||||
pub mod baz;
|
||||
pub use self::baz::Baz;
|
||||
pub mod category;
|
||||
pub use self::category::Category;
|
||||
pub mod order;
|
||||
pub use self::order::Order;
|
||||
pub mod pet;
|
||||
pub use self::pet::Pet;
|
||||
pub mod property_test;
|
||||
pub use self::property_test::PropertyTest;
|
||||
pub mod tag;
|
||||
pub use self::tag::Tag;
|
||||
pub mod type_testing;
|
||||
pub use self::type_testing::TypeTesting;
|
||||
pub mod user;
|
||||
pub use self::user::User;
|
||||
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/// PropertyTest : A model to test various formats, e.g. UUID
|
||||
|
||||
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
|
||||
pub struct PropertyTest {
|
||||
#[serde(rename = "uuid", skip_serializing_if = "Option::is_none")]
|
||||
pub uuid: Option<uuid::Uuid>,
|
||||
}
|
||||
|
||||
impl PropertyTest {
|
||||
/// A model to test various formats, e.g. UUID
|
||||
pub fn new() -> PropertyTest {
|
||||
PropertyTest {
|
||||
uuid: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
*
|
||||
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.0.0
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
/// TypeTesting : Test handling of different field data types
|
||||
|
||||
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
|
||||
pub struct TypeTesting {
|
||||
#[serde(rename = "int32")]
|
||||
pub int32: i32,
|
||||
#[serde(rename = "int64")]
|
||||
pub int64: i64,
|
||||
#[serde(rename = "float")]
|
||||
pub float: f32,
|
||||
#[serde(rename = "double")]
|
||||
pub double: f64,
|
||||
#[serde(rename = "string")]
|
||||
pub string: String,
|
||||
#[serde(rename = "boolean")]
|
||||
pub boolean: bool,
|
||||
#[serde(rename = "uuid")]
|
||||
pub uuid: uuid::Uuid,
|
||||
}
|
||||
|
||||
impl TypeTesting {
|
||||
/// Test handling of different field data types
|
||||
pub fn new(int32: i32, int64: i64, float: f32, double: f64, string: String, boolean: bool, uuid: uuid::Uuid) -> TypeTesting {
|
||||
TypeTesting {
|
||||
int32,
|
||||
int64,
|
||||
float,
|
||||
double,
|
||||
string,
|
||||
boolean,
|
||||
uuid,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user