Skip to content

Commit 0d04fb7

Browse files
add generics
1 parent 4231074 commit 0d04fb7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

templates/web/src/sdk.ts.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace Models {
77
/**
88
* {{ definition.description }}
99
*/
10-
export type {{ definition.name | caseUcfirst }} = {
10+
export type {{ definition.name | caseUcfirst }}<{% for property in definition.properties %}{% if spec.definitions[property.sub_schema].additionalProperties %}{{property.sub_schema | caseUcfirst}} extends Models.{{property.sub_schema | caseUcfirst}}{% endif %}{% endfor %}> = {
1111
{% for property in definition.properties %}
1212
/**
1313
* {{ property.description }}
@@ -449,7 +449,7 @@ class {{ spec.title | caseUcfirst }} {
449449
* @returns {% if method.type == 'webAuth' %}{void|string}{% elseif method.type == 'location' %}{URL}{% else %}{Promise}{% endif %}
450450

451451
*/
452-
{{ method.name | caseCamel }}: {% if method.type != 'location' and method.type != 'webAuth'%}async {% endif %}({% for parameter in method.parameters.all %}{{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required %}?{% endif %}: {{ parameter.type | typeName }}{% if not loop.last %}, {% endif %}{% endfor %}): {% if method.type == 'webAuth' %}void | URL{% elseif method.type == 'location' %}URL{% else %}Promise<{% if method.responseModel and method.responseModel != 'any' %}Models.{{method.responseModel | caseUcfirst}}{% else %}{}{% endif %}>{% endif %} => {
452+
{{ method.name | caseCamel }}: {% if method.type != 'location' and method.type != 'webAuth'%}async {% for property in spec.definitions[method.responseModel].properties %}{% if spec.definitions[property.sub_schema].additionalProperties %}<{{property.sub_schema | caseUcfirst}} extends Models.{{property.sub_schema | caseUcfirst}}>{% endif %}{% endfor %}{% endif %}({% for parameter in method.parameters.all %}{{ parameter.name | caseCamel | escapeKeyword }}{% if not parameter.required %}?{% endif %}: {{ parameter.type | typeName }}{% if not loop.last %}, {% endif %}{% endfor %}): {% if method.type == 'webAuth' %}void | URL{% elseif method.type == 'location' %}URL{% else %}Promise<{% if method.responseModel and method.responseModel != 'any' %}Models.{{method.responseModel | caseUcfirst}}{% for property in spec.definitions[method.responseModel].properties %}{% if spec.definitions[property.sub_schema].additionalProperties %}<{{property.sub_schema | caseUcfirst}}>{% endif %}{% endfor %}{% else %}{}{% endif %}>{% endif %} => {
453453
{% for parameter in method.parameters.all %}
454454
{% if parameter.required %}
455455
if (typeof {{ parameter.name | caseCamel | escapeKeyword }} === 'undefined') {

0 commit comments

Comments
 (0)