This repository was archived by the owner on May 22, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtests.dot
More file actions
39 lines (35 loc) · 2.23 KB
/
tests.dot
File metadata and controls
39 lines (35 loc) · 2.23 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
/* This is stub file for gapi.client.{{=it.name}} definition tests */
/* IMPORTANT.
* This file was automatically generated by https://github.com/Bolisov/google-api-typings-generator. Please do not edit it manually.
* In case of any problems please post issue to https://github.com/Bolisov/google-api-typings-generator
**/
gapi.load('client', () => {
// now we can use gapi.client
gapi.client.load('{{=it.name}}', '{{=it.version}}', () => {
// now we can use gapi.client.{{=it.name}}
{{? it.auth }}
// don't forget to authenticate your client before sending any request to resources:
// declare client_id registered in Google Developers Console
const client_id = '<<PUT YOUR CLIENT ID HERE>>';
const scope = [ {{ for(var scope in it.auth.oauth2.scopes) { }}
// {{=it.auth.oauth2.scopes[scope].description}}
'{{=scope}}',
{{ } }} ];
const immediate = true;
gapi.auth.authorize({ client_id, scope, immediate }, authResult => {
if (authResult && !authResult.error) {
/* handle succesfull authorization */
run();
} else {
/* handle authorization error */
}
}); {{?}}{{? !it.auth }}
run();
{{?}}
});
async function run() { {{ for(var resource in it.resources) { }}{{ for(var method in it.resources[resource].methods) { }}
{{? it.resources[resource].methods[method].description }}{{ for(var comment of it.resources[resource].methods[method].description.split(/\r\n|\r|\n|\u000a\u000d|\u000a|\u000d|\u240a/g)) { }}
// {{=comment}}{{ } }}{{?}}
await gapi.client.{{=resource}}.{{=method}}({ {{ for(var parameter in it.resources[resource].methods[method].parameters) { }}{{? it.resources[resource].methods[method].parameters[parameter].required }}{{=it.formatPropertyName(parameter) }}: {{? it.resources[resource].methods[method].parameters[parameter].type === 'integer'}}1{{?}}{{? it.resources[resource].methods[method].parameters[parameter].type === 'string'}}"{{=parameter}}"{{?}}{{? it.resources[resource].methods[method].parameters[parameter].type === 'boolean'}}false{{?}}, {{?}}{{ } }} });{{ }}}{{ }}}
}
});