Upgrade rust-hyper to use hyper 1.0 (#19115)

* Upgrade to rust-hyper to use hyper 1.0

* Update rust-hyper samples for hyper 1.0 upgrade

* update cargo

* update samples

* update samples

* update doc

* Default client configuration for rust-hyper

---------

Co-authored-by: Krishna Rajendran <krishna@emptybox.org>
This commit is contained in:
William Cheng 2024-07-14 22:11:08 +08:00 committed by GitHub
parent 897a4e79d2
commit b705972cad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
117 changed files with 4019 additions and 283 deletions

View File

@ -0,0 +1,8 @@
generatorName: rust
outputDir: samples/client/petstore/rust/hyper0x/petstore
library: hyper0x
inputSpec: modules/openapi-generator/src/test/resources/3_0/rust/petstore.yaml
templateDir: modules/openapi-generator/src/main/resources/rust
additionalProperties:
supportAsync: "false"
packageName: petstore-hyper0x

View File

@ -22,7 +22,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|bestFitInt|Use best fitting integer type where minimum or maximum is set| |false|
|enumNameSuffix|Suffix that will be appended to all enum names.| ||
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|library|library template (sub-template) to use.|<dl><dt>**hyper**</dt><dd>HTTP client: Hyper.</dd><dt>**reqwest**</dt><dd>HTTP client: Reqwest.</dd></dl>|reqwest|
|library|library template (sub-template) to use.|<dl><dt>**hyper**</dt><dd>HTTP client: Hyper (v1.x).</dd><dt>**hyper0x**</dt><dd>HTTP client: Hyper (v0.x).</dd><dt>**reqwest**</dt><dd>HTTP client: Reqwest.</dd></dl>|reqwest|
|packageName|Rust package name (convention: lowercase).| |openapi|
|packageVersion|Rust package version.| |1.0.0|
|preferUnsignedInt|Prefer unsigned integers where minimum value is &gt;= 0| |false|

View File

@ -57,6 +57,7 @@ public class RustClientCodegen extends AbstractRustCodegen implements CodegenCon
public static final String PACKAGE_NAME = "packageName";
public static final String PACKAGE_VERSION = "packageVersion";
public static final String HYPER_LIBRARY = "hyper";
public static final String HYPER0X_LIBRARY = "hyper0x";
public static final String REQWEST_LIBRARY = "reqwest";
public static final String SUPPORT_ASYNC = "supportAsync";
public static final String SUPPORT_MIDDLEWARE = "supportMiddleware";
@ -202,7 +203,8 @@ public class RustClientCodegen extends AbstractRustCodegen implements CodegenCon
cliOptions.add(new CliOption(AVOID_BOXED_MODELS, "If set, `Box<T>` will not be used for models", SchemaTypeUtil.BOOLEAN_TYPE)
.defaultValue(Boolean.FALSE.toString()));
supportedLibraries.put(HYPER_LIBRARY, "HTTP client: Hyper.");
supportedLibraries.put(HYPER_LIBRARY, "HTTP client: Hyper (v1.x).");
supportedLibraries.put(HYPER0X_LIBRARY, "HTTP client: Hyper (v0.x).");
supportedLibraries.put(REQWEST_LIBRARY, "HTTP client: Reqwest.");
CliOption libraryOption = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use.");
@ -371,6 +373,9 @@ public class RustClientCodegen extends AbstractRustCodegen implements CodegenCon
if (HYPER_LIBRARY.equals(getLibrary())) {
additionalProperties.put(HYPER_LIBRARY, "true");
} else if (HYPER0X_LIBRARY.equals(getLibrary())) {
additionalProperties.put(HYPER_LIBRARY, "true");
additionalProperties.put(HYPER0X_LIBRARY, "true");
} else if (REQWEST_LIBRARY.equals(getLibrary())) {
additionalProperties.put(REQWEST_LIBRARY, "true");
} else {

View File

@ -40,8 +40,15 @@ serde_json = "^1.0"
url = "^2.5"
uuid = { version = "^1.8", features = ["serde", "v4"] }
{{#hyper}}
{{#hyper0x}}
hyper = { version = "~0.14", features = ["full"] }
hyper-tls = "~0.5"
{{/hyper0x}}
{{^hyper0x}}
hyper = { version = "^1.3.1", features = ["full"] }
hyper-util = { version = "0.1.5", features = ["client", "client-legacy", "http1", "http2"] }
http-body-util = { version = "0.1.2" }
{{/hyper0x}}
http = "~0.2"
base64 = "~0.7.0"
futures = "^0.3"

View File

@ -6,18 +6,19 @@ use std::pin::Pin;
use std::option::Option;
use hyper;
use hyper_util::client::legacy::connect::Connect;
use futures::Future;
use crate::models;
use super::{Error, configuration};
use super::request as __internal_request;
pub struct {{{classname}}}Client<C: hyper::client::connect::Connect>
pub struct {{{classname}}}Client<C: Connect>
where C: Clone + std::marker::Send + Sync + 'static {
configuration: Rc<configuration::Configuration<C>>,
}
impl<C: hyper::client::connect::Connect> {{{classname}}}Client<C>
impl<C: Connect> {{{classname}}}Client<C>
where C: Clone + std::marker::Send + Sync {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> {{{classname}}}Client<C> {
{{{classname}}}Client {
@ -34,7 +35,7 @@ pub trait {{{classname}}} {
{{/operations}}
}
impl<C: hyper::client::connect::Connect>{{{classname}}} for {{{classname}}}Client<C>
impl<C: Connect>{{{classname}}} for {{{classname}}}Client<C>
where C: Clone + std::marker::Send + Sync {
{{#operations}}
{{#operation}}

View File

@ -1,25 +1,38 @@
use http;
use std::fmt;
use std::fmt::Debug;
use hyper;
use hyper::http;
use hyper_util::client::legacy::connect::Connect;
use serde_json;
#[derive(Debug)]
pub enum Error {
Api(ApiError),
Header(hyper::http::header::InvalidHeaderValue),
Header(http::header::InvalidHeaderValue),
Http(http::Error),
Hyper(hyper::Error),
HyperClient(hyper_util::client::legacy::Error),
Serde(serde_json::Error),
UriError(http::uri::InvalidUri),
}
#[derive(Debug)]
pub struct ApiError {
pub code: hyper::StatusCode,
pub body: hyper::body::Body,
pub body: hyper::body::Incoming,
}
impl From<(hyper::StatusCode, hyper::body::Body)> for Error {
fn from(e: (hyper::StatusCode, hyper::body::Body)) -> Self {
impl Debug for ApiError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("ApiError")
.field("code", &self.code)
.field("body", &"hyper::body::Incoming")
.finish()
}
}
impl From<(hyper::StatusCode, hyper::body::Incoming)> for Error {
fn from(e: (hyper::StatusCode, hyper::body::Incoming)) -> Self {
Error::Api(ApiError {
code: e.0,
body: e.1,
@ -33,6 +46,12 @@ impl From<http::Error> for Error {
}
}
impl From<hyper_util::client::legacy::Error> for Error {
fn from(e: hyper_util::client::legacy::Error) -> Self {
Error::HyperClient(e)
}
}
impl From<hyper::Error> for Error {
fn from(e: hyper::Error) -> Self {
Error::Hyper(e)

View File

@ -1,6 +1,7 @@
use std::rc::Rc;
use hyper;
use hyper_util::client::legacy::connect::Connect;
use super::configuration::Configuration;
pub struct APIClient {
@ -18,7 +19,7 @@ pub struct APIClient {
}
impl APIClient {
pub fn new<C: hyper::client::connect::Connect>(configuration: Configuration<C>) -> APIClient
pub fn new<C: Connect>(configuration: Configuration<C>) -> APIClient
where C: Clone + std::marker::Send + Sync + 'static {
let rc = Rc::new(configuration);

View File

@ -1,11 +1,15 @@
{{>partial_header}}
use hyper;
use hyper_util::client::legacy::Client;
use hyper_util::client::legacy::connect::Connect;
use hyper_util::client::legacy::connect::HttpConnector;
use hyper_util::rt::TokioExecutor;
pub struct Configuration<C: hyper::client::connect::Connect>
pub struct Configuration<C: Connect = HttpConnector>
where C: Clone + std::marker::Send + Sync + 'static {
pub base_path: String,
pub user_agent: Option<String>,
pub client: hyper::client::Client<C>,
pub client: Client<C, String>,
pub basic_auth: Option<BasicAuth>,
pub oauth_access_token: Option<String>,
pub api_key: Option<ApiKey>,
@ -19,9 +23,41 @@ pub struct ApiKey {
pub key: String,
}
impl<C: hyper::client::connect::Connect> Configuration<C>
impl Configuration<HttpConnector> {
/// Construct a default [`Configuration`](Self) with a hyper client using a default
/// [`HttpConnector`](hyper_util::client::legacy::connect::HttpConnector).
///
/// Use [`with_client`](Configuration<T>::with_client) to construct a Configuration with a
/// custom hyper client.
///
/// # Example
///
/// ```
/// let api_config = {
/// api_key: "my-api-key",
/// ...Configuration::new()
/// }
/// ```
pub fn new() -> Configuration<HttpConnector> {
Configuration::default()
}
}
impl<C: Connect> Configuration<C>
where C: Clone + std::marker::Send + Sync {
pub fn new(client: hyper::client::Client<C>) -> Configuration<C> {
/// Construct a new Configuration with a custom hyper client.
///
/// # Example
///
/// ```
/// let client = Client::builder(TokioExecutor::new())
/// .pool_idle_timeout(Duration::from_secs(30))
/// .build_http();
///
/// let api_config = Configuration::with_client(client);
/// ```
pub fn with_client(client: Client<C, String>) -> Configuration<C> {
Configuration {
base_path: "{{{basePath}}}".to_owned(),
user_agent: {{#httpUserAgent}}Some("{{{.}}}".to_owned()){{/httpUserAgent}}{{^httpUserAgent}}Some("OpenAPI-Generator/{{{version}}}/rust".to_owned()){{/httpUserAgent}},
@ -32,3 +68,10 @@ impl<C: hyper::client::connect::Connect> Configuration<C>
}
}
}
impl Default for Configuration<HttpConnector> {
fn default() -> Self {
let client = Client::builder(TokioExecutor::new()).build_http();
Configuration::with_client(client)
}
}

View File

@ -0,0 +1,173 @@
{{>partial_header}}
use std::rc::Rc;
use std::borrow::Borrow;
use std::pin::Pin;
#[allow(unused_imports)]
use std::option::Option;
use hyper;
use futures::Future;
use crate::models;
use super::{Error, configuration};
use super::request as __internal_request;
pub struct {{{classname}}}Client<C: hyper::client::connect::Connect>
where C: Clone + std::marker::Send + Sync + 'static {
configuration: Rc<configuration::Configuration<C>>,
}
impl<C: hyper::client::connect::Connect> {{{classname}}}Client<C>
where C: Clone + std::marker::Send + Sync {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> {{{classname}}}Client<C> {
{{{classname}}}Client {
configuration,
}
}
}
pub trait {{{classname}}} {
{{#operations}}
{{#operation}}
fn {{{operationId}}}(&self, {{#allParams}}{{{paramName}}}: {{^required}}Option<{{/required}}{{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{#isString}}{{^isUuid}}&str{{/isUuid}}{{/isString}}{{#isUuid}}&str{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) -> Pin<Box<dyn Future<Output = Result<{{^returnType}}(){{/returnType}}{{#returnType}}{{{returnType}}}{{/returnType}}, Error>>>>;
{{/operation}}
{{/operations}}
}
impl<C: hyper::client::connect::Connect>{{{classname}}} for {{{classname}}}Client<C>
where C: Clone + std::marker::Send + Sync {
{{#operations}}
{{#operation}}
#[allow(unused_mut)]
fn {{{operationId}}}(&self, {{#allParams}}{{{paramName}}}: {{^required}}Option<{{/required}}{{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{#isString}}{{^isUuid}}&str{{/isUuid}}{{/isString}}{{#isUuid}}&str{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) -> Pin<Box<dyn Future<Output = Result<{{^returnType}}(){{/returnType}}{{#returnType}}{{{.}}}{{/returnType}}, Error>>>> {
let mut req = __internal_request::Request::new(hyper::Method::{{{httpMethod.toUpperCase}}}, "{{{path}}}".to_string())
{{#hasAuthMethods}}
{{#authMethods}}
{{#isApiKey}}
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
in_header: {{#isKeyInHeader}}true{{/isKeyInHeader}}{{^isKeyInHeader}}false{{/isKeyInHeader}},
in_query: {{#isKeyInQuery}}true{{/isKeyInQuery}}{{^isKeyInQuery}}false{{/isKeyInQuery}},
param_name: "{{{keyParamName}}}".to_owned(),
}))
{{/isApiKey}}
{{#isBasicBasic}}
.with_auth(__internal_request::Auth::Basic)
{{/isBasicBasic}}
{{#isOAuth}}
.with_auth(__internal_request::Auth::Oauth)
{{/isOAuth}}
{{/authMethods}}
{{/hasAuthMethods}}
;
{{#queryParams}}
{{#required}}
{{^isNullable}}
req = req.with_query_param("{{{baseName}}}".to_string(), {{{paramName}}}{{#isArray}}.join(","){{/isArray}}.to_string());
{{/isNullable}}
{{#isNullable}}
match {{{paramName}}} {
Some(param_value) => { req = req.with_query_param("{{{baseName}}}".to_string(), param_value{{#isArray}}.join(","){{/isArray}}.to_string()); },
None => { req = req.with_query_param("{{{baseName}}}".to_string(), "".to_string()); },
}
{{/isNullable}}
{{/required}}
{{^required}}
if let Some(ref s) = {{{paramName}}} {
let query_value = {{#isArray}}s.iter().map(|s| s.to_string()).collect::<Vec<String>>().join(","){{/isArray}}{{^isArray}}s.to_string(){{/isArray}};
req = req.with_query_param("{{{baseName}}}".to_string(), query_value);
}
{{/required}}
{{/queryParams}}
{{#pathParams}}
{{#required}}
{{^isNullable}}
req = req.with_path_param("{{{baseName}}}".to_string(), {{{paramName}}}{{#isArray}}.join(","){{/isArray}}.to_string());
{{/isNullable}}
{{#isNullable}}
match {{{paramName}}} {
Some(param_value) => { req = req.with_path_param("{{{baseName}}}".to_string(), param_value{{#isArray}}.join(","){{/isArray}}.to_string()); },
None => { req = req.with_path_param("{{{baseName}}}".to_string(), "".to_string()); },
}
{{/isNullable}}
{{/required}}
{{^required}}
if let Some(param_value) = {{{paramName}}} {
req = req.with_path_param("{{{baseName}}}".to_string(), param_value{{#isArray}}.join(","){{/isArray}}.to_string());
}
{{/required}}
{{/pathParams}}
{{#hasHeaderParams}}
{{#headerParams}}
{{#required}}
{{^isNullable}}
req = req.with_header_param("{{{baseName}}}".to_string(), {{{paramName}}}{{#isArray}}.join(","){{/isArray}}.to_string());
{{/isNullable}}
{{#isNullable}}
match {{{paramName}}} {
Some(param_value) => { req = req.with_header_param("{{{baseName}}}".to_string(), param_value{{#isArray}}.join(","){{/isArray}}.to_string()); },
None => { req = req.with_header_param("{{{baseName}}}".to_string(), "".to_string()); },
}
{{/isNullable}}
{{/required}}
{{^required}}
if let Some(param_value) = {{{paramName}}} {
req = req.with_header_param("{{{baseName}}}".to_string(), param_value{{#isArray}}.join(","){{/isArray}}.to_string());
}
{{/required}}
{{/headerParams}}
{{/hasHeaderParams}}
{{#hasFormParams}}
{{#formParams}}
{{#isFile}}
{{#required}}
{{^isNullable}}
req = req.with_form_param("{{{baseName}}}".to_string(), unimplemented!());
{{/isNullable}}
{{#isNullable}}
match {{{paramName}}} {
Some(param_value) => { req = req.with_form_param("{{{baseName}}}".to_string(), unimplemented!()); },
None => { req = req.with_form_param("{{{baseName}}}".to_string(), unimplemented!()); },
}
{{/isNullable}}
{{/required}}
{{^required}}
if let Some(param_value) = {{{paramName}}} {
req = req.with_form_param("{{{baseName}}}".to_string(), unimplemented!());
}
{{/required}}
{{/isFile}}
{{^isFile}}
{{#required}}
{{^isNullable}}
req = req.with_form_param("{{{baseName}}}".to_string(), {{{paramName}}}{{#isArray}}.join(","){{/isArray}}.to_string());
{{/isNullable}}
{{#isNullable}}
match {{{paramName}}} {
Some(param_value) => { req = req.with_form_param("{{{baseName}}}".to_string(), param_value{{#isArray}}.join(","){{/isArray}}.to_string()); },
None => { req = req.with_form_param("{{{baseName}}}".to_string(), "".to_string()); },
}
{{/isNullable}}
{{/required}}
{{^required}}
if let Some(param_value) = {{{paramName}}} {
req = req.with_form_param("{{{baseName}}}".to_string(), param_value{{#isArray}}.join(","){{/isArray}}.to_string());
}
{{/required}}
{{/isFile}}
{{/formParams}}
{{/hasFormParams}}
{{#hasBodyParam}}
{{#bodyParams}}
req = req.with_body_param({{{paramName}}});
{{/bodyParams}}
{{/hasBodyParam}}
{{^returnType}}
req = req.returns_nothing();
{{/returnType}}
req.execute(self.configuration.borrow())
}
{{/operation}}
{{/operations}}
}

View File

@ -0,0 +1,64 @@
use http;
use hyper;
use serde_json;
#[derive(Debug)]
pub enum Error {
Api(ApiError),
Header(hyper::http::header::InvalidHeaderValue),
Http(http::Error),
Hyper(hyper::Error),
Serde(serde_json::Error),
UriError(http::uri::InvalidUri),
}
#[derive(Debug)]
pub struct ApiError {
pub code: hyper::StatusCode,
pub body: hyper::body::Body,
}
impl From<(hyper::StatusCode, hyper::body::Body)> for Error {
fn from(e: (hyper::StatusCode, hyper::body::Body)) -> Self {
Error::Api(ApiError {
code: e.0,
body: e.1,
})
}
}
impl From<http::Error> for Error {
fn from(e: http::Error) -> Self {
Error::Http(e)
}
}
impl From<hyper::Error> for Error {
fn from(e: hyper::Error) -> Self {
Error::Hyper(e)
}
}
impl From<serde_json::Error> for Error {
fn from(e: serde_json::Error) -> Self {
Error::Serde(e)
}
}
mod request;
{{#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;

View File

@ -0,0 +1,54 @@
use std::rc::Rc;
use hyper;
use super::configuration::Configuration;
pub struct APIClient {
{{#apiInfo}}
{{#apis}}
{{#operations}}
{{#operation}}
{{#-last}}
{{{classFilename}}}: Box<dyn crate::apis::{{{classname}}}>,
{{/-last}}
{{/operation}}
{{/operations}}
{{/apis}}
{{/apiInfo}}
}
impl APIClient {
pub fn new<C: hyper::client::connect::Connect>(configuration: Configuration<C>) -> APIClient
where C: Clone + std::marker::Send + Sync + 'static {
let rc = Rc::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}}
}

View File

@ -0,0 +1,34 @@
{{>partial_header}}
use hyper;
pub struct Configuration<C: hyper::client::connect::Connect>
where C: Clone + std::marker::Send + Sync + 'static {
pub base_path: String,
pub user_agent: Option<String>,
pub client: hyper::client::Client<C>,
pub basic_auth: Option<BasicAuth>,
pub oauth_access_token: Option<String>,
pub api_key: Option<ApiKey>,
// TODO: take an oauth2 token source, similar to the go one
}
pub type BasicAuth = (String, Option<String>);
pub struct ApiKey {
pub prefix: Option<String>,
pub key: String,
}
impl<C: hyper::client::connect::Connect> Configuration<C>
where C: Clone + std::marker::Send + Sync {
pub fn new(client: hyper::client::Client<C>) -> Configuration<C> {
Configuration {
base_path: "{{{basePath}}}".to_owned(),
user_agent: {{#httpUserAgent}}Some("{{{.}}}".to_owned()){{/httpUserAgent}}{{^httpUserAgent}}Some("OpenAPI-Generator/{{{version}}}/rust".to_owned()){{/httpUserAgent}},
client,
basic_auth: None,
oauth_access_token: None,
api_key: None,
}
}
}

View File

@ -4,7 +4,9 @@ use std::pin::Pin;
use futures;
use futures::Future;
use futures::future::*;
use http_body_util::BodyExt;
use hyper;
use hyper_util::client::legacy::connect::Connect;
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, HeaderValue, USER_AGENT};
use serde;
use serde_json;
@ -109,7 +111,7 @@ impl Request {
conf: &configuration::Configuration<C>,
) -> Pin<Box<dyn Future<Output=Result<U, Error>> + 'a>>
where
C: hyper::client::connect::Connect + Clone + std::marker::Send + Sync,
C: Connect + Clone + std::marker::Send + Sync,
U: Sized + std::marker::Send + 'a,
for<'de> U: serde::Deserialize<'de>,
{
@ -203,13 +205,13 @@ impl Request {
for (k, v) in self.form_params {
enc.append_pair(&k, &v);
}
req_builder.body(hyper::Body::from(enc.finish()))
req_builder.body(enc.finish())
} else if let Some(body) = self.serialized_body {
req_headers.insert(CONTENT_TYPE, HeaderValue::from_static("application/json"));
req_headers.insert(CONTENT_LENGTH, body.len().into());
req_builder.body(hyper::Body::from(body))
req_builder.body(body)
} else {
req_builder.body(hyper::Body::default())
req_builder.body(String::new())
};
let request = match request_result {
Ok(request) => request,
@ -233,9 +235,12 @@ impl Request {
// need to impl default for all models.
futures::future::ok::<U, Error>(serde_json::from_str("null").expect("serde null value")).boxed()
} else {
hyper::body::to_bytes(response.into_body())
.map(|bytes| serde_json::from_slice(&bytes.unwrap()))
.map_err(|e| Error::from(e)).boxed()
let collect = response.into_body().collect().map_err(Error::from);
collect.map(|collected| {
collected.and_then(|collected| {
serde_json::from_slice(&collected.to_bytes()).map_err(Error::from)
})
}).boxed()
}
}))
}

View File

@ -23,11 +23,11 @@ version = "0.0.0"
dependencies = [
"base64 0.7.0",
"futures",
"http",
"http 0.2.11",
"http-body-util",
"hyper",
"hyper-tls",
"hyper-util",
"serde",
"serde_derive",
"serde_json",
"url",
"uuid",
@ -39,12 +39,17 @@ version = "0.0.0"
dependencies = [
"reqwest",
"serde",
"serde_derive",
"serde_json",
"url",
"uuid",
]
[[package]]
name = "atomic-waker"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
[[package]]
name = "autocfg"
version = "1.1.0"
@ -78,9 +83,9 @@ dependencies = [
[[package]]
name = "base64"
version = "0.21.7"
version = "0.22.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
[[package]]
name = "bitflags"
@ -108,9 +113,9 @@ checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223"
[[package]]
name = "cc"
version = "1.0.79"
version = "1.0.105"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
checksum = "5208975e568d83b6b05cc0a063c8e7e9acc2b43bee6da15616a5b73e109d7437"
[[package]]
name = "cfg-if"
@ -124,11 +129,11 @@ version = "1.0.0"
dependencies = [
"base64 0.7.0",
"futures",
"http",
"http 0.2.11",
"http-body-util",
"hyper",
"hyper-tls",
"hyper-util",
"serde",
"serde_derive",
"serde_json",
"url",
"uuid",
@ -140,7 +145,6 @@ version = "1.0.0"
dependencies = [
"reqwest",
"serde",
"serde_derive",
"serde_json",
"url",
"uuid",
@ -168,11 +172,11 @@ version = "1.0.0"
dependencies = [
"base64 0.7.0",
"futures",
"http",
"http 0.2.11",
"http-body-util",
"hyper",
"hyper-tls",
"hyper-util",
"serde",
"serde_derive",
"serde_json",
"url",
"uuid",
@ -184,7 +188,6 @@ version = "1.0.0"
dependencies = [
"reqwest",
"serde",
"serde_derive",
"serde_json",
"url",
"uuid",
@ -258,9 +261,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
[[package]]
name = "form_urlencoded"
version = "1.2.0"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652"
checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456"
dependencies = [
"percent-encoding",
]
@ -373,16 +376,16 @@ checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e"
[[package]]
name = "h2"
version = "0.3.24"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9"
checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab"
dependencies = [
"atomic-waker",
"bytes",
"fnv",
"futures-core",
"futures-sink",
"futures-util",
"http",
"http 1.1.0",
"indexmap",
"slab",
"tokio",
@ -414,13 +417,36 @@ dependencies = [
]
[[package]]
name = "http-body"
version = "0.4.6"
name = "http"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2"
checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258"
dependencies = [
"bytes",
"http",
"fnv",
"itoa",
]
[[package]]
name = "http-body"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643"
dependencies = [
"bytes",
"http 1.1.0",
]
[[package]]
name = "http-body-util"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f"
dependencies = [
"bytes",
"futures-util",
"http 1.1.0",
"http-body",
"pin-project-lite",
]
@ -438,46 +464,83 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
[[package]]
name = "hyper"
version = "0.14.28"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80"
checksum = "c4fe55fb7a772d59a5ff1dfbff4fe0258d19b89fec4b233e75d35d5d2316badc"
dependencies = [
"bytes",
"futures-channel",
"futures-core",
"futures-util",
"h2",
"http",
"http 1.1.0",
"http-body",
"httparse",
"httpdate",
"itoa",
"pin-project-lite",
"socket2",
"smallvec",
"tokio",
"tower-service",
"tracing",
"want",
]
[[package]]
name = "hyper-tls"
version = "0.5.0"
name = "hyper-rustls"
version = "0.27.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905"
checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155"
dependencies = [
"futures-util",
"http 1.1.0",
"hyper",
"hyper-util",
"rustls",
"rustls-pki-types",
"tokio",
"tokio-rustls",
"tower-service",
]
[[package]]
name = "hyper-tls"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0"
dependencies = [
"bytes",
"http-body-util",
"hyper",
"hyper-util",
"native-tls",
"tokio",
"tokio-native-tls",
"tower-service",
]
[[package]]
name = "hyper-util"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ab92f4f49ee4fb4f997c784b7a2e0fa70050211e0b6a287f898c3c9785ca956"
dependencies = [
"bytes",
"futures-channel",
"futures-util",
"http 1.1.0",
"http-body",
"hyper",
"pin-project-lite",
"socket2",
"tokio",
"tower",
"tower-service",
"tracing",
]
[[package]]
name = "idna"
version = "0.4.0"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c"
checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6"
dependencies = [
"unicode-bidi",
"unicode-normalization",
@ -542,9 +605,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.147"
version = "0.2.155"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
[[package]]
name = "linux-raw-sys"
@ -618,16 +681,6 @@ dependencies = [
"tempfile",
]
[[package]]
name = "num_cpus"
version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
dependencies = [
"hermit-abi",
"libc",
]
[[package]]
name = "object"
version = "0.31.1"
@ -649,11 +702,11 @@ version = "0.0.1"
dependencies = [
"base64 0.7.0",
"futures",
"http",
"http 0.2.11",
"http-body-util",
"hyper",
"hyper-tls",
"hyper-util",
"serde",
"serde_derive",
"serde_json",
"url",
"uuid",
@ -665,7 +718,6 @@ version = "0.0.1"
dependencies = [
"reqwest",
"serde",
"serde_derive",
"serde_json",
"url",
"uuid",
@ -677,11 +729,11 @@ version = "0.0.1"
dependencies = [
"base64 0.7.0",
"futures",
"http",
"http 0.2.11",
"http-body-util",
"hyper",
"hyper-tls",
"hyper-util",
"serde",
"serde_derive",
"serde_json",
"url",
"uuid",
@ -693,7 +745,6 @@ version = "0.0.1"
dependencies = [
"reqwest",
"serde",
"serde_derive",
"serde_json",
"url",
"uuid",
@ -705,11 +756,11 @@ version = "1.0.0"
dependencies = [
"base64 0.7.0",
"futures",
"http",
"http 0.2.11",
"http-body-util",
"hyper",
"hyper-tls",
"hyper-util",
"serde",
"serde_derive",
"serde_json",
"url",
"uuid",
@ -721,7 +772,6 @@ version = "1.0.0"
dependencies = [
"reqwest",
"serde",
"serde_derive",
"serde_json",
"url",
"uuid",
@ -773,9 +823,29 @@ dependencies = [
[[package]]
name = "percent-encoding"
version = "2.3.0"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94"
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
[[package]]
name = "pin-project"
version = "1.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3"
dependencies = [
"pin-project-internal",
]
[[package]]
name = "pin-project-internal"
version = "1.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "pin-project-lite"
@ -828,7 +898,6 @@ version = "0.1.0"
dependencies = [
"reqwest",
"serde",
"serde_derive",
"serde_json",
"url",
"uuid",
@ -836,20 +905,24 @@ dependencies = [
[[package]]
name = "reqwest"
version = "0.11.24"
version = "0.12.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6920094eb85afde5e4a138be3f2de8bbdf28000f0029e72c45025a56b042251"
checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37"
dependencies = [
"base64 0.21.7",
"base64 0.22.1",
"bytes",
"encoding_rs",
"futures-channel",
"futures-core",
"futures-util",
"h2",
"http",
"http 1.1.0",
"http-body",
"http-body-util",
"hyper",
"hyper-rustls",
"hyper-tls",
"hyper-util",
"ipnet",
"js-sys",
"log",
@ -875,6 +948,21 @@ dependencies = [
"winreg",
]
[[package]]
name = "ring"
version = "0.17.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d"
dependencies = [
"cc",
"cfg-if",
"getrandom",
"libc",
"spin",
"untrusted",
"windows-sys 0.52.0",
]
[[package]]
name = "rustc-demangle"
version = "0.1.23"
@ -896,12 +984,43 @@ dependencies = [
]
[[package]]
name = "rustls-pemfile"
version = "1.0.4"
name = "rustls"
version = "0.23.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c"
checksum = "05cff451f60db80f490f3c182b77c35260baace73209e9cdbbe526bfe3a4d402"
dependencies = [
"base64 0.21.7",
"once_cell",
"rustls-pki-types",
"rustls-webpki",
"subtle",
"zeroize",
]
[[package]]
name = "rustls-pemfile"
version = "2.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d"
dependencies = [
"base64 0.22.1",
"rustls-pki-types",
]
[[package]]
name = "rustls-pki-types"
version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d"
[[package]]
name = "rustls-webpki"
version = "0.102.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9a6fccd794a42c2c105b513a2f62bc3fd8f3ba57a4593677ceb0bd035164d78"
dependencies = [
"ring",
"rustls-pki-types",
"untrusted",
]
[[package]]
@ -953,6 +1072,9 @@ name = "serde"
version = "1.0.173"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e91f70896d6720bc714a4a57d22fc91f1db634680e65c8efe13323f1fa38d53f"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
@ -997,6 +1119,12 @@ dependencies = [
"autocfg",
]
[[package]]
name = "smallvec"
version = "1.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
[[package]]
name = "socket2"
version = "0.5.4"
@ -1007,6 +1135,18 @@ dependencies = [
"windows-sys 0.48.0",
]
[[package]]
name = "spin"
version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
[[package]]
name = "subtle"
version = "2.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]]
name = "syn"
version = "2.0.26"
@ -1020,9 +1160,9 @@ dependencies = [
[[package]]
name = "sync_wrapper"
version = "0.1.2"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160"
checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394"
[[package]]
name = "system-configuration"
@ -1083,7 +1223,6 @@ dependencies = [
"bytes",
"libc",
"mio",
"num_cpus",
"pin-project-lite",
"socket2",
"windows-sys 0.48.0",
@ -1099,6 +1238,17 @@ dependencies = [
"tokio",
]
[[package]]
name = "tokio-rustls"
version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4"
dependencies = [
"rustls",
"rustls-pki-types",
"tokio",
]
[[package]]
name = "tokio-util"
version = "0.7.10"
@ -1113,6 +1263,27 @@ dependencies = [
"tracing",
]
[[package]]
name = "tower"
version = "0.4.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c"
dependencies = [
"futures-core",
"futures-util",
"pin-project",
"pin-project-lite",
"tokio",
"tower-layer",
"tower-service",
]
[[package]]
name = "tower-layer"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0"
[[package]]
name = "tower-service"
version = "0.3.2"
@ -1175,10 +1346,16 @@ dependencies = [
]
[[package]]
name = "url"
version = "2.4.0"
name = "untrusted"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb"
checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
[[package]]
name = "url"
version = "2.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c"
dependencies = [
"form_urlencoded",
"idna",
@ -1187,9 +1364,9 @@ dependencies = [
[[package]]
name = "uuid"
version = "1.4.1"
version = "1.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d"
checksum = "5de17fd2f7da591098415cff336e12965a28061ddace43b59cb3c430179c9439"
dependencies = [
"getrandom",
"serde",
@ -1331,6 +1508,15 @@ dependencies = [
"windows-targets 0.48.0",
]
[[package]]
name = "windows-sys"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
"windows-targets 0.52.6",
]
[[package]]
name = "windows-targets"
version = "0.42.2"
@ -1361,6 +1547,22 @@ dependencies = [
"windows_x86_64_msvc 0.48.0",
]
[[package]]
name = "windows-targets"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
dependencies = [
"windows_aarch64_gnullvm 0.52.6",
"windows_aarch64_msvc 0.52.6",
"windows_i686_gnu 0.52.6",
"windows_i686_gnullvm",
"windows_i686_msvc 0.52.6",
"windows_x86_64_gnu 0.52.6",
"windows_x86_64_gnullvm 0.52.6",
"windows_x86_64_msvc 0.52.6",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.42.2"
@ -1373,6 +1575,12 @@ version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
[[package]]
name = "windows_aarch64_msvc"
version = "0.42.2"
@ -1385,6 +1593,12 @@ version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
[[package]]
name = "windows_i686_gnu"
version = "0.42.2"
@ -1397,6 +1611,18 @@ version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
[[package]]
name = "windows_i686_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
[[package]]
name = "windows_i686_msvc"
version = "0.42.2"
@ -1409,6 +1635,12 @@ version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
[[package]]
name = "windows_i686_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
[[package]]
name = "windows_x86_64_gnu"
version = "0.42.2"
@ -1421,6 +1653,12 @@ version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.42.2"
@ -1433,6 +1671,12 @@ version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
[[package]]
name = "windows_x86_64_msvc"
version = "0.42.2"
@ -1446,11 +1690,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
[[package]]
name = "winreg"
version = "0.50.0"
name = "windows_x86_64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]]
name = "winreg"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5"
dependencies = [
"cfg-if",
"windows-sys 0.48.0",
]
[[package]]
name = "zeroize"
version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde"

View File

@ -12,8 +12,9 @@ serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0"
url = "^2.5"
uuid = { version = "^1.8", features = ["serde", "v4"] }
hyper = { version = "~0.14", features = ["full"] }
hyper-tls = "~0.5"
hyper = { version = "^1.3.1", features = ["full"] }
hyper-util = { version = "0.1.5", features = ["client", "client-legacy", "http1", "http2"] }
http-body-util = { version = "0.1.2" }
http = "~0.2"
base64 = "~0.7.0"
futures = "^0.3"

View File

@ -1,6 +1,7 @@
use std::rc::Rc;
use hyper;
use hyper_util::client::legacy::connect::Connect;
use super::configuration::Configuration;
pub struct APIClient {
@ -8,7 +9,7 @@ pub struct APIClient {
}
impl APIClient {
pub fn new<C: hyper::client::connect::Connect>(configuration: Configuration<C>) -> APIClient
pub fn new<C: Connect>(configuration: Configuration<C>) -> APIClient
where C: Clone + std::marker::Send + Sync + 'static {
let rc = Rc::new(configuration);

View File

@ -9,12 +9,16 @@
*/
use hyper;
use hyper_util::client::legacy::Client;
use hyper_util::client::legacy::connect::Connect;
use hyper_util::client::legacy::connect::HttpConnector;
use hyper_util::rt::TokioExecutor;
pub struct Configuration<C: hyper::client::connect::Connect>
pub struct Configuration<C: Connect = HttpConnector>
where C: Clone + std::marker::Send + Sync + 'static {
pub base_path: String,
pub user_agent: Option<String>,
pub client: hyper::client::Client<C>,
pub client: Client<C, String>,
pub basic_auth: Option<BasicAuth>,
pub oauth_access_token: Option<String>,
pub api_key: Option<ApiKey>,
@ -28,9 +32,41 @@ pub struct ApiKey {
pub key: String,
}
impl<C: hyper::client::connect::Connect> Configuration<C>
impl Configuration<HttpConnector> {
/// Construct a default [`Configuration`](Self) with a hyper client using a default
/// [`HttpConnector`](hyper_util::client::legacy::connect::HttpConnector).
///
/// Use [`with_client`](Configuration<T>::with_client) to construct a Configuration with a
/// custom hyper client.
///
/// # Example
///
/// ```
/// let api_config = {
/// api_key: "my-api-key",
/// ...Configuration::new()
/// }
/// ```
pub fn new() -> Configuration<HttpConnector> {
Configuration::default()
}
}
impl<C: Connect> Configuration<C>
where C: Clone + std::marker::Send + Sync {
pub fn new(client: hyper::client::Client<C>) -> Configuration<C> {
/// Construct a new Configuration with a custom hyper client.
///
/// # Example
///
/// ```
/// let client = Client::builder(TokioExecutor::new())
/// .pool_idle_timeout(Duration::from_secs(30))
/// .build_http();
///
/// let api_config = Configuration::with_client(client);
/// ```
pub fn with_client(client: Client<C, String>) -> Configuration<C> {
Configuration {
base_path: "http://localhost".to_owned(),
user_agent: Some("OpenAPI-Generator/0.0.0/rust".to_owned()),
@ -41,3 +77,10 @@ impl<C: hyper::client::connect::Connect> Configuration<C>
}
}
}
impl Default for Configuration<HttpConnector> {
fn default() -> Self {
let client = Client::builder(TokioExecutor::new()).build_http();
Configuration::with_client(client)
}
}

View File

@ -15,18 +15,19 @@ use std::pin::Pin;
use std::option::Option;
use hyper;
use hyper_util::client::legacy::connect::Connect;
use futures::Future;
use crate::models;
use super::{Error, configuration};
use super::request as __internal_request;
pub struct DefaultApiClient<C: hyper::client::connect::Connect>
pub struct DefaultApiClient<C: Connect>
where C: Clone + std::marker::Send + Sync + 'static {
configuration: Rc<configuration::Configuration<C>>,
}
impl<C: hyper::client::connect::Connect> DefaultApiClient<C>
impl<C: Connect> DefaultApiClient<C>
where C: Clone + std::marker::Send + Sync {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> DefaultApiClient<C> {
DefaultApiClient {
@ -39,7 +40,7 @@ pub trait DefaultApi {
fn demo_color_get(&self, color: models::Color) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>;
}
impl<C: hyper::client::connect::Connect>DefaultApi for DefaultApiClient<C>
impl<C: Connect>DefaultApi for DefaultApiClient<C>
where C: Clone + std::marker::Send + Sync {
#[allow(unused_mut)]
fn demo_color_get(&self, color: models::Color) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> {

View File

@ -1,25 +1,38 @@
use http;
use std::fmt;
use std::fmt::Debug;
use hyper;
use hyper::http;
use hyper_util::client::legacy::connect::Connect;
use serde_json;
#[derive(Debug)]
pub enum Error {
Api(ApiError),
Header(hyper::http::header::InvalidHeaderValue),
Header(http::header::InvalidHeaderValue),
Http(http::Error),
Hyper(hyper::Error),
HyperClient(hyper_util::client::legacy::Error),
Serde(serde_json::Error),
UriError(http::uri::InvalidUri),
}
#[derive(Debug)]
pub struct ApiError {
pub code: hyper::StatusCode,
pub body: hyper::body::Body,
pub body: hyper::body::Incoming,
}
impl From<(hyper::StatusCode, hyper::body::Body)> for Error {
fn from(e: (hyper::StatusCode, hyper::body::Body)) -> Self {
impl Debug for ApiError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("ApiError")
.field("code", &self.code)
.field("body", &"hyper::body::Incoming")
.finish()
}
}
impl From<(hyper::StatusCode, hyper::body::Incoming)> for Error {
fn from(e: (hyper::StatusCode, hyper::body::Incoming)) -> Self {
Error::Api(ApiError {
code: e.0,
body: e.1,
@ -33,6 +46,12 @@ impl From<http::Error> for Error {
}
}
impl From<hyper_util::client::legacy::Error> for Error {
fn from(e: hyper_util::client::legacy::Error) -> Self {
Error::HyperClient(e)
}
}
impl From<hyper::Error> for Error {
fn from(e: hyper::Error) -> Self {
Error::Hyper(e)

View File

@ -4,7 +4,9 @@ use std::pin::Pin;
use futures;
use futures::Future;
use futures::future::*;
use http_body_util::BodyExt;
use hyper;
use hyper_util::client::legacy::connect::Connect;
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, HeaderValue, USER_AGENT};
use serde;
use serde_json;
@ -109,7 +111,7 @@ impl Request {
conf: &configuration::Configuration<C>,
) -> Pin<Box<dyn Future<Output=Result<U, Error>> + 'a>>
where
C: hyper::client::connect::Connect + Clone + std::marker::Send + Sync,
C: Connect + Clone + std::marker::Send + Sync,
U: Sized + std::marker::Send + 'a,
for<'de> U: serde::Deserialize<'de>,
{
@ -203,13 +205,13 @@ impl Request {
for (k, v) in self.form_params {
enc.append_pair(&k, &v);
}
req_builder.body(hyper::Body::from(enc.finish()))
req_builder.body(enc.finish())
} else if let Some(body) = self.serialized_body {
req_headers.insert(CONTENT_TYPE, HeaderValue::from_static("application/json"));
req_headers.insert(CONTENT_LENGTH, body.len().into());
req_builder.body(hyper::Body::from(body))
req_builder.body(body)
} else {
req_builder.body(hyper::Body::default())
req_builder.body(String::new())
};
let request = match request_result {
Ok(request) => request,
@ -233,9 +235,12 @@ impl Request {
// need to impl default for all models.
futures::future::ok::<U, Error>(serde_json::from_str("null").expect("serde null value")).boxed()
} else {
hyper::body::to_bytes(response.into_body())
.map(|bytes| serde_json::from_slice(&bytes.unwrap()))
.map_err(|e| Error::from(e)).boxed()
let collect = response.into_body().collect().map_err(Error::from);
collect.map(|collected| {
collected.and_then(|collected| {
serde_json::from_slice(&collected.to_bytes()).map_err(Error::from)
})
}).boxed()
}
}))
}

View File

@ -12,8 +12,9 @@ serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0"
url = "^2.5"
uuid = { version = "^1.8", features = ["serde", "v4"] }
hyper = { version = "~0.14", features = ["full"] }
hyper-tls = "~0.5"
hyper = { version = "^1.3.1", features = ["full"] }
hyper-util = { version = "0.1.5", features = ["client", "client-legacy", "http1", "http2"] }
http-body-util = { version = "0.1.2" }
http = "~0.2"
base64 = "~0.7.0"
futures = "^0.3"

View File

@ -1,6 +1,7 @@
use std::rc::Rc;
use hyper;
use hyper_util::client::legacy::connect::Connect;
use super::configuration::Configuration;
pub struct APIClient {
@ -8,7 +9,7 @@ pub struct APIClient {
}
impl APIClient {
pub fn new<C: hyper::client::connect::Connect>(configuration: Configuration<C>) -> APIClient
pub fn new<C: Connect>(configuration: Configuration<C>) -> APIClient
where C: Clone + std::marker::Send + Sync + 'static {
let rc = Rc::new(configuration);

View File

@ -9,12 +9,16 @@
*/
use hyper;
use hyper_util::client::legacy::Client;
use hyper_util::client::legacy::connect::Connect;
use hyper_util::client::legacy::connect::HttpConnector;
use hyper_util::rt::TokioExecutor;
pub struct Configuration<C: hyper::client::connect::Connect>
pub struct Configuration<C: Connect = HttpConnector>
where C: Clone + std::marker::Send + Sync + 'static {
pub base_path: String,
pub user_agent: Option<String>,
pub client: hyper::client::Client<C>,
pub client: Client<C, String>,
pub basic_auth: Option<BasicAuth>,
pub oauth_access_token: Option<String>,
pub api_key: Option<ApiKey>,
@ -28,9 +32,41 @@ pub struct ApiKey {
pub key: String,
}
impl<C: hyper::client::connect::Connect> Configuration<C>
impl Configuration<HttpConnector> {
/// Construct a default [`Configuration`](Self) with a hyper client using a default
/// [`HttpConnector`](hyper_util::client::legacy::connect::HttpConnector).
///
/// Use [`with_client`](Configuration<T>::with_client) to construct a Configuration with a
/// custom hyper client.
///
/// # Example
///
/// ```
/// let api_config = {
/// api_key: "my-api-key",
/// ...Configuration::new()
/// }
/// ```
pub fn new() -> Configuration<HttpConnector> {
Configuration::default()
}
}
impl<C: Connect> Configuration<C>
where C: Clone + std::marker::Send + Sync {
pub fn new(client: hyper::client::Client<C>) -> Configuration<C> {
/// Construct a new Configuration with a custom hyper client.
///
/// # Example
///
/// ```
/// let client = Client::builder(TokioExecutor::new())
/// .pool_idle_timeout(Duration::from_secs(30))
/// .build_http();
///
/// let api_config = Configuration::with_client(client);
/// ```
pub fn with_client(client: Client<C, String>) -> Configuration<C> {
Configuration {
base_path: "http://localhost:8000".to_owned(),
user_agent: Some("OpenAPI-Generator/1.0.0/rust".to_owned()),
@ -41,3 +77,10 @@ impl<C: hyper::client::connect::Connect> Configuration<C>
}
}
}
impl Default for Configuration<HttpConnector> {
fn default() -> Self {
let client = Client::builder(TokioExecutor::new()).build_http();
Configuration::with_client(client)
}
}

View File

@ -15,18 +15,19 @@ use std::pin::Pin;
use std::option::Option;
use hyper;
use hyper_util::client::legacy::connect::Connect;
use futures::Future;
use crate::models;
use super::{Error, configuration};
use super::request as __internal_request;
pub struct DefaultApiClient<C: hyper::client::connect::Connect>
pub struct DefaultApiClient<C: Connect>
where C: Clone + std::marker::Send + Sync + 'static {
configuration: Rc<configuration::Configuration<C>>,
}
impl<C: hyper::client::connect::Connect> DefaultApiClient<C>
impl<C: Connect> DefaultApiClient<C>
where C: Clone + std::marker::Send + Sync {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> DefaultApiClient<C> {
DefaultApiClient {
@ -40,7 +41,7 @@ pub trait DefaultApi {
fn get_state(&self, ) -> Pin<Box<dyn Future<Output = Result<models::GetState200Response, Error>>>>;
}
impl<C: hyper::client::connect::Connect>DefaultApi for DefaultApiClient<C>
impl<C: Connect>DefaultApi for DefaultApiClient<C>
where C: Clone + std::marker::Send + Sync {
#[allow(unused_mut)]
fn create_state(&self, create_state_request: models::CreateStateRequest) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> {

View File

@ -1,25 +1,38 @@
use http;
use std::fmt;
use std::fmt::Debug;
use hyper;
use hyper::http;
use hyper_util::client::legacy::connect::Connect;
use serde_json;
#[derive(Debug)]
pub enum Error {
Api(ApiError),
Header(hyper::http::header::InvalidHeaderValue),
Header(http::header::InvalidHeaderValue),
Http(http::Error),
Hyper(hyper::Error),
HyperClient(hyper_util::client::legacy::Error),
Serde(serde_json::Error),
UriError(http::uri::InvalidUri),
}
#[derive(Debug)]
pub struct ApiError {
pub code: hyper::StatusCode,
pub body: hyper::body::Body,
pub body: hyper::body::Incoming,
}
impl From<(hyper::StatusCode, hyper::body::Body)> for Error {
fn from(e: (hyper::StatusCode, hyper::body::Body)) -> Self {
impl Debug for ApiError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("ApiError")
.field("code", &self.code)
.field("body", &"hyper::body::Incoming")
.finish()
}
}
impl From<(hyper::StatusCode, hyper::body::Incoming)> for Error {
fn from(e: (hyper::StatusCode, hyper::body::Incoming)) -> Self {
Error::Api(ApiError {
code: e.0,
body: e.1,
@ -33,6 +46,12 @@ impl From<http::Error> for Error {
}
}
impl From<hyper_util::client::legacy::Error> for Error {
fn from(e: hyper_util::client::legacy::Error) -> Self {
Error::HyperClient(e)
}
}
impl From<hyper::Error> for Error {
fn from(e: hyper::Error) -> Self {
Error::Hyper(e)

View File

@ -4,7 +4,9 @@ use std::pin::Pin;
use futures;
use futures::Future;
use futures::future::*;
use http_body_util::BodyExt;
use hyper;
use hyper_util::client::legacy::connect::Connect;
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, HeaderValue, USER_AGENT};
use serde;
use serde_json;
@ -109,7 +111,7 @@ impl Request {
conf: &configuration::Configuration<C>,
) -> Pin<Box<dyn Future<Output=Result<U, Error>> + 'a>>
where
C: hyper::client::connect::Connect + Clone + std::marker::Send + Sync,
C: Connect + Clone + std::marker::Send + Sync,
U: Sized + std::marker::Send + 'a,
for<'de> U: serde::Deserialize<'de>,
{
@ -203,13 +205,13 @@ impl Request {
for (k, v) in self.form_params {
enc.append_pair(&k, &v);
}
req_builder.body(hyper::Body::from(enc.finish()))
req_builder.body(enc.finish())
} else if let Some(body) = self.serialized_body {
req_headers.insert(CONTENT_TYPE, HeaderValue::from_static("application/json"));
req_headers.insert(CONTENT_LENGTH, body.len().into());
req_builder.body(hyper::Body::from(body))
req_builder.body(body)
} else {
req_builder.body(hyper::Body::default())
req_builder.body(String::new())
};
let request = match request_result {
Ok(request) => request,
@ -233,9 +235,12 @@ impl Request {
// need to impl default for all models.
futures::future::ok::<U, Error>(serde_json::from_str("null").expect("serde null value")).boxed()
} else {
hyper::body::to_bytes(response.into_body())
.map(|bytes| serde_json::from_slice(&bytes.unwrap()))
.map_err(|e| Error::from(e)).boxed()
let collect = response.into_body().collect().map_err(Error::from);
collect.map(|collected| {
collected.and_then(|collected| {
serde_json::from_slice(&collected.to_bytes()).map_err(Error::from)
})
}).boxed()
}
}))
}

View File

@ -12,8 +12,9 @@ serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0"
url = "^2.5"
uuid = { version = "^1.8", features = ["serde", "v4"] }
hyper = { version = "~0.14", features = ["full"] }
hyper-tls = "~0.5"
hyper = { version = "^1.3.1", features = ["full"] }
hyper-util = { version = "0.1.5", features = ["client", "client-legacy", "http1", "http2"] }
http-body-util = { version = "0.1.2" }
http = "~0.2"
base64 = "~0.7.0"
futures = "^0.3"

View File

@ -1,6 +1,7 @@
use std::rc::Rc;
use hyper;
use hyper_util::client::legacy::connect::Connect;
use super::configuration::Configuration;
pub struct APIClient {
@ -8,7 +9,7 @@ pub struct APIClient {
}
impl APIClient {
pub fn new<C: hyper::client::connect::Connect>(configuration: Configuration<C>) -> APIClient
pub fn new<C: Connect>(configuration: Configuration<C>) -> APIClient
where C: Clone + std::marker::Send + Sync + 'static {
let rc = Rc::new(configuration);

View File

@ -9,12 +9,16 @@
*/
use hyper;
use hyper_util::client::legacy::Client;
use hyper_util::client::legacy::connect::Connect;
use hyper_util::client::legacy::connect::HttpConnector;
use hyper_util::rt::TokioExecutor;
pub struct Configuration<C: hyper::client::connect::Connect>
pub struct Configuration<C: Connect = HttpConnector>
where C: Clone + std::marker::Send + Sync + 'static {
pub base_path: String,
pub user_agent: Option<String>,
pub client: hyper::client::Client<C>,
pub client: Client<C, String>,
pub basic_auth: Option<BasicAuth>,
pub oauth_access_token: Option<String>,
pub api_key: Option<ApiKey>,
@ -28,9 +32,41 @@ pub struct ApiKey {
pub key: String,
}
impl<C: hyper::client::connect::Connect> Configuration<C>
impl Configuration<HttpConnector> {
/// Construct a default [`Configuration`](Self) with a hyper client using a default
/// [`HttpConnector`](hyper_util::client::legacy::connect::HttpConnector).
///
/// Use [`with_client`](Configuration<T>::with_client) to construct a Configuration with a
/// custom hyper client.
///
/// # Example
///
/// ```
/// let api_config = {
/// api_key: "my-api-key",
/// ...Configuration::new()
/// }
/// ```
pub fn new() -> Configuration<HttpConnector> {
Configuration::default()
}
}
impl<C: Connect> Configuration<C>
where C: Clone + std::marker::Send + Sync {
pub fn new(client: hyper::client::Client<C>) -> Configuration<C> {
/// Construct a new Configuration with a custom hyper client.
///
/// # Example
///
/// ```
/// let client = Client::builder(TokioExecutor::new())
/// .pool_idle_timeout(Duration::from_secs(30))
/// .build_http();
///
/// let api_config = Configuration::with_client(client);
/// ```
pub fn with_client(client: Client<C, String>) -> Configuration<C> {
Configuration {
base_path: "http://localhost".to_owned(),
user_agent: Some("OpenAPI-Generator/1.0.0/rust".to_owned()),
@ -41,3 +77,10 @@ impl<C: hyper::client::connect::Connect> Configuration<C>
}
}
}
impl Default for Configuration<HttpConnector> {
fn default() -> Self {
let client = Client::builder(TokioExecutor::new()).build_http();
Configuration::with_client(client)
}
}

View File

@ -15,18 +15,19 @@ use std::pin::Pin;
use std::option::Option;
use hyper;
use hyper_util::client::legacy::connect::Connect;
use futures::Future;
use crate::models;
use super::{Error, configuration};
use super::request as __internal_request;
pub struct DefaultApiClient<C: hyper::client::connect::Connect>
pub struct DefaultApiClient<C: Connect>
where C: Clone + std::marker::Send + Sync + 'static {
configuration: Rc<configuration::Configuration<C>>,
}
impl<C: hyper::client::connect::Connect> DefaultApiClient<C>
impl<C: Connect> DefaultApiClient<C>
where C: Clone + std::marker::Send + Sync {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> DefaultApiClient<C> {
DefaultApiClient {
@ -39,7 +40,7 @@ pub trait DefaultApi {
fn endpoint_get(&self, ) -> Pin<Box<dyn Future<Output = Result<models::EmptyObject, Error>>>>;
}
impl<C: hyper::client::connect::Connect>DefaultApi for DefaultApiClient<C>
impl<C: Connect>DefaultApi for DefaultApiClient<C>
where C: Clone + std::marker::Send + Sync {
#[allow(unused_mut)]
fn endpoint_get(&self, ) -> Pin<Box<dyn Future<Output = Result<models::EmptyObject, Error>>>> {

View File

@ -1,25 +1,38 @@
use http;
use std::fmt;
use std::fmt::Debug;
use hyper;
use hyper::http;
use hyper_util::client::legacy::connect::Connect;
use serde_json;
#[derive(Debug)]
pub enum Error {
Api(ApiError),
Header(hyper::http::header::InvalidHeaderValue),
Header(http::header::InvalidHeaderValue),
Http(http::Error),
Hyper(hyper::Error),
HyperClient(hyper_util::client::legacy::Error),
Serde(serde_json::Error),
UriError(http::uri::InvalidUri),
}
#[derive(Debug)]
pub struct ApiError {
pub code: hyper::StatusCode,
pub body: hyper::body::Body,
pub body: hyper::body::Incoming,
}
impl From<(hyper::StatusCode, hyper::body::Body)> for Error {
fn from(e: (hyper::StatusCode, hyper::body::Body)) -> Self {
impl Debug for ApiError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("ApiError")
.field("code", &self.code)
.field("body", &"hyper::body::Incoming")
.finish()
}
}
impl From<(hyper::StatusCode, hyper::body::Incoming)> for Error {
fn from(e: (hyper::StatusCode, hyper::body::Incoming)) -> Self {
Error::Api(ApiError {
code: e.0,
body: e.1,
@ -33,6 +46,12 @@ impl From<http::Error> for Error {
}
}
impl From<hyper_util::client::legacy::Error> for Error {
fn from(e: hyper_util::client::legacy::Error) -> Self {
Error::HyperClient(e)
}
}
impl From<hyper::Error> for Error {
fn from(e: hyper::Error) -> Self {
Error::Hyper(e)

View File

@ -4,7 +4,9 @@ use std::pin::Pin;
use futures;
use futures::Future;
use futures::future::*;
use http_body_util::BodyExt;
use hyper;
use hyper_util::client::legacy::connect::Connect;
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, HeaderValue, USER_AGENT};
use serde;
use serde_json;
@ -109,7 +111,7 @@ impl Request {
conf: &configuration::Configuration<C>,
) -> Pin<Box<dyn Future<Output=Result<U, Error>> + 'a>>
where
C: hyper::client::connect::Connect + Clone + std::marker::Send + Sync,
C: Connect + Clone + std::marker::Send + Sync,
U: Sized + std::marker::Send + 'a,
for<'de> U: serde::Deserialize<'de>,
{
@ -203,13 +205,13 @@ impl Request {
for (k, v) in self.form_params {
enc.append_pair(&k, &v);
}
req_builder.body(hyper::Body::from(enc.finish()))
req_builder.body(enc.finish())
} else if let Some(body) = self.serialized_body {
req_headers.insert(CONTENT_TYPE, HeaderValue::from_static("application/json"));
req_headers.insert(CONTENT_LENGTH, body.len().into());
req_builder.body(hyper::Body::from(body))
req_builder.body(body)
} else {
req_builder.body(hyper::Body::default())
req_builder.body(String::new())
};
let request = match request_result {
Ok(request) => request,
@ -233,9 +235,12 @@ impl Request {
// need to impl default for all models.
futures::future::ok::<U, Error>(serde_json::from_str("null").expect("serde null value")).boxed()
} else {
hyper::body::to_bytes(response.into_body())
.map(|bytes| serde_json::from_slice(&bytes.unwrap()))
.map_err(|e| Error::from(e)).boxed()
let collect = response.into_body().collect().map_err(Error::from);
collect.map(|collected| {
collected.and_then(|collected| {
serde_json::from_slice(&collected.to_bytes()).map_err(Error::from)
})
}).boxed()
}
}))
}

View File

@ -12,8 +12,9 @@ serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0"
url = "^2.5"
uuid = { version = "^1.8", features = ["serde", "v4"] }
hyper = { version = "~0.14", features = ["full"] }
hyper-tls = "~0.5"
hyper = { version = "^1.3.1", features = ["full"] }
hyper-util = { version = "0.1.5", features = ["client", "client-legacy", "http1", "http2"] }
http-body-util = { version = "0.1.2" }
http = "~0.2"
base64 = "~0.7.0"
futures = "^0.3"

View File

@ -1,6 +1,7 @@
use std::rc::Rc;
use hyper;
use hyper_util::client::legacy::connect::Connect;
use super::configuration::Configuration;
pub struct APIClient {
@ -8,7 +9,7 @@ pub struct APIClient {
}
impl APIClient {
pub fn new<C: hyper::client::connect::Connect>(configuration: Configuration<C>) -> APIClient
pub fn new<C: Connect>(configuration: Configuration<C>) -> APIClient
where C: Clone + std::marker::Send + Sync + 'static {
let rc = Rc::new(configuration);

View File

@ -9,12 +9,16 @@
*/
use hyper;
use hyper_util::client::legacy::Client;
use hyper_util::client::legacy::connect::Connect;
use hyper_util::client::legacy::connect::HttpConnector;
use hyper_util::rt::TokioExecutor;
pub struct Configuration<C: hyper::client::connect::Connect>
pub struct Configuration<C: Connect = HttpConnector>
where C: Clone + std::marker::Send + Sync + 'static {
pub base_path: String,
pub user_agent: Option<String>,
pub client: hyper::client::Client<C>,
pub client: Client<C, String>,
pub basic_auth: Option<BasicAuth>,
pub oauth_access_token: Option<String>,
pub api_key: Option<ApiKey>,
@ -28,9 +32,41 @@ pub struct ApiKey {
pub key: String,
}
impl<C: hyper::client::connect::Connect> Configuration<C>
impl Configuration<HttpConnector> {
/// Construct a default [`Configuration`](Self) with a hyper client using a default
/// [`HttpConnector`](hyper_util::client::legacy::connect::HttpConnector).
///
/// Use [`with_client`](Configuration<T>::with_client) to construct a Configuration with a
/// custom hyper client.
///
/// # Example
///
/// ```
/// let api_config = {
/// api_key: "my-api-key",
/// ...Configuration::new()
/// }
/// ```
pub fn new() -> Configuration<HttpConnector> {
Configuration::default()
}
}
impl<C: Connect> Configuration<C>
where C: Clone + std::marker::Send + Sync {
pub fn new(client: hyper::client::Client<C>) -> Configuration<C> {
/// Construct a new Configuration with a custom hyper client.
///
/// # Example
///
/// ```
/// let client = Client::builder(TokioExecutor::new())
/// .pool_idle_timeout(Duration::from_secs(30))
/// .build_http();
///
/// let api_config = Configuration::with_client(client);
/// ```
pub fn with_client(client: Client<C, String>) -> Configuration<C> {
Configuration {
base_path: "http://localhost".to_owned(),
user_agent: Some("OpenAPI-Generator/0.0.1/rust".to_owned()),
@ -41,3 +77,10 @@ impl<C: hyper::client::connect::Connect> Configuration<C>
}
}
}
impl Default for Configuration<HttpConnector> {
fn default() -> Self {
let client = Client::builder(TokioExecutor::new()).build_http();
Configuration::with_client(client)
}
}

View File

@ -15,18 +15,19 @@ use std::pin::Pin;
use std::option::Option;
use hyper;
use hyper_util::client::legacy::connect::Connect;
use futures::Future;
use crate::models;
use super::{Error, configuration};
use super::request as __internal_request;
pub struct DefaultApiClient<C: hyper::client::connect::Connect>
pub struct DefaultApiClient<C: Connect>
where C: Clone + std::marker::Send + Sync + 'static {
configuration: Rc<configuration::Configuration<C>>,
}
impl<C: hyper::client::connect::Connect> DefaultApiClient<C>
impl<C: Connect> DefaultApiClient<C>
where C: Clone + std::marker::Send + Sync {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> DefaultApiClient<C> {
DefaultApiClient {
@ -40,7 +41,7 @@ pub trait DefaultApi {
fn test(&self, body: Option<serde_json::Value>) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>;
}
impl<C: hyper::client::connect::Connect>DefaultApi for DefaultApiClient<C>
impl<C: Connect>DefaultApi for DefaultApiClient<C>
where C: Clone + std::marker::Send + Sync {
#[allow(unused_mut)]
fn root_get(&self, ) -> Pin<Box<dyn Future<Output = Result<models::Fruit, Error>>>> {

View File

@ -1,25 +1,38 @@
use http;
use std::fmt;
use std::fmt::Debug;
use hyper;
use hyper::http;
use hyper_util::client::legacy::connect::Connect;
use serde_json;
#[derive(Debug)]
pub enum Error {
Api(ApiError),
Header(hyper::http::header::InvalidHeaderValue),
Header(http::header::InvalidHeaderValue),
Http(http::Error),
Hyper(hyper::Error),
HyperClient(hyper_util::client::legacy::Error),
Serde(serde_json::Error),
UriError(http::uri::InvalidUri),
}
#[derive(Debug)]
pub struct ApiError {
pub code: hyper::StatusCode,
pub body: hyper::body::Body,
pub body: hyper::body::Incoming,
}
impl From<(hyper::StatusCode, hyper::body::Body)> for Error {
fn from(e: (hyper::StatusCode, hyper::body::Body)) -> Self {
impl Debug for ApiError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("ApiError")
.field("code", &self.code)
.field("body", &"hyper::body::Incoming")
.finish()
}
}
impl From<(hyper::StatusCode, hyper::body::Incoming)> for Error {
fn from(e: (hyper::StatusCode, hyper::body::Incoming)) -> Self {
Error::Api(ApiError {
code: e.0,
body: e.1,
@ -33,6 +46,12 @@ impl From<http::Error> for Error {
}
}
impl From<hyper_util::client::legacy::Error> for Error {
fn from(e: hyper_util::client::legacy::Error) -> Self {
Error::HyperClient(e)
}
}
impl From<hyper::Error> for Error {
fn from(e: hyper::Error) -> Self {
Error::Hyper(e)

View File

@ -4,7 +4,9 @@ use std::pin::Pin;
use futures;
use futures::Future;
use futures::future::*;
use http_body_util::BodyExt;
use hyper;
use hyper_util::client::legacy::connect::Connect;
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, HeaderValue, USER_AGENT};
use serde;
use serde_json;
@ -109,7 +111,7 @@ impl Request {
conf: &configuration::Configuration<C>,
) -> Pin<Box<dyn Future<Output=Result<U, Error>> + 'a>>
where
C: hyper::client::connect::Connect + Clone + std::marker::Send + Sync,
C: Connect + Clone + std::marker::Send + Sync,
U: Sized + std::marker::Send + 'a,
for<'de> U: serde::Deserialize<'de>,
{
@ -203,13 +205,13 @@ impl Request {
for (k, v) in self.form_params {
enc.append_pair(&k, &v);
}
req_builder.body(hyper::Body::from(enc.finish()))
req_builder.body(enc.finish())
} else if let Some(body) = self.serialized_body {
req_headers.insert(CONTENT_TYPE, HeaderValue::from_static("application/json"));
req_headers.insert(CONTENT_LENGTH, body.len().into());
req_builder.body(hyper::Body::from(body))
req_builder.body(body)
} else {
req_builder.body(hyper::Body::default())
req_builder.body(String::new())
};
let request = match request_result {
Ok(request) => request,
@ -233,9 +235,12 @@ impl Request {
// need to impl default for all models.
futures::future::ok::<U, Error>(serde_json::from_str("null").expect("serde null value")).boxed()
} else {
hyper::body::to_bytes(response.into_body())
.map(|bytes| serde_json::from_slice(&bytes.unwrap()))
.map_err(|e| Error::from(e)).boxed()
let collect = response.into_body().collect().map_err(Error::from);
collect.map(|collected| {
collected.and_then(|collected| {
serde_json::from_slice(&collected.to_bytes()).map_err(Error::from)
})
}).boxed()
}
}))
}

View File

@ -11,8 +11,9 @@ serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0"
url = "^2.5"
uuid = { version = "^1.8", features = ["serde", "v4"] }
hyper = { version = "~0.14", features = ["full"] }
hyper-tls = "~0.5"
hyper = { version = "^1.3.1", features = ["full"] }
hyper-util = { version = "0.1.5", features = ["client", "client-legacy", "http1", "http2"] }
http-body-util = { version = "0.1.2" }
http = "~0.2"
base64 = "~0.7.0"
futures = "^0.3"

View File

@ -1,6 +1,7 @@
use std::rc::Rc;
use hyper;
use hyper_util::client::legacy::connect::Connect;
use super::configuration::Configuration;
pub struct APIClient {
@ -8,7 +9,7 @@ pub struct APIClient {
}
impl APIClient {
pub fn new<C: hyper::client::connect::Connect>(configuration: Configuration<C>) -> APIClient
pub fn new<C: Connect>(configuration: Configuration<C>) -> APIClient
where C: Clone + std::marker::Send + Sync + 'static {
let rc = Rc::new(configuration);

View File

@ -9,12 +9,16 @@
*/
use hyper;
use hyper_util::client::legacy::Client;
use hyper_util::client::legacy::connect::Connect;
use hyper_util::client::legacy::connect::HttpConnector;
use hyper_util::rt::TokioExecutor;
pub struct Configuration<C: hyper::client::connect::Connect>
pub struct Configuration<C: Connect = HttpConnector>
where C: Clone + std::marker::Send + Sync + 'static {
pub base_path: String,
pub user_agent: Option<String>,
pub client: hyper::client::Client<C>,
pub client: Client<C, String>,
pub basic_auth: Option<BasicAuth>,
pub oauth_access_token: Option<String>,
pub api_key: Option<ApiKey>,
@ -28,9 +32,41 @@ pub struct ApiKey {
pub key: String,
}
impl<C: hyper::client::connect::Connect> Configuration<C>
impl Configuration<HttpConnector> {
/// Construct a default [`Configuration`](Self) with a hyper client using a default
/// [`HttpConnector`](hyper_util::client::legacy::connect::HttpConnector).
///
/// Use [`with_client`](Configuration<T>::with_client) to construct a Configuration with a
/// custom hyper client.
///
/// # Example
///
/// ```
/// let api_config = {
/// api_key: "my-api-key",
/// ...Configuration::new()
/// }
/// ```
pub fn new() -> Configuration<HttpConnector> {
Configuration::default()
}
}
impl<C: Connect> Configuration<C>
where C: Clone + std::marker::Send + Sync {
pub fn new(client: hyper::client::Client<C>) -> Configuration<C> {
/// Construct a new Configuration with a custom hyper client.
///
/// # Example
///
/// ```
/// let client = Client::builder(TokioExecutor::new())
/// .pool_idle_timeout(Duration::from_secs(30))
/// .build_http();
///
/// let api_config = Configuration::with_client(client);
/// ```
pub fn with_client(client: Client<C, String>) -> Configuration<C> {
Configuration {
base_path: "http://api.example.xyz/v1".to_owned(),
user_agent: Some("OpenAPI-Generator/1.0.0/rust".to_owned()),
@ -41,3 +77,10 @@ impl<C: hyper::client::connect::Connect> Configuration<C>
}
}
}
impl Default for Configuration<HttpConnector> {
fn default() -> Self {
let client = Client::builder(TokioExecutor::new()).build_http();
Configuration::with_client(client)
}
}

View File

@ -15,18 +15,19 @@ use std::pin::Pin;
use std::option::Option;
use hyper;
use hyper_util::client::legacy::connect::Connect;
use futures::Future;
use crate::models;
use super::{Error, configuration};
use super::request as __internal_request;
pub struct DefaultApiClient<C: hyper::client::connect::Connect>
pub struct DefaultApiClient<C: Connect>
where C: Clone + std::marker::Send + Sync + 'static {
configuration: Rc<configuration::Configuration<C>>,
}
impl<C: hyper::client::connect::Connect> DefaultApiClient<C>
impl<C: Connect> DefaultApiClient<C>
where C: Clone + std::marker::Send + Sync {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> DefaultApiClient<C> {
DefaultApiClient {
@ -39,7 +40,7 @@ pub trait DefaultApi {
fn get_fruit(&self, ) -> Pin<Box<dyn Future<Output = Result<models::Fruit, Error>>>>;
}
impl<C: hyper::client::connect::Connect>DefaultApi for DefaultApiClient<C>
impl<C: Connect>DefaultApi for DefaultApiClient<C>
where C: Clone + std::marker::Send + Sync {
#[allow(unused_mut)]
fn get_fruit(&self, ) -> Pin<Box<dyn Future<Output = Result<models::Fruit, Error>>>> {

View File

@ -1,25 +1,38 @@
use http;
use std::fmt;
use std::fmt::Debug;
use hyper;
use hyper::http;
use hyper_util::client::legacy::connect::Connect;
use serde_json;
#[derive(Debug)]
pub enum Error {
Api(ApiError),
Header(hyper::http::header::InvalidHeaderValue),
Header(http::header::InvalidHeaderValue),
Http(http::Error),
Hyper(hyper::Error),
HyperClient(hyper_util::client::legacy::Error),
Serde(serde_json::Error),
UriError(http::uri::InvalidUri),
}
#[derive(Debug)]
pub struct ApiError {
pub code: hyper::StatusCode,
pub body: hyper::body::Body,
pub body: hyper::body::Incoming,
}
impl From<(hyper::StatusCode, hyper::body::Body)> for Error {
fn from(e: (hyper::StatusCode, hyper::body::Body)) -> Self {
impl Debug for ApiError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("ApiError")
.field("code", &self.code)
.field("body", &"hyper::body::Incoming")
.finish()
}
}
impl From<(hyper::StatusCode, hyper::body::Incoming)> for Error {
fn from(e: (hyper::StatusCode, hyper::body::Incoming)) -> Self {
Error::Api(ApiError {
code: e.0,
body: e.1,
@ -33,6 +46,12 @@ impl From<http::Error> for Error {
}
}
impl From<hyper_util::client::legacy::Error> for Error {
fn from(e: hyper_util::client::legacy::Error) -> Self {
Error::HyperClient(e)
}
}
impl From<hyper::Error> for Error {
fn from(e: hyper::Error) -> Self {
Error::Hyper(e)

View File

@ -4,7 +4,9 @@ use std::pin::Pin;
use futures;
use futures::Future;
use futures::future::*;
use http_body_util::BodyExt;
use hyper;
use hyper_util::client::legacy::connect::Connect;
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, HeaderValue, USER_AGENT};
use serde;
use serde_json;
@ -109,7 +111,7 @@ impl Request {
conf: &configuration::Configuration<C>,
) -> Pin<Box<dyn Future<Output=Result<U, Error>> + 'a>>
where
C: hyper::client::connect::Connect + Clone + std::marker::Send + Sync,
C: Connect + Clone + std::marker::Send + Sync,
U: Sized + std::marker::Send + 'a,
for<'de> U: serde::Deserialize<'de>,
{
@ -203,13 +205,13 @@ impl Request {
for (k, v) in self.form_params {
enc.append_pair(&k, &v);
}
req_builder.body(hyper::Body::from(enc.finish()))
req_builder.body(enc.finish())
} else if let Some(body) = self.serialized_body {
req_headers.insert(CONTENT_TYPE, HeaderValue::from_static("application/json"));
req_headers.insert(CONTENT_LENGTH, body.len().into());
req_builder.body(hyper::Body::from(body))
req_builder.body(body)
} else {
req_builder.body(hyper::Body::default())
req_builder.body(String::new())
};
let request = match request_result {
Ok(request) => request,
@ -233,9 +235,12 @@ impl Request {
// need to impl default for all models.
futures::future::ok::<U, Error>(serde_json::from_str("null").expect("serde null value")).boxed()
} else {
hyper::body::to_bytes(response.into_body())
.map(|bytes| serde_json::from_slice(&bytes.unwrap()))
.map_err(|e| Error::from(e)).boxed()
let collect = response.into_body().collect().map_err(Error::from);
collect.map(|collected| {
collected.and_then(|collected| {
serde_json::from_slice(&collected.to_bytes()).map_err(Error::from)
})
}).boxed()
}
}))
}

View File

@ -12,8 +12,9 @@ serde = { version = "^1.0", features = ["derive"] }
serde_json = "^1.0"
url = "^2.5"
uuid = { version = "^1.8", features = ["serde", "v4"] }
hyper = { version = "~0.14", features = ["full"] }
hyper-tls = "~0.5"
hyper = { version = "^1.3.1", features = ["full"] }
hyper-util = { version = "0.1.5", features = ["client", "client-legacy", "http1", "http2"] }
http-body-util = { version = "0.1.2" }
http = "~0.2"
base64 = "~0.7.0"
futures = "^0.3"

View File

@ -15,18 +15,19 @@ use std::pin::Pin;
use std::option::Option;
use hyper;
use hyper_util::client::legacy::connect::Connect;
use futures::Future;
use crate::models;
use super::{Error, configuration};
use super::request as __internal_request;
pub struct BarApiClient<C: hyper::client::connect::Connect>
pub struct BarApiClient<C: Connect>
where C: Clone + std::marker::Send + Sync + 'static {
configuration: Rc<configuration::Configuration<C>>,
}
impl<C: hyper::client::connect::Connect> BarApiClient<C>
impl<C: Connect> BarApiClient<C>
where C: Clone + std::marker::Send + Sync {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> BarApiClient<C> {
BarApiClient {
@ -39,7 +40,7 @@ pub trait BarApi {
fn create_bar(&self, bar_create: models::BarCreate) -> Pin<Box<dyn Future<Output = Result<models::Bar, Error>>>>;
}
impl<C: hyper::client::connect::Connect>BarApi for BarApiClient<C>
impl<C: Connect>BarApi for BarApiClient<C>
where C: Clone + std::marker::Send + Sync {
#[allow(unused_mut)]
fn create_bar(&self, bar_create: models::BarCreate) -> Pin<Box<dyn Future<Output = Result<models::Bar, Error>>>> {

View File

@ -1,6 +1,7 @@
use std::rc::Rc;
use hyper;
use hyper_util::client::legacy::connect::Connect;
use super::configuration::Configuration;
pub struct APIClient {
@ -9,7 +10,7 @@ pub struct APIClient {
}
impl APIClient {
pub fn new<C: hyper::client::connect::Connect>(configuration: Configuration<C>) -> APIClient
pub fn new<C: Connect>(configuration: Configuration<C>) -> APIClient
where C: Clone + std::marker::Send + Sync + 'static {
let rc = Rc::new(configuration);

View File

@ -9,12 +9,16 @@
*/
use hyper;
use hyper_util::client::legacy::Client;
use hyper_util::client::legacy::connect::Connect;
use hyper_util::client::legacy::connect::HttpConnector;
use hyper_util::rt::TokioExecutor;
pub struct Configuration<C: hyper::client::connect::Connect>
pub struct Configuration<C: Connect = HttpConnector>
where C: Clone + std::marker::Send + Sync + 'static {
pub base_path: String,
pub user_agent: Option<String>,
pub client: hyper::client::Client<C>,
pub client: Client<C, String>,
pub basic_auth: Option<BasicAuth>,
pub oauth_access_token: Option<String>,
pub api_key: Option<ApiKey>,
@ -28,9 +32,41 @@ pub struct ApiKey {
pub key: String,
}
impl<C: hyper::client::connect::Connect> Configuration<C>
impl Configuration<HttpConnector> {
/// Construct a default [`Configuration`](Self) with a hyper client using a default
/// [`HttpConnector`](hyper_util::client::legacy::connect::HttpConnector).
///
/// Use [`with_client`](Configuration<T>::with_client) to construct a Configuration with a
/// custom hyper client.
///
/// # Example
///
/// ```
/// let api_config = {
/// api_key: "my-api-key",
/// ...Configuration::new()
/// }
/// ```
pub fn new() -> Configuration<HttpConnector> {
Configuration::default()
}
}
impl<C: Connect> Configuration<C>
where C: Clone + std::marker::Send + Sync {
pub fn new(client: hyper::client::Client<C>) -> Configuration<C> {
/// Construct a new Configuration with a custom hyper client.
///
/// # Example
///
/// ```
/// let client = Client::builder(TokioExecutor::new())
/// .pool_idle_timeout(Duration::from_secs(30))
/// .build_http();
///
/// let api_config = Configuration::with_client(client);
/// ```
pub fn with_client(client: Client<C, String>) -> Configuration<C> {
Configuration {
base_path: "http://localhost:8080".to_owned(),
user_agent: Some("OpenAPI-Generator/0.0.1/rust".to_owned()),
@ -41,3 +77,10 @@ impl<C: hyper::client::connect::Connect> Configuration<C>
}
}
}
impl Default for Configuration<HttpConnector> {
fn default() -> Self {
let client = Client::builder(TokioExecutor::new()).build_http();
Configuration::with_client(client)
}
}

View File

@ -15,18 +15,19 @@ use std::pin::Pin;
use std::option::Option;
use hyper;
use hyper_util::client::legacy::connect::Connect;
use futures::Future;
use crate::models;
use super::{Error, configuration};
use super::request as __internal_request;
pub struct FooApiClient<C: hyper::client::connect::Connect>
pub struct FooApiClient<C: Connect>
where C: Clone + std::marker::Send + Sync + 'static {
configuration: Rc<configuration::Configuration<C>>,
}
impl<C: hyper::client::connect::Connect> FooApiClient<C>
impl<C: Connect> FooApiClient<C>
where C: Clone + std::marker::Send + Sync {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> FooApiClient<C> {
FooApiClient {
@ -40,7 +41,7 @@ pub trait FooApi {
fn get_all_foos(&self, ) -> Pin<Box<dyn Future<Output = Result<Vec<models::FooRefOrValue>, Error>>>>;
}
impl<C: hyper::client::connect::Connect>FooApi for FooApiClient<C>
impl<C: Connect>FooApi for FooApiClient<C>
where C: Clone + std::marker::Send + Sync {
#[allow(unused_mut)]
fn create_foo(&self, foo: Option<models::Foo>) -> Pin<Box<dyn Future<Output = Result<models::FooRefOrValue, Error>>>> {

View File

@ -1,25 +1,38 @@
use http;
use std::fmt;
use std::fmt::Debug;
use hyper;
use hyper::http;
use hyper_util::client::legacy::connect::Connect;
use serde_json;
#[derive(Debug)]
pub enum Error {
Api(ApiError),
Header(hyper::http::header::InvalidHeaderValue),
Header(http::header::InvalidHeaderValue),
Http(http::Error),
Hyper(hyper::Error),
HyperClient(hyper_util::client::legacy::Error),
Serde(serde_json::Error),
UriError(http::uri::InvalidUri),
}
#[derive(Debug)]
pub struct ApiError {
pub code: hyper::StatusCode,
pub body: hyper::body::Body,
pub body: hyper::body::Incoming,
}
impl From<(hyper::StatusCode, hyper::body::Body)> for Error {
fn from(e: (hyper::StatusCode, hyper::body::Body)) -> Self {
impl Debug for ApiError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("ApiError")
.field("code", &self.code)
.field("body", &"hyper::body::Incoming")
.finish()
}
}
impl From<(hyper::StatusCode, hyper::body::Incoming)> for Error {
fn from(e: (hyper::StatusCode, hyper::body::Incoming)) -> Self {
Error::Api(ApiError {
code: e.0,
body: e.1,
@ -33,6 +46,12 @@ impl From<http::Error> for Error {
}
}
impl From<hyper_util::client::legacy::Error> for Error {
fn from(e: hyper_util::client::legacy::Error) -> Self {
Error::HyperClient(e)
}
}
impl From<hyper::Error> for Error {
fn from(e: hyper::Error) -> Self {
Error::Hyper(e)

View File

@ -4,7 +4,9 @@ use std::pin::Pin;
use futures;
use futures::Future;
use futures::future::*;
use http_body_util::BodyExt;
use hyper;
use hyper_util::client::legacy::connect::Connect;
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, HeaderValue, USER_AGENT};
use serde;
use serde_json;
@ -109,7 +111,7 @@ impl Request {
conf: &configuration::Configuration<C>,
) -> Pin<Box<dyn Future<Output=Result<U, Error>> + 'a>>
where
C: hyper::client::connect::Connect + Clone + std::marker::Send + Sync,
C: Connect + Clone + std::marker::Send + Sync,
U: Sized + std::marker::Send + 'a,
for<'de> U: serde::Deserialize<'de>,
{
@ -203,13 +205,13 @@ impl Request {
for (k, v) in self.form_params {
enc.append_pair(&k, &v);
}
req_builder.body(hyper::Body::from(enc.finish()))
req_builder.body(enc.finish())
} else if let Some(body) = self.serialized_body {
req_headers.insert(CONTENT_TYPE, HeaderValue::from_static("application/json"));
req_headers.insert(CONTENT_LENGTH, body.len().into());
req_builder.body(hyper::Body::from(body))
req_builder.body(body)
} else {
req_builder.body(hyper::Body::default())
req_builder.body(String::new())
};
let request = match request_result {
Ok(request) => request,
@ -233,9 +235,12 @@ impl Request {
// need to impl default for all models.
futures::future::ok::<U, Error>(serde_json::from_str("null").expect("serde null value")).boxed()
} else {
hyper::body::to_bytes(response.into_body())
.map(|bytes| serde_json::from_slice(&bytes.unwrap()))
.map_err(|e| Error::from(e)).boxed()
let collect = response.into_body().collect().map_err(Error::from);
collect.map(|collected| {
collected.and_then(|collected| {
serde_json::from_slice(&collected.to_bytes()).map_err(Error::from)
})
}).boxed()
}
}))
}

View File

@ -12,8 +12,9 @@ serde_with = { version = "^3.8", default-features = false, features = ["base64",
serde_json = "^1.0"
url = "^2.5"
uuid = { version = "^1.8", features = ["serde", "v4"] }
hyper = { version = "~0.14", features = ["full"] }
hyper-tls = "~0.5"
hyper = { version = "^1.3.1", features = ["full"] }
hyper-util = { version = "0.1.5", features = ["client", "client-legacy", "http1", "http2"] }
http-body-util = { version = "0.1.2" }
http = "~0.2"
base64 = "~0.7.0"
futures = "^0.3"

View File

@ -1,6 +1,7 @@
use std::rc::Rc;
use hyper;
use hyper_util::client::legacy::connect::Connect;
use super::configuration::Configuration;
pub struct APIClient {
@ -12,7 +13,7 @@ pub struct APIClient {
}
impl APIClient {
pub fn new<C: hyper::client::connect::Connect>(configuration: Configuration<C>) -> APIClient
pub fn new<C: Connect>(configuration: Configuration<C>) -> APIClient
where C: Clone + std::marker::Send + Sync + 'static {
let rc = Rc::new(configuration);

View File

@ -9,12 +9,16 @@
*/
use hyper;
use hyper_util::client::legacy::Client;
use hyper_util::client::legacy::connect::Connect;
use hyper_util::client::legacy::connect::HttpConnector;
use hyper_util::rt::TokioExecutor;
pub struct Configuration<C: hyper::client::connect::Connect>
pub struct Configuration<C: Connect = HttpConnector>
where C: Clone + std::marker::Send + Sync + 'static {
pub base_path: String,
pub user_agent: Option<String>,
pub client: hyper::client::Client<C>,
pub client: Client<C, String>,
pub basic_auth: Option<BasicAuth>,
pub oauth_access_token: Option<String>,
pub api_key: Option<ApiKey>,
@ -28,9 +32,41 @@ pub struct ApiKey {
pub key: String,
}
impl<C: hyper::client::connect::Connect> Configuration<C>
impl Configuration<HttpConnector> {
/// Construct a default [`Configuration`](Self) with a hyper client using a default
/// [`HttpConnector`](hyper_util::client::legacy::connect::HttpConnector).
///
/// Use [`with_client`](Configuration<T>::with_client) to construct a Configuration with a
/// custom hyper client.
///
/// # Example
///
/// ```
/// let api_config = {
/// api_key: "my-api-key",
/// ...Configuration::new()
/// }
/// ```
pub fn new() -> Configuration<HttpConnector> {
Configuration::default()
}
}
impl<C: Connect> Configuration<C>
where C: Clone + std::marker::Send + Sync {
pub fn new(client: hyper::client::Client<C>) -> Configuration<C> {
/// Construct a new Configuration with a custom hyper client.
///
/// # Example
///
/// ```
/// let client = Client::builder(TokioExecutor::new())
/// .pool_idle_timeout(Duration::from_secs(30))
/// .build_http();
///
/// let api_config = Configuration::with_client(client);
/// ```
pub fn with_client(client: Client<C, String>) -> Configuration<C> {
Configuration {
base_path: "http://petstore.swagger.io/v2".to_owned(),
user_agent: Some("OpenAPI-Generator/1.0.0/rust".to_owned()),
@ -41,3 +77,10 @@ impl<C: hyper::client::connect::Connect> Configuration<C>
}
}
}
impl Default for Configuration<HttpConnector> {
fn default() -> Self {
let client = Client::builder(TokioExecutor::new()).build_http();
Configuration::with_client(client)
}
}

View File

@ -15,18 +15,19 @@ use std::pin::Pin;
use std::option::Option;
use hyper;
use hyper_util::client::legacy::connect::Connect;
use futures::Future;
use crate::models;
use super::{Error, configuration};
use super::request as __internal_request;
pub struct FakeApiClient<C: hyper::client::connect::Connect>
pub struct FakeApiClient<C: Connect>
where C: Clone + std::marker::Send + Sync + 'static {
configuration: Rc<configuration::Configuration<C>>,
}
impl<C: hyper::client::connect::Connect> FakeApiClient<C>
impl<C: Connect> FakeApiClient<C>
where C: Clone + std::marker::Send + Sync {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> FakeApiClient<C> {
FakeApiClient {
@ -39,7 +40,7 @@ pub trait FakeApi {
fn test_nullable_required_param(&self, username: &str, dummy_required_nullable_param: Option<&str>, uppercase: Option<&str>) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>;
}
impl<C: hyper::client::connect::Connect>FakeApi for FakeApiClient<C>
impl<C: Connect>FakeApi for FakeApiClient<C>
where C: Clone + std::marker::Send + Sync {
#[allow(unused_mut)]
fn test_nullable_required_param(&self, username: &str, dummy_required_nullable_param: Option<&str>, uppercase: Option<&str>) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> {

View File

@ -1,25 +1,38 @@
use http;
use std::fmt;
use std::fmt::Debug;
use hyper;
use hyper::http;
use hyper_util::client::legacy::connect::Connect;
use serde_json;
#[derive(Debug)]
pub enum Error {
Api(ApiError),
Header(hyper::http::header::InvalidHeaderValue),
Header(http::header::InvalidHeaderValue),
Http(http::Error),
Hyper(hyper::Error),
HyperClient(hyper_util::client::legacy::Error),
Serde(serde_json::Error),
UriError(http::uri::InvalidUri),
}
#[derive(Debug)]
pub struct ApiError {
pub code: hyper::StatusCode,
pub body: hyper::body::Body,
pub body: hyper::body::Incoming,
}
impl From<(hyper::StatusCode, hyper::body::Body)> for Error {
fn from(e: (hyper::StatusCode, hyper::body::Body)) -> Self {
impl Debug for ApiError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("ApiError")
.field("code", &self.code)
.field("body", &"hyper::body::Incoming")
.finish()
}
}
impl From<(hyper::StatusCode, hyper::body::Incoming)> for Error {
fn from(e: (hyper::StatusCode, hyper::body::Incoming)) -> Self {
Error::Api(ApiError {
code: e.0,
body: e.1,
@ -33,6 +46,12 @@ impl From<http::Error> for Error {
}
}
impl From<hyper_util::client::legacy::Error> for Error {
fn from(e: hyper_util::client::legacy::Error) -> Self {
Error::HyperClient(e)
}
}
impl From<hyper::Error> for Error {
fn from(e: hyper::Error) -> Self {
Error::Hyper(e)

View File

@ -15,18 +15,19 @@ use std::pin::Pin;
use std::option::Option;
use hyper;
use hyper_util::client::legacy::connect::Connect;
use futures::Future;
use crate::models;
use super::{Error, configuration};
use super::request as __internal_request;
pub struct PetApiClient<C: hyper::client::connect::Connect>
pub struct PetApiClient<C: Connect>
where C: Clone + std::marker::Send + Sync + 'static {
configuration: Rc<configuration::Configuration<C>>,
}
impl<C: hyper::client::connect::Connect> PetApiClient<C>
impl<C: Connect> PetApiClient<C>
where C: Clone + std::marker::Send + Sync {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> PetApiClient<C> {
PetApiClient {
@ -46,7 +47,7 @@ pub trait PetApi {
fn upload_file(&self, pet_id: i64, additional_metadata: Option<&str>, file: Option<std::path::PathBuf>) -> Pin<Box<dyn Future<Output = Result<models::ApiResponse, Error>>>>;
}
impl<C: hyper::client::connect::Connect>PetApi for PetApiClient<C>
impl<C: Connect>PetApi for PetApiClient<C>
where C: Clone + std::marker::Send + Sync {
#[allow(unused_mut)]
fn add_pet(&self, pet: models::Pet) -> Pin<Box<dyn Future<Output = Result<models::Pet, Error>>>> {

View File

@ -4,7 +4,9 @@ use std::pin::Pin;
use futures;
use futures::Future;
use futures::future::*;
use http_body_util::BodyExt;
use hyper;
use hyper_util::client::legacy::connect::Connect;
use hyper::header::{AUTHORIZATION, CONTENT_LENGTH, CONTENT_TYPE, HeaderValue, USER_AGENT};
use serde;
use serde_json;
@ -109,7 +111,7 @@ impl Request {
conf: &configuration::Configuration<C>,
) -> Pin<Box<dyn Future<Output=Result<U, Error>> + 'a>>
where
C: hyper::client::connect::Connect + Clone + std::marker::Send + Sync,
C: Connect + Clone + std::marker::Send + Sync,
U: Sized + std::marker::Send + 'a,
for<'de> U: serde::Deserialize<'de>,
{
@ -203,13 +205,13 @@ impl Request {
for (k, v) in self.form_params {
enc.append_pair(&k, &v);
}
req_builder.body(hyper::Body::from(enc.finish()))
req_builder.body(enc.finish())
} else if let Some(body) = self.serialized_body {
req_headers.insert(CONTENT_TYPE, HeaderValue::from_static("application/json"));
req_headers.insert(CONTENT_LENGTH, body.len().into());
req_builder.body(hyper::Body::from(body))
req_builder.body(body)
} else {
req_builder.body(hyper::Body::default())
req_builder.body(String::new())
};
let request = match request_result {
Ok(request) => request,
@ -233,9 +235,12 @@ impl Request {
// need to impl default for all models.
futures::future::ok::<U, Error>(serde_json::from_str("null").expect("serde null value")).boxed()
} else {
hyper::body::to_bytes(response.into_body())
.map(|bytes| serde_json::from_slice(&bytes.unwrap()))
.map_err(|e| Error::from(e)).boxed()
let collect = response.into_body().collect().map_err(Error::from);
collect.map(|collected| {
collected.and_then(|collected| {
serde_json::from_slice(&collected.to_bytes()).map_err(Error::from)
})
}).boxed()
}
}))
}

View File

@ -15,18 +15,19 @@ use std::pin::Pin;
use std::option::Option;
use hyper;
use hyper_util::client::legacy::connect::Connect;
use futures::Future;
use crate::models;
use super::{Error, configuration};
use super::request as __internal_request;
pub struct StoreApiClient<C: hyper::client::connect::Connect>
pub struct StoreApiClient<C: Connect>
where C: Clone + std::marker::Send + Sync + 'static {
configuration: Rc<configuration::Configuration<C>>,
}
impl<C: hyper::client::connect::Connect> StoreApiClient<C>
impl<C: Connect> StoreApiClient<C>
where C: Clone + std::marker::Send + Sync {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> StoreApiClient<C> {
StoreApiClient {
@ -42,7 +43,7 @@ pub trait StoreApi {
fn place_order(&self, order: models::Order) -> Pin<Box<dyn Future<Output = Result<models::Order, Error>>>>;
}
impl<C: hyper::client::connect::Connect>StoreApi for StoreApiClient<C>
impl<C: Connect>StoreApi for StoreApiClient<C>
where C: Clone + std::marker::Send + Sync {
#[allow(unused_mut)]
fn delete_order(&self, order_id: &str) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> {

View File

@ -15,18 +15,19 @@ use std::pin::Pin;
use std::option::Option;
use hyper;
use hyper_util::client::legacy::connect::Connect;
use futures::Future;
use crate::models;
use super::{Error, configuration};
use super::request as __internal_request;
pub struct TestingApiClient<C: hyper::client::connect::Connect>
pub struct TestingApiClient<C: Connect>
where C: Clone + std::marker::Send + Sync + 'static {
configuration: Rc<configuration::Configuration<C>>,
}
impl<C: hyper::client::connect::Connect> TestingApiClient<C>
impl<C: Connect> TestingApiClient<C>
where C: Clone + std::marker::Send + Sync {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> TestingApiClient<C> {
TestingApiClient {
@ -40,7 +41,7 @@ pub trait TestingApi {
fn tests_type_testing_get(&self, ) -> Pin<Box<dyn Future<Output = Result<models::TypeTesting, Error>>>>;
}
impl<C: hyper::client::connect::Connect>TestingApi for TestingApiClient<C>
impl<C: Connect>TestingApi for TestingApiClient<C>
where C: Clone + std::marker::Send + Sync {
#[allow(unused_mut)]
fn tests_file_response_get(&self, ) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>>>> {

View File

@ -15,18 +15,19 @@ use std::pin::Pin;
use std::option::Option;
use hyper;
use hyper_util::client::legacy::connect::Connect;
use futures::Future;
use crate::models;
use super::{Error, configuration};
use super::request as __internal_request;
pub struct UserApiClient<C: hyper::client::connect::Connect>
pub struct UserApiClient<C: Connect>
where C: Clone + std::marker::Send + Sync + 'static {
configuration: Rc<configuration::Configuration<C>>,
}
impl<C: hyper::client::connect::Connect> UserApiClient<C>
impl<C: Connect> UserApiClient<C>
where C: Clone + std::marker::Send + Sync {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> UserApiClient<C> {
UserApiClient {
@ -46,7 +47,7 @@ pub trait UserApi {
fn update_user(&self, username: &str, user: models::User) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>;
}
impl<C: hyper::client::connect::Connect>UserApi for UserApiClient<C>
impl<C: Connect>UserApi for UserApiClient<C>
where C: Clone + std::marker::Send + Sync {
#[allow(unused_mut)]
fn create_user(&self, user: models::User) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> {

View File

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

View File

@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

View File

@ -0,0 +1,53 @@
.gitignore
.travis.yml
Cargo.toml
README.md
docs/ActionContainer.md
docs/ApiResponse.md
docs/ArrayItemRefTest.md
docs/Baz.md
docs/Category.md
docs/EnumArrayTesting.md
docs/FakeApi.md
docs/NullableArray.md
docs/OptionalTesting.md
docs/Order.md
docs/Pet.md
docs/PetApi.md
docs/PropertyTest.md
docs/Ref.md
docs/Return.md
docs/StoreApi.md
docs/Tag.md
docs/TestingApi.md
docs/TypeTesting.md
docs/UniqueItemArrayTesting.md
docs/User.md
docs/UserApi.md
git_push.sh
src/apis/configuration.rs
src/apis/fake_api.rs
src/apis/mod.rs
src/apis/pet_api.rs
src/apis/store_api.rs
src/apis/testing_api.rs
src/apis/user_api.rs
src/lib.rs
src/models/action_container.rs
src/models/api_response.rs
src/models/array_item_ref_test.rs
src/models/baz.rs
src/models/category.rs
src/models/enum_array_testing.rs
src/models/mod.rs
src/models/model_ref.rs
src/models/model_return.rs
src/models/nullable_array.rs
src/models/optional_testing.rs
src/models/order.rs
src/models/pet.rs
src/models/property_test.rs
src/models/tag.rs
src/models/type_testing.rs
src/models/unique_item_array_testing.rs
src/models/user.rs

View File

@ -0,0 +1 @@
7.8.0-SNAPSHOT

View File

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

View File

@ -0,0 +1,19 @@
[package]
name = "petstore-hyper0x"
version = "1.0.0"
authors = ["OpenAPI Generator team and contributors"]
description = "This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters."
license = "Apache-2.0"
edition = "2021"
[dependencies]
serde = { version = "^1.0", features = ["derive"] }
serde_with = { version = "^3.8", default-features = false, features = ["base64", "std", "macros"] }
serde_json = "^1.0"
url = "^2.5"
uuid = { version = "^1.8", features = ["serde", "v4"] }
hyper = { version = "~0.14", features = ["full"] }
hyper-tls = "~0.5"
http = "~0.2"
base64 = "~0.7.0"
futures = "^0.3"

View File

@ -0,0 +1,84 @@
# Rust API client for petstore-hyper0x
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
- Generator version: 7.8.0-SNAPSHOT
- Build package: `org.openapitools.codegen.languages.RustClientCodegen`
## Installation
Put the package under your project folder in a directory named `petstore-hyper0x` and add the following to `Cargo.toml` under `[dependencies]`:
```
petstore-hyper0x = { path = "./petstore-hyper0x" }
```
## Documentation for API Endpoints
All URIs are relative to *http://petstore.swagger.io/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*FakeApi* | [**test_nullable_required_param**](docs/FakeApi.md#test_nullable_required_param) | **GET** /fake/user/{username} | To test nullable required parameters
*PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store
*PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet
*PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status
*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
*TestingApi* | [**tests_file_response_get**](docs/TestingApi.md#tests_file_response_get) | **GET** /tests/fileResponse | Returns an image file
*TestingApi* | [**tests_type_testing_get**](docs/TestingApi.md#tests_type_testing_get) | **GET** /tests/typeTesting | Route to test the TypeTesting schema
*UserApi* | [**create_user**](docs/UserApi.md#create_user) | **POST** /user | Create user
*UserApi* | [**create_users_with_array_input**](docs/UserApi.md#create_users_with_array_input) | **POST** /user/createWithArray | Creates list of users with given input array
*UserApi* | [**create_users_with_list_input**](docs/UserApi.md#create_users_with_list_input) | **POST** /user/createWithList | Creates list of users with given input array
*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
- [ActionContainer](docs/ActionContainer.md)
- [ApiResponse](docs/ApiResponse.md)
- [ArrayItemRefTest](docs/ArrayItemRefTest.md)
- [Baz](docs/Baz.md)
- [Category](docs/Category.md)
- [EnumArrayTesting](docs/EnumArrayTesting.md)
- [NullableArray](docs/NullableArray.md)
- [OptionalTesting](docs/OptionalTesting.md)
- [Order](docs/Order.md)
- [Pet](docs/Pet.md)
- [PropertyTest](docs/PropertyTest.md)
- [Ref](docs/Ref.md)
- [Return](docs/Return.md)
- [Tag](docs/Tag.md)
- [TypeTesting](docs/TypeTesting.md)
- [UniqueItemArrayTesting](docs/UniqueItemArrayTesting.md)
- [User](docs/User.md)
To get access to the crate's generated documentation, use:
```
cargo doc --open
```
## Author

View File

@ -0,0 +1,11 @@
# ActionContainer
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**action** | [**models::Baz**](Baz.md) | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,13 @@
# ApiResponse
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**code** | Option<**i32**> | | [optional]
**r#type** | Option<**String**> | | [optional]
**message** | Option<**String**> | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,12 @@
# ArrayItemRefTest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**list_with_array_ref** | [**Vec<Vec<String>>**](Vec.md) | |
**list_with_object_ref** | [**Vec<std::collections::HashMap<String, serde_json::Value>>**](std::collections::HashMap.md) | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,14 @@
# Baz
## Enum Variants
| Name | Value |
|---- | -----|
| A | A |
| B | B |
| Empty | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,12 @@
# 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)

View File

@ -0,0 +1,11 @@
# EnumArrayTesting
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**required_enums** | **Vec<String>** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,41 @@
# \FakeApi
All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**test_nullable_required_param**](FakeApi.md#test_nullable_required_param) | **GET** /fake/user/{username} | To test nullable required parameters
## test_nullable_required_param
> test_nullable_required_param(username, dummy_required_nullable_param, uppercase)
To test nullable required parameters
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**username** | **String** | The name that needs to be fetched. Use user1 for testing. | [required] |
**dummy_required_nullable_param** | Option<**String**> | To test nullable required parameters | [required] |
**uppercase** | Option<**String**> | To test parameter names in upper case | |
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@ -0,0 +1,14 @@
# NullableArray
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**array_nullable** | Option<**Vec<String>**> | | [optional]
**just_array** | Option<**Vec<String>**> | | [optional]
**nullable_string** | Option<**String**> | | [optional]
**just_string** | Option<**String**> | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,14 @@
# OptionalTesting
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**optional_nonnull** | Option<**String**> | | [optional]
**required_nonnull** | **String** | |
**optional_nullable** | Option<**String**> | | [optional]
**required_nullable** | Option<**String**> | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -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)

View File

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

View File

@ -0,0 +1,261 @@
# \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
> models::Pet add_pet(pet)
Add a new pet to the store
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**pet** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | [required] |
### Return type
[**models::Pet**](Pet.md)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **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)
## 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<models::Pet> 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>**](String.md) | Status values that need to be considered for filter | [required] |
### Return type
[**Vec<models::Pet>**](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<models::Pet> 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>**](String.md) | Tags to filter by | [required] |
### Return type
[**Vec<models::Pet>**](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
> 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
[**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
> models::Pet update_pet(pet)
Update an existing pet
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**pet** | [**Pet**](Pet.md) | Pet object that needs to be added to the store | [required] |
### Return type
[**models::Pet**](Pet.md)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **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_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
> 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
[**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)

View File

@ -0,0 +1,11 @@
# PropertyTest
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**uuid** | Option<[**uuid::Uuid**](uuid::Uuid.md)> | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,11 @@
# Ref
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**dummy** | Option<**String**> | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,13 @@
# Return
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**r#match** | Option<**i32**> | | [optional]
**r#async** | Option<**bool**> | | [optional]
**param_super** | Option<**bool**> | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,129 @@
# \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<String, i32> 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<String, i32>**
### 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
> 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 generate exceptions
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**order_id** | **i64** | ID of pet that needs to be fetched | [required] |
### Return type
[**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
> models::Order place_order(order)
Place an order for a pet
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**order** | [**Order**](Order.md) | order placed for purchasing the pet | [required] |
### Return type
[**models::Order**](Order.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **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)

View File

@ -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)

View File

@ -0,0 +1,60 @@
# \TestingApi
All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**tests_file_response_get**](TestingApi.md#tests_file_response_get) | **GET** /tests/fileResponse | Returns an image file
[**tests_type_testing_get**](TestingApi.md#tests_type_testing_get) | **GET** /tests/typeTesting | Route to test the TypeTesting schema
## tests_file_response_get
> std::path::PathBuf tests_file_response_get()
Returns an image file
### Parameters
This endpoint does not need any parameter.
### Return type
[**std::path::PathBuf**](std::path::PathBuf.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: image/jpeg
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
## tests_type_testing_get
> models::TypeTesting tests_type_testing_get()
Route to test the TypeTesting schema
### Parameters
This endpoint does not need any parameter.
### Return type
[**models::TypeTesting**](TypeTesting.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@ -0,0 +1,18 @@
# TypeTesting
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**int32** | **i32** | |
**int64** | **i64** | |
**float** | **f32** | |
**double** | **f64** | |
**string** | **String** | |
**boolean** | **bool** | |
**uuid** | [**uuid::Uuid**](uuid::Uuid.md) | |
**bytes** | **String** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,11 @@
# UniqueItemArrayTesting
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**unique_item_array** | **Vec<String>** | Helper object for the unique item array test |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

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

View File

@ -0,0 +1,255 @@
# \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(user)
Create user
This can only be done by the logged in user.
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**user** | [**User**](User.md) | Created user object | [required] |
### Return type
(empty response body)
### Authorization
[api_key](../README.md#api_key)
### HTTP request headers
- **Content-Type**: application/json
- **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(user)
Creates list of users with given input array
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**user** | [**Vec<models::User>**](User.md) | List of user object | [required] |
### Return type
(empty response body)
### Authorization
[api_key](../README.md#api_key)
### HTTP request headers
- **Content-Type**: application/json
- **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(user)
Creates list of users with given input array
### Parameters
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**user** | [**Vec<models::User>**](User.md) | List of user object | [required] |
### Return type
(empty response body)
### Authorization
[api_key](../README.md#api_key)
### HTTP request headers
- **Content-Type**: application/json
- **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
[api_key](../README.md#api_key)
### 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
> 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
[**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
[api_key](../README.md#api_key)
### 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, user)
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] |
**user** | [**User**](User.md) | Updated user object | [required] |
### Return type
(empty response body)
### Authorization
[api_key](../README.md#api_key)
### HTTP request headers
- **Content-Type**: application/json
- **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)

View File

@ -0,0 +1,57 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
git_user_id=$1
git_repo_id=$2
release_note=$3
git_host=$4
if [ "$git_host" = "" ]; then
git_host="github.com"
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
fi
if [ "$git_user_id" = "" ]; then
git_user_id="GIT_USER_ID"
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
fi
if [ "$git_repo_id" = "" ]; then
git_repo_id="GIT_REPO_ID"
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
fi
if [ "$release_note" = "" ]; then
release_note="Minor update"
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
fi
# Initialize the local directory as a Git repository
git init
# Adds the files in the local repository and stages them for commit.
git add .
# Commits the tracked changes and prepares them to be pushed to a remote repository.
git commit -m "$release_note"
# Sets the new remote
git_remote=$(git remote)
if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
fi
fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'

View File

@ -0,0 +1,43 @@
/*
* 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<C: hyper::client::connect::Connect>
where C: Clone + std::marker::Send + Sync + 'static {
pub base_path: String,
pub user_agent: Option<String>,
pub client: hyper::client::Client<C>,
pub basic_auth: Option<BasicAuth>,
pub oauth_access_token: Option<String>,
pub api_key: Option<ApiKey>,
// TODO: take an oauth2 token source, similar to the go one
}
pub type BasicAuth = (String, Option<String>);
pub struct ApiKey {
pub prefix: Option<String>,
pub key: String,
}
impl<C: hyper::client::connect::Connect> Configuration<C>
where C: Clone + std::marker::Send + Sync {
pub fn new(client: hyper::client::Client<C>) -> Configuration<C> {
Configuration {
base_path: "http://petstore.swagger.io/v2".to_owned(),
user_agent: Some("OpenAPI-Generator/1.0.0/rust".to_owned()),
client,
basic_auth: None,
oauth_access_token: None,
api_key: None,
}
}
}

View File

@ -0,0 +1,61 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
use std::rc::Rc;
use std::borrow::Borrow;
use std::pin::Pin;
#[allow(unused_imports)]
use std::option::Option;
use hyper;
use futures::Future;
use crate::models;
use super::{Error, configuration};
use super::request as __internal_request;
pub struct FakeApiClient<C: hyper::client::connect::Connect>
where C: Clone + std::marker::Send + Sync + 'static {
configuration: Rc<configuration::Configuration<C>>,
}
impl<C: hyper::client::connect::Connect> FakeApiClient<C>
where C: Clone + std::marker::Send + Sync {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> FakeApiClient<C> {
FakeApiClient {
configuration,
}
}
}
pub trait FakeApi {
fn test_nullable_required_param(&self, username: &str, dummy_required_nullable_param: Option<&str>, uppercase: Option<&str>) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>;
}
impl<C: hyper::client::connect::Connect>FakeApi for FakeApiClient<C>
where C: Clone + std::marker::Send + Sync {
#[allow(unused_mut)]
fn test_nullable_required_param(&self, username: &str, dummy_required_nullable_param: Option<&str>, uppercase: Option<&str>) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/fake/user/{username}".to_string())
;
req = req.with_path_param("username".to_string(), username.to_string());
match dummy_required_nullable_param {
Some(param_value) => { req = req.with_header_param("dummy_required_nullable_param".to_string(), param_value.to_string()); },
None => { req = req.with_header_param("dummy_required_nullable_param".to_string(), "".to_string()); },
}
if let Some(param_value) = uppercase {
req = req.with_header_param("UPPERCASE".to_string(), param_value.to_string());
}
req = req.returns_nothing();
req.execute(self.configuration.borrow())
}
}

View File

@ -0,0 +1,62 @@
use http;
use hyper;
use serde_json;
#[derive(Debug)]
pub enum Error {
Api(ApiError),
Header(hyper::http::header::InvalidHeaderValue),
Http(http::Error),
Hyper(hyper::Error),
Serde(serde_json::Error),
UriError(http::uri::InvalidUri),
}
#[derive(Debug)]
pub struct ApiError {
pub code: hyper::StatusCode,
pub body: hyper::body::Body,
}
impl From<(hyper::StatusCode, hyper::body::Body)> for Error {
fn from(e: (hyper::StatusCode, hyper::body::Body)) -> Self {
Error::Api(ApiError {
code: e.0,
body: e.1,
})
}
}
impl From<http::Error> for Error {
fn from(e: http::Error) -> Self {
Error::Http(e)
}
}
impl From<hyper::Error> for Error {
fn from(e: hyper::Error) -> Self {
Error::Hyper(e)
}
}
impl From<serde_json::Error> for Error {
fn from(e: serde_json::Error) -> Self {
Error::Serde(e)
}
}
mod request;
mod fake_api;
pub use self::fake_api::{ FakeApi, FakeApiClient };
mod pet_api;
pub use self::pet_api::{ PetApi, PetApiClient };
mod store_api;
pub use self::store_api::{ StoreApi, StoreApiClient };
mod testing_api;
pub use self::testing_api::{ TestingApi, TestingApiClient };
mod user_api;
pub use self::user_api::{ UserApi, UserApiClient };
pub mod configuration;
pub mod client;

View File

@ -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::rc::Rc;
use std::borrow::Borrow;
use std::pin::Pin;
#[allow(unused_imports)]
use std::option::Option;
use hyper;
use futures::Future;
use crate::models;
use super::{Error, configuration};
use super::request as __internal_request;
pub struct PetApiClient<C: hyper::client::connect::Connect>
where C: Clone + std::marker::Send + Sync + 'static {
configuration: Rc<configuration::Configuration<C>>,
}
impl<C: hyper::client::connect::Connect> PetApiClient<C>
where C: Clone + std::marker::Send + Sync {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> PetApiClient<C> {
PetApiClient {
configuration,
}
}
}
pub trait PetApi {
fn add_pet(&self, pet: models::Pet) -> Pin<Box<dyn Future<Output = Result<models::Pet, Error>>>>;
fn delete_pet(&self, pet_id: i64, api_key: Option<&str>) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>;
fn find_pets_by_status(&self, status: Vec<String>) -> Pin<Box<dyn Future<Output = Result<Vec<models::Pet>, Error>>>>;
fn find_pets_by_tags(&self, tags: Vec<String>) -> Pin<Box<dyn Future<Output = Result<Vec<models::Pet>, Error>>>>;
fn get_pet_by_id(&self, pet_id: i64) -> Pin<Box<dyn Future<Output = Result<models::Pet, Error>>>>;
fn update_pet(&self, pet: models::Pet) -> Pin<Box<dyn Future<Output = Result<models::Pet, Error>>>>;
fn update_pet_with_form(&self, pet_id: i64, name: Option<&str>, status: Option<&str>) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>;
fn upload_file(&self, pet_id: i64, additional_metadata: Option<&str>, file: Option<std::path::PathBuf>) -> Pin<Box<dyn Future<Output = Result<models::ApiResponse, Error>>>>;
}
impl<C: hyper::client::connect::Connect>PetApi for PetApiClient<C>
where C: Clone + std::marker::Send + Sync {
#[allow(unused_mut)]
fn add_pet(&self, pet: models::Pet) -> Pin<Box<dyn Future<Output = Result<models::Pet, Error>>>> {
let mut req = __internal_request::Request::new(hyper::Method::POST, "/pet".to_string())
.with_auth(__internal_request::Auth::Oauth)
;
req = req.with_body_param(pet);
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn delete_pet(&self, pet_id: i64, api_key: Option<&str>) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> {
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())
}
#[allow(unused_mut)]
fn find_pets_by_status(&self, status: Vec<String>) -> Pin<Box<dyn Future<Output = Result<Vec<models::Pet>, Error>>>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/pet/findByStatus".to_string())
.with_auth(__internal_request::Auth::Oauth)
;
req = req.with_query_param("status".to_string(), status.join(",").to_string());
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn find_pets_by_tags(&self, tags: Vec<String>) -> Pin<Box<dyn Future<Output = Result<Vec<models::Pet>, Error>>>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/pet/findByTags".to_string())
.with_auth(__internal_request::Auth::Oauth)
;
req = req.with_query_param("tags".to_string(), tags.join(",").to_string());
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn get_pet_by_id(&self, pet_id: i64) -> Pin<Box<dyn Future<Output = Result<models::Pet, Error>>>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/pet/{petId}".to_string())
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
in_header: true,
in_query: false,
param_name: "api_key".to_owned(),
}))
;
req = req.with_path_param("petId".to_string(), pet_id.to_string());
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn update_pet(&self, pet: models::Pet) -> Pin<Box<dyn Future<Output = Result<models::Pet, Error>>>> {
let mut req = __internal_request::Request::new(hyper::Method::PUT, "/pet".to_string())
.with_auth(__internal_request::Auth::Oauth)
;
req = req.with_body_param(pet);
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn update_pet_with_form(&self, pet_id: i64, name: Option<&str>, status: Option<&str>) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> {
let mut req = __internal_request::Request::new(hyper::Method::POST, "/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) = name {
req = req.with_form_param("name".to_string(), param_value.to_string());
}
if let Some(param_value) = status {
req = req.with_form_param("status".to_string(), param_value.to_string());
}
req = req.returns_nothing();
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn upload_file(&self, pet_id: i64, additional_metadata: Option<&str>, file: Option<std::path::PathBuf>) -> Pin<Box<dyn Future<Output = Result<models::ApiResponse, Error>>>> {
let mut req = __internal_request::Request::new(hyper::Method::POST, "/pet/{petId}/uploadImage".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) = additional_metadata {
req = req.with_form_param("additionalMetadata".to_string(), param_value.to_string());
}
if let Some(param_value) = file {
req = req.with_form_param("file".to_string(), unimplemented!());
}
req.execute(self.configuration.borrow())
}
}

View File

@ -0,0 +1,88 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
use std::rc::Rc;
use std::borrow::Borrow;
use std::pin::Pin;
#[allow(unused_imports)]
use std::option::Option;
use hyper;
use futures::Future;
use crate::models;
use super::{Error, configuration};
use super::request as __internal_request;
pub struct StoreApiClient<C: hyper::client::connect::Connect>
where C: Clone + std::marker::Send + Sync + 'static {
configuration: Rc<configuration::Configuration<C>>,
}
impl<C: hyper::client::connect::Connect> StoreApiClient<C>
where C: Clone + std::marker::Send + Sync {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> StoreApiClient<C> {
StoreApiClient {
configuration,
}
}
}
pub trait StoreApi {
fn delete_order(&self, order_id: &str) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>;
fn get_inventory(&self, ) -> Pin<Box<dyn Future<Output = Result<std::collections::HashMap<String, i32>, Error>>>>;
fn get_order_by_id(&self, order_id: i64) -> Pin<Box<dyn Future<Output = Result<models::Order, Error>>>>;
fn place_order(&self, order: models::Order) -> Pin<Box<dyn Future<Output = Result<models::Order, Error>>>>;
}
impl<C: hyper::client::connect::Connect>StoreApi for StoreApiClient<C>
where C: Clone + std::marker::Send + Sync {
#[allow(unused_mut)]
fn delete_order(&self, order_id: &str) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> {
let mut req = __internal_request::Request::new(hyper::Method::DELETE, "/store/order/{orderId}".to_string())
;
req = req.with_path_param("orderId".to_string(), order_id.to_string());
req = req.returns_nothing();
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn get_inventory(&self, ) -> Pin<Box<dyn Future<Output = Result<std::collections::HashMap<String, i32>, Error>>>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/store/inventory".to_string())
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
in_header: true,
in_query: false,
param_name: "api_key".to_owned(),
}))
;
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn get_order_by_id(&self, order_id: i64) -> Pin<Box<dyn Future<Output = Result<models::Order, Error>>>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/store/order/{orderId}".to_string())
;
req = req.with_path_param("orderId".to_string(), order_id.to_string());
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn place_order(&self, order: models::Order) -> Pin<Box<dyn Future<Output = Result<models::Order, Error>>>> {
let mut req = __internal_request::Request::new(hyper::Method::POST, "/store/order".to_string())
;
req = req.with_body_param(order);
req.execute(self.configuration.borrow())
}
}

View File

@ -0,0 +1,61 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
use std::rc::Rc;
use std::borrow::Borrow;
use std::pin::Pin;
#[allow(unused_imports)]
use std::option::Option;
use hyper;
use futures::Future;
use crate::models;
use super::{Error, configuration};
use super::request as __internal_request;
pub struct TestingApiClient<C: hyper::client::connect::Connect>
where C: Clone + std::marker::Send + Sync + 'static {
configuration: Rc<configuration::Configuration<C>>,
}
impl<C: hyper::client::connect::Connect> TestingApiClient<C>
where C: Clone + std::marker::Send + Sync {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> TestingApiClient<C> {
TestingApiClient {
configuration,
}
}
}
pub trait TestingApi {
fn tests_file_response_get(&self, ) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>>>>;
fn tests_type_testing_get(&self, ) -> Pin<Box<dyn Future<Output = Result<models::TypeTesting, Error>>>>;
}
impl<C: hyper::client::connect::Connect>TestingApi for TestingApiClient<C>
where C: Clone + std::marker::Send + Sync {
#[allow(unused_mut)]
fn tests_file_response_get(&self, ) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>>>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/tests/fileResponse".to_string())
;
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn tests_type_testing_get(&self, ) -> Pin<Box<dyn Future<Output = Result<models::TypeTesting, Error>>>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/tests/typeTesting".to_string())
;
req.execute(self.configuration.borrow())
}
}

View File

@ -0,0 +1,160 @@
/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
use std::rc::Rc;
use std::borrow::Borrow;
use std::pin::Pin;
#[allow(unused_imports)]
use std::option::Option;
use hyper;
use futures::Future;
use crate::models;
use super::{Error, configuration};
use super::request as __internal_request;
pub struct UserApiClient<C: hyper::client::connect::Connect>
where C: Clone + std::marker::Send + Sync + 'static {
configuration: Rc<configuration::Configuration<C>>,
}
impl<C: hyper::client::connect::Connect> UserApiClient<C>
where C: Clone + std::marker::Send + Sync {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> UserApiClient<C> {
UserApiClient {
configuration,
}
}
}
pub trait UserApi {
fn create_user(&self, user: models::User) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>;
fn create_users_with_array_input(&self, user: Vec<models::User>) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>;
fn create_users_with_list_input(&self, user: Vec<models::User>) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>;
fn delete_user(&self, username: &str) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>;
fn get_user_by_name(&self, username: &str) -> Pin<Box<dyn Future<Output = Result<models::User, Error>>>>;
fn login_user(&self, username: &str, password: &str) -> Pin<Box<dyn Future<Output = Result<String, Error>>>>;
fn logout_user(&self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>;
fn update_user(&self, username: &str, user: models::User) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>;
}
impl<C: hyper::client::connect::Connect>UserApi for UserApiClient<C>
where C: Clone + std::marker::Send + Sync {
#[allow(unused_mut)]
fn create_user(&self, user: models::User) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> {
let mut req = __internal_request::Request::new(hyper::Method::POST, "/user".to_string())
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
in_header: true,
in_query: false,
param_name: "api_key".to_owned(),
}))
;
req = req.with_body_param(user);
req = req.returns_nothing();
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn create_users_with_array_input(&self, user: Vec<models::User>) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> {
let mut req = __internal_request::Request::new(hyper::Method::POST, "/user/createWithArray".to_string())
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
in_header: true,
in_query: false,
param_name: "api_key".to_owned(),
}))
;
req = req.with_body_param(user);
req = req.returns_nothing();
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn create_users_with_list_input(&self, user: Vec<models::User>) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> {
let mut req = __internal_request::Request::new(hyper::Method::POST, "/user/createWithList".to_string())
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
in_header: true,
in_query: false,
param_name: "api_key".to_owned(),
}))
;
req = req.with_body_param(user);
req = req.returns_nothing();
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn delete_user(&self, username: &str) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> {
let mut req = __internal_request::Request::new(hyper::Method::DELETE, "/user/{username}".to_string())
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
in_header: true,
in_query: false,
param_name: "api_key".to_owned(),
}))
;
req = req.with_path_param("username".to_string(), username.to_string());
req = req.returns_nothing();
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn get_user_by_name(&self, username: &str) -> Pin<Box<dyn Future<Output = Result<models::User, Error>>>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/user/{username}".to_string())
;
req = req.with_path_param("username".to_string(), username.to_string());
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn login_user(&self, username: &str, password: &str) -> Pin<Box<dyn Future<Output = Result<String, Error>>>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/user/login".to_string())
;
req = req.with_query_param("username".to_string(), username.to_string());
req = req.with_query_param("password".to_string(), password.to_string());
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn logout_user(&self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/user/logout".to_string())
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
in_header: true,
in_query: false,
param_name: "api_key".to_owned(),
}))
;
req = req.returns_nothing();
req.execute(self.configuration.borrow())
}
#[allow(unused_mut)]
fn update_user(&self, username: &str, user: models::User) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> {
let mut req = __internal_request::Request::new(hyper::Method::PUT, "/user/{username}".to_string())
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
in_header: true,
in_query: false,
param_name: "api_key".to_owned(),
}))
;
req = req.with_path_param("username".to_string(), username.to_string());
req = req.with_body_param(user);
req = req.returns_nothing();
req.execute(self.configuration.borrow())
}
}

View File

@ -0,0 +1,11 @@
#![allow(unused_imports)]
#![allow(clippy::too_many_arguments)]
extern crate serde;
extern crate serde_json;
extern crate url;
extern crate hyper;
extern crate futures;
pub mod apis;
pub mod models;

View File

@ -0,0 +1,27 @@
/*
* 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 crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ActionContainer {
#[serde(rename = "action")]
pub action: Box<models::Baz>,
}
impl ActionContainer {
pub fn new(action: models::Baz) -> ActionContainer {
ActionContainer {
action: Box::new(action),
}
}
}

Some files were not shown because too many files have changed in this diff Show More