[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\Keep\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\Keep\BatchCreatePermissionsRequest;
|
---|
| 21 | use Google\Service\Keep\BatchCreatePermissionsResponse;
|
---|
| 22 | use Google\Service\Keep\BatchDeletePermissionsRequest;
|
---|
| 23 | use Google\Service\Keep\KeepEmpty;
|
---|
| 24 |
|
---|
| 25 | /**
|
---|
| 26 | * The "permissions" collection of methods.
|
---|
| 27 | * Typical usage is:
|
---|
| 28 | * <code>
|
---|
| 29 | * $keepService = new Google\Service\Keep(...);
|
---|
| 30 | * $permissions = $keepService->notes_permissions;
|
---|
| 31 | * </code>
|
---|
| 32 | */
|
---|
| 33 | class NotesPermissions extends \Google\Service\Resource
|
---|
| 34 | {
|
---|
| 35 | /**
|
---|
| 36 | * Creates one or more permissions on the note. Only permissions with the
|
---|
| 37 | * `WRITER` role may be created. If adding any permission fails, then the entire
|
---|
| 38 | * request fails and no changes are made. (permissions.batchCreate)
|
---|
| 39 | *
|
---|
| 40 | * @param string $parent The parent resource shared by all Permissions being
|
---|
| 41 | * created. Format: `notes/{note}` If this is set, the parent field in the
|
---|
| 42 | * CreatePermission messages must either be empty or match this field.
|
---|
| 43 | * @param BatchCreatePermissionsRequest $postBody
|
---|
| 44 | * @param array $optParams Optional parameters.
|
---|
| 45 | * @return BatchCreatePermissionsResponse
|
---|
| 46 | * @throws \Google\Service\Exception
|
---|
| 47 | */
|
---|
| 48 | public function batchCreate($parent, BatchCreatePermissionsRequest $postBody, $optParams = [])
|
---|
| 49 | {
|
---|
| 50 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 51 | $params = array_merge($params, $optParams);
|
---|
| 52 | return $this->call('batchCreate', [$params], BatchCreatePermissionsResponse::class);
|
---|
| 53 | }
|
---|
| 54 | /**
|
---|
| 55 | * Deletes one or more permissions on the note. The specified entities will
|
---|
| 56 | * immediately lose access. A permission with the `OWNER` role can't be removed.
|
---|
| 57 | * If removing a permission fails, then the entire request fails and no changes
|
---|
| 58 | * are made. Returns a 400 bad request error if a specified permission does not
|
---|
| 59 | * exist on the note. (permissions.batchDelete)
|
---|
| 60 | *
|
---|
| 61 | * @param string $parent The parent resource shared by all permissions being
|
---|
| 62 | * deleted. Format: `notes/{note}` If this is set, the parent of all of the
|
---|
| 63 | * permissions specified in the DeletePermissionRequest messages must match this
|
---|
| 64 | * field.
|
---|
| 65 | * @param BatchDeletePermissionsRequest $postBody
|
---|
| 66 | * @param array $optParams Optional parameters.
|
---|
| 67 | * @return KeepEmpty
|
---|
| 68 | * @throws \Google\Service\Exception
|
---|
| 69 | */
|
---|
| 70 | public function batchDelete($parent, BatchDeletePermissionsRequest $postBody, $optParams = [])
|
---|
| 71 | {
|
---|
| 72 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 73 | $params = array_merge($params, $optParams);
|
---|
| 74 | return $this->call('batchDelete', [$params], KeepEmpty::class);
|
---|
| 75 | }
|
---|
| 76 | }
|
---|
| 77 |
|
---|
| 78 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 79 | class_alias(NotesPermissions::class, 'Google_Service_Keep_Resource_NotesPermissions');
|
---|