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