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