source: vendor/google/apiclient-services/src/Script/Resource/Projects.php@ e3d4e0a

Last change on this file since e3d4e0a was e3d4e0a, checked in by Vlado 222039 <vlado.popovski@…>, 10 days ago

Upload project files

  • Property mode set to 100644
File size: 4.4 KB
Line 
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\Script\Resource;
19
20use Google\Service\Script\Content;
21use Google\Service\Script\CreateProjectRequest;
22use Google\Service\Script\Metrics;
23use Google\Service\Script\Project;
24
25/**
26 * The "projects" collection of methods.
27 * Typical usage is:
28 * <code>
29 * $scriptService = new Google\Service\Script(...);
30 * $projects = $scriptService->projects;
31 * </code>
32 */
33class Projects extends \Google\Service\Resource
34{
35 /**
36 * Creates a new, empty script project with no script files and a base manifest
37 * file. (projects.create)
38 *
39 * @param CreateProjectRequest $postBody
40 * @param array $optParams Optional parameters.
41 * @return Project
42 * @throws \Google\Service\Exception
43 */
44 public function create(CreateProjectRequest $postBody, $optParams = [])
45 {
46 $params = ['postBody' => $postBody];
47 $params = array_merge($params, $optParams);
48 return $this->call('create', [$params], Project::class);
49 }
50 /**
51 * Gets a script project's metadata. (projects.get)
52 *
53 * @param string $scriptId The script project's Drive ID.
54 * @param array $optParams Optional parameters.
55 * @return Project
56 * @throws \Google\Service\Exception
57 */
58 public function get($scriptId, $optParams = [])
59 {
60 $params = ['scriptId' => $scriptId];
61 $params = array_merge($params, $optParams);
62 return $this->call('get', [$params], Project::class);
63 }
64 /**
65 * Gets the content of the script project, including the code source and
66 * metadata for each script file. (projects.getContent)
67 *
68 * @param string $scriptId The script project's Drive ID.
69 * @param array $optParams Optional parameters.
70 *
71 * @opt_param int versionNumber The version number of the project to retrieve.
72 * If not provided, the project's HEAD version is returned.
73 * @return Content
74 * @throws \Google\Service\Exception
75 */
76 public function getContent($scriptId, $optParams = [])
77 {
78 $params = ['scriptId' => $scriptId];
79 $params = array_merge($params, $optParams);
80 return $this->call('getContent', [$params], Content::class);
81 }
82 /**
83 * Get metrics data for scripts, such as number of executions and active users.
84 * (projects.getMetrics)
85 *
86 * @param string $scriptId Required field indicating the script to get metrics
87 * for.
88 * @param array $optParams Optional parameters.
89 *
90 * @opt_param string metricsFilter.deploymentId Optional field indicating a
91 * specific deployment to retrieve metrics from.
92 * @opt_param string metricsGranularity Required field indicating what
93 * granularity of metrics are returned.
94 * @return Metrics
95 * @throws \Google\Service\Exception
96 */
97 public function getMetrics($scriptId, $optParams = [])
98 {
99 $params = ['scriptId' => $scriptId];
100 $params = array_merge($params, $optParams);
101 return $this->call('getMetrics', [$params], Metrics::class);
102 }
103 /**
104 * Updates the content of the specified script project. This content is stored
105 * as the HEAD version, and is used when the script is executed as a trigger, in
106 * the script editor, in add-on preview mode, or as a web app or Apps Script API
107 * in development mode. This clears all the existing files in the project.
108 * (projects.updateContent)
109 *
110 * @param string $scriptId The script project's Drive ID.
111 * @param Content $postBody
112 * @param array $optParams Optional parameters.
113 * @return Content
114 * @throws \Google\Service\Exception
115 */
116 public function updateContent($scriptId, Content $postBody, $optParams = [])
117 {
118 $params = ['scriptId' => $scriptId, 'postBody' => $postBody];
119 $params = array_merge($params, $optParams);
120 return $this->call('updateContent', [$params], Content::class);
121 }
122}
123
124// Adding a class alias for backwards compatibility with the previous class name.
125class_alias(Projects::class, 'Google_Service_Script_Resource_Projects');
Note: See TracBrowser for help on using the repository browser.