Make the rust hyper client Send so it can be used in rust threads more easily (#19375)

* Add externCrateName property to rust hyper client

This is follows the lead of the rust hyper server generator and provides
an externCrateName. This is because the crate name used for importing
can be different from the package name, because dashes `-` get converted
to underscores `_`.

This allows us to write example code in rustdoc that compiles
successfully.

* Get the rustdoc examples to actually compile

* Make rust hyper client thread safe

* Fix compile time issue with reqwest client test

* Add a test for thread safety

* Generate rust hyper samples

* Use https for petstore api to fix client tests

http://petstore.swagger.io/v2 is 301 redirecting to
https://petstore.swagger.io/v2 and this is breaking posts to the API.
When the client recieves a redirect it does not resend the POST data,
instead it switches to GET. This is in line with how browsers behave
when encountering a 301 redirect on a POST request.

* Make rust hyper client structs `Sync` too

This trait is also helpful in making the api work well with threads.

* Use a getCrateName function instead of adding more state

* update samples

---------

Co-authored-by: Krishna Rajendran <krishna@emptybox.org>
This commit is contained in:
William Cheng 2024-08-17 16:01:11 +08:00 committed by GitHub
parent 172fafe674
commit bb831dad9a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
39 changed files with 248 additions and 176 deletions

View File

@ -55,6 +55,7 @@ public class RustClientCodegen extends AbstractRustCodegen implements CodegenCon
@Setter private boolean avoidBoxedModels = false; @Setter private boolean avoidBoxedModels = false;
public static final String PACKAGE_NAME = "packageName"; public static final String PACKAGE_NAME = "packageName";
public static final String EXTERN_CRATE_NAME = "externCrateName";
public static final String PACKAGE_VERSION = "packageVersion"; public static final String PACKAGE_VERSION = "packageVersion";
public static final String HYPER_LIBRARY = "hyper"; public static final String HYPER_LIBRARY = "hyper";
public static final String HYPER0X_LIBRARY = "hyper0x"; public static final String HYPER0X_LIBRARY = "hyper0x";
@ -367,6 +368,7 @@ public class RustClientCodegen extends AbstractRustCodegen implements CodegenCon
additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName); additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName);
additionalProperties.put(CodegenConstants.PACKAGE_VERSION, packageVersion); additionalProperties.put(CodegenConstants.PACKAGE_VERSION, packageVersion);
additionalProperties.put(EXTERN_CRATE_NAME, getExternCrateName());
additionalProperties.put("apiDocPath", apiDocPath); additionalProperties.put("apiDocPath", apiDocPath);
additionalProperties.put("modelDocPath", modelDocPath); additionalProperties.put("modelDocPath", modelDocPath);
@ -423,6 +425,11 @@ public class RustClientCodegen extends AbstractRustCodegen implements CodegenCon
} }
private String getExternCrateName() {
// The external name used when importing a crate has all '-' replaced with '_'.
return packageName.replace('-', '_');
}
private boolean getSupportAsync() { private boolean getSupportAsync() {
return supportAsync; return supportAsync;
} }

View File

