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\Webproperties;
21use Google\Service\Analytics\Webproperty;
22
23/**
24 * The "webproperties" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $analyticsService = new Google\Service\Analytics(...);
28 *   $webproperties = $analyticsService->webproperties;
29 *  </code>
30 */
31class ManagementWebproperties extends \Google\Service\Resource
32{
33  /**
34   * Gets a web property to which the user has access. (webproperties.get)
35   *
36   * @param string $accountId Account ID to retrieve the web property for.
37   * @param string $webPropertyId ID to retrieve the web property for.
38   * @param array $optParams Optional parameters.
39   * @return Webproperty
40   */
41  public function get($accountId, $webPropertyId, $optParams = [])
42  {
43    $params = ['accountId' => $accountId, 'webPropertyId' => $webPropertyId];
44    $params = array_merge($params, $optParams);
45    return $this->call('get', [$params], Webproperty::class);
46  }
47  /**
48   * Create a new property if the account has fewer than 20 properties. Web
49   * properties are visible in the Google Analytics interface only if they have at
50   * least one profile. (webproperties.insert)
51   *
52   * @param string $accountId Account ID to create the web property for.
53   * @param Webproperty $postBody
54   * @param array $optParams Optional parameters.
55   * @return Webproperty
56   */
57  public function insert($accountId, Webproperty $postBody, $optParams = [])
58  {
59    $params = ['accountId' => $accountId, 'postBody' => $postBody];
60    $params = array_merge($params, $optParams);
61    return $this->call('insert', [$params], Webproperty::class);
62  }
63  /**
64   * Lists web properties to which the user has access.
65   * (webproperties.listManagementWebproperties)
66   *
67   * @param string $accountId Account ID to retrieve web properties for. Can
68   * either be a specific account ID or '~all', which refers to all the accounts
69   * that user has access to.
70   * @param array $optParams Optional parameters.
71   *
72   * @opt_param int max-results The maximum number of web properties to include in
73   * this response.
74   * @opt_param int start-index An index of the first entity to retrieve. Use this
75   * parameter as a pagination mechanism along with the max-results parameter.
76   * @return Webproperties
77   */
78  public function listManagementWebproperties($accountId, $optParams = [])
79  {
80    $params = ['accountId' => $accountId];
81    $params = array_merge($params, $optParams);
82    return $this->call('list', [$params], Webproperties::class);
83  }
84  /**
85   * Updates an existing web property. This method supports patch semantics.
86   * (webproperties.patch)
87   *
88   * @param string $accountId Account ID to which the web property belongs
89   * @param string $webPropertyId Web property ID
90   * @param Webproperty $postBody
91   * @param array $optParams Optional parameters.
92   * @return Webproperty
93   */
94  public function patch($accountId, $webPropertyId, Webproperty $postBody, $optParams = [])
95  {
96    $params = ['accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'postBody' => $postBody];
97    $params = array_merge($params, $optParams);
98    return $this->call('patch', [$params], Webproperty::class);
99  }
100  /**
101   * Updates an existing web property. (webproperties.update)
102   *
103   * @param string $accountId Account ID to which the web property belongs
104   * @param string $webPropertyId Web property ID
105   * @param Webproperty $postBody
106   * @param array $optParams Optional parameters.
107   * @return Webproperty
108   */
109  public function update($accountId, $webPropertyId, Webproperty $postBody, $optParams = [])
110  {
111    $params = ['accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'postBody' => $postBody];
112    $params = array_merge($params, $optParams);
113    return $this->call('update', [$params], Webproperty::class);
114  }
115}
116
117// Adding a class alias for backwards compatibility with the previous class name.
118class_alias(ManagementWebproperties::class, 'Google_Service_Analytics_Resource_ManagementWebproperties');
119