Skip to content

removed returning await pattern from node templates #1036

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions templates/node/src/services/template.ts.twig
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class {{ service.name | caseUcfirst }} {
* @throws {{ '{' }}{{ spec.title | caseUcfirst}}Exception}
* @returns {{ '{' }}{{ method | getReturn(spec) | raw }}{{ '}' }}
*/
async {{ method.name | caseCamel }}{{ method.responseModel | getGenerics(spec) | raw }}({% for parameter in method.parameters.all %}{{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required or parameter.nullable %}?{% endif %}: {{ parameter | getPropertyType(method) | raw }}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, onProgress = (progress: UploadProgress) => {}{% endif %}): {{ method | getReturn(spec) | raw }} {
{{ method.name | caseCamel }}{{ method.responseModel | getGenerics(spec) | raw }}({% for parameter in method.parameters.all %}{{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required or parameter.nullable %}?{% endif %}: {{ parameter | getPropertyType(method) | raw }}{% if not loop.last %}, {% endif %}{% endfor %}{% if 'multipart/form-data' in method.consumes %}, onProgress = (progress: UploadProgress) => {}{% endif %}): {{ method | getReturn(spec) | raw }} {
{%~ for parameter in method.parameters.all %}
{%~ if parameter.required %}
if (typeof {{ parameter.name | caseCamel | escapeKeyword }} === 'undefined') {
Expand Down Expand Up @@ -68,22 +68,22 @@ export class {{ service.name | caseUcfirst }} {
}

{%~ if method.type == 'webAuth' %}
return await this.client.redirect(
return this.client.redirect(
'{{ method.method | caseLower }}',
uri,
apiHeaders,
payload
);
{%~ elseif 'multipart/form-data' in method.consumes %}
return await this.client.chunkedUpload(
return this.client.chunkedUpload(
'{{ method.method | caseLower }}',
uri,
apiHeaders,
payload,
onProgress
);
{%~ else %}
return await this.client.call(
return this.client.call(
'{{ method.method | caseLower }}',
uri,
apiHeaders,
Expand Down
4 changes: 2 additions & 2 deletions templates/react-native/src/services/template.ts.twig
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export class {{ service.name | caseUcfirst }} extends Service {
const size = {{ parameter.name | caseCamel | escapeKeyword }}.size;

if (size <= Service.CHUNK_SIZE) {
return await this.client.call('{{ method.method | caseLower }}', uri, {
return this.client.call('{{ method.method | caseLower }}', uri, {
{% for parameter in method.parameters.header %}
'{{ parameter.name | caseCamel | escapeKeyword }}': this.client.${{ parameter.name | caseCamel | escapeKeyword }},
{% endfor %}
Expand Down Expand Up @@ -163,7 +163,7 @@ export class {{ service.name | caseUcfirst }} extends Service {
{% endif %}
{% endfor %}
{% else %}
return await this.client.call('{{ method.method | caseLower }}', uri, {
return this.client.call('{{ method.method | caseLower }}', uri, {
{% for parameter in method.parameters.header %}
'{{ parameter.name | caseCamel | escapeKeyword }}': this.client.${{ parameter.name | caseCamel | escapeKeyword }},
{% endfor %}
Expand Down
4 changes: 2 additions & 2 deletions templates/web/src/services/template.ts.twig
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ export class {{ service.name | caseUcfirst }} {
{%~ elseif method.type == 'location' %}
return uri.toString();
{%~ elseif 'multipart/form-data' in method.consumes %}
return await this.client.chunkedUpload(
return this.client.chunkedUpload(
'{{ method.method | caseLower }}',
uri,
apiHeaders,
payload,
onProgress
);
{%~ else %}
return await this.client.call(
return this.client.call(
'{{ method.method | caseLower }}',
uri,
apiHeaders,
Expand Down