[Rust] [Fix #3052] Handle optional and nullable parameters (#4016)

This PR includes theses changes:

- Handling "optional" parameters is not optional anymore. Handling an additional parameter for it makes templates more complicated, and IMO, it is not worth it (as discussed in issue, it is an "acceptable" breaking change).
- Optional parameters are handled everywhere: path params, query params, form params... Generated sample code compiles (both hyper and reqwest libraries).
This commit is contained in:
Benoît Courtine
2019-10-15 14:59:37 +02:00
committed by Benjamin Gill
parent c1d5fe0c77
commit dd08ea7a6b
42 changed files with 485 additions and 242 deletions

View File

@@ -25,7 +25,7 @@ Method | HTTP request | Description
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}
{{#allParams}}
**{{{paramName}}}** | {{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{{dataType}}}**]({{{baseType}}}.md){{/isPrimitiveType}} | {{{description}}} | {{#required}}Required{{/required}} | {{#defaultValue}}[default to {{{defaultValue}}}]{{/defaultValue}}
**{{{paramName}}}** | {{^required}}Option<{{/required}}{{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{{dataType}}}**]({{{baseType}}}.md){{/isPrimitiveType}}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}} | {{{description}}} | {{#required}}[required]{{/required}} |{{#defaultValue}}[default to {{{defaultValue}}}]{{/defaultValue}}
{{/allParams}}
### Return type

View File

@@ -1,6 +1,8 @@
{{>partial_header}}
use std::rc::Rc;
use std::borrow::Borrow;
#[allow(unused_imports)]
use std::option::Option;
use hyper;
use serde_json;
@@ -24,17 +26,16 @@ impl<C: hyper::client::Connect> {{{classname}}}Client<C> {
pub trait {{{classname}}} {
{{#operations}}
{{#operation}}
fn {{{operationId}}}(&self, {{#allParams}}{{{paramName}}}: {{#isString}}&str{{/isString}}{{#isUuid}}&str{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}crate::models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Box<dyn Future<Item = {{^returnType}}(){{/returnType}}{{#returnType}}{{{returnType}}}{{/returnType}}, Error = Error<serde_json::Value>>>;
fn {{{operationId}}}(&self, {{#allParams}}{{{paramName}}}: {{^required}}Option<{{/required}}{{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{#isString}}&str{{/isString}}{{#isUuid}}&str{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}crate::models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Box<dyn Future<Item = {{^returnType}}(){{/returnType}}{{#returnType}}{{{returnType}}}{{/returnType}}, Error = Error<serde_json::Value>>>;
{{/operation}}
{{/operations}}
}
impl<C: hyper::client::Connect>{{{classname}}} for {{{classname}}}Client<C> {
{{#operations}}
{{#operation}}
fn {{{operationId}}}(&self, {{#allParams}}{{{paramName}}}: {{#isString}}&str{{/isString}}{{#isUuid}}&str{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}crate::models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Box<dyn Future<Item = {{^returnType}}(){{/returnType}}{{#returnType}}{{{.}}}{{/returnType}}, Error = Error<serde_json::Value>>> {
__internal_request::Request::new(hyper::Method::{{{httpMethod}}}, "{{{path}}}".to_string())
fn {{{operationId}}}(&self, {{#allParams}}{{{paramName}}}: {{^required}}Option<{{/required}}{{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{#isString}}&str{{/isString}}{{#isUuid}}&str{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}crate::models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Box<dyn Future<Item = {{^returnType}}(){{/returnType}}{{#returnType}}{{{.}}}{{/returnType}}, Error = Error<serde_json::Value>>> {
let mut req = __internal_request::Request::new(hyper::Method::{{{httpMethod}}}, "{{{path}}}".to_string())
{{#hasAuthMethods}}
{{#authMethods}}
{{#isApiKey}}
@@ -52,36 +53,113 @@ impl<C: hyper::client::Connect>{{{classname}}} for {{{classname}}}Client<C> {
{{/isOAuth}}
{{/authMethods}}
{{/hasAuthMethods}}
;
{{#queryParams}}
.with_query_param("{{{baseName}}}".to_string(), {{{paramName}}}{{#isListContainer}}.join(","){{/isListContainer}}.to_string())
{{#required}}
{{^isNullable}}
req = req.with_query_param("{{{baseName}}}".to_string(), {{{paramName}}}{{#isListContainer}}.join(","){{/isListContainer}}.to_string());
{{/isNullable}}
{{#isNullable}}
match {{{paramName}}} {
Some(param_value) => { req = req.with_query_param("{{{baseName}}}".to_string(), param_value{{#isListContainer}}.join(","){{/isListContainer}}.to_string()); },
None => { req = req.with_query_param("{{{baseName}}}".to_string(), "".to_string()); },
}
{{/isNullable}}
{{/required}}
{{^required}}
if let Some(ref s) = {{{paramName}}} {
req = req.with_query_param("{{{baseName}}}".to_string(), s{{#isListContainer}}.join(","){{/isListContainer}}.to_string());
}
{{/required}}
{{/queryParams}}
{{#pathParams}}
.with_path_param("{{{baseName}}}".to_string(), {{{paramName}}}{{#isListContainer}}.join(","){{/isListContainer}}.to_string())
{{#required}}
{{^isNullable}}
req = req.with_path_param("{{{baseName}}}".to_string(), {{{paramName}}}{{#isListContainer}}.join(","){{/isListContainer}}.to_string());
{{/isNullable}}
{{#isNullable}}
match {{{paramName}}} {
Some(param_value) => { req = req.with_path_param("{{{baseName}}}".to_string(), param_value{{#isListContainer}}.join(","){{/isListContainer}}.to_string()); },
None => { req = req.with_path_param("{{{baseName}}}".to_string(), "".to_string()); },
}
{{/isNullable}}
{{/required}}
{{^required}}
if let Some(param_value) = {{{paramName}}} {
req = req.with_path_param("{{{baseName}}}".to_string(), param_value{{#isListContainer}}.join(","){{/isListContainer}}.to_string());
}
{{/required}}
{{/pathParams}}
{{#hasHeaderParams}}
{{#headerParams}}
.with_header_param("{{{baseName}}}".to_string(), {{{paramName}}}{{#isListContainer}}.join(","){{/isListContainer}}.to_string())
{{#required}}
{{^isNullable}}
req = req.with_header_param("{{{baseName}}}".to_string(), {{{paramName}}}{{#isListContainer}}.join(","){{/isListContainer}}.to_string());
{{/isNullable}}
{{#isNullable}}
match {{{paramName}}} {
Some(param_value) => { req = req.with_header_param("{{{baseName}}}".to_string(), param_value{{#isListContainer}}.join(","){{/isListContainer}}.to_string()); },
None => { req = req.with_header_param("{{{baseName}}}".to_string(), "".to_string()); },
}
{{/isNullable}}
{{/required}}
{{^required}}
if let Some(param_value) = {{{paramName}}} {
req = req.with_header_param("{{{baseName}}}".to_string(), param_value{{#isListContainer}}.join(","){{/isListContainer}}.to_string());
}
{{/required}}
{{/headerParams}}
{{/hasHeaderParams}}
{{#hasFormParams}}
{{#formParams}}
{{#isFile}}
.with_form_param("{{{baseName}}}".to_string(), unimplemented!())
{{#required}}
{{^isNullable}}
req = req.with_form_param("{{{baseName}}}".to_string(), unimplemented!());
{{/isNullable}}
{{#isNullable}}
match {{{paramName}}} {
Some(param_value) => { req = req.with_form_param("{{{baseName}}}".to_string(), unimplemented!()); },
None => { req = req.with_form_param("{{{baseName}}}".to_string(), unimplemented!()); },
}
{{/isNullable}}
{{/required}}
{{^required}}
if let Some(param_value) = {{{paramName}}} {
req = req.with_form_param("{{{baseName}}}".to_string(), unimplemented!());
}
{{/required}}
{{/isFile}}
{{^isFile}}
.with_form_param("{{{baseName}}}".to_string(), {{{paramName}}}{{#isListContainer}}.join(","){{/isListContainer}}.to_string())
{{#required}}
{{^isNullable}}
req = req.with_form_param("{{{baseName}}}".to_string(), {{{paramName}}}{{#isListContainer}}.join(","){{/isListContainer}}.to_string());
{{/isNullable}}
{{#isNullable}}
match {{{paramName}}} {
Some(param_value) => { req = req.with_form_param("{{{baseName}}}".to_string(), param_value{{#isListContainer}}.join(","){{/isListContainer}}.to_string()); },
None => { req = req.with_form_param("{{{baseName}}}".to_string(), "".to_string()); },
}
{{/isNullable}}
{{/required}}
{{^required}}
if let Some(param_value) = {{{paramName}}} {
req = req.with_form_param("{{{baseName}}}".to_string(), param_value{{#isListContainer}}.join(","){{/isListContainer}}.to_string());
}
{{/required}}
{{/isFile}}
{{/formParams}}
{{/hasFormParams}}
{{#hasBodyParam}}
{{#bodyParams}}
.with_body_param({{{paramName}}})
req = req.with_body_param({{{paramName}}});
{{/bodyParams}}
{{/hasBodyParam}}
{{^returnType}}
.returns_nothing()
req = req.returns_nothing();
{{/returnType}}
.execute(self.configuration.borrow())
req.execute(self.configuration.borrow())
}
{{/operation}}

View File

@@ -4,7 +4,7 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
{{#vars}}**{{{name}}}** | {{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{^isContainer}}{{^isDateTime}}*{{/isDateTime}}{{/isContainer}}{{{dataType}}}**]({{{complexType}}}.md){{/isPrimitiveType}} | {{{description}}} | {{^required}}[optional] {{/required}}{{#isReadOnly}}[readonly] {{/isReadOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}}
{{#vars}}**{{{name}}}** | {{^required}}Option<{{/required}}{{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{{dataType}}}**]({{{complexType}}}.md){{/isPrimitiveType}}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}} | {{{description}}} | {{^required}}[optional]{{/required}}{{#isReadOnly}}[readonly]{{/isReadOnly}}{{#defaultValue}}[default to {{{defaultValue}}}]{{/defaultValue}}
{{/vars}}
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -1,6 +1,8 @@
{{>partial_header}}
use std::rc::Rc;
use std::borrow::Borrow;
#[allow(unused_imports)]
use std::option::Option;
use reqwest;
@@ -21,7 +23,7 @@ impl {{{classname}}}Client {
pub trait {{{classname}}} {
{{#operations}}
{{#operation}}
fn {{{operationId}}}(&self, {{#allParams}}{{{paramName}}}: {{#isString}}&str{{/isString}}{{#isUuid}}&str{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}crate::models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Result<{{^returnType}}(){{/returnType}}{{#returnType}}{{{returnType}}}{{/returnType}}, Error>;
fn {{{operationId}}}(&self, {{#allParams}}{{{paramName}}}: {{^required}}Option<{{/required}}{{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{#isString}}&str{{/isString}}{{#isUuid}}&str{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}crate::models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Result<{{^returnType}}(){{/returnType}}{{#returnType}}{{{returnType}}}{{/returnType}}, Error>;
{{/operation}}
{{/operations}}
}
@@ -29,15 +31,22 @@ pub trait {{{classname}}} {
impl {{{classname}}} for {{{classname}}}Client {
{{#operations}}
{{#operation}}
fn {{{operationId}}}(&self, {{#allParams}}{{{paramName}}}: {{#isString}}&str{{/isString}}{{#isUuid}}&str{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}crate::models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Result<{{^returnType}}(){{/returnType}}{{#returnType}}{{{returnType}}}{{/returnType}}, Error> {
fn {{{operationId}}}(&self, {{#allParams}}{{{paramName}}}: {{^required}}Option<{{/required}}{{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{#isString}}&str{{/isString}}{{#isUuid}}&str{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}crate::models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Result<{{^returnType}}(){{/returnType}}{{#returnType}}{{{returnType}}}{{/returnType}}, Error> {
let configuration: &configuration::Configuration = self.configuration.borrow();
let client = &configuration.client;
let uri_str = format!("{}{{{path}}}", configuration.base_path{{#pathParams}}, {{{baseName}}}={{#isString}}crate::apis::urlencode({{/isString}}{{{paramName}}}{{#isListContainer}}.join(",").as_ref(){{/isListContainer}}{{#isString}}){{/isString}}{{/pathParams}});
let uri_str = format!("{}{{{path}}}", configuration.base_path{{#pathParams}}, {{{baseName}}}={{#isString}}crate::apis::urlencode({{/isString}}{{{paramName}}}{{^required}}.unwrap(){{/required}}{{#required}}{{#isNullable}}.unwrap(){{/isNullable}}{{/required}}{{#isListContainer}}.join(",").as_ref(){{/isListContainer}}{{#isString}}){{/isString}}{{/pathParams}});
let mut req_builder = client.{{{httpMethod}}}(uri_str.as_str());
{{#queryParams}}
{{#required}}
req_builder = req_builder.query(&[("{{{baseName}}}", &{{{paramName}}}{{#isListContainer}}.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(","){{/isListContainer}}.to_string())]);
{{/required}}
{{^required}}
if let Some(ref s) = {{{paramName}}} {
req_builder = req_builder.query(&[("{{{baseName}}}", &s{{#isListContainer}}.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(","){{/isListContainer}}.to_string())]);
}
{{/required}}
{{/queryParams}}
{{#hasAuthMethods}}
{{#authMethods}}
@@ -60,7 +69,22 @@ impl {{{classname}}} for {{{classname}}}Client {
}
{{#hasHeaderParams}}
{{#headerParams}}
{{#required}}
{{^isNullable}}
req_builder = req_builder.header("{{{baseName}}}", {{{paramName}}}{{#isListContainer}}.join(","){{/isListContainer}}.to_string());
{{/isNullable}}
{{#isNullable}}
match {{{paramName}}} {
Some(param_value) => { req_builder = req_builder.header("{{{baseName}}}", param_value{{#isListContainer}}.join(","){{/isListContainer}}.to_string()); },
None => { req_builder = req_builder.header("{{{baseName}}}", ""); },
}
{{/isNullable}}
{{/required}}
{{^required}}
if let Some(param_value) = {{{paramName}}} {
req_builder = req_builder.header("{{{baseName}}}", param_value{{#isListContainer}}.join(","){{/isListContainer}}.to_string());
}
{{/required}}
{{/headerParams}}
{{/hasHeaderParams}}
{{#hasAuthMethods}}
@@ -98,13 +122,43 @@ impl {{{classname}}} for {{{classname}}}Client {
{{/hasAuthMethods}}
{{#isMultipart}}
{{#hasFormParams}}
let form = reqwest::multipart::Form::new()
let mut form = reqwest::multipart::Form::new();
{{#formParams}}
{{#isFile}}
.file("{{{baseName}}}", {{{paramName}}})?{{#-last}};{{/-last}}
{{#required}}
{{^isNullable}}
form = form.file("{{{baseName}}}", {{{paramName}}})?;
{{/isNullable}}
{{#isNullable}}
match {{{paramName}}} {
Some(param_value) => { form = form.file("{{{baseName}}}", param_value)?; },
None => { unimplemented!("Required nullable form file param not supported"); },
}
{{/isNullable}}
{{/required}}
{{^required}}
if let Some(param_value) = {{{paramName}}} {
form = form.file("{{{baseName}}}", param_value)?;
}
{{/required}}
{{/isFile}}
{{^isFile}}
.text("{{{baseName}}}", {{{paramName}}}{{#isListContainer}}.join(","){{/isListContainer}}.to_string()){{#-last}};{{/-last}}
{{#required}}
{{^isNullable}}
form = form.text("{{{baseName}}}", {{{paramName}}}{{#isListContainer}}.join(","){{/isListContainer}}.to_string());
{{/isNullable}}
{{#isNullable}}
match {{{paramName}}} {
Some(param_value) => { form = form.text("{{{baseName}}}", param_value{{#isListContainer}}.join(","){{/isListContainer}}.to_string()); },
None => { form = form.text("{{{baseName}}}", ""); },
}
{{/isNullable}}
{{/required}}
{{^required}}
if let Some(param_value) = {{{paramName}}} {
form = form.text("{{{baseName}}}", param_value{{#isListContainer}}.join(","){{/isListContainer}}.to_string());
}
{{/required}}
{{/isFile}}
{{/formParams}}
req_builder = req_builder.multipart(form);
@@ -115,10 +169,40 @@ impl {{{classname}}} for {{{classname}}}Client {
let mut form_params = std::collections::HashMap::new();
{{#formParams}}
{{#isFile}}
{{#required}}
{{^isNullable}}
form_params.insert("{{{baseName}}}", unimplemented!("File form param not supported with x-www-form-urlencoded content"));
{{/isNullable}}
{{#isNullable}}
match {{{paramName}}} {
Some(param_value) => { form_params.insert("{{{baseName}}}", unimplemented!("File form param not supported with x-www-form-urlencoded content")); },
None => { unimplemented!("Required nullable file form param not supported with x-www-form-urlencoded content"); },
}
{{/isNullable}}
{{/required}}
{{^required}}
if let Some(param_value) = {{{paramName}}} {
form_params.insert("{{{baseName}}}", unimplemented!("File form param not supported with x-www-form-urlencoded content"));
}
{{/required}}
{{/isFile}}
{{^isFile}}
{{#required}}
{{^isNullable}}
form_params.insert("{{{baseName}}}", {{{paramName}}}{{#isListContainer}}.join(","){{/isListContainer}}.to_string());
{{/isNullable}}
{{#isNullable}}
match {{{paramName}}} {
Some(param_value) => { form_params.insert("{{{baseName}}}", param_value{{#isListContainer}}.join(","){{/isListContainer}}.to_string()); },
None => { form_params.insert("{{{baseName}}}", ""); },
}
{{/isNullable}}
{{/required}}
{{^required}}
if let Some(param_value) = {{{paramName}}} {
form_params.insert("{{{baseName}}}", param_value{{#isListContainer}}.join(","){{/isListContainer}}.to_string());
}
{{/required}}
{{/isFile}}
{{/formParams}}
req_builder = req_builder.form(&form_params);

View File

@@ -0,0 +1 @@
4.0.3-SNAPSHOT

View File

@@ -0,0 +1 @@
4.0.3-SNAPSHOT

View File

@@ -1 +1 @@
4.1.3-SNAPSHOT
4.2.0-SNAPSHOT

View File

@@ -10,6 +10,8 @@
use std::rc::Rc;
use std::borrow::Borrow;
#[allow(unused_imports)]
use std::option::Option;
use hyper;
use serde_json;
@@ -34,11 +36,12 @@ 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>>> {
__internal_request::Request::new(hyper::Method::Get, "/tests/fileResponse".to_string())
.execute(self.configuration.borrow())
let mut req = __internal_request::Request::new(hyper::Method::Get, "/tests/fileResponse".to_string())
;
req.execute(self.configuration.borrow())
}
}

View File

@@ -1 +1 @@
4.1.3-SNAPSHOT
4.2.0-SNAPSHOT

View File

@@ -4,9 +4,9 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**code** | **i32** | | [optional]
**_type** | **String** | | [optional]
**message** | **String** | | [optional]
**code** | Option<**i32**> | | [optional]
**_type** | Option<**String**> | | [optional]
**message** | Option<**String**> | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -4,8 +4,8 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **i64** | | [optional]
**name** | **String** | | [optional]
**id** | Option<**i64**> | | [optional]
**name** | Option<**String**> | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -4,12 +4,12 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **i64** | | [optional]
**pet_id** | **i64** | | [optional]
**quantity** | **i32** | | [optional]
**ship_date** | **String** | | [optional]
**status** | **String** | Order Status | [optional]
**complete** | **bool** | | [optional] [default to false]
**id** | Option<**i64**> | | [optional]
**pet_id** | Option<**i64**> | | [optional]
**quantity** | Option<**i32**> | | [optional]
**ship_date** | Option<**String**> | | [optional]
**status** | Option<**String**> | Order Status | [optional]
**complete** | Option<**bool**> | | [optional][default to false]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -4,12 +4,12 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **i64** | | [optional]
**category** | [***crate::models::Category**](Category.md) | | [optional]
**id** | Option<**i64**> | | [optional]
**category** | Option<[**crate::models::Category**](Category.md)> | | [optional]
**name** | **String** | |
**photo_urls** | **Vec<String>** | |
**tags** | [**Vec<crate::models::Tag>**](Tag.md) | | [optional]
**status** | **String** | pet status in the store | [optional]
**tags** | Option<[**Vec<crate::models::Tag>**](Tag.md)> | | [optional]
**status** | Option<**String**> | pet status in the store | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -25,7 +25,7 @@ Add a new pet to the store
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**body** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | Required |
**body** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | [required] |
### Return type
@@ -53,8 +53,8 @@ Deletes a pet
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**pet_id** | **i64** | Pet id to delete | Required |
**api_key** | **String** | | |
**pet_id** | **i64** | Pet id to delete | [required] |
**api_key** | Option<**String**> | | |
### Return type
@@ -84,7 +84,7 @@ Multiple status values can be provided with comma separated strings
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**status** | [**Vec<String>**](String.md) | Status values that need to be considered for filter | Required |
**status** | [**Vec<String>**](String.md) | Status values that need to be considered for filter | [required] |
### Return type
@@ -114,7 +114,7 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**tags** | [**Vec<String>**](String.md) | Tags to filter by | Required |
**tags** | [**Vec<String>**](String.md) | Tags to filter by | [required] |
### Return type
@@ -144,7 +144,7 @@ Returns a single pet
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**pet_id** | **i64** | ID of pet to return | Required |
**pet_id** | **i64** | ID of pet to return | [required] |
### Return type
@@ -172,7 +172,7 @@ Update an existing pet
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**body** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | Required |
**body** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | [required] |
### Return type
@@ -200,9 +200,9 @@ Updates a pet in the store with form data
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**pet_id** | **i64** | ID of pet that needs to be updated | Required |
**name** | **String** | Updated name of the pet | |
**status** | **String** | Updated status of the pet | |
**pet_id** | **i64** | ID of pet that needs to be updated | [required] |
**name** | Option<**String**> | Updated name of the pet | |
**status** | Option<**String**> | Updated status of the pet | |
### Return type
@@ -230,9 +230,9 @@ uploads an image
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**pet_id** | **i64** | ID of pet to update | Required |
**additional_metadata** | **String** | Additional data to pass to server | |
**file** | **std::path::PathBuf** | file to upload | |
**pet_id** | **i64** | ID of pet to update | [required] |
**additional_metadata** | Option<**String**> | Additional data to pass to server | |
**file** | Option<**std::path::PathBuf**> | file to upload | |
### Return type

View File

@@ -23,7 +23,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**order_id** | **String** | ID of the order that needs to be deleted | Required |
**order_id** | **String** | ID of the order that needs to be deleted | [required] |
### Return type
@@ -80,7 +80,7 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**order_id** | **i64** | ID of pet that needs to be fetched | Required |
**order_id** | **i64** | ID of pet that needs to be fetched | [required] |
### Return type
@@ -108,7 +108,7 @@ Place an order for a pet
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**body** | [**Order**](Order.md) | order placed for purchasing the pet | Required |
**body** | [**Order**](Order.md) | order placed for purchasing the pet | [required] |
### Return type

View File

@@ -4,8 +4,8 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **i64** | | [optional]
**name** | **String** | | [optional]
**id** | Option<**i64**> | | [optional]
**name** | Option<**String**> | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -4,14 +4,14 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **i64** | | [optional]
**username** | **String** | | [optional]
**first_name** | **String** | | [optional]
**last_name** | **String** | | [optional]
**email** | **String** | | [optional]
**password** | **String** | | [optional]
**phone** | **String** | | [optional]
**user_status** | **i32** | User Status | [optional]
**id** | Option<**i64**> | | [optional]
**username** | Option<**String**> | | [optional]
**first_name** | Option<**String**> | | [optional]
**last_name** | Option<**String**> | | [optional]
**email** | Option<**String**> | | [optional]
**password** | Option<**String**> | | [optional]
**phone** | Option<**String**> | | [optional]
**user_status** | Option<**i32**> | User Status | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -27,7 +27,7 @@ This can only be done by the logged in user.
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**body** | [**User**](User.md) | Created user object | Required |
**body** | [**User**](User.md) | Created user object | [required] |
### Return type
@@ -55,7 +55,7 @@ Creates list of users with given input array
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**body** | [**Vec<crate::models::User>**](User.md) | List of user object | Required |
**body** | [**Vec<crate::models::User>**](User.md) | List of user object | [required] |
### Return type
@@ -83,7 +83,7 @@ Creates list of users with given input array
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**body** | [**Vec<crate::models::User>**](User.md) | List of user object | Required |
**body** | [**Vec<crate::models::User>**](User.md) | List of user object | [required] |
### Return type
@@ -113,7 +113,7 @@ This can only be done by the logged in user.
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**username** | **String** | The name that needs to be deleted | Required |
**username** | **String** | The name that needs to be deleted | [required] |
### Return type
@@ -141,7 +141,7 @@ Get user by user name
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**username** | **String** | The name that needs to be fetched. Use user1 for testing. | Required |
**username** | **String** | The name that needs to be fetched. Use user1 for testing. | [required] |
### Return type
@@ -169,8 +169,8 @@ Logs user into the system
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**username** | **String** | The user name for login | Required |
**password** | **String** | The password for login in clear text | Required |
**username** | **String** | The user name for login | [required] |
**password** | **String** | The password for login in clear text | [required] |
### Return type
@@ -225,8 +225,8 @@ This can only be done by the logged in user.
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**username** | **String** | name that need to be deleted | Required |
**body** | [**User**](User.md) | Updated user object | Required |
**username** | **String** | name that need to be deleted | [required] |
**body** | [**User**](User.md) | Updated user object | [required] |
### Return type

View File

@@ -10,6 +10,8 @@
use std::rc::Rc;
use std::borrow::Borrow;
#[allow(unused_imports)]
use std::option::Option;
use hyper;
use serde_json;
@@ -32,84 +34,109 @@ impl<C: hyper::client::Connect> PetApiClient<C> {
pub trait PetApi {
fn add_pet(&self, body: crate::models::Pet) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>>;
fn delete_pet(&self, pet_id: i64, api_key: &str) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>>;
fn delete_pet(&self, pet_id: i64, api_key: Option<&str>) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>>;
fn find_pets_by_status(&self, status: Vec<String>) -> Box<dyn Future<Item = Vec<crate::models::Pet>, Error = Error<serde_json::Value>>>;
fn find_pets_by_tags(&self, tags: Vec<String>) -> Box<dyn Future<Item = Vec<crate::models::Pet>, Error = Error<serde_json::Value>>>;
fn get_pet_by_id(&self, pet_id: i64) -> Box<dyn Future<Item = crate::models::Pet, Error = Error<serde_json::Value>>>;
fn update_pet(&self, body: crate::models::Pet) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>>;
fn update_pet_with_form(&self, pet_id: i64, name: &str, status: &str) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>>;
fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: std::path::PathBuf) -> Box<dyn Future<Item = crate::models::ApiResponse, Error = Error<serde_json::Value>>>;
fn update_pet_with_form(&self, pet_id: i64, name: Option<&str>, status: Option<&str>) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>>;
fn upload_file(&self, pet_id: i64, additional_metadata: Option<&str>, file: Option<std::path::PathBuf>) -> Box<dyn Future<Item = crate::models::ApiResponse, Error = Error<serde_json::Value>>>;
}
impl<C: hyper::client::Connect>PetApi for PetApiClient<C> {
fn add_pet(&self, body: crate::models::Pet) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>> {
__internal_request::Request::new(hyper::Method::Post, "/pet".to_string())
let mut req = __internal_request::Request::new(hyper::Method::Post, "/pet".to_string())
.with_auth(__internal_request::Auth::Oauth)
.with_body_param(body)
.returns_nothing()
.execute(self.configuration.borrow())
;
req = req.with_body_param(body);
req = req.returns_nothing();
req.execute(self.configuration.borrow())
}
fn delete_pet(&self, pet_id: i64, api_key: &str) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>> {
__internal_request::Request::new(hyper::Method::Delete, "/pet/{petId}".to_string())
fn delete_pet(&self, pet_id: i64, api_key: Option<&str>) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>> {
let mut req = __internal_request::Request::new(hyper::Method::Delete, "/pet/{petId}".to_string())
.with_auth(__internal_request::Auth::Oauth)
.with_path_param("petId".to_string(), pet_id.to_string())
.with_header_param("api_key".to_string(), api_key.to_string())
.returns_nothing()
.execute(self.configuration.borrow())
;
req = req.with_path_param("petId".to_string(), pet_id.to_string());
if let Some(param_value) = api_key {
req = req.with_header_param("api_key".to_string(), param_value.to_string());
}
req = req.returns_nothing();
req.execute(self.configuration.borrow())
}
fn find_pets_by_status(&self, status: Vec<String>) -> Box<dyn Future<Item = Vec<crate::models::Pet>, Error = Error<serde_json::Value>>> {
__internal_request::Request::new(hyper::Method::Get, "/pet/findByStatus".to_string())
let mut req = __internal_request::Request::new(hyper::Method::Get, "/pet/findByStatus".to_string())
.with_auth(__internal_request::Auth::Oauth)
.with_query_param("status".to_string(), status.join(",").to_string())
.execute(self.configuration.borrow())
;
req = req.with_query_param("status".to_string(), status.join(",").to_string());
req.execute(self.configuration.borrow())
}
fn find_pets_by_tags(&self, tags: Vec<String>) -> Box<dyn Future<Item = Vec<crate::models::Pet>, Error = Error<serde_json::Value>>> {
__internal_request::Request::new(hyper::Method::Get, "/pet/findByTags".to_string())
let mut req = __internal_request::Request::new(hyper::Method::Get, "/pet/findByTags".to_string())
.with_auth(__internal_request::Auth::Oauth)
.with_query_param("tags".to_string(), tags.join(",").to_string())
.execute(self.configuration.borrow())
;
req = req.with_query_param("tags".to_string(), tags.join(",").to_string());
req.execute(self.configuration.borrow())
}
fn get_pet_by_id(&self, pet_id: i64) -> Box<dyn Future<Item = crate::models::Pet, Error = Error<serde_json::Value>>> {
__internal_request::Request::new(hyper::Method::Get, "/pet/{petId}".to_string())
let mut req = __internal_request::Request::new(hyper::Method::Get, "/pet/{petId}".to_string())
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
in_header: true,
in_query: false,
param_name: "api_key".to_owned(),
}))
.with_path_param("petId".to_string(), pet_id.to_string())
.execute(self.configuration.borrow())
;
req = req.with_path_param("petId".to_string(), pet_id.to_string());
req.execute(self.configuration.borrow())
}
fn update_pet(&self, body: crate::models::Pet) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>> {
__internal_request::Request::new(hyper::Method::Put, "/pet".to_string())
let mut req = __internal_request::Request::new(hyper::Method::Put, "/pet".to_string())
.with_auth(__internal_request::Auth::Oauth)
.with_body_param(body)
.returns_nothing()
.execute(self.configuration.borrow())
;
req = req.with_body_param(body);
req = req.returns_nothing();
req.execute(self.configuration.borrow())
}
fn update_pet_with_form(&self, pet_id: i64, name: &str, status: &str) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>> {
__internal_request::Request::new(hyper::Method::Post, "/pet/{petId}".to_string())
fn update_pet_with_form(&self, pet_id: i64, name: Option<&str>, status: Option<&str>) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>> {
let mut req = __internal_request::Request::new(hyper::Method::Post, "/pet/{petId}".to_string())
.with_auth(__internal_request::Auth::Oauth)
.with_path_param("petId".to_string(), pet_id.to_string())
.with_form_param("name".to_string(), name.to_string())
.with_form_param("status".to_string(), status.to_string())
.returns_nothing()
.execute(self.configuration.borrow())
;
req = req.with_path_param("petId".to_string(), pet_id.to_string());
if let Some(param_value) = name {
req = req.with_form_param("name".to_string(), param_value.to_string());
}
if let Some(param_value) = status {
req = req.with_form_param("status".to_string(), param_value.to_string());
}
req = req.returns_nothing();
req.execute(self.configuration.borrow())
}
fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: std::path::PathBuf) -> Box<dyn Future<Item = crate::models::ApiResponse, Error = Error<serde_json::Value>>> {
__internal_request::Request::new(hyper::Method::Post, "/pet/{petId}/uploadImage".to_string())
fn upload_file(&self, pet_id: i64, additional_metadata: Option<&str>, file: Option<std::path::PathBuf>) -> Box<dyn Future<Item = crate::models::ApiResponse, Error = Error<serde_json::Value>>> {
let mut req = __internal_request::Request::new(hyper::Method::Post, "/pet/{petId}/uploadImage".to_string())
.with_auth(__internal_request::Auth::Oauth)
.with_path_param("petId".to_string(), pet_id.to_string())
.with_form_param("additionalMetadata".to_string(), additional_metadata.to_string())
.with_form_param("file".to_string(), unimplemented!())
.execute(self.configuration.borrow())
;
req = req.with_path_param("petId".to_string(), pet_id.to_string());
if let Some(param_value) = additional_metadata {
req = req.with_form_param("additionalMetadata".to_string(), param_value.to_string());
}
if let Some(param_value) = file {
req = req.with_form_param("file".to_string(), unimplemented!());
}
req.execute(self.configuration.borrow())
}
}

View File

@@ -10,6 +10,8 @@
use std::rc::Rc;
use std::borrow::Borrow;
#[allow(unused_imports)]
use std::option::Option;
use hyper;
use serde_json;
@@ -37,35 +39,42 @@ pub trait StoreApi {
fn place_order(&self, body: crate::models::Order) -> Box<dyn Future<Item = crate::models::Order, Error = Error<serde_json::Value>>>;
}
impl<C: hyper::client::Connect>StoreApi for StoreApiClient<C> {
fn delete_order(&self, order_id: &str) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>> {
__internal_request::Request::new(hyper::Method::Delete, "/store/order/{orderId}".to_string())
.with_path_param("orderId".to_string(), order_id.to_string())
.returns_nothing()
.execute(self.configuration.borrow())
let mut req = __internal_request::Request::new(hyper::Method::Delete, "/store/order/{orderId}".to_string())
;
req = req.with_path_param("orderId".to_string(), order_id.to_string());
req = req.returns_nothing();
req.execute(self.configuration.borrow())
}
fn get_inventory(&self, ) -> Box<dyn Future<Item = ::std::collections::HashMap<String, i32>, Error = Error<serde_json::Value>>> {
__internal_request::Request::new(hyper::Method::Get, "/store/inventory".to_string())
let mut req = __internal_request::Request::new(hyper::Method::Get, "/store/inventory".to_string())
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
in_header: true,
in_query: false,
param_name: "api_key".to_owned(),
}))
.execute(self.configuration.borrow())
;
req.execute(self.configuration.borrow())
}
fn get_order_by_id(&self, order_id: i64) -> Box<dyn Future<Item = crate::models::Order, Error = Error<serde_json::Value>>> {
__internal_request::Request::new(hyper::Method::Get, "/store/order/{orderId}".to_string())
.with_path_param("orderId".to_string(), order_id.to_string())
.execute(self.configuration.borrow())
let mut req = __internal_request::Request::new(hyper::Method::Get, "/store/order/{orderId}".to_string())
;
req = req.with_path_param("orderId".to_string(), order_id.to_string());
req.execute(self.configuration.borrow())
}
fn place_order(&self, body: crate::models::Order) -> Box<dyn Future<Item = crate::models::Order, Error = Error<serde_json::Value>>> {
__internal_request::Request::new(hyper::Method::Post, "/store/order".to_string())
.with_body_param(body)
.execute(self.configuration.borrow())
let mut req = __internal_request::Request::new(hyper::Method::Post, "/store/order".to_string())
;
req = req.with_body_param(body);
req.execute(self.configuration.borrow())
}
}

View File

@@ -10,6 +10,8 @@
use std::rc::Rc;
use std::borrow::Borrow;
#[allow(unused_imports)]
use std::option::Option;
use hyper;
use serde_json;
@@ -41,61 +43,76 @@ pub trait UserApi {
fn update_user(&self, username: &str, body: crate::models::User) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>>;
}
impl<C: hyper::client::Connect>UserApi for UserApiClient<C> {
fn create_user(&self, body: crate::models::User) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>> {
__internal_request::Request::new(hyper::Method::Post, "/user".to_string())
.with_body_param(body)
.returns_nothing()
.execute(self.configuration.borrow())
let mut req = __internal_request::Request::new(hyper::Method::Post, "/user".to_string())
;
req = req.with_body_param(body);
req = req.returns_nothing();
req.execute(self.configuration.borrow())
}
fn create_users_with_array_input(&self, body: Vec<crate::models::User>) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>> {
__internal_request::Request::new(hyper::Method::Post, "/user/createWithArray".to_string())
.with_body_param(body)
.returns_nothing()
.execute(self.configuration.borrow())
let mut req = __internal_request::Request::new(hyper::Method::Post, "/user/createWithArray".to_string())
;
req = req.with_body_param(body);
req = req.returns_nothing();
req.execute(self.configuration.borrow())
}
fn create_users_with_list_input(&self, body: Vec<crate::models::User>) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>> {
__internal_request::Request::new(hyper::Method::Post, "/user/createWithList".to_string())
.with_body_param(body)
.returns_nothing()
.execute(self.configuration.borrow())
let mut req = __internal_request::Request::new(hyper::Method::Post, "/user/createWithList".to_string())
;
req = req.with_body_param(body);
req = req.returns_nothing();
req.execute(self.configuration.borrow())
}
fn delete_user(&self, username: &str) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>> {
__internal_request::Request::new(hyper::Method::Delete, "/user/{username}".to_string())
.with_path_param("username".to_string(), username.to_string())
.returns_nothing()
.execute(self.configuration.borrow())
let mut req = __internal_request::Request::new(hyper::Method::Delete, "/user/{username}".to_string())
;
req = req.with_path_param("username".to_string(), username.to_string());
req = req.returns_nothing();
req.execute(self.configuration.borrow())
}
fn get_user_by_name(&self, username: &str) -> Box<dyn Future<Item = crate::models::User, Error = Error<serde_json::Value>>> {
__internal_request::Request::new(hyper::Method::Get, "/user/{username}".to_string())
.with_path_param("username".to_string(), username.to_string())
.execute(self.configuration.borrow())
let mut req = __internal_request::Request::new(hyper::Method::Get, "/user/{username}".to_string())
;
req = req.with_path_param("username".to_string(), username.to_string());
req.execute(self.configuration.borrow())
}
fn login_user(&self, username: &str, password: &str) -> Box<dyn Future<Item = String, Error = Error<serde_json::Value>>> {
__internal_request::Request::new(hyper::Method::Get, "/user/login".to_string())
.with_query_param("username".to_string(), username.to_string())
.with_query_param("password".to_string(), password.to_string())
.execute(self.configuration.borrow())
let mut req = __internal_request::Request::new(hyper::Method::Get, "/user/login".to_string())
;
req = req.with_query_param("username".to_string(), username.to_string());
req = req.with_query_param("password".to_string(), password.to_string());
req.execute(self.configuration.borrow())
}
fn logout_user(&self, ) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>> {
__internal_request::Request::new(hyper::Method::Get, "/user/logout".to_string())
.returns_nothing()
.execute(self.configuration.borrow())
let mut req = __internal_request::Request::new(hyper::Method::Get, "/user/logout".to_string())
;
req = req.returns_nothing();
req.execute(self.configuration.borrow())
}
fn update_user(&self, username: &str, body: crate::models::User) -> Box<dyn Future<Item = (), Error = Error<serde_json::Value>>> {
__internal_request::Request::new(hyper::Method::Put, "/user/{username}".to_string())
.with_path_param("username".to_string(), username.to_string())
.with_body_param(body)
.returns_nothing()
.execute(self.configuration.borrow())
let mut req = __internal_request::Request::new(hyper::Method::Put, "/user/{username}".to_string())
;
req = req.with_path_param("username".to_string(), username.to_string());
req = req.with_body_param(body);
req = req.returns_nothing();
req.execute(self.configuration.borrow())
}
}

View File

@@ -1 +1 @@
4.1.3-SNAPSHOT
4.2.0-SNAPSHOT

View File

@@ -4,12 +4,12 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**integer** | **i32** | | [optional]
**long** | **i64** | | [optional]
**number** | **f32** | | [optional]
**float** | **f32** | | [optional]
**double** | **f64** | | [optional]
**uuid** | **String** | | [optional]
**integer** | Option<**i32**> | | [optional]
**long** | Option<**i64**> | | [optional]
**number** | Option<**f32**> | | [optional]
**float** | Option<**f32**> | | [optional]
**double** | Option<**f64**> | | [optional]
**uuid** | Option<**String**> | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -10,6 +10,8 @@
use std::rc::Rc;
use std::borrow::Borrow;
#[allow(unused_imports)]
use std::option::Option;
use hyper;
use serde_json;
@@ -34,12 +36,13 @@ 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>>> {
__internal_request::Request::new(hyper::Method::Get, "/dummy".to_string())
.returns_nothing()
.execute(self.configuration.borrow())
let mut req = __internal_request::Request::new(hyper::Method::Get, "/dummy".to_string())
;
req = req.returns_nothing();
req.execute(self.configuration.borrow())
}
}

View File

@@ -1 +1 @@
4.1.3-SNAPSHOT
4.2.0-SNAPSHOT

View File

@@ -10,6 +10,8 @@
use std::rc::Rc;
use std::borrow::Borrow;
#[allow(unused_imports)]
use std::option::Option;
use reqwest;

View File

@@ -1 +1 @@
4.1.3-SNAPSHOT
4.2.0-SNAPSHOT

View File

@@ -4,9 +4,9 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**code** | **i32** | | [optional]
**_type** | **String** | | [optional]
**message** | **String** | | [optional]
**code** | Option<**i32**> | | [optional]
**_type** | Option<**String**> | | [optional]
**message** | Option<**String**> | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -4,8 +4,8 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **i64** | | [optional]
**name** | **String** | | [optional]
**id** | Option<**i64**> | | [optional]
**name** | Option<**String**> | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -4,12 +4,12 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **i64** | | [optional]
**pet_id** | **i64** | | [optional]
**quantity** | **i32** | | [optional]
**ship_date** | **String** | | [optional]
**status** | **String** | Order Status | [optional]
**complete** | **bool** | | [optional] [default to false]
**id** | Option<**i64**> | | [optional]
**pet_id** | Option<**i64**> | | [optional]
**quantity** | Option<**i32**> | | [optional]
**ship_date** | Option<**String**> | | [optional]
**status** | Option<**String**> | Order Status | [optional]
**complete** | Option<**bool**> | | [optional][default to false]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -4,12 +4,12 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **i64** | | [optional]
**category** | [***crate::models::Category**](Category.md) | | [optional]
**id** | Option<**i64**> | | [optional]
**category** | Option<[**crate::models::Category**](Category.md)> | | [optional]
**name** | **String** | |
**photo_urls** | **Vec<String>** | |
**tags** | [**Vec<crate::models::Tag>**](Tag.md) | | [optional]
**status** | **String** | pet status in the store | [optional]
**tags** | Option<[**Vec<crate::models::Tag>**](Tag.md)> | | [optional]
**status** | Option<**String**> | pet status in the store | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -25,7 +25,7 @@ Add a new pet to the store
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**body** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | Required |
**body** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | [required] |
### Return type
@@ -53,8 +53,8 @@ Deletes a pet
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**pet_id** | **i64** | Pet id to delete | Required |
**api_key** | **String** | | |
**pet_id** | **i64** | Pet id to delete | [required] |
**api_key** | Option<**String**> | | |
### Return type
@@ -84,7 +84,7 @@ Multiple status values can be provided with comma separated strings
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**status** | [**Vec<String>**](String.md) | Status values that need to be considered for filter | Required |
**status** | [**Vec<String>**](String.md) | Status values that need to be considered for filter | [required] |
### Return type
@@ -114,7 +114,7 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**tags** | [**Vec<String>**](String.md) | Tags to filter by | Required |
**tags** | [**Vec<String>**](String.md) | Tags to filter by | [required] |
### Return type
@@ -144,7 +144,7 @@ Returns a single pet
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**pet_id** | **i64** | ID of pet to return | Required |
**pet_id** | **i64** | ID of pet to return | [required] |
### Return type
@@ -172,7 +172,7 @@ Update an existing pet
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**body** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | Required |
**body** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | [required] |
### Return type
@@ -200,9 +200,9 @@ Updates a pet in the store with form data
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**pet_id** | **i64** | ID of pet that needs to be updated | Required |
**name** | **String** | Updated name of the pet | |
**status** | **String** | Updated status of the pet | |
**pet_id** | **i64** | ID of pet that needs to be updated | [required] |
**name** | Option<**String**> | Updated name of the pet | |
**status** | Option<**String**> | Updated status of the pet | |
### Return type
@@ -230,9 +230,9 @@ uploads an image
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**pet_id** | **i64** | ID of pet to update | Required |
**additional_metadata** | **String** | Additional data to pass to server | |
**file** | **std::path::PathBuf** | file to upload | |
**pet_id** | **i64** | ID of pet to update | [required] |
**additional_metadata** | Option<**String**> | Additional data to pass to server | |
**file** | Option<**std::path::PathBuf**> | file to upload | |
### Return type

View File

@@ -23,7 +23,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**order_id** | **String** | ID of the order that needs to be deleted | Required |
**order_id** | **String** | ID of the order that needs to be deleted | [required] |
### Return type
@@ -80,7 +80,7 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**order_id** | **i64** | ID of pet that needs to be fetched | Required |
**order_id** | **i64** | ID of pet that needs to be fetched | [required] |
### Return type
@@ -108,7 +108,7 @@ Place an order for a pet
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**body** | [**Order**](Order.md) | order placed for purchasing the pet | Required |
**body** | [**Order**](Order.md) | order placed for purchasing the pet | [required] |
### Return type

View File

@@ -4,8 +4,8 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **i64** | | [optional]
**name** | **String** | | [optional]
**id** | Option<**i64**> | | [optional]
**name** | Option<**String**> | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -4,14 +4,14 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **i64** | | [optional]
**username** | **String** | | [optional]
**first_name** | **String** | | [optional]
**last_name** | **String** | | [optional]
**email** | **String** | | [optional]
**password** | **String** | | [optional]
**phone** | **String** | | [optional]
**user_status** | **i32** | User Status | [optional]
**id** | Option<**i64**> | | [optional]
**username** | Option<**String**> | | [optional]
**first_name** | Option<**String**> | | [optional]
**last_name** | Option<**String**> | | [optional]
**email** | Option<**String**> | | [optional]
**password** | Option<**String**> | | [optional]
**phone** | Option<**String**> | | [optional]
**user_status** | Option<**i32**> | User Status | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -27,7 +27,7 @@ This can only be done by the logged in user.
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**body** | [**User**](User.md) | Created user object | Required |
**body** | [**User**](User.md) | Created user object | [required] |
### Return type
@@ -55,7 +55,7 @@ Creates list of users with given input array
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**body** | [**Vec<crate::models::User>**](User.md) | List of user object | Required |
**body** | [**Vec<crate::models::User>**](User.md) | List of user object | [required] |
### Return type
@@ -83,7 +83,7 @@ Creates list of users with given input array
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**body** | [**Vec<crate::models::User>**](User.md) | List of user object | Required |
**body** | [**Vec<crate::models::User>**](User.md) | List of user object | [required] |
### Return type
@@ -113,7 +113,7 @@ This can only be done by the logged in user.
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**username** | **String** | The name that needs to be deleted | Required |
**username** | **String** | The name that needs to be deleted | [required] |
### Return type
@@ -141,7 +141,7 @@ Get user by user name
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**username** | **String** | The name that needs to be fetched. Use user1 for testing. | Required |
**username** | **String** | The name that needs to be fetched. Use user1 for testing. | [required] |
### Return type
@@ -169,8 +169,8 @@ Logs user into the system
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**username** | **String** | The user name for login | Required |
**password** | **String** | The password for login in clear text | Required |
**username** | **String** | The user name for login | [required] |
**password** | **String** | The password for login in clear text | [required] |
### Return type
@@ -225,8 +225,8 @@ This can only be done by the logged in user.
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**username** | **String** | name that need to be deleted | Required |
**body** | [**User**](User.md) | Updated user object | Required |
**username** | **String** | name that need to be deleted | [required] |
**body** | [**User**](User.md) | Updated user object | [required] |
### Return type

View File

@@ -10,6 +10,8 @@
use std::rc::Rc;
use std::borrow::Borrow;
#[allow(unused_imports)]
use std::option::Option;
use reqwest;
@@ -29,13 +31,13 @@ impl PetApiClient {
pub trait PetApi {
fn add_pet(&self, body: crate::models::Pet) -> Result<(), Error>;
fn delete_pet(&self, pet_id: i64, api_key: &str) -> Result<(), Error>;
fn delete_pet(&self, pet_id: i64, api_key: Option<&str>) -> Result<(), Error>;
fn find_pets_by_status(&self, status: Vec<String>) -> Result<Vec<crate::models::Pet>, Error>;
fn find_pets_by_tags(&self, tags: Vec<String>) -> Result<Vec<crate::models::Pet>, Error>;
fn get_pet_by_id(&self, pet_id: i64) -> Result<crate::models::Pet, Error>;
fn update_pet(&self, body: crate::models::Pet) -> Result<(), Error>;
fn update_pet_with_form(&self, pet_id: i64, name: &str, status: &str) -> Result<(), Error>;
fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: std::path::PathBuf) -> Result<crate::models::ApiResponse, Error>;
fn update_pet_with_form(&self, pet_id: i64, name: Option<&str>, status: Option<&str>) -> Result<(), Error>;
fn upload_file(&self, pet_id: i64, additional_metadata: Option<&str>, file: Option<std::path::PathBuf>) -> Result<crate::models::ApiResponse, Error>;
}
impl PetApi for PetApiClient {
@@ -61,7 +63,7 @@ impl PetApi for PetApiClient {
Ok(())
}
fn delete_pet(&self, pet_id: i64, api_key: &str) -> Result<(), Error> {
fn delete_pet(&self, pet_id: i64, api_key: Option<&str>) -> Result<(), Error> {
let configuration: &configuration::Configuration = self.configuration.borrow();
let client = &configuration.client;
@@ -71,7 +73,9 @@ impl PetApi for PetApiClient {
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = req_builder.header("api_key", api_key.to_string());
if let Some(param_value) = api_key {
req_builder = req_builder.header("api_key", param_value.to_string());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
@@ -172,7 +176,7 @@ impl PetApi for PetApiClient {
Ok(())
}
fn update_pet_with_form(&self, pet_id: i64, name: &str, status: &str) -> Result<(), Error> {
fn update_pet_with_form(&self, pet_id: i64, name: Option<&str>, status: Option<&str>) -> Result<(), Error> {
let configuration: &configuration::Configuration = self.configuration.borrow();
let client = &configuration.client;
@@ -186,8 +190,12 @@ impl PetApi for PetApiClient {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let mut form_params = std::collections::HashMap::new();
form_params.insert("name", name.to_string());
form_params.insert("status", status.to_string());
if let Some(param_value) = name {
form_params.insert("name", param_value.to_string());
}
if let Some(param_value) = status {
form_params.insert("status", param_value.to_string());
}
req_builder = req_builder.form(&form_params);
// send request
@@ -197,7 +205,7 @@ impl PetApi for PetApiClient {
Ok(())
}
fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: std::path::PathBuf) -> Result<crate::models::ApiResponse, Error> {
fn upload_file(&self, pet_id: i64, additional_metadata: Option<&str>, file: Option<std::path::PathBuf>) -> Result<crate::models::ApiResponse, Error> {
let configuration: &configuration::Configuration = self.configuration.borrow();
let client = &configuration.client;
@@ -210,9 +218,13 @@ impl PetApi for PetApiClient {
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
let form = reqwest::multipart::Form::new()
.text("additionalMetadata", additional_metadata.to_string())
.file("file", file)?;
let mut form = reqwest::multipart::Form::new();
if let Some(param_value) = additional_metadata {
form = form.text("additionalMetadata", param_value.to_string());
}
if let Some(param_value) = file {
form = form.file("file", param_value)?;
}
req_builder = req_builder.multipart(form);
// send request

View File

@@ -10,6 +10,8 @@
use std::rc::Rc;
use std::borrow::Borrow;
#[allow(unused_imports)]
use std::option::Option;
use reqwest;

View File

@@ -10,6 +10,8 @@
use std::rc::Rc;
use std::borrow::Borrow;
#[allow(unused_imports)]
use std::option::Option;
use reqwest;

View File

@@ -1 +1 @@
4.1.3-SNAPSHOT
4.2.0-SNAPSHOT

View File

@@ -4,12 +4,12 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**integer** | **i32** | | [optional]
**long** | **i64** | | [optional]
**number** | **f32** | | [optional]
**float** | **f32** | | [optional]
**double** | **f64** | | [optional]
**uuid** | **String** | | [optional]
**integer** | Option<**i32**> | | [optional]
**long** | Option<**i64**> | | [optional]
**number** | Option<**f32**> | | [optional]
**float** | Option<**f32**> | | [optional]
**double** | Option<**f64**> | | [optional]
**uuid** | Option<**String**> | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -10,6 +10,8 @@
use std::rc::Rc;
use std::borrow::Borrow;
#[allow(unused_imports)]
use std::option::Option;
use reqwest;