@maxim_mazurok/gapi.client.script-v1 0.0.20231105 → 0.0.20231126

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@maxim_mazurok/gapi.client.script-v1",
3
- "version": "0.0.20231105",
3
+ "version": "0.0.20231126",
4
4
  "description": "TypeScript typings for Apps Script API v1",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/Maxim-Mazurok/google-api-typings-generator.git"
8
+ },
5
9
  "license": "MIT",
6
10
  "author": {
7
- "email": "maxim@mazurok.com",
8
11
  "name": "Maxim Mazurok",
12
+ "email": "maxim@mazurok.com",
9
13
  "url": "https://maxim.mazurok.com"
10
14
  },
11
- "repository": {
12
- "type": "git",
13
- "url": "https://github.com/Maxim-Mazurok/google-api-typings-generator.git"
14
- },
15
15
  "types": "index.d.ts",
16
16
  "dependencies": {
17
17
  "@types/gapi.client": "*",
package/readme.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # TypeScript typings for Apps Script API v1
2
2
 
3
- Manages and executes Google Apps Script projects.
3
+ Manages and executes Google Apps Script projects.
4
4
  For detailed description please check [documentation](https://developers.google.com/apps-script/api/).
5
5
 
6
6
  ## Installing
@@ -25,10 +25,13 @@ gapi.load('client', () => {
25
25
  Then load api client wrapper:
26
26
 
27
27
  ```typescript
28
- gapi.client.load('https://script.googleapis.com/$discovery/rest?version=v1', () => {
29
- // now we can use:
30
- // gapi.client.script
31
- });
28
+ gapi.client.load(
29
+ 'https://script.googleapis.com/$discovery/rest?version=v1',
30
+ () => {
31
+ // now we can use:
32
+ // gapi.client.script
33
+ }
34
+ );
32
35
  ```
33
36
 
34
37
  ```typescript
@@ -45,115 +48,115 @@ Don't forget to authenticate your client before sending any request to resources
45
48
  // declare client_id registered in Google Developers Console
46
49
  var client_id = '',
47
50
  scope = [
48
- // Read, compose, send, and permanently delete all your email from Gmail
49
- 'https://mail.google.com/',
51
+ // Read, compose, send, and permanently delete all your email from Gmail
52
+ 'https://mail.google.com/',
50
53
 
51
- // See, edit, share, and permanently delete all the calendars you can access using Google Calendar
52
- 'https://www.google.com/calendar/feeds',
54
+ // See, edit, share, and permanently delete all the calendars you can access using Google Calendar
55
+ 'https://www.google.com/calendar/feeds',
53
56
 
54
- // See, edit, download, and permanently delete your contacts
55
- 'https://www.google.com/m8/feeds',
57
+ // See, edit, download, and permanently delete your contacts
58
+ 'https://www.google.com/m8/feeds',
56
59
 
57
- // View and manage the provisioning of groups on your domain
58
- 'https://www.googleapis.com/auth/admin.directory.group',
60
+ // View and manage the provisioning of groups on your domain
61
+ 'https://www.googleapis.com/auth/admin.directory.group',
59
62
 
60
- // View and manage the provisioning of users on your domain
61
- 'https://www.googleapis.com/auth/admin.directory.user',
63
+ // View and manage the provisioning of users on your domain
64
+ 'https://www.googleapis.com/auth/admin.directory.user',
62
65
 
63
- // See, edit, create, and delete all your Google Docs documents
64
- 'https://www.googleapis.com/auth/documents',
66
+ // See, edit, create, and delete all your Google Docs documents
67
+ 'https://www.googleapis.com/auth/documents',
65
68
 
66
- // See, edit, create, and delete all of your Google Drive files
67
- 'https://www.googleapis.com/auth/drive',
69
+ // See, edit, create, and delete all of your Google Drive files
70
+ 'https://www.googleapis.com/auth/drive',
68
71
 
69
- // View and manage your forms in Google Drive
70
- 'https://www.googleapis.com/auth/forms',
72
+ // View and manage your forms in Google Drive
73
+ 'https://www.googleapis.com/auth/forms',
71
74
 
72
- // View and manage forms that this application has been installed in
73
- 'https://www.googleapis.com/auth/forms.currentonly',
75
+ // View and manage forms that this application has been installed in
76
+ 'https://www.googleapis.com/auth/forms.currentonly',
74
77
 
75
- // View and manage your Google Groups
76
- 'https://www.googleapis.com/auth/groups',
78
+ // View and manage your Google Groups
79
+ 'https://www.googleapis.com/auth/groups',
77
80
 
78
- // Create and update Google Apps Script deployments
79
- 'https://www.googleapis.com/auth/script.deployments',
81
+ // Create and update Google Apps Script deployments
82
+ 'https://www.googleapis.com/auth/script.deployments',
80
83
 
81
- // View Google Apps Script deployments
82
- 'https://www.googleapis.com/auth/script.deployments.readonly',
84
+ // View Google Apps Script deployments
85
+ 'https://www.googleapis.com/auth/script.deployments.readonly',
83
86
 
84
- // View Google Apps Script project's metrics
85
- 'https://www.googleapis.com/auth/script.metrics',
87
+ // View Google Apps Script project's metrics
88
+ 'https://www.googleapis.com/auth/script.metrics',
86
89
 
87
- // View Google Apps Script processes
88
- 'https://www.googleapis.com/auth/script.processes',
90
+ // View Google Apps Script processes
91
+ 'https://www.googleapis.com/auth/script.processes',
89
92
 
90
- // Create and update Google Apps Script projects
91
- 'https://www.googleapis.com/auth/script.projects',
93
+ // Create and update Google Apps Script projects
94
+ 'https://www.googleapis.com/auth/script.projects',
92
95
 
93
- // View Google Apps Script projects
94
- 'https://www.googleapis.com/auth/script.projects.readonly',
96
+ // View Google Apps Script projects
97
+ 'https://www.googleapis.com/auth/script.projects.readonly',
95
98
 
96
- // See, edit, create, and delete all your Google Sheets spreadsheets
97
- 'https://www.googleapis.com/auth/spreadsheets',
99
+ // See, edit, create, and delete all your Google Sheets spreadsheets
100
+ 'https://www.googleapis.com/auth/spreadsheets',
98
101
 
99
- // See your primary Google Account email address
100
- 'https://www.googleapis.com/auth/userinfo.email',
101
- ],
102
- immediate = true;
102
+ // See your primary Google Account email address
103
+ 'https://www.googleapis.com/auth/userinfo.email',
104
+ ],
105
+ immediate = true;
103
106
  // ...
104
107
 
105
108
  gapi.auth.authorize(
106
- { client_id: client_id, scope: scope, immediate: immediate },
109
+ {client_id: client_id, scope: scope, immediate: immediate},
107
110
  authResult => {
108
111
  if (authResult && !authResult.error) {
109
- /* handle successful authorization */
112
+ /* handle successful authorization */
110
113
  } else {
111
- /* handle authorization error */
114
+ /* handle authorization error */
112
115
  }
113
- });
116
+ }
117
+ );
114
118
  ```
115
119
 
116
120
  After that you can use Apps Script API resources: <!-- TODO: make this work for multiple namespaces -->
117
121
 
118
122
  ```typescript
119
-
120
123
  /*
121
124
  List information about processes made by or on behalf of a user, such as process type and current status.
122
125
  */
123
- await gapi.client.script.processes.list({ });
126
+ await gapi.client.script.processes.list({});
124
127
 
125
128
  /*
126
129
  List information about a script's executed processes, such as process type and current status.
127
130
  */
128
- await gapi.client.script.processes.listScriptProcesses({ });
131
+ await gapi.client.script.processes.listScriptProcesses({});
129
132
 
130
133
  /*
131
134
  Creates a new, empty script project with no script files and a base manifest file.
132
135
  */
133
- await gapi.client.script.projects.create({ });
136
+ await gapi.client.script.projects.create({});
134
137
 
135
138
  /*
136
139
  Gets a script project's metadata.
137
140
  */
138
- await gapi.client.script.projects.get({ scriptId: "scriptId", });
141
+ await gapi.client.script.projects.get({scriptId: 'scriptId'});
139
142
 
140
143
  /*
141
144
  Gets the content of the script project, including the code source and metadata for each script file.
142
145
  */
143
- await gapi.client.script.projects.getContent({ scriptId: "scriptId", });
146
+ await gapi.client.script.projects.getContent({scriptId: 'scriptId'});
144
147
 
145
148
  /*
146
149
  Get metrics data for scripts, such as number of executions and active users.
147
150
  */
148
- await gapi.client.script.projects.getMetrics({ scriptId: "scriptId", });
151
+ await gapi.client.script.projects.getMetrics({scriptId: 'scriptId'});
149
152
 
150
153
  /*
151
154
  Updates the content of the specified script project. This content is stored as the HEAD version, and is used when the script is executed as a trigger, in the script editor, in add-on preview mode, or as a web app or Apps Script API in development mode. This clears all the existing files in the project.
152
155
  */
153
- await gapi.client.script.projects.updateContent({ scriptId: "scriptId", });
156
+ await gapi.client.script.projects.updateContent({scriptId: 'scriptId'});
154
157
 
155
158
  /*
156
159
  Runs a function in an Apps Script project. The script project must be deployed for use with the Apps Script API and the calling application must share the same Cloud Platform project. This method requires authorization with an OAuth 2.0 token that includes at least one of the scopes listed in the [Authorization](#authorization-scopes) section; script projects that do not require authorization cannot be executed through this API. To find the correct scopes to include in the authentication token, open the script project **Overview** page and scroll down to "Project OAuth Scopes." The error `403, PERMISSION_DENIED: The caller does not have permission` indicates that the Cloud Platform project used to authorize the request is not the same as the one used by the script.
157
160
  */
158
- await gapi.client.script.scripts.run({ scriptId: "scriptId", });
161
+ await gapi.client.script.scripts.run({scriptId: 'scriptId'});
159
162
  ```
package/tests.ts DELETED
@@ -1,223 +0,0 @@
1
- /* This is stub file for gapi.client.script-v1 definition tests */
2
- // IMPORTANT
3
- // This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually.
4
- // In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator
5
-
6
- // Revision: 20231105
7
-
8
- gapi.load('client', async () => {
9
- /** now we can use gapi.client */
10
-
11
- await gapi.client.load('https://script.googleapis.com/$discovery/rest?version=v1');
12
- /** now we can use gapi.client.script */
13
-
14
- /** don't forget to authenticate your client before sending any request to resources: */
15
- /** declare client_id registered in Google Developers Console */
16
- const client_id = '<<PUT YOUR CLIENT ID HERE>>';
17
- const scope = [
18
- /** Read, compose, send, and permanently delete all your email from Gmail */
19
- 'https://mail.google.com/',
20
- /** See, edit, share, and permanently delete all the calendars you can access using Google Calendar */
21
- 'https://www.google.com/calendar/feeds',
22
- /** See, edit, download, and permanently delete your contacts */
23
- 'https://www.google.com/m8/feeds',
24
- /** View and manage the provisioning of groups on your domain */
25
- 'https://www.googleapis.com/auth/admin.directory.group',
26
- /** View and manage the provisioning of users on your domain */
27
- 'https://www.googleapis.com/auth/admin.directory.user',
28
- /** See, edit, create, and delete all your Google Docs documents */
29
- 'https://www.googleapis.com/auth/documents',
30
- /** See, edit, create, and delete all of your Google Drive files */
31
- 'https://www.googleapis.com/auth/drive',
32
- /** View and manage your forms in Google Drive */
33
- 'https://www.googleapis.com/auth/forms',
34
- /** View and manage forms that this application has been installed in */
35
- 'https://www.googleapis.com/auth/forms.currentonly',
36
- /** View and manage your Google Groups */
37
- 'https://www.googleapis.com/auth/groups',
38
- /** Create and update Google Apps Script deployments */
39
- 'https://www.googleapis.com/auth/script.deployments',
40
- /** View Google Apps Script deployments */
41
- 'https://www.googleapis.com/auth/script.deployments.readonly',
42
- /** View Google Apps Script project's metrics */
43
- 'https://www.googleapis.com/auth/script.metrics',
44
- /** View Google Apps Script processes */
45
- 'https://www.googleapis.com/auth/script.processes',
46
- /** Create and update Google Apps Script projects */
47
- 'https://www.googleapis.com/auth/script.projects',
48
- /** View Google Apps Script projects */
49
- 'https://www.googleapis.com/auth/script.projects.readonly',
50
- /** See, edit, create, and delete all your Google Sheets spreadsheets */
51
- 'https://www.googleapis.com/auth/spreadsheets',
52
- /** See your primary Google Account email address */
53
- 'https://www.googleapis.com/auth/userinfo.email',
54
- ];
55
- const immediate = false;
56
- gapi.auth.authorize({ client_id, scope, immediate }, authResult => {
57
- if (authResult && !authResult.error) {
58
- /** handle successful authorization */
59
- run();
60
- } else {
61
- /** handle authorization error */
62
- }
63
- });
64
-
65
- async function run() {
66
- /** List information about processes made by or on behalf of a user, such as process type and current status. */
67
- await gapi.client.script.processes.list({
68
- pageSize: 42,
69
- pageToken: "Test string",
70
- "userProcessFilter.deploymentId": "Test string",
71
- "userProcessFilter.endTime": "Test string",
72
- "userProcessFilter.functionName": "Test string",
73
- "userProcessFilter.projectName": "Test string",
74
- "userProcessFilter.scriptId": "Test string",
75
- "userProcessFilter.startTime": "Test string",
76
- "userProcessFilter.statuses": "Test string",
77
- "userProcessFilter.types": "Test string",
78
- "userProcessFilter.userAccessLevels": "Test string",
79
- });
80
- /** List information about a script's executed processes, such as process type and current status. */
81
- await gapi.client.script.processes.listScriptProcesses({
82
- pageSize: 42,
83
- pageToken: "Test string",
84
- scriptId: "Test string",
85
- "scriptProcessFilter.deploymentId": "Test string",
86
- "scriptProcessFilter.endTime": "Test string",
87
- "scriptProcessFilter.functionName": "Test string",
88
- "scriptProcessFilter.startTime": "Test string",
89
- "scriptProcessFilter.statuses": "Test string",
90
- "scriptProcessFilter.types": "Test string",
91
- "scriptProcessFilter.userAccessLevels": "Test string",
92
- });
93
- /** Creates a new, empty script project with no script files and a base manifest file. */
94
- await gapi.client.script.projects.create({
95
- }, {
96
- parentId: "Test string",
97
- title: "Test string",
98
- });
99
- /** Gets a script project's metadata. */
100
- await gapi.client.script.projects.get({
101
- scriptId: "Test string",
102
- });
103
- /** Gets the content of the script project, including the code source and metadata for each script file. */
104
- await gapi.client.script.projects.getContent({
105
- scriptId: "Test string",
106
- versionNumber: 42,
107
- });
108
- /** Get metrics data for scripts, such as number of executions and active users. */
109
- await gapi.client.script.projects.getMetrics({
110
- "metricsFilter.deploymentId": "Test string",
111
- metricsGranularity: "Test string",
112
- scriptId: "Test string",
113
- });
114
- /**
115
- * Updates the content of the specified script project. This content is stored as the HEAD version, and is used when the script is executed as a trigger, in the script editor, in add-on
116
- * preview mode, or as a web app or Apps Script API in development mode. This clears all the existing files in the project.
117
- */
118
- await gapi.client.script.projects.updateContent({
119
- scriptId: "Test string",
120
- }, {
121
- files: [
122
- {
123
- createTime: "Test string",
124
- functionSet: {
125
- values: [
126
- {
127
- name: "Test string",
128
- parameters: [
129
- "Test string"
130
- ],
131
- }
132
- ],
133
- },
134
- lastModifyUser: {
135
- domain: "Test string",
136
- email: "Test string",
137
- name: "Test string",
138
- photoUrl: "Test string",
139
- },
140
- name: "Test string",
141
- source: "Test string",
142
- type: "Test string",
143
- updateTime: "Test string",
144
- }
145
- ],
146
- scriptId: "Test string",
147
- });
148
- /** Creates a deployment of an Apps Script project. */
149
- await gapi.client.script.projects.deployments.create({
150
- scriptId: "Test string",
151
- }, {
152
- description: "Test string",
153
- manifestFileName: "Test string",
154
- scriptId: "Test string",
155
- versionNumber: 42,
156
- });
157
- /** Deletes a deployment of an Apps Script project. */
158
- await gapi.client.script.projects.deployments.delete({
159
- deploymentId: "Test string",
160
- scriptId: "Test string",
161
- });
162
- /** Gets a deployment of an Apps Script project. */
163
- await gapi.client.script.projects.deployments.get({
164
- deploymentId: "Test string",
165
- scriptId: "Test string",
166
- });
167
- /** Lists the deployments of an Apps Script project. */
168
- await gapi.client.script.projects.deployments.list({
169
- pageSize: 42,
170
- pageToken: "Test string",
171
- scriptId: "Test string",
172
- });
173
- /** Updates a deployment of an Apps Script project. */
174
- await gapi.client.script.projects.deployments.update({
175
- deploymentId: "Test string",
176
- scriptId: "Test string",
177
- }, {
178
- deploymentConfig: {
179
- description: "Test string",
180
- manifestFileName: "Test string",
181
- scriptId: "Test string",
182
- versionNumber: 42,
183
- },
184
- });
185
- /** Creates a new immutable version using the current code, with a unique version number. */
186
- await gapi.client.script.projects.versions.create({
187
- scriptId: "Test string",
188
- }, {
189
- createTime: "Test string",
190
- description: "Test string",
191
- scriptId: "Test string",
192
- versionNumber: 42,
193
- });
194
- /** Gets a version of a script project. */
195
- await gapi.client.script.projects.versions.get({
196
- scriptId: "Test string",
197
- versionNumber: 42,
198
- });
199
- /** List the versions of a script project. */
200
- await gapi.client.script.projects.versions.list({
201
- pageSize: 42,
202
- pageToken: "Test string",
203
- scriptId: "Test string",
204
- });
205
- /**
206
- * Runs a function in an Apps Script project. The script project must be deployed for use with the Apps Script API and the calling application must share the same Cloud Platform project.
207
- * This method requires authorization with an OAuth 2.0 token that includes at least one of the scopes listed in the [Authorization](#authorization-scopes) section; script projects that do
208
- * not require authorization cannot be executed through this API. To find the correct scopes to include in the authentication token, open the script project **Overview** page and scroll
209
- * down to "Project OAuth Scopes." The error `403, PERMISSION_DENIED: The caller does not have permission` indicates that the Cloud Platform project used to authorize the request is not
210
- * the same as the one used by the script.
211
- */
212
- await gapi.client.script.scripts.run({
213
- scriptId: "Test string",
214
- }, {
215
- devMode: true,
216
- function: "Test string",
217
- parameters: [
218
- 42
219
- ],
220
- sessionState: "Test string",
221
- });
222
- }
223
- });
package/tsconfig.json DELETED
@@ -1,18 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "module": "commonjs",
4
- "lib": ["es6", "dom"],
5
- "noImplicitAny": true,
6
- "noImplicitThis": true,
7
- "strictNullChecks": true,
8
- "baseUrl": "../",
9
- "typeRoots": [
10
- "../"
11
- ],
12
- "types": [],
13
- "noEmit": true,
14
- "forceConsistentCasingInFileNames": true,
15
- "strictFunctionTypes": true
16
- },
17
- "files": ["index.d.ts", "tests.ts"]
18
- }
package/tslint.json DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "extends": "dtslint/dtslint.json",
3
- "rules": {
4
- "no-redundant-jsdoc": false
5
- }
6
- }