@ -1,5 +1,5 @@
{{>partial_header}} {{>partial_header}}
use std::rc::Rc; use std::sync::Arc;
use std::borrow::Borrow; use std::borrow::Borrow;
use std::pin::Pin; use std::pin::Pin;
#[allow(unused_imports)] #[allow(unused_imports)]
@ -15,22 +15,22 @@ use super::request as __internal_request;
pub struct {{{classname}}}Client<C: Connect> pub struct {{{classname}}}Client<C: Connect>
where C: Clone + std::marker::Send + Sync + 'static { where C: Clone + std::marker::Send + Sync + 'static {
configuration: Rc<configuration::Configuration<C>>, configuration: Arc<configuration::Configuration<C>>,
} }
impl<C: Connect> {{{classname}}}Client<C> impl<C: Connect> {{{classname}}}Client<C>
where C: Clone + std::marker::Send + Sync { where C: Clone + std::marker::Send + Sync {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> {{{classname}}}Client<C> { pub fn new(configuration: Arc<configuration::Configuration<C>>) -> {{{classname}}}Client<C> {
{{{classname}}}Client { {{{classname}}}Client {
configuration, configuration,
} }
} }
} }
pub trait {{{classname}}} { pub trait {{{classname}}}: Send + Sync {
{{#operations}} {{#operations}}
{{#operation}} {{#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>>>>; 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>> + Send>>;
{{/operation}} {{/operation}}
{{/operations}} {{/operations}}
} }
@ -40,7 +40,7 @@ impl<C: Connect>{{{classname}}} for {{{classname}}}Client<C>
{{#operations}} {{#operations}}
{{#operation}} {{#operation}}
#[allow(unused_mut)] #[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>>>> { 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>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::{{{httpMethod.toUpperCase}}}, "{{{path}}}".to_string()) let mut req = __internal_request::Request::new(hyper::Method::{{{httpMethod.toUpperCase}}}, "{{{path}}}".to_string())
{{#hasAuthMethods}} {{#hasAuthMethods}}
{{#authMethods}} {{#authMethods}}

View File

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

View File

@ -33,10 +33,11 @@ impl Configuration<HttpConnector> {
/// # Example /// # Example
/// ///
/// ``` /// ```
/// let api_config = { /// # use {{externCrateName}}::apis::configuration::Configuration;
/// api_key: "my-api-key", /// let api_config = Configuration {
/// ...Configuration::new() /// basic_auth: Some(("user".into(), None)),
/// } /// ..Configuration::new()
/// };
/// ``` /// ```
pub fn new() -> Configuration<HttpConnector> { pub fn new() -> Configuration<HttpConnector> {
Configuration::default() Configuration::default()
@ -51,6 +52,11 @@ impl<C: Connect> Configuration<C>
/// # Example /// # Example
/// ///
/// ``` /// ```
/// # use core::time::Duration;
/// # use {{externCrateName}}::apis::configuration::Configuration;
/// use hyper_util::client::legacy::Client;
/// use hyper_util::rt::TokioExecutor;
///
/// let client = Client::builder(TokioExecutor::new()) /// let client = Client::builder(TokioExecutor::new())
/// .pool_idle_timeout(Duration::from_secs(30)) /// .pool_idle_timeout(Duration::from_secs(30))
/// .build_http(); /// .build_http();

View File

@ -109,7 +109,7 @@ impl Request {
pub fn execute<'a, C, U>( pub fn execute<'a, C, U>(
self, self,
conf: &configuration::Configuration<C>, conf: &configuration::Configuration<C>,
) -> Pin<Box<dyn Future<Output=Result<U, Error>> + 'a>> ) -> Pin<Box<dyn Future<Output=Result<U, Error>> + 'a + Send>>
where where
C: Connect + Clone + std::marker::Send + Sync, C: Connect + Clone + std::marker::Send + Sync,
U: Sized + std::marker::Send + 'a, U: Sized + std::marker::Send + 'a,

View File

@ -1,4 +1,4 @@
use std::rc::Rc; use std::sync::Arc;
use hyper; use hyper;
use hyper_util::client::legacy::connect::Connect; use hyper_util::client::legacy::connect::Connect;
@ -11,7 +11,7 @@ pub struct APIClient {
impl APIClient { impl APIClient {
pub fn new<C: Connect>(configuration: Configuration<C>) -> APIClient pub fn new<C: Connect>(configuration: Configuration<C>) -> APIClient
where C: Clone + std::marker::Send + Sync + 'static { where C: Clone + std::marker::Send + Sync + 'static {
let rc = Rc::new(configuration); let rc = Arc::new(configuration);
APIClient { APIClient {
default_api: Box::new(crate::apis::DefaultApiClient::new(rc.clone())), default_api: Box::new(crate::apis::DefaultApiClient::new(rc.clone())),

View File

@ -42,10 +42,11 @@ impl Configuration<HttpConnector> {
/// # Example /// # Example
/// ///
/// ``` /// ```
/// let api_config = { /// # use api_ref_param_hyper::apis::configuration::Configuration;
/// api_key: "my-api-key", /// let api_config = Configuration {
/// ...Configuration::new() /// basic_auth: Some(("user".into(), None)),
/// } /// ..Configuration::new()
/// };
/// ``` /// ```
pub fn new() -> Configuration<HttpConnector> { pub fn new() -> Configuration<HttpConnector> {
Configuration::default() Configuration::default()
@ -60,6 +61,11 @@ impl<C: Connect> Configuration<C>
/// # Example /// # Example
/// ///
/// ``` /// ```
/// # use core::time::Duration;
/// # use api_ref_param_hyper::apis::configuration::Configuration;
/// use hyper_util::client::legacy::Client;
/// use hyper_util::rt::TokioExecutor;
///
/// let client = Client::builder(TokioExecutor::new()) /// let client = Client::builder(TokioExecutor::new())
/// .pool_idle_timeout(Duration::from_secs(30)) /// .pool_idle_timeout(Duration::from_secs(30))
/// .build_http(); /// .build_http();

View File

@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
use std::rc::Rc; use std::sync::Arc;
use std::borrow::Borrow; use std::borrow::Borrow;
use std::pin::Pin; use std::pin::Pin;
#[allow(unused_imports)] #[allow(unused_imports)]
@ -24,26 +24,26 @@ use super::request as __internal_request;
pub struct DefaultApiClient<C: Connect> pub struct DefaultApiClient<C: Connect>
where C: Clone + std::marker::Send + Sync + 'static { where C: Clone + std::marker::Send + Sync + 'static {
configuration: Rc<configuration::Configuration<C>>, configuration: Arc<configuration::Configuration<C>>,
} }
impl<C: Connect> DefaultApiClient<C> impl<C: Connect> DefaultApiClient<C>
where C: Clone + std::marker::Send + Sync { where C: Clone + std::marker::Send + Sync {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> DefaultApiClient<C> { pub fn new(configuration: Arc<configuration::Configuration<C>>) -> DefaultApiClient<C> {
DefaultApiClient { DefaultApiClient {
configuration, configuration,
} }
} }
} }
pub trait DefaultApi { pub trait DefaultApi: Send + Sync {
fn demo_color_get(&self, color: models::Color) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>; fn demo_color_get(&self, color: models::Color) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
} }
impl<C: Connect>DefaultApi for DefaultApiClient<C> impl<C: Connect>DefaultApi for DefaultApiClient<C>
where C: Clone + std::marker::Send + Sync { where C: Clone + std::marker::Send + Sync {
#[allow(unused_mut)] #[allow(unused_mut)]
fn demo_color_get(&self, color: models::Color) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> { fn demo_color_get(&self, color: models::Color) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/demo/{color}".to_string()) let mut req = __internal_request::Request::new(hyper::Method::GET, "/demo/{color}".to_string())
; ;
req = req.with_path_param("color".to_string(), color.to_string()); req = req.with_path_param("color".to_string(), color.to_string());

View File

@ -109,7 +109,7 @@ impl Request {
pub fn execute<'a, C, U>( pub fn execute<'a, C, U>(
self, self,
conf: &configuration::Configuration<C>, conf: &configuration::Configuration<C>,
) -> Pin<Box<dyn Future<Output=Result<U, Error>> + 'a>> ) -> Pin<Box<dyn Future<Output=Result<U, Error>> + 'a + Send>>
where where
C: Connect + Clone + std::marker::Send + Sync, C: Connect + Clone + std::marker::Send + Sync,
U: Sized + std::marker::Send + 'a, U: Sized + std::marker::Send + 'a,

View File

@ -1,4 +1,4 @@
use std::rc::Rc; use std::sync::Arc;
use hyper; use hyper;
use hyper_util::client::legacy::connect::Connect; use hyper_util::client::legacy::connect::Connect;
@ -11,7 +11,7 @@ pub struct APIClient {
impl APIClient { impl APIClient {
pub fn new<C: Connect>(configuration: Configuration<C>) -> APIClient pub fn new<C: Connect>(configuration: Configuration<C>) -> APIClient
where C: Clone + std::marker::Send + Sync + 'static { where C: Clone + std::marker::Send + Sync + 'static {
let rc = Rc::new(configuration); let rc = Arc::new(configuration);
APIClient { APIClient {
default_api: Box::new(crate::apis::DefaultApiClient::new(rc.clone())), default_api: Box::new(crate::apis::DefaultApiClient::new(rc.clone())),

View File

@ -42,10 +42,11 @@ impl Configuration<HttpConnector> {
/// # Example /// # Example
/// ///
/// ``` /// ```
/// let api_config = { /// # use composed_oneof_hyper::apis::configuration::Configuration;
/// api_key: "my-api-key", /// let api_config = Configuration {
/// ...Configuration::new() /// basic_auth: Some(("user".into(), None)),
/// } /// ..Configuration::new()
/// };
/// ``` /// ```
pub fn new() -> Configuration<HttpConnector> { pub fn new() -> Configuration<HttpConnector> {
Configuration::default() Configuration::default()
@ -60,6 +61,11 @@ impl<C: Connect> Configuration<C>
/// # Example /// # Example
/// ///
/// ``` /// ```
/// # use core::time::Duration;
/// # use composed_oneof_hyper::apis::configuration::Configuration;
/// use hyper_util::client::legacy::Client;
/// use hyper_util::rt::TokioExecutor;
///
/// let client = Client::builder(TokioExecutor::new()) /// let client = Client::builder(TokioExecutor::new())
/// .pool_idle_timeout(Duration::from_secs(30)) /// .pool_idle_timeout(Duration::from_secs(30))
/// .build_http(); /// .build_http();

View File

@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
use std::rc::Rc; use std::sync::Arc;
use std::borrow::Borrow; use std::borrow::Borrow;
use std::pin::Pin; use std::pin::Pin;
#[allow(unused_imports)] #[allow(unused_imports)]
@ -24,27 +24,27 @@ use super::request as __internal_request;
pub struct DefaultApiClient<C: Connect> pub struct DefaultApiClient<C: Connect>
where C: Clone + std::marker::Send + Sync + 'static { where C: Clone + std::marker::Send + Sync + 'static {
configuration: Rc<configuration::Configuration<C>>, configuration: Arc<configuration::Configuration<C>>,
} }
impl<C: Connect> DefaultApiClient<C> impl<C: Connect> DefaultApiClient<C>
where C: Clone + std::marker::Send + Sync { where C: Clone + std::marker::Send + Sync {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> DefaultApiClient<C> { pub fn new(configuration: Arc<configuration::Configuration<C>>) -> DefaultApiClient<C> {
DefaultApiClient { DefaultApiClient {
configuration, configuration,
} }
} }
} }
pub trait DefaultApi { pub trait DefaultApi: Send + Sync {
fn create_state(&self, create_state_request: models::CreateStateRequest) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>; fn create_state(&self, create_state_request: models::CreateStateRequest) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
fn get_state(&self, ) -> Pin<Box<dyn Future<Output = Result<models::GetState200Response, Error>>>>; fn get_state(&self, ) -> Pin<Box<dyn Future<Output = Result<models::GetState200Response, Error>> + Send>>;
} }
impl<C: Connect>DefaultApi for DefaultApiClient<C> impl<C: Connect>DefaultApi for DefaultApiClient<C>
where C: Clone + std::marker::Send + Sync { where C: Clone + std::marker::Send + Sync {
#[allow(unused_mut)] #[allow(unused_mut)]
fn create_state(&self, create_state_request: models::CreateStateRequest) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> { fn create_state(&self, create_state_request: models::CreateStateRequest) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::POST, "/state".to_string()) let mut req = __internal_request::Request::new(hyper::Method::POST, "/state".to_string())
; ;
req = req.with_body_param(create_state_request); req = req.with_body_param(create_state_request);
@ -54,7 +54,7 @@ impl<C: Connect>DefaultApi for DefaultApiClient<C>
} }
#[allow(unused_mut)] #[allow(unused_mut)]
fn get_state(&self, ) -> Pin<Box<dyn Future<Output = Result<models::GetState200Response, Error>>>> { fn get_state(&self, ) -> Pin<Box<dyn Future<Output = Result<models::GetState200Response, Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/state".to_string()) let mut req = __internal_request::Request::new(hyper::Method::GET, "/state".to_string())
; ;

View File

@ -109,7 +109,7 @@ impl Request {
pub fn execute<'a, C, U>( pub fn execute<'a, C, U>(
self, self,
conf: &configuration::Configuration<C>, conf: &configuration::Configuration<C>,
) -> Pin<Box<dyn Future<Output=Result<U, Error>> + 'a>> ) -> Pin<Box<dyn Future<Output=Result<U, Error>> + 'a + Send>>
where where
C: Connect + Clone + std::marker::Send + Sync, C: Connect + Clone + std::marker::Send + Sync,
U: Sized + std::marker::Send + 'a, U: Sized + std::marker::Send + 'a,

View File

@ -1,4 +1,4 @@
use std::rc::Rc; use std::sync::Arc;
use hyper; use hyper;
use hyper_util::client::legacy::connect::Connect; use hyper_util::client::legacy::connect::Connect;
@ -11,7 +11,7 @@ pub struct APIClient {
impl APIClient { impl APIClient {
pub fn new<C: Connect>(configuration: Configuration<C>) -> APIClient pub fn new<C: Connect>(configuration: Configuration<C>) -> APIClient
where C: Clone + std::marker::Send + Sync + 'static { where C: Clone + std::marker::Send + Sync + 'static {
let rc = Rc::new(configuration); let rc = Arc::new(configuration);
APIClient { APIClient {
default_api: Box::new(crate::apis::DefaultApiClient::new(rc.clone())), default_api: Box::new(crate::apis::DefaultApiClient::new(rc.clone())),

View File

@ -42,10 +42,11 @@ impl Configuration<HttpConnector> {
/// # Example /// # Example
/// ///
/// ``` /// ```
/// let api_config = { /// # use empty_object_hyper::apis::configuration::Configuration;
/// api_key: "my-api-key", /// let api_config = Configuration {
/// ...Configuration::new() /// basic_auth: Some(("user".into(), None)),
/// } /// ..Configuration::new()
/// };
/// ``` /// ```
pub fn new() -> Configuration<HttpConnector> { pub fn new() -> Configuration<HttpConnector> {
Configuration::default() Configuration::default()
@ -60,6 +61,11 @@ impl<C: Connect> Configuration<C>
/// # Example /// # Example
/// ///
/// ``` /// ```
/// # use core::time::Duration;
/// # use empty_object_hyper::apis::configuration::Configuration;
/// use hyper_util::client::legacy::Client;
/// use hyper_util::rt::TokioExecutor;
///
/// let client = Client::builder(TokioExecutor::new()) /// let client = Client::builder(TokioExecutor::new())
/// .pool_idle_timeout(Duration::from_secs(30)) /// .pool_idle_timeout(Duration::from_secs(30))
/// .build_http(); /// .build_http();

View File

@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
use std::rc::Rc; use std::sync::Arc;
use std::borrow::Borrow; use std::borrow::Borrow;
use std::pin::Pin; use std::pin::Pin;
#[allow(unused_imports)] #[allow(unused_imports)]
@ -24,26 +24,26 @@ use super::request as __internal_request;
pub struct DefaultApiClient<C: Connect> pub struct DefaultApiClient<C: Connect>
where C: Clone + std::marker::Send + Sync + 'static { where C: Clone + std::marker::Send + Sync + 'static {
configuration: Rc<configuration::Configuration<C>>, configuration: Arc<configuration::Configuration<C>>,
} }
impl<C: Connect> DefaultApiClient<C> impl<C: Connect> DefaultApiClient<C>
where C: Clone + std::marker::Send + Sync { where C: Clone + std::marker::Send + Sync {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> DefaultApiClient<C> { pub fn new(configuration: Arc<configuration::Configuration<C>>) -> DefaultApiClient<C> {
DefaultApiClient { DefaultApiClient {
configuration, configuration,
} }
} }
} }
pub trait DefaultApi { pub trait DefaultApi: Send + Sync {
fn endpoint_get(&self, ) -> Pin<Box<dyn Future<Output = Result<models::EmptyObject, Error>>>>; fn endpoint_get(&self, ) -> Pin<Box<dyn Future<Output = Result<models::EmptyObject, Error>> + Send>>;
} }
impl<C: Connect>DefaultApi for DefaultApiClient<C> impl<C: Connect>DefaultApi for DefaultApiClient<C>
where C: Clone + std::marker::Send + Sync { where C: Clone + std::marker::Send + Sync {
#[allow(unused_mut)] #[allow(unused_mut)]
fn endpoint_get(&self, ) -> Pin<Box<dyn Future<Output = Result<models::EmptyObject, Error>>>> { fn endpoint_get(&self, ) -> Pin<Box<dyn Future<Output = Result<models::EmptyObject, Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/endpoint".to_string()) let mut req = __internal_request::Request::new(hyper::Method::GET, "/endpoint".to_string())
; ;

View File

@ -109,7 +109,7 @@ impl Request {
pub fn execute<'a, C, U>( pub fn execute<'a, C, U>(
self, self,
conf: &configuration::Configuration<C>, conf: &configuration::Configuration<C>,
) -> Pin<Box<dyn Future<Output=Result<U, Error>> + 'a>> ) -> Pin<Box<dyn Future<Output=Result<U, Error>> + 'a + Send>>
where where
C: Connect + Clone + std::marker::Send + Sync, C: Connect + Clone + std::marker::Send + Sync,
U: Sized + std::marker::Send + 'a, U: Sized + std::marker::Send + 'a,

View File

@ -1,4 +1,4 @@
use std::rc::Rc; use std::sync::Arc;
use hyper; use hyper;
use hyper_util::client::legacy::connect::Connect; use hyper_util::client::legacy::connect::Connect;
@ -11,7 +11,7 @@ pub struct APIClient {
impl APIClient { impl APIClient {
pub fn new<C: Connect>(configuration: Configuration<C>) -> APIClient pub fn new<C: Connect>(configuration: Configuration<C>) -> APIClient
where C: Clone + std::marker::Send + Sync + 'static { where C: Clone + std::marker::Send + Sync + 'static {
let rc = Rc::new(configuration); let rc = Arc::new(configuration);
APIClient { APIClient {
default_api: Box::new(crate::apis::DefaultApiClient::new(rc.clone())), default_api: Box::new(crate::apis::DefaultApiClient::new(rc.clone())),

View File

@ -42,10 +42,11 @@ impl Configuration<HttpConnector> {
/// # Example /// # Example
/// ///
/// ``` /// ```
/// let api_config = { /// # use oneof_array_map_hyper::apis::configuration::Configuration;
/// api_key: "my-api-key", /// let api_config = Configuration {
/// ...Configuration::new() /// basic_auth: Some(("user".into(), None)),
/// } /// ..Configuration::new()
/// };
/// ``` /// ```
pub fn new() -> Configuration<HttpConnector> { pub fn new() -> Configuration<HttpConnector> {
Configuration::default() Configuration::default()
@ -60,6 +61,11 @@ impl<C: Connect> Configuration<C>
/// # Example /// # Example
/// ///
/// ``` /// ```
/// # use core::time::Duration;
/// # use oneof_array_map_hyper::apis::configuration::Configuration;
/// use hyper_util::client::legacy::Client;
/// use hyper_util::rt::TokioExecutor;
///
/// let client = Client::builder(TokioExecutor::new()) /// let client = Client::builder(TokioExecutor::new())
/// .pool_idle_timeout(Duration::from_secs(30)) /// .pool_idle_timeout(Duration::from_secs(30))
/// .build_http(); /// .build_http();

View File

@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
use std::rc::Rc; use std::sync::Arc;
use std::borrow::Borrow; use std::borrow::Borrow;
use std::pin::Pin; use std::pin::Pin;
#[allow(unused_imports)] #[allow(unused_imports)]
@ -24,27 +24,27 @@ use super::request as __internal_request;
pub struct DefaultApiClient<C: Connect> pub struct DefaultApiClient<C: Connect>
where C: Clone + std::marker::Send + Sync + 'static { where C: Clone + std::marker::Send + Sync + 'static {
configuration: Rc<configuration::Configuration<C>>, configuration: Arc<configuration::Configuration<C>>,
} }
impl<C: Connect> DefaultApiClient<C> impl<C: Connect> DefaultApiClient<C>
where C: Clone + std::marker::Send + Sync { where C: Clone + std::marker::Send + Sync {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> DefaultApiClient<C> { pub fn new(configuration: Arc<configuration::Configuration<C>>) -> DefaultApiClient<C> {
DefaultApiClient { DefaultApiClient {
configuration, configuration,
} }
} }
} }
pub trait DefaultApi { pub trait DefaultApi: Send + Sync {
fn root_get(&self, ) -> Pin<Box<dyn Future<Output = Result<models::Fruit, Error>>>>; fn root_get(&self, ) -> Pin<Box<dyn Future<Output = Result<models::Fruit, Error>> + Send>>;
fn test(&self, body: Option<serde_json::Value>) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>; fn test(&self, body: Option<serde_json::Value>) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
} }
impl<C: Connect>DefaultApi for DefaultApiClient<C> impl<C: Connect>DefaultApi for DefaultApiClient<C>
where C: Clone + std::marker::Send + Sync { where C: Clone + std::marker::Send + Sync {
#[allow(unused_mut)] #[allow(unused_mut)]
fn root_get(&self, ) -> Pin<Box<dyn Future<Output = Result<models::Fruit, Error>>>> { fn root_get(&self, ) -> Pin<Box<dyn Future<Output = Result<models::Fruit, Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/".to_string()) let mut req = __internal_request::Request::new(hyper::Method::GET, "/".to_string())
; ;
@ -52,7 +52,7 @@ impl<C: Connect>DefaultApi for DefaultApiClient<C>
} }
#[allow(unused_mut)] #[allow(unused_mut)]
fn test(&self, body: Option<serde_json::Value>) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> { fn test(&self, body: Option<serde_json::Value>) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::PUT, "/".to_string()) let mut req = __internal_request::Request::new(hyper::Method::PUT, "/".to_string())
; ;
req = req.with_body_param(body); req = req.with_body_param(body);

View File

@ -109,7 +109,7 @@ impl Request {
pub fn execute<'a, C, U>( pub fn execute<'a, C, U>(
self, self,
conf: &configuration::Configuration<C>, conf: &configuration::Configuration<C>,
) -> Pin<Box<dyn Future<Output=Result<U, Error>> + 'a>> ) -> Pin<Box<dyn Future<Output=Result<U, Error>> + 'a + Send>>
where where
C: Connect + Clone + std::marker::Send + Sync, C: Connect + Clone + std::marker::Send + Sync,
U: Sized + std::marker::Send + 'a, U: Sized + std::marker::Send + 'a,

View File

@ -1,4 +1,4 @@
use std::rc::Rc; use std::sync::Arc;
use hyper; use hyper;
use hyper_util::client::legacy::connect::Connect; use hyper_util::client::legacy::connect::Connect;
@ -11,7 +11,7 @@ pub struct APIClient {
impl APIClient { impl APIClient {
pub fn new<C: Connect>(configuration: Configuration<C>) -> APIClient pub fn new<C: Connect>(configuration: Configuration<C>) -> APIClient
where C: Clone + std::marker::Send + Sync + 'static { where C: Clone + std::marker::Send + Sync + 'static {
let rc = Rc::new(configuration); let rc = Arc::new(configuration);
APIClient { APIClient {
default_api: Box::new(crate::apis::DefaultApiClient::new(rc.clone())), default_api: Box::new(crate::apis::DefaultApiClient::new(rc.clone())),

View File

@ -42,10 +42,11 @@ impl Configuration<HttpConnector> {
/// # Example /// # Example
/// ///
/// ``` /// ```
/// let api_config = { /// # use oneof_reuse_ref_hyper::apis::configuration::Configuration;
/// api_key: "my-api-key", /// let api_config = Configuration {
/// ...Configuration::new() /// basic_auth: Some(("user".into(), None)),
/// } /// ..Configuration::new()
/// };
/// ``` /// ```
pub fn new() -> Configuration<HttpConnector> { pub fn new() -> Configuration<HttpConnector> {
Configuration::default() Configuration::default()
@ -60,6 +61,11 @@ impl<C: Connect> Configuration<C>
/// # Example /// # Example
/// ///
/// ``` /// ```
/// # use core::time::Duration;
/// # use oneof_reuse_ref_hyper::apis::configuration::Configuration;
/// use hyper_util::client::legacy::Client;
/// use hyper_util::rt::TokioExecutor;
///
/// let client = Client::builder(TokioExecutor::new()) /// let client = Client::builder(TokioExecutor::new())
/// .pool_idle_timeout(Duration::from_secs(30)) /// .pool_idle_timeout(Duration::from_secs(30))
/// .build_http(); /// .build_http();

View File

@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
use std::rc::Rc; use std::sync::Arc;
use std::borrow::Borrow; use std::borrow::Borrow;
use std::pin::Pin; use std::pin::Pin;
#[allow(unused_imports)] #[allow(unused_imports)]
@ -24,26 +24,26 @@ use super::request as __internal_request;
pub struct DefaultApiClient<C: Connect> pub struct DefaultApiClient<C: Connect>
where C: Clone + std::marker::Send + Sync + 'static { where C: Clone + std::marker::Send + Sync + 'static {
configuration: Rc<configuration::Configuration<C>>, configuration: Arc<configuration::Configuration<C>>,
} }
impl<C: Connect> DefaultApiClient<C> impl<C: Connect> DefaultApiClient<C>
where C: Clone + std::marker::Send + Sync { where C: Clone + std::marker::Send + Sync {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> DefaultApiClient<C> { pub fn new(configuration: Arc<configuration::Configuration<C>>) -> DefaultApiClient<C> {
DefaultApiClient { DefaultApiClient {
configuration, configuration,
} }
} }
} }
pub trait DefaultApi { pub trait DefaultApi: Send + Sync {
fn get_fruit(&self, ) -> Pin<Box<dyn Future<Output = Result<models::Fruit, Error>>>>; fn get_fruit(&self, ) -> Pin<Box<dyn Future<Output = Result<models::Fruit, Error>> + Send>>;
} }
impl<C: Connect>DefaultApi for DefaultApiClient<C> impl<C: Connect>DefaultApi for DefaultApiClient<C>
where C: Clone + std::marker::Send + Sync { where C: Clone + std::marker::Send + Sync {
#[allow(unused_mut)] #[allow(unused_mut)]
fn get_fruit(&self, ) -> Pin<Box<dyn Future<Output = Result<models::Fruit, Error>>>> { fn get_fruit(&self, ) -> Pin<Box<dyn Future<Output = Result<models::Fruit, Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/example".to_string()) let mut req = __internal_request::Request::new(hyper::Method::GET, "/example".to_string())
; ;

View File

@ -109,7 +109,7 @@ impl Request {
pub fn execute<'a, C, U>( pub fn execute<'a, C, U>(
self, self,
conf: &configuration::Configuration<C>, conf: &configuration::Configuration<C>,
) -> Pin<Box<dyn Future<Output=Result<U, Error>> + 'a>> ) -> Pin<Box<dyn Future<Output=Result<U, Error>> + 'a + Send>>
where where
C: Connect + Clone + std::marker::Send + Sync, C: Connect + Clone + std::marker::Send + Sync,
U: Sized + std::marker::Send + 'a, U: Sized + std::marker::Send + 'a,

View File

@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
use std::rc::Rc; use std::sync::Arc;
use std::borrow::Borrow; use std::borrow::Borrow;
use std::pin::Pin; use std::pin::Pin;
#[allow(unused_imports)] #[allow(unused_imports)]
@ -24,26 +24,26 @@ use super::request as __internal_request;
pub struct BarApiClient<C: Connect> pub struct BarApiClient<C: Connect>
where C: Clone + std::marker::Send + Sync + 'static { where C: Clone + std::marker::Send + Sync + 'static {
configuration: Rc<configuration::Configuration<C>>, configuration: Arc<configuration::Configuration<C>>,
} }
impl<C: Connect> BarApiClient<C> impl<C: Connect> BarApiClient<C>
where C: Clone + std::marker::Send + Sync { where C: Clone + std::marker::Send + Sync {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> BarApiClient<C> { pub fn new(configuration: Arc<configuration::Configuration<C>>) -> BarApiClient<C> {
BarApiClient { BarApiClient {
configuration, configuration,
} }
} }
} }
pub trait BarApi { pub trait BarApi: Send + Sync {
fn create_bar(&self, bar_create: models::BarCreate) -> Pin<Box<dyn Future<Output = Result<models::Bar, Error>>>>; fn create_bar(&self, bar_create: models::BarCreate) -> Pin<Box<dyn Future<Output = Result<models::Bar, Error>> + Send>>;
} }
impl<C: Connect>BarApi for BarApiClient<C> impl<C: Connect>BarApi for BarApiClient<C>
where C: Clone + std::marker::Send + Sync { where C: Clone + std::marker::Send + Sync {
#[allow(unused_mut)] #[allow(unused_mut)]
fn create_bar(&self, bar_create: models::BarCreate) -> Pin<Box<dyn Future<Output = Result<models::Bar, Error>>>> { fn create_bar(&self, bar_create: models::BarCreate) -> Pin<Box<dyn Future<Output = Result<models::Bar, Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::POST, "/bar".to_string()) let mut req = __internal_request::Request::new(hyper::Method::POST, "/bar".to_string())
; ;
req = req.with_body_param(bar_create); req = req.with_body_param(bar_create);

View File

@ -1,4 +1,4 @@
use std::rc::Rc; use std::sync::Arc;
use hyper; use hyper;
use hyper_util::client::legacy::connect::Connect; use hyper_util::client::legacy::connect::Connect;
@ -12,7 +12,7 @@ pub struct APIClient {
impl APIClient { impl APIClient {
pub fn new<C: Connect>(configuration: Configuration<C>) -> APIClient pub fn new<C: Connect>(configuration: Configuration<C>) -> APIClient
where C: Clone + std::marker::Send + Sync + 'static { where C: Clone + std::marker::Send + Sync + 'static {
let rc = Rc::new(configuration); let rc = Arc::new(configuration);
APIClient { APIClient {
bar_api: Box::new(crate::apis::BarApiClient::new(rc.clone())), bar_api: Box::new(crate::apis::BarApiClient::new(rc.clone())),

View File

@ -42,10 +42,11 @@ impl Configuration<HttpConnector> {
/// # Example /// # Example
/// ///
/// ``` /// ```
/// let api_config = { /// # use oneof_hyper::apis::configuration::Configuration;
/// api_key: "my-api-key", /// let api_config = Configuration {
/// ...Configuration::new() /// basic_auth: Some(("user".into(), None)),
/// } /// ..Configuration::new()
/// };
/// ``` /// ```
pub fn new() -> Configuration<HttpConnector> { pub fn new() -> Configuration<HttpConnector> {
Configuration::default() Configuration::default()
@ -60,6 +61,11 @@ impl<C: Connect> Configuration<C>
/// # Example /// # Example
/// ///
/// ``` /// ```
/// # use core::time::Duration;
/// # use oneof_hyper::apis::configuration::Configuration;
/// use hyper_util::client::legacy::Client;
/// use hyper_util::rt::TokioExecutor;
///
/// let client = Client::builder(TokioExecutor::new()) /// let client = Client::builder(TokioExecutor::new())
/// .pool_idle_timeout(Duration::from_secs(30)) /// .pool_idle_timeout(Duration::from_secs(30))
/// .build_http(); /// .build_http();

View File

@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
use std::rc::Rc; use std::sync::Arc;
use std::borrow::Borrow; use std::borrow::Borrow;
use std::pin::Pin; use std::pin::Pin;
#[allow(unused_imports)] #[allow(unused_imports)]
@ -24,27 +24,27 @@ use super::request as __internal_request;
pub struct FooApiClient<C: Connect> pub struct FooApiClient<C: Connect>
where C: Clone + std::marker::Send + Sync + 'static { where C: Clone + std::marker::Send + Sync + 'static {
configuration: Rc<configuration::Configuration<C>>, configuration: Arc<configuration::Configuration<C>>,
} }
impl<C: Connect> FooApiClient<C> impl<C: Connect> FooApiClient<C>
where C: Clone + std::marker::Send + Sync { where C: Clone + std::marker::Send + Sync {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> FooApiClient<C> { pub fn new(configuration: Arc<configuration::Configuration<C>>) -> FooApiClient<C> {
FooApiClient { FooApiClient {
configuration, configuration,
} }
} }
} }
pub trait FooApi { pub trait FooApi: Send + Sync {
fn create_foo(&self, foo: Option<models::Foo>) -> Pin<Box<dyn Future<Output = Result<models::FooRefOrValue, Error>>>>; fn create_foo(&self, foo: Option<models::Foo>) -> Pin<Box<dyn Future<Output = Result<models::FooRefOrValue, Error>> + Send>>;
fn get_all_foos(&self, ) -> Pin<Box<dyn Future<Output = Result<Vec<models::FooRefOrValue>, Error>>>>; fn get_all_foos(&self, ) -> Pin<Box<dyn Future<Output = Result<Vec<models::FooRefOrValue>, Error>> + Send>>;
} }
impl<C: Connect>FooApi for FooApiClient<C> impl<C: Connect>FooApi for FooApiClient<C>
where C: Clone + std::marker::Send + Sync { where C: Clone + std::marker::Send + Sync {
#[allow(unused_mut)] #[allow(unused_mut)]
fn create_foo(&self, foo: Option<models::Foo>) -> Pin<Box<dyn Future<Output = Result<models::FooRefOrValue, Error>>>> { fn create_foo(&self, foo: Option<models::Foo>) -> Pin<Box<dyn Future<Output = Result<models::FooRefOrValue, Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::POST, "/foo".to_string()) let mut req = __internal_request::Request::new(hyper::Method::POST, "/foo".to_string())
; ;
req = req.with_body_param(foo); req = req.with_body_param(foo);
@ -53,7 +53,7 @@ impl<C: Connect>FooApi for FooApiClient<C>
} }
#[allow(unused_mut)] #[allow(unused_mut)]
fn get_all_foos(&self, ) -> Pin<Box<dyn Future<Output = Result<Vec<models::FooRefOrValue>, Error>>>> { fn get_all_foos(&self, ) -> Pin<Box<dyn Future<Output = Result<Vec<models::FooRefOrValue>, Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/foo".to_string()) let mut req = __internal_request::Request::new(hyper::Method::GET, "/foo".to_string())
; ;

View File

@ -109,7 +109,7 @@ impl Request {
pub fn execute<'a, C, U>( pub fn execute<'a, C, U>(
self, self,
conf: &configuration::Configuration<C>, conf: &configuration::Configuration<C>,
) -> Pin<Box<dyn Future<Output=Result<U, Error>> + 'a>> ) -> Pin<Box<dyn Future<Output=Result<U, Error>> + 'a + Send>>
where where
C: Connect + Clone + std::marker::Send + Sync, C: Connect + Clone + std::marker::Send + Sync,
U: Sized + std::marker::Send + 'a, U: Sized + std::marker::Send + 'a,

View File

@ -1,4 +1,4 @@
use std::rc::Rc; use std::sync::Arc;
use hyper; use hyper;
use hyper_util::client::legacy::connect::Connect; use hyper_util::client::legacy::connect::Connect;
@ -15,7 +15,7 @@ pub struct APIClient {
impl APIClient { impl APIClient {
pub fn new<C: Connect>(configuration: Configuration<C>) -> APIClient pub fn new<C: Connect>(configuration: Configuration<C>) -> APIClient
where C: Clone + std::marker::Send + Sync + 'static { where C: Clone + std::marker::Send + Sync + 'static {
let rc = Rc::new(configuration); let rc = Arc::new(configuration);
APIClient { APIClient {
fake_api: Box::new(crate::apis::FakeApiClient::new(rc.clone())), fake_api: Box::new(crate::apis::FakeApiClient::new(rc.clone())),

View File

@ -42,10 +42,11 @@ impl Configuration<HttpConnector> {
/// # Example /// # Example
/// ///
/// ``` /// ```
/// let api_config = { /// # use petstore_hyper::apis::configuration::Configuration;
/// api_key: "my-api-key", /// let api_config = Configuration {
/// ...Configuration::new() /// basic_auth: Some(("user".into(), None)),
/// } /// ..Configuration::new()
/// };
/// ``` /// ```
pub fn new() -> Configuration<HttpConnector> { pub fn new() -> Configuration<HttpConnector> {
Configuration::default() Configuration::default()
@ -60,6 +61,11 @@ impl<C: Connect> Configuration<C>
/// # Example /// # Example
/// ///
/// ``` /// ```
/// # use core::time::Duration;
/// # use petstore_hyper::apis::configuration::Configuration;
/// use hyper_util::client::legacy::Client;
/// use hyper_util::rt::TokioExecutor;
///
/// let client = Client::builder(TokioExecutor::new()) /// let client = Client::builder(TokioExecutor::new())
/// .pool_idle_timeout(Duration::from_secs(30)) /// .pool_idle_timeout(Duration::from_secs(30))
/// .build_http(); /// .build_http();

View File

@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
use std::rc::Rc; use std::sync::Arc;
use std::borrow::Borrow; use std::borrow::Borrow;
use std::pin::Pin; use std::pin::Pin;
#[allow(unused_imports)] #[allow(unused_imports)]
@ -24,26 +24,26 @@ use super::request as __internal_request;
pub struct FakeApiClient<C: Connect> pub struct FakeApiClient<C: Connect>
where C: Clone + std::marker::Send + Sync + 'static { where C: Clone + std::marker::Send + Sync + 'static {
configuration: Rc<configuration::Configuration<C>>, configuration: Arc<configuration::Configuration<C>>,
} }
impl<C: Connect> FakeApiClient<C> impl<C: Connect> FakeApiClient<C>
where C: Clone + std::marker::Send + Sync { where C: Clone + std::marker::Send + Sync {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> FakeApiClient<C> { pub fn new(configuration: Arc<configuration::Configuration<C>>) -> FakeApiClient<C> {
FakeApiClient { FakeApiClient {
configuration, configuration,
} }
} }
} }
pub trait FakeApi { pub trait FakeApi: Send + Sync {
fn test_nullable_required_param(&self, username: &str, dummy_required_nullable_param: Option<&str>, uppercase: Option<&str>) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>; fn test_nullable_required_param(&self, username: &str, dummy_required_nullable_param: Option<&str>, uppercase: Option<&str>) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
} }
impl<C: Connect>FakeApi for FakeApiClient<C> impl<C: Connect>FakeApi for FakeApiClient<C>
where C: Clone + std::marker::Send + Sync { where C: Clone + std::marker::Send + Sync {
#[allow(unused_mut)] #[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>>>> { fn test_nullable_required_param(&self, username: &str, dummy_required_nullable_param: Option<&str>, uppercase: Option<&str>) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/fake/user/{username}".to_string()) 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()); req = req.with_path_param("username".to_string(), username.to_string());

View File

@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
use std::rc::Rc; use std::sync::Arc;
use std::borrow::Borrow; use std::borrow::Borrow;
use std::pin::Pin; use std::pin::Pin;
#[allow(unused_imports)] #[allow(unused_imports)]
@ -24,33 +24,33 @@ use super::request as __internal_request;
pub struct PetApiClient<C: Connect> pub struct PetApiClient<C: Connect>
where C: Clone + std::marker::Send + Sync + 'static { where C: Clone + std::marker::Send + Sync + 'static {
configuration: Rc<configuration::Configuration<C>>, configuration: Arc<configuration::Configuration<C>>,
} }
impl<C: Connect> PetApiClient<C> impl<C: Connect> PetApiClient<C>
where C: Clone + std::marker::Send + Sync { where C: Clone + std::marker::Send + Sync {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> PetApiClient<C> { pub fn new(configuration: Arc<configuration::Configuration<C>>) -> PetApiClient<C> {
PetApiClient { PetApiClient {
configuration, configuration,
} }
} }
} }
pub trait PetApi { pub trait PetApi: Send + Sync {
fn add_pet(&self, pet: models::Pet) -> Pin<Box<dyn Future<Output = Result<models::Pet, Error>>>>; fn add_pet(&self, pet: models::Pet) -> Pin<Box<dyn Future<Output = Result<models::Pet, Error>> + Send>>;
fn delete_pet(&self, pet_id: i64, api_key: Option<&str>) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>; fn delete_pet(&self, pet_id: i64, api_key: Option<&str>) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
fn find_pets_by_status(&self, status: Vec<String>) -> Pin<Box<dyn Future<Output = Result<Vec<models::Pet>, Error>>>>; fn find_pets_by_status(&self, status: Vec<String>) -> Pin<Box<dyn Future<Output = Result<Vec<models::Pet>, Error>> + Send>>;
fn find_pets_by_tags(&self, tags: 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>> + Send>>;
fn get_pet_by_id(&self, pet_id: i64) -> Pin<Box<dyn Future<Output = Result<models::Pet, Error>>>>; fn get_pet_by_id(&self, pet_id: i64) -> Pin<Box<dyn Future<Output = Result<models::Pet, Error>> + Send>>;
fn update_pet(&self, pet: models::Pet) -> 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>> + Send>>;
fn update_pet_with_form(&self, pet_id: i64, name: Option<&str>, status: Option<&str>) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>; fn update_pet_with_form(&self, pet_id: i64, name: Option<&str>, status: Option<&str>) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
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>>>>; 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>> + Send>>;
} }
impl<C: Connect>PetApi for PetApiClient<C> impl<C: Connect>PetApi for PetApiClient<C>
where C: Clone + std::marker::Send + Sync { where C: Clone + std::marker::Send + Sync {
#[allow(unused_mut)] #[allow(unused_mut)]
fn add_pet(&self, pet: models::Pet) -> Pin<Box<dyn Future<Output = Result<models::Pet, Error>>>> { fn add_pet(&self, pet: models::Pet) -> Pin<Box<dyn Future<Output = Result<models::Pet, Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::POST, "/pet".to_string()) let mut req = __internal_request::Request::new(hyper::Method::POST, "/pet".to_string())
.with_auth(__internal_request::Auth::Oauth) .with_auth(__internal_request::Auth::Oauth)
; ;
@ -60,7 +60,7 @@ impl<C: Connect>PetApi for PetApiClient<C>
} }
#[allow(unused_mut)] #[allow(unused_mut)]
fn delete_pet(&self, pet_id: i64, api_key: Option<&str>) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> { fn delete_pet(&self, pet_id: i64, api_key: Option<&str>) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::DELETE, "/pet/{petId}".to_string()) let mut req = __internal_request::Request::new(hyper::Method::DELETE, "/pet/{petId}".to_string())
.with_auth(__internal_request::Auth::Oauth) .with_auth(__internal_request::Auth::Oauth)
; ;
@ -74,7 +74,7 @@ impl<C: Connect>PetApi for PetApiClient<C>
} }
#[allow(unused_mut)] #[allow(unused_mut)]
fn find_pets_by_status(&self, status: Vec<String>) -> Pin<Box<dyn Future<Output = Result<Vec<models::Pet>, Error>>>> { fn find_pets_by_status(&self, status: Vec<String>) -> Pin<Box<dyn Future<Output = Result<Vec<models::Pet>, Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/pet/findByStatus".to_string()) let mut req = __internal_request::Request::new(hyper::Method::GET, "/pet/findByStatus".to_string())
.with_auth(__internal_request::Auth::Oauth) .with_auth(__internal_request::Auth::Oauth)
; ;
@ -84,7 +84,7 @@ impl<C: Connect>PetApi for PetApiClient<C>
} }
#[allow(unused_mut)] #[allow(unused_mut)]
fn find_pets_by_tags(&self, tags: 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>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/pet/findByTags".to_string()) let mut req = __internal_request::Request::new(hyper::Method::GET, "/pet/findByTags".to_string())
.with_auth(__internal_request::Auth::Oauth) .with_auth(__internal_request::Auth::Oauth)
; ;
@ -94,7 +94,7 @@ impl<C: Connect>PetApi for PetApiClient<C>
} }
#[allow(unused_mut)] #[allow(unused_mut)]
fn get_pet_by_id(&self, pet_id: i64) -> Pin<Box<dyn Future<Output = Result<models::Pet, Error>>>> { fn get_pet_by_id(&self, pet_id: i64) -> Pin<Box<dyn Future<Output = Result<models::Pet, Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/pet/{petId}".to_string()) let mut req = __internal_request::Request::new(hyper::Method::GET, "/pet/{petId}".to_string())
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{ .with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
in_header: true, in_header: true,
@ -108,7 +108,7 @@ impl<C: Connect>PetApi for PetApiClient<C>
} }
#[allow(unused_mut)] #[allow(unused_mut)]
fn update_pet(&self, pet: models::Pet) -> 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>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::PUT, "/pet".to_string()) let mut req = __internal_request::Request::new(hyper::Method::PUT, "/pet".to_string())
.with_auth(__internal_request::Auth::Oauth) .with_auth(__internal_request::Auth::Oauth)
; ;
@ -118,7 +118,7 @@ impl<C: Connect>PetApi for PetApiClient<C>
} }
#[allow(unused_mut)] #[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>>>> { fn update_pet_with_form(&self, pet_id: i64, name: Option<&str>, status: Option<&str>) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::POST, "/pet/{petId}".to_string()) let mut req = __internal_request::Request::new(hyper::Method::POST, "/pet/{petId}".to_string())
.with_auth(__internal_request::Auth::Oauth) .with_auth(__internal_request::Auth::Oauth)
; ;
@ -135,7 +135,7 @@ impl<C: Connect>PetApi for PetApiClient<C>
} }
#[allow(unused_mut)] #[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>>>> { 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>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::POST, "/pet/{petId}/uploadImage".to_string()) let mut req = __internal_request::Request::new(hyper::Method::POST, "/pet/{petId}/uploadImage".to_string())
.with_auth(__internal_request::Auth::Oauth) .with_auth(__internal_request::Auth::Oauth)
; ;

View File

@ -109,7 +109,7 @@ impl Request {
pub fn execute<'a, C, U>( pub fn execute<'a, C, U>(
self, self,
conf: &configuration::Configuration<C>, conf: &configuration::Configuration<C>,
) -> Pin<Box<dyn Future<Output=Result<U, Error>> + 'a>> ) -> Pin<Box<dyn Future<Output=Result<U, Error>> + 'a + Send>>
where where
C: Connect + Clone + std::marker::Send + Sync, C: Connect + Clone + std::marker::Send + Sync,
U: Sized + std::marker::Send + 'a, U: Sized + std::marker::Send + 'a,

View File

@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
use std::rc::Rc; use std::sync::Arc;
use std::borrow::Borrow; use std::borrow::Borrow;
use std::pin::Pin; use std::pin::Pin;
#[allow(unused_imports)] #[allow(unused_imports)]
@ -24,29 +24,29 @@ use super::request as __internal_request;
pub struct StoreApiClient<C: Connect> pub struct StoreApiClient<C: Connect>
where C: Clone + std::marker::Send + Sync + 'static { where C: Clone + std::marker::Send + Sync + 'static {
configuration: Rc<configuration::Configuration<C>>, configuration: Arc<configuration::Configuration<C>>,
} }
impl<C: Connect> StoreApiClient<C> impl<C: Connect> StoreApiClient<C>
where C: Clone + std::marker::Send + Sync { where C: Clone + std::marker::Send + Sync {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> StoreApiClient<C> { pub fn new(configuration: Arc<configuration::Configuration<C>>) -> StoreApiClient<C> {
StoreApiClient { StoreApiClient {
configuration, configuration,
} }
} }
} }
pub trait StoreApi { pub trait StoreApi: Send + Sync {
fn delete_order(&self, order_id: &str) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>; fn delete_order(&self, order_id: &str) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
fn get_inventory(&self, ) -> Pin<Box<dyn Future<Output = Result<std::collections::HashMap<String, i32>, Error>>>>; fn get_inventory(&self, ) -> Pin<Box<dyn Future<Output = Result<std::collections::HashMap<String, i32>, Error>> + Send>>;
fn get_order_by_id(&self, order_id: i64) -> Pin<Box<dyn Future<Output = Result<models::Order, Error>>>>; fn get_order_by_id(&self, order_id: i64) -> Pin<Box<dyn Future<Output = Result<models::Order, Error>> + Send>>;
fn place_order(&self, order: models::Order) -> 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>> + Send>>;
} }
impl<C: Connect>StoreApi for StoreApiClient<C> impl<C: Connect>StoreApi for StoreApiClient<C>
where C: Clone + std::marker::Send + Sync { where C: Clone + std::marker::Send + Sync {
#[allow(unused_mut)] #[allow(unused_mut)]
fn delete_order(&self, order_id: &str) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> { fn delete_order(&self, order_id: &str) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::DELETE, "/store/order/{orderId}".to_string()) 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.with_path_param("orderId".to_string(), order_id.to_string());
@ -56,7 +56,7 @@ impl<C: Connect>StoreApi for StoreApiClient<C>
} }
#[allow(unused_mut)] #[allow(unused_mut)]
fn get_inventory(&self, ) -> Pin<Box<dyn Future<Output = Result<std::collections::HashMap<String, i32>, Error>>>> { fn get_inventory(&self, ) -> Pin<Box<dyn Future<Output = Result<std::collections::HashMap<String, i32>, Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/store/inventory".to_string()) let mut req = __internal_request::Request::new(hyper::Method::GET, "/store/inventory".to_string())
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{ .with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
in_header: true, in_header: true,
@ -69,7 +69,7 @@ impl<C: Connect>StoreApi for StoreApiClient<C>
} }
#[allow(unused_mut)] #[allow(unused_mut)]
fn get_order_by_id(&self, order_id: i64) -> Pin<Box<dyn Future<Output = Result<models::Order, Error>>>> { fn get_order_by_id(&self, order_id: i64) -> Pin<Box<dyn Future<Output = Result<models::Order, Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/store/order/{orderId}".to_string()) 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 = req.with_path_param("orderId".to_string(), order_id.to_string());
@ -78,7 +78,7 @@ impl<C: Connect>StoreApi for StoreApiClient<C>
} }
#[allow(unused_mut)] #[allow(unused_mut)]
fn place_order(&self, order: models::Order) -> 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>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::POST, "/store/order".to_string()) let mut req = __internal_request::Request::new(hyper::Method::POST, "/store/order".to_string())
; ;
req = req.with_body_param(order); req = req.with_body_param(order);

View File

@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
use std::rc::Rc; use std::sync::Arc;
use std::borrow::Borrow; use std::borrow::Borrow;
use std::pin::Pin; use std::pin::Pin;
#[allow(unused_imports)] #[allow(unused_imports)]
@ -24,27 +24,27 @@ use super::request as __internal_request;
pub struct TestingApiClient<C: Connect> pub struct TestingApiClient<C: Connect>
where C: Clone + std::marker::Send + Sync + 'static { where C: Clone + std::marker::Send + Sync + 'static {
configuration: Rc<configuration::Configuration<C>>, configuration: Arc<configuration::Configuration<C>>,
} }
impl<C: Connect> TestingApiClient<C> impl<C: Connect> TestingApiClient<C>
where C: Clone + std::marker::Send + Sync { where C: Clone + std::marker::Send + Sync {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> TestingApiClient<C> { pub fn new(configuration: Arc<configuration::Configuration<C>>) -> TestingApiClient<C> {
TestingApiClient { TestingApiClient {
configuration, configuration,
} }
} }
} }
pub trait TestingApi { pub trait TestingApi: Send + Sync {
fn tests_file_response_get(&self, ) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>>>>; fn tests_file_response_get(&self, ) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>> + Send>>;
fn tests_type_testing_get(&self, ) -> Pin<Box<dyn Future<Output = Result<models::TypeTesting, Error>>>>; fn tests_type_testing_get(&self, ) -> Pin<Box<dyn Future<Output = Result<models::TypeTesting, Error>> + Send>>;
} }
impl<C: Connect>TestingApi for TestingApiClient<C> impl<C: Connect>TestingApi for TestingApiClient<C>
where C: Clone + std::marker::Send + Sync { where C: Clone + std::marker::Send + Sync {
#[allow(unused_mut)] #[allow(unused_mut)]
fn tests_file_response_get(&self, ) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>>>> { fn tests_file_response_get(&self, ) -> Pin<Box<dyn Future<Output = Result<std::path::PathBuf, Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/tests/fileResponse".to_string()) let mut req = __internal_request::Request::new(hyper::Method::GET, "/tests/fileResponse".to_string())
; ;
@ -52,7 +52,7 @@ impl<C: Connect>TestingApi for TestingApiClient<C>
} }
#[allow(unused_mut)] #[allow(unused_mut)]
fn tests_type_testing_get(&self, ) -> Pin<Box<dyn Future<Output = Result<models::TypeTesting, Error>>>> { fn tests_type_testing_get(&self, ) -> Pin<Box<dyn Future<Output = Result<models::TypeTesting, Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/tests/typeTesting".to_string()) let mut req = __internal_request::Request::new(hyper::Method::GET, "/tests/typeTesting".to_string())
; ;

View File

@ -8,7 +8,7 @@
* Generated by: https://openapi-generator.tech * Generated by: https://openapi-generator.tech
*/ */
use std::rc::Rc; use std::sync::Arc;
use std::borrow::Borrow; use std::borrow::Borrow;
use std::pin::Pin; use std::pin::Pin;
#[allow(unused_imports)] #[allow(unused_imports)]
@ -24,33 +24,33 @@ use super::request as __internal_request;
pub struct UserApiClient<C: Connect> pub struct UserApiClient<C: Connect>
where C: Clone + std::marker::Send + Sync + 'static { where C: Clone + std::marker::Send + Sync + 'static {
configuration: Rc<configuration::Configuration<C>>, configuration: Arc<configuration::Configuration<C>>,
} }
impl<C: Connect> UserApiClient<C> impl<C: Connect> UserApiClient<C>
where C: Clone + std::marker::Send + Sync { where C: Clone + std::marker::Send + Sync {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> UserApiClient<C> { pub fn new(configuration: Arc<configuration::Configuration<C>>) -> UserApiClient<C> {
UserApiClient { UserApiClient {
configuration, configuration,
} }
} }
} }
pub trait UserApi { pub trait UserApi: Send + Sync {
fn create_user(&self, user: models::User) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>; fn create_user(&self, user: models::User) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
fn create_users_with_array_input(&self, user: Vec<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>> + Send>>;
fn create_users_with_list_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>> + Send>>;
fn delete_user(&self, username: &str) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>; fn delete_user(&self, username: &str) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
fn get_user_by_name(&self, username: &str) -> Pin<Box<dyn Future<Output = Result<models::User, Error>>>>; fn get_user_by_name(&self, username: &str) -> Pin<Box<dyn Future<Output = Result<models::User, Error>> + Send>>;
fn login_user(&self, username: &str, password: &str) -> Pin<Box<dyn Future<Output = Result<String, Error>>>>; fn login_user(&self, username: &str, password: &str) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send>>;
fn logout_user(&self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>; fn logout_user(&self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
fn update_user(&self, username: &str, user: models::User) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>; fn update_user(&self, username: &str, user: models::User) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>;
} }
impl<C: Connect>UserApi for UserApiClient<C> impl<C: Connect>UserApi for UserApiClient<C>
where C: Clone + std::marker::Send + Sync { where C: Clone + std::marker::Send + Sync {
#[allow(unused_mut)] #[allow(unused_mut)]
fn create_user(&self, user: models::User) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> { fn create_user(&self, user: models::User) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::POST, "/user".to_string()) let mut req = __internal_request::Request::new(hyper::Method::POST, "/user".to_string())
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{ .with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
in_header: true, in_header: true,
@ -65,7 +65,7 @@ impl<C: Connect>UserApi for UserApiClient<C>
} }
#[allow(unused_mut)] #[allow(unused_mut)]
fn create_users_with_array_input(&self, user: Vec<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>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::POST, "/user/createWithArray".to_string()) let mut req = __internal_request::Request::new(hyper::Method::POST, "/user/createWithArray".to_string())
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{ .with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
in_header: true, in_header: true,
@ -80,7 +80,7 @@ impl<C: Connect>UserApi for UserApiClient<C>
} }
#[allow(unused_mut)] #[allow(unused_mut)]
fn create_users_with_list_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>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::POST, "/user/createWithList".to_string()) let mut req = __internal_request::Request::new(hyper::Method::POST, "/user/createWithList".to_string())
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{ .with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
in_header: true, in_header: true,
@ -95,7 +95,7 @@ impl<C: Connect>UserApi for UserApiClient<C>
} }
#[allow(unused_mut)] #[allow(unused_mut)]
fn delete_user(&self, username: &str) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> { fn delete_user(&self, username: &str) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::DELETE, "/user/{username}".to_string()) let mut req = __internal_request::Request::new(hyper::Method::DELETE, "/user/{username}".to_string())
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{ .with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
in_header: true, in_header: true,
@ -110,7 +110,7 @@ impl<C: Connect>UserApi for UserApiClient<C>
} }
#[allow(unused_mut)] #[allow(unused_mut)]
fn get_user_by_name(&self, username: &str) -> Pin<Box<dyn Future<Output = Result<models::User, Error>>>> { fn get_user_by_name(&self, username: &str) -> Pin<Box<dyn Future<Output = Result<models::User, Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/user/{username}".to_string()) 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 = req.with_path_param("username".to_string(), username.to_string());
@ -119,7 +119,7 @@ impl<C: Connect>UserApi for UserApiClient<C>
} }
#[allow(unused_mut)] #[allow(unused_mut)]
fn login_user(&self, username: &str, password: &str) -> Pin<Box<dyn Future<Output = Result<String, Error>>>> { fn login_user(&self, username: &str, password: &str) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/user/login".to_string()) 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("username".to_string(), username.to_string());
@ -129,7 +129,7 @@ impl<C: Connect>UserApi for UserApiClient<C>
} }
#[allow(unused_mut)] #[allow(unused_mut)]
fn logout_user(&self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> { fn logout_user(&self, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/user/logout".to_string()) let mut req = __internal_request::Request::new(hyper::Method::GET, "/user/logout".to_string())
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{ .with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
in_header: true, in_header: true,
@ -143,7 +143,7 @@ impl<C: Connect>UserApi for UserApiClient<C>
} }
#[allow(unused_mut)] #[allow(unused_mut)]
fn update_user(&self, username: &str, user: models::User) -> Pin<Box<dyn Future<Output = Result<(), Error>>>> { fn update_user(&self, username: &str, user: models::User) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>> {
let mut req = __internal_request::Request::new(hyper::Method::PUT, "/user/{username}".to_string()) let mut req = __internal_request::Request::new(hyper::Method::PUT, "/user/{username}".to_string())
.with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{ .with_auth(__internal_request::Auth::ApiKey(__internal_request::ApiKey{
in_header: true, in_header: true,

View File

@ -0,0 +1,17 @@
#[cfg(test)]
mod tests {
use petstore_hyper::apis::client::APIClient;
use petstore_hyper::apis::configuration::Configuration;
use std::thread;
#[test]
fn test_client_is_send_for_threads() {
let client = APIClient::new(Configuration::new());
let handle = thread::spawn(move || {
let _ = client.fake_api().test_nullable_required_param("username", None, None);
});
handle.join().expect("Thread panicked!");
}
}