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