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\ListVersionsResponse;
21use Google\Service\Script\Version;
22
23/**
24 * The "versions" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $scriptService = new Google\Service\Script(...);
28 *   $versions = $scriptService->versions;
29 *  </code>
30 */
31class ProjectsVersions extends \Google\Service\Resource
32{
33  /**
34   * Creates a new immutable version using the current code, with a unique version
35   * number. (versions.create)
36   *
37   * @param string $scriptId The script project's Drive ID.
38   * @param Version $postBody
39   * @param array $optParams Optional parameters.
40   * @return Version
41   */
42  public function create($scriptId, Version $postBody, $optParams = [])
43  {
44    $params = ['scriptId' => $scriptId, 'postBody' => $postBody];
45    $params = array_merge($params, $optParams);
46    return $this->call('create', [$params], Version::class);
47  }
48  /**
49   * Gets a version of a script project. (versions.get)
50   *
51   * @param string $scriptId The script project's Drive ID.
52   * @param int $versionNumber The version number.
53   * @param array $optParams Optional parameters.
54   * @return Version
55   */
56  public function get($scriptId, $versionNumber, $optParams = [])
57  {
58    $params = ['scriptId' => $scriptId, 'versionNumber' => $versionNumber];
59    $params = array_merge($params, $optParams);
60    return $this->call('get', [$params], Version::class);
61  }
62  /**
63   * List the versions of a script project. (versions.listProjectsVersions)
64   *
65   * @param string $scriptId The script project's Drive ID.
66   * @param array $optParams Optional parameters.
67   *
68   * @opt_param int pageSize The maximum number of versions on each returned page.
69   * Defaults to 50.
70   * @opt_param string pageToken The token for continuing a previous list request
71   * on the next page. This should be set to the value of `nextPageToken` from a
72   * previous response.
73   * @return ListVersionsResponse
74   */
75  public function listProjectsVersions($scriptId, $optParams = [])
76  {
77    $params = ['scriptId' => $scriptId];
78    $params = array_merge($params, $optParams);
79    return $this->call('list', [$params], ListVersionsResponse::class);
80  }
81}
82
83// Adding a class alias for backwards compatibility with the previous class name.
84class_alias(ProjectsVersions::class, 'Google_Service_Script_Resource_ProjectsVersions');
85