forked from googleapis/google-api-nodejs-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmethod-partial.js
More file actions
44 lines (43 loc) · 1.8 KB
/
Copy pathmethod-partial.js
File metadata and controls
44 lines (43 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{% set lb = "{" %}
{% set rb = "}" %}
{%- set pathParams = m.parameters|getPathParams -%}
/**
* {{ m.id }}
*
* {% if m.description %}@desc {{ m.description|oneLine|cleanComments|safe }}{% endif %}
*
* @alias {{ m.id }}
* @memberOf! {{ name }}({{ version }})
*
* @param {object{% if !m.parameterOrder && !m.request %}={% endif %}} params - Parameters for request
{% for pname, p in m.parameters -%}
* @param {{ lb }}{{ p.type }}{% if ! p.required %}={% endif %}{{ rb }} params.{{ pname|getSafeParamName }} - {{ p.description|oneLine|cleanComments|safe }}
{% endfor -%}
{% if m.supportsMediaUpload -%}
{% if m.request -%}
* @param {object} params.resource - Media resource metadata
{% endif -%}
* @param {object} params.media - Media object
* @param {string} params.media.mimeType - Media mime-type
* @param {string|object} params.media.body - Media body contents
{% elif m.request -%}
* @param {object} params.resource - Request body data
{% endif -%}
* @param {callback} callback - The callback that handles the response.
* @return {object} Request object
*/
{% if globalmethods %}this.{{ mname }} ={% else %}{{ mname }}:{% endif %} function(params, callback) {
var parameters = {
options: {
url: {{ (rootUrl + servicePath + m.path)|buildurl }},
method: '{{ m.httpMethod }}'
},
params: params,
{%- if m.mediaUpload.protocols.simple.path -%}mediaUrl: {{ [rootUrl, m.mediaUpload.protocols.simple.path]|join('')|buildurl }},{%- endif -%}
requiredParams: [{%- if m.parameterOrder.length -%}'{{ m.parameterOrder|join("', '")|safe }}'{%- endif -%}],
pathParams: [{%- if pathParams.length -%}'{{ pathParams|join("', '")|safe }}'{%- endif -%}],
context: self
};
return createAPIRequest(parameters, callback);
}{%- if globalmethods -%};{%- elif not loop.last -%},
{%- endif -%}