[e3d4e0a] | 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\Reports\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\Reports\Activities as ActivitiesModel;
|
---|
| 21 | use Google\Service\Reports\Channel;
|
---|
| 22 |
|
---|
| 23 | /**
|
---|
| 24 | * The "activities" collection of methods.
|
---|
| 25 | * Typical usage is:
|
---|
| 26 | * <code>
|
---|
| 27 | * $adminService = new Google\Service\Reports(...);
|
---|
| 28 | * $activities = $adminService->activities;
|
---|
| 29 | * </code>
|
---|
| 30 | */
|
---|
| 31 | class Activities extends \Google\Service\Resource
|
---|
| 32 | {
|
---|
| 33 | /**
|
---|
| 34 | * Retrieves a list of activities for a specific customer's account and
|
---|
| 35 | * application such as the Admin console application or the Google Drive
|
---|
| 36 | * application. For more information, see the guides for administrator and
|
---|
| 37 | * Google Drive activity reports. For more information about the activity
|
---|
| 38 | * report's parameters, see the activity parameters reference guides.
|
---|
| 39 | * (activities.listActivities)
|
---|
| 40 | *
|
---|
| 41 | * @param string $userKey Represents the profile ID or the user email for which
|
---|
| 42 | * the data should be filtered. Can be `all` for all information, or `userKey`
|
---|
| 43 | * for a user's unique Google Workspace profile ID or their primary email
|
---|
| 44 | * address. Must not be a deleted user. For a deleted user, call `users.list` in
|
---|
| 45 | * Directory API with `showDeleted=true`, then use the returned `ID` as the
|
---|
| 46 | * `userKey`.
|
---|
| 47 | * @param string $applicationName Application name for which the events are to
|
---|
| 48 | * be retrieved.
|
---|
| 49 | * @param array $optParams Optional parameters.
|
---|
| 50 | *
|
---|
| 51 | * @opt_param string actorIpAddress The Internet Protocol (IP) Address of host
|
---|
| 52 | * where the event was performed. This is an additional way to filter a report's
|
---|
| 53 | * summary using the IP address of the user whose activity is being reported.
|
---|
| 54 | * This IP address may or may not reflect the user's physical location. For
|
---|
| 55 | * example, the IP address can be the user's proxy server's address or a virtual
|
---|
| 56 | * private network (VPN) address. This parameter supports both IPv4 and IPv6
|
---|
| 57 | * address versions.
|
---|
| 58 | * @opt_param string customerId The unique ID of the customer to retrieve data
|
---|
| 59 | * for.
|
---|
| 60 | * @opt_param string endTime Sets the end of the range of time shown in the
|
---|
| 61 | * report. The date is in the RFC 3339 format, for example
|
---|
| 62 | * 2010-10-28T10:26:35.000Z. The default value is the approximate time of the
|
---|
| 63 | * API request. An API report has three basic time concepts: - *Date of the
|
---|
| 64 | * API's request for a report*: When the API created and retrieved the report. -
|
---|
| 65 | * *Report's start time*: The beginning of the timespan shown in the report. The
|
---|
| 66 | * `startTime` must be before the `endTime` (if specified) and the current time
|
---|
| 67 | * when the request is made, or the API returns an error. - *Report's end time*:
|
---|
| 68 | * The end of the timespan shown in the report. For example, the timespan of
|
---|
| 69 | * events summarized in a report can start in April and end in May. The report
|
---|
| 70 | * itself can be requested in August. If the `endTime` is not specified, the
|
---|
| 71 | * report returns all activities from the `startTime` until the current time or
|
---|
| 72 | * the most recent 180 days if the `startTime` is more than 180 days in the
|
---|
| 73 | * past.
|
---|
| 74 | * @opt_param string eventName The name of the event being queried by the API.
|
---|
| 75 | * Each `eventName` is related to a specific Google Workspace service or feature
|
---|
| 76 | * which the API organizes into types of events. An example is the Google
|
---|
| 77 | * Calendar events in the Admin console application's reports. The Calendar
|
---|
| 78 | * Settings `type` structure has all of the Calendar `eventName` activities
|
---|
| 79 | * reported by the API. When an administrator changes a Calendar setting, the
|
---|
| 80 | * API reports this activity in the Calendar Settings `type` and `eventName`
|
---|
| 81 | * parameters. For more information about `eventName` query strings and
|
---|
| 82 | * parameters, see the list of event names for various applications above in
|
---|
| 83 | * `applicationName`.
|
---|
| 84 | * @opt_param string filters The `filters` query string is a comma-separated
|
---|
| 85 | * list composed of event parameters manipulated by relational operators. Event
|
---|
| 86 | * parameters are in the form `{parameter1 name}{relational operator}{parameter1
|
---|
| 87 | * value},{parameter2 name}{relational operator}{parameter2 value},...` These
|
---|
| 88 | * event parameters are associated with a specific `eventName`. An empty report
|
---|
| 89 | * is returned if the request's parameter doesn't belong to the `eventName`. For
|
---|
| 90 | * more information about the available `eventName` fields for each application
|
---|
| 91 | * and their associated parameters, go to the
|
---|
| 92 | * [ApplicationName](#applicationname) table, then click through to the Activity
|
---|
| 93 | * Events page in the Appendix for the application you want. In the following
|
---|
| 94 | * Drive activity examples, the returned list consists of all `edit` events
|
---|
| 95 | * where the `doc_id` parameter value matches the conditions defined by the
|
---|
| 96 | * relational operator. In the first example, the request returns all edited
|
---|
| 97 | * documents with a `doc_id` value equal to `12345`. In the second example, the
|
---|
| 98 | * report returns any edited documents where the `doc_id` value is not equal to
|
---|
| 99 | * `98765`. The `<>` operator is URL-encoded in the request's query string
|
---|
| 100 | * (`%3C%3E`): ``` GET...&eventName=edit&filters=doc_id==12345
|
---|
| 101 | * GET...&eventName=edit&filters=doc_id%3C%3E98765 ``` A `filters` query
|
---|
| 102 | * supports these relational operators: * `==`—'equal to'. * `<>`—'not equal
|
---|
| 103 | * to'. Must be URL-encoded (%3C%3E). * `<`—'less than'. Must be URL-encoded
|
---|
| 104 | * (%3C). * `<=`—'less than or equal to'. Must be URL-encoded (%3C=). *
|
---|
| 105 | * `>`—'greater than'. Must be URL-encoded (%3E). * `>=`—'greater than or equal
|
---|
| 106 | * to'. Must be URL-encoded (%3E=). **Note:** The API doesn't accept multiple
|
---|
| 107 | * values of the same parameter. If a parameter is supplied more than once in
|
---|
| 108 | * the API request, the API only accepts the last value of that parameter. In
|
---|
| 109 | * addition, if an invalid parameter is supplied in the API request, the API
|
---|
| 110 | * ignores that parameter and returns the response corresponding to the
|
---|
| 111 | * remaining valid parameters. If no parameters are requested, all parameters
|
---|
| 112 | * are returned.
|
---|
| 113 | * @opt_param string groupIdFilter Comma separated group ids (obfuscated) on
|
---|
| 114 | * which user activities are filtered, i.e. the response will contain activities
|
---|
| 115 | * for only those users that are a part of at least one of the group ids
|
---|
| 116 | * mentioned here. Format: "id:abc123,id:xyz456"
|
---|
| 117 | * @opt_param int maxResults Determines how many activity records are shown on
|
---|
| 118 | * each response page. For example, if the request sets `maxResults=1` and the
|
---|
| 119 | * report has two activities, the report has two pages. The response's
|
---|
| 120 | * `nextPageToken` property has the token to the second page. The `maxResults`
|
---|
| 121 | * query string is optional in the request. The default value is 1000.
|
---|
| 122 | * @opt_param string orgUnitID ID of the organizational unit to report on.
|
---|
| 123 | * Activity records will be shown only for users who belong to the specified
|
---|
| 124 | * organizational unit. Data before Dec 17, 2018 doesn't appear in the filtered
|
---|
| 125 | * results.
|
---|
| 126 | * @opt_param string pageToken The token to specify next page. A report with
|
---|
| 127 | * multiple pages has a `nextPageToken` property in the response. In your
|
---|
| 128 | * follow-on request getting the next page of the report, enter the
|
---|
| 129 | * `nextPageToken` value in the `pageToken` query string.
|
---|
| 130 | * @opt_param string startTime Sets the beginning of the range of time shown in
|
---|
| 131 | * the report. The date is in the RFC 3339 format, for example
|
---|
| 132 | * 2010-10-28T10:26:35.000Z. The report returns all activities from `startTime`
|
---|
| 133 | * until `endTime`. The `startTime` must be before the `endTime` (if specified)
|
---|
| 134 | * and the current time when the request is made, or the API returns an error.
|
---|
| 135 | * @return ActivitiesModel
|
---|
| 136 | * @throws \Google\Service\Exception
|
---|
| 137 | */
|
---|
| 138 | public function listActivities($userKey, $applicationName, $optParams = [])
|
---|
| 139 | {
|
---|
| 140 | $params = ['userKey' => $userKey, 'applicationName' => $applicationName];
|
---|
| 141 | $params = array_merge($params, $optParams);
|
---|
| 142 | return $this->call('list', [$params], ActivitiesModel::class);
|
---|
| 143 | }
|
---|
| 144 | /**
|
---|
| 145 | * Start receiving notifications for account activities. For more information,
|
---|
| 146 | * see Receiving Push Notifications. (activities.watch)
|
---|
| 147 | *
|
---|
| 148 | * @param string $userKey Represents the profile ID or the user email for which
|
---|
| 149 | * the data should be filtered. Can be `all` for all information, or `userKey`
|
---|
| 150 | * for a user's unique Google Workspace profile ID or their primary email
|
---|
| 151 | * address. Must not be a deleted user. For a deleted user, call `users.list` in
|
---|
| 152 | * Directory API with `showDeleted=true`, then use the returned `ID` as the
|
---|
| 153 | * `userKey`.
|
---|
| 154 | * @param string $applicationName Application name for which the events are to
|
---|
| 155 | * be retrieved.
|
---|
| 156 | * @param Channel $postBody
|
---|
| 157 | * @param array $optParams Optional parameters.
|
---|
| 158 | *
|
---|
| 159 | * @opt_param string actorIpAddress The Internet Protocol (IP) Address of host
|
---|
| 160 | * where the event was performed. This is an additional way to filter a report's
|
---|
| 161 | * summary using the IP address of the user whose activity is being reported.
|
---|
| 162 | * This IP address may or may not reflect the user's physical location. For
|
---|
| 163 | * example, the IP address can be the user's proxy server's address or a virtual
|
---|
| 164 | * private network (VPN) address. This parameter supports both IPv4 and IPv6
|
---|
| 165 | * address versions.
|
---|
| 166 | * @opt_param string customerId The unique ID of the customer to retrieve data
|
---|
| 167 | * for.
|
---|
| 168 | * @opt_param string endTime Sets the end of the range of time shown in the
|
---|
| 169 | * report. The date is in the RFC 3339 format, for example
|
---|
| 170 | * 2010-10-28T10:26:35.000Z. The default value is the approximate time of the
|
---|
| 171 | * API request. An API report has three basic time concepts: - *Date of the
|
---|
| 172 | * API's request for a report*: When the API created and retrieved the report. -
|
---|
| 173 | * *Report's start time*: The beginning of the timespan shown in the report. The
|
---|
| 174 | * `startTime` must be before the `endTime` (if specified) and the current time
|
---|
| 175 | * when the request is made, or the API returns an error. - *Report's end time*:
|
---|
| 176 | * The end of the timespan shown in the report. For example, the timespan of
|
---|
| 177 | * events summarized in a report can start in April and end in May. The report
|
---|
| 178 | * itself can be requested in August. If the `endTime` is not specified, the
|
---|
| 179 | * report returns all activities from the `startTime` until the current time or
|
---|
| 180 | * the most recent 180 days if the `startTime` is more than 180 days in the
|
---|
| 181 | * past.
|
---|
| 182 | * @opt_param string eventName The name of the event being queried by the API.
|
---|
| 183 | * Each `eventName` is related to a specific Google Workspace service or feature
|
---|
| 184 | * which the API organizes into types of events. An example is the Google
|
---|
| 185 | * Calendar events in the Admin console application's reports. The Calendar
|
---|
| 186 | * Settings `type` structure has all of the Calendar `eventName` activities
|
---|
| 187 | * reported by the API. When an administrator changes a Calendar setting, the
|
---|
| 188 | * API reports this activity in the Calendar Settings `type` and `eventName`
|
---|
| 189 | * parameters. For more information about `eventName` query strings and
|
---|
| 190 | * parameters, see the list of event names for various applications above in
|
---|
| 191 | * `applicationName`.
|
---|
| 192 | * @opt_param string filters The `filters` query string is a comma-separated
|
---|
| 193 | * list composed of event parameters manipulated by relational operators. Event
|
---|
| 194 | * parameters are in the form `{parameter1 name}{relational operator}{parameter1
|
---|
| 195 | * value},{parameter2 name}{relational operator}{parameter2 value},...` These
|
---|
| 196 | * event parameters are associated with a specific `eventName`. An empty report
|
---|
| 197 | * is returned if the request's parameter doesn't belong to the `eventName`. For
|
---|
| 198 | * more information about the available `eventName` fields for each application
|
---|
| 199 | * and their associated parameters, go to the
|
---|
| 200 | * [ApplicationName](#applicationname) table, then click through to the Activity
|
---|
| 201 | * Events page in the Appendix for the application you want. In the following
|
---|
| 202 | * Drive activity examples, the returned list consists of all `edit` events
|
---|
| 203 | * where the `doc_id` parameter value matches the conditions defined by the
|
---|
| 204 | * relational operator. In the first example, the request returns all edited
|
---|
| 205 | * documents with a `doc_id` value equal to `12345`. In the second example, the
|
---|
| 206 | * report returns any edited documents where the `doc_id` value is not equal to
|
---|
| 207 | * `98765`. The `<>` operator is URL-encoded in the request's query string
|
---|
| 208 | * (`%3C%3E`): ``` GET...&eventName=edit&filters=doc_id==12345
|
---|
| 209 | * GET...&eventName=edit&filters=doc_id%3C%3E98765 ``` A `filters` query
|
---|
| 210 | * supports these relational operators: * `==`—'equal to'. * `<>`—'not equal
|
---|
| 211 | * to'. Must be URL-encoded (%3C%3E). * `<`—'less than'. Must be URL-encoded
|
---|
| 212 | * (%3C). * `<=`—'less than or equal to'. Must be URL-encoded (%3C=). *
|
---|
| 213 | * `>`—'greater than'. Must be URL-encoded (%3E). * `>=`—'greater than or equal
|
---|
| 214 | * to'. Must be URL-encoded (%3E=). **Note:** The API doesn't accept multiple
|
---|
| 215 | * values of the same parameter. If a parameter is supplied more than once in
|
---|
| 216 | * the API request, the API only accepts the last value of that parameter. In
|
---|
| 217 | * addition, if an invalid parameter is supplied in the API request, the API
|
---|
| 218 | * ignores that parameter and returns the response corresponding to the
|
---|
| 219 | * remaining valid parameters. If no parameters are requested, all parameters
|
---|
| 220 | * are returned.
|
---|
| 221 | * @opt_param string groupIdFilter Comma separated group ids (obfuscated) on
|
---|
| 222 | * which user activities are filtered, i.e. the response will contain activities
|
---|
| 223 | * for only those users that are a part of at least one of the group ids
|
---|
| 224 | * mentioned here. Format: "id:abc123,id:xyz456"
|
---|
| 225 | * @opt_param int maxResults Determines how many activity records are shown on
|
---|
| 226 | * each response page. For example, if the request sets `maxResults=1` and the
|
---|
| 227 | * report has two activities, the report has two pages. The response's
|
---|
| 228 | * `nextPageToken` property has the token to the second page. The `maxResults`
|
---|
| 229 | * query string is optional in the request. The default value is 1000.
|
---|
| 230 | * @opt_param string orgUnitID `Deprecated`. This field is deprecated and is no
|
---|
| 231 | * longer supported. ID of the organizational unit to report on. Activity
|
---|
| 232 | * records will be shown only for users who belong to the specified
|
---|
| 233 | * organizational unit. Data before Dec 17, 2018 doesn't appear in the filtered
|
---|
| 234 | * results.
|
---|
| 235 | * @opt_param string pageToken The token to specify next page. A report with
|
---|
| 236 | * multiple pages has a `nextPageToken` property in the response. In your
|
---|
| 237 | * follow-on request getting the next page of the report, enter the
|
---|
| 238 | * `nextPageToken` value in the `pageToken` query string.
|
---|
| 239 | * @opt_param string startTime Sets the beginning of the range of time shown in
|
---|
| 240 | * the report. The date is in the RFC 3339 format, for example
|
---|
| 241 | * 2010-10-28T10:26:35.000Z. The report returns all activities from `startTime`
|
---|
| 242 | * until `endTime`. The `startTime` must be before the `endTime` (if specified)
|
---|
| 243 | * and the current time when the request is made, or the API returns an error.
|
---|
| 244 | * @return Channel
|
---|
| 245 | * @throws \Google\Service\Exception
|
---|
| 246 | */
|
---|
| 247 | public function watch($userKey, $applicationName, Channel $postBody, $optParams = [])
|
---|
| 248 | {
|
---|
| 249 | $params = ['userKey' => $userKey, 'applicationName' => $applicationName, 'postBody' => $postBody];
|
---|
| 250 | $params = array_merge($params, $optParams);
|
---|
| 251 | return $this->call('watch', [$params], Channel::class);
|
---|
| 252 | }
|
---|
| 253 | }
|
---|
| 254 |
|
---|
| 255 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 256 | class_alias(Activities::class, 'Google_Service_Reports_Resource_Activities');
|
---|