Skip to content

Commit f458cca

Browse files
committed
chore: add deprecated to ts
1 parent bd87714 commit f458cca

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

templates/node/src/services/template.ts.twig

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,17 @@ export class {{ service.name | caseUcfirst }} {
2727
{%~ for method in service.methods %}
2828
/**
2929
{%~ if method.description %}
30-
* {{ method.description }}
30+
* {{ method.description | replace({'\n': '\n * '}) }}
3131
{%~ endif %}
3232
*
3333
{%~ for parameter in method.parameters.all %}
3434
* @param {{ '{' }}{{ parameter | getPropertyType(method) | raw }}{{ '}' }} {{ parameter.name | caseCamel | escapeKeyword }}
3535
{%~ endfor %}
3636
* @throws {{ '{' }}{{ spec.title | caseUcfirst}}Exception}
3737
* @returns {{ '{' }}{{ method | getReturn(spec) | raw }}{{ '}' }}
38+
{%~ if method.deprecated %}
39+
* @deprecated This API is deprecated and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %}
40+
{%~ endif %}
3841
*/
3942
{{ 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 }} {
4043
{%~ for parameter in method.parameters.all %}
@@ -94,5 +97,8 @@ export class {{ service.name | caseUcfirst }} {
9497
);
9598
{%~ endif %}
9699
}
100+
{% if not loop.last %}
101+
102+
{% endif %}
97103
{%~ endfor %}
98104
}

templates/react-native/src/services/template.ts.twig

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ export class {{ service.name | caseUcfirst }} extends Service {
4141
* @throws {{ '{' }}{{ spec.title | caseUcfirst}}Exception}
4242
* @returns {% if method.type == 'webAuth' %}{void|string}{% elseif method.type == 'location' %}{ArrayBuffer}{% else %}{Promise}{% endif %}
4343

44-
*/
44+
{%~ if method.deprecated %}
45+
* @deprecated This API is deprecated and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %}
46+
{%~ endif %}
47+
*/
4548
{% if method.type == 'upload'%}async {% endif %}{{ 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 }} {
4649
{% for parameter in method.parameters.all %}
4750
{% if parameter.required %}
@@ -187,6 +190,9 @@ export class {{ service.name | caseUcfirst }} extends Service {
187190
{% endfor %}
188191
* @throws {{ '{' }}{{ spec.title | caseUcfirst}}Exception}
189192
* @returns {{ '{' }}URL{{ '}' }}
193+
{%~ if method.deprecated %}
194+
* @deprecated This API is deprecated and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %}
195+
{%~ endif %}
190196
*/
191197
{{ method.name | caseCamel }}URL({% 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 %}): URL {
192198
const apiPath = '{{ method.path }}'{% for parameter in method.parameters.path %}.replace('{{ '{' }}{{ parameter.name | caseCamel | escapeKeyword }}{{ '}' }}', {{ parameter.name | caseCamel | escapeKeyword }}){% endfor %};

templates/web/src/services/template.ts.twig

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,17 @@ export class {{ service.name | caseUcfirst }} {
2828
{%~ for method in service.methods %}
2929
/**
3030
{%~ if method.description %}
31-
* {{ method.description }}
31+
* {{ method.description | replace({'\n': '\n * '}) }}
3232
{%~ endif %}
3333
*
3434
{%~ for parameter in method.parameters.all %}
3535
* @param {{ '{' }}{{ parameter | getPropertyType(method) | raw }}{{ '}' }} {{ parameter.name | caseCamel | escapeKeyword }}
3636
{%~ endfor %}
3737
* @throws {{ '{' }}{{ spec.title | caseUcfirst}}Exception}
3838
* @returns {{ '{' }}{{ method | getReturn(spec) | raw }}{{ '}' }}
39+
{%~ if method.deprecated %}
40+
* @deprecated This API is deprecated and uses outdated terminologies.{% if method.replaceWith %} Please use `{{ method.replaceWith | capitalizeFirst }}` instead.{% endif %}
41+
{%~ endif %}
3942
*/
4043
{{ 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 }} {
4144
{%~ for parameter in method.parameters.all %}
@@ -108,5 +111,8 @@ export class {{ service.name | caseUcfirst }} {
108111
);
109112
{%~ endif %}
110113
}
114+
{% if not loop.last %}
115+
116+
{% endif %}
111117
{%~ endfor %}
112118
}

0 commit comments

Comments
 (0)