[Rust] Fixed rust keyword params in reqwest-trait library (#20333)

* Fixed rust keywords in reqwest-trait lib

* Update tests and samples
This commit is contained in:
Ross 2024-12-16 19:58:47 +09:00 committed by GitHub
parent ea2ba0c349
commit 47891245e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
23 changed files with 132 additions and 25 deletions

View File

@ -52,12 +52,15 @@ import org.openapitools.codegen.model.ModelMap;
import org.openapitools.codegen.model.ModelsMap;
import org.openapitools.codegen.model.OperationMap;
import org.openapitools.codegen.model.OperationsMap;
import org.openapitools.codegen.templating.mustache.ReplaceAllLambda;
import org.openapitools.codegen.utils.ModelUtils;
import org.openapitools.codegen.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.collect.ImmutableMap;
import com.samskivert.mustache.Mustache;
import com.samskivert.mustache.Mustache.Lambda;
import com.samskivert.mustache.Template;
import io.swagger.v3.oas.models.media.Discriminator;
@ -692,4 +695,14 @@ public class RustClientCodegen extends AbstractRustCodegen implements CodegenCon
return null;
}
}
@Override
protected ImmutableMap.Builder<String, Lambda> addMustacheLambdas() {
return super.addMustacheLambdas()
// Convert variable names to lifetime names.
// Generally they are the same, but `#` is not valid in lifetime names.
// Rust uses `r#` prefix for variables that are also keywords.
.put("lifetimeName", new ReplaceAllLambda("^r#", "r_"));
}
}

View File

@ -22,7 +22,7 @@ pub trait {{{classname}}}: Send + Sync {
async fn {{{operationId}}}(&self, {{#allParams}}{{#-first}} params: {{{operationIdCamelCase}}}Params {{/-first}}{{/allParams}}) -> Result<{{#supportMultipleResponses}}ResponseContent<{{{operationIdCamelCase}}}Success>{{/supportMultipleResponses}}{{^supportMultipleResponses}}{{^returnType}}(){{/returnType}}{{{returnType}}}{{/supportMultipleResponses}}, Error<{{{operationIdCamelCase}}}Error>>;
{{/vendorExtensions.x-group-parameters}}
{{^vendorExtensions.x-group-parameters}}
async fn {{{operationId}}}<{{#allParams}}'{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}>(&self, {{#allParams}}{{{paramName}}}: {{^required}}Option<{{/required}}{{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{#isString}}{{#isArray}}Vec<{{/isArray}}{{^isUuid}}&'{{{paramName}}} str{{/isUuid}}{{#isArray}}>{{/isArray}}{{/isString}}{{#isUuid}}{{#isArray}}Vec<{{/isArray}}&str{{#isArray}}>{{/isArray}}{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) -> Result<{{#supportMultipleResponses}}ResponseContent<{{{operationIdCamelCase}}}Success>{{/supportMultipleResponses}}{{^supportMultipleResponses}}{{^returnType}}(){{/returnType}}{{{returnType}}}{{/supportMultipleResponses}}, Error<{{{operationIdCamelCase}}}Error>>;
async fn {{{operationId}}}<{{#allParams}}'{{#lambda.lifetimeName}}{{{paramName}}}{{/lambda.lifetimeName}}{{^-last}}, {{/-last}}{{/allParams}}>(&self, {{#allParams}}{{{paramName}}}: {{^required}}Option<{{/required}}{{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{#isString}}{{#isArray}}Vec<{{/isArray}}{{^isUuid}}&'{{#lambda.lifetimeName}}{{{paramName}}}{{/lambda.lifetimeName}} str{{/isUuid}}{{#isArray}}>{{/isArray}}{{/isString}}{{#isUuid}}{{#isArray}}Vec<{{/isArray}}&str{{#isArray}}>{{/isArray}}{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) -> Result<{{#supportMultipleResponses}}ResponseContent<{{{operationIdCamelCase}}}Success>{{/supportMultipleResponses}}{{^supportMultipleResponses}}{{^returnType}}(){{/returnType}}{{{returnType}}}{{/supportMultipleResponses}}, Error<{{{operationIdCamelCase}}}Error>>;
{{/vendorExtensions.x-group-parameters}}
{{/operation}}
{{/operations}}
@ -86,7 +86,7 @@ impl {{classname}} for {{classname}}Client {
{{/vendorExtensions.x-group-parameters}}
{{^vendorExtensions.x-group-parameters}}
async fn {{{operationId}}}<{{#allParams}}'{{{paramName}}}{{^-last}}, {{/-last}}{{/allParams}}>(&self, {{#allParams}}{{{paramName}}}: {{^required}}Option<{{/required}}{{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{#isString}}{{#isArray}}Vec<{{/isArray}}{{^isUuid}}&'{{{paramName}}} str{{/isUuid}}{{#isArray}}>{{/isArray}}{{/isString}}{{#isUuid}}{{#isArray}}Vec<{{/isArray}}&str{{#isArray}}>{{/isArray}}{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) -> Result<{{#supportMultipleResponses}}ResponseContent<{{{operationIdCamelCase}}}Success>{{/supportMultipleResponses}}{{^supportMultipleResponses}}{{^returnType}}(){{/returnType}}{{{returnType}}}{{/supportMultipleResponses}}, Error<{{{operationIdCamelCase}}}Error>> {
async fn {{{operationId}}}<{{#allParams}}'{{#lambda.lifetimeName}}{{{paramName}}}{{/lambda.lifetimeName}}{{^-last}}, {{/-last}}{{/allParams}}>(&self, {{#allParams}}{{{paramName}}}: {{^required}}Option<{{/required}}{{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{#isString}}{{#isArray}}Vec<{{/isArray}}{{^isUuid}}&'{{#lambda.lifetimeName}}{{{paramName}}}{{/lambda.lifetimeName}} str{{/isUuid}}{{#isArray}}>{{/isArray}}{{/isString}}{{#isUuid}}{{#isArray}}Vec<{{/isArray}}&str{{#isArray}}>{{/isArray}}{{/isUuid}}{{^isString}}{{^isUuid}}{{^isPrimitiveType}}{{^isContainer}}models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isUuid}}{{/isString}}{{^required}}>{{/required}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}) -> Result<{{#supportMultipleResponses}}ResponseContent<{{{operationIdCamelCase}}}Success>{{/supportMultipleResponses}}{{^supportMultipleResponses}}{{^returnType}}(){{/returnType}}{{{returnType}}}{{/supportMultipleResponses}}, Error<{{{operationIdCamelCase}}}Error>> {
{{/vendorExtensions.x-group-parameters}}
let local_var_configuration = &self.configuration;

View File

@ -95,6 +95,22 @@ paths:
- pending
- sold
default: available
- name: type
in: query
description: Make sure that Rust keywords like type work as query params
required: false
style: form
explode: false
deprecated: true
schema:
type: array
items:
type: string
enum:
- available
- pending
- sold
default: available
responses:
'200':
description: successful operation

View File

@ -78,7 +78,7 @@ Name | Type | Description | Required | Notes
## find_pets_by_status
> Vec<models::Pet> find_pets_by_status(status)
> Vec<models::Pet> find_pets_by_status(status, r#type)
Finds Pets by status
Multiple status values can be provided with comma separated strings
@ -89,6 +89,7 @@ Multiple status values can be provided with comma separated strings
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**status** | [**Vec<String>**](String.md) | Status values that need to be considered for filter | [required] |
**r#type** | Option<[**Vec<String>**](String.md)> | Make sure that Rust keywords like type work as query params | |
### Return type

View File

@ -39,7 +39,7 @@ impl<C: Connect> PetApiClient<C>
pub trait PetApi: Send + Sync {
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>> + Send>>;
fn find_pets_by_status(&self, status: Vec<String>) -> Pin<Box<dyn Future<Output = Result<Vec<models::Pet>, Error>> + Send>>;
fn find_pets_by_status(&self, status: Vec<String>, r#type: Option<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>> + Send>>;
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>> + Send>>;
@ -74,11 +74,15 @@ impl<C: Connect>PetApi for PetApiClient<C>
}
#[allow(unused_mut)]
fn find_pets_by_status(&self, status: Vec<String>) -> Pin<Box<dyn Future<Output = Result<Vec<models::Pet>, Error>> + Send>> {
fn find_pets_by_status(&self, status: Vec<String>, r#type: Option<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())
.with_auth(__internal_request::Auth::Oauth)
;
req = req.with_query_param("status".to_string(), status.join(",").to_string());
if let Some(ref s) = r#type {
let query_value = s.iter().map(|s| s.to_string()).collect::<Vec<String>>().join(",");
req = req.with_query_param("type".to_string(), query_value);
}
req.execute(self.configuration.borrow())
}

View File

@ -78,7 +78,7 @@ Name | Type | Description | Required | Notes
## find_pets_by_status
> Vec<models::Pet> find_pets_by_status(status)
> Vec<models::Pet> find_pets_by_status(status, r#type)
Finds Pets by status
Multiple status values can be provided with comma separated strings
@ -89,6 +89,7 @@ Multiple status values can be provided with comma separated strings
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**status** | [**Vec<String>**](String.md) | Status values that need to be considered for filter | [required] |
**r#type** | Option<[**Vec<String>**](String.md)> | Make sure that Rust keywords like type work as query params | |
### Return type

View File

@ -38,7 +38,7 @@ impl<C: hyper::client::connect::Connect> PetApiClient<C>
pub trait PetApi {
fn add_pet(&self, pet: models::Pet) -> Pin<Box<dyn Future<Output = Result<models::Pet, Error>>>>;
fn delete_pet(&self, pet_id: i64, api_key: Option<&str>) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>;
fn find_pets_by_status(&self, status: Vec<String>) -> Pin<Box<dyn Future<Output = Result<Vec<models::Pet>, Error>>>>;
fn find_pets_by_status(&self, status: Vec<String>, r#type: Option<Vec<String>>) -> Pin<Box<dyn Future<Output = Result<Vec<models::Pet>, Error>>>>;
fn find_pets_by_tags(&self, tags: Vec<String>) -> Pin<Box<dyn Future<Output = Result<Vec<models::Pet>, Error>>>>;
fn get_pet_by_id(&self, pet_id: i64) -> Pin<Box<dyn Future<Output = Result<models::Pet, Error>>>>;
fn update_pet(&self, pet: models::Pet) -> Pin<Box<dyn Future<Output = Result<models::Pet, Error>>>>;
@ -73,11 +73,15 @@ impl<C: hyper::client::connect::Connect>PetApi for PetApiClient<C>
}
#[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>, r#type: Option<Vec<String>>) -> Pin<Box<dyn Future<Output = Result<Vec<models::Pet>, Error>>>> {
let mut req = __internal_request::Request::new(hyper::Method::GET, "/pet/findByStatus".to_string())
.with_auth(__internal_request::Auth::Oauth)
;
req = req.with_query_param("status".to_string(), status.join(",").to_string());
if let Some(ref s) = r#type {
let query_value = s.iter().map(|s| s.to_string()).collect::<Vec<String>>().join(",");
req = req.with_query_param("type".to_string(), query_value);
}
req.execute(self.configuration.borrow())
}

View File

@ -78,7 +78,7 @@ Name | Type | Description | Required | Notes
## find_pets_by_status
> Vec<models::Pet> find_pets_by_status(status)
> Vec<models::Pet> find_pets_by_status(status, r#type)
Finds Pets by status
Multiple status values can be provided with comma separated strings
@ -89,6 +89,7 @@ Multiple status values can be provided with comma separated strings
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**status** | [**Vec<String>**](String.md) | Status values that need to be considered for filter | [required] |
**r#type** | Option<[**Vec<String>**](String.md)> | Make sure that Rust keywords like type work as query params | |
### Return type

View File

@ -23,7 +23,7 @@ use super::{Error, configuration};
pub trait PetApi: Send + Sync {
async fn add_pet<'pet>(&self, pet: models::Pet) -> Result<models::Pet, Error<AddPetError>>;
async fn delete_pet<'pet_id, 'api_key>(&self, pet_id: i64, api_key: Option<&'api_key str>) -> Result<(), Error<DeletePetError>>;
async fn find_pets_by_status<'status>(&self, status: Vec<String>) -> Result<Vec<models::Pet>, Error<FindPetsByStatusError>>;
async fn find_pets_by_status<'status, 'r_type>(&self, status: Vec<String>, r#type: Option<Vec<String>>) -> Result<Vec<models::Pet>, Error<FindPetsByStatusError>>;
async fn find_pets_by_tags<'tags>(&self, tags: Vec<String>) -> Result<Vec<models::Pet>, Error<FindPetsByTagsError>>;
async fn get_pet_by_id<'pet_id>(&self, pet_id: i64) -> Result<models::Pet, Error<GetPetByIdError>>;
async fn update_pet<'pet>(&self, pet: models::Pet) -> Result<models::Pet, Error<UpdatePetError>>;
@ -112,7 +112,7 @@ impl PetApi for PetApiClient {
}
/// Multiple status values can be provided with comma separated strings
async fn find_pets_by_status<'status>(&self, status: Vec<String>) -> Result<Vec<models::Pet>, Error<FindPetsByStatusError>> {
async fn find_pets_by_status<'status, 'r_type>(&self, status: Vec<String>, r#type: Option<Vec<String>>) -> Result<Vec<models::Pet>, Error<FindPetsByStatusError>> {
let local_var_configuration = &self.configuration;
let local_var_client = &local_var_configuration.client;
@ -124,6 +124,12 @@ impl PetApi for PetApiClient {
"multi" => local_var_req_builder.query(&status.into_iter().map(|p| ("status".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => local_var_req_builder.query(&[("status", &status.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
if let Some(ref local_var_str) = r#type {
local_var_req_builder = match "csv" {
"multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("type".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => local_var_req_builder.query(&[("type", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}

View File

@ -78,7 +78,7 @@ Name | Type | Description | Required | Notes
## find_pets_by_status
> Vec<models::Pet> find_pets_by_status(status)
> Vec<models::Pet> find_pets_by_status(status, r#type)
Finds Pets by status
Multiple status values can be provided with comma separated strings
@ -89,6 +89,7 @@ Multiple status values can be provided with comma separated strings
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**status** | [**Vec<String>**](String.md) | Status values that need to be considered for filter | [required] |
**r#type** | Option<[**Vec<String>**](String.md)> | Make sure that Rust keywords like type work as query params | |
### Return type

View File

@ -33,7 +33,9 @@ pub struct DeletePetParams {
#[derive(Clone, Debug)]
pub struct FindPetsByStatusParams {
/// Status values that need to be considered for filter
pub status: Vec<String>
pub status: Vec<String>,
/// Make sure that Rust keywords like type work as query params
pub r#type: Option<Vec<String>>
}
/// struct for passing parameters to the method [`find_pets_by_tags`]
@ -296,6 +298,7 @@ pub async fn find_pets_by_status(configuration: &configuration::Configuration, p
// unbox the parameters
let status = params.status;
let r#type = params.r#type;
let local_var_client = &local_var_configuration.client;
@ -307,6 +310,12 @@ pub async fn find_pets_by_status(configuration: &configuration::Configuration, p
"multi" => local_var_req_builder.query(&status.into_iter().map(|p| ("status".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => local_var_req_builder.query(&[("status", &status.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
if let Some(ref local_var_str) = r#type {
local_var_req_builder = match "csv" {
"multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("type".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => local_var_req_builder.query(&[("type", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}

View File

@ -78,7 +78,7 @@ Name | Type | Description | Required | Notes
## find_pets_by_status
> Vec<models::Pet> find_pets_by_status(status)
> Vec<models::Pet> find_pets_by_status(status, r#type)
Finds Pets by status
Multiple status values can be provided with comma separated strings
@ -89,6 +89,7 @@ Multiple status values can be provided with comma separated strings
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**status** | [**Vec<String>**](String.md) | Status values that need to be considered for filter | [required] |
**r#type** | Option<[**Vec<String>**](String.md)> | Make sure that Rust keywords like type work as query params | |
### Return type

View File

@ -33,7 +33,9 @@ pub struct DeletePetParams {
#[derive(Clone, Debug)]
pub struct FindPetsByStatusParams {
/// Status values that need to be considered for filter
pub status: Vec<String>
pub status: Vec<String>,
/// Make sure that Rust keywords like type work as query params
pub r#type: Option<Vec<String>>
}
/// struct for passing parameters to the method [`find_pets_by_tags`]
@ -300,6 +302,7 @@ pub async fn find_pets_by_status(configuration: &configuration::Configuration, p
// unbox the parameters
let status = params.status;
let r#type = params.r#type;
let local_var_client = &local_var_configuration.client;
@ -311,6 +314,12 @@ pub async fn find_pets_by_status(configuration: &configuration::Configuration, p
"multi" => local_var_req_builder.query(&status.into_iter().map(|p| ("status".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => local_var_req_builder.query(&[("status", &status.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
if let Some(ref local_var_str) = r#type {
local_var_req_builder = match "csv" {
"multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("type".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => local_var_req_builder.query(&[("type", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}

View File

@ -78,7 +78,7 @@ Name | Type | Description | Required | Notes
## find_pets_by_status
> Vec<models::Pet> find_pets_by_status(status)
> Vec<models::Pet> find_pets_by_status(status, r#type)
Finds Pets by status
Multiple status values can be provided with comma separated strings
@ -89,6 +89,7 @@ Multiple status values can be provided with comma separated strings
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**status** | [**Vec<String>**](String.md) | Status values that need to be considered for filter | [required] |
**r#type** | Option<[**Vec<String>**](String.md)> | Make sure that Rust keywords like type work as query params | |
### Return type

View File

@ -33,7 +33,9 @@ pub struct DeletePetParams {
#[derive(Clone, Debug)]
pub struct FindPetsByStatusParams {
/// Status values that need to be considered for filter
pub status: Vec<String>
pub status: Vec<String>,
/// Make sure that Rust keywords like type work as query params
pub r#type: Option<Vec<String>>
}
/// struct for passing parameters to the method [`find_pets_by_tags`]
@ -296,6 +298,7 @@ pub async fn find_pets_by_status(configuration: &configuration::Configuration, p
// unbox the parameters
let status = params.status;
let r#type = params.r#type;
let local_var_client = &local_var_configuration.client;
@ -307,6 +310,12 @@ pub async fn find_pets_by_status(configuration: &configuration::Configuration, p
"multi" => local_var_req_builder.query(&status.into_iter().map(|p| ("status".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => local_var_req_builder.query(&[("status", &status.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
if let Some(ref local_var_str) = r#type {
local_var_req_builder = match "csv" {
"multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("type".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => local_var_req_builder.query(&[("type", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}

View File

@ -78,7 +78,7 @@ Name | Type | Description | Required | Notes
## find_pets_by_status
> Vec<models::Pet> find_pets_by_status(status)
> Vec<models::Pet> find_pets_by_status(status, r#type)
Finds Pets by status
Multiple status values can be provided with comma separated strings
@ -89,6 +89,7 @@ Multiple status values can be provided with comma separated strings
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**status** | [**Vec<String>**](String.md) | Status values that need to be considered for filter | [required] |
**r#type** | Option<[**Vec<String>**](String.md)> | Make sure that Rust keywords like type work as query params | |
### Return type

View File

@ -33,7 +33,9 @@ pub struct DeletePetParams {
#[derive(Clone, Debug)]
pub struct FindPetsByStatusParams {
/// Status values that need to be considered for filter
pub status: Vec<String>
pub status: Vec<String>,
/// Make sure that Rust keywords like type work as query params
pub r#type: Option<Vec<String>>
}
/// struct for passing parameters to the method [`find_pets_by_tags`]
@ -296,6 +298,7 @@ pub async fn find_pets_by_status(configuration: &configuration::Configuration, p
// unbox the parameters
let status = params.status;
let r#type = params.r#type;
let local_var_client = &local_var_configuration.client;
@ -307,6 +310,12 @@ pub async fn find_pets_by_status(configuration: &configuration::Configuration, p
"multi" => local_var_req_builder.query(&status.into_iter().map(|p| ("status".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => local_var_req_builder.query(&[("status", &status.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
if let Some(ref local_var_str) = r#type {
local_var_req_builder = match "csv" {
"multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("type".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => local_var_req_builder.query(&[("type", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}

View File

@ -78,7 +78,7 @@ Name | Type | Description | Required | Notes
## find_pets_by_status
> Vec<models::Pet> find_pets_by_status(status)
> Vec<models::Pet> find_pets_by_status(status, r#type)
Finds Pets by status
Multiple status values can be provided with comma separated strings
@ -89,6 +89,7 @@ Multiple status values can be provided with comma separated strings
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**status** | [**Vec<String>**](String.md) | Status values that need to be considered for filter | [required] |
**r#type** | Option<[**Vec<String>**](String.md)> | Make sure that Rust keywords like type work as query params | |
### Return type

View File

@ -176,7 +176,7 @@ pub fn delete_pet(configuration: &configuration::Configuration, pet_id: i64, api
}
/// Multiple status values can be provided with comma separated strings
pub fn find_pets_by_status(configuration: &configuration::Configuration, status: Vec<String>) -> Result<Vec<models::Pet>, Error<FindPetsByStatusError>> {
pub fn find_pets_by_status(configuration: &configuration::Configuration, status: Vec<String>, r#type: Option<Vec<String>>) -> Result<Vec<models::Pet>, Error<FindPetsByStatusError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
@ -188,6 +188,12 @@ pub fn find_pets_by_status(configuration: &configuration::Configuration, status:
"multi" => local_var_req_builder.query(&status.into_iter().map(|p| ("status".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => local_var_req_builder.query(&[("status", &status.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
if let Some(ref local_var_str) = r#type {
local_var_req_builder = match "csv" {
"multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("type".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => local_var_req_builder.query(&[("type", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref local_var_aws_v4_key) = local_var_configuration.aws_v4_key {
let local_var_new_headers = match local_var_aws_v4_key.sign(
&local_var_uri_str,

View File

@ -78,7 +78,7 @@ Name | Type | Description | Required | Notes
## find_pets_by_status
> Vec<models::FooPet> find_pets_by_status(status)
> Vec<models::FooPet> find_pets_by_status(status, r#type)
Finds Pets by status
Multiple status values can be provided with comma separated strings
@ -89,6 +89,7 @@ Multiple status values can be provided with comma separated strings
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**status** | [**Vec<String>**](String.md) | Status values that need to be considered for filter | [required] |
**r#type** | Option<[**Vec<String>**](String.md)> | Make sure that Rust keywords like type work as query params | |
### Return type

View File

@ -150,7 +150,7 @@ pub fn delete_pet(configuration: &configuration::Configuration, pet_id: i64, api
}
/// Multiple status values can be provided with comma separated strings
pub fn find_pets_by_status(configuration: &configuration::Configuration, status: Vec<String>) -> Result<Vec<models::FooPet>, Error<FindPetsByStatusError>> {
pub fn find_pets_by_status(configuration: &configuration::Configuration, status: Vec<String>, r#type: Option<Vec<String>>) -> Result<Vec<models::FooPet>, Error<FindPetsByStatusError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
@ -162,6 +162,12 @@ pub fn find_pets_by_status(configuration: &configuration::Configuration, status:
"multi" => local_var_req_builder.query(&status.into_iter().map(|p| ("status".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => local_var_req_builder.query(&[("status", &status.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
if let Some(ref local_var_str) = r#type {
local_var_req_builder = match "csv" {
"multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("type".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => local_var_req_builder.query(&[("type", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}

View File

@ -78,7 +78,7 @@ Name | Type | Description | Required | Notes
## find_pets_by_status
> Vec<models::Pet> find_pets_by_status(status)
> Vec<models::Pet> find_pets_by_status(status, r#type)
Finds Pets by status
Multiple status values can be provided with comma separated strings
@ -89,6 +89,7 @@ Multiple status values can be provided with comma separated strings
Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**status** | [**Vec<String>**](String.md) | Status values that need to be considered for filter | [required] |
**r#type** | Option<[**Vec<String>**](String.md)> | Make sure that Rust keywords like type work as query params | |
### Return type

View File

@ -150,7 +150,7 @@ pub fn delete_pet(configuration: &configuration::Configuration, pet_id: i64, api
}
/// Multiple status values can be provided with comma separated strings
pub fn find_pets_by_status(configuration: &configuration::Configuration, status: Vec<String>) -> Result<Vec<models::Pet>, Error<FindPetsByStatusError>> {
pub fn find_pets_by_status(configuration: &configuration::Configuration, status: Vec<String>, r#type: Option<Vec<String>>) -> Result<Vec<models::Pet>, Error<FindPetsByStatusError>> {
let local_var_configuration = configuration;
let local_var_client = &local_var_configuration.client;
@ -162,6 +162,12 @@ pub fn find_pets_by_status(configuration: &configuration::Configuration, status:
"multi" => local_var_req_builder.query(&status.into_iter().map(|p| ("status".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => local_var_req_builder.query(&[("status", &status.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
if let Some(ref local_var_str) = r#type {
local_var_req_builder = match "csv" {
"multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("type".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => local_var_req_builder.query(&[("type", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}