Skip to content

Commit ee61e2d

Browse files
committed
Use returnProperty to generate void method
1 parent 8247c4f commit ee61e2d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

templates-v7/typescript/api/api.mustache

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ export class {{classname}} extends Service {
4040
const endpoint = `${this.baseUrl}{{{path}}}`{{#pathParams}}
4141
.replace("{" + "{{baseName}}" + "}", encodeURIComponent(String({{paramName}}))){{/pathParams}};
4242
const resource = new Resource(this, endpoint);
43+
4344
{{#bodyParam}}
4445
const request: {{{dataType}}} = ObjectSerializer.serialize({{paramName}}, "{{{dataType}}}", "");
4546
{{/bodyParam}}
@@ -53,14 +54,15 @@ export class {{classname}} extends Service {
5354
{{/queryParams}}
5455
}
5556
{{/hasQueryParams}}
56-
{{#hasProduces}}const response = {{/hasProduces}}await getJsonResponse<{{#bodyParam}}{{{dataType}}}{{/bodyParam}}{{^bodyParam}}string{{/bodyParam}}, {{#returnType}}{{{.}}}{{/returnType}}{{^returnType}}void{{/returnType}}>(
57+
{{#returnProperty}}const response = {{/returnProperty}}await getJsonResponse<{{#bodyParam}}{{{dataType}}}{{/bodyParam}}{{^bodyParam}}string{{/bodyParam}}, {{#returnType}}{{{.}}}{{/returnType}}{{^returnType}}void{{/returnType}}>(
5758
resource,
5859
{{#bodyParam}}request{{/bodyParam}}{{^bodyParam}}""{{/bodyParam}},
5960
{ ...requestOptions, method: "{{httpMethod}}" }
6061
);
61-
{{#hasProduces}}
62+
{{#returnProperty}}
63+
6264
return ObjectSerializer.deserialize(response, "{{{returnType}}}", "");
63-
{{/hasProduces}}
65+
{{/returnProperty}}
6466
}
6567

6668
{{/operation}}

0 commit comments

Comments
 (0)