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\Drive;
|
---|
21 | use Google\Service\Drive\DriveList;
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * The "drives" collection of methods.
|
---|
25 | * Typical usage is:
|
---|
26 | * <code>
|
---|
27 | * $driveService = new Google\Service\Drive(...);
|
---|
28 | * $drives = $driveService->drives;
|
---|
29 | * </code>
|
---|
30 | */
|
---|
31 | class Drives extends \Google\Service\Resource
|
---|
32 | {
|
---|
33 | /**
|
---|
34 | * Creates a shared drive. (drives.create)
|
---|
35 | *
|
---|
36 | * @param string $requestId Required. An ID, such as a random UUID, which
|
---|
37 | * uniquely identifies this user's request for idempotent creation of a shared
|
---|
38 | * drive. A repeated request by the same user and with the same request ID will
|
---|
39 | * avoid creating duplicates by attempting to create the same shared drive. If
|
---|
40 | * the shared drive already exists a 409 error will be returned.
|
---|
41 | * @param Drive $postBody
|
---|
42 | * @param array $optParams Optional parameters.
|
---|
43 | * @return Drive
|
---|
44 | * @throws \Google\Service\Exception
|
---|
45 | */
|
---|
46 | public function create($requestId, Drive $postBody, $optParams = [])
|
---|
47 | {
|
---|
48 | $params = ['requestId' => $requestId, 'postBody' => $postBody];
|
---|
49 | $params = array_merge($params, $optParams);
|
---|
50 | return $this->call('create', [$params], Drive::class);
|
---|
51 | }
|
---|
52 | /**
|
---|
53 | * Permanently deletes a shared drive for which the user is an `organizer`. The
|
---|
54 | * shared drive cannot contain any untrashed items. (drives.delete)
|
---|
55 | *
|
---|
56 | * @param string $driveId The ID of the shared drive.
|
---|
57 | * @param array $optParams Optional parameters.
|
---|
58 | *
|
---|
59 | * @opt_param bool allowItemDeletion Whether any items inside the shared drive
|
---|
60 | * should also be deleted. This option is only supported when
|
---|
61 | * `useDomainAdminAccess` is also set to `true`.
|
---|
62 | * @opt_param bool useDomainAdminAccess Issue the request as a domain
|
---|
63 | * administrator; if set to true, then the requester will be granted access if
|
---|
64 | * they are an administrator of the domain to which the shared drive belongs.
|
---|
65 | * @throws \Google\Service\Exception
|
---|
66 | */
|
---|
67 | public function delete($driveId, $optParams = [])
|
---|
68 | {
|
---|
69 | $params = ['driveId' => $driveId];
|
---|
70 | $params = array_merge($params, $optParams);
|
---|
71 | return $this->call('delete', [$params]);
|
---|
72 | }
|
---|
73 | /**
|
---|
74 | * Gets a shared drive's metadata by ID. (drives.get)
|
---|
75 | *
|
---|
76 | * @param string $driveId The ID of the shared drive.
|
---|
77 | * @param array $optParams Optional parameters.
|
---|
78 | *
|
---|
79 | * @opt_param bool useDomainAdminAccess Issue the request as a domain
|
---|
80 | * administrator; if set to true, then the requester will be granted access if
|
---|
81 | * they are an administrator of the domain to which the shared drive belongs.
|
---|
82 | * @return Drive
|
---|
83 | * @throws \Google\Service\Exception
|
---|
84 | */
|
---|
85 | public function get($driveId, $optParams = [])
|
---|
86 | {
|
---|
87 | $params = ['driveId' => $driveId];
|
---|
88 | $params = array_merge($params, $optParams);
|
---|
89 | return $this->call('get', [$params], Drive::class);
|
---|
90 | }
|
---|
91 | /**
|
---|
92 | * Hides a shared drive from the default view. (drives.hide)
|
---|
93 | *
|
---|
94 | * @param string $driveId The ID of the shared drive.
|
---|
95 | * @param array $optParams Optional parameters.
|
---|
96 | * @return Drive
|
---|
97 | * @throws \Google\Service\Exception
|
---|
98 | */
|
---|
99 | public function hide($driveId, $optParams = [])
|
---|
100 | {
|
---|
101 | $params = ['driveId' => $driveId];
|
---|
102 | $params = array_merge($params, $optParams);
|
---|
103 | return $this->call('hide', [$params], Drive::class);
|
---|
104 | }
|
---|
105 | /**
|
---|
106 | * Lists the user's shared drives. This method accepts the `q` parameter, which
|
---|
107 | * is a search query combining one or more search terms. For more information,
|
---|
108 | * see the [Search for shared drives](/drive/api/guides/search-shareddrives)
|
---|
109 | * guide. (drives.listDrives)
|
---|
110 | *
|
---|
111 | * @param array $optParams Optional parameters.
|
---|
112 | *
|
---|
113 | * @opt_param int pageSize Maximum number of shared drives to return per page.
|
---|
114 | * @opt_param string pageToken Page token for shared drives.
|
---|
115 | * @opt_param string q Query string for searching shared drives.
|
---|
116 | * @opt_param bool useDomainAdminAccess Issue the request as a domain
|
---|
117 | * administrator; if set to true, then all shared drives of the domain in which
|
---|
118 | * the requester is an administrator are returned.
|
---|
119 | * @return DriveList
|
---|
120 | * @throws \Google\Service\Exception
|
---|
121 | */
|
---|
122 | public function listDrives($optParams = [])
|
---|
123 | {
|
---|
124 | $params = [];
|
---|
125 | $params = array_merge($params, $optParams);
|
---|
126 | return $this->call('list', [$params], DriveList::class);
|
---|
127 | }
|
---|
128 | /**
|
---|
129 | * Restores a shared drive to the default view. (drives.unhide)
|
---|
130 | *
|
---|
131 | * @param string $driveId The ID of the shared drive.
|
---|
132 | * @param array $optParams Optional parameters.
|
---|
133 | * @return Drive
|
---|
134 | * @throws \Google\Service\Exception
|
---|
135 | */
|
---|
136 | public function unhide($driveId, $optParams = [])
|
---|
137 | {
|
---|
138 | $params = ['driveId' => $driveId];
|
---|
139 | $params = array_merge($params, $optParams);
|
---|
140 | return $this->call('unhide', [$params], Drive::class);
|
---|
141 | }
|
---|
142 | /**
|
---|
143 | * Updates the metadata for a shared drive. (drives.update)
|
---|
144 | *
|
---|
145 | * @param string $driveId The ID of the shared drive.
|
---|
146 | * @param Drive $postBody
|
---|
147 | * @param array $optParams Optional parameters.
|
---|
148 | *
|
---|
149 | * @opt_param bool useDomainAdminAccess Issue the request as a domain
|
---|
150 | * administrator; if set to true, then the requester will be granted access if
|
---|
151 | * they are an administrator of the domain to which the shared drive belongs.
|
---|
152 | * @return Drive
|
---|
153 | * @throws \Google\Service\Exception
|
---|
154 | */
|
---|
155 | public function update($driveId, Drive $postBody, $optParams = [])
|
---|
156 | {
|
---|
157 | $params = ['driveId' => $driveId, 'postBody' => $postBody];
|
---|
158 | $params = array_merge($params, $optParams);
|
---|
159 | return $this->call('update', [$params], Drive::class);
|
---|
160 | }
|
---|
161 | }
|
---|
162 |
|
---|
163 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
164 | class_alias(Drives::class, 'Google_Service_Drive_Resource_Drives');
|
---|