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\TagManager\Resource;
19
20use Google\Service\TagManager\ListUserPermissionsResponse;
21use Google\Service\TagManager\UserPermission;
22
23/**
24 * The "user_permissions" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $tagmanagerService = new Google\Service\TagManager(...);
28 *   $user_permissions = $tagmanagerService->user_permissions;
29 *  </code>
30 */
31class AccountsUserPermissions extends \Google\Service\Resource
32{
33  /**
34   * Creates a user's Account & Container access. (user_permissions.create)
35   *
36   * @param string $parent GTM Account's API relative path. Example:
37   * accounts/{account_id}
38   * @param UserPermission $postBody
39   * @param array $optParams Optional parameters.
40   * @return UserPermission
41   */
42  public function create($parent, UserPermission $postBody, $optParams = [])
43  {
44    $params = ['parent' => $parent, 'postBody' => $postBody];
45    $params = array_merge($params, $optParams);
46    return $this->call('create', [$params], UserPermission::class);
47  }
48  /**
49   * Removes a user from the account, revoking access to it and all of its
50   * containers. (user_permissions.delete)
51   *
52   * @param string $path GTM UserPermission's API relative path. Example:
53   * accounts/{account_id}/user_permissions/{user_permission_id}
54   * @param array $optParams Optional parameters.
55   */
56  public function delete($path, $optParams = [])
57  {
58    $params = ['path' => $path];
59    $params = array_merge($params, $optParams);
60    return $this->call('delete', [$params]);
61  }
62  /**
63   * Gets a user's Account & Container access. (user_permissions.get)
64   *
65   * @param string $path GTM UserPermission's API relative path. Example:
66   * accounts/{account_id}/user_permissions/{user_permission_id}
67   * @param array $optParams Optional parameters.
68   * @return UserPermission
69   */
70  public function get($path, $optParams = [])
71  {
72    $params = ['path' => $path];
73    $params = array_merge($params, $optParams);
74    return $this->call('get', [$params], UserPermission::class);
75  }
76  /**
77   * List all users that have access to the account along with Account and
78   * Container user access granted to each of them.
79   * (user_permissions.listAccountsUserPermissions)
80   *
81   * @param string $parent GTM Accounts's API relative path. Example:
82   * accounts/{account_id}
83   * @param array $optParams Optional parameters.
84   *
85   * @opt_param string pageToken Continuation token for fetching the next page of
86   * results.
87   * @return ListUserPermissionsResponse
88   */
89  public function listAccountsUserPermissions($parent, $optParams = [])
90  {
91    $params = ['parent' => $parent];
92    $params = array_merge($params, $optParams);
93    return $this->call('list', [$params], ListUserPermissionsResponse::class);
94  }
95  /**
96   * Updates a user's Account & Container access. (user_permissions.update)
97   *
98   * @param string $path GTM UserPermission's API relative path. Example:
99   * accounts/{account_id}/user_permissions/{user_permission_id}
100   * @param UserPermission $postBody
101   * @param array $optParams Optional parameters.
102   * @return UserPermission
103   */
104  public function update($path, UserPermission $postBody, $optParams = [])
105  {
106    $params = ['path' => $path, 'postBody' => $postBody];
107    $params = array_merge($params, $optParams);
108    return $this->call('update', [$params], UserPermission::class);
109  }
110}
111
112// Adding a class alias for backwards compatibility with the previous class name.
113class_alias(AccountsUserPermissions::class, 'Google_Service_TagManager_Resource_AccountsUserPermissions');
114