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\GoogleAnalyticsAdmin\Resource;
19
20use Google\Service\GoogleAnalyticsAdmin\GoogleAnalyticsAdminV1alphaAuditUserLinksRequest;
21use Google\Service\GoogleAnalyticsAdmin\GoogleAnalyticsAdminV1alphaAuditUserLinksResponse;
22use Google\Service\GoogleAnalyticsAdmin\GoogleAnalyticsAdminV1alphaBatchCreateUserLinksRequest;
23use Google\Service\GoogleAnalyticsAdmin\GoogleAnalyticsAdminV1alphaBatchCreateUserLinksResponse;
24use Google\Service\GoogleAnalyticsAdmin\GoogleAnalyticsAdminV1alphaBatchDeleteUserLinksRequest;
25use Google\Service\GoogleAnalyticsAdmin\GoogleAnalyticsAdminV1alphaBatchGetUserLinksResponse;
26use Google\Service\GoogleAnalyticsAdmin\GoogleAnalyticsAdminV1alphaBatchUpdateUserLinksRequest;
27use Google\Service\GoogleAnalyticsAdmin\GoogleAnalyticsAdminV1alphaBatchUpdateUserLinksResponse;
28use Google\Service\GoogleAnalyticsAdmin\GoogleAnalyticsAdminV1alphaListUserLinksResponse;
29use Google\Service\GoogleAnalyticsAdmin\GoogleAnalyticsAdminV1alphaUserLink;
30use Google\Service\GoogleAnalyticsAdmin\GoogleProtobufEmpty;
31
32/**
33 * The "userLinks" collection of methods.
34 * Typical usage is:
35 *  <code>
36 *   $analyticsadminService = new Google\Service\GoogleAnalyticsAdmin(...);
37 *   $userLinks = $analyticsadminService->userLinks;
38 *  </code>
39 */
40class AccountsUserLinks extends \Google\Service\Resource
41{
42  /**
43   * Lists all user links on an account or property, including implicit ones that
44   * come from effective permissions granted by groups or organization admin
45   * roles. If a returned user link does not have direct permissions, they cannot
46   * be removed from the account or property directly with the DeleteUserLink
47   * command. They have to be removed from the group/etc that gives them
48   * permissions, which is currently only usable/discoverable in the GA or GMP
49   * UIs. (userLinks.audit)
50   *
51   * @param string $parent Required. Example format: accounts/1234
52   * @param GoogleAnalyticsAdminV1alphaAuditUserLinksRequest $postBody
53   * @param array $optParams Optional parameters.
54   * @return GoogleAnalyticsAdminV1alphaAuditUserLinksResponse
55   */
56  public function audit($parent, GoogleAnalyticsAdminV1alphaAuditUserLinksRequest $postBody, $optParams = [])
57  {
58    $params = ['parent' => $parent, 'postBody' => $postBody];
59    $params = array_merge($params, $optParams);
60    return $this->call('audit', [$params], GoogleAnalyticsAdminV1alphaAuditUserLinksResponse::class);
61  }
62  /**
63   * Creates information about multiple users' links to an account or property.
64   * This method is transactional. If any UserLink cannot be created, none of the
65   * UserLinks will be created. (userLinks.batchCreate)
66   *
67   * @param string $parent Required. The account or property that all user links
68   * in the request are for. This field is required. The parent field in the
69   * CreateUserLinkRequest messages must either be empty or match this field.
70   * Example format: accounts/1234
71   * @param GoogleAnalyticsAdminV1alphaBatchCreateUserLinksRequest $postBody
72   * @param array $optParams Optional parameters.
73   * @return GoogleAnalyticsAdminV1alphaBatchCreateUserLinksResponse
74   */
75  public function batchCreate($parent, GoogleAnalyticsAdminV1alphaBatchCreateUserLinksRequest $postBody, $optParams = [])
76  {
77    $params = ['parent' => $parent, 'postBody' => $postBody];
78    $params = array_merge($params, $optParams);
79    return $this->call('batchCreate', [$params], GoogleAnalyticsAdminV1alphaBatchCreateUserLinksResponse::class);
80  }
81  /**
82   * Deletes information about multiple users' links to an account or property.
83   * (userLinks.batchDelete)
84   *
85   * @param string $parent Required. The account or property that all user links
86   * in the request are for. The parent of all values for user link names to
87   * delete must match this field. Example format: accounts/1234
88   * @param GoogleAnalyticsAdminV1alphaBatchDeleteUserLinksRequest $postBody
89   * @param array $optParams Optional parameters.
90   * @return GoogleProtobufEmpty
91   */
92  public function batchDelete($parent, GoogleAnalyticsAdminV1alphaBatchDeleteUserLinksRequest $postBody, $optParams = [])
93  {
94    $params = ['parent' => $parent, 'postBody' => $postBody];
95    $params = array_merge($params, $optParams);
96    return $this->call('batchDelete', [$params], GoogleProtobufEmpty::class);
97  }
98  /**
99   * Gets information about multiple users' links to an account or property.
100   * (userLinks.batchGet)
101   *
102   * @param string $parent Required. The account or property that all user links
103   * in the request are for. The parent of all provided values for the 'names'
104   * field must match this field. Example format: accounts/1234
105   * @param array $optParams Optional parameters.
106   *
107   * @opt_param string names Required. The names of the user links to retrieve. A
108   * maximum of 1000 user links can be retrieved in a batch. Format:
109   * accounts/{accountId}/userLinks/{userLinkId}
110   * @return GoogleAnalyticsAdminV1alphaBatchGetUserLinksResponse
111   */
112  public function batchGet($parent, $optParams = [])
113  {
114    $params = ['parent' => $parent];
115    $params = array_merge($params, $optParams);
116    return $this->call('batchGet', [$params], GoogleAnalyticsAdminV1alphaBatchGetUserLinksResponse::class);
117  }
118  /**
119   * Updates information about multiple users' links to an account or property.
120   * (userLinks.batchUpdate)
121   *
122   * @param string $parent Required. The account or property that all user links
123   * in the request are for. The parent field in the UpdateUserLinkRequest
124   * messages must either be empty or match this field. Example format:
125   * accounts/1234
126   * @param GoogleAnalyticsAdminV1alphaBatchUpdateUserLinksRequest $postBody
127   * @param array $optParams Optional parameters.
128   * @return GoogleAnalyticsAdminV1alphaBatchUpdateUserLinksResponse
129   */
130  public function batchUpdate($parent, GoogleAnalyticsAdminV1alphaBatchUpdateUserLinksRequest $postBody, $optParams = [])
131  {
132    $params = ['parent' => $parent, 'postBody' => $postBody];
133    $params = array_merge($params, $optParams);
134    return $this->call('batchUpdate', [$params], GoogleAnalyticsAdminV1alphaBatchUpdateUserLinksResponse::class);
135  }
136  /**
137   * Creates a user link on an account or property. If the user with the specified
138   * email already has permissions on the account or property, then the user's
139   * existing permissions will be unioned with the permissions specified in the
140   * new UserLink. (userLinks.create)
141   *
142   * @param string $parent Required. Example format: accounts/1234
143   * @param GoogleAnalyticsAdminV1alphaUserLink $postBody
144   * @param array $optParams Optional parameters.
145   *
146   * @opt_param bool notifyNewUser Optional. If set, then email the new user
147   * notifying them that they've been granted permissions to the resource.
148   * @return GoogleAnalyticsAdminV1alphaUserLink
149   */
150  public function create($parent, GoogleAnalyticsAdminV1alphaUserLink $postBody, $optParams = [])
151  {
152    $params = ['parent' => $parent, 'postBody' => $postBody];
153    $params = array_merge($params, $optParams);
154    return $this->call('create', [$params], GoogleAnalyticsAdminV1alphaUserLink::class);
155  }
156  /**
157   * Deletes a user link on an account or property. (userLinks.delete)
158   *
159   * @param string $name Required. Example format: accounts/1234/userLinks/5678
160   * @param array $optParams Optional parameters.
161   * @return GoogleProtobufEmpty
162   */
163  public function delete($name, $optParams = [])
164  {
165    $params = ['name' => $name];
166    $params = array_merge($params, $optParams);
167    return $this->call('delete', [$params], GoogleProtobufEmpty::class);
168  }
169  /**
170   * Gets information about a user's link to an account or property.
171   * (userLinks.get)
172   *
173   * @param string $name Required. Example format: accounts/1234/userLinks/5678
174   * @param array $optParams Optional parameters.
175   * @return GoogleAnalyticsAdminV1alphaUserLink
176   */
177  public function get($name, $optParams = [])
178  {
179    $params = ['name' => $name];
180    $params = array_merge($params, $optParams);
181    return $this->call('get', [$params], GoogleAnalyticsAdminV1alphaUserLink::class);
182  }
183  /**
184   * Lists all user links on an account or property.
185   * (userLinks.listAccountsUserLinks)
186   *
187   * @param string $parent Required. Example format: accounts/1234
188   * @param array $optParams Optional parameters.
189   *
190   * @opt_param int pageSize The maximum number of user links to return. The
191   * service may return fewer than this value. If unspecified, at most 200 user
192   * links will be returned. The maximum value is 500; values above 500 will be
193   * coerced to 500.
194   * @opt_param string pageToken A page token, received from a previous
195   * `ListUserLinks` call. Provide this to retrieve the subsequent page. When
196   * paginating, all other parameters provided to `ListUserLinks` must match the
197   * call that provided the page token.
198   * @return GoogleAnalyticsAdminV1alphaListUserLinksResponse
199   */
200  public function listAccountsUserLinks($parent, $optParams = [])
201  {
202    $params = ['parent' => $parent];
203    $params = array_merge($params, $optParams);
204    return $this->call('list', [$params], GoogleAnalyticsAdminV1alphaListUserLinksResponse::class);
205  }
206  /**
207   * Updates a user link on an account or property. (userLinks.patch)
208   *
209   * @param string $name Output only. Example format:
210   * properties/1234/userLinks/5678
211   * @param GoogleAnalyticsAdminV1alphaUserLink $postBody
212   * @param array $optParams Optional parameters.
213   * @return GoogleAnalyticsAdminV1alphaUserLink
214   */
215  public function patch($name, GoogleAnalyticsAdminV1alphaUserLink $postBody, $optParams = [])
216  {
217    $params = ['name' => $name, 'postBody' => $postBody];
218    $params = array_merge($params, $optParams);
219    return $this->call('patch', [$params], GoogleAnalyticsAdminV1alphaUserLink::class);
220  }
221}
222
223// Adding a class alias for backwards compatibility with the previous class name.
224class_alias(AccountsUserLinks::class, 'Google_Service_GoogleAnalyticsAdmin_Resource_AccountsUserLinks');
225