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\Keep\Resource;
19
20use Google\Service\Keep\BatchCreatePermissionsRequest;
21use Google\Service\Keep\BatchCreatePermissionsResponse;
22use Google\Service\Keep\BatchDeletePermissionsRequest;
23use 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->permissions;
31 *  </code>
32 */
33class 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   */
47  public function batchCreate($parent, BatchCreatePermissionsRequest $postBody, $optParams = [])
48  {
49    $params = ['parent' => $parent, 'postBody' => $postBody];
50    $params = array_merge($params, $optParams);
51    return $this->call('batchCreate', [$params], BatchCreatePermissionsResponse::class);
52  }
53  /**
54   * Deletes one or more permissions on the note. The specified entities will
55   * immediately lose access. A permission with the `OWNER` role can't be removed.
56   * If removing a permission fails, then the entire request fails and no changes
57   * are made. Returns a 400 bad request error if a specified permission does not
58   * exist on the note. (permissions.batchDelete)
59   *
60   * @param string $parent The parent resource shared by all permissions being
61   * deleted. Format: `notes/{note}` If this is set, the parent of all of the
62   * permissions specified in the DeletePermissionRequest messages must match this
63   * field.
64   * @param BatchDeletePermissionsRequest $postBody
65   * @param array $optParams Optional parameters.
66   * @return KeepEmpty
67   */
68  public function batchDelete($parent, BatchDeletePermissionsRequest $postBody, $optParams = [])
69  {
70    $params = ['parent' => $parent, 'postBody' => $postBody];
71    $params = array_merge($params, $optParams);
72    return $this->call('batchDelete', [$params], KeepEmpty::class);
73  }
74}
75
76// Adding a class alias for backwards compatibility with the previous class name.
77class_alias(NotesPermissions::class, 'Google_Service_Keep_Resource_NotesPermissions');
78