@@ -39,7 +39,7 @@ export class {{ service.name | caseUcfirst }} extends Service {
39
39
* @param {{ ' {' }}{{ parameter | getPropertyType(method ) | raw }}{{ ' }' }} {{ parameter .name | caseCamel | escapeKeyword }}
40
40
{% endfor %}
41
41
* @throws {{ ' {' }}{{ spec .title | caseUcfirst }}Exception}
42
- * @returns {% if method .type == ' webAuth' %}{void|string}{% elseif method .type == ' location' %}{URL }{% else %}{Promise}{% endif %}
42
+ * @returns {% if method .type == ' webAuth' %}{void|string}{% elseif method .type == ' location' %}{ArrayBuffer }{% else %}{Promise}{% endif %}
43
43
44
44
*/
45
45
{% 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 }} {
@@ -83,8 +83,6 @@ export class {{ service.name | caseUcfirst }} extends Service {
83
83
{% endif %}
84
84
{% if method .type == ' webAuth' %}
85
85
return uri;
86
- {% elseif method .type == ' location' %}
87
- return uri;
88
86
{% else %}
89
87
{% if ' multipart/form-data' in method .consumes %}
90
88
{% for parameter in method .parameters .all %}
@@ -170,9 +168,46 @@ export class {{ service.name | caseUcfirst }} extends Service {
170
168
{% for key , header in method .headers %}
171
169
'{{ key }}': '{{ header }}',
172
170
{% endfor %}
173
- }, payload);
171
+ }, payload{% if method .type == ' location' %}, 'arrayBuffer'{% endif %});
172
+ {% endif %}
174
173
{% endif %}
174
+ }
175
+ {% endfor %}
176
+ {# Extra methods for just getting the URL of 'location' type methods #}
177
+ {% for method in service .methods %}
178
+ {% if method .type == ' location' %}
179
+
180
+ /**
181
+ {% if method .description %}
182
+ {{ method .description | comment2 }}
175
183
{% endif %}
184
+ *
185
+ {% for parameter in method .parameters .all %}
186
+ * @param {{ ' {' }}{{ parameter | getPropertyType(method ) | raw }}{{ ' }' }} {{ parameter .name | caseCamel | escapeKeyword }}
187
+ {% endfor %}
188
+ * @throws {{ ' {' }}{{ spec .title | caseUcfirst }}Exception}
189
+ * @returns {{ ' {' }}URL{{ ' }' }}
190
+ */
191
+ {{ 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 {
192
+ const apiPath = '{{ method .path }}'{% for parameter in method .parameters .path %}.replace('{{ ' {' }}{{ parameter .name | caseCamel | escapeKeyword }}{{ ' }' }}', {{ parameter .name | caseCamel | escapeKeyword }}){% endfor %};
193
+ const payload: Payload = {};
194
+
195
+ {% for parameter in method .parameters .query %}
196
+ if (typeof {{ parameter .name | caseCamel | escapeKeyword }} !== 'undefined') {
197
+ payload['{{ parameter .name }}'] = {{ parameter .name | caseCamel | escapeKeyword }};
198
+ }
199
+
200
+ {% endfor %}
201
+ {% for parameter in method .parameters .body %}
202
+ if (typeof {{ parameter .name | caseCamel | escapeKeyword }} !== 'undefined') {
203
+ payload['{{ parameter .name }}'] = {{ parameter .name | caseCamel | escapeKeyword }};
204
+ }
205
+
206
+ {% endfor %}
207
+ const uri = new URL(this.client.config.endpoint + apiPath);
208
+
209
+ return uri;
176
210
}
211
+ {% endif %}
177
212
{% endfor %}
178
213
};
0 commit comments