forked from loafle/openapi-generator-original
Revert "[Rust] Support formParams and fix list-params." (#1732)
* Revert "Disable rust-reqwest petstore test" This reverts commit9e1cce2e7b. * Revert "Fix various CI issues (#1722)" This reverts commit77270a0118. * Revert "[Rust] Support formParams and fix list-params. (#1678)" This reverts commit4a494b45d3.
This commit is contained in:
@@ -21,7 +21,7 @@ impl {{{classname}}}Client {
|
||||
pub trait {{{classname}}} {
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
fn {{{operationId}}}(&self, {{#allParams}}{{{paramName}}}: {{#isListContainer}}Vec<{{/isListContainer}}{{#isString}}&str{{/isString}}{{#isUuid}}&str{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}::models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{#isListContainer}}>{{/isListContainer}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Result<{{^returnType}}(){{/returnType}}{{#returnType}}{{{returnType}}}{{/returnType}}, Error>;
|
||||
fn {{{operationId}}}(&self, {{#allParams}}{{{paramName}}}: {{#isString}}&str{{/isString}}{{#isUuid}}&str{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}::models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Result<{{^returnType}}(){{/returnType}}{{#returnType}}{{{returnType}}}{{/returnType}}, Error>;
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
}
|
||||
@@ -30,23 +30,16 @@ pub trait {{{classname}}} {
|
||||
impl {{{classname}}} for {{{classname}}}Client {
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
fn {{{operationId}}}(&self, {{#allParams}}{{{paramName}}}: {{#isListContainer}}Vec<{{/isListContainer}}{{#isString}}&str{{/isString}}{{#isUuid}}&str{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}::models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{#isListContainer}}>{{/isListContainer}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Result<{{^returnType}}(){{/returnType}}{{#returnType}}{{{returnType}}}{{/returnType}}, Error> {
|
||||
fn {{{operationId}}}(&self, {{#allParams}}{{{paramName}}}: {{#isString}}&str{{/isString}}{{#isUuid}}&str{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}::models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Result<{{^returnType}}(){{/returnType}}{{#returnType}}{{{returnType}}}{{/returnType}}, Error> {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
{{#hasFormParams}}
|
||||
let form = [
|
||||
{{#formParams}}
|
||||
("{{{baseName}}}", &{{{paramName}}}{{#isListContainer}}.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(","){{/isListContainer}}.to_string()),
|
||||
{{/formParams}}
|
||||
];
|
||||
{{/hasFormParams}}
|
||||
let query_string = {
|
||||
let mut query = ::url::form_urlencoded::Serializer::new(String::new());
|
||||
{{#queryParams}}
|
||||
{{#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}}
|
||||
{{/queryParams}}
|
||||
{{#hasAuthMethods}}{{#authMethods}}{{#isApiKey}}{{#isKeyInQuery}}
|
||||
if let Some(ref apikey) = configuration.api_key {
|
||||
let key = apikey.key.clone();
|
||||
let val = match apikey.prefix {
|
||||
@@ -55,7 +48,7 @@ impl {{{classname}}} for {{{classname}}}Client {
|
||||
};
|
||||
query.append_pair("{{{keyParamName}}}".to_owned(), val);
|
||||
}
|
||||
{{/isKeyInQuery}}{{/isApiKey}}{{/authMethods}}{{/hasAuthMethods}}
|
||||
{{/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}});
|
||||
@@ -103,10 +96,6 @@ impl {{{classname}}} for {{{classname}}}Client {
|
||||
{{/bodyParams}}
|
||||
{{/hasBodyParam}}
|
||||
|
||||
{{#hasFormParams}}
|
||||
req_builder = req_builder.form(&form);
|
||||
{{/hasFormParams}}
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
4.0.0-SNAPSHOT
|
||||
3.3.4-SNAPSHOT
|
||||
@@ -30,8 +30,8 @@ impl PetApiClient {
|
||||
pub trait PetApi {
|
||||
fn add_pet(&self, pet: ::models::Pet) -> Result<(), Error>;
|
||||
fn delete_pet(&self, pet_id: i64, api_key: &str) -> Result<(), Error>;
|
||||
fn find_pets_by_status(&self, status: Vec<Vec<String>>) -> Result<Vec<::models::Pet>, Error>;
|
||||
fn find_pets_by_tags(&self, tags: Vec<Vec<String>>) -> Result<Vec<::models::Pet>, 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_with_form(&self, pet_id: i64, name: &str, status: &str) -> Result<(), Error>;
|
||||
@@ -46,7 +46,7 @@ impl PetApi for PetApiClient {
|
||||
|
||||
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);
|
||||
@@ -65,7 +65,6 @@ impl PetApi for PetApiClient {
|
||||
|
||||
req_builder = req_builder.json(&pet);
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
|
||||
@@ -79,7 +78,7 @@ impl PetApi for PetApiClient {
|
||||
|
||||
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);
|
||||
@@ -98,7 +97,6 @@ impl PetApi for PetApiClient {
|
||||
};
|
||||
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
|
||||
@@ -106,14 +104,14 @@ impl PetApi for PetApiClient {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn find_pets_by_status(&self, status: Vec<Vec<String>>) -> Result<Vec<::models::Pet>, Error> {
|
||||
fn find_pets_by_status(&self, status: Vec<String>) -> Result<Vec<::models::Pet>, 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.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);
|
||||
@@ -131,21 +129,20 @@ impl PetApi for PetApiClient {
|
||||
};
|
||||
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
|
||||
Ok(client.execute(req)?.error_for_status()?.json()?)
|
||||
}
|
||||
|
||||
fn find_pets_by_tags(&self, tags: Vec<Vec<String>>) -> Result<Vec<::models::Pet>, Error> {
|
||||
fn find_pets_by_tags(&self, tags: Vec<String>) -> Result<Vec<::models::Pet>, 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.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);
|
||||
@@ -163,7 +160,6 @@ impl PetApi for PetApiClient {
|
||||
};
|
||||
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
|
||||
@@ -176,7 +172,7 @@ impl PetApi for PetApiClient {
|
||||
|
||||
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);
|
||||
@@ -200,7 +196,6 @@ impl PetApi for PetApiClient {
|
||||
|
||||
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
|
||||
@@ -213,7 +208,7 @@ impl PetApi for PetApiClient {
|
||||
|
||||
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);
|
||||
@@ -232,7 +227,6 @@ impl PetApi for PetApiClient {
|
||||
|
||||
req_builder = req_builder.json(&pet);
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
|
||||
@@ -244,13 +238,9 @@ impl PetApi for PetApiClient {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
let form = [
|
||||
("name", &name.to_string()),
|
||||
("status", &status.to_string()),
|
||||
];
|
||||
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);
|
||||
@@ -268,8 +258,6 @@ impl PetApi for PetApiClient {
|
||||
};
|
||||
|
||||
|
||||
req_builder = req_builder.form(&form);
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
|
||||
@@ -281,13 +269,9 @@ impl PetApi for PetApiClient {
|
||||
let configuration: &configuration::Configuration = self.configuration.borrow();
|
||||
let client = &configuration.client;
|
||||
|
||||
let form = [
|
||||
("additionalMetadata", &additional_metadata.to_string()),
|
||||
("file", &file.to_string()),
|
||||
];
|
||||
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);
|
||||
@@ -305,8 +289,6 @@ impl PetApi for PetApiClient {
|
||||
};
|
||||
|
||||
|
||||
req_builder = req_builder.form(&form);
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ impl StoreApi for StoreApiClient {
|
||||
|
||||
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);
|
||||
@@ -56,7 +56,6 @@ impl StoreApi for StoreApiClient {
|
||||
|
||||
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
|
||||
@@ -70,7 +69,7 @@ impl StoreApi for StoreApiClient {
|
||||
|
||||
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);
|
||||
@@ -94,7 +93,6 @@ impl StoreApi for StoreApiClient {
|
||||
|
||||
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
|
||||
@@ -107,7 +105,7 @@ impl StoreApi for StoreApiClient {
|
||||
|
||||
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);
|
||||
@@ -121,7 +119,6 @@ impl StoreApi for StoreApiClient {
|
||||
|
||||
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
|
||||
@@ -134,7 +131,7 @@ impl StoreApi for StoreApiClient {
|
||||
|
||||
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);
|
||||
@@ -149,7 +146,6 @@ impl StoreApi for StoreApiClient {
|
||||
|
||||
req_builder = req_builder.json(&order);
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ impl UserApiClient {
|
||||
|
||||
pub trait UserApi {
|
||||
fn create_user(&self, user: ::models::User) -> Result<(), Error>;
|
||||
fn create_users_with_array_input(&self, user: Vec<Vec<::models::User>>) -> Result<(), Error>;
|
||||
fn create_users_with_list_input(&self, user: Vec<Vec<::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 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>;
|
||||
@@ -46,7 +46,7 @@ impl UserApi for UserApiClient {
|
||||
|
||||
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);
|
||||
@@ -61,7 +61,6 @@ impl UserApi for UserApiClient {
|
||||
|
||||
req_builder = req_builder.json(&user);
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
|
||||
@@ -69,13 +68,13 @@ impl UserApi for UserApiClient {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn create_users_with_array_input(&self, user: Vec<Vec<::models::User>>) -> Result<(), Error> {
|
||||
fn create_users_with_array_input(&self, user: 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);
|
||||
@@ -90,7 +89,6 @@ impl UserApi for UserApiClient {
|
||||
|
||||
req_builder = req_builder.json(&user);
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
|
||||
@@ -98,13 +96,13 @@ impl UserApi for UserApiClient {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn create_users_with_list_input(&self, user: Vec<Vec<::models::User>>) -> Result<(), Error> {
|
||||
fn create_users_with_list_input(&self, user: 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);
|
||||
@@ -119,7 +117,6 @@ impl UserApi for UserApiClient {
|
||||
|
||||
req_builder = req_builder.json(&user);
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
|
||||
@@ -133,7 +130,7 @@ impl UserApi for UserApiClient {
|
||||
|
||||
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);
|
||||
@@ -147,7 +144,6 @@ impl UserApi for UserApiClient {
|
||||
|
||||
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
|
||||
@@ -161,7 +157,7 @@ impl UserApi for UserApiClient {
|
||||
|
||||
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);
|
||||
@@ -175,7 +171,6 @@ impl UserApi for UserApiClient {
|
||||
|
||||
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
|
||||
@@ -190,7 +185,7 @@ impl UserApi for UserApiClient {
|
||||
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);
|
||||
@@ -204,7 +199,6 @@ impl UserApi for UserApiClient {
|
||||
|
||||
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
|
||||
@@ -217,7 +211,7 @@ impl UserApi for UserApiClient {
|
||||
|
||||
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);
|
||||
@@ -231,7 +225,6 @@ impl UserApi for UserApiClient {
|
||||
|
||||
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
|
||||
@@ -245,7 +238,7 @@ impl UserApi for UserApiClient {
|
||||
|
||||
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);
|
||||
@@ -260,7 +253,6 @@ impl UserApi for UserApiClient {
|
||||
|
||||
req_builder = req_builder.json(&user);
|
||||
|
||||
|
||||
// send request
|
||||
let req = req_builder.build()?;
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
4.0.0-SNAPSHOT
|
||||
3.3.4-SNAPSHOT
|
||||
Reference in New Issue
Block a user