{{>partial_header}} use std::rc::Rc; use std::borrow::Borrow; #[allow(unused_imports)] use std::option::Option; use hyper; use serde_json; use futures::Future; use super::{Error, configuration}; use super::request as __internal_request; pub struct {{{classname}}}Client { configuration: Rc>, } impl {{{classname}}}Client { pub fn new(configuration: Rc>) -> {{{classname}}}Client { {{{classname}}}Client { configuration, } } } pub trait {{{classname}}} { {{#operations}} {{#operation}} fn {{{operationId}}}(&self, {{#allParams}}{{{paramName}}}: {{^required}}Option<{{/required}}{{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{#isString}}&str{{/isString}}{{#isUuid}}&str{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}crate::models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) -> Box>>; {{/operation}} {{/operations}} } impl{{{classname}}} for {{{classname}}}Client { {{#operations}} {{#operation}} fn {{{operationId}}}(&self, {{#allParams}}{{{paramName}}}: {{^required}}Option<{{/required}}{{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{#isString}}&str{{/isString}}{{#isUuid}}&str{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}crate::models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) -> Box>> { let mut req = __internal_request::Request::new(hyper::Method::{{{httpMethod}}}, "{{{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}} {{#isBasic}} .with_auth(__internal_request::Auth::Basic) {{/isBasic}} {{#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}}} { req = req.with_query_param("{{{baseName}}}".to_string(), s{{#isArray}}.join(","){{/isArray}}.to_string()); } {{/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}} }