1<?php
2/*
3 * Copyright 2014 Google Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 * use this file except in compliance with the License. You may obtain a copy of
7 * the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17
18namespace Google\Service;
19
20use Google\Client;
21
22/**
23 * Service definition for Script (v1).
24 *
25 * <p>
26 * Manages and executes Google Apps Script projects.</p>
27 *
28 * <p>
29 * For more information about this service, see the API
30 * <a href="https://developers.google.com/apps-script/api/" target="_blank">Documentation</a>
31 * </p>
32 *
33 * @author Google, Inc.
34 */
35class Script extends \Google\Service
36{
37  /** Read, compose, send, and permanently delete all your email from Gmail. */
38  const MAIL_GOOGLE_COM =
39      "https://mail.google.com/";
40  /** See, edit, share, and permanently delete all the calendars you can access using Google Calendar. */
41  const WWW_GOOGLE_COM_CALENDAR_FEEDS =
42      "https://www.google.com/calendar/feeds";
43  /** See, edit, download, and permanently delete your contacts. */
44  const WWW_GOOGLE_COM_M8_FEEDS =
45      "https://www.google.com/m8/feeds";
46  /** View and manage the provisioning of groups on your domain. */
47  const ADMIN_DIRECTORY_GROUP =
48      "https://www.googleapis.com/auth/admin.directory.group";
49  /** View and manage the provisioning of users on your domain. */
50  const ADMIN_DIRECTORY_USER =
51      "https://www.googleapis.com/auth/admin.directory.user";
52  /** See, edit, create, and delete all your Google Docs documents. */
53  const DOCUMENTS =
54      "https://www.googleapis.com/auth/documents";
55  /** See, edit, create, and delete all of your Google Drive files. */
56  const DRIVE =
57      "https://www.googleapis.com/auth/drive";
58  /** View and manage your forms in Google Drive. */
59  const FORMS =
60      "https://www.googleapis.com/auth/forms";
61  /** View and manage forms that this application has been installed in. */
62  const FORMS_CURRENTONLY =
63      "https://www.googleapis.com/auth/forms.currentonly";
64  /** View and manage your Google Groups. */
65  const GROUPS =
66      "https://www.googleapis.com/auth/groups";
67  /** Create and update Google Apps Script deployments. */
68  const SCRIPT_DEPLOYMENTS =
69      "https://www.googleapis.com/auth/script.deployments";
70  /** View Google Apps Script deployments. */
71  const SCRIPT_DEPLOYMENTS_READONLY =
72      "https://www.googleapis.com/auth/script.deployments.readonly";
73  /** View Google Apps Script project's metrics. */
74  const SCRIPT_METRICS =
75      "https://www.googleapis.com/auth/script.metrics";
76  /** View Google Apps Script processes. */
77  const SCRIPT_PROCESSES =
78      "https://www.googleapis.com/auth/script.processes";
79  /** Create and update Google Apps Script projects. */
80  const SCRIPT_PROJECTS =
81      "https://www.googleapis.com/auth/script.projects";
82  /** View Google Apps Script projects. */
83  const SCRIPT_PROJECTS_READONLY =
84      "https://www.googleapis.com/auth/script.projects.readonly";
85  /** See, edit, create, and delete all your Google Sheets spreadsheets. */
86  const SPREADSHEETS =
87      "https://www.googleapis.com/auth/spreadsheets";
88  /** See your primary Google Account email address. */
89  const USERINFO_EMAIL =
90      "https://www.googleapis.com/auth/userinfo.email";
91
92  public $processes;
93  public $projects;
94  public $projects_deployments;
95  public $projects_versions;
96  public $scripts;
97
98  /**
99   * Constructs the internal representation of the Script service.
100   *
101   * @param Client|array $clientOrConfig The client used to deliver requests, or a
102   *                                     config array to pass to a new Client instance.
103   * @param string $rootUrl The root URL used for requests to the service.
104   */
105  public function __construct($clientOrConfig = [], $rootUrl = null)
106  {
107    parent::__construct($clientOrConfig);
108    $this->rootUrl = $rootUrl ?: 'https://script.googleapis.com/';
109    $this->servicePath = '';
110    $this->batchPath = 'batch';
111    $this->version = 'v1';
112    $this->serviceName = 'script';
113
114    $this->processes = new Script\Resource\Processes(
115        $this,
116        $this->serviceName,
117        'processes',
118        [
119          'methods' => [
120            'list' => [
121              'path' => 'v1/processes',
122              'httpMethod' => 'GET',
123              'parameters' => [
124                'pageSize' => [
125                  'location' => 'query',
126                  'type' => 'integer',
127                ],
128                'pageToken' => [
129                  'location' => 'query',
130                  'type' => 'string',
131                ],
132                'userProcessFilter.deploymentId' => [
133                  'location' => 'query',
134                  'type' => 'string',
135                ],
136                'userProcessFilter.endTime' => [
137                  'location' => 'query',
138                  'type' => 'string',
139                ],
140                'userProcessFilter.functionName' => [
141                  'location' => 'query',
142                  'type' => 'string',
143                ],
144                'userProcessFilter.projectName' => [
145                  'location' => 'query',
146                  'type' => 'string',
147                ],
148                'userProcessFilter.scriptId' => [
149                  'location' => 'query',
150                  'type' => 'string',
151                ],
152                'userProcessFilter.startTime' => [
153                  'location' => 'query',
154                  'type' => 'string',
155                ],
156                'userProcessFilter.statuses' => [
157                  'location' => 'query',
158                  'type' => 'string',
159                  'repeated' => true,
160                ],
161                'userProcessFilter.types' => [
162                  'location' => 'query',
163                  'type' => 'string',
164                  'repeated' => true,
165                ],
166                'userProcessFilter.userAccessLevels' => [
167                  'location' => 'query',
168                  'type' => 'string',
169                  'repeated' => true,
170                ],
171              ],
172            ],'listScriptProcesses' => [
173              'path' => 'v1/processes:listScriptProcesses',
174              'httpMethod' => 'GET',
175              'parameters' => [
176                'pageSize' => [
177                  'location' => 'query',
178                  'type' => 'integer',
179                ],
180                'pageToken' => [
181                  'location' => 'query',
182                  'type' => 'string',
183                ],
184                'scriptId' => [
185                  'location' => 'query',
186                  'type' => 'string',
187                ],
188                'scriptProcessFilter.deploymentId' => [
189                  'location' => 'query',
190                  'type' => 'string',
191                ],
192                'scriptProcessFilter.endTime' => [
193                  'location' => 'query',
194                  'type' => 'string',
195                ],
196                'scriptProcessFilter.functionName' => [
197                  'location' => 'query',
198                  'type' => 'string',
199                ],
200                'scriptProcessFilter.startTime' => [
201                  'location' => 'query',
202                  'type' => 'string',
203                ],
204                'scriptProcessFilter.statuses' => [
205                  'location' => 'query',
206                  'type' => 'string',
207                  'repeated' => true,
208                ],
209                'scriptProcessFilter.types' => [
210                  'location' => 'query',
211                  'type' => 'string',
212                  'repeated' => true,
213                ],
214                'scriptProcessFilter.userAccessLevels' => [
215                  'location' => 'query',
216                  'type' => 'string',
217                  'repeated' => true,
218                ],
219              ],
220            ],
221          ]
222        ]
223    );
224    $this->projects = new Script\Resource\Projects(
225        $this,
226        $this->serviceName,
227        'projects',
228        [
229          'methods' => [
230            'create' => [
231              'path' => 'v1/projects',
232              'httpMethod' => 'POST',
233              'parameters' => [],
234            ],'get' => [
235              'path' => 'v1/projects/{scriptId}',
236              'httpMethod' => 'GET',
237              'parameters' => [
238                'scriptId' => [
239                  'location' => 'path',
240                  'type' => 'string',
241                  'required' => true,
242                ],
243              ],
244            ],'getContent' => [
245              'path' => 'v1/projects/{scriptId}/content',
246              'httpMethod' => 'GET',
247              'parameters' => [
248                'scriptId' => [
249                  'location' => 'path',
250                  'type' => 'string',
251                  'required' => true,
252                ],
253                'versionNumber' => [
254                  'location' => 'query',
255                  'type' => 'integer',
256                ],
257              ],
258            ],'getMetrics' => [
259              'path' => 'v1/projects/{scriptId}/metrics',
260              'httpMethod' => 'GET',
261              'parameters' => [
262                'scriptId' => [
263                  'location' => 'path',
264                  'type' => 'string',
265                  'required' => true,
266                ],
267                'metricsFilter.deploymentId' => [
268                  'location' => 'query',
269                  'type' => 'string',
270                ],
271                'metricsGranularity' => [
272                  'location' => 'query',
273                  'type' => 'string',
274                ],
275              ],
276            ],'updateContent' => [
277              'path' => 'v1/projects/{scriptId}/content',
278              'httpMethod' => 'PUT',
279              'parameters' => [
280                'scriptId' => [
281                  'location' => 'path',
282                  'type' => 'string',
283                  'required' => true,
284                ],
285              ],
286            ],
287          ]
288        ]
289    );
290    $this->projects_deployments = new Script\Resource\ProjectsDeployments(
291        $this,
292        $this->serviceName,
293        'deployments',
294        [
295          'methods' => [
296            'create' => [
297              'path' => 'v1/projects/{scriptId}/deployments',
298              'httpMethod' => 'POST',
299              'parameters' => [
300                'scriptId' => [
301                  'location' => 'path',
302                  'type' => 'string',
303                  'required' => true,
304                ],
305              ],
306            ],'delete' => [
307              'path' => 'v1/projects/{scriptId}/deployments/{deploymentId}',
308              'httpMethod' => 'DELETE',
309              'parameters' => [
310                'scriptId' => [
311                  'location' => 'path',
312                  'type' => 'string',
313                  'required' => true,
314                ],
315                'deploymentId' => [
316                  'location' => 'path',
317                  'type' => 'string',
318                  'required' => true,
319                ],
320              ],
321            ],'get' => [
322              'path' => 'v1/projects/{scriptId}/deployments/{deploymentId}',
323              'httpMethod' => 'GET',
324              'parameters' => [
325                'scriptId' => [
326                  'location' => 'path',
327                  'type' => 'string',
328                  'required' => true,
329                ],
330                'deploymentId' => [
331                  'location' => 'path',
332                  'type' => 'string',
333                  'required' => true,
334                ],
335              ],
336            ],'list' => [
337              'path' => 'v1/projects/{scriptId}/deployments',
338              'httpMethod' => 'GET',
339              'parameters' => [
340                'scriptId' => [
341                  'location' => 'path',
342                  'type' => 'string',
343                  'required' => true,
344                ],
345                'pageSize' => [
346                  'location' => 'query',
347                  'type' => 'integer',
348                ],
349                'pageToken' => [
350                  'location' => 'query',
351                  'type' => 'string',
352                ],
353              ],
354            ],'update' => [
355              'path' => 'v1/projects/{scriptId}/deployments/{deploymentId}',
356              'httpMethod' => 'PUT',
357              'parameters' => [
358                'scriptId' => [
359                  'location' => 'path',
360                  'type' => 'string',
361                  'required' => true,
362                ],
363                'deploymentId' => [
364                  'location' => 'path',
365                  'type' => 'string',
366                  'required' => true,
367                ],
368              ],
369            ],
370          ]
371        ]
372    );
373    $this->projects_versions = new Script\Resource\ProjectsVersions(
374        $this,
375        $this->serviceName,
376        'versions',
377        [
378          'methods' => [
379            'create' => [
380              'path' => 'v1/projects/{scriptId}/versions',
381              'httpMethod' => 'POST',
382              'parameters' => [
383                'scriptId' => [
384                  'location' => 'path',
385                  'type' => 'string',
386                  'required' => true,
387                ],
388              ],
389            ],'get' => [
390              'path' => 'v1/projects/{scriptId}/versions/{versionNumber}',
391              'httpMethod' => 'GET',
392              'parameters' => [
393                'scriptId' => [
394                  'location' => 'path',
395                  'type' => 'string',
396                  'required' => true,
397                ],
398                'versionNumber' => [
399                  'location' => 'path',
400                  'type' => 'integer',
401                  'required' => true,
402                ],
403              ],
404            ],'list' => [
405              'path' => 'v1/projects/{scriptId}/versions',
406              'httpMethod' => 'GET',
407              'parameters' => [
408                'scriptId' => [
409                  'location' => 'path',
410                  'type' => 'string',
411                  'required' => true,
412                ],
413                'pageSize' => [
414                  'location' => 'query',
415                  'type' => 'integer',
416                ],
417                'pageToken' => [
418                  'location' => 'query',
419                  'type' => 'string',
420                ],
421              ],
422            ],
423          ]
424        ]
425    );
426    $this->scripts = new Script\Resource\Scripts(
427        $this,
428        $this->serviceName,
429        'scripts',
430        [
431          'methods' => [
432            'run' => [
433              'path' => 'v1/scripts/{scriptId}:run',
434              'httpMethod' => 'POST',
435              'parameters' => [
436                'scriptId' => [
437                  'location' => 'path',
438                  'type' => 'string',
439                  'required' => true,
440                ],
441              ],
442            ],
443          ]
444        ]
445    );
446  }
447}
448
449// Adding a class alias for backwards compatibility with the previous class name.
450class_alias(Script::class, 'Google_Service_Script');
451