Script.php 15 KB

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