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\GoogleAnalyticsAdmin\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\GoogleAnalyticsAdmin\GoogleAnalyticsAdminV1betaAccount;
|
---|
21 | use Google\Service\GoogleAnalyticsAdmin\GoogleAnalyticsAdminV1betaDataSharingSettings;
|
---|
22 | use Google\Service\GoogleAnalyticsAdmin\GoogleAnalyticsAdminV1betaListAccountsResponse;
|
---|
23 | use Google\Service\GoogleAnalyticsAdmin\GoogleAnalyticsAdminV1betaProvisionAccountTicketRequest;
|
---|
24 | use Google\Service\GoogleAnalyticsAdmin\GoogleAnalyticsAdminV1betaProvisionAccountTicketResponse;
|
---|
25 | use Google\Service\GoogleAnalyticsAdmin\GoogleAnalyticsAdminV1betaRunAccessReportRequest;
|
---|
26 | use Google\Service\GoogleAnalyticsAdmin\GoogleAnalyticsAdminV1betaRunAccessReportResponse;
|
---|
27 | use Google\Service\GoogleAnalyticsAdmin\GoogleAnalyticsAdminV1betaSearchChangeHistoryEventsRequest;
|
---|
28 | use Google\Service\GoogleAnalyticsAdmin\GoogleAnalyticsAdminV1betaSearchChangeHistoryEventsResponse;
|
---|
29 | use Google\Service\GoogleAnalyticsAdmin\GoogleProtobufEmpty;
|
---|
30 |
|
---|
31 | /**
|
---|
32 | * The "accounts" collection of methods.
|
---|
33 | * Typical usage is:
|
---|
34 | * <code>
|
---|
35 | * $analyticsadminService = new Google\Service\GoogleAnalyticsAdmin(...);
|
---|
36 | * $accounts = $analyticsadminService->accounts;
|
---|
37 | * </code>
|
---|
38 | */
|
---|
39 | class Accounts extends \Google\Service\Resource
|
---|
40 | {
|
---|
41 | /**
|
---|
42 | * Marks target Account as soft-deleted (ie: "trashed") and returns it. This API
|
---|
43 | * does not have a method to restore soft-deleted accounts. However, they can be
|
---|
44 | * restored using the Trash Can UI. If the accounts are not restored before the
|
---|
45 | * expiration time, the account and all child resources (eg: Properties,
|
---|
46 | * GoogleAdsLinks, Streams, AccessBindings) will be permanently purged.
|
---|
47 | * https://support.google.com/analytics/answer/6154772 Returns an error if the
|
---|
48 | * target is not found. (accounts.delete)
|
---|
49 | *
|
---|
50 | * @param string $name Required. The name of the Account to soft-delete. Format:
|
---|
51 | * accounts/{account} Example: "accounts/100"
|
---|
52 | * @param array $optParams Optional parameters.
|
---|
53 | * @return GoogleProtobufEmpty
|
---|
54 | * @throws \Google\Service\Exception
|
---|
55 | */
|
---|
56 | public function delete($name, $optParams = [])
|
---|
57 | {
|
---|
58 | $params = ['name' => $name];
|
---|
59 | $params = array_merge($params, $optParams);
|
---|
60 | return $this->call('delete', [$params], GoogleProtobufEmpty::class);
|
---|
61 | }
|
---|
62 | /**
|
---|
63 | * Lookup for a single Account. (accounts.get)
|
---|
64 | *
|
---|
65 | * @param string $name Required. The name of the account to lookup. Format:
|
---|
66 | * accounts/{account} Example: "accounts/100"
|
---|
67 | * @param array $optParams Optional parameters.
|
---|
68 | * @return GoogleAnalyticsAdminV1betaAccount
|
---|
69 | * @throws \Google\Service\Exception
|
---|
70 | */
|
---|
71 | public function get($name, $optParams = [])
|
---|
72 | {
|
---|
73 | $params = ['name' => $name];
|
---|
74 | $params = array_merge($params, $optParams);
|
---|
75 | return $this->call('get', [$params], GoogleAnalyticsAdminV1betaAccount::class);
|
---|
76 | }
|
---|
77 | /**
|
---|
78 | * Get data sharing settings on an account. Data sharing settings are
|
---|
79 | * singletons. (accounts.getDataSharingSettings)
|
---|
80 | *
|
---|
81 | * @param string $name Required. The name of the settings to lookup. Format:
|
---|
82 | * accounts/{account}/dataSharingSettings Example:
|
---|
83 | * `accounts/1000/dataSharingSettings`
|
---|
84 | * @param array $optParams Optional parameters.
|
---|
85 | * @return GoogleAnalyticsAdminV1betaDataSharingSettings
|
---|
86 | * @throws \Google\Service\Exception
|
---|
87 | */
|
---|
88 | public function getDataSharingSettings($name, $optParams = [])
|
---|
89 | {
|
---|
90 | $params = ['name' => $name];
|
---|
91 | $params = array_merge($params, $optParams);
|
---|
92 | return $this->call('getDataSharingSettings', [$params], GoogleAnalyticsAdminV1betaDataSharingSettings::class);
|
---|
93 | }
|
---|
94 | /**
|
---|
95 | * Returns all accounts accessible by the caller. Note that these accounts might
|
---|
96 | * not currently have GA properties. Soft-deleted (ie: "trashed") accounts are
|
---|
97 | * excluded by default. Returns an empty list if no relevant accounts are found.
|
---|
98 | * (accounts.listAccounts)
|
---|
99 | *
|
---|
100 | * @param array $optParams Optional parameters.
|
---|
101 | *
|
---|
102 | * @opt_param int pageSize The maximum number of resources to return. The
|
---|
103 | * service may return fewer than this value, even if there are additional pages.
|
---|
104 | * If unspecified, at most 50 resources will be returned. The maximum value is
|
---|
105 | * 200; (higher values will be coerced to the maximum)
|
---|
106 | * @opt_param string pageToken A page token, received from a previous
|
---|
107 | * `ListAccounts` call. Provide this to retrieve the subsequent page. When
|
---|
108 | * paginating, all other parameters provided to `ListAccounts` must match the
|
---|
109 | * call that provided the page token.
|
---|
110 | * @opt_param bool showDeleted Whether to include soft-deleted (ie: "trashed")
|
---|
111 | * Accounts in the results. Accounts can be inspected to determine whether they
|
---|
112 | * are deleted or not.
|
---|
113 | * @return GoogleAnalyticsAdminV1betaListAccountsResponse
|
---|
114 | * @throws \Google\Service\Exception
|
---|
115 | */
|
---|
116 | public function listAccounts($optParams = [])
|
---|
117 | {
|
---|
118 | $params = [];
|
---|
119 | $params = array_merge($params, $optParams);
|
---|
120 | return $this->call('list', [$params], GoogleAnalyticsAdminV1betaListAccountsResponse::class);
|
---|
121 | }
|
---|
122 | /**
|
---|
123 | * Updates an account. (accounts.patch)
|
---|
124 | *
|
---|
125 | * @param string $name Output only. Resource name of this account. Format:
|
---|
126 | * accounts/{account} Example: "accounts/100"
|
---|
127 | * @param GoogleAnalyticsAdminV1betaAccount $postBody
|
---|
128 | * @param array $optParams Optional parameters.
|
---|
129 | *
|
---|
130 | * @opt_param string updateMask Required. The list of fields to be updated.
|
---|
131 | * Field names must be in snake case (for example, "field_to_update"). Omitted
|
---|
132 | * fields will not be updated. To replace the entire entity, use one path with
|
---|
133 | * the string "*" to match all fields.
|
---|
134 | * @return GoogleAnalyticsAdminV1betaAccount
|
---|
135 | * @throws \Google\Service\Exception
|
---|
136 | */
|
---|
137 | public function patch($name, GoogleAnalyticsAdminV1betaAccount $postBody, $optParams = [])
|
---|
138 | {
|
---|
139 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
140 | $params = array_merge($params, $optParams);
|
---|
141 | return $this->call('patch', [$params], GoogleAnalyticsAdminV1betaAccount::class);
|
---|
142 | }
|
---|
143 | /**
|
---|
144 | * Requests a ticket for creating an account. (accounts.provisionAccountTicket)
|
---|
145 | *
|
---|
146 | * @param GoogleAnalyticsAdminV1betaProvisionAccountTicketRequest $postBody
|
---|
147 | * @param array $optParams Optional parameters.
|
---|
148 | * @return GoogleAnalyticsAdminV1betaProvisionAccountTicketResponse
|
---|
149 | * @throws \Google\Service\Exception
|
---|
150 | */
|
---|
151 | public function provisionAccountTicket(GoogleAnalyticsAdminV1betaProvisionAccountTicketRequest $postBody, $optParams = [])
|
---|
152 | {
|
---|
153 | $params = ['postBody' => $postBody];
|
---|
154 | $params = array_merge($params, $optParams);
|
---|
155 | return $this->call('provisionAccountTicket', [$params], GoogleAnalyticsAdminV1betaProvisionAccountTicketResponse::class);
|
---|
156 | }
|
---|
157 | /**
|
---|
158 | * Returns a customized report of data access records. The report provides
|
---|
159 | * records of each time a user reads Google Analytics reporting data. Access
|
---|
160 | * records are retained for up to 2 years. Data Access Reports can be requested
|
---|
161 | * for a property. Reports may be requested for any property, but dimensions
|
---|
162 | * that aren't related to quota can only be requested on Google Analytics 360
|
---|
163 | * properties. This method is only available to Administrators. These data
|
---|
164 | * access records include GA UI Reporting, GA UI Explorations, GA Data API, and
|
---|
165 | * other products like Firebase & Admob that can retrieve data from Google
|
---|
166 | * Analytics through a linkage. These records don't include property
|
---|
167 | * configuration changes like adding a stream or changing a property's time
|
---|
168 | * zone. For configuration change history, see [searchChangeHistoryEvents](https
|
---|
169 | * ://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/acc
|
---|
170 | * ounts/searchChangeHistoryEvents). To give your feedback on this API, complete
|
---|
171 | * the [Google Analytics Access Reports feedback](https://docs.google.com/forms/
|
---|
172 | * d/e/1FAIpQLSdmEBUrMzAEdiEKk5TV5dEHvDUZDRlgWYdQdAeSdtR4hVjEhw/viewform) form.
|
---|
173 | * (accounts.runAccessReport)
|
---|
174 | *
|
---|
175 | * @param string $entity The Data Access Report supports requesting at the
|
---|
176 | * property level or account level. If requested at the account level, Data
|
---|
177 | * Access Reports include all access for all properties under that account. To
|
---|
178 | * request at the property level, entity should be for example 'properties/123'
|
---|
179 | * if "123" is your Google Analytics property ID. To request at the account
|
---|
180 | * level, entity should be for example 'accounts/1234' if "1234" is your Google
|
---|
181 | * Analytics Account ID.
|
---|
182 | * @param GoogleAnalyticsAdminV1betaRunAccessReportRequest $postBody
|
---|
183 | * @param array $optParams Optional parameters.
|
---|
184 | * @return GoogleAnalyticsAdminV1betaRunAccessReportResponse
|
---|
185 | * @throws \Google\Service\Exception
|
---|
186 | */
|
---|
187 | public function runAccessReport($entity, GoogleAnalyticsAdminV1betaRunAccessReportRequest $postBody, $optParams = [])
|
---|
188 | {
|
---|
189 | $params = ['entity' => $entity, 'postBody' => $postBody];
|
---|
190 | $params = array_merge($params, $optParams);
|
---|
191 | return $this->call('runAccessReport', [$params], GoogleAnalyticsAdminV1betaRunAccessReportResponse::class);
|
---|
192 | }
|
---|
193 | /**
|
---|
194 | * Searches through all changes to an account or its children given the
|
---|
195 | * specified set of filters. (accounts.searchChangeHistoryEvents)
|
---|
196 | *
|
---|
197 | * @param string $account Required. The account resource for which to return
|
---|
198 | * change history resources. Format: accounts/{account} Example: `accounts/100`
|
---|
199 | * @param GoogleAnalyticsAdminV1betaSearchChangeHistoryEventsRequest $postBody
|
---|
200 | * @param array $optParams Optional parameters.
|
---|
201 | * @return GoogleAnalyticsAdminV1betaSearchChangeHistoryEventsResponse
|
---|
202 | * @throws \Google\Service\Exception
|
---|
203 | */
|
---|
204 | public function searchChangeHistoryEvents($account, GoogleAnalyticsAdminV1betaSearchChangeHistoryEventsRequest $postBody, $optParams = [])
|
---|
205 | {
|
---|
206 | $params = ['account' => $account, 'postBody' => $postBody];
|
---|
207 | $params = array_merge($params, $optParams);
|
---|
208 | return $this->call('searchChangeHistoryEvents', [$params], GoogleAnalyticsAdminV1betaSearchChangeHistoryEventsResponse::class);
|
---|
209 | }
|
---|
210 | }
|
---|
211 |
|
---|
212 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
213 | class_alias(Accounts::class, 'Google_Service_GoogleAnalyticsAdmin_Resource_Accounts');
|
---|