forked from loafle/openapi-generator-original
Rust reqwest improve (#1890)
* Resolves #525 for Rust client generator with reqwest library. * Use Reqwest "query" method to generate query URL. * urlencode URL string parameters. * Generate rust-reqwest client, and verify it compiles and work as intended. * Map file params (to "&std::path::Path") and support multipart operations (with file params) in Reqwest library. * Cleanup: template compression to remove unecessary blank lines in generated code.
This commit is contained in:
parent
16f52cf2ad
commit
888068d122
@ -119,8 +119,11 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
typeMapping.put("date", "string");
|
||||
typeMapping.put("DateTime", "String");
|
||||
typeMapping.put("password", "String");
|
||||
// TODO(farcaller): map file
|
||||
typeMapping.put("file", "::models::File");
|
||||
// TODO(bcourtine): review file mapping.
|
||||
// I tried to map as "std::io::File", but Reqwest multipart file requires a "AsRef<Path>" param.
|
||||
// Getting a file from a Path is simple, but the opposite is difficult. So I map as "std::path::Path".
|
||||
// Reference is required here because Path does not implement the "Sized" trait.
|
||||
typeMapping.put("file", "&std::path::Path");
|
||||
typeMapping.put("binary", "::models::File");
|
||||
typeMapping.put("ByteArray", "String");
|
||||
typeMapping.put("object", "Value");
|
||||
@ -379,7 +382,6 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
Map<String, Object> objectMap = (Map<String, Object>) objs.get("operations");
|
||||
@SuppressWarnings("unchecked")
|
||||
List<CodegenOperation> operations = (List<CodegenOperation>) objectMap.get("operation");
|
||||
Set<String> headerKeys = new HashSet<>();
|
||||
for (CodegenOperation operation : operations) {
|
||||
// http method verb conversion, depending on client library (e.g. Hyper: PUT => Put, Reqwest: PUT => put)
|
||||
if (HYPER_LIBRARY.equals(getLibrary())) {
|
||||
@ -439,9 +441,6 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
}*/
|
||||
}
|
||||
|
||||
additionalProperties.put("headerKeys", headerKeys);
|
||||
additionalProperties.putIfAbsent("authHeaderKey", "api-key");
|
||||
|
||||
return objs;
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ use std::borrow::Borrow;
|
||||
|
||||
use reqwest;
|
||||
|
||||
use super::{Error, configuration};
|
||||
use super::{Error, configuration, urlencode};
|
||||
|
||||
pub struct {{{classname}}}Client {
|
||||
configuration: Rc<configuration::Configuration>,
|
||||
@ -26,7 +26,6 @@ pub trait {{{classname}}} {
|
||||
{{/operations}}
|
||||
}
|
||||
|
||||
|
||||
impl {{{classname}}} for {{{classname}}}Client {
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
@ -34,39 +33,29 @@ impl {{{classname}}} for {{{classname}}}Client {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
let query_string = {
|
||||
let mut query = ::url::form_urlencoded::Serializer::new(String::new());
|
||||
{{#queryParams}}
|
||||
query.append_pair("{{{baseName}}}", &{{{paramName}}}{{#isListContainer}}.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(","){{/isListContainer}}.to_string());
|
||||
{{/queryParams}}
|
||||
{{#hasAuthMethods}}{{#authMethods}}{{#isApiKey}}{{#isKeyInQuery}}
|
||||
if let Some(ref apikey) = configuration.api_key {
|
||||
let key = apikey.key.clone();
|
||||
let val = match apikey.prefix {
|
||||
Some(ref prefix) => format!("{} {}", prefix, key),
|
||||
None => key,
|
||||
};
|
||||
query.append_pair("{{{keyParamName}}}".to_owned(), val);
|
||||
}
|
||||
{{/isKeyInQuery}}{{/isApiKey}}{{/authMethods}}{{/hasAuthMethods}}
|
||||
query.finish()
|
||||
};
|
||||
let uri_str = format!("{}{{{path}}}?{}", configuration.base_path, query_string{{#pathParams}}, {{{baseName}}}={{{paramName}}}{{#isListContainer}}.join(",").as_ref(){{/isListContainer}}{{/pathParams}});
|
||||
|
||||
let uri_str = format!("{}{{{path}}}", configuration.base_path{{#pathParams}}, {{{baseName}}}={{#isString}}urlencode({{/isString}}{{{paramName}}}{{#isListContainer}}.join(",").as_ref(){{/isListContainer}}{{#isString}}){{/isString}}{{/pathParams}});
|
||||
let mut req_builder = client.{{{httpMethod}}}(uri_str.as_str());
|
||||
|
||||
{{#queryParams}}
|
||||
req_builder = req_builder.query(&[("{{{baseName}}}", &{{{paramName}}}{{#isListContainer}}.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(","){{/isListContainer}}.to_string())]);
|
||||
{{/queryParams}}
|
||||
{{#hasAuthMethods}}{{#authMethods}}{{#isApiKey}}{{#isKeyInQuery}}
|
||||
if let Some(ref apikey) = configuration.api_key {
|
||||
let key = apikey.key.clone();
|
||||
let val = match apikey.prefix {
|
||||
Some(ref prefix) => format!("{} {}", prefix, key),
|
||||
None => key,
|
||||
};
|
||||
req_builder = req_builder.query(&[("{{{keyParamName}}}", val)]);
|
||||
}
|
||||
{{/isKeyInQuery}}{{/isApiKey}}{{/authMethods}}{{/hasAuthMethods}}
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
|
||||
{{#hasHeaderParams}}
|
||||
{{#headerParams}}
|
||||
{{#hasHeaderParams}}{{#headerParams}}
|
||||
req_builder = req_builder.header("{{{baseName}}}", {{{paramName}}}{{#isListContainer}}.join(","){{/isListContainer}}.to_string());
|
||||
{{/headerParams}}
|
||||
{{/hasHeaderParams}}
|
||||
|
||||
{{#hasAuthMethods}}
|
||||
{{#authMethods}}
|
||||
{{/headerParams}}{{/hasHeaderParams}}
|
||||
{{#hasAuthMethods}}{{#authMethods}}
|
||||
{{#isApiKey}}{{#isKeyInHeader}}
|
||||
if let Some(ref apikey) = configuration.api_key {
|
||||
let key = apikey.key.clone();
|
||||
@ -87,14 +76,34 @@ impl {{{classname}}} for {{{classname}}}Client {
|
||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||
};
|
||||
{{/isOAuth}}
|
||||
{{/authMethods}}
|
||||
{{/hasAuthMethods}}
|
||||
|
||||
{{#hasBodyParam}}
|
||||
{{#bodyParams}}
|
||||
{{/authMethods}}{{/hasAuthMethods}}
|
||||
{{#isMultipart}}{{#hasFormParams}}
|
||||
let form = reqwest::multipart::Form::new()
|
||||
{{#formParams}}
|
||||
{{#isFile}}
|
||||
.file("{{{baseName}}}", {{{paramName}}})?{{#-last}};{{/-last}}
|
||||
{{/isFile}}
|
||||
{{^isFile}}
|
||||
.text("{{{baseName}}}", {{{paramName}}}{{#isListContainer}}.join(","){{/isListContainer}}.to_string()){{#-last}};{{/-last}}
|
||||
{{/isFile}}
|
||||
{{/formParams}}
|
||||
req_builder = req_builder.multipart(form);
|
||||
{{/hasFormParams}}{{/isMultipart}}
|
||||
{{^isMultipart}}{{#hasFormParams}}
|
||||
let mut form_params = std::collections::HashMap::new();
|
||||
{{#formParams}}
|
||||
{{#isFile}}
|
||||
form_params.insert("{{{baseName}}}", unimplemented!("File form param not supported with x-www-form-urlencoded content"));
|
||||
{{/isFile}}
|
||||
{{^isFile}}
|
||||
form_params.insert("{{{baseName}}}", {{{paramName}}}{{#isListContainer}}.join(","){{/isListContainer}}.to_string());
|
||||
{{/isFile}}
|
||||
{{/formParams}}
|
||||
req_builder = req_builder.form(&form_params);
|
||||
{{/hasFormParams}}{{/isMultipart}}
|
||||
{{#hasBodyParam}}{{#bodyParams}}
|
||||
req_builder = req_builder.json(&{{{paramName}}});
|
||||
{{/bodyParams}}
|
||||
{{/hasBodyParam}}
|
||||
{{/bodyParams}}{{/hasBodyParam}}
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
|
@ -5,6 +5,7 @@ use serde_json;
|
||||
pub enum Error {
|
||||
Reqwest(reqwest::Error),
|
||||
Serde(serde_json::Error),
|
||||
Io(std::io::Error),
|
||||
}
|
||||
|
||||
impl From<reqwest::Error> for Error {
|
||||
@ -19,6 +20,16 @@ impl From<serde_json::Error> for Error {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<std::io::Error> for Error {
|
||||
fn from(e: std::io::Error) -> Self {
|
||||
return Error::Io(e)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn urlencode<T: AsRef<str>>(s: T) -> String {
|
||||
::url::form_urlencoded::byte_serialize(s.as_ref().as_bytes()).collect()
|
||||
}
|
||||
|
||||
use super::models::*;
|
||||
|
||||
{{#apiInfo}}
|
||||
|
@ -1 +1 @@
|
||||
3.3.4-SNAPSHOT
|
||||
4.0.0-SNAPSHOT
|
@ -15,7 +15,7 @@ Method | HTTP request | Description
|
||||
|
||||
|
||||
# **add_pet**
|
||||
> add_pet(ctx, pet)
|
||||
> add_pet(ctx, body)
|
||||
Add a new pet to the store
|
||||
|
||||
### Required Parameters
|
||||
@ -23,7 +23,7 @@ Add a new pet to the store
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context containing the authentication | nil if no authentication
|
||||
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -160,7 +160,7 @@ Name | Type | Description | Notes
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **update_pet**
|
||||
> update_pet(ctx, pet)
|
||||
> update_pet(ctx, body)
|
||||
Update an existing pet
|
||||
|
||||
### Required Parameters
|
||||
@ -168,7 +168,7 @@ Update an existing pet
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context containing the authentication | nil if no authentication
|
||||
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -240,7 +240,7 @@ Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet_id** | **i64**| ID of pet to update |
|
||||
**additional_metadata** | **String**| Additional data to pass to server |
|
||||
**file** | **::models::File**| file to upload |
|
||||
**file** | **&std::path::Path**| file to upload |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -89,14 +89,14 @@ No authorization required
|
||||
[[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)
|
||||
> ::models::Order place_order(body)
|
||||
Place an order for a pet
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**order** | [**Order**](Order.md)| order placed for purchasing the pet |
|
||||
**body** | [**Order**](Order.md)| order placed for purchasing the pet |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -15,7 +15,7 @@ Method | HTTP request | Description
|
||||
|
||||
|
||||
# **create_user**
|
||||
> create_user(user)
|
||||
> create_user(body)
|
||||
Create user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
@ -24,7 +24,7 @@ This can only be done by the logged in user.
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | [**User**](User.md)| Created user object |
|
||||
**body** | [**User**](User.md)| Created user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -42,14 +42,14 @@ No authorization required
|
||||
[[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)
|
||||
> create_users_with_array_input(body)
|
||||
Creates list of users with given input array
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | [**Vec<::models::User>**](array.md)| List of user object |
|
||||
**body** | [**Vec<::models::User>**](array.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -67,14 +67,14 @@ No authorization required
|
||||
[[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)
|
||||
> create_users_with_list_input(body)
|
||||
Creates list of users with given input array
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | [**Vec<::models::User>**](array.md)| List of user object |
|
||||
**body** | [**Vec<::models::User>**](array.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -192,7 +192,7 @@ No authorization required
|
||||
[[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)
|
||||
> update_user(username, body)
|
||||
Updated user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
@ -202,7 +202,7 @@ This can only be done by the logged in user.
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| name that need to be deleted |
|
||||
**user** | [**User**](User.md)| Updated user object |
|
||||
**body** | [**User**](User.md)| Updated user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -5,6 +5,7 @@ use serde_json;
|
||||
pub enum Error {
|
||||
Reqwest(reqwest::Error),
|
||||
Serde(serde_json::Error),
|
||||
Io(std::io::Error),
|
||||
}
|
||||
|
||||
impl From<reqwest::Error> for Error {
|
||||
@ -19,6 +20,16 @@ impl From<serde_json::Error> for Error {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<std::io::Error> for Error {
|
||||
fn from(e: std::io::Error) -> Self {
|
||||
return Error::Io(e)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn urlencode<T: AsRef<str>>(s: T) -> String {
|
||||
::url::form_urlencoded::byte_serialize(s.as_ref().as_bytes()).collect()
|
||||
}
|
||||
|
||||
use super::models::*;
|
||||
|
||||
mod pet_api;
|
||||
|
@ -13,7 +13,7 @@ use std::borrow::Borrow;
|
||||
|
||||
use reqwest;
|
||||
|
||||
use super::{Error, configuration};
|
||||
use super::{Error, configuration, urlencode};
|
||||
|
||||
pub struct PetApiClient {
|
||||
configuration: Rc<configuration::Configuration>,
|
||||
@ -28,42 +28,40 @@ impl PetApiClient {
|
||||
}
|
||||
|
||||
pub trait PetApi {
|
||||
fn add_pet(&self, pet: ::models::Pet) -> Result<(), Error>;
|
||||
fn add_pet(&self, body: ::models::Pet) -> Result<(), Error>;
|
||||
fn delete_pet(&self, pet_id: i64, api_key: &str) -> Result<(), Error>;
|
||||
fn find_pets_by_status(&self, status: Vec<String>) -> Result<Vec<::models::Pet>, Error>;
|
||||
fn find_pets_by_tags(&self, tags: Vec<String>) -> Result<Vec<::models::Pet>, Error>;
|
||||
fn get_pet_by_id(&self, pet_id: i64) -> Result<::models::Pet, Error>;
|
||||
fn update_pet(&self, pet: ::models::Pet) -> Result<(), Error>;
|
||||
fn update_pet(&self, body: ::models::Pet) -> Result<(), Error>;
|
||||
fn update_pet_with_form(&self, pet_id: i64, name: &str, status: &str) -> Result<(), Error>;
|
||||
fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: ::models::File) -> Result<::models::ApiResponse, Error>;
|
||||
fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: &std::path::Path) -> Result<::models::ApiResponse, Error>;
|
||||
}
|
||||
|
||||
|
||||
impl PetApi for PetApiClient {
|
||||
fn add_pet(&self, pet: ::models::Pet) -> Result<(), Error> {
|
||||
fn add_pet(&self, body: ::models::Pet) -> Result<(), Error> {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
let query_string = {
|
||||
let mut query = ::url::form_urlencoded::Serializer::new(String::new());
|
||||
|
||||
query.finish()
|
||||
};
|
||||
let uri_str = format!("{}/pet?{}", configuration.base_path, query_string);
|
||||
|
||||
let uri_str = format!("{}/pet", configuration.base_path);
|
||||
let mut req_builder = client.post(uri_str.as_str());
|
||||
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if let Some(ref token) = configuration.oauth_access_token {
|
||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||
};
|
||||
|
||||
req_builder = req_builder.json(&pet);
|
||||
|
||||
|
||||
|
||||
|
||||
req_builder = req_builder.json(&body);
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
@ -76,26 +74,25 @@ impl PetApi for PetApiClient {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
let query_string = {
|
||||
let mut query = ::url::form_urlencoded::Serializer::new(String::new());
|
||||
|
||||
query.finish()
|
||||
};
|
||||
let uri_str = format!("{}/pet/{petId}?{}", configuration.base_path, query_string, petId=pet_id);
|
||||
|
||||
let uri_str = format!("{}/pet/{petId}", configuration.base_path, petId=pet_id);
|
||||
let mut req_builder = client.delete(uri_str.as_str());
|
||||
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
|
||||
|
||||
req_builder = req_builder.header("api_key", api_key.to_string());
|
||||
|
||||
|
||||
|
||||
|
||||
if let Some(ref token) = configuration.oauth_access_token {
|
||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
@ -108,26 +105,24 @@ impl PetApi for PetApiClient {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
let query_string = {
|
||||
let mut query = ::url::form_urlencoded::Serializer::new(String::new());
|
||||
query.append_pair("status", &status.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string());
|
||||
|
||||
query.finish()
|
||||
};
|
||||
let uri_str = format!("{}/pet/findByStatus?{}", configuration.base_path, query_string);
|
||||
|
||||
let uri_str = format!("{}/pet/findByStatus", configuration.base_path);
|
||||
let mut req_builder = client.get(uri_str.as_str());
|
||||
|
||||
req_builder = req_builder.query(&[("status", &status.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]);
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if let Some(ref token) = configuration.oauth_access_token {
|
||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
@ -139,26 +134,24 @@ impl PetApi for PetApiClient {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
let query_string = {
|
||||
let mut query = ::url::form_urlencoded::Serializer::new(String::new());
|
||||
query.append_pair("tags", &tags.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string());
|
||||
|
||||
query.finish()
|
||||
};
|
||||
let uri_str = format!("{}/pet/findByTags?{}", configuration.base_path, query_string);
|
||||
|
||||
let uri_str = format!("{}/pet/findByTags", configuration.base_path);
|
||||
let mut req_builder = client.get(uri_str.as_str());
|
||||
|
||||
req_builder = req_builder.query(&[("tags", &tags.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]);
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if let Some(ref token) = configuration.oauth_access_token {
|
||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
@ -170,20 +163,15 @@ impl PetApi for PetApiClient {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
let query_string = {
|
||||
let mut query = ::url::form_urlencoded::Serializer::new(String::new());
|
||||
|
||||
query.finish()
|
||||
};
|
||||
let uri_str = format!("{}/pet/{petId}?{}", configuration.base_path, query_string, petId=pet_id);
|
||||
|
||||
let uri_str = format!("{}/pet/{petId}", configuration.base_path, petId=pet_id);
|
||||
let mut req_builder = client.get(uri_str.as_str());
|
||||
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if let Some(ref apikey) = configuration.api_key {
|
||||
let key = apikey.key.clone();
|
||||
@ -194,7 +182,10 @@ impl PetApi for PetApiClient {
|
||||
req_builder = req_builder.header("api_key", val);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
@ -202,30 +193,29 @@ impl PetApi for PetApiClient {
|
||||
Ok(client.execute(req)?.error_for_status()?.json()?)
|
||||
}
|
||||
|
||||
fn update_pet(&self, pet: ::models::Pet) -> Result<(), Error> {
|
||||
fn update_pet(&self, body: ::models::Pet) -> Result<(), Error> {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
let query_string = {
|
||||
let mut query = ::url::form_urlencoded::Serializer::new(String::new());
|
||||
|
||||
query.finish()
|
||||
};
|
||||
let uri_str = format!("{}/pet?{}", configuration.base_path, query_string);
|
||||
|
||||
let uri_str = format!("{}/pet", configuration.base_path);
|
||||
let mut req_builder = client.put(uri_str.as_str());
|
||||
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if let Some(ref token) = configuration.oauth_access_token {
|
||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||
};
|
||||
|
||||
req_builder = req_builder.json(&pet);
|
||||
|
||||
|
||||
|
||||
|
||||
req_builder = req_builder.json(&body);
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
@ -238,25 +228,28 @@ impl PetApi for PetApiClient {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
let query_string = {
|
||||
let mut query = ::url::form_urlencoded::Serializer::new(String::new());
|
||||
|
||||
query.finish()
|
||||
};
|
||||
let uri_str = format!("{}/pet/{petId}?{}", configuration.base_path, query_string, petId=pet_id);
|
||||
|
||||
let uri_str = format!("{}/pet/{petId}", configuration.base_path, petId=pet_id);
|
||||
let mut req_builder = client.post(uri_str.as_str());
|
||||
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if let Some(ref token) = configuration.oauth_access_token {
|
||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
let mut form_params = std::collections::HashMap::new();
|
||||
form_params.insert("name", name.to_string());
|
||||
form_params.insert("status", status.to_string());
|
||||
req_builder = req_builder.form(&form_params);
|
||||
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
@ -265,29 +258,32 @@ impl PetApi for PetApiClient {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: ::models::File) -> Result<::models::ApiResponse, Error> {
|
||||
fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: &std::path::Path) -> Result<::models::ApiResponse, Error> {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
let query_string = {
|
||||
let mut query = ::url::form_urlencoded::Serializer::new(String::new());
|
||||
|
||||
query.finish()
|
||||
};
|
||||
let uri_str = format!("{}/pet/{petId}/uploadImage?{}", configuration.base_path, query_string, petId=pet_id);
|
||||
|
||||
let uri_str = format!("{}/pet/{petId}/uploadImage", configuration.base_path, petId=pet_id);
|
||||
let mut req_builder = client.post(uri_str.as_str());
|
||||
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if let Some(ref token) = configuration.oauth_access_token {
|
||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
let mut form_params = std::collections::HashMap::new();
|
||||
form_params.insert("additionalMetadata", additional_metadata.to_string());
|
||||
form_params.insert("file", unimplemented!("File form param not supported with x-www-form-urlencoded content"));
|
||||
req_builder = req_builder.form(&form_params);
|
||||
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
|
@ -13,7 +13,7 @@ use std::borrow::Borrow;
|
||||
|
||||
use reqwest;
|
||||
|
||||
use super::{Error, configuration};
|
||||
use super::{Error, configuration, urlencode};
|
||||
|
||||
pub struct StoreApiClient {
|
||||
configuration: Rc<configuration::Configuration>,
|
||||
@ -31,30 +31,26 @@ pub trait StoreApi {
|
||||
fn delete_order(&self, order_id: &str) -> Result<(), Error>;
|
||||
fn get_inventory(&self, ) -> Result<::std::collections::HashMap<String, i32>, Error>;
|
||||
fn get_order_by_id(&self, order_id: i64) -> Result<::models::Order, Error>;
|
||||
fn place_order(&self, order: ::models::Order) -> Result<::models::Order, Error>;
|
||||
fn place_order(&self, body: ::models::Order) -> Result<::models::Order, Error>;
|
||||
}
|
||||
|
||||
|
||||
impl StoreApi for StoreApiClient {
|
||||
fn delete_order(&self, order_id: &str) -> Result<(), Error> {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
let query_string = {
|
||||
let mut query = ::url::form_urlencoded::Serializer::new(String::new());
|
||||
|
||||
query.finish()
|
||||
};
|
||||
let uri_str = format!("{}/store/order/{orderId}?{}", configuration.base_path, query_string, orderId=order_id);
|
||||
|
||||
let uri_str = format!("{}/store/order/{orderId}", configuration.base_path, orderId=urlencode(order_id));
|
||||
let mut req_builder = client.delete(uri_str.as_str());
|
||||
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
@ -67,20 +63,15 @@ impl StoreApi for StoreApiClient {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
let query_string = {
|
||||
let mut query = ::url::form_urlencoded::Serializer::new(String::new());
|
||||
|
||||
query.finish()
|
||||
};
|
||||
let uri_str = format!("{}/store/inventory?{}", configuration.base_path, query_string);
|
||||
|
||||
let uri_str = format!("{}/store/inventory", configuration.base_path);
|
||||
let mut req_builder = client.get(uri_str.as_str());
|
||||
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if let Some(ref apikey) = configuration.api_key {
|
||||
let key = apikey.key.clone();
|
||||
@ -91,7 +82,10 @@ impl StoreApi for StoreApiClient {
|
||||
req_builder = req_builder.header("api_key", val);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
@ -103,21 +97,18 @@ impl StoreApi for StoreApiClient {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
let query_string = {
|
||||
let mut query = ::url::form_urlencoded::Serializer::new(String::new());
|
||||
|
||||
query.finish()
|
||||
};
|
||||
let uri_str = format!("{}/store/order/{orderId}?{}", configuration.base_path, query_string, orderId=order_id);
|
||||
|
||||
let uri_str = format!("{}/store/order/{orderId}", configuration.base_path, orderId=order_id);
|
||||
let mut req_builder = client.get(uri_str.as_str());
|
||||
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
@ -125,26 +116,24 @@ impl StoreApi for StoreApiClient {
|
||||
Ok(client.execute(req)?.error_for_status()?.json()?)
|
||||
}
|
||||
|
||||
fn place_order(&self, order: ::models::Order) -> Result<::models::Order, Error> {
|
||||
fn place_order(&self, body: ::models::Order) -> Result<::models::Order, Error> {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
let query_string = {
|
||||
let mut query = ::url::form_urlencoded::Serializer::new(String::new());
|
||||
|
||||
query.finish()
|
||||
};
|
||||
let uri_str = format!("{}/store/order?{}", configuration.base_path, query_string);
|
||||
|
||||
let uri_str = format!("{}/store/order", configuration.base_path);
|
||||
let mut req_builder = client.post(uri_str.as_str());
|
||||
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
|
||||
|
||||
|
||||
req_builder = req_builder.json(&order);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
req_builder = req_builder.json(&body);
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
|
@ -13,7 +13,7 @@ use std::borrow::Borrow;
|
||||
|
||||
use reqwest;
|
||||
|
||||
use super::{Error, configuration};
|
||||
use super::{Error, configuration, urlencode};
|
||||
|
||||
pub struct UserApiClient {
|
||||
configuration: Rc<configuration::Configuration>,
|
||||
@ -28,38 +28,35 @@ impl UserApiClient {
|
||||
}
|
||||
|
||||
pub trait UserApi {
|
||||
fn create_user(&self, user: ::models::User) -> Result<(), Error>;
|
||||
fn create_users_with_array_input(&self, user: Vec<::models::User>) -> Result<(), Error>;
|
||||
fn create_users_with_list_input(&self, user: Vec<::models::User>) -> Result<(), Error>;
|
||||
fn create_user(&self, body: ::models::User) -> Result<(), Error>;
|
||||
fn create_users_with_array_input(&self, body: Vec<::models::User>) -> Result<(), Error>;
|
||||
fn create_users_with_list_input(&self, body: Vec<::models::User>) -> Result<(), Error>;
|
||||
fn delete_user(&self, username: &str) -> Result<(), Error>;
|
||||
fn get_user_by_name(&self, username: &str) -> Result<::models::User, Error>;
|
||||
fn login_user(&self, username: &str, password: &str) -> Result<String, Error>;
|
||||
fn logout_user(&self, ) -> Result<(), Error>;
|
||||
fn update_user(&self, username: &str, user: ::models::User) -> Result<(), Error>;
|
||||
fn update_user(&self, username: &str, body: ::models::User) -> Result<(), Error>;
|
||||
}
|
||||
|
||||
|
||||
impl UserApi for UserApiClient {
|
||||
fn create_user(&self, user: ::models::User) -> Result<(), Error> {
|
||||
fn create_user(&self, body: ::models::User) -> Result<(), Error> {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
let query_string = {
|
||||
let mut query = ::url::form_urlencoded::Serializer::new(String::new());
|
||||
|
||||
query.finish()
|
||||
};
|
||||
let uri_str = format!("{}/user?{}", configuration.base_path, query_string);
|
||||
|
||||
let uri_str = format!("{}/user", configuration.base_path);
|
||||
let mut req_builder = client.post(uri_str.as_str());
|
||||
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
|
||||
|
||||
|
||||
req_builder = req_builder.json(&user);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
req_builder = req_builder.json(&body);
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
@ -68,26 +65,24 @@ impl UserApi for UserApiClient {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn create_users_with_array_input(&self, user: Vec<::models::User>) -> Result<(), Error> {
|
||||
fn create_users_with_array_input(&self, body: Vec<::models::User>) -> Result<(), Error> {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
let query_string = {
|
||||
let mut query = ::url::form_urlencoded::Serializer::new(String::new());
|
||||
|
||||
query.finish()
|
||||
};
|
||||
let uri_str = format!("{}/user/createWithArray?{}", configuration.base_path, query_string);
|
||||
|
||||
let uri_str = format!("{}/user/createWithArray", configuration.base_path);
|
||||
let mut req_builder = client.post(uri_str.as_str());
|
||||
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
|
||||
|
||||
|
||||
req_builder = req_builder.json(&user);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
req_builder = req_builder.json(&body);
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
@ -96,26 +91,24 @@ impl UserApi for UserApiClient {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn create_users_with_list_input(&self, user: Vec<::models::User>) -> Result<(), Error> {
|
||||
fn create_users_with_list_input(&self, body: Vec<::models::User>) -> Result<(), Error> {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
let query_string = {
|
||||
let mut query = ::url::form_urlencoded::Serializer::new(String::new());
|
||||
|
||||
query.finish()
|
||||
};
|
||||
let uri_str = format!("{}/user/createWithList?{}", configuration.base_path, query_string);
|
||||
|
||||
let uri_str = format!("{}/user/createWithList", configuration.base_path);
|
||||
let mut req_builder = client.post(uri_str.as_str());
|
||||
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
|
||||
|
||||
|
||||
req_builder = req_builder.json(&user);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
req_builder = req_builder.json(&body);
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
@ -128,21 +121,18 @@ impl UserApi for UserApiClient {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
let query_string = {
|
||||
let mut query = ::url::form_urlencoded::Serializer::new(String::new());
|
||||
|
||||
query.finish()
|
||||
};
|
||||
let uri_str = format!("{}/user/{username}?{}", configuration.base_path, query_string, username=username);
|
||||
|
||||
let uri_str = format!("{}/user/{username}", configuration.base_path, username=urlencode(username));
|
||||
let mut req_builder = client.delete(uri_str.as_str());
|
||||
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
@ -155,21 +145,18 @@ impl UserApi for UserApiClient {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
let query_string = {
|
||||
let mut query = ::url::form_urlencoded::Serializer::new(String::new());
|
||||
|
||||
query.finish()
|
||||
};
|
||||
let uri_str = format!("{}/user/{username}?{}", configuration.base_path, query_string, username=username);
|
||||
|
||||
let uri_str = format!("{}/user/{username}", configuration.base_path, username=urlencode(username));
|
||||
let mut req_builder = client.get(uri_str.as_str());
|
||||
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
@ -181,23 +168,20 @@ impl UserApi for UserApiClient {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
let query_string = {
|
||||
let mut query = ::url::form_urlencoded::Serializer::new(String::new());
|
||||
query.append_pair("username", &username.to_string());
|
||||
query.append_pair("password", &password.to_string());
|
||||
|
||||
query.finish()
|
||||
};
|
||||
let uri_str = format!("{}/user/login?{}", configuration.base_path, query_string);
|
||||
|
||||
let uri_str = format!("{}/user/login", configuration.base_path);
|
||||
let mut req_builder = client.get(uri_str.as_str());
|
||||
|
||||
req_builder = req_builder.query(&[("username", &username.to_string())]);
|
||||
req_builder = req_builder.query(&[("password", &password.to_string())]);
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
@ -209,21 +193,18 @@ impl UserApi for UserApiClient {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
let query_string = {
|
||||
let mut query = ::url::form_urlencoded::Serializer::new(String::new());
|
||||
|
||||
query.finish()
|
||||
};
|
||||
let uri_str = format!("{}/user/logout?{}", configuration.base_path, query_string);
|
||||
|
||||
let uri_str = format!("{}/user/logout", configuration.base_path);
|
||||
let mut req_builder = client.get(uri_str.as_str());
|
||||
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
@ -232,26 +213,24 @@ impl UserApi for UserApiClient {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn update_user(&self, username: &str, user: ::models::User) -> Result<(), Error> {
|
||||
fn update_user(&self, username: &str, body: ::models::User) -> Result<(), Error> {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
let query_string = {
|
||||
let mut query = ::url::form_urlencoded::Serializer::new(String::new());
|
||||
|
||||
query.finish()
|
||||
};
|
||||
let uri_str = format!("{}/user/{username}?{}", configuration.base_path, query_string, username=username);
|
||||
|
||||
let uri_str = format!("{}/user/{username}", configuration.base_path, username=urlencode(username));
|
||||
let mut req_builder = client.put(uri_str.as_str());
|
||||
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
|
||||
|
||||
|
||||
req_builder = req_builder.json(&user);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
req_builder = req_builder.json(&body);
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
|
@ -1 +1 @@
|
||||
3.3.4-SNAPSHOT
|
||||
4.0.0-SNAPSHOT
|
@ -15,7 +15,7 @@ Method | HTTP request | Description
|
||||
|
||||
|
||||
# **add_pet**
|
||||
> add_pet(ctx, pet)
|
||||
> add_pet(ctx, body)
|
||||
Add a new pet to the store
|
||||
|
||||
### Required Parameters
|
||||
@ -23,7 +23,7 @@ Add a new pet to the store
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context containing the authentication | nil if no authentication
|
||||
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -160,7 +160,7 @@ Name | Type | Description | Notes
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **update_pet**
|
||||
> update_pet(ctx, pet)
|
||||
> update_pet(ctx, body)
|
||||
Update an existing pet
|
||||
|
||||
### Required Parameters
|
||||
@ -168,7 +168,7 @@ Update an existing pet
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**ctx** | **context.Context** | context containing the authentication | nil if no authentication
|
||||
**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -240,7 +240,7 @@ Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet_id** | **i64**| ID of pet to update |
|
||||
**additional_metadata** | **String**| Additional data to pass to server |
|
||||
**file** | **::models::File**| file to upload |
|
||||
**file** | **&std::path::Path**| file to upload |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -89,14 +89,14 @@ No authorization required
|
||||
[[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)
|
||||
> ::models::Order place_order(body)
|
||||
Place an order for a pet
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**order** | [**Order**](Order.md)| order placed for purchasing the pet |
|
||||
**body** | [**Order**](Order.md)| order placed for purchasing the pet |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -15,7 +15,7 @@ Method | HTTP request | Description
|
||||
|
||||
|
||||
# **create_user**
|
||||
> create_user(user)
|
||||
> create_user(body)
|
||||
Create user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
@ -24,7 +24,7 @@ This can only be done by the logged in user.
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | [**User**](User.md)| Created user object |
|
||||
**body** | [**User**](User.md)| Created user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -42,14 +42,14 @@ No authorization required
|
||||
[[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)
|
||||
> create_users_with_array_input(body)
|
||||
Creates list of users with given input array
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | [**Vec<::models::User>**](array.md)| List of user object |
|
||||
**body** | [**Vec<::models::User>**](array.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -67,14 +67,14 @@ No authorization required
|
||||
[[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)
|
||||
> create_users_with_list_input(body)
|
||||
Creates list of users with given input array
|
||||
|
||||
### Required Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | [**Vec<::models::User>**](array.md)| List of user object |
|
||||
**body** | [**Vec<::models::User>**](array.md)| List of user object |
|
||||
|
||||
### Return type
|
||||
|
||||
@ -192,7 +192,7 @@ No authorization required
|
||||
[[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)
|
||||
> update_user(username, body)
|
||||
Updated user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
@ -202,7 +202,7 @@ This can only be done by the logged in user.
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **String**| name that need to be deleted |
|
||||
**user** | [**User**](User.md)| Updated user object |
|
||||
**body** | [**User**](User.md)| Updated user object |
|
||||
|
||||
### Return type
|
||||
|
||||
|
@ -31,22 +31,22 @@ impl<C: hyper::client::Connect> PetApiClient<C> {
|
||||
}
|
||||
|
||||
pub trait PetApi {
|
||||
fn add_pet(&self, pet: ::models::Pet) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
|
||||
fn add_pet(&self, body: ::models::Pet) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
|
||||
fn delete_pet(&self, pet_id: i64, api_key: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
|
||||
fn find_pets_by_status(&self, status: Vec<String>) -> Box<Future<Item = Vec<::models::Pet>, Error = Error<serde_json::Value>>>;
|
||||
fn find_pets_by_tags(&self, tags: Vec<String>) -> Box<Future<Item = Vec<::models::Pet>, Error = Error<serde_json::Value>>>;
|
||||
fn get_pet_by_id(&self, pet_id: i64) -> Box<Future<Item = ::models::Pet, Error = Error<serde_json::Value>>>;
|
||||
fn update_pet(&self, pet: ::models::Pet) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
|
||||
fn update_pet(&self, body: ::models::Pet) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
|
||||
fn update_pet_with_form(&self, pet_id: i64, name: &str, status: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
|
||||
fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: ::models::File) -> Box<Future<Item = ::models::ApiResponse, Error = Error<serde_json::Value>>>;
|
||||
fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: &std::path::Path) -> Box<Future<Item = ::models::ApiResponse, Error = Error<serde_json::Value>>>;
|
||||
}
|
||||
|
||||
|
||||
impl<C: hyper::client::Connect>PetApi for PetApiClient<C> {
|
||||
fn add_pet(&self, pet: ::models::Pet) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
|
||||
fn add_pet(&self, body: ::models::Pet) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
|
||||
__internal_request::Request::new(hyper::Method::Post, "/pet".to_string())
|
||||
.with_auth(__internal_request::Auth::Oauth)
|
||||
.with_body_param(pet)
|
||||
.with_body_param(body)
|
||||
.returns_nothing()
|
||||
.execute(self.configuration.borrow())
|
||||
}
|
||||
@ -85,10 +85,10 @@ impl<C: hyper::client::Connect>PetApi for PetApiClient<C> {
|
||||
.execute(self.configuration.borrow())
|
||||
}
|
||||
|
||||
fn update_pet(&self, pet: ::models::Pet) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
|
||||
fn update_pet(&self, body: ::models::Pet) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
|
||||
__internal_request::Request::new(hyper::Method::Put, "/pet".to_string())
|
||||
.with_auth(__internal_request::Auth::Oauth)
|
||||
.with_body_param(pet)
|
||||
.with_body_param(body)
|
||||
.returns_nothing()
|
||||
.execute(self.configuration.borrow())
|
||||
}
|
||||
@ -103,7 +103,7 @@ impl<C: hyper::client::Connect>PetApi for PetApiClient<C> {
|
||||
.execute(self.configuration.borrow())
|
||||
}
|
||||
|
||||
fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: ::models::File) -> Box<Future<Item = ::models::ApiResponse, Error = Error<serde_json::Value>>> {
|
||||
fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: &std::path::Path) -> Box<Future<Item = ::models::ApiResponse, Error = Error<serde_json::Value>>> {
|
||||
__internal_request::Request::new(hyper::Method::Post, "/pet/{petId}/uploadImage".to_string())
|
||||
.with_auth(__internal_request::Auth::Oauth)
|
||||
.with_path_param("petId".to_string(), pet_id.to_string())
|
||||
|
@ -34,7 +34,7 @@ pub trait StoreApi {
|
||||
fn delete_order(&self, order_id: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
|
||||
fn get_inventory(&self, ) -> Box<Future<Item = ::std::collections::HashMap<String, i32>, Error = Error<serde_json::Value>>>;
|
||||
fn get_order_by_id(&self, order_id: i64) -> Box<Future<Item = ::models::Order, Error = Error<serde_json::Value>>>;
|
||||
fn place_order(&self, order: ::models::Order) -> Box<Future<Item = ::models::Order, Error = Error<serde_json::Value>>>;
|
||||
fn place_order(&self, body: ::models::Order) -> Box<Future<Item = ::models::Order, Error = Error<serde_json::Value>>>;
|
||||
}
|
||||
|
||||
|
||||
@ -62,9 +62,9 @@ impl<C: hyper::client::Connect>StoreApi for StoreApiClient<C> {
|
||||
.execute(self.configuration.borrow())
|
||||
}
|
||||
|
||||
fn place_order(&self, order: ::models::Order) -> Box<Future<Item = ::models::Order, Error = Error<serde_json::Value>>> {
|
||||
fn place_order(&self, body: ::models::Order) -> Box<Future<Item = ::models::Order, Error = Error<serde_json::Value>>> {
|
||||
__internal_request::Request::new(hyper::Method::Post, "/store/order".to_string())
|
||||
.with_body_param(order)
|
||||
.with_body_param(body)
|
||||
.execute(self.configuration.borrow())
|
||||
}
|
||||
|
||||
|
@ -31,35 +31,35 @@ impl<C: hyper::client::Connect> UserApiClient<C> {
|
||||
}
|
||||
|
||||
pub trait UserApi {
|
||||
fn create_user(&self, user: ::models::User) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
|
||||
fn create_users_with_array_input(&self, user: Vec<::models::User>) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
|
||||
fn create_users_with_list_input(&self, user: Vec<::models::User>) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
|
||||
fn create_user(&self, body: ::models::User) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
|
||||
fn create_users_with_array_input(&self, body: Vec<::models::User>) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
|
||||
fn create_users_with_list_input(&self, body: Vec<::models::User>) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
|
||||
fn delete_user(&self, username: &str) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
|
||||
fn get_user_by_name(&self, username: &str) -> Box<Future<Item = ::models::User, Error = Error<serde_json::Value>>>;
|
||||
fn login_user(&self, username: &str, password: &str) -> Box<Future<Item = String, Error = Error<serde_json::Value>>>;
|
||||
fn logout_user(&self, ) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
|
||||
fn update_user(&self, username: &str, user: ::models::User) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
|
||||
fn update_user(&self, username: &str, body: ::models::User) -> Box<Future<Item = (), Error = Error<serde_json::Value>>>;
|
||||
}
|
||||
|
||||
|
||||
impl<C: hyper::client::Connect>UserApi for UserApiClient<C> {
|
||||
fn create_user(&self, user: ::models::User) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
|
||||
fn create_user(&self, body: ::models::User) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
|
||||
__internal_request::Request::new(hyper::Method::Post, "/user".to_string())
|
||||
.with_body_param(user)
|
||||
.with_body_param(body)
|
||||
.returns_nothing()
|
||||
.execute(self.configuration.borrow())
|
||||
}
|
||||
|
||||
fn create_users_with_array_input(&self, user: Vec<::models::User>) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
|
||||
fn create_users_with_array_input(&self, body: Vec<::models::User>) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
|
||||
__internal_request::Request::new(hyper::Method::Post, "/user/createWithArray".to_string())
|
||||
.with_body_param(user)
|
||||
.with_body_param(body)
|
||||
.returns_nothing()
|
||||
.execute(self.configuration.borrow())
|
||||
}
|
||||
|
||||
fn create_users_with_list_input(&self, user: Vec<::models::User>) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
|
||||
fn create_users_with_list_input(&self, body: Vec<::models::User>) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
|
||||
__internal_request::Request::new(hyper::Method::Post, "/user/createWithList".to_string())
|
||||
.with_body_param(user)
|
||||
.with_body_param(body)
|
||||
.returns_nothing()
|
||||
.execute(self.configuration.borrow())
|
||||
}
|
||||
@ -90,10 +90,10 @@ impl<C: hyper::client::Connect>UserApi for UserApiClient<C> {
|
||||
.execute(self.configuration.borrow())
|
||||
}
|
||||
|
||||
fn update_user(&self, username: &str, user: ::models::User) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
|
||||
fn update_user(&self, username: &str, body: ::models::User) -> Box<Future<Item = (), Error = Error<serde_json::Value>>> {
|
||||
__internal_request::Request::new(hyper::Method::Put, "/user/{username}".to_string())
|
||||
.with_path_param("username".to_string(), username.to_string())
|
||||
.with_body_param(user)
|
||||
.with_body_param(body)
|
||||
.returns_nothing()
|
||||
.execute(self.configuration.borrow())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user