@@ -20,25 +20,26 @@ var (
20
20
21
21
type { {classname} }Service service
22
22
{ {#operation} }
23
-
24
- /*
23
+ { {#contents} }
24
+ { {#@first} }
25
+ /*
25
26
{ {{classname} }}Service{ {#summary} } { {.} }{ {/summary} }{ {#notes} }
26
27
{ {notes} }{ {/notes} }
27
28
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
28
- { {#allParams } }{ {#required} } * @param { {paramName} }{ {#description} } { {.} }{ {/description} }
29
- { {/required} }{ {/allParams } }{ {#hasOptionalParams} } * @param optional nil or *{ {{classname} }}{ {{nickname} }}Opts - Optional Parameters:
30
- { {#allParams } }{ {^required} } * @param "{ {vendorExtensions.x-exportParamName} }" ({ {#isPrimitiveType} }optional.{ {vendorExtensions.x-optionalDataType} }{ {/isPrimitiveType} }{ {^isPrimitiveType} }optional.Interface of { {dataType} }{ {/isPrimitiveType} }) - { {#description} } { {.} }{ {/description} }
31
- { {/required} }{ {/allParams } }{ {/hasOptionalParams} }
29
+ { {#parameters } }{ {#required} } * @param { {paramName} }{ {#description} } { {.} }{ {/description} }
30
+ { {/required} }{ {/parameters } }{ {#hasOptionalParams} } * @param optional nil or *{ {{classname} }}{ {{nickname} }}Opts - Optional Parameters:
31
+ { {#parameters } }{ {^required} } * @param "{ {vendorExtensions.x-exportParamName} }" ({ {#isPrimitiveType} }optional.{ {vendorExtensions.x-optionalDataType} }{ {/isPrimitiveType} }{ {^isPrimitiveType} }optional.Interface of { {dataType} }{ {/isPrimitiveType} }) - { {#description} } { {.} }{ {/description} }
32
+ { {/required} }{ {/parameters } }{ {/hasOptionalParams} }
32
33
{ {#returnType} }@return { {{returnType} }}{ {/returnType} }
33
34
*/
34
35
{ {#hasOptionalParams} }
35
36
36
- type { {{classname} }}{ {{nickname} }}Opts struct { {{#allParams } }{ {^required} }
37
- { {#isPrimitiveType} } { {vendorExtensions.x-exportParamName} } optional.{ {vendorExtensions.x-optionalDataType} }{ {/isPrimitiveType} }{ {^isPrimitiveType} } { {vendorExtensions.x-exportParamName} } optional.Interface{ {/isPrimitiveType} }{ {/required} }{ {/allParams } }
37
+ type { {{classname} }}{ {{nickname} }}Opts struct { {{#parameters } }{ {^required} }
38
+ { {#isPrimitiveType} } { {vendorExtensions.x-exportParamName} } optional.{ {vendorExtensions.x-optionalDataType} }{ {/isPrimitiveType} }{ {^isPrimitiveType} } { {vendorExtensions.x-exportParamName} } optional.Interface{ {/isPrimitiveType} }{ {/required} }{ {/parameters } }
38
39
}
39
40
40
41
{ {/hasOptionalParams} }
41
- func (a *{ {{classname} }}Service) { {{nickname} }}(ctx context.Context{ {#hasParams} }, { {/hasParams} }{ {#allParams } }{ {#required} }{ {paramName} } { {{dataType} }}{ {#hasMore} }, { {/hasMore} }{ {/required} }{ {/allParams } }{ {#hasOptionalParams} }localVarOptionals *{ {{classname} }}{ {{nickname} }}Opts{ {/hasOptionalParams} }) ({ {#returnType} }{ {{returnType} }}, { {/returnType} }*http.Response, error) {
42
+ func (a *{ {{classname} }}Service) { {{nickname} }}(ctx context.Context{ {#hasParams} }, { {/hasParams} }{ {#parameters } }{ {#required} }{ {paramName} } { {{dataType} }}{ {#hasMore} }, { {/hasMore} }{ {/required} }{ {/parameters } }{ {#hasOptionalParams} }localVarOptionals *{ {{classname} }}{ {{nickname} }}Opts{ {/hasOptionalParams} }) ({ {#returnType} }{ {{returnType} }}, { {/returnType} }*http.Response, error) {
42
43
var (
43
44
localVarHttpMethod = strings.ToUpper(" {{httpMethod}}" )
44
45
localVarPostBody interface{}
@@ -54,7 +55,7 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}
54
55
localVarHeaderParams := make(map[string]string)
55
56
localVarQueryParams := url.Values{ }
56
57
localVarFormParams := url.Values{ }
57
- { {#allParams } }
58
+ { {#parameters } }
58
59
{ {#required} }
59
60
{ {#minItems} }
60
61
if len({ {paramName} }) < { {minItems} } {
@@ -99,7 +100,7 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}
99
100
}
100
101
{ {/maximum} }
101
102
{ {/required} }
102
- { {/allParams } }
103
+ { {/parameters } }
103
104
104
105
{ {#hasQueryParams} }
105
106
{ {#queryParams} }
@@ -115,7 +116,7 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}
115
116
{ {/hasQueryParams} }
116
117
// to determine the Content-Type header
117
118
{ {=<% %>= } }
118
- localVarHttpContentTypes := []string{ <% #consumes%> " <%&mediaType%>" <% ^- last%> , <% /- last%><% /consumes%> }
119
+ localVarHttpContentTypes := []string{ <% #consumes%> " <%&mediaType%>" <% ^@ last%> , <% /@ last%><% /consumes%> }
119
120
<%={ { } }=%>
120
121
121
122
// set Content-Type header
@@ -126,7 +127,7 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}
126
127
127
128
// to determine the Accept header
128
129
{ {=<% %>= } }
129
- localVarHttpHeaderAccepts := []string{ <% #produces%> " <%&mediaType%>" <% ^- last%> , <% /- last%><% /produces%> }
130
+ localVarHttpHeaderAccepts := []string{ <% #produces%> " <%&mediaType%>" <% ^@ last%> , <% /@ last%><% /produces%> }
130
131
<%={ { } }=%>
131
132
132
133
// set Accept header
@@ -189,10 +190,7 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}
189
190
{ {^required} }
190
191
if localVarOptionals != nil && localVarOptionals.{ {vendorExtensions.x-exportParamName} }.IsSet() {
191
192
{{#isPrimitiveType} }localVarPostBody = &localVarOptionals.{ {vendorExtensions.x-exportParamName} }.Value(){ {/isPrimitiveType} }
192
- { {^isPrimitiveType} }localVarOptional{ {vendorExtensions.x-exportParamName} }, localVarOptional{ {vendorExtensions.x-exportParamName} }ok := localVarOptionals.{ {vendorExtensions.x-exportParamName} }.Value().({ {{dataType} }})
193
- if !localVarOptional{ {vendorExtensions.x-exportParamName} }ok {
194
- return {{#returnType} }localVarReturnValue, { {/returnType} }nil, reportError("{ {paramName} } should be { {dataType} }")
195
- }
193
+ { {^isPrimitiveType} }localVarOptional{ {vendorExtensions.x-exportParamName} }:= localVarOptionals.{ {vendorExtensions.x-exportParamName} }.Value()
196
194
localVarPostBody = &localVarOptional{ {vendorExtensions.x-exportParamName} }{ {/isPrimitiveType} }
197
195
}
198
196
{ {/required} }
@@ -263,4 +261,4 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}
263
261
264
262
return { {#returnType} }localVarReturnValue, { {/returnType} }localVarHttpResponse, nil
265
263
}
266
- { {/operation} }{ {/operations} }
264
+ { {/@first } } { {/contents } } { {/ operation} }{ {/operations} }
0 commit comments