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\Drive\Resource;
19
20use Google\Service\Drive\Revision;
21use Google\Service\Drive\RevisionList;
22
23/**
24 * The "revisions" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $driveService = new Google\Service\Drive(...);
28 *   $revisions = $driveService->revisions;
29 *  </code>
30 */
31class Revisions extends \Google\Service\Resource
32{
33  /**
34   * Permanently deletes a file version. You can only delete revisions for files
35   * with binary content in Google Drive, like images or videos. Revisions for
36   * other files, like Google Docs or Sheets, and the last remaining file version
37   * can't be deleted. (revisions.delete)
38   *
39   * @param string $fileId The ID of the file.
40   * @param string $revisionId The ID of the revision.
41   * @param array $optParams Optional parameters.
42   */
43  public function delete($fileId, $revisionId, $optParams = [])
44  {
45    $params = ['fileId' => $fileId, 'revisionId' => $revisionId];
46    $params = array_merge($params, $optParams);
47    return $this->call('delete', [$params]);
48  }
49  /**
50   * Gets a revision's metadata or content by ID. (revisions.get)
51   *
52   * @param string $fileId The ID of the file.
53   * @param string $revisionId The ID of the revision.
54   * @param array $optParams Optional parameters.
55   *
56   * @opt_param bool acknowledgeAbuse Whether the user is acknowledging the risk
57   * of downloading known malware or other abusive files. This is only applicable
58   * when alt=media.
59   * @return Revision
60   */
61  public function get($fileId, $revisionId, $optParams = [])
62  {
63    $params = ['fileId' => $fileId, 'revisionId' => $revisionId];
64    $params = array_merge($params, $optParams);
65    return $this->call('get', [$params], Revision::class);
66  }
67  /**
68   * Lists a file's revisions. (revisions.listRevisions)
69   *
70   * @param string $fileId The ID of the file.
71   * @param array $optParams Optional parameters.
72   *
73   * @opt_param int pageSize The maximum number of revisions to return per page.
74   * @opt_param string pageToken The token for continuing a previous list request
75   * on the next page. This should be set to the value of 'nextPageToken' from the
76   * previous response.
77   * @return RevisionList
78   */
79  public function listRevisions($fileId, $optParams = [])
80  {
81    $params = ['fileId' => $fileId];
82    $params = array_merge($params, $optParams);
83    return $this->call('list', [$params], RevisionList::class);
84  }
85  /**
86   * Updates a revision with patch semantics. (revisions.update)
87   *
88   * @param string $fileId The ID of the file.
89   * @param string $revisionId The ID of the revision.
90   * @param Revision $postBody
91   * @param array $optParams Optional parameters.
92   * @return Revision
93   */
94  public function update($fileId, $revisionId, Revision $postBody, $optParams = [])
95  {
96    $params = ['fileId' => $fileId, 'revisionId' => $revisionId, 'postBody' => $postBody];
97    $params = array_merge($params, $optParams);
98    return $this->call('update', [$params], Revision::class);
99  }
100}
101
102// Adding a class alias for backwards compatibility with the previous class name.
103class_alias(Revisions::class, 'Google_Service_Drive_Resource_Revisions');
104