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\MyBusinessAccountManagement\Resource;
19
20use Google\Service\MyBusinessAccountManagement\Admin;
21use Google\Service\MyBusinessAccountManagement\ListAccountAdminsResponse;
22use Google\Service\MyBusinessAccountManagement\MybusinessaccountmanagementEmpty;
23
24/**
25 * The "admins" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $mybusinessaccountmanagementService = new Google\Service\MyBusinessAccountManagement(...);
29 *   $admins = $mybusinessaccountmanagementService->admins;
30 *  </code>
31 */
32class AccountsAdmins extends \Google\Service\Resource
33{
34  /**
35   * Invites the specified user to become an administrator for the specified
36   * account. The invitee must accept the invitation in order to be granted access
37   * to the account. See AcceptInvitation to programmatically accept an
38   * invitation. (admins.create)
39   *
40   * @param string $parent Required. The resource name of the account this admin
41   * is created for. `accounts/{account_id}`.
42   * @param Admin $postBody
43   * @param array $optParams Optional parameters.
44   * @return Admin
45   */
46  public function create($parent, Admin $postBody, $optParams = [])
47  {
48    $params = ['parent' => $parent, 'postBody' => $postBody];
49    $params = array_merge($params, $optParams);
50    return $this->call('create', [$params], Admin::class);
51  }
52  /**
53   * Removes the specified admin from the specified account. (admins.delete)
54   *
55   * @param string $name Required. The resource name of the admin to remove from
56   * the account. `accounts/{account_id}/admins/{admin_id}`.
57   * @param array $optParams Optional parameters.
58   * @return MybusinessaccountmanagementEmpty
59   */
60  public function delete($name, $optParams = [])
61  {
62    $params = ['name' => $name];
63    $params = array_merge($params, $optParams);
64    return $this->call('delete', [$params], MybusinessaccountmanagementEmpty::class);
65  }
66  /**
67   * Lists the admins for the specified account. (admins.listAccountsAdmins)
68   *
69   * @param string $parent Required. The name of the account from which to
70   * retrieve a list of admins. `accounts/{account_id}/admins`.
71   * @param array $optParams Optional parameters.
72   * @return ListAccountAdminsResponse
73   */
74  public function listAccountsAdmins($parent, $optParams = [])
75  {
76    $params = ['parent' => $parent];
77    $params = array_merge($params, $optParams);
78    return $this->call('list', [$params], ListAccountAdminsResponse::class);
79  }
80  /**
81   * Updates the Admin for the specified Account Admin. (admins.patch)
82   *
83   * @param string $name Immutable. The resource name. For account admins, this is
84   * in the form: `accounts/{account_id}/admins/{admin_id}` For location admins,
85   * this is in the form: `locations/{location_id}/admins/{admin_id}` This field
86   * will be ignored if set during admin creation.
87   * @param Admin $postBody
88   * @param array $optParams Optional parameters.
89   *
90   * @opt_param string updateMask Required. The specific fields that should be
91   * updated. The only editable field is role.
92   * @return Admin
93   */
94  public function patch($name, Admin $postBody, $optParams = [])
95  {
96    $params = ['name' => $name, 'postBody' => $postBody];
97    $params = array_merge($params, $optParams);
98    return $this->call('patch', [$params], Admin::class);
99  }
100}
101
102// Adding a class alias for backwards compatibility with the previous class name.
103class_alias(AccountsAdmins::class, 'Google_Service_MyBusinessAccountManagement_Resource_AccountsAdmins');
104