[e3d4e0a] | 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 |
|
---|
| 18 | namespace Google\Service\Drive\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\Drive\Revision;
|
---|
| 21 | use 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 | */
|
---|
| 31 | class 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 | * @throws \Google\Service\Exception
|
---|
| 43 | */
|
---|
| 44 | public function delete($fileId, $revisionId, $optParams = [])
|
---|
| 45 | {
|
---|
| 46 | $params = ['fileId' => $fileId, 'revisionId' => $revisionId];
|
---|
| 47 | $params = array_merge($params, $optParams);
|
---|
| 48 | return $this->call('delete', [$params]);
|
---|
| 49 | }
|
---|
| 50 | /**
|
---|
| 51 | * Gets a revision's metadata or content by ID. (revisions.get)
|
---|
| 52 | *
|
---|
| 53 | * @param string $fileId The ID of the file.
|
---|
| 54 | * @param string $revisionId The ID of the revision.
|
---|
| 55 | * @param array $optParams Optional parameters.
|
---|
| 56 | *
|
---|
| 57 | * @opt_param bool acknowledgeAbuse Whether the user is acknowledging the risk
|
---|
| 58 | * of downloading known malware or other abusive files. This is only applicable
|
---|
| 59 | * when the `alt` parameter is set to `media` and the user is the owner of the
|
---|
| 60 | * file or an organizer of the shared drive in which the file resides.
|
---|
| 61 | * @return Revision
|
---|
| 62 | * @throws \Google\Service\Exception
|
---|
| 63 | */
|
---|
| 64 | public function get($fileId, $revisionId, $optParams = [])
|
---|
| 65 | {
|
---|
| 66 | $params = ['fileId' => $fileId, 'revisionId' => $revisionId];
|
---|
| 67 | $params = array_merge($params, $optParams);
|
---|
| 68 | return $this->call('get', [$params], Revision::class);
|
---|
| 69 | }
|
---|
| 70 | /**
|
---|
| 71 | * Lists a file's revisions. (revisions.listRevisions)
|
---|
| 72 | *
|
---|
| 73 | * @param string $fileId The ID of the file.
|
---|
| 74 | * @param array $optParams Optional parameters.
|
---|
| 75 | *
|
---|
| 76 | * @opt_param int pageSize The maximum number of revisions to return per page.
|
---|
| 77 | * @opt_param string pageToken The token for continuing a previous list request
|
---|
| 78 | * on the next page. This should be set to the value of 'nextPageToken' from the
|
---|
| 79 | * previous response.
|
---|
| 80 | * @return RevisionList
|
---|
| 81 | * @throws \Google\Service\Exception
|
---|
| 82 | */
|
---|
| 83 | public function listRevisions($fileId, $optParams = [])
|
---|
| 84 | {
|
---|
| 85 | $params = ['fileId' => $fileId];
|
---|
| 86 | $params = array_merge($params, $optParams);
|
---|
| 87 | return $this->call('list', [$params], RevisionList::class);
|
---|
| 88 | }
|
---|
| 89 | /**
|
---|
| 90 | * Updates a revision with patch semantics. (revisions.update)
|
---|
| 91 | *
|
---|
| 92 | * @param string $fileId The ID of the file.
|
---|
| 93 | * @param string $revisionId The ID of the revision.
|
---|
| 94 | * @param Revision $postBody
|
---|
| 95 | * @param array $optParams Optional parameters.
|
---|
| 96 | * @return Revision
|
---|
| 97 | * @throws \Google\Service\Exception
|
---|
| 98 | */
|
---|
| 99 | public function update($fileId, $revisionId, Revision $postBody, $optParams = [])
|
---|
| 100 | {
|
---|
| 101 | $params = ['fileId' => $fileId, 'revisionId' => $revisionId, 'postBody' => $postBody];
|
---|
| 102 | $params = array_merge($params, $optParams);
|
---|
| 103 | return $this->call('update', [$params], Revision::class);
|
---|
| 104 | }
|
---|
| 105 | }
|
---|
| 106 |
|
---|
| 107 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 108 | class_alias(Revisions::class, 'Google_Service_Drive_Resource_Revisions');
|
---|