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