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\DriveLabels\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\DriveLabels\GoogleAppsDriveLabelsV2DeltaUpdateLabelRequest;
|
---|
21 | use Google\Service\DriveLabels\GoogleAppsDriveLabelsV2DeltaUpdateLabelResponse;
|
---|
22 | use Google\Service\DriveLabels\GoogleAppsDriveLabelsV2DisableLabelRequest;
|
---|
23 | use Google\Service\DriveLabels\GoogleAppsDriveLabelsV2EnableLabelRequest;
|
---|
24 | use Google\Service\DriveLabels\GoogleAppsDriveLabelsV2Label;
|
---|
25 | use Google\Service\DriveLabels\GoogleAppsDriveLabelsV2LabelPermission;
|
---|
26 | use Google\Service\DriveLabels\GoogleAppsDriveLabelsV2ListLabelsResponse;
|
---|
27 | use Google\Service\DriveLabels\GoogleAppsDriveLabelsV2PublishLabelRequest;
|
---|
28 | use Google\Service\DriveLabels\GoogleAppsDriveLabelsV2UpdateLabelCopyModeRequest;
|
---|
29 | use Google\Service\DriveLabels\GoogleProtobufEmpty;
|
---|
30 |
|
---|
31 | /**
|
---|
32 | * The "labels" collection of methods.
|
---|
33 | * Typical usage is:
|
---|
34 | * <code>
|
---|
35 | * $drivelabelsService = new Google\Service\DriveLabels(...);
|
---|
36 | * $labels = $drivelabelsService->labels;
|
---|
37 | * </code>
|
---|
38 | */
|
---|
39 | class Labels extends \Google\Service\Resource
|
---|
40 | {
|
---|
41 | /**
|
---|
42 | * Creates a new Label. (labels.create)
|
---|
43 | *
|
---|
44 | * @param GoogleAppsDriveLabelsV2Label $postBody
|
---|
45 | * @param array $optParams Optional parameters.
|
---|
46 | *
|
---|
47 | * @opt_param string languageCode The BCP-47 language code to use for evaluating
|
---|
48 | * localized Field labels in response. When not specified, values in the default
|
---|
49 | * configured language will be used.
|
---|
50 | * @opt_param bool useAdminAccess Set to `true` in order to use the user's admin
|
---|
51 | * privileges. The server will verify the user is an admin before allowing
|
---|
52 | * access.
|
---|
53 | * @return GoogleAppsDriveLabelsV2Label
|
---|
54 | * @throws \Google\Service\Exception
|
---|
55 | */
|
---|
56 | public function create(GoogleAppsDriveLabelsV2Label $postBody, $optParams = [])
|
---|
57 | {
|
---|
58 | $params = ['postBody' => $postBody];
|
---|
59 | $params = array_merge($params, $optParams);
|
---|
60 | return $this->call('create', [$params], GoogleAppsDriveLabelsV2Label::class);
|
---|
61 | }
|
---|
62 | /**
|
---|
63 | * Permanently deletes a Label and related metadata on Drive Items. Once
|
---|
64 | * deleted, the Label and related Drive item metadata will be deleted. Only
|
---|
65 | * draft Labels, and disabled Labels may be deleted. (labels.delete)
|
---|
66 | *
|
---|
67 | * @param string $name Required. Label resource name.
|
---|
68 | * @param array $optParams Optional parameters.
|
---|
69 | *
|
---|
70 | * @opt_param bool useAdminAccess Set to `true` in order to use the user's admin
|
---|
71 | * credentials. The server will verify the user is an admin for the Label before
|
---|
72 | * allowing access.
|
---|
73 | * @opt_param string writeControl.requiredRevisionId The revision_id of the
|
---|
74 | * label that the write request will be applied to. If this is not the latest
|
---|
75 | * revision of the label, the request will not be processed and will return a
|
---|
76 | * 400 Bad Request error.
|
---|
77 | * @return GoogleProtobufEmpty
|
---|
78 | * @throws \Google\Service\Exception
|
---|
79 | */
|
---|
80 | public function delete($name, $optParams = [])
|
---|
81 | {
|
---|
82 | $params = ['name' => $name];
|
---|
83 | $params = array_merge($params, $optParams);
|
---|
84 | return $this->call('delete', [$params], GoogleProtobufEmpty::class);
|
---|
85 | }
|
---|
86 | /**
|
---|
87 | * Updates a single Label by applying a set of update requests resulting in a
|
---|
88 | * new draft revision. The batch update is all-or-nothing: If any of the update
|
---|
89 | * requests are invalid, no changes are applied. The resulting draft revision
|
---|
90 | * must be published before the changes may be used with Drive Items.
|
---|
91 | * (labels.delta)
|
---|
92 | *
|
---|
93 | * @param string $name Required. The resource name of the Label to update.
|
---|
94 | * @param GoogleAppsDriveLabelsV2DeltaUpdateLabelRequest $postBody
|
---|
95 | * @param array $optParams Optional parameters.
|
---|
96 | * @return GoogleAppsDriveLabelsV2DeltaUpdateLabelResponse
|
---|
97 | * @throws \Google\Service\Exception
|
---|
98 | */
|
---|
99 | public function delta($name, GoogleAppsDriveLabelsV2DeltaUpdateLabelRequest $postBody, $optParams = [])
|
---|
100 | {
|
---|
101 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
102 | $params = array_merge($params, $optParams);
|
---|
103 | return $this->call('delta', [$params], GoogleAppsDriveLabelsV2DeltaUpdateLabelResponse::class);
|
---|
104 | }
|
---|
105 | /**
|
---|
106 | * Disable a published Label. Disabling a Label will result in a new disabled
|
---|
107 | * published revision based on the current published revision. If there is a
|
---|
108 | * draft revision, a new disabled draft revision will be created based on the
|
---|
109 | * latest draft revision. Older draft revisions will be deleted. Once disabled,
|
---|
110 | * a label may be deleted with `DeleteLabel`. (labels.disable)
|
---|
111 | *
|
---|
112 | * @param string $name Required. Label resource name.
|
---|
113 | * @param GoogleAppsDriveLabelsV2DisableLabelRequest $postBody
|
---|
114 | * @param array $optParams Optional parameters.
|
---|
115 | * @return GoogleAppsDriveLabelsV2Label
|
---|
116 | * @throws \Google\Service\Exception
|
---|
117 | */
|
---|
118 | public function disable($name, GoogleAppsDriveLabelsV2DisableLabelRequest $postBody, $optParams = [])
|
---|
119 | {
|
---|
120 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
121 | $params = array_merge($params, $optParams);
|
---|
122 | return $this->call('disable', [$params], GoogleAppsDriveLabelsV2Label::class);
|
---|
123 | }
|
---|
124 | /**
|
---|
125 | * Enable a disabled Label and restore it to its published state. This will
|
---|
126 | * result in a new published revision based on the current disabled published
|
---|
127 | * revision. If there is an existing disabled draft revision, a new revision
|
---|
128 | * will be created based on that draft and will be enabled. (labels.enable)
|
---|
129 | *
|
---|
130 | * @param string $name Required. Label resource name.
|
---|
131 | * @param GoogleAppsDriveLabelsV2EnableLabelRequest $postBody
|
---|
132 | * @param array $optParams Optional parameters.
|
---|
133 | * @return GoogleAppsDriveLabelsV2Label
|
---|
134 | * @throws \Google\Service\Exception
|
---|
135 | */
|
---|
136 | public function enable($name, GoogleAppsDriveLabelsV2EnableLabelRequest $postBody, $optParams = [])
|
---|
137 | {
|
---|
138 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
139 | $params = array_merge($params, $optParams);
|
---|
140 | return $this->call('enable', [$params], GoogleAppsDriveLabelsV2Label::class);
|
---|
141 | }
|
---|
142 | /**
|
---|
143 | * Get a label by its resource name. Resource name may be any of: *
|
---|
144 | * `labels/{id}` - See `labels/{id}@latest` * `labels/{id}@latest` - Gets the
|
---|
145 | * latest revision of the label. * `labels/{id}@published` - Gets the current
|
---|
146 | * published revision of the label. * `labels/{id}@{revision_id}` - Gets the
|
---|
147 | * label at the specified revision ID. (labels.get)
|
---|
148 | *
|
---|
149 | * @param string $name Required. Label resource name. May be any of: *
|
---|
150 | * `labels/{id}` (equivalent to labels/{id}@latest) * `labels/{id}@latest` *
|
---|
151 | * `labels/{id}@published` * `labels/{id}@{revision_id}`
|
---|
152 | * @param array $optParams Optional parameters.
|
---|
153 | *
|
---|
154 | * @opt_param string languageCode The BCP-47 language code to use for evaluating
|
---|
155 | * localized field labels. When not specified, values in the default configured
|
---|
156 | * language are used.
|
---|
157 | * @opt_param bool useAdminAccess Set to `true` in order to use the user's admin
|
---|
158 | * credentials. The server verifies that the user is an admin for the label
|
---|
159 | * before allowing access.
|
---|
160 | * @opt_param string view When specified, only certain fields belonging to the
|
---|
161 | * indicated view are returned.
|
---|
162 | * @return GoogleAppsDriveLabelsV2Label
|
---|
163 | * @throws \Google\Service\Exception
|
---|
164 | */
|
---|
165 | public function get($name, $optParams = [])
|
---|
166 | {
|
---|
167 | $params = ['name' => $name];
|
---|
168 | $params = array_merge($params, $optParams);
|
---|
169 | return $this->call('get', [$params], GoogleAppsDriveLabelsV2Label::class);
|
---|
170 | }
|
---|
171 | /**
|
---|
172 | * List labels. (labels.listLabels)
|
---|
173 | *
|
---|
174 | * @param array $optParams Optional parameters.
|
---|
175 | *
|
---|
176 | * @opt_param string customer The customer to scope this list request to. For
|
---|
177 | * example: "customers/abcd1234". If unset, will return all labels within the
|
---|
178 | * current customer.
|
---|
179 | * @opt_param string languageCode The BCP-47 language code to use for evaluating
|
---|
180 | * localized field labels. When not specified, values in the default configured
|
---|
181 | * language are used.
|
---|
182 | * @opt_param string minimumRole Specifies the level of access the user must
|
---|
183 | * have on the returned Labels. The minimum role a user must have on a label.
|
---|
184 | * Defaults to `READER`.
|
---|
185 | * @opt_param int pageSize Maximum number of labels to return per page. Default:
|
---|
186 | * 50. Max: 200.
|
---|
187 | * @opt_param string pageToken The token of the page to return.
|
---|
188 | * @opt_param bool publishedOnly Whether to include only published labels in the
|
---|
189 | * results. * When `true`, only the current published label revisions are
|
---|
190 | * returned. Disabled labels are included. Returned label resource names
|
---|
191 | * reference the published revision (`labels/{id}/{revision_id}`). * When
|
---|
192 | * `false`, the current label revisions are returned, which might not be
|
---|
193 | * published. Returned label resource names don't reference a specific revision
|
---|
194 | * (`labels/{id}`).
|
---|
195 | * @opt_param bool useAdminAccess Set to `true` in order to use the user's admin
|
---|
196 | * credentials. This will return all Labels within the customer.
|
---|
197 | * @opt_param string view When specified, only certain fields belonging to the
|
---|
198 | * indicated view are returned.
|
---|
199 | * @return GoogleAppsDriveLabelsV2ListLabelsResponse
|
---|
200 | * @throws \Google\Service\Exception
|
---|
201 | */
|
---|
202 | public function listLabels($optParams = [])
|
---|
203 | {
|
---|
204 | $params = [];
|
---|
205 | $params = array_merge($params, $optParams);
|
---|
206 | return $this->call('list', [$params], GoogleAppsDriveLabelsV2ListLabelsResponse::class);
|
---|
207 | }
|
---|
208 | /**
|
---|
209 | * Publish all draft changes to the Label. Once published, the Label may not
|
---|
210 | * return to its draft state. See `google.apps.drive.labels.v2.Lifecycle` for
|
---|
211 | * more information. Publishing a Label will result in a new published revision.
|
---|
212 | * All previous draft revisions will be deleted. Previous published revisions
|
---|
213 | * will be kept but are subject to automated deletion as needed. Once published,
|
---|
214 | * some changes are no longer permitted. Generally, any change that would
|
---|
215 | * invalidate or cause new restrictions on existing metadata related to the
|
---|
216 | * Label will be rejected. For example, the following changes to a Label will be
|
---|
217 | * rejected after the Label is published: * The label cannot be directly
|
---|
218 | * deleted. It must be disabled first, then deleted. * Field.FieldType cannot be
|
---|
219 | * changed. * Changes to Field validation options cannot reject something that
|
---|
220 | * was previously accepted. * Reducing the max entries. (labels.publish)
|
---|
221 | *
|
---|
222 | * @param string $name Required. Label resource name.
|
---|
223 | * @param GoogleAppsDriveLabelsV2PublishLabelRequest $postBody
|
---|
224 | * @param array $optParams Optional parameters.
|
---|
225 | * @return GoogleAppsDriveLabelsV2Label
|
---|
226 | * @throws \Google\Service\Exception
|
---|
227 | */
|
---|
228 | public function publish($name, GoogleAppsDriveLabelsV2PublishLabelRequest $postBody, $optParams = [])
|
---|
229 | {
|
---|
230 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
231 | $params = array_merge($params, $optParams);
|
---|
232 | return $this->call('publish', [$params], GoogleAppsDriveLabelsV2Label::class);
|
---|
233 | }
|
---|
234 | /**
|
---|
235 | * Updates a Label's `CopyMode`. Changes to this policy are not revisioned, do
|
---|
236 | * not require publishing, and take effect immediately.
|
---|
237 | * (labels.updateLabelCopyMode)
|
---|
238 | *
|
---|
239 | * @param string $name Required. The resource name of the Label to update.
|
---|
240 | * @param GoogleAppsDriveLabelsV2UpdateLabelCopyModeRequest $postBody
|
---|
241 | * @param array $optParams Optional parameters.
|
---|
242 | * @return GoogleAppsDriveLabelsV2Label
|
---|
243 | * @throws \Google\Service\Exception
|
---|
244 | */
|
---|
245 | public function updateLabelCopyMode($name, GoogleAppsDriveLabelsV2UpdateLabelCopyModeRequest $postBody, $optParams = [])
|
---|
246 | {
|
---|
247 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
248 | $params = array_merge($params, $optParams);
|
---|
249 | return $this->call('updateLabelCopyMode', [$params], GoogleAppsDriveLabelsV2Label::class);
|
---|
250 | }
|
---|
251 | /**
|
---|
252 | * Updates a Label's permissions. If a permission for the indicated principal
|
---|
253 | * doesn't exist, a new Label Permission is created, otherwise the existing
|
---|
254 | * permission is updated. Permissions affect the Label resource as a whole, are
|
---|
255 | * not revisioned, and do not require publishing. (labels.updatePermissions)
|
---|
256 | *
|
---|
257 | * @param string $parent Required. The parent Label resource name.
|
---|
258 | * @param GoogleAppsDriveLabelsV2LabelPermission $postBody
|
---|
259 | * @param array $optParams Optional parameters.
|
---|
260 | *
|
---|
261 | * @opt_param bool useAdminAccess Set to `true` in order to use the user's admin
|
---|
262 | * credentials. The server will verify the user is an admin for the Label before
|
---|
263 | * allowing access.
|
---|
264 | * @return GoogleAppsDriveLabelsV2LabelPermission
|
---|
265 | * @throws \Google\Service\Exception
|
---|
266 | */
|
---|
267 | public function updatePermissions($parent, GoogleAppsDriveLabelsV2LabelPermission $postBody, $optParams = [])
|
---|
268 | {
|
---|
269 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
270 | $params = array_merge($params, $optParams);
|
---|
271 | return $this->call('updatePermissions', [$params], GoogleAppsDriveLabelsV2LabelPermission::class);
|
---|
272 | }
|
---|
273 | }
|
---|
274 |
|
---|
275 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
276 | class_alias(Labels::class, 'Google_Service_DriveLabels_Resource_Labels');
|
---|