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\CustomDimension;
21use Google\Service\Analytics\CustomDimensions;
22
23/**
24 * The "customDimensions" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $analyticsService = new Google\Service\Analytics(...);
28 *   $customDimensions = $analyticsService->customDimensions;
29 *  </code>
30 */
31class ManagementCustomDimensions extends \Google\Service\Resource
32{
33  /**
34   * Get a custom dimension to which the user has access. (customDimensions.get)
35   *
36   * @param string $accountId Account ID for the custom dimension to retrieve.
37   * @param string $webPropertyId Web property ID for the custom dimension to
38   * retrieve.
39   * @param string $customDimensionId The ID of the custom dimension to retrieve.
40   * @param array $optParams Optional parameters.
41   * @return CustomDimension
42   */
43  public function get($accountId, $webPropertyId, $customDimensionId, $optParams = [])
44  {
45    $params = ['accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'customDimensionId' => $customDimensionId];
46    $params = array_merge($params, $optParams);
47    return $this->call('get', [$params], CustomDimension::class);
48  }
49  /**
50   * Create a new custom dimension. (customDimensions.insert)
51   *
52   * @param string $accountId Account ID for the custom dimension to create.
53   * @param string $webPropertyId Web property ID for the custom dimension to
54   * create.
55   * @param CustomDimension $postBody
56   * @param array $optParams Optional parameters.
57   * @return CustomDimension
58   */
59  public function insert($accountId, $webPropertyId, CustomDimension $postBody, $optParams = [])
60  {
61    $params = ['accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'postBody' => $postBody];
62    $params = array_merge($params, $optParams);
63    return $this->call('insert', [$params], CustomDimension::class);
64  }
65  /**
66   * Lists custom dimensions to which the user has access.
67   * (customDimensions.listManagementCustomDimensions)
68   *
69   * @param string $accountId Account ID for the custom dimensions to retrieve.
70   * @param string $webPropertyId Web property ID for the custom dimensions to
71   * retrieve.
72   * @param array $optParams Optional parameters.
73   *
74   * @opt_param int max-results The maximum number of custom dimensions to include
75   * in this response.
76   * @opt_param int start-index An index of the first entity to retrieve. Use this
77   * parameter as a pagination mechanism along with the max-results parameter.
78   * @return CustomDimensions
79   */
80  public function listManagementCustomDimensions($accountId, $webPropertyId, $optParams = [])
81  {
82    $params = ['accountId' => $accountId, 'webPropertyId' => $webPropertyId];
83    $params = array_merge($params, $optParams);
84    return $this->call('list', [$params], CustomDimensions::class);
85  }
86  /**
87   * Updates an existing custom dimension. This method supports patch semantics.
88   * (customDimensions.patch)
89   *
90   * @param string $accountId Account ID for the custom dimension to update.
91   * @param string $webPropertyId Web property ID for the custom dimension to
92   * update.
93   * @param string $customDimensionId Custom dimension ID for the custom dimension
94   * to update.
95   * @param CustomDimension $postBody
96   * @param array $optParams Optional parameters.
97   *
98   * @opt_param bool ignoreCustomDataSourceLinks Force the update and ignore any
99   * warnings related to the custom dimension being linked to a custom data source
100   * / data set.
101   * @return CustomDimension
102   */
103  public function patch($accountId, $webPropertyId, $customDimensionId, CustomDimension $postBody, $optParams = [])
104  {
105    $params = ['accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'customDimensionId' => $customDimensionId, 'postBody' => $postBody];
106    $params = array_merge($params, $optParams);
107    return $this->call('patch', [$params], CustomDimension::class);
108  }
109  /**
110   * Updates an existing custom dimension. (customDimensions.update)
111   *
112   * @param string $accountId Account ID for the custom dimension to update.
113   * @param string $webPropertyId Web property ID for the custom dimension to
114   * update.
115   * @param string $customDimensionId Custom dimension ID for the custom dimension
116   * to update.
117   * @param CustomDimension $postBody
118   * @param array $optParams Optional parameters.
119   *
120   * @opt_param bool ignoreCustomDataSourceLinks Force the update and ignore any
121   * warnings related to the custom dimension being linked to a custom data source
122   * / data set.
123   * @return CustomDimension
124   */
125  public function update($accountId, $webPropertyId, $customDimensionId, CustomDimension $postBody, $optParams = [])
126  {
127    $params = ['accountId' => $accountId, 'webPropertyId' => $webPropertyId, 'customDimensionId' => $customDimensionId, 'postBody' => $postBody];
128    $params = array_merge($params, $optParams);
129    return $this->call('update', [$params], CustomDimension::class);
130  }
131}
132
133// Adding a class alias for backwards compatibility with the previous class name.
134class_alias(ManagementCustomDimensions::class, 'Google_Service_Analytics_Resource_ManagementCustomDimensions');
135