@@ -8,13 +8,20 @@ use super::{Error, configuration, ContentType};
88{ {#operations} }
99{ {#operation} }
1010{ {#vendorExtensions.x-group-parameters} }
11- { {^allParams} }
12- /*
13- { {/allParams} }
11+ { {#allParams} }
12+ { {#-first} }
1413/// struct for passing parameters to the method [`{ {operationId} }`]
1514#[derive(Clone, Debug)]
16- pub struct { {{operationIdCamelCase} }}Params{ {{vendorExtensions.x-rust-params-generic-parameter} }} {
17- {{#allParams} }
15+ pub struct { {{operationIdCamelCase} }}Params{ {!
16+ Iterate through ALL parameters in the operation.
17+ Only the requestBody has this extension defined, so it will print " <B>" .
18+ The other parameters have nothing, so they will print nothing.
19+ This effectively extract the generic parameter from the requestBody
20+ and places it on the struct definition line.
21+ } }{ {#allParams} }
22+ { {{vendorExtensions.x-rust-params-generic-parameter} }}
23+ { {/allParams} } {
24+ {{/-first} }
1825 { {#description} }
1926 /// { {{.} }}
2027 { {/description} }
@@ -32,14 +39,15 @@ pub struct {{{operationIdCamelCase}}}Params{{{vendorExtensions.x-rust-params-gen
3239 ### Models and primative types
3340 } }{ {^isString} }{ {^isUuid} }{ {^isPrimitiveType} }{ {^isContainer} }models::{ {/isContainer} }{ {/isPrimitiveType} }{ {{dataType} }}{ {/isUuid} }{ {/isString} }{ {!
3441 ### Option End
35- } }{ {^required} }>{ {/required} }{ {#required} }{ {#isNullable} }>{ {/isNullable} }{ {/required} },
42+ } }{ {^required} }>{ {/required} }{ {#required} }{ {#isNullable} }>{ {/isNullable} }{ {/required} }{ {!
43+ ### Comma for next arguement
44+ } }{ {^-last} },{ {/-last} }
3645 { {/vendorExtensions.x-rust-type} }
37- { {/allParams } }
46+ { {#-last } }
3847}
39- { {^allParams} }
40- */
41- { {/allParams} }
4248
49+ { {/-last} }
50+ { {/allParams} }
4351{ {/vendorExtensions.x-group-parameters} }
4452{ {/operation} }
4553{ {/operations} }
@@ -97,51 +105,12 @@ pub enum {{{operationIdCamelCase}}}Error {
97105/// { {{.} }}
98106{ {/notes} }
99107{ {#vendorExtensions.x-group-parameters} }
100- pub { {#supportAsync} }async { {/supportAsync} }fn { {{operationId} }}{ {{vendorExtensions.x-rust-generic-parameter} }}(configuration: &configuration::Configuration
101- { {^allParams} }
102- /*
103- { {/allParams} }
104- , params: & { {{operationIdCamelCase} }}Params{ {{vendorExtensions.x-rust-params-generic-parameter} }}
105- { {^allParams} }
106- */
107- { {/allParams} }{ {!
108+ pub { {#supportAsync} }async { {/supportAsync} }fn { {{operationId} }}{ {{vendorExtensions.x-rust-generic-parameter} }}(configuration: &configuration::Configuration{ {#allParams} }{ {#-first} }, { {!
109+ ### Params
110+ } }params: & { {{operationIdCamelCase} }}Params{ {#allParams} }{ {{vendorExtensions.x-rust-params-generic-parameter} }}{ {/allParams} }{ {/-first} }{ {/allParams} }{ {!
108111### Function return type
109112} }) -> Result<{ {#vendorExtensions.x-rust-return-type} }{ {{.} }}{ {/vendorExtensions.x-rust-return-type} }{ {^vendorExtensions.x-rust-return-type} }{ {#isResponseFile} }{ {#supportAsync} }reqwest::Response{ {/supportAsync} }{ {^supportAsync} }reqwest::blocking::Response{ {/supportAsync} }{ {/isResponseFile} }{ {^isResponseFile} }{ {#supportMultipleResponses} }ResponseContent<{ {{operationIdCamelCase} }}Success>{ {/supportMultipleResponses} }{ {^supportMultipleResponses} }{ {^returnType} }(){ {/returnType} }{ {{returnType} }}{ {/supportMultipleResponses} }{ {/isResponseFile} }{ {/vendorExtensions.x-rust-return-type} }, Error<{ {{operationIdCamelCase} }}Error>> {
110113{{/vendorExtensions.x-group-parameters} }
111- { {^vendorExtensions.x-group-parameters} }
112- pub { {#supportAsync} }async { {/supportAsync} }fn { {{operationId} }}{ {{vendorExtensions.x-rust-generic-parameter} }}{ {{vendorExtensions.x-rust-params-generic-parameter} }}(configuration: &configuration::Configuration, { {#allParams} }{ {{paramName} }}: { {!
113- ### Option Start
114- } }{ {^required} }Option<{ {/required} }{ {#required} }{ {#isNullable} }Option<{ {/isNullable} }{ {/required} }{ {!
115- ### &str and Vec< &str>
116- } }{ {#isString} }{ {#isArray} }Vec<{ {/isArray} }{ {^isUuid} }&str{ {/isUuid} }{ {#isArray} }>{ {/isArray} }{ {/isString} }{ {!
117- ### UUIDs
118- } }{ {#isUuid} }{ {#isArray} }Vec<{ {/isArray} }&str{ {#isArray} }>{ {/isArray} }{ {/isUuid} }{ {!
119- ### Models and primative types
120- } }{ {^isString} }{ {^isUuid} }{ {^isPrimitiveType} }{ {^isContainer} }models::{ {/isContainer} }{ {/isPrimitiveType} }{ {{dataType} }}{ {/isUuid} }{ {/isString} }{ {!
121- ### Option End
122- } }{ {^required} }>{ {/required} }{ {#required} }{ {#isNullable} }>{ {/isNullable} }{ {/required} }{ {!
123- ### Comma for next arguement
124- } }{ {^-last} }, { {/-last} }{ {/allParams} }{ {!
125- ### Function return type
126- } }) -> Result<{ {#vendorExtensions.x-rust-return-type} }{ {{vendorExtensions.x-rust-return-type} }}{ {/vendorExtensions.x-rust-return-type} }{ {^vendorExtensions.x-rust-return-type} }{ {!
127- ### Response File Support
128- } }{ {#isResponseFile} }{ {#supportAsync} }reqwest::Response{ {/supportAsync} }{ {^supportAsync} }reqwest::blocking::Response{ {/supportAsync} }{ {/isResponseFile} }{ {!
129- ### Regular Responses
130- } }{ {^isResponseFile} }{ {!
131- ### Multi response support
132- } }{ {#supportMultipleResponses} }ResponseContent<{ {{operationIdCamelCase} }}Success>{ {/supportMultipleResponses} }{ {!
133- ### Regular return type
134- } }{ {^supportMultipleResponses} }{ {^returnType} }(){ {/returnType} }{ {{returnType} }}{ {{vendorExtensions.x-rust-return-type-generic-parameter} }}{ {/supportMultipleResponses} }{ {/isResponseFile} }{ {/vendorExtensions.x-rust-return-type} }{ {!
135- ### Error Type
136- } }, Error<{ {{operationIdCamelCase} }}Error>> {
137- {{#allParams.0} }
138- // add a prefix to parameters to efficiently prevent name collisions
139- { {/allParams.0} }
140- { {#allParams} }
141- let { {{vendorExtensions.x-rust-param-identifier} }} = { {{paramName} }};
142- { {/allParams} }
143- { {/vendorExtensions.x-group-parameters} }
144-
145114 let uri_str = format!("{ } { {{path} }}", configuration.base_path{ {#pathParams} }, { {{baseName} }}={ {#isString} }crate::apis::urlencode(& { {/isString} }{ {{vendorExtensions.x-rust-param-identifier} }}{ {^required} }.unwrap(){ {/required} }{ {#required} }{ {#isNullable} }.unwrap(){ {/isNullable} }{ {/required} }{ {#isArray} }.join(",").as_ref(){ {/isArray} }{ {^isString} }{ {^isUuid} }{ {^isPrimitiveType} }{ {^isContainer} }.to_string(){ {/isContainer} }{ {/isPrimitiveType} }{ {/isUuid} }{ {/isString} }{ {#isString} }){ {/isString} }{ {/pathParams} });
146115 let mut req_builder = configuration.client.request(reqwest::Method::{ {{httpMethod} }}, &uri_str);
147116
@@ -523,4 +492,4 @@ pub {{#supportAsync}}async {{/supportAsync}}fn {{{operationId}}}{{{vendorExtensi
523492}
524493
525494{ {/operation} }
526- { {/operations} }
495+ { {/operations} }
0 commit comments