diff --git a/bin/rust-petstore.sh b/bin/rust-petstore.sh
index d5aceb82af66..327b9cc3a8c5 100755
--- a/bin/rust-petstore.sh
+++ b/bin/rust-petstore.sh
@@ -35,7 +35,7 @@ for spec_path in \
; do
spec=$(basename "$spec_path" | sed 's/.yaml//' | sed 's/.json//' )
- for library in hyper reqwest; do
+ for library in hyper reqwest reqwestFutures; do
args="generate --template-dir modules/openapi-generator/src/main/resources/rust
--input-spec $spec_path
--generator-name rust
diff --git a/bin/windows/rust-futures-petstore.bat b/bin/windows/rust-futures-petstore.bat
new file mode 100644
index 000000000000..7098cff6de46
--- /dev/null
+++ b/bin/windows/rust-futures-petstore.bat
@@ -0,0 +1,10 @@
+set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
+
+If Not Exist %executable% (
+ mvn clean package
+)
+
+REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
+set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g rust --library reqwestFutures -o samples\client\petstore\rust
+
+java %JAVA_OPTS% -jar %executable% %ags%
diff --git a/docs/generators/rust.md b/docs/generators/rust.md
index 2f1aa5d74719..03cb6dfa20b6 100644
--- a/docs/generators/rust.md
+++ b/docs/generators/rust.md
@@ -7,5 +7,6 @@ sidebar_label: rust
| ------ | ----------- | ------ | ------- |
|packageName|Rust package name (convention: lowercase).| |openapi|
|packageVersion|Rust package version.| |1.0.0|
+|interfacePrefix|Method prefix.| ||
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
-|library|library template (sub-template) to use.|
- **hyper**
- HTTP client: Hyper.
- **reqwest**
- HTTP client: Reqwest.
|hyper|
+|library|library template (sub-template) to use.|- **hyper**
- HTTP client: Hyper.
- **reqwest**
- HTTP client: Reqwest.
- **reqwestFutures**
- HTTP client: Reqwest (futures).
|hyper|
diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java
index cdac07896c1e..64d95e10b6ae 100644
--- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java
+++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java
@@ -40,6 +40,7 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig {
public static final String HYPER_LIBRARY = "hyper";
public static final String REQWEST_LIBRARY = "reqwest";
+ public static final String REQWEST_FUTURES_LIBRARY = "reqwestFutures";
protected String packageName = "openapi";
protected String packageVersion = "1.0.0";
@@ -136,11 +137,14 @@ public RustClientCodegen() {
.defaultValue("openapi"));
cliOptions.add(new CliOption(CodegenConstants.PACKAGE_VERSION, "Rust package version.")
.defaultValue("1.0.0"));
+ cliOptions.add(new CliOption(CodegenConstants.INTERFACE_PREFIX, "Method prefix.")
+ .defaultValue(""));
cliOptions.add(new CliOption(CodegenConstants.HIDE_GENERATION_TIMESTAMP, CodegenConstants.HIDE_GENERATION_TIMESTAMP_DESC)
.defaultValue(Boolean.TRUE.toString()));
supportedLibraries.put(HYPER_LIBRARY, "HTTP client: Hyper.");
supportedLibraries.put(REQWEST_LIBRARY, "HTTP client: Reqwest.");
+ supportedLibraries.put(REQWEST_FUTURES_LIBRARY, "HTTP client: Reqwest (futures).");
CliOption libraryOption = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use.");
libraryOption.setEnum(supportedLibraries);
@@ -221,6 +225,8 @@ public void processOpts() {
additionalProperties.put(HYPER_LIBRARY, "true");
} else if (REQWEST_LIBRARY.equals(getLibrary())) {
additionalProperties.put(REQWEST_LIBRARY, "true");
+ } else if (REQWEST_FUTURES_LIBRARY.equals(getLibrary())) {
+ additionalProperties.put("reqwestFutures", "true");
} else {
LOGGER.error("Unknown library option (-l/--library): {}", getLibrary());
}
@@ -431,7 +437,7 @@ public Map postProcessOperationsWithModels(Map o
// http method verb conversion, depending on client library (e.g. Hyper: PUT => Put, Reqwest: PUT => put)
if (HYPER_LIBRARY.equals(getLibrary())) {
operation.httpMethod = StringUtils.camelize(operation.httpMethod.toLowerCase(Locale.ROOT));
- } else if (REQWEST_LIBRARY.equals(getLibrary())) {
+ } else if (REQWEST_LIBRARY.equals(getLibrary()) || REQWEST_FUTURES_LIBRARY.equals(getLibrary())) {
operation.httpMethod = operation.httpMethod.toLowerCase(Locale.ROOT);
}
diff --git a/modules/openapi-generator/src/main/resources/rust/Cargo.mustache b/modules/openapi-generator/src/main/resources/rust/Cargo.mustache
index e448a38c51c9..d51bf608e206 100644
--- a/modules/openapi-generator/src/main/resources/rust/Cargo.mustache
+++ b/modules/openapi-generator/src/main/resources/rust/Cargo.mustache
@@ -17,6 +17,11 @@ futures = "0.1.23"
{{#reqwest}}
reqwest = "~0.9"
{{/reqwest}}
+{{#reqwestFutures}}
+reqwest = "~0.9"
+futures = "0.1.23"
+mime_guess = "2.0.1"
+{{/reqwestFutures}}
[dev-dependencies]
{{#hyper}}
diff --git a/modules/openapi-generator/src/main/resources/rust/api.mustache b/modules/openapi-generator/src/main/resources/rust/api.mustache
new file mode 100644
index 000000000000..448f6c302c98
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/rust/api.mustache
@@ -0,0 +1,231 @@
+{{>partial_header}}
+use std::rc::Rc;
+use std::borrow::Borrow;
+#[allow(unused_imports)]
+use std::option::Option;
+
+use reqwest;
+
+use super::{Error, configuration};
+
+pub struct {{{classname}}}Client {
+ configuration: Rc,
+}
+
+impl {{{classname}}}Client {
+ pub fn new(configuration: Rc) -> {{{classname}}}Client {
+ {{{classname}}}Client {
+ configuration,
+ }
+ }
+}
+
+pub trait {{{classname}}} {
+{{#operations}}
+{{#operation}}
+ 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}}
+}
+
+impl {{{classname}}} for {{{classname}}}Client {
+{{#operations}}
+{{#operation}}
+ 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}}}{{^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::>().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::>().join(","){{/isListContainer}}.to_string())]);
+ }
+ {{/required}}
+ {{/queryParams}}
+ {{#hasAuthMethods}}
+ {{#authMethods}}
+ {{#isApiKey}}
+ {{#isKeyInQuery}}
+ if let Some(ref apikey) = configuration.api_key {
+ let key = apikey.key.clone();
+ let val = match apikey.prefix {
+ Some(ref prefix) => format!("{} {}", prefix, key),
+ None => key,
+ };
+ req_builder = req_builder.query(&[("{{{keyParamName}}}", val)]);
+ }
+ {{/isKeyInQuery}}
+ {{/isApiKey}}
+ {{/authMethods}}
+ {{/hasAuthMethods}}
+ if let Some(ref user_agent) = configuration.user_agent {
+ req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
+ }
+ {{#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}}
+ {{#authMethods}}
+ {{#isApiKey}}
+ {{#isKeyInHeader}}
+ if let Some(ref apikey) = configuration.api_key {
+ let key = apikey.key.clone();
+ let val = match apikey.prefix {
+ Some(ref prefix) => format!("{} {}", prefix, key),
+ None => key,
+ };
+ req_builder = req_builder.header("{{{keyParamName}}}", val);
+ };
+ {{/isKeyInHeader}}
+ {{/isApiKey}}
+ {{#isBasic}}
+ {{^isBasicBearer}}
+ if let Some(ref auth_conf) = configuration.basic_auth {
+ req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
+ };
+ {{/isBasicBearer}}
+ {{#isBasicBearer}}
+ if let Some(ref token) = configuration.bearer_access_token {
+ req_builder = req_builder.bearer_auth(token.to_owned());
+ };
+ {{/isBasicBearer}}
+ {{/isBasic}}
+ {{#isOAuth}}
+ if let Some(ref token) = configuration.oauth_access_token {
+ req_builder = req_builder.bearer_auth(token.to_owned());
+ };
+ {{/isOAuth}}
+ {{/authMethods}}
+ {{/hasAuthMethods}}
+ {{#isMultipart}}
+ {{#hasFormParams}}
+ let mut form = reqwest::multipart::Form::new();
+ {{#formParams}}
+ {{#isFile}}
+ {{#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}}
+ {{#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);
+ {{/hasFormParams}}
+ {{/isMultipart}}
+ {{^isMultipart}}
+ {{#hasFormParams}}
+ 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);
+ {{/hasFormParams}}
+ {{/isMultipart}}
+ {{#hasBodyParam}}
+ {{#bodyParams}}
+ req_builder = req_builder.json(&{{{paramName}}});
+ {{/bodyParams}}
+ {{/hasBodyParam}}
+
+ // send request
+ let req = req_builder.build()?;
+
+ {{^returnType}}
+ client.execute(req)?.error_for_status()?;
+ Ok(())
+ {{/returnType}}
+ {{#returnType}}
+ Ok(client.execute(req)?.error_for_status()?.json()?)
+ {{/returnType}}
+ }
+
+{{/operation}}
+{{/operations}}
+}
diff --git a/modules/openapi-generator/src/main/resources/rust/lib.mustache b/modules/openapi-generator/src/main/resources/rust/lib.mustache
index cdc5287aae73..3f04e34aa552 100644
--- a/modules/openapi-generator/src/main/resources/rust/lib.mustache
+++ b/modules/openapi-generator/src/main/resources/rust/lib.mustache
@@ -11,6 +11,11 @@ extern crate futures;
{{#reqwest}}
extern crate reqwest;
{{/reqwest}}
+{{#reqwestFutures}}
+extern crate reqwest;
+extern crate futures;
+extern crate mime_guess;
+{{/reqwestFutures}}
pub mod apis;
pub mod models;
diff --git a/modules/openapi-generator/src/main/resources/rust/reqwestFutures/api.mustache b/modules/openapi-generator/src/main/resources/rust/reqwestFutures/api.mustache
new file mode 100644
index 000000000000..24424f42fdf6
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/rust/reqwestFutures/api.mustache
@@ -0,0 +1,272 @@
+{{>partial_header}}
+use std::sync::Arc;
+use std::borrow::Borrow;
+#[allow(unused_imports)]
+use std::option::Option;
+use futures::{Future, future};
+use reqwest;
+use mime_guess::{self, Mime};
+use reqwest::async::multipart::Part;
+use super::{Error, configuration};
+use std::path::Path;
+use std::io;
+use std::io::Read;
+use std::fs::{File};
+
+fn part_from_file>(path: T) -> io::Result {
+ let path = path.as_ref();
+ let file_name = path.file_name().and_then(|filename| {
+ Some(filename.to_string_lossy().into_owned())
+ });
+ let ext = path.extension()
+ .and_then(|ext| ext.to_str())
+ .unwrap_or("");
+ let mime = mime_guess::from_ext(ext).first_or_octet_stream();
+ let mut file = File::open(path)?;
+ let mut buffer = vec![];
+ let bytes_read = file.read_to_end(&mut buffer)?;
+ let field = Part::bytes(buffer)
+ .mime_str(&mime.to_string())
+ .map_err(|e| io::Error::new(io::ErrorKind::NotFound, "Invalid/unknown mime type"))?;
+ Ok(if let Some(file_name) = file_name {
+ field.file_name(file_name)
+ } else {
+ field
+ })
+}
+
+pub struct {{{classname}}}Client {
+ configuration: Arc,
+}
+
+impl {{{classname}}}Client {
+ pub fn new(configuration: Arc) -> {{{classname}}}Client {
+ {{{classname}}}Client {
+ configuration,
+ }
+ }
+}
+
+pub trait {{{classname}}} {
+{{#operations}}
+{{#operation}}
+ fn {{{interfacePrefix}}}{{{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 + Send>;
+{{/operation}}
+{{/operations}}
+}
+
+impl {{{classname}}} for {{{classname}}}Client {
+{{#operations}}
+{{#operation}}
+ fn {{{interfacePrefix}}}{{{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 + Send> {
+ 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}}}{{^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::>().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::>().join(","){{/isListContainer}}.to_string())]);
+ }
+ {{/required}}
+ {{/queryParams}}
+ {{#hasAuthMethods}}
+ {{#authMethods}}
+ {{#isApiKey}}
+ {{#isKeyInQuery}}
+ if let Some(ref apikey) = configuration.api_key {
+ let key = apikey.key.clone();
+ let val = match apikey.prefix {
+ Some(ref prefix) => format!("{} {}", prefix, key),
+ None => key,
+ };
+ req_builder = req_builder.query(&[("{{{keyParamName}}}", val)]);
+ }
+ {{/isKeyInQuery}}
+ {{/isApiKey}}
+ {{/authMethods}}
+ {{/hasAuthMethods}}
+ if let Some(ref user_agent) = configuration.user_agent {
+ req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
+ }
+ {{#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}}
+ {{#authMethods}}
+ {{#isApiKey}}
+ {{#isKeyInHeader}}
+ if let Some(ref apikey) = configuration.api_key {
+ let key = apikey.key.clone();
+ let val = match apikey.prefix {
+ Some(ref prefix) => format!("{} {}", prefix, key),
+ None => key,
+ };
+ req_builder = req_builder.header("{{{keyParamName}}}", val);
+ };
+ {{/isKeyInHeader}}
+ {{/isApiKey}}
+ {{#isBasic}}
+ {{^isBasicBearer}}
+ if let Some(ref auth_conf) = configuration.basic_auth {
+ req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
+ };
+ {{/isBasicBearer}}
+ {{#isBasicBearer}}
+ if let Some(ref token) = configuration.bearer_access_token {
+ req_builder = req_builder.bearer_auth(token.to_owned());
+ };
+ {{/isBasicBearer}}
+ {{/isBasic}}
+ {{#isOAuth}}
+ if let Some(ref token) = configuration.oauth_access_token {
+ req_builder = req_builder.bearer_auth(token.to_owned());
+ };
+ {{/isOAuth}}
+ {{/authMethods}}
+ {{/hasAuthMethods}}
+ {{#isMultipart}}
+ {{#hasFormParams}}
+ let mut form = reqwest::async::multipart::Form::new();
+ {{#formParams}}
+ {{#isFile}}
+ {{#required}}
+ {{^isNullable}}
+ match part_from_file({{{paramName}}}) {
+ Ok(part) => form = form.part("{{{baseName}}}", part),
+ Err(e) => return Box::new(future::err(e.into()))
+ }
+ // form = form.part("{{{baseName}}}", part_from_file({{{paramName}}}));
+ {{/isNullable}}
+ {{#isNullable}}
+ match {{{paramName}}} {
+ Some(param_value) => {
+ match part_from_file(param_value) {
+ Ok(part) => { form = form.part("{{{baseName}}}", part); },
+ Err(e) => { return Box::new(future::err(e.into())); }
+ }
+ },
+ None => { unimplemented!("Required nullable form file param not supported"); },
+ }
+ {{/isNullable}}
+ {{/required}}
+ {{^required}}
+ if let Some(param_value) = {{{paramName}}} {
+ match part_from_file(param_value) {
+ Ok(part) => { form = form.part("{{{baseName}}}", part); },
+ Err(e) => { return Box::new(future::err(e.into())); }
+ }
+ }
+ {{/required}}
+ {{/isFile}}
+ {{^isFile}}
+ {{#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);
+ {{/hasFormParams}}
+ {{/isMultipart}}
+ {{^isMultipart}}
+ {{#hasFormParams}}
+ 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);
+ {{/hasFormParams}}
+ {{/isMultipart}}
+ {{#hasBodyParam}}
+ {{#bodyParams}}
+ req_builder = req_builder.json(&{{{paramName}}});
+ {{/bodyParams}}
+ {{/hasBodyParam}}
+
+ // send request
+ Box::new(req_builder.send()
+ {{^returnType}}
+ .and_then(|i| i.error_for_status())
+ .map(|_| ())
+ {{/returnType}}
+ {{#returnType}}
+ .and_then(|i| i.error_for_status())
+ .and_then(|mut i| i.json())
+ {{/returnType}}
+ .from_err()
+ )
+ }
+
+{{/operation}}
+{{/operations}}
+}
diff --git a/modules/openapi-generator/src/main/resources/rust/reqwestFutures/api_mod.mustache b/modules/openapi-generator/src/main/resources/rust/reqwestFutures/api_mod.mustache
new file mode 100644
index 000000000000..93123e31facd
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/rust/reqwestFutures/api_mod.mustache
@@ -0,0 +1,47 @@
+use reqwest;
+use serde_json;
+
+#[derive(Debug)]
+pub enum Error {
+ Reqwest(reqwest::Error),
+ Serde(serde_json::Error),
+ Io(std::io::Error),
+}
+
+impl From for Error {
+ fn from(e: reqwest::Error) -> Self {
+ Error::Reqwest(e)
+ }
+}
+
+impl From for Error {
+ fn from(e: serde_json::Error) -> Self {
+ Error::Serde(e)
+ }
+}
+
+impl From for Error {
+ fn from(e: std::io::Error) -> Self {
+ Error::Io(e)
+ }
+}
+
+pub fn urlencode>(s: T) -> String {
+ ::url::form_urlencoded::byte_serialize(s.as_ref().as_bytes()).collect()
+}
+
+{{#apiInfo}}
+{{#apis}}
+mod {{{classFilename}}};
+{{#operations}}
+{{#operation}}
+{{#-last}}
+pub use self::{{{classFilename}}}::{ {{{classname}}}, {{{classname}}}Client };
+{{/-last}}
+{{/operation}}
+{{/operations}}
+{{/apis}}
+{{/apiInfo}}
+
+pub mod configuration;
+pub mod client;
diff --git a/modules/openapi-generator/src/main/resources/rust/reqwestFutures/client.mustache b/modules/openapi-generator/src/main/resources/rust/reqwestFutures/client.mustache
new file mode 100644
index 000000000000..8589665d956e
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/rust/reqwestFutures/client.mustache
@@ -0,0 +1,52 @@
+use std::sync::Arc;
+
+use super::configuration::Configuration;
+
+pub struct APIClient {
+{{#apiInfo}}
+{{#apis}}
+{{#operations}}
+{{#operation}}
+ {{#-last}}
+ {{{classFilename}}}: Box,
+ {{/-last}}
+{{/operation}}
+{{/operations}}
+{{/apis}}
+{{/apiInfo}}
+}
+
+impl APIClient {
+ pub fn new(configuration: Configuration) -> APIClient {
+ let rc = Arc::new(configuration);
+
+ APIClient {
+{{#apiInfo}}
+{{#apis}}
+{{#operations}}
+{{#operation}}
+ {{#-last}}
+ {{{classFilename}}}: Box::new(crate::apis::{{{classname}}}Client::new(rc.clone())),
+ {{/-last}}
+{{/operation}}
+{{/operations}}
+{{/apis}}
+{{/apiInfo}}
+ }
+ }
+
+{{#apiInfo}}
+{{#apis}}
+{{#operations}}
+{{#operation}}
+{{#-last}}
+ pub fn {{{classFilename}}}(&self) -> &dyn crate::apis::{{{classname}}}{
+ self.{{{classFilename}}}.as_ref()
+ }
+
+{{/-last}}
+{{/operation}}
+{{/operations}}
+{{/apis}}
+{{/apiInfo}}
+}
diff --git a/modules/openapi-generator/src/main/resources/rust/reqwestFutures/configuration.mustache b/modules/openapi-generator/src/main/resources/rust/reqwestFutures/configuration.mustache
new file mode 100644
index 000000000000..cc968afcf55c
--- /dev/null
+++ b/modules/openapi-generator/src/main/resources/rust/reqwestFutures/configuration.mustache
@@ -0,0 +1,41 @@
+{{>partial_header}}
+
+use reqwest;
+
+pub struct Configuration {
+ pub base_path: String,
+ pub user_agent: Option,
+ pub client: reqwest::async::Client,
+ pub basic_auth: Option,
+ pub oauth_access_token: Option,
+ pub bearer_access_token: Option,
+ pub api_key: Option,
+ // TODO: take an oauth2 token source, similar to the go one
+}
+
+pub type BasicAuth = (String, Option);
+
+pub struct ApiKey {
+ pub prefix: Option,
+ pub key: String,
+}
+
+impl Configuration {
+ pub fn new() -> Configuration {
+ Configuration::default()
+ }
+}
+
+impl Default for Configuration {
+ fn default() -> Self {
+ Configuration {
+ base_path: "{{{basePath}}}".to_owned(),
+ user_agent: {{#httpUserAgent}}Some("{{{.}}}".to_owned()){{/httpUserAgent}}{{^httpUserAgent}}Some("OpenAPI-Generator/{{{version}}}/rust".to_owned()){{/httpUserAgent}},
+ client: reqwest::async::Client::new(),
+ basic_auth: None,
+ oauth_access_token: None,
+ bearer_access_token: None,
+ api_key: None,
+ }
+ }
+}
diff --git a/samples/client/petstore/rust/.gitignore b/samples/client/petstore/rust/.gitignore
index a9d37c560c6a..6aa106405a4b 100644
--- a/samples/client/petstore/rust/.gitignore
+++ b/samples/client/petstore/rust/.gitignore
@@ -1,2 +1,3 @@
-target
+/target/
+**/*.rs.bk
Cargo.lock
diff --git a/samples/client/petstore/rust/.openapi-generator-ignore b/samples/client/petstore/rust/.openapi-generator-ignore
new file mode 100644
index 000000000000..7484ee590a38
--- /dev/null
+++ b/samples/client/petstore/rust/.openapi-generator-ignore
@@ -0,0 +1,23 @@
+# OpenAPI Generator Ignore
+# Generated by openapi-generator https://github.com/openapitools/openapi-generator
+
+# Use this file to prevent files from being overwritten by the generator.
+# The patterns follow closely to .gitignore or .dockerignore.
+
+# As an example, the C# client generator defines ApiClient.cs.
+# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
+#ApiClient.cs
+
+# You can match any string of characters against a directory, file or extension with a single asterisk (*):
+#foo/*/qux
+# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
+
+# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
+#foo/**/qux
+# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
+
+# You can also negate patterns with an exclamation (!).
+# For example, you can ignore all files in a docs folder with the file extension .md:
+#docs/*.md
+# Then explicitly reverse the ignore rule for a single file:
+#!docs/README.md
diff --git a/samples/client/petstore/rust/.openapi-generator/VERSION b/samples/client/petstore/rust/.openapi-generator/VERSION
index 479c313e87b9..c3a2c7076fa8 100644
--- a/samples/client/petstore/rust/.openapi-generator/VERSION
+++ b/samples/client/petstore/rust/.openapi-generator/VERSION
@@ -1 +1 @@
-4.0.3-SNAPSHOT
\ No newline at end of file
+4.2.0-SNAPSHOT
\ No newline at end of file
diff --git a/samples/client/petstore/rust/.travis.yml b/samples/client/petstore/rust/.travis.yml
new file mode 100644
index 000000000000..22761ba7ee19
--- /dev/null
+++ b/samples/client/petstore/rust/.travis.yml
@@ -0,0 +1 @@
+language: rust
diff --git a/samples/client/petstore/rust/Cargo.toml b/samples/client/petstore/rust/Cargo.toml
index 46b06cf9bbe3..d2f23d92784d 100644
--- a/samples/client/petstore/rust/Cargo.toml
+++ b/samples/client/petstore/rust/Cargo.toml
@@ -1,2 +1,17 @@
-[workspace]
-members = ["hyper/*", "reqwest/*"]
+[package]
+name = "openapi"
+version = "1.0.0"
+authors = ["OpenAPI Generator team and contributors"]
+
+[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 = "*"
diff --git a/samples/client/petstore/rust/README.md b/samples/client/petstore/rust/README.md
new file mode 100644
index 000000000000..8c29b9199dff
--- /dev/null
+++ b/samples/client/petstore/rust/README.md
@@ -0,0 +1,68 @@
+# Rust API client for openapi
+
+This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+
+## 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://petstore.swagger.io/v2*
+
+Class | Method | HTTP request | Description
+------------ | ------------- | ------------- | -------------
+*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
+*PetApi* | [**find_pets_by_tags**](docs/PetApi.md#find_pets_by_tags) | **Get** /pet/findByTags | Finds Pets by tags
+*PetApi* | [**get_pet_by_id**](docs/PetApi.md#get_pet_by_id) | **Get** /pet/{petId} | Find pet by ID
+*PetApi* | [**update_pet**](docs/PetApi.md#update_pet) | **Put** /pet | Update an existing pet
+*PetApi* | [**update_pet_with_form**](docs/PetApi.md#update_pet_with_form) | **Post** /pet/{petId} | Updates a pet in the store with form data
+*PetApi* | [**upload_file**](docs/PetApi.md#upload_file) | **Post** /pet/{petId}/uploadImage | uploads an image
+*StoreApi* | [**delete_order**](docs/StoreApi.md#delete_order) | **Delete** /store/order/{orderId} | Delete purchase order by ID
+*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
+*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
+*UserApi* | [**delete_user**](docs/UserApi.md#delete_user) | **Delete** /user/{username} | Delete user
+*UserApi* | [**get_user_by_name**](docs/UserApi.md#get_user_by_name) | **Get** /user/{username} | Get user by user name
+*UserApi* | [**login_user**](docs/UserApi.md#login_user) | **Get** /user/login | Logs user into the system
+*UserApi* | [**logout_user**](docs/UserApi.md#logout_user) | **Get** /user/logout | Logs out current logged in user session
+*UserApi* | [**update_user**](docs/UserApi.md#update_user) | **Put** /user/{username} | Updated user
+
+
+## Documentation For Models
+
+ - [ApiResponse](docs/ApiResponse.md)
+ - [Category](docs/Category.md)
+ - [Order](docs/Order.md)
+ - [Pet](docs/Pet.md)
+ - [Tag](docs/Tag.md)
+ - [User](docs/User.md)
+
+
+To get access to the crate's generated documentation, use:
+
+```
+cargo doc --open
+```
+
+## Author
+
+
+
diff --git a/samples/client/petstore/rust/docs/ApiResponse.md b/samples/client/petstore/rust/docs/ApiResponse.md
new file mode 100644
index 000000000000..97128a87d97b
--- /dev/null
+++ b/samples/client/petstore/rust/docs/ApiResponse.md
@@ -0,0 +1,13 @@
+# ApiResponse
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**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)
+
+
diff --git a/samples/client/petstore/rust/docs/Category.md b/samples/client/petstore/rust/docs/Category.md
new file mode 100644
index 000000000000..1cf67347c057
--- /dev/null
+++ b/samples/client/petstore/rust/docs/Category.md
@@ -0,0 +1,12 @@
+# Category
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**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)
+
+
diff --git a/samples/client/petstore/rust/docs/Order.md b/samples/client/petstore/rust/docs/Order.md
new file mode 100644
index 000000000000..d9a09c397432
--- /dev/null
+++ b/samples/client/petstore/rust/docs/Order.md
@@ -0,0 +1,16 @@
+# Order
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**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)
+
+
diff --git a/samples/client/petstore/rust/docs/Pet.md b/samples/client/petstore/rust/docs/Pet.md
new file mode 100644
index 000000000000..27886889d1d4
--- /dev/null
+++ b/samples/client/petstore/rust/docs/Pet.md
@@ -0,0 +1,16 @@
+# Pet
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**id** | Option<**i64**> | | [optional]
+**category** | Option<[**crate::models::Category**](Category.md)> | | [optional]
+**name** | **String** | |
+**photo_urls** | **Vec** | |
+**tags** | Option<[**Vec**](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)
+
+
diff --git a/samples/client/petstore/rust/docs/PetApi.md b/samples/client/petstore/rust/docs/PetApi.md
new file mode 100644
index 000000000000..6ac82abc9d4a
--- /dev/null
+++ b/samples/client/petstore/rust/docs/PetApi.md
@@ -0,0 +1,251 @@
+# \PetApi
+
+All URIs are relative to *http://petstore.swagger.io/v2*
+
+Method | HTTP request | Description
+------------- | ------------- | -------------
+[**add_pet**](PetApi.md#add_pet) | **Post** /pet | Add a new pet to the store
+[**delete_pet**](PetApi.md#delete_pet) | **Delete** /pet/{petId} | Deletes a pet
+[**find_pets_by_status**](PetApi.md#find_pets_by_status) | **Get** /pet/findByStatus | Finds Pets by status
+[**find_pets_by_tags**](PetApi.md#find_pets_by_tags) | **Get** /pet/findByTags | Finds Pets by tags
+[**get_pet_by_id**](PetApi.md#get_pet_by_id) | **Get** /pet/{petId} | Find pet by ID
+[**update_pet**](PetApi.md#update_pet) | **Put** /pet | Update an existing pet
+[**update_pet_with_form**](PetApi.md#update_pet_with_form) | **Post** /pet/{petId} | Updates a pet in the store with form data
+[**upload_file**](PetApi.md#upload_file) | **Post** /pet/{petId}/uploadImage | uploads an image
+
+
+
+## add_pet
+
+> add_pet(body)
+Add a new pet to the store
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**body** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | [required] |
+
+### Return type
+
+ (empty response body)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+- **Content-Type**: application/json, application/xml
+- **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)
+
+
+## delete_pet
+
+> delete_pet(pet_id, api_key)
+Deletes a pet
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**pet_id** | **i64** | Pet id to delete | [required] |
+**api_key** | Option<**String**> | | |
+
+### Return type
+
+ (empty response body)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### 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)
+
+
+## find_pets_by_status
+
+> Vec find_pets_by_status(status)
+Finds Pets by status
+
+Multiple status values can be provided with comma separated strings
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**status** | [**Vec**](String.md) | Status values that need to be considered for filter | [required] |
+
+### Return type
+
+[**Vec**](Pet.md)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/xml, 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)
+
+
+## find_pets_by_tags
+
+> Vec find_pets_by_tags(tags)
+Finds Pets by tags
+
+Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**tags** | [**Vec**](String.md) | Tags to filter by | [required] |
+
+### Return type
+
+[**Vec**](Pet.md)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/xml, application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+
+## get_pet_by_id
+
+> crate::models::Pet get_pet_by_id(pet_id)
+Find pet by ID
+
+Returns a single pet
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**pet_id** | **i64** | ID of pet to return | [required] |
+
+### Return type
+
+[**crate::models::Pet**](Pet.md)
+
+### Authorization
+
+[api_key](../README.md#api_key)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/xml, 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)
+
+
+## update_pet
+
+> update_pet(body)
+Update an existing pet
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**body** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | [required] |
+
+### Return type
+
+ (empty response body)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+- **Content-Type**: application/json, application/xml
+- **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)
+
+
+## update_pet_with_form
+
+> update_pet_with_form(pet_id, name, status)
+Updates a pet in the store with form data
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**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
+
+ (empty response body)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+- **Content-Type**: application/x-www-form-urlencoded
+- **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)
+
+
+## upload_file
+
+> crate::models::ApiResponse upload_file(pet_id, additional_metadata, file)
+uploads an image
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**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
+
+[**crate::models::ApiResponse**](ApiResponse.md)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+- **Content-Type**: multipart/form-data
+- **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)
+
diff --git a/samples/client/petstore/rust/docs/StoreApi.md b/samples/client/petstore/rust/docs/StoreApi.md
new file mode 100644
index 000000000000..7a7b9498d16a
--- /dev/null
+++ b/samples/client/petstore/rust/docs/StoreApi.md
@@ -0,0 +1,127 @@
+# \StoreApi
+
+All URIs are relative to *http://petstore.swagger.io/v2*
+
+Method | HTTP request | Description
+------------- | ------------- | -------------
+[**delete_order**](StoreApi.md#delete_order) | **Delete** /store/order/{orderId} | Delete purchase order by ID
+[**get_inventory**](StoreApi.md#get_inventory) | **Get** /store/inventory | Returns pet inventories by status
+[**get_order_by_id**](StoreApi.md#get_order_by_id) | **Get** /store/order/{orderId} | Find purchase order by ID
+[**place_order**](StoreApi.md#place_order) | **Post** /store/order | Place an order for a pet
+
+
+
+## delete_order
+
+> delete_order(order_id)
+Delete purchase order by ID
+
+For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**order_id** | **String** | ID of the order that needs to be deleted | [required] |
+
+### 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)
+
+
+## get_inventory
+
+> ::std::collections::HashMap get_inventory()
+Returns pet inventories by status
+
+Returns a map of status codes to quantities
+
+### Parameters
+
+This endpoint does not need any parameter.
+
+### Return type
+
+**::std::collections::HashMap**
+
+### Authorization
+
+[api_key](../README.md#api_key)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+
+## get_order_by_id
+
+> crate::models::Order get_order_by_id(order_id)
+Find purchase order by ID
+
+For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**order_id** | **i64** | ID of pet that needs to be fetched | [required] |
+
+### Return type
+
+[**crate::models::Order**](Order.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/xml, 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)
+
+
+## place_order
+
+> crate::models::Order place_order(body)
+Place an order for a pet
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**body** | [**Order**](Order.md) | order placed for purchasing the pet | [required] |
+
+### Return type
+
+[**crate::models::Order**](Order.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/xml, 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)
+
diff --git a/samples/client/petstore/rust/docs/Tag.md b/samples/client/petstore/rust/docs/Tag.md
new file mode 100644
index 000000000000..7bf71ab0e9d8
--- /dev/null
+++ b/samples/client/petstore/rust/docs/Tag.md
@@ -0,0 +1,12 @@
+# Tag
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**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)
+
+
diff --git a/samples/client/petstore/rust/docs/User.md b/samples/client/petstore/rust/docs/User.md
new file mode 100644
index 000000000000..2e6abda42b32
--- /dev/null
+++ b/samples/client/petstore/rust/docs/User.md
@@ -0,0 +1,18 @@
+# User
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**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)
+
+
diff --git a/samples/client/petstore/rust/docs/UserApi.md b/samples/client/petstore/rust/docs/UserApi.md
new file mode 100644
index 000000000000..f3fce53b66da
--- /dev/null
+++ b/samples/client/petstore/rust/docs/UserApi.md
@@ -0,0 +1,245 @@
+# \UserApi
+
+All URIs are relative to *http://petstore.swagger.io/v2*
+
+Method | HTTP request | Description
+------------- | ------------- | -------------
+[**create_user**](UserApi.md#create_user) | **Post** /user | Create user
+[**create_users_with_array_input**](UserApi.md#create_users_with_array_input) | **Post** /user/createWithArray | Creates list of users with given input array
+[**create_users_with_list_input**](UserApi.md#create_users_with_list_input) | **Post** /user/createWithList | Creates list of users with given input array
+[**delete_user**](UserApi.md#delete_user) | **Delete** /user/{username} | Delete user
+[**get_user_by_name**](UserApi.md#get_user_by_name) | **Get** /user/{username} | Get user by user name
+[**login_user**](UserApi.md#login_user) | **Get** /user/login | Logs user into the system
+[**logout_user**](UserApi.md#logout_user) | **Get** /user/logout | Logs out current logged in user session
+[**update_user**](UserApi.md#update_user) | **Put** /user/{username} | Updated user
+
+
+
+## create_user
+
+> create_user(body)
+Create user
+
+This can only be done by the logged in user.
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**body** | [**User**](User.md) | Created user object | [required] |
+
+### 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)
+
+
+## create_users_with_array_input
+
+> create_users_with_array_input(body)
+Creates list of users with given input array
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**body** | [**Vec**](User.md) | List of user object | [required] |
+
+### 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)
+
+
+## create_users_with_list_input
+
+> create_users_with_list_input(body)
+Creates list of users with given input array
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**body** | [**Vec**](User.md) | List of user object | [required] |
+
+### 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)
+
+
+## delete_user
+
+> delete_user(username)
+Delete user
+
+This can only be done by the logged in user.
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**username** | **String** | The name that needs to be deleted | [required] |
+
+### 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)
+
+
+## get_user_by_name
+
+> crate::models::User get_user_by_name(username)
+Get user by user name
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**username** | **String** | The name that needs to be fetched. Use user1 for testing. | [required] |
+
+### Return type
+
+[**crate::models::User**](User.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/xml, 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)
+
+
+## login_user
+
+> String login_user(username, password)
+Logs user into the system
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**username** | **String** | The user name for login | [required] |
+**password** | **String** | The password for login in clear text | [required] |
+
+### Return type
+
+**String**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/xml, 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)
+
+
+## logout_user
+
+> logout_user()
+Logs out current logged in user session
+
+### 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)
+
+
+## update_user
+
+> update_user(username, body)
+Updated user
+
+This can only be done by the logged in user.
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**username** | **String** | name that need to be deleted | [required] |
+**body** | [**User**](User.md) | Updated user object | [required] |
+
+### 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)
+
diff --git a/samples/client/petstore/rust/git_push.sh b/samples/client/petstore/rust/git_push.sh
new file mode 100644
index 000000000000..ced3be2b0c7b
--- /dev/null
+++ b/samples/client/petstore/rust/git_push.sh
@@ -0,0 +1,58 @@
+#!/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'
+
diff --git a/samples/client/petstore/rust/reqwestFutures/fileResponseTest/.gitignore b/samples/client/petstore/rust/reqwestFutures/fileResponseTest/.gitignore
new file mode 100644
index 000000000000..6aa106405a4b
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/fileResponseTest/.gitignore
@@ -0,0 +1,3 @@
+/target/
+**/*.rs.bk
+Cargo.lock
diff --git a/samples/client/petstore/rust/reqwestFutures/fileResponseTest/.openapi-generator-ignore b/samples/client/petstore/rust/reqwestFutures/fileResponseTest/.openapi-generator-ignore
new file mode 100644
index 000000000000..7484ee590a38
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/fileResponseTest/.openapi-generator-ignore
@@ -0,0 +1,23 @@
+# OpenAPI Generator Ignore
+# Generated by openapi-generator https://github.com/openapitools/openapi-generator
+
+# Use this file to prevent files from being overwritten by the generator.
+# The patterns follow closely to .gitignore or .dockerignore.
+
+# As an example, the C# client generator defines ApiClient.cs.
+# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
+#ApiClient.cs
+
+# You can match any string of characters against a directory, file or extension with a single asterisk (*):
+#foo/*/qux
+# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
+
+# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
+#foo/**/qux
+# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
+
+# You can also negate patterns with an exclamation (!).
+# For example, you can ignore all files in a docs folder with the file extension .md:
+#docs/*.md
+# Then explicitly reverse the ignore rule for a single file:
+#!docs/README.md
diff --git a/samples/client/petstore/rust/reqwestFutures/fileResponseTest/.openapi-generator/VERSION b/samples/client/petstore/rust/reqwestFutures/fileResponseTest/.openapi-generator/VERSION
new file mode 100644
index 000000000000..c3a2c7076fa8
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/fileResponseTest/.openapi-generator/VERSION
@@ -0,0 +1 @@
+4.2.0-SNAPSHOT
\ No newline at end of file
diff --git a/samples/client/petstore/rust/reqwestFutures/fileResponseTest/.travis.yml b/samples/client/petstore/rust/reqwestFutures/fileResponseTest/.travis.yml
new file mode 100644
index 000000000000..22761ba7ee19
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/fileResponseTest/.travis.yml
@@ -0,0 +1 @@
+language: rust
diff --git a/samples/client/petstore/rust/reqwestFutures/fileResponseTest/Cargo.toml b/samples/client/petstore/rust/reqwestFutures/fileResponseTest/Cargo.toml
new file mode 100644
index 000000000000..59b2c48e826c
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/fileResponseTest/Cargo.toml
@@ -0,0 +1,15 @@
+[package]
+name = "fileResponseTest-reqwestFutures"
+version = "1.0.0"
+authors = ["OpenAPI Generator team and contributors"]
+
+[dependencies]
+serde = "^1.0"
+serde_derive = "^1.0"
+serde_json = "^1.0"
+url = "1.5"
+reqwest = "~0.9"
+futures = "0.1.23"
+mime_guess = "2.0.1"
+
+[dev-dependencies]
diff --git a/samples/client/petstore/rust/reqwestFutures/fileResponseTest/README.md b/samples/client/petstore/rust/reqwestFutures/fileResponseTest/README.md
new file mode 100644
index 000000000000..bfd64293dda9
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/fileResponseTest/README.md
@@ -0,0 +1,43 @@
+# Rust API client for fileResponseTest-reqwestFutures
+
+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
+
+
+
diff --git a/samples/client/petstore/rust/reqwestFutures/fileResponseTest/docs/DefaultApi.md b/samples/client/petstore/rust/reqwestFutures/fileResponseTest/docs/DefaultApi.md
new file mode 100644
index 000000000000..0b0273e4346b
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/fileResponseTest/docs/DefaultApi.md
@@ -0,0 +1,34 @@
+# \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)
+
diff --git a/samples/client/petstore/rust/reqwestFutures/fileResponseTest/git_push.sh b/samples/client/petstore/rust/reqwestFutures/fileResponseTest/git_push.sh
new file mode 100644
index 000000000000..ced3be2b0c7b
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/fileResponseTest/git_push.sh
@@ -0,0 +1,58 @@
+#!/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'
+
diff --git a/samples/client/petstore/rust/reqwestFutures/fileResponseTest/src/apis/client.rs b/samples/client/petstore/rust/reqwestFutures/fileResponseTest/src/apis/client.rs
new file mode 100644
index 000000000000..3f1438beaf1a
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/fileResponseTest/src/apis/client.rs
@@ -0,0 +1,22 @@
+use std::sync::Arc;
+
+use super::configuration::Configuration;
+
+pub struct APIClient {
+ default_api: Box,
+}
+
+impl APIClient {
+ pub fn new(configuration: Configuration) -> APIClient {
+ let rc = Arc::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()
+ }
+
+}
diff --git a/samples/client/petstore/rust/reqwestFutures/fileResponseTest/src/apis/configuration.rs b/samples/client/petstore/rust/reqwestFutures/fileResponseTest/src/apis/configuration.rs
new file mode 100644
index 000000000000..169b4bdcb6b8
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/fileResponseTest/src/apis/configuration.rs
@@ -0,0 +1,50 @@
+/*
+ * 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,
+ pub client: reqwest::async::Client,
+ pub basic_auth: Option,
+ pub oauth_access_token: Option,
+ pub bearer_access_token: Option,
+ pub api_key: Option,
+ // TODO: take an oauth2 token source, similar to the go one
+}
+
+pub type BasicAuth = (String, Option);
+
+pub struct ApiKey {
+ pub prefix: Option,
+ 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::async::Client::new(),
+ basic_auth: None,
+ oauth_access_token: None,
+ bearer_access_token: None,
+ api_key: None,
+ }
+ }
+}
diff --git a/samples/client/petstore/rust/reqwestFutures/fileResponseTest/src/apis/default_api.rs b/samples/client/petstore/rust/reqwestFutures/fileResponseTest/src/apis/default_api.rs
new file mode 100644
index 000000000000..ec9fb623e9fc
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/fileResponseTest/src/apis/default_api.rs
@@ -0,0 +1,83 @@
+/*
+ * 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::sync::Arc;
+use std::borrow::Borrow;
+#[allow(unused_imports)]
+use std::option::Option;
+use futures::{Future, future};
+use reqwest;
+use mime_guess::{self, Mime};
+use reqwest::async::multipart::Part;
+use super::{Error, configuration};
+use std::path::Path;
+use std::io;
+use std::io::Read;
+use std::fs::{File};
+
+fn part_from_file>(path: T) -> io::Result {
+ let path = path.as_ref();
+ let file_name = path.file_name().and_then(|filename| {
+ Some(filename.to_string_lossy().into_owned())
+ });
+ let ext = path.extension()
+ .and_then(|ext| ext.to_str())
+ .unwrap_or("");
+ let mime = mime_guess::from_ext(ext).first_or_octet_stream();
+ let mut file = File::open(path)?;
+ let mut buffer = vec![];
+ let bytes_read = file.read_to_end(&mut buffer)?;
+ let field = Part::bytes(buffer)
+ .mime_str(&mime.to_string())
+ .map_err(|e| io::Error::new(io::ErrorKind::NotFound, "Invalid/unknown mime type"))?;
+ Ok(if let Some(file_name) = file_name {
+ field.file_name(file_name)
+ } else {
+ field
+ })
+}
+
+pub struct DefaultApiClient {
+ configuration: Arc,
+}
+
+impl DefaultApiClient {
+ pub fn new(configuration: Arc) -> DefaultApiClient {
+ DefaultApiClient {
+ configuration,
+ }
+ }
+}
+
+pub trait DefaultApi {
+ fn fileresponsetest(&self, ) -> Box + Send>;
+}
+
+impl DefaultApi for DefaultApiClient {
+ fn fileresponsetest(&self, ) -> Box + Send> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ 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());
+ }
+
+ // send request
+ Box::new(req_builder.send()
+ .and_then(|i| i.error_for_status())
+ .and_then(|mut i| i.json())
+ .from_err()
+ )
+ }
+
+}
diff --git a/samples/client/petstore/rust/reqwestFutures/fileResponseTest/src/apis/mod.rs b/samples/client/petstore/rust/reqwestFutures/fileResponseTest/src/apis/mod.rs
new file mode 100644
index 000000000000..3b70668f6fd9
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/fileResponseTest/src/apis/mod.rs
@@ -0,0 +1,37 @@
+use reqwest;
+use serde_json;
+
+#[derive(Debug)]
+pub enum Error {
+ Reqwest(reqwest::Error),
+ Serde(serde_json::Error),
+ Io(std::io::Error),
+}
+
+impl From for Error {
+ fn from(e: reqwest::Error) -> Self {
+ Error::Reqwest(e)
+ }
+}
+
+impl From for Error {
+ fn from(e: serde_json::Error) -> Self {
+ Error::Serde(e)
+ }
+}
+
+impl From for Error {
+ fn from(e: std::io::Error) -> Self {
+ Error::Io(e)
+ }
+}
+
+pub fn urlencode>(s: T) -> String {
+ ::url::form_urlencoded::byte_serialize(s.as_ref().as_bytes()).collect()
+}
+
+mod default_api;
+pub use self::default_api::{ DefaultApi, DefaultApiClient };
+
+pub mod configuration;
+pub mod client;
diff --git a/samples/client/petstore/rust/reqwestFutures/fileResponseTest/src/lib.rs b/samples/client/petstore/rust/reqwestFutures/fileResponseTest/src/lib.rs
new file mode 100644
index 000000000000..6b40adb9e9f9
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/fileResponseTest/src/lib.rs
@@ -0,0 +1,12 @@
+#[macro_use]
+extern crate serde_derive;
+
+extern crate serde;
+extern crate serde_json;
+extern crate url;
+extern crate reqwest;
+extern crate futures;
+extern crate mime_guess;
+
+pub mod apis;
+pub mod models;
diff --git a/samples/client/petstore/rust/reqwestFutures/fileResponseTest/src/models/mod.rs b/samples/client/petstore/rust/reqwestFutures/fileResponseTest/src/models/mod.rs
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/samples/client/petstore/rust/reqwestFutures/petstore/.gitignore b/samples/client/petstore/rust/reqwestFutures/petstore/.gitignore
new file mode 100644
index 000000000000..6aa106405a4b
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/petstore/.gitignore
@@ -0,0 +1,3 @@
+/target/
+**/*.rs.bk
+Cargo.lock
diff --git a/samples/client/petstore/rust/reqwestFutures/petstore/.openapi-generator-ignore b/samples/client/petstore/rust/reqwestFutures/petstore/.openapi-generator-ignore
new file mode 100644
index 000000000000..7484ee590a38
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/petstore/.openapi-generator-ignore
@@ -0,0 +1,23 @@
+# OpenAPI Generator Ignore
+# Generated by openapi-generator https://github.com/openapitools/openapi-generator
+
+# Use this file to prevent files from being overwritten by the generator.
+# The patterns follow closely to .gitignore or .dockerignore.
+
+# As an example, the C# client generator defines ApiClient.cs.
+# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
+#ApiClient.cs
+
+# You can match any string of characters against a directory, file or extension with a single asterisk (*):
+#foo/*/qux
+# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
+
+# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
+#foo/**/qux
+# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
+
+# You can also negate patterns with an exclamation (!).
+# For example, you can ignore all files in a docs folder with the file extension .md:
+#docs/*.md
+# Then explicitly reverse the ignore rule for a single file:
+#!docs/README.md
diff --git a/samples/client/petstore/rust/reqwestFutures/petstore/.openapi-generator/VERSION b/samples/client/petstore/rust/reqwestFutures/petstore/.openapi-generator/VERSION
new file mode 100644
index 000000000000..c3a2c7076fa8
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/petstore/.openapi-generator/VERSION
@@ -0,0 +1 @@
+4.2.0-SNAPSHOT
\ No newline at end of file
diff --git a/samples/client/petstore/rust/reqwestFutures/petstore/.travis.yml b/samples/client/petstore/rust/reqwestFutures/petstore/.travis.yml
new file mode 100644
index 000000000000..22761ba7ee19
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/petstore/.travis.yml
@@ -0,0 +1 @@
+language: rust
diff --git a/samples/client/petstore/rust/reqwestFutures/petstore/Cargo.toml b/samples/client/petstore/rust/reqwestFutures/petstore/Cargo.toml
new file mode 100644
index 000000000000..682ba5bb4f90
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/petstore/Cargo.toml
@@ -0,0 +1,15 @@
+[package]
+name = "petstore-reqwestFutures"
+version = "1.0.0"
+authors = ["OpenAPI Generator team and contributors"]
+
+[dependencies]
+serde = "^1.0"
+serde_derive = "^1.0"
+serde_json = "^1.0"
+url = "1.5"
+reqwest = "~0.9"
+futures = "0.1.23"
+mime_guess = "2.0.1"
+
+[dev-dependencies]
diff --git a/samples/client/petstore/rust/reqwestFutures/petstore/README.md b/samples/client/petstore/rust/reqwestFutures/petstore/README.md
new file mode 100644
index 000000000000..4465b8519c81
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/petstore/README.md
@@ -0,0 +1,68 @@
+# Rust API client for petstore-reqwestFutures
+
+This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
+
+## 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://petstore.swagger.io/v2*
+
+Class | Method | HTTP request | Description
+------------ | ------------- | ------------- | -------------
+*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
+*PetApi* | [**find_pets_by_tags**](docs/PetApi.md#find_pets_by_tags) | **get** /pet/findByTags | Finds Pets by tags
+*PetApi* | [**get_pet_by_id**](docs/PetApi.md#get_pet_by_id) | **get** /pet/{petId} | Find pet by ID
+*PetApi* | [**update_pet**](docs/PetApi.md#update_pet) | **put** /pet | Update an existing pet
+*PetApi* | [**update_pet_with_form**](docs/PetApi.md#update_pet_with_form) | **post** /pet/{petId} | Updates a pet in the store with form data
+*PetApi* | [**upload_file**](docs/PetApi.md#upload_file) | **post** /pet/{petId}/uploadImage | uploads an image
+*StoreApi* | [**delete_order**](docs/StoreApi.md#delete_order) | **delete** /store/order/{orderId} | Delete purchase order by ID
+*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
+*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
+*UserApi* | [**delete_user**](docs/UserApi.md#delete_user) | **delete** /user/{username} | Delete user
+*UserApi* | [**get_user_by_name**](docs/UserApi.md#get_user_by_name) | **get** /user/{username} | Get user by user name
+*UserApi* | [**login_user**](docs/UserApi.md#login_user) | **get** /user/login | Logs user into the system
+*UserApi* | [**logout_user**](docs/UserApi.md#logout_user) | **get** /user/logout | Logs out current logged in user session
+*UserApi* | [**update_user**](docs/UserApi.md#update_user) | **put** /user/{username} | Updated user
+
+
+## Documentation For Models
+
+ - [ApiResponse](docs/ApiResponse.md)
+ - [Category](docs/Category.md)
+ - [Order](docs/Order.md)
+ - [Pet](docs/Pet.md)
+ - [Tag](docs/Tag.md)
+ - [User](docs/User.md)
+
+
+To get access to the crate's generated documentation, use:
+
+```
+cargo doc --open
+```
+
+## Author
+
+
+
diff --git a/samples/client/petstore/rust/reqwestFutures/petstore/docs/ApiResponse.md b/samples/client/petstore/rust/reqwestFutures/petstore/docs/ApiResponse.md
new file mode 100644
index 000000000000..97128a87d97b
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/petstore/docs/ApiResponse.md
@@ -0,0 +1,13 @@
+# ApiResponse
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**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)
+
+
diff --git a/samples/client/petstore/rust/reqwestFutures/petstore/docs/Category.md b/samples/client/petstore/rust/reqwestFutures/petstore/docs/Category.md
new file mode 100644
index 000000000000..1cf67347c057
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/petstore/docs/Category.md
@@ -0,0 +1,12 @@
+# Category
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**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)
+
+
diff --git a/samples/client/petstore/rust/reqwestFutures/petstore/docs/Order.md b/samples/client/petstore/rust/reqwestFutures/petstore/docs/Order.md
new file mode 100644
index 000000000000..d9a09c397432
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/petstore/docs/Order.md
@@ -0,0 +1,16 @@
+# Order
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**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)
+
+
diff --git a/samples/client/petstore/rust/reqwestFutures/petstore/docs/Pet.md b/samples/client/petstore/rust/reqwestFutures/petstore/docs/Pet.md
new file mode 100644
index 000000000000..27886889d1d4
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/petstore/docs/Pet.md
@@ -0,0 +1,16 @@
+# Pet
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**id** | Option<**i64**> | | [optional]
+**category** | Option<[**crate::models::Category**](Category.md)> | | [optional]
+**name** | **String** | |
+**photo_urls** | **Vec** | |
+**tags** | Option<[**Vec**](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)
+
+
diff --git a/samples/client/petstore/rust/reqwestFutures/petstore/docs/PetApi.md b/samples/client/petstore/rust/reqwestFutures/petstore/docs/PetApi.md
new file mode 100644
index 000000000000..4716e752b666
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/petstore/docs/PetApi.md
@@ -0,0 +1,251 @@
+# \PetApi
+
+All URIs are relative to *http://petstore.swagger.io/v2*
+
+Method | HTTP request | Description
+------------- | ------------- | -------------
+[**add_pet**](PetApi.md#add_pet) | **post** /pet | Add a new pet to the store
+[**delete_pet**](PetApi.md#delete_pet) | **delete** /pet/{petId} | Deletes a pet
+[**find_pets_by_status**](PetApi.md#find_pets_by_status) | **get** /pet/findByStatus | Finds Pets by status
+[**find_pets_by_tags**](PetApi.md#find_pets_by_tags) | **get** /pet/findByTags | Finds Pets by tags
+[**get_pet_by_id**](PetApi.md#get_pet_by_id) | **get** /pet/{petId} | Find pet by ID
+[**update_pet**](PetApi.md#update_pet) | **put** /pet | Update an existing pet
+[**update_pet_with_form**](PetApi.md#update_pet_with_form) | **post** /pet/{petId} | Updates a pet in the store with form data
+[**upload_file**](PetApi.md#upload_file) | **post** /pet/{petId}/uploadImage | uploads an image
+
+
+
+## add_pet
+
+> add_pet(body)
+Add a new pet to the store
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**body** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | [required] |
+
+### Return type
+
+ (empty response body)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+- **Content-Type**: application/json, application/xml
+- **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)
+
+
+## delete_pet
+
+> delete_pet(pet_id, api_key)
+Deletes a pet
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**pet_id** | **i64** | Pet id to delete | [required] |
+**api_key** | Option<**String**> | | |
+
+### Return type
+
+ (empty response body)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### 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)
+
+
+## find_pets_by_status
+
+> Vec find_pets_by_status(status)
+Finds Pets by status
+
+Multiple status values can be provided with comma separated strings
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**status** | [**Vec**](String.md) | Status values that need to be considered for filter | [required] |
+
+### Return type
+
+[**Vec**](Pet.md)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/xml, 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)
+
+
+## find_pets_by_tags
+
+> Vec find_pets_by_tags(tags)
+Finds Pets by tags
+
+Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**tags** | [**Vec**](String.md) | Tags to filter by | [required] |
+
+### Return type
+
+[**Vec**](Pet.md)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/xml, application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+
+## get_pet_by_id
+
+> crate::models::Pet get_pet_by_id(pet_id)
+Find pet by ID
+
+Returns a single pet
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**pet_id** | **i64** | ID of pet to return | [required] |
+
+### Return type
+
+[**crate::models::Pet**](Pet.md)
+
+### Authorization
+
+[api_key](../README.md#api_key)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/xml, 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)
+
+
+## update_pet
+
+> update_pet(body)
+Update an existing pet
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**body** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | [required] |
+
+### Return type
+
+ (empty response body)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+- **Content-Type**: application/json, application/xml
+- **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)
+
+
+## update_pet_with_form
+
+> update_pet_with_form(pet_id, name, status)
+Updates a pet in the store with form data
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**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
+
+ (empty response body)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+- **Content-Type**: application/x-www-form-urlencoded
+- **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)
+
+
+## upload_file
+
+> crate::models::ApiResponse upload_file(pet_id, additional_metadata, file)
+uploads an image
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**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
+
+[**crate::models::ApiResponse**](ApiResponse.md)
+
+### Authorization
+
+[petstore_auth](../README.md#petstore_auth)
+
+### HTTP request headers
+
+- **Content-Type**: multipart/form-data
+- **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)
+
diff --git a/samples/client/petstore/rust/reqwestFutures/petstore/docs/StoreApi.md b/samples/client/petstore/rust/reqwestFutures/petstore/docs/StoreApi.md
new file mode 100644
index 000000000000..a310b5383154
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/petstore/docs/StoreApi.md
@@ -0,0 +1,127 @@
+# \StoreApi
+
+All URIs are relative to *http://petstore.swagger.io/v2*
+
+Method | HTTP request | Description
+------------- | ------------- | -------------
+[**delete_order**](StoreApi.md#delete_order) | **delete** /store/order/{orderId} | Delete purchase order by ID
+[**get_inventory**](StoreApi.md#get_inventory) | **get** /store/inventory | Returns pet inventories by status
+[**get_order_by_id**](StoreApi.md#get_order_by_id) | **get** /store/order/{orderId} | Find purchase order by ID
+[**place_order**](StoreApi.md#place_order) | **post** /store/order | Place an order for a pet
+
+
+
+## delete_order
+
+> delete_order(order_id)
+Delete purchase order by ID
+
+For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**order_id** | **String** | ID of the order that needs to be deleted | [required] |
+
+### 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)
+
+
+## get_inventory
+
+> ::std::collections::HashMap get_inventory()
+Returns pet inventories by status
+
+Returns a map of status codes to quantities
+
+### Parameters
+
+This endpoint does not need any parameter.
+
+### Return type
+
+**::std::collections::HashMap**
+
+### Authorization
+
+[api_key](../README.md#api_key)
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
+
+
+## get_order_by_id
+
+> crate::models::Order get_order_by_id(order_id)
+Find purchase order by ID
+
+For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**order_id** | **i64** | ID of pet that needs to be fetched | [required] |
+
+### Return type
+
+[**crate::models::Order**](Order.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/xml, 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)
+
+
+## place_order
+
+> crate::models::Order place_order(body)
+Place an order for a pet
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**body** | [**Order**](Order.md) | order placed for purchasing the pet | [required] |
+
+### Return type
+
+[**crate::models::Order**](Order.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/xml, 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)
+
diff --git a/samples/client/petstore/rust/reqwestFutures/petstore/docs/Tag.md b/samples/client/petstore/rust/reqwestFutures/petstore/docs/Tag.md
new file mode 100644
index 000000000000..7bf71ab0e9d8
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/petstore/docs/Tag.md
@@ -0,0 +1,12 @@
+# Tag
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**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)
+
+
diff --git a/samples/client/petstore/rust/reqwestFutures/petstore/docs/User.md b/samples/client/petstore/rust/reqwestFutures/petstore/docs/User.md
new file mode 100644
index 000000000000..2e6abda42b32
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/petstore/docs/User.md
@@ -0,0 +1,18 @@
+# User
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**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)
+
+
diff --git a/samples/client/petstore/rust/reqwestFutures/petstore/docs/UserApi.md b/samples/client/petstore/rust/reqwestFutures/petstore/docs/UserApi.md
new file mode 100644
index 000000000000..a6268f251a64
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/petstore/docs/UserApi.md
@@ -0,0 +1,245 @@
+# \UserApi
+
+All URIs are relative to *http://petstore.swagger.io/v2*
+
+Method | HTTP request | Description
+------------- | ------------- | -------------
+[**create_user**](UserApi.md#create_user) | **post** /user | Create user
+[**create_users_with_array_input**](UserApi.md#create_users_with_array_input) | **post** /user/createWithArray | Creates list of users with given input array
+[**create_users_with_list_input**](UserApi.md#create_users_with_list_input) | **post** /user/createWithList | Creates list of users with given input array
+[**delete_user**](UserApi.md#delete_user) | **delete** /user/{username} | Delete user
+[**get_user_by_name**](UserApi.md#get_user_by_name) | **get** /user/{username} | Get user by user name
+[**login_user**](UserApi.md#login_user) | **get** /user/login | Logs user into the system
+[**logout_user**](UserApi.md#logout_user) | **get** /user/logout | Logs out current logged in user session
+[**update_user**](UserApi.md#update_user) | **put** /user/{username} | Updated user
+
+
+
+## create_user
+
+> create_user(body)
+Create user
+
+This can only be done by the logged in user.
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**body** | [**User**](User.md) | Created user object | [required] |
+
+### 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)
+
+
+## create_users_with_array_input
+
+> create_users_with_array_input(body)
+Creates list of users with given input array
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**body** | [**Vec**](User.md) | List of user object | [required] |
+
+### 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)
+
+
+## create_users_with_list_input
+
+> create_users_with_list_input(body)
+Creates list of users with given input array
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**body** | [**Vec**](User.md) | List of user object | [required] |
+
+### 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)
+
+
+## delete_user
+
+> delete_user(username)
+Delete user
+
+This can only be done by the logged in user.
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**username** | **String** | The name that needs to be deleted | [required] |
+
+### 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)
+
+
+## get_user_by_name
+
+> crate::models::User get_user_by_name(username)
+Get user by user name
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**username** | **String** | The name that needs to be fetched. Use user1 for testing. | [required] |
+
+### Return type
+
+[**crate::models::User**](User.md)
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/xml, 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)
+
+
+## login_user
+
+> String login_user(username, password)
+Logs user into the system
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**username** | **String** | The user name for login | [required] |
+**password** | **String** | The password for login in clear text | [required] |
+
+### Return type
+
+**String**
+
+### Authorization
+
+No authorization required
+
+### HTTP request headers
+
+- **Content-Type**: Not defined
+- **Accept**: application/xml, 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)
+
+
+## logout_user
+
+> logout_user()
+Logs out current logged in user session
+
+### 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)
+
+
+## update_user
+
+> update_user(username, body)
+Updated user
+
+This can only be done by the logged in user.
+
+### Parameters
+
+
+Name | Type | Description | Required | Notes
+------------- | ------------- | ------------- | ------------- | -------------
+**username** | **String** | name that need to be deleted | [required] |
+**body** | [**User**](User.md) | Updated user object | [required] |
+
+### 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)
+
diff --git a/samples/client/petstore/rust/reqwestFutures/petstore/git_push.sh b/samples/client/petstore/rust/reqwestFutures/petstore/git_push.sh
new file mode 100644
index 000000000000..ced3be2b0c7b
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/petstore/git_push.sh
@@ -0,0 +1,58 @@
+#!/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'
+
diff --git a/samples/client/petstore/rust/reqwestFutures/petstore/src/apis/client.rs b/samples/client/petstore/rust/reqwestFutures/petstore/src/apis/client.rs
new file mode 100644
index 000000000000..260183d6ba80
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/petstore/src/apis/client.rs
@@ -0,0 +1,34 @@
+use std::sync::Arc;
+
+use super::configuration::Configuration;
+
+pub struct APIClient {
+ pet_api: Box,
+ store_api: Box,
+ user_api: Box,
+}
+
+impl APIClient {
+ pub fn new(configuration: Configuration) -> APIClient {
+ let rc = Arc::new(configuration);
+
+ APIClient {
+ pet_api: Box::new(crate::apis::PetApiClient::new(rc.clone())),
+ store_api: Box::new(crate::apis::StoreApiClient::new(rc.clone())),
+ user_api: Box::new(crate::apis::UserApiClient::new(rc.clone())),
+ }
+ }
+
+ pub fn pet_api(&self) -> &dyn crate::apis::PetApi{
+ self.pet_api.as_ref()
+ }
+
+ pub fn store_api(&self) -> &dyn crate::apis::StoreApi{
+ self.store_api.as_ref()
+ }
+
+ pub fn user_api(&self) -> &dyn crate::apis::UserApi{
+ self.user_api.as_ref()
+ }
+
+}
diff --git a/samples/client/petstore/rust/reqwestFutures/petstore/src/apis/configuration.rs b/samples/client/petstore/rust/reqwestFutures/petstore/src/apis/configuration.rs
new file mode 100644
index 000000000000..4442a66f0d25
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/petstore/src/apis/configuration.rs
@@ -0,0 +1,50 @@
+/*
+ * 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;
+
+pub struct Configuration {
+ pub base_path: String,
+ pub user_agent: Option,
+ pub client: reqwest::async::Client,
+ pub basic_auth: Option,
+ pub oauth_access_token: Option,
+ pub bearer_access_token: Option,
+ pub api_key: Option,
+ // TODO: take an oauth2 token source, similar to the go one
+}
+
+pub type BasicAuth = (String, Option);
+
+pub struct ApiKey {
+ pub prefix: Option,
+ pub key: String,
+}
+
+impl Configuration {
+ pub fn new() -> Configuration {
+ Configuration::default()
+ }
+}
+
+impl Default for Configuration {
+ fn default() -> Self {
+ Configuration {
+ base_path: "http://petstore.swagger.io/v2".to_owned(),
+ user_agent: Some("OpenAPI-Generator/1.0.0/rust".to_owned()),
+ client: reqwest::async::Client::new(),
+ basic_auth: None,
+ oauth_access_token: None,
+ bearer_access_token: None,
+ api_key: None,
+ }
+ }
+}
diff --git a/samples/client/petstore/rust/reqwestFutures/petstore/src/apis/mod.rs b/samples/client/petstore/rust/reqwestFutures/petstore/src/apis/mod.rs
new file mode 100644
index 000000000000..c14d751153a1
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/petstore/src/apis/mod.rs
@@ -0,0 +1,41 @@
+use reqwest;
+use serde_json;
+
+#[derive(Debug)]
+pub enum Error {
+ Reqwest(reqwest::Error),
+ Serde(serde_json::Error),
+ Io(std::io::Error),
+}
+
+impl From for Error {
+ fn from(e: reqwest::Error) -> Self {
+ Error::Reqwest(e)
+ }
+}
+
+impl From for Error {
+ fn from(e: serde_json::Error) -> Self {
+ Error::Serde(e)
+ }
+}
+
+impl From for Error {
+ fn from(e: std::io::Error) -> Self {
+ Error::Io(e)
+ }
+}
+
+pub fn urlencode>(s: T) -> String {
+ ::url::form_urlencoded::byte_serialize(s.as_ref().as_bytes()).collect()
+}
+
+mod pet_api;
+pub use self::pet_api::{ PetApi, PetApiClient };
+mod store_api;
+pub use self::store_api::{ StoreApi, StoreApiClient };
+mod user_api;
+pub use self::user_api::{ UserApi, UserApiClient };
+
+pub mod configuration;
+pub mod client;
diff --git a/samples/client/petstore/rust/reqwestFutures/petstore/src/apis/pet_api.rs b/samples/client/petstore/rust/reqwestFutures/petstore/src/apis/pet_api.rs
new file mode 100644
index 000000000000..e75e03528271
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/petstore/src/apis/pet_api.rs
@@ -0,0 +1,278 @@
+/*
+ * 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::sync::Arc;
+use std::borrow::Borrow;
+#[allow(unused_imports)]
+use std::option::Option;
+use futures::{Future, future};
+use reqwest;
+use mime_guess::{self, Mime};
+use reqwest::async::multipart::Part;
+use super::{Error, configuration};
+use std::path::Path;
+use std::io;
+use std::io::Read;
+use std::fs::{File};
+
+fn part_from_file>(path: T) -> io::Result {
+ let path = path.as_ref();
+ let file_name = path.file_name().and_then(|filename| {
+ Some(filename.to_string_lossy().into_owned())
+ });
+ let ext = path.extension()
+ .and_then(|ext| ext.to_str())
+ .unwrap_or("");
+ let mime = mime_guess::from_ext(ext).first_or_octet_stream();
+ let mut file = File::open(path)?;
+ let mut buffer = vec![];
+ let bytes_read = file.read_to_end(&mut buffer)?;
+ let field = Part::bytes(buffer)
+ .mime_str(&mime.to_string())
+ .map_err(|e| io::Error::new(io::ErrorKind::NotFound, "Invalid/unknown mime type"))?;
+ Ok(if let Some(file_name) = file_name {
+ field.file_name(file_name)
+ } else {
+ field
+ })
+}
+
+pub struct PetApiClient {
+ configuration: Arc,
+}
+
+impl PetApiClient {
+ pub fn new(configuration: Arc) -> PetApiClient {
+ PetApiClient {
+ configuration,
+ }
+ }
+}
+
+pub trait PetApi {
+ fn add_pet(&self, body: crate::models::Pet) -> Box + Send>;
+ fn delete_pet(&self, pet_id: i64, api_key: Option<&str>) -> Box + Send>;
+ fn find_pets_by_status(&self, status: Vec) -> Box, Error = Error> + Send>;
+ fn find_pets_by_tags(&self, tags: Vec) -> Box, Error = Error> + Send>;
+ fn get_pet_by_id(&self, pet_id: i64) -> Box + Send>;
+ fn update_pet(&self, body: crate::models::Pet) -> Box + Send>;
+ fn update_pet_with_form(&self, pet_id: i64, name: Option<&str>, status: Option<&str>) -> Box + Send>;
+ fn upload_file(&self, pet_id: i64, additional_metadata: Option<&str>, file: Option) -> Box + Send>;
+}
+
+impl PetApi for PetApiClient {
+ fn add_pet(&self, body: crate::models::Pet) -> Box + Send> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/pet", configuration.base_path);
+ let mut req_builder = client.post(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());
+ }
+ if let Some(ref token) = configuration.oauth_access_token {
+ req_builder = req_builder.bearer_auth(token.to_owned());
+ };
+ req_builder = req_builder.json(&body);
+
+ // send request
+ Box::new(req_builder.send()
+ .and_then(|i| i.error_for_status())
+ .map(|_| ())
+ .from_err()
+ )
+ }
+
+ fn delete_pet(&self, pet_id: i64, api_key: Option<&str>) -> Box + Send> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/pet/{petId}", configuration.base_path, petId=pet_id);
+ let mut req_builder = client.delete(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());
+ }
+ 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());
+ };
+
+ // send request
+ Box::new(req_builder.send()
+ .and_then(|i| i.error_for_status())
+ .map(|_| ())
+ .from_err()
+ )
+ }
+
+ fn find_pets_by_status(&self, status: Vec) -> Box, Error = Error> + Send> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/pet/findByStatus", configuration.base_path);
+ let mut req_builder = client.get(uri_str.as_str());
+
+ req_builder = req_builder.query(&[("status", &status.into_iter().map(|p| p.to_string()).collect::>().join(",").to_string())]);
+ if let Some(ref user_agent) = configuration.user_agent {
+ req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
+ }
+ if let Some(ref token) = configuration.oauth_access_token {
+ req_builder = req_builder.bearer_auth(token.to_owned());
+ };
+
+ // send request
+ Box::new(req_builder.send()
+ .and_then(|i| i.error_for_status())
+ .and_then(|mut i| i.json())
+ .from_err()
+ )
+ }
+
+ fn find_pets_by_tags(&self, tags: Vec) -> Box, Error = Error> + Send> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/pet/findByTags", configuration.base_path);
+ let mut req_builder = client.get(uri_str.as_str());
+
+ req_builder = req_builder.query(&[("tags", &tags.into_iter().map(|p| p.to_string()).collect::>().join(",").to_string())]);
+ if let Some(ref user_agent) = configuration.user_agent {
+ req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
+ }
+ if let Some(ref token) = configuration.oauth_access_token {
+ req_builder = req_builder.bearer_auth(token.to_owned());
+ };
+
+ // send request
+ Box::new(req_builder.send()
+ .and_then(|i| i.error_for_status())
+ .and_then(|mut i| i.json())
+ .from_err()
+ )
+ }
+
+ fn get_pet_by_id(&self, pet_id: i64) -> Box + Send> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/pet/{petId}", configuration.base_path, petId=pet_id);
+ 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());
+ }
+ if let Some(ref apikey) = configuration.api_key {
+ let key = apikey.key.clone();
+ let val = match apikey.prefix {
+ Some(ref prefix) => format!("{} {}", prefix, key),
+ None => key,
+ };
+ req_builder = req_builder.header("api_key", val);
+ };
+
+ // send request
+ Box::new(req_builder.send()
+ .and_then(|i| i.error_for_status())
+ .and_then(|mut i| i.json())
+ .from_err()
+ )
+ }
+
+ fn update_pet(&self, body: crate::models::Pet) -> Box + Send> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/pet", configuration.base_path);
+ let mut req_builder = client.put(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());
+ }
+ if let Some(ref token) = configuration.oauth_access_token {
+ req_builder = req_builder.bearer_auth(token.to_owned());
+ };
+ req_builder = req_builder.json(&body);
+
+ // send request
+ Box::new(req_builder.send()
+ .and_then(|i| i.error_for_status())
+ .map(|_| ())
+ .from_err()
+ )
+ }
+
+ fn update_pet_with_form(&self, pet_id: i64, name: Option<&str>, status: Option<&str>) -> Box + Send> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/pet/{petId}", configuration.base_path, petId=pet_id);
+ let mut req_builder = client.post(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());
+ }
+ if let Some(ref token) = configuration.oauth_access_token {
+ req_builder = req_builder.bearer_auth(token.to_owned());
+ };
+ let mut form_params = std::collections::HashMap::new();
+ 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
+ Box::new(req_builder.send()
+ .and_then(|i| i.error_for_status())
+ .map(|_| ())
+ .from_err()
+ )
+ }
+
+ fn upload_file(&self, pet_id: i64, additional_metadata: Option<&str>, file: Option) -> Box + Send> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/pet/{petId}/uploadImage", configuration.base_path, petId=pet_id);
+ let mut req_builder = client.post(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());
+ }
+ if let Some(ref token) = configuration.oauth_access_token {
+ req_builder = req_builder.bearer_auth(token.to_owned());
+ };
+ let mut form = reqwest::async::multipart::Form::new();
+ if let Some(param_value) = additional_metadata {
+ form = form.text("additionalMetadata", param_value.to_string());
+ }
+ if let Some(param_value) = file {
+ match part_from_file(param_value) {
+ Ok(part) => { form = form.part("file", part); },
+ Err(e) => { return Box::new(future::err(e.into())); }
+ }
+ }
+ req_builder = req_builder.multipart(form);
+
+ // send request
+ Box::new(req_builder.send()
+ .and_then(|i| i.error_for_status())
+ .and_then(|mut i| i.json())
+ .from_err()
+ )
+ }
+
+}
diff --git a/samples/client/petstore/rust/reqwestFutures/petstore/src/apis/store_api.rs b/samples/client/petstore/rust/reqwestFutures/petstore/src/apis/store_api.rs
new file mode 100644
index 000000000000..c2de90f4c088
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/petstore/src/apis/store_api.rs
@@ -0,0 +1,152 @@
+/*
+ * 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::sync::Arc;
+use std::borrow::Borrow;
+#[allow(unused_imports)]
+use std::option::Option;
+use futures::{Future, future};
+use reqwest;
+use mime_guess::{self, Mime};
+use reqwest::async::multipart::Part;
+use super::{Error, configuration};
+use std::path::Path;
+use std::io;
+use std::io::Read;
+use std::fs::{File};
+
+fn part_from_file>(path: T) -> io::Result {
+ let path = path.as_ref();
+ let file_name = path.file_name().and_then(|filename| {
+ Some(filename.to_string_lossy().into_owned())
+ });
+ let ext = path.extension()
+ .and_then(|ext| ext.to_str())
+ .unwrap_or("");
+ let mime = mime_guess::from_ext(ext).first_or_octet_stream();
+ let mut file = File::open(path)?;
+ let mut buffer = vec![];
+ let bytes_read = file.read_to_end(&mut buffer)?;
+ let field = Part::bytes(buffer)
+ .mime_str(&mime.to_string())
+ .map_err(|e| io::Error::new(io::ErrorKind::NotFound, "Invalid/unknown mime type"))?;
+ Ok(if let Some(file_name) = file_name {
+ field.file_name(file_name)
+ } else {
+ field
+ })
+}
+
+pub struct StoreApiClient {
+ configuration: Arc,
+}
+
+impl StoreApiClient {
+ pub fn new(configuration: Arc) -> StoreApiClient {
+ StoreApiClient {
+ configuration,
+ }
+ }
+}
+
+pub trait StoreApi {
+ fn delete_order(&self, order_id: &str) -> Box + Send>;
+ fn get_inventory(&self, ) -> Box, Error = Error> + Send>;
+ fn get_order_by_id(&self, order_id: i64) -> Box + Send>;
+ fn place_order(&self, body: crate::models::Order) -> Box + Send>;
+}
+
+impl StoreApi for StoreApiClient {
+ fn delete_order(&self, order_id: &str) -> Box + Send> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/store/order/{orderId}", configuration.base_path, orderId=crate::apis::urlencode(order_id));
+ let mut req_builder = client.delete(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());
+ }
+
+ // send request
+ Box::new(req_builder.send()
+ .and_then(|i| i.error_for_status())
+ .map(|_| ())
+ .from_err()
+ )
+ }
+
+ fn get_inventory(&self, ) -> Box, Error = Error> + Send> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/store/inventory", 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());
+ }
+ if let Some(ref apikey) = configuration.api_key {
+ let key = apikey.key.clone();
+ let val = match apikey.prefix {
+ Some(ref prefix) => format!("{} {}", prefix, key),
+ None => key,
+ };
+ req_builder = req_builder.header("api_key", val);
+ };
+
+ // send request
+ Box::new(req_builder.send()
+ .and_then(|i| i.error_for_status())
+ .and_then(|mut i| i.json())
+ .from_err()
+ )
+ }
+
+ fn get_order_by_id(&self, order_id: i64) -> Box + Send> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/store/order/{orderId}", configuration.base_path, orderId=order_id);
+ 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());
+ }
+
+ // send request
+ Box::new(req_builder.send()
+ .and_then(|i| i.error_for_status())
+ .and_then(|mut i| i.json())
+ .from_err()
+ )
+ }
+
+ fn place_order(&self, body: crate::models::Order) -> Box + Send> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/store/order", configuration.base_path);
+ let mut req_builder = client.post(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());
+ }
+ req_builder = req_builder.json(&body);
+
+ // send request
+ Box::new(req_builder.send()
+ .and_then(|i| i.error_for_status())
+ .and_then(|mut i| i.json())
+ .from_err()
+ )
+ }
+
+}
diff --git a/samples/client/petstore/rust/reqwestFutures/petstore/src/apis/user_api.rs b/samples/client/petstore/rust/reqwestFutures/petstore/src/apis/user_api.rs
new file mode 100644
index 000000000000..ab7554dcbb1c
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/petstore/src/apis/user_api.rs
@@ -0,0 +1,229 @@
+/*
+ * 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::sync::Arc;
+use std::borrow::Borrow;
+#[allow(unused_imports)]
+use std::option::Option;
+use futures::{Future, future};
+use reqwest;
+use mime_guess::{self, Mime};
+use reqwest::async::multipart::Part;
+use super::{Error, configuration};
+use std::path::Path;
+use std::io;
+use std::io::Read;
+use std::fs::{File};
+
+fn part_from_file>(path: T) -> io::Result {
+ let path = path.as_ref();
+ let file_name = path.file_name().and_then(|filename| {
+ Some(filename.to_string_lossy().into_owned())
+ });
+ let ext = path.extension()
+ .and_then(|ext| ext.to_str())
+ .unwrap_or("");
+ let mime = mime_guess::from_ext(ext).first_or_octet_stream();
+ let mut file = File::open(path)?;
+ let mut buffer = vec![];
+ let bytes_read = file.read_to_end(&mut buffer)?;
+ let field = Part::bytes(buffer)
+ .mime_str(&mime.to_string())
+ .map_err(|e| io::Error::new(io::ErrorKind::NotFound, "Invalid/unknown mime type"))?;
+ Ok(if let Some(file_name) = file_name {
+ field.file_name(file_name)
+ } else {
+ field
+ })
+}
+
+pub struct UserApiClient {
+ configuration: Arc,
+}
+
+impl UserApiClient {
+ pub fn new(configuration: Arc) -> UserApiClient {
+ UserApiClient {
+ configuration,
+ }
+ }
+}
+
+pub trait UserApi {
+ fn create_user(&self, body: crate::models::User) -> Box + Send>;
+ fn create_users_with_array_input(&self, body: Vec) -> Box + Send>;
+ fn create_users_with_list_input(&self, body: Vec) -> Box + Send>;
+ fn delete_user(&self, username: &str) -> Box + Send>;
+ fn get_user_by_name(&self, username: &str) -> Box + Send>;
+ fn login_user(&self, username: &str, password: &str) -> Box + Send>;
+ fn logout_user(&self, ) -> Box + Send>;
+ fn update_user(&self, username: &str, body: crate::models::User) -> Box + Send>;
+}
+
+impl UserApi for UserApiClient {
+ fn create_user(&self, body: crate::models::User) -> Box + Send> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/user", configuration.base_path);
+ let mut req_builder = client.post(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());
+ }
+ req_builder = req_builder.json(&body);
+
+ // send request
+ Box::new(req_builder.send()
+ .and_then(|i| i.error_for_status())
+ .map(|_| ())
+ .from_err()
+ )
+ }
+
+ fn create_users_with_array_input(&self, body: Vec) -> Box + Send> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/user/createWithArray", configuration.base_path);
+ let mut req_builder = client.post(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());
+ }
+ req_builder = req_builder.json(&body);
+
+ // send request
+ Box::new(req_builder.send()
+ .and_then(|i| i.error_for_status())
+ .map(|_| ())
+ .from_err()
+ )
+ }
+
+ fn create_users_with_list_input(&self, body: Vec) -> Box + Send> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/user/createWithList", configuration.base_path);
+ let mut req_builder = client.post(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());
+ }
+ req_builder = req_builder.json(&body);
+
+ // send request
+ Box::new(req_builder.send()
+ .and_then(|i| i.error_for_status())
+ .map(|_| ())
+ .from_err()
+ )
+ }
+
+ fn delete_user(&self, username: &str) -> Box + Send> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/user/{username}", configuration.base_path, username=crate::apis::urlencode(username));
+ let mut req_builder = client.delete(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());
+ }
+
+ // send request
+ Box::new(req_builder.send()
+ .and_then(|i| i.error_for_status())
+ .map(|_| ())
+ .from_err()
+ )
+ }
+
+ fn get_user_by_name(&self, username: &str) -> Box + Send> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/user/{username}", configuration.base_path, username=crate::apis::urlencode(username));
+ 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());
+ }
+
+ // send request
+ Box::new(req_builder.send()
+ .and_then(|i| i.error_for_status())
+ .and_then(|mut i| i.json())
+ .from_err()
+ )
+ }
+
+ fn login_user(&self, username: &str, password: &str) -> Box + Send> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/user/login", configuration.base_path);
+ let mut req_builder = client.get(uri_str.as_str());
+
+ req_builder = req_builder.query(&[("username", &username.to_string())]);
+ req_builder = req_builder.query(&[("password", &password.to_string())]);
+ if let Some(ref user_agent) = configuration.user_agent {
+ req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
+ }
+
+ // send request
+ Box::new(req_builder.send()
+ .and_then(|i| i.error_for_status())
+ .and_then(|mut i| i.json())
+ .from_err()
+ )
+ }
+
+ fn logout_user(&self, ) -> Box + Send> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/user/logout", 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());
+ }
+
+ // send request
+ Box::new(req_builder.send()
+ .and_then(|i| i.error_for_status())
+ .map(|_| ())
+ .from_err()
+ )
+ }
+
+ fn update_user(&self, username: &str, body: crate::models::User) -> Box + Send> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/user/{username}", configuration.base_path, username=crate::apis::urlencode(username));
+ let mut req_builder = client.put(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());
+ }
+ req_builder = req_builder.json(&body);
+
+ // send request
+ Box::new(req_builder.send()
+ .and_then(|i| i.error_for_status())
+ .map(|_| ())
+ .from_err()
+ )
+ }
+
+}
diff --git a/samples/client/petstore/rust/reqwestFutures/petstore/src/lib.rs b/samples/client/petstore/rust/reqwestFutures/petstore/src/lib.rs
new file mode 100644
index 000000000000..6b40adb9e9f9
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/petstore/src/lib.rs
@@ -0,0 +1,12 @@
+#[macro_use]
+extern crate serde_derive;
+
+extern crate serde;
+extern crate serde_json;
+extern crate url;
+extern crate reqwest;
+extern crate futures;
+extern crate mime_guess;
+
+pub mod apis;
+pub mod models;
diff --git a/samples/client/petstore/rust/reqwestFutures/petstore/src/models/api_response.rs b/samples/client/petstore/rust/reqwestFutures/petstore/src/models/api_response.rs
new file mode 100644
index 000000000000..f1286a5d1c84
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/petstore/src/models/api_response.rs
@@ -0,0 +1,36 @@
+/*
+ * 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
+ */
+
+/// ApiResponse : Describes the result of uploading an image resource
+
+
+
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+pub struct ApiResponse {
+ #[serde(rename = "code", skip_serializing_if = "Option::is_none")]
+ pub code: Option,
+ #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
+ pub _type: Option,
+ #[serde(rename = "message", skip_serializing_if = "Option::is_none")]
+ pub message: Option,
+}
+
+impl ApiResponse {
+ /// Describes the result of uploading an image resource
+ pub fn new() -> ApiResponse {
+ ApiResponse {
+ code: None,
+ _type: None,
+ message: None,
+ }
+ }
+}
+
+
diff --git a/samples/client/petstore/rust/reqwestFutures/petstore/src/models/category.rs b/samples/client/petstore/rust/reqwestFutures/petstore/src/models/category.rs
new file mode 100644
index 000000000000..dcd2dc386302
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/petstore/src/models/category.rs
@@ -0,0 +1,33 @@
+/*
+ * 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
+ */
+
+/// Category : A category for a pet
+
+
+
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+pub struct Category {
+ #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
+ pub id: Option,
+ #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
+ pub name: Option,
+}
+
+impl Category {
+ /// A category for a pet
+ pub fn new() -> Category {
+ Category {
+ id: None,
+ name: None,
+ }
+ }
+}
+
+
diff --git a/samples/client/petstore/rust/reqwestFutures/petstore/src/models/mod.rs b/samples/client/petstore/rust/reqwestFutures/petstore/src/models/mod.rs
new file mode 100644
index 000000000000..1baf2f7528e2
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/petstore/src/models/mod.rs
@@ -0,0 +1,12 @@
+pub mod api_response;
+pub use self::api_response::ApiResponse;
+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 tag;
+pub use self::tag::Tag;
+pub mod user;
+pub use self::user::User;
diff --git a/samples/client/petstore/rust/reqwestFutures/petstore/src/models/order.rs b/samples/client/petstore/rust/reqwestFutures/petstore/src/models/order.rs
new file mode 100644
index 000000000000..89cab91e62c1
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/petstore/src/models/order.rs
@@ -0,0 +1,56 @@
+/*
+ * 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
+ */
+
+/// Order : An order for a pets from the pet store
+
+
+
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+pub struct Order {
+ #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
+ pub id: Option,
+ #[serde(rename = "petId", skip_serializing_if = "Option::is_none")]
+ pub pet_id: Option,
+ #[serde(rename = "quantity", skip_serializing_if = "Option::is_none")]
+ pub quantity: Option,
+ #[serde(rename = "shipDate", skip_serializing_if = "Option::is_none")]
+ pub ship_date: Option,
+ /// Order Status
+ #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
+ pub status: Option,
+ #[serde(rename = "complete", skip_serializing_if = "Option::is_none")]
+ pub complete: Option,
+}
+
+impl Order {
+ /// An order for a pets from the pet store
+ pub fn new() -> Order {
+ Order {
+ id: None,
+ pet_id: None,
+ quantity: None,
+ ship_date: None,
+ status: None,
+ complete: None,
+ }
+ }
+}
+
+/// Order Status
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+pub enum Status {
+ #[serde(rename = "placed")]
+ Placed,
+ #[serde(rename = "approved")]
+ Approved,
+ #[serde(rename = "delivered")]
+ Delivered,
+}
+
diff --git a/samples/client/petstore/rust/reqwestFutures/petstore/src/models/pet.rs b/samples/client/petstore/rust/reqwestFutures/petstore/src/models/pet.rs
new file mode 100644
index 000000000000..ff8a32fee3ab
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/petstore/src/models/pet.rs
@@ -0,0 +1,56 @@
+/*
+ * 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
+ */
+
+/// Pet : A pet for sale in the pet store
+
+
+
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+pub struct Pet {
+ #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
+ pub id: Option,
+ #[serde(rename = "category", skip_serializing_if = "Option::is_none")]
+ pub category: Option,
+ #[serde(rename = "name")]
+ pub name: String,
+ #[serde(rename = "photoUrls")]
+ pub photo_urls: Vec,
+ #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
+ pub tags: Option>,
+ /// pet status in the store
+ #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
+ pub status: Option,
+}
+
+impl Pet {
+ /// A pet for sale in the pet store
+ pub fn new(name: String, photo_urls: Vec) -> Pet {
+ Pet {
+ id: None,
+ category: None,
+ name,
+ photo_urls,
+ tags: None,
+ status: None,
+ }
+ }
+}
+
+/// pet status in the store
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+pub enum Status {
+ #[serde(rename = "available")]
+ Available,
+ #[serde(rename = "pending")]
+ Pending,
+ #[serde(rename = "sold")]
+ Sold,
+}
+
diff --git a/samples/client/petstore/rust/reqwestFutures/petstore/src/models/tag.rs b/samples/client/petstore/rust/reqwestFutures/petstore/src/models/tag.rs
new file mode 100644
index 000000000000..f6bcb5c78d6a
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/petstore/src/models/tag.rs
@@ -0,0 +1,33 @@
+/*
+ * 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
+ */
+
+/// Tag : A tag for a pet
+
+
+
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+pub struct Tag {
+ #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
+ pub id: Option,
+ #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
+ pub name: Option,
+}
+
+impl Tag {
+ /// A tag for a pet
+ pub fn new() -> Tag {
+ Tag {
+ id: None,
+ name: None,
+ }
+ }
+}
+
+
diff --git a/samples/client/petstore/rust/reqwestFutures/petstore/src/models/user.rs b/samples/client/petstore/rust/reqwestFutures/petstore/src/models/user.rs
new file mode 100644
index 000000000000..cf863af7b585
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/petstore/src/models/user.rs
@@ -0,0 +1,52 @@
+/*
+ * 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
+ */
+
+/// User : A User who is purchasing from the pet store
+
+
+
+#[derive(Debug, PartialEq, Serialize, Deserialize)]
+pub struct User {
+ #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
+ pub id: Option,
+ #[serde(rename = "username", skip_serializing_if = "Option::is_none")]
+ pub username: Option,
+ #[serde(rename = "firstName", skip_serializing_if = "Option::is_none")]
+ pub first_name: Option,
+ #[serde(rename = "lastName", skip_serializing_if = "Option::is_none")]
+ pub last_name: Option,
+ #[serde(rename = "email", skip_serializing_if = "Option::is_none")]
+ pub email: Option,
+ #[serde(rename = "password", skip_serializing_if = "Option::is_none")]
+ pub password: Option,
+ #[serde(rename = "phone", skip_serializing_if = "Option::is_none")]
+ pub phone: Option,
+ /// User Status
+ #[serde(rename = "userStatus", skip_serializing_if = "Option::is_none")]
+ pub user_status: Option,
+}
+
+impl User {
+ /// A User who is purchasing from the pet store
+ pub fn new() -> User {
+ User {
+ id: None,
+ username: None,
+ first_name: None,
+ last_name: None,
+ email: None,
+ password: None,
+ phone: None,
+ user_status: None,
+ }
+ }
+}
+
+
diff --git a/samples/client/petstore/rust/reqwestFutures/rust-test/.gitignore b/samples/client/petstore/rust/reqwestFutures/rust-test/.gitignore
new file mode 100644
index 000000000000..6aa106405a4b
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/rust-test/.gitignore
@@ -0,0 +1,3 @@
+/target/
+**/*.rs.bk
+Cargo.lock
diff --git a/samples/client/petstore/rust/reqwestFutures/rust-test/.openapi-generator-ignore b/samples/client/petstore/rust/reqwestFutures/rust-test/.openapi-generator-ignore
new file mode 100644
index 000000000000..7484ee590a38
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/rust-test/.openapi-generator-ignore
@@ -0,0 +1,23 @@
+# OpenAPI Generator Ignore
+# Generated by openapi-generator https://github.com/openapitools/openapi-generator
+
+# Use this file to prevent files from being overwritten by the generator.
+# The patterns follow closely to .gitignore or .dockerignore.
+
+# As an example, the C# client generator defines ApiClient.cs.
+# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
+#ApiClient.cs
+
+# You can match any string of characters against a directory, file or extension with a single asterisk (*):
+#foo/*/qux
+# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
+
+# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
+#foo/**/qux
+# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
+
+# You can also negate patterns with an exclamation (!).
+# For example, you can ignore all files in a docs folder with the file extension .md:
+#docs/*.md
+# Then explicitly reverse the ignore rule for a single file:
+#!docs/README.md
diff --git a/samples/client/petstore/rust/reqwestFutures/rust-test/.openapi-generator/VERSION b/samples/client/petstore/rust/reqwestFutures/rust-test/.openapi-generator/VERSION
new file mode 100644
index 000000000000..c3a2c7076fa8
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/rust-test/.openapi-generator/VERSION
@@ -0,0 +1 @@
+4.2.0-SNAPSHOT
\ No newline at end of file
diff --git a/samples/client/petstore/rust/reqwestFutures/rust-test/.travis.yml b/samples/client/petstore/rust/reqwestFutures/rust-test/.travis.yml
new file mode 100644
index 000000000000..22761ba7ee19
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/rust-test/.travis.yml
@@ -0,0 +1 @@
+language: rust
diff --git a/samples/client/petstore/rust/reqwestFutures/rust-test/Cargo.toml b/samples/client/petstore/rust/reqwestFutures/rust-test/Cargo.toml
new file mode 100644
index 000000000000..5a252229b72f
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/rust-test/Cargo.toml
@@ -0,0 +1,15 @@
+[package]
+name = "rust-test-reqwestFutures"
+version = "1.0.0"
+authors = ["OpenAPI Generator team and contributors"]
+
+[dependencies]
+serde = "^1.0"
+serde_derive = "^1.0"
+serde_json = "^1.0"
+url = "1.5"
+reqwest = "~0.9"
+futures = "0.1.23"
+mime_guess = "2.0.1"
+
+[dev-dependencies]
diff --git a/samples/client/petstore/rust/reqwestFutures/rust-test/README.md b/samples/client/petstore/rust/reqwestFutures/rust-test/README.md
new file mode 100644
index 000000000000..9341aa94aa36
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/rust-test/README.md
@@ -0,0 +1,44 @@
+# Rust API client for rust-test-reqwestFutures
+
+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
+
+
+
diff --git a/samples/client/petstore/rust/reqwestFutures/rust-test/docs/DefaultApi.md b/samples/client/petstore/rust/reqwestFutures/rust-test/docs/DefaultApi.md
new file mode 100644
index 000000000000..ea01d010f01f
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/rust-test/docs/DefaultApi.md
@@ -0,0 +1,34 @@
+# \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)
+
diff --git a/samples/client/petstore/rust/reqwestFutures/rust-test/docs/TypeTesting.md b/samples/client/petstore/rust/reqwestFutures/rust-test/docs/TypeTesting.md
new file mode 100644
index 000000000000..7b05cee280a8
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/rust-test/docs/TypeTesting.md
@@ -0,0 +1,16 @@
+# TypeTesting
+
+## Properties
+
+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]
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/samples/client/petstore/rust/reqwestFutures/rust-test/git_push.sh b/samples/client/petstore/rust/reqwestFutures/rust-test/git_push.sh
new file mode 100644
index 000000000000..ced3be2b0c7b
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/rust-test/git_push.sh
@@ -0,0 +1,58 @@
+#!/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'
+
diff --git a/samples/client/petstore/rust/reqwestFutures/rust-test/src/apis/client.rs b/samples/client/petstore/rust/reqwestFutures/rust-test/src/apis/client.rs
new file mode 100644
index 000000000000..3f1438beaf1a
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/rust-test/src/apis/client.rs
@@ -0,0 +1,22 @@
+use std::sync::Arc;
+
+use super::configuration::Configuration;
+
+pub struct APIClient {
+ default_api: Box,
+}
+
+impl APIClient {
+ pub fn new(configuration: Configuration) -> APIClient {
+ let rc = Arc::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()
+ }
+
+}
diff --git a/samples/client/petstore/rust/reqwestFutures/rust-test/src/apis/configuration.rs b/samples/client/petstore/rust/reqwestFutures/rust-test/src/apis/configuration.rs
new file mode 100644
index 000000000000..a4307abb909e
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/rust-test/src/apis/configuration.rs
@@ -0,0 +1,50 @@
+/*
+ * 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 reqwest;
+
+pub struct Configuration {
+ pub base_path: String,
+ pub user_agent: Option,
+ pub client: reqwest::async::Client,
+ pub basic_auth: Option,
+ pub oauth_access_token: Option,
+ pub bearer_access_token: Option,
+ pub api_key: Option,
+ // TODO: take an oauth2 token source, similar to the go one
+}
+
+pub type BasicAuth = (String, Option);
+
+pub struct ApiKey {
+ pub prefix: Option,
+ pub key: String,
+}
+
+impl Configuration {
+ pub fn new() -> Configuration {
+ Configuration::default()
+ }
+}
+
+impl Default for Configuration {
+ fn default() -> Self {
+ Configuration {
+ base_path: "http://localhost".to_owned(),
+ user_agent: Some("OpenAPI-Generator/1.0.7/rust".to_owned()),
+ client: reqwest::async::Client::new(),
+ basic_auth: None,
+ oauth_access_token: None,
+ bearer_access_token: None,
+ api_key: None,
+ }
+ }
+}
diff --git a/samples/client/petstore/rust/reqwestFutures/rust-test/src/apis/default_api.rs b/samples/client/petstore/rust/reqwestFutures/rust-test/src/apis/default_api.rs
new file mode 100644
index 000000000000..f67aa7764d45
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/rust-test/src/apis/default_api.rs
@@ -0,0 +1,83 @@
+/*
+ * 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::sync::Arc;
+use std::borrow::Borrow;
+#[allow(unused_imports)]
+use std::option::Option;
+use futures::{Future, future};
+use reqwest;
+use mime_guess::{self, Mime};
+use reqwest::async::multipart::Part;
+use super::{Error, configuration};
+use std::path::Path;
+use std::io;
+use std::io::Read;
+use std::fs::{File};
+
+fn part_from_file>(path: T) -> io::Result {
+ let path = path.as_ref();
+ let file_name = path.file_name().and_then(|filename| {
+ Some(filename.to_string_lossy().into_owned())
+ });
+ let ext = path.extension()
+ .and_then(|ext| ext.to_str())
+ .unwrap_or("");
+ let mime = mime_guess::from_ext(ext).first_or_octet_stream();
+ let mut file = File::open(path)?;
+ let mut buffer = vec![];
+ let bytes_read = file.read_to_end(&mut buffer)?;
+ let field = Part::bytes(buffer)
+ .mime_str(&mime.to_string())
+ .map_err(|e| io::Error::new(io::ErrorKind::NotFound, "Invalid/unknown mime type"))?;
+ Ok(if let Some(file_name) = file_name {
+ field.file_name(file_name)
+ } else {
+ field
+ })
+}
+
+pub struct DefaultApiClient {
+ configuration: Arc,
+}
+
+impl DefaultApiClient {
+ pub fn new(configuration: Arc) -> DefaultApiClient {
+ DefaultApiClient {
+ configuration,
+ }
+ }
+}
+
+pub trait DefaultApi {
+ fn dummy_get(&self, ) -> Box + Send>;
+}
+
+impl DefaultApi for DefaultApiClient {
+ fn dummy_get(&self, ) -> Box + Send> {
+ let configuration: &configuration::Configuration = self.configuration.borrow();
+ let client = &configuration.client;
+
+ let uri_str = format!("{}/dummy", 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());
+ }
+
+ // send request
+ Box::new(req_builder.send()
+ .and_then(|i| i.error_for_status())
+ .map(|_| ())
+ .from_err()
+ )
+ }
+
+}
diff --git a/samples/client/petstore/rust/reqwestFutures/rust-test/src/apis/mod.rs b/samples/client/petstore/rust/reqwestFutures/rust-test/src/apis/mod.rs
new file mode 100644
index 000000000000..3b70668f6fd9
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/rust-test/src/apis/mod.rs
@@ -0,0 +1,37 @@
+use reqwest;
+use serde_json;
+
+#[derive(Debug)]
+pub enum Error {
+ Reqwest(reqwest::Error),
+ Serde(serde_json::Error),
+ Io(std::io::Error),
+}
+
+impl From for Error {
+ fn from(e: reqwest::Error) -> Self {
+ Error::Reqwest(e)
+ }
+}
+
+impl From for Error {
+ fn from(e: serde_json::Error) -> Self {
+ Error::Serde(e)
+ }
+}
+
+impl From for Error {
+ fn from(e: std::io::Error) -> Self {
+ Error::Io(e)
+ }
+}
+
+pub fn urlencode>(s: T) -> String {
+ ::url::form_urlencoded::byte_serialize(s.as_ref().as_bytes()).collect()
+}
+
+mod default_api;
+pub use self::default_api::{ DefaultApi, DefaultApiClient };
+
+pub mod configuration;
+pub mod client;
diff --git a/samples/client/petstore/rust/reqwestFutures/rust-test/src/lib.rs b/samples/client/petstore/rust/reqwestFutures/rust-test/src/lib.rs
new file mode 100644
index 000000000000..6b40adb9e9f9
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/rust-test/src/lib.rs
@@ -0,0 +1,12 @@
+#[macro_use]
+extern crate serde_derive;
+
+extern crate serde;
+extern crate serde_json;
+extern crate url;
+extern crate reqwest;
+extern crate futures;
+extern crate mime_guess;
+
+pub mod apis;
+pub mod models;
diff --git a/samples/client/petstore/rust/reqwestFutures/rust-test/src/models/mod.rs b/samples/client/petstore/rust/reqwestFutures/rust-test/src/models/mod.rs
new file mode 100644
index 000000000000..97887b5798ef
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/rust-test/src/models/mod.rs
@@ -0,0 +1,2 @@
+pub mod type_testing;
+pub use self::type_testing::TypeTesting;
diff --git a/samples/client/petstore/rust/reqwestFutures/rust-test/src/models/type_testing.rs b/samples/client/petstore/rust/reqwestFutures/rust-test/src/models/type_testing.rs
new file mode 100644
index 000000000000..57188e8ee7e4
--- /dev/null
+++ b/samples/client/petstore/rust/reqwestFutures/rust-test/src/models/type_testing.rs
@@ -0,0 +1,45 @@
+/*
+ * 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(Debug, PartialEq, Serialize, Deserialize)]
+pub struct TypeTesting {
+ #[serde(rename = "integer", skip_serializing_if = "Option::is_none")]
+ pub integer: Option,
+ #[serde(rename = "long", skip_serializing_if = "Option::is_none")]
+ pub long: Option,
+ #[serde(rename = "number", skip_serializing_if = "Option::is_none")]
+ pub number: Option,
+ #[serde(rename = "float", skip_serializing_if = "Option::is_none")]
+ pub float: Option,
+ #[serde(rename = "double", skip_serializing_if = "Option::is_none")]
+ pub double: Option,
+ #[serde(rename = "uuid", skip_serializing_if = "Option::is_none")]
+ pub uuid: Option,
+}
+
+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,
+ }
+ }
+}
+
+
diff --git a/samples/client/petstore/rust/src/apis/client.rs b/samples/client/petstore/rust/src/apis/client.rs
new file mode 100644
index 000000000000..34953d4a0631
--- /dev/null
+++ b/samples/client/petstore/rust/src/apis/client.rs
@@ -0,0 +1,35 @@
+use std::rc::Rc;
+
+use hyper;
+use super::configuration::Configuration;
+
+pub struct APIClient {
+ pet_api: Box,
+ store_api: Box,
+ user_api: Box,
+}
+
+impl APIClient {
+ pub fn new(configuration: Configuration) -> APIClient {
+ let rc = Rc::new(configuration);
+
+ APIClient {
+ pet_api: Box::new(crate::apis::PetApiClient::new(rc.clone())),
+ store_api: Box::new(crate::apis::StoreApiClient::new(rc.clone())),
+ user_api: Box::new(crate::apis::UserApiClient::new(rc.clone())),
+ }
+ }
+
+ pub fn pet_api(&self) -> &dyn crate::apis::PetApi{
+ self.pet_api.as_ref()
+ }
+
+ pub fn store_api(&self) -> &dyn crate::apis::StoreApi{
+ self.store_api.as_ref()
+ }
+
+ pub fn user_api(&self) -> &dyn crate::apis::UserApi{
+ self.user_api.as_ref()
+ }
+
+}
diff --git a/samples/client/petstore/rust/src/apis/configuration.rs b/samples/client/petstore/rust/src/apis/configuration.rs
new file mode 100644
index 000000000000..83d5f1c3d0cc
--- /dev/null
+++ b/samples/client/petstore/rust/src/apis/configuration.rs
@@ -0,0 +1,41 @@
+/*
+ * 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 hyper;
+
+pub struct Configuration {
+ pub base_path: String,
+ pub user_agent: Option,
+ pub client: hyper::client::Client,
+ pub basic_auth: Option,
+ pub oauth_access_token: Option,
+ pub api_key: Option,
+ // TODO: take an oauth2 token source, similar to the go one
+}
+
+pub type BasicAuth = (String, Option);
+
+pub struct ApiKey {
+ pub prefix: Option,
+ pub key: String,
+}
+
+impl Configuration {
+ pub fn new(client: hyper::client::Client) -> Configuration {
+ Configuration {
+ base_path: "http://petstore.swagger.io/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,
+ }
+ }
+}
diff --git a/samples/client/petstore/rust/src/apis/mod.rs b/samples/client/petstore/rust/src/apis/mod.rs
new file mode 100644
index 000000000000..8e1f9cc2adb5
--- /dev/null
+++ b/samples/client/petstore/rust/src/apis/mod.rs
@@ -0,0 +1,62 @@
+use hyper;
+use serde;
+use serde_json;
+
+#[derive(Debug)]
+pub enum Error {
+ UriError(hyper::error::UriError),
+ Hyper(hyper::Error),
+ Serde(serde_json::Error),
+ ApiError(ApiError),
+}
+
+#[derive(Debug)]
+pub struct ApiError {
+ pub code: hyper::StatusCode,
+ pub content: Option,
+}
+
+impl<'de, T> From<(hyper::StatusCode, &'de [u8])> for Error
+ 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::(e.1) {
+ Ok(t) => Error::ApiError(ApiError{
+ code: e.0,
+ content: Some(t),
+ }),
+ Err(e) => {
+ Error::from(e)
+ }
+ }
+ }
+}
+
+impl From for Error {
+ fn from(e: hyper::Error) -> Self {
+ return Error::Hyper(e)
+ }
+}
+
+impl From for Error {
+ fn from(e: serde_json::Error) -> Self {
+ return Error::Serde(e)
+ }
+}
+
+mod request;
+
+mod pet_api;
+pub use self::pet_api::{ PetApi, PetApiClient };
+mod store_api;
+pub use self::store_api::{ StoreApi, StoreApiClient };
+mod user_api;
+pub use self::user_api::{ UserApi, UserApiClient };
+
+pub mod configuration;
+pub mod client;
diff --git a/samples/client/petstore/rust/src/apis/pet_api.rs b/samples/client/petstore/rust/src/apis/pet_api.rs
new file mode 100644
index 000000000000..6ecaee91037f
--- /dev/null
+++ b/samples/client/petstore/rust/src/apis/pet_api.rs
@@ -0,0 +1,142 @@
+/*
+ * 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;
+#[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 PetApiClient {
+ configuration: Rc>,
+}
+
+impl PetApiClient {
+ pub fn new(configuration: Rc>) -> PetApiClient {
+ PetApiClient {
+ configuration,
+ }
+ }
+}
+
+pub trait PetApi {
+ fn add_pet(&self, body: crate::models::Pet) -> Box>>;
+ fn delete_pet(&self, pet_id: i64, api_key: Option<&str>) -> Box>>;
+ fn find_pets_by_status(&self, status: Vec) -> Box, Error = Error>>;
+ fn find_pets_by_tags(&self, tags: Vec) -> Box, Error = Error>>;
+ fn get_pet_by_id(&self, pet_id: i64) -> Box>>;
+ fn update_pet(&self, body: crate::models::Pet) -> Box>>;
+ fn update_pet_with_form(&self, pet_id: i64, name: Option<&str>, status: Option<&str>) -> Box>>;
+ fn upload_file(&self, pet_id: i64, additional_metadata: Option<&str>, file: Option) -> Box>>;
+}
+
+implPetApi for PetApiClient {
+ fn add_pet(&self, body: crate::models::Pet) -> Box>> {
+ let mut req = __internal_request::Request::new(hyper::Method::Post, "/pet".to_string())
+ .with_auth(__internal_request::Auth::Oauth)
+ ;
+ req = req.with_body_param(body);
+ req = req.returns_nothing();
+
+ req.execute(self.configuration.borrow())
+ }
+
+ fn delete_pet(&self, pet_id: i64, api_key: Option<&str>) -> Box>> {
+ let mut req = __internal_request::Request::new(hyper::Method::Delete, "/pet/{petId}".to_string())
+ .with_auth(__internal_request::Auth::Oauth)
+ ;
+ 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