Skip to content

Commit b839970

Browse files
authored
chore: update template to use custom return types (#195)
PR: #195
1 parent bdcc50c commit b839970

File tree

1 file changed

+13
-13
lines changed
  • customizations/generator/openapi/src/main/resources/templates/expediagroup-sdk

1 file changed

+13
-13
lines changed

customizations/generator/openapi/src/main/resources/templates/expediagroup-sdk/client.mustache

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,12 @@ class {{clientClassname}}Client private constructor(clientConfiguration: RapidCl
113113
* @throws ExpediaGroupApi{{.}}Exception
114114
{{/dataTypes}}
115115
{{/exceptionDataTypes}}
116-
* @return a [Response] object with a body of type {{{returnType}}}{{^returnType}}Nothing{{/returnType}}
116+
* @return a [Response] object with a body of type {{#customReturnType}}{{{returnType}}}{{/customReturnType}}{{^returnType}}Nothing{{/returnType}}
117117
*/
118-
fun execute(operation: {{operationIdCamelCase}}Operation) : {{#returnType}}Response<{{{returnType}}}>{{/returnType}}{{^returnType}}EmptyResponse{{/returnType}} {
119-
{{#returnType}}
118+
fun execute(operation: {{operationIdCamelCase}}Operation) : {{#customReturnType}}Response<{{{returnType}}}>{{/customReturnType}}{{^returnType}}EmptyResponse{{/returnType}} {
119+
{{#customReturnType}}
120120
return execute<{{#bodyParam}}{{dataType}}{{/bodyParam}}{{^hasBodyParam}}Nothing{{/hasBodyParam}}, {{{returnType}}}>(operation)
121-
{{/returnType}}
121+
{{/customReturnType}}
122122
{{^returnType}}
123123
return executeWithEmptyResponse<{{#bodyParam}}{{dataType}}{{/bodyParam}}{{^hasBodyParam}}Nothing{{/hasBodyParam}}>(operation)
124124
{{/returnType}}
@@ -133,18 +133,18 @@ class {{clientClassname}}Client private constructor(clientConfiguration: RapidCl
133133
* @throws ExpediaGroupApi{{.}}Exception
134134
{{/dataTypes}}
135135
{{/exceptionDataTypes}}
136-
* @return a [CompletableFuture<Response>] object with a body of type {{{returnType}}}{{^returnType}}Nothing{{/returnType}}
136+
* @return a [CompletableFuture<Response>] object with a body of type {{#customReturnType}}{{{returnType}}}{{/customReturnType}}{{^returnType}}Nothing{{/returnType}}
137137
*/
138-
fun executeAsync(operation: {{operationIdCamelCase}}Operation) : CompletableFuture<{{#returnType}}Response<{{{returnType}}}>{{/returnType}}{{^returnType}}EmptyResponse{{/returnType}}> {
139-
{{#returnType}}
138+
fun executeAsync(operation: {{operationIdCamelCase}}Operation) : CompletableFuture<{{#customReturnType}}Response<{{{returnType}}}>{{/customReturnType}}{{^returnType}}EmptyResponse{{/returnType}}> {
139+
{{#customReturnType}}
140140
return executeAsync<{{#bodyParam}}{{dataType}}{{/bodyParam}}{{^hasBodyParam}}Nothing{{/hasBodyParam}}, {{{returnType}}}>(operation)
141-
{{/returnType}}
141+
{{/customReturnType}}
142142
{{^returnType}}
143143
return executeAsyncWithEmptyResponse<{{#bodyParam}}{{dataType}}{{/bodyParam}}{{^hasBodyParam}}Nothing{{/hasBodyParam}}>(operation)
144144
{{/returnType}}
145145
}
146146

147-
private suspend {{^isKotlin}}inline {{/isKotlin}}fun {{^isKotlin}}k{{/isKotlin}}{{operationId}}WithResponse({{>client/apiParamsDecleration}}): {{#returnType}}Response<{{{returnType}}}>{{/returnType}}{{^returnType}}Response<Nothing>{{/returnType}} {
147+
private suspend {{^isKotlin}}inline {{/isKotlin}}fun {{^isKotlin}}k{{/isKotlin}}{{operationId}}WithResponse({{>client/apiParamsDecleration}}): {{#customReturnType}}Response<{{{returnType}}}>{{/customReturnType}}{{^returnType}}Response<Nothing>{{/returnType}} {
148148
{{#hasNonBodyParams}}
149149
val params = {{operationIdCamelCase}}OperationParams(
150150
{{#nonBodyParams}}
@@ -179,7 +179,7 @@ class {{clientClassname}}Client private constructor(clientConfiguration: RapidCl
179179
* @throws ExpediaGroupApi{{.}}Exception
180180
{{/dataTypes}}
181181
{{/exceptionDataTypes}}
182-
* @return {{{returnType}}}{{^returnType}}Nothing{{/returnType}}
182+
* @return {{#customReturnType}}{{{returnType}}}{{/customReturnType}}{{^returnType}}Nothing{{/returnType}}
183183
*/
184184
@Throws(
185185
{{#exceptionDataTypes}}
@@ -191,7 +191,7 @@ class {{clientClassname}}Client private constructor(clientConfiguration: RapidCl
191191
)
192192
@JvmOverloads
193193
@Deprecated("Use execute method instead", ReplaceWith("execute(operation: {{operationIdCamelCase}}Operation)"))
194-
fun {{operationId}}({{>client/apiParamsDecleration}}) : {{{returnType}}}{{^returnType}}Nothing{{/returnType}} {
194+
fun {{operationId}}({{>client/apiParamsDecleration}}) : {{#customReturnType}}{{{returnType}}}{{/customReturnType}}{{^returnType}}Nothing{{/returnType}} {
195195
return {{operationId}}WithResponse({{>client/apiParamsPassed}}).data
196196
}
197197

@@ -206,7 +206,7 @@ class {{clientClassname}}Client private constructor(clientConfiguration: RapidCl
206206
* @throws ExpediaGroupApi{{.}}Exception
207207
{{/dataTypes}}
208208
{{/exceptionDataTypes}}
209-
* @return a [Response] object with a body of type {{{returnType}}}{{^returnType}}Nothing{{/returnType}}
209+
* @return a [Response] object with a body of type {{#customReturnType}}{{{returnType}}}{{/customReturnType}}{{^returnType}}Nothing{{/returnType}}
210210
*/
211211
@Throws(
212212
{{#exceptionDataTypes}}
@@ -218,7 +218,7 @@ class {{clientClassname}}Client private constructor(clientConfiguration: RapidCl
218218
)
219219
@JvmOverloads
220220
@Deprecated("Use execute method instead", ReplaceWith("execute(operation: {{operationIdCamelCase}}Operation)"))
221-
fun {{operationId}}WithResponse({{>client/apiParamsDecleration}}) : {{#returnType}}Response<{{{returnType}}}>{{/returnType}}{{^returnType}}Response<Nothing>{{/returnType}} {
221+
fun {{operationId}}WithResponse({{>client/apiParamsDecleration}}) : {{#customReturnType}}Response<{{{returnType}}}>{{/customReturnType}}{{^returnType}}Response<Nothing>{{/returnType}} {
222222
try {
223223
return GlobalScope.future(Dispatchers.IO) {
224224
k{{operationId}}WithResponse({{>client/apiParamsPassed}})

0 commit comments

Comments
 (0)