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\GoogleAnalyticsAdminV1alphaAcknowledgeUserDataCollectionRequest;
21use Google\Service\GoogleAnalyticsAdmin\GoogleAnalyticsAdminV1alphaAcknowledgeUserDataCollectionResponse;
22use Google\Service\GoogleAnalyticsAdmin\GoogleAnalyticsAdminV1alphaDataRetentionSettings;
23use Google\Service\GoogleAnalyticsAdmin\GoogleAnalyticsAdminV1alphaGoogleSignalsSettings;
24use Google\Service\GoogleAnalyticsAdmin\GoogleAnalyticsAdminV1alphaListPropertiesResponse;
25use Google\Service\GoogleAnalyticsAdmin\GoogleAnalyticsAdminV1alphaProperty;
26
27/**
28 * The "properties" collection of methods.
29 * Typical usage is:
30 *  <code>
31 *   $analyticsadminService = new Google\Service\GoogleAnalyticsAdmin(...);
32 *   $properties = $analyticsadminService->properties;
33 *  </code>
34 */
35class Properties extends \Google\Service\Resource
36{
37  /**
38   * Acknowledges the terms of user data collection for the specified property.
39   * This acknowledgement must be completed (either in the Google Analytics UI or
40   * via this API) before MeasurementProtocolSecret resources may be created.
41   * (properties.acknowledgeUserDataCollection)
42   *
43   * @param string $property Required. The property for which to acknowledge user
44   * data collection.
45   * @param GoogleAnalyticsAdminV1alphaAcknowledgeUserDataCollectionRequest $postBody
46   * @param array $optParams Optional parameters.
47   * @return GoogleAnalyticsAdminV1alphaAcknowledgeUserDataCollectionResponse
48   */
49  public function acknowledgeUserDataCollection($property, GoogleAnalyticsAdminV1alphaAcknowledgeUserDataCollectionRequest $postBody, $optParams = [])
50  {
51    $params = ['property' => $property, 'postBody' => $postBody];
52    $params = array_merge($params, $optParams);
53    return $this->call('acknowledgeUserDataCollection', [$params], GoogleAnalyticsAdminV1alphaAcknowledgeUserDataCollectionResponse::class);
54  }
55  /**
56   * Creates an "GA4" property with the specified location and attributes.
57   * (properties.create)
58   *
59   * @param GoogleAnalyticsAdminV1alphaProperty $postBody
60   * @param array $optParams Optional parameters.
61   * @return GoogleAnalyticsAdminV1alphaProperty
62   */
63  public function create(GoogleAnalyticsAdminV1alphaProperty $postBody, $optParams = [])
64  {
65    $params = ['postBody' => $postBody];
66    $params = array_merge($params, $optParams);
67    return $this->call('create', [$params], GoogleAnalyticsAdminV1alphaProperty::class);
68  }
69  /**
70   * Marks target Property as soft-deleted (ie: "trashed") and returns it. This
71   * API does not have a method to restore soft-deleted properties. However, they
72   * can be restored using the Trash Can UI. If the properties are not restored
73   * before the expiration time, the Property and all child resources (eg:
74   * GoogleAdsLinks, Streams, UserLinks) will be permanently purged.
75   * https://support.google.com/analytics/answer/6154772 Returns an error if the
76   * target is not found, or is not an GA4 Property. (properties.delete)
77   *
78   * @param string $name Required. The name of the Property to soft-delete.
79   * Format: properties/{property_id} Example: "properties/1000"
80   * @param array $optParams Optional parameters.
81   * @return GoogleAnalyticsAdminV1alphaProperty
82   */
83  public function delete($name, $optParams = [])
84  {
85    $params = ['name' => $name];
86    $params = array_merge($params, $optParams);
87    return $this->call('delete', [$params], GoogleAnalyticsAdminV1alphaProperty::class);
88  }
89  /**
90   * Lookup for a single "GA4" Property. (properties.get)
91   *
92   * @param string $name Required. The name of the property to lookup. Format:
93   * properties/{property_id} Example: "properties/1000"
94   * @param array $optParams Optional parameters.
95   * @return GoogleAnalyticsAdminV1alphaProperty
96   */
97  public function get($name, $optParams = [])
98  {
99    $params = ['name' => $name];
100    $params = array_merge($params, $optParams);
101    return $this->call('get', [$params], GoogleAnalyticsAdminV1alphaProperty::class);
102  }
103  /**
104   * Returns the singleton data retention settings for this property.
105   * (properties.getDataRetentionSettings)
106   *
107   * @param string $name Required. The name of the settings to lookup. Format:
108   * properties/{property}/dataRetentionSettings Example:
109   * "properties/1000/dataRetentionSettings"
110   * @param array $optParams Optional parameters.
111   * @return GoogleAnalyticsAdminV1alphaDataRetentionSettings
112   */
113  public function getDataRetentionSettings($name, $optParams = [])
114  {
115    $params = ['name' => $name];
116    $params = array_merge($params, $optParams);
117    return $this->call('getDataRetentionSettings', [$params], GoogleAnalyticsAdminV1alphaDataRetentionSettings::class);
118  }
119  /**
120   * Lookup for Google Signals settings for a property.
121   * (properties.getGoogleSignalsSettings)
122   *
123   * @param string $name Required. The name of the google signals settings to
124   * retrieve. Format: properties/{property}/googleSignalsSettings
125   * @param array $optParams Optional parameters.
126   * @return GoogleAnalyticsAdminV1alphaGoogleSignalsSettings
127   */
128  public function getGoogleSignalsSettings($name, $optParams = [])
129  {
130    $params = ['name' => $name];
131    $params = array_merge($params, $optParams);
132    return $this->call('getGoogleSignalsSettings', [$params], GoogleAnalyticsAdminV1alphaGoogleSignalsSettings::class);
133  }
134  /**
135   * Returns child Properties under the specified parent Account. Only "GA4"
136   * properties will be returned. Properties will be excluded if the caller does
137   * not have access. Soft-deleted (ie: "trashed") properties are excluded by
138   * default. Returns an empty list if no relevant properties are found.
139   * (properties.listProperties)
140   *
141   * @param array $optParams Optional parameters.
142   *
143   * @opt_param string filter Required. An expression for filtering the results of
144   * the request. Fields eligible for filtering are: `parent:`(The resource name
145   * of the parent account/property) or `ancestor:`(The resource name of the
146   * parent account) or `firebase_project:`(The id or number of the linked
147   * firebase project). Some examples of filters: ``` | Filter | Description |
148   * |-----------------------------|-------------------------------------------| |
149   * parent:accounts/123 | The account with account id: 123. | |
150   * parent:properties/123 | The property with property id: 123. | |
151   * ancestor:accounts/123 | The account with account id: 123. | |
152   * firebase_project:project-id | The firebase project with id: project-id. | |
153   * firebase_project:123 | The firebase project with number: 123. | ```
154   * @opt_param int pageSize The maximum number of resources to return. The
155   * service may return fewer than this value, even if there are additional pages.
156   * If unspecified, at most 50 resources will be returned. The maximum value is
157   * 200; (higher values will be coerced to the maximum)
158   * @opt_param string pageToken A page token, received from a previous
159   * `ListProperties` call. Provide this to retrieve the subsequent page. When
160   * paginating, all other parameters provided to `ListProperties` must match the
161   * call that provided the page token.
162   * @opt_param bool showDeleted Whether to include soft-deleted (ie: "trashed")
163   * Properties in the results. Properties can be inspected to determine whether
164   * they are deleted or not.
165   * @return GoogleAnalyticsAdminV1alphaListPropertiesResponse
166   */
167  public function listProperties($optParams = [])
168  {
169    $params = [];
170    $params = array_merge($params, $optParams);
171    return $this->call('list', [$params], GoogleAnalyticsAdminV1alphaListPropertiesResponse::class);
172  }
173  /**
174   * Updates a property. (properties.patch)
175   *
176   * @param string $name Output only. Resource name of this property. Format:
177   * properties/{property_id} Example: "properties/1000"
178   * @param GoogleAnalyticsAdminV1alphaProperty $postBody
179   * @param array $optParams Optional parameters.
180   *
181   * @opt_param string updateMask Required. The list of fields to be updated.
182   * Field names must be in snake case (e.g., "field_to_update"). Omitted fields
183   * will not be updated. To replace the entire entity, use one path with the
184   * string "*" to match all fields.
185   * @return GoogleAnalyticsAdminV1alphaProperty
186   */
187  public function patch($name, GoogleAnalyticsAdminV1alphaProperty $postBody, $optParams = [])
188  {
189    $params = ['name' => $name, 'postBody' => $postBody];
190    $params = array_merge($params, $optParams);
191    return $this->call('patch', [$params], GoogleAnalyticsAdminV1alphaProperty::class);
192  }
193  /**
194   * Updates the singleton data retention settings for this property.
195   * (properties.updateDataRetentionSettings)
196   *
197   * @param string $name Output only. Resource name for this DataRetentionSetting
198   * resource. Format: properties/{property}/dataRetentionSettings
199   * @param GoogleAnalyticsAdminV1alphaDataRetentionSettings $postBody
200   * @param array $optParams Optional parameters.
201   *
202   * @opt_param string updateMask Required. The list of fields to be updated.
203   * Field names must be in snake case (e.g., "field_to_update"). Omitted fields
204   * will not be updated. To replace the entire entity, use one path with the
205   * string "*" to match all fields.
206   * @return GoogleAnalyticsAdminV1alphaDataRetentionSettings
207   */
208  public function updateDataRetentionSettings($name, GoogleAnalyticsAdminV1alphaDataRetentionSettings $postBody, $optParams = [])
209  {
210    $params = ['name' => $name, 'postBody' => $postBody];
211    $params = array_merge($params, $optParams);
212    return $this->call('updateDataRetentionSettings', [$params], GoogleAnalyticsAdminV1alphaDataRetentionSettings::class);
213  }
214  /**
215   * Updates Google Signals settings for a property.
216   * (properties.updateGoogleSignalsSettings)
217   *
218   * @param string $name Output only. Resource name of this setting. Format:
219   * properties/{property_id}/googleSignalsSettings Example:
220   * "properties/1000/googleSignalsSettings"
221   * @param GoogleAnalyticsAdminV1alphaGoogleSignalsSettings $postBody
222   * @param array $optParams Optional parameters.
223   *
224   * @opt_param string updateMask Required. The list of fields to be updated.
225   * Field names must be in snake case (e.g., "field_to_update"). Omitted fields
226   * will not be updated. To replace the entire entity, use one path with the
227   * string "*" to match all fields.
228   * @return GoogleAnalyticsAdminV1alphaGoogleSignalsSettings
229   */
230  public function updateGoogleSignalsSettings($name, GoogleAnalyticsAdminV1alphaGoogleSignalsSettings $postBody, $optParams = [])
231  {
232    $params = ['name' => $name, 'postBody' => $postBody];
233    $params = array_merge($params, $optParams);
234    return $this->call('updateGoogleSignalsSettings', [$params], GoogleAnalyticsAdminV1alphaGoogleSignalsSettings::class);
235  }
236}
237
238// Adding a class alias for backwards compatibility with the previous class name.
239class_alias(Properties::class, 'Google_Service_GoogleAnalyticsAdmin_Resource_Properties');
240