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\AndroidPublisher\Resource;
19
20use Google\Service\AndroidPublisher\Grant;
21
22/**
23 * The "grants" collection of methods.
24 * Typical usage is:
25 *  <code>
26 *   $androidpublisherService = new Google\Service\AndroidPublisher(...);
27 *   $grants = $androidpublisherService->grants;
28 *  </code>
29 */
30class Grants extends \Google\Service\Resource
31{
32  /**
33   * Grant access for a user to the given package. (grants.create)
34   *
35   * @param string $parent Required. The user which needs permission. Format:
36   * developers/{developer}/users/{user}
37   * @param Grant $postBody
38   * @param array $optParams Optional parameters.
39   * @return Grant
40   */
41  public function create($parent, Grant $postBody, $optParams = [])
42  {
43    $params = ['parent' => $parent, 'postBody' => $postBody];
44    $params = array_merge($params, $optParams);
45    return $this->call('create', [$params], Grant::class);
46  }
47  /**
48   * Removes all access for the user to the given package or developer account.
49   * (grants.delete)
50   *
51   * @param string $name Required. The name of the grant to delete. Format:
52   * developers/{developer}/users/{email}/grants/{package_name}
53   * @param array $optParams Optional parameters.
54   */
55  public function delete($name, $optParams = [])
56  {
57    $params = ['name' => $name];
58    $params = array_merge($params, $optParams);
59    return $this->call('delete', [$params]);
60  }
61  /**
62   * Updates access for the user to the given package. (grants.patch)
63   *
64   * @param string $name Required. Resource name for this grant, following the
65   * pattern "developers/{developer}/users/{email}/grants/{package_name}". If this
66   * grant is for a draft app, the app ID will be used in this resource name
67   * instead of the package name.
68   * @param Grant $postBody
69   * @param array $optParams Optional parameters.
70   *
71   * @opt_param string updateMask Optional. The list of fields to be updated.
72   * @return Grant
73   */
74  public function patch($name, Grant $postBody, $optParams = [])
75  {
76    $params = ['name' => $name, 'postBody' => $postBody];
77    $params = array_merge($params, $optParams);
78    return $this->call('patch', [$params], Grant::class);
79  }
80}
81
82// Adding a class alias for backwards compatibility with the previous class name.
83class_alias(Grants::class, 'Google_Service_AndroidPublisher_Resource_Grants');
84