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\GoogleAnalyticsAdminV1alphaArchiveCustomMetricRequest;
21use Google\Service\GoogleAnalyticsAdmin\GoogleAnalyticsAdminV1alphaCustomMetric;
22use Google\Service\GoogleAnalyticsAdmin\GoogleAnalyticsAdminV1alphaListCustomMetricsResponse;
23use Google\Service\GoogleAnalyticsAdmin\GoogleProtobufEmpty;
24
25/**
26 * The "customMetrics" collection of methods.
27 * Typical usage is:
28 *  <code>
29 *   $analyticsadminService = new Google\Service\GoogleAnalyticsAdmin(...);
30 *   $customMetrics = $analyticsadminService->customMetrics;
31 *  </code>
32 */
33class PropertiesCustomMetrics extends \Google\Service\Resource
34{
35  /**
36   * Archives a CustomMetric on a property. (customMetrics.archive)
37   *
38   * @param string $name Required. The name of the CustomMetric to archive.
39   * Example format: properties/1234/customMetrics/5678
40   * @param GoogleAnalyticsAdminV1alphaArchiveCustomMetricRequest $postBody
41   * @param array $optParams Optional parameters.
42   * @return GoogleProtobufEmpty
43   */
44  public function archive($name, GoogleAnalyticsAdminV1alphaArchiveCustomMetricRequest $postBody, $optParams = [])
45  {
46    $params = ['name' => $name, 'postBody' => $postBody];
47    $params = array_merge($params, $optParams);
48    return $this->call('archive', [$params], GoogleProtobufEmpty::class);
49  }
50  /**
51   * Creates a CustomMetric. (customMetrics.create)
52   *
53   * @param string $parent Required. Example format: properties/1234
54   * @param GoogleAnalyticsAdminV1alphaCustomMetric $postBody
55   * @param array $optParams Optional parameters.
56   * @return GoogleAnalyticsAdminV1alphaCustomMetric
57   */
58  public function create($parent, GoogleAnalyticsAdminV1alphaCustomMetric $postBody, $optParams = [])
59  {
60    $params = ['parent' => $parent, 'postBody' => $postBody];
61    $params = array_merge($params, $optParams);
62    return $this->call('create', [$params], GoogleAnalyticsAdminV1alphaCustomMetric::class);
63  }
64  /**
65   * Lookup for a single CustomMetric. (customMetrics.get)
66   *
67   * @param string $name Required. The name of the CustomMetric to get. Example
68   * format: properties/1234/customMetrics/5678
69   * @param array $optParams Optional parameters.
70   * @return GoogleAnalyticsAdminV1alphaCustomMetric
71   */
72  public function get($name, $optParams = [])
73  {
74    $params = ['name' => $name];
75    $params = array_merge($params, $optParams);
76    return $this->call('get', [$params], GoogleAnalyticsAdminV1alphaCustomMetric::class);
77  }
78  /**
79   * Lists CustomMetrics on a property.
80   * (customMetrics.listPropertiesCustomMetrics)
81   *
82   * @param string $parent Required. Example format: properties/1234
83   * @param array $optParams Optional parameters.
84   *
85   * @opt_param int pageSize The maximum number of resources to return. If
86   * unspecified, at most 50 resources will be returned. The maximum value is 200
87   * (higher values will be coerced to the maximum).
88   * @opt_param string pageToken A page token, received from a previous
89   * `ListCustomMetrics` call. Provide this to retrieve the subsequent page. When
90   * paginating, all other parameters provided to `ListCustomMetrics` must match
91   * the call that provided the page token.
92   * @return GoogleAnalyticsAdminV1alphaListCustomMetricsResponse
93   */
94  public function listPropertiesCustomMetrics($parent, $optParams = [])
95  {
96    $params = ['parent' => $parent];
97    $params = array_merge($params, $optParams);
98    return $this->call('list', [$params], GoogleAnalyticsAdminV1alphaListCustomMetricsResponse::class);
99  }
100  /**
101   * Updates a CustomMetric on a property. (customMetrics.patch)
102   *
103   * @param string $name Output only. Resource name for this CustomMetric
104   * resource. Format: properties/{property}/customMetrics/{customMetric}
105   * @param GoogleAnalyticsAdminV1alphaCustomMetric $postBody
106   * @param array $optParams Optional parameters.
107   *
108   * @opt_param string updateMask Required. The list of fields to be updated.
109   * Omitted fields will not be updated. To replace the entire entity, use one
110   * path with the string "*" to match all fields.
111   * @return GoogleAnalyticsAdminV1alphaCustomMetric
112   */
113  public function patch($name, GoogleAnalyticsAdminV1alphaCustomMetric $postBody, $optParams = [])
114  {
115    $params = ['name' => $name, 'postBody' => $postBody];
116    $params = array_merge($params, $optParams);
117    return $this->call('patch', [$params], GoogleAnalyticsAdminV1alphaCustomMetric::class);
118  }
119}
120
121// Adding a class alias for backwards compatibility with the previous class name.
122class_alias(PropertiesCustomMetrics::class, 'Google_Service_GoogleAnalyticsAdmin_Resource_PropertiesCustomMetrics');
123