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\Analytics\Resource;
19
20use Google\Service\Analytics\EntityUserLink;
21use Google\Service\Analytics\EntityUserLinks;
22
23/**
24 * The "accountUserLinks" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $analyticsService = new Google\Service\Analytics(...);
28 *   $accountUserLinks = $analyticsService->accountUserLinks;
29 *  </code>
30 */
31class ManagementAccountUserLinks extends \Google\Service\Resource
32{
33  /**
34   * Removes a user from the given account. (accountUserLinks.delete)
35   *
36   * @param string $accountId Account ID to delete the user link for.
37   * @param string $linkId Link ID to delete the user link for.
38   * @param array $optParams Optional parameters.
39   */
40  public function delete($accountId, $linkId, $optParams = [])
41  {
42    $params = ['accountId' => $accountId, 'linkId' => $linkId];
43    $params = array_merge($params, $optParams);
44    return $this->call('delete', [$params]);
45  }
46  /**
47   * Adds a new user to the given account. (accountUserLinks.insert)
48   *
49   * @param string $accountId Account ID to create the user link for.
50   * @param EntityUserLink $postBody
51   * @param array $optParams Optional parameters.
52   * @return EntityUserLink
53   */
54  public function insert($accountId, EntityUserLink $postBody, $optParams = [])
55  {
56    $params = ['accountId' => $accountId, 'postBody' => $postBody];
57    $params = array_merge($params, $optParams);
58    return $this->call('insert', [$params], EntityUserLink::class);
59  }
60  /**
61   * Lists account-user links for a given account.
62   * (accountUserLinks.listManagementAccountUserLinks)
63   *
64   * @param string $accountId Account ID to retrieve the user links for.
65   * @param array $optParams Optional parameters.
66   *
67   * @opt_param int max-results The maximum number of account-user links to
68   * include in this response.
69   * @opt_param int start-index An index of the first account-user link to
70   * retrieve. Use this parameter as a pagination mechanism along with the max-
71   * results parameter.
72   * @return EntityUserLinks
73   */
74  public function listManagementAccountUserLinks($accountId, $optParams = [])
75  {
76    $params = ['accountId' => $accountId];
77    $params = array_merge($params, $optParams);
78    return $this->call('list', [$params], EntityUserLinks::class);
79  }
80  /**
81   * Updates permissions for an existing user on the given account.
82   * (accountUserLinks.update)
83   *
84   * @param string $accountId Account ID to update the account-user link for.
85   * @param string $linkId Link ID to update the account-user link for.
86   * @param EntityUserLink $postBody
87   * @param array $optParams Optional parameters.
88   * @return EntityUserLink
89   */
90  public function update($accountId, $linkId, EntityUserLink $postBody, $optParams = [])
91  {
92    $params = ['accountId' => $accountId, 'linkId' => $linkId, 'postBody' => $postBody];
93    $params = array_merge($params, $optParams);
94    return $this->call('update', [$params], EntityUserLink::class);
95  }
96}
97
98// Adding a class alias for backwards compatibility with the previous class name.
99class_alias(ManagementAccountUserLinks::class, 'Google_Service_Analytics_Resource_ManagementAccountUserLinks');
100