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\Reports\Resource;
19
20use Google\Service\Reports\Activities as ActivitiesModel;
21use 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 */
31class 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. The list is composed of event parameters that are manipulated by
86   * relational operators. Event parameters are in the form `parameter1
87   * name[parameter1 value],parameter2 name[parameter2 value],...` These event
88   * parameters are associated with a specific `eventName`. An empty report is
89   * returned if the filtered request's parameter does not belong to the
90   * `eventName`. For more information about `eventName` parameters, see the list
91   * of event names for various applications above in `applicationName`. In the
92   * following Admin Activity example, the <> operator is URL-encoded in the
93   * request's query string (%3C%3E): GET...=CHANGE_CALENDAR_SETTING
94   * =NEW_VALUE%3C%3EREAD_ONLY_ACCESS In the following Drive example, the list can
95   * be a view or edit event's `doc_id` parameter with a value that is manipulated
96   * by an 'equal to' (==) or 'not equal to' (<>) relational operator. In the
97   * first example, the report returns each edited document's `doc_id`. In the
98   * second example, the report returns each viewed document's `doc_id` that
99   * equals the value 12345 and does not return any viewed document's which have a
100   * `doc_id` value of 98765. The <> operator is URL-encoded in the request's
101   * query string (%3C%3E): GET...=edit=doc_id
102   * GET...=view=doc_id==12345,doc_id%3C%3E98765 The relational operators include:
103   * - `==` - 'equal to'. - `<>` - 'not equal to'. It is URL-encoded (%3C%3E). -
104   * `<` - 'less than'. It is URL-encoded (%3C). - `<=` - 'less than or equal to'.
105   * It is URL-encoded (%3C=). - `>` - 'greater than'. It is URL-encoded (%3E). -
106   * `>=` - 'greater than or equal to'. It is URL-encoded (%3E=). *Note:* The API
107   * doesn't accept multiple values of a parameter. If a particular parameter is
108   * supplied more than once in the API request, the API only accepts the last
109   * value of that request parameter. In addition, if an invalid request parameter
110   * is supplied in the API request, the API ignores that request parameter and
111   * returns the response corresponding to the remaining valid request parameters.
112   * If no parameters are requested, all parameters 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   */
137  public function listActivities($userKey, $applicationName, $optParams = [])
138  {
139    $params = ['userKey' => $userKey, 'applicationName' => $applicationName];
140    $params = array_merge($params, $optParams);
141    return $this->call('list', [$params], ActivitiesModel::class);
142  }
143  /**
144   * Start receiving notifications for account activities. For more information,
145   * see Receiving Push Notifications. (activities.watch)
146   *
147   * @param string $userKey Represents the profile ID or the user email for which
148   * the data should be filtered. Can be `all` for all information, or `userKey`
149   * for a user's unique Google Workspace profile ID or their primary email
150   * address. Must not be a deleted user. For a deleted user, call `users.list` in
151   * Directory API with `showDeleted=true`, then use the returned `ID` as the
152   * `userKey`.
153   * @param string $applicationName Application name for which the events are to
154   * be retrieved.
155   * @param Channel $postBody
156   * @param array $optParams Optional parameters.
157   *
158   * @opt_param string actorIpAddress The Internet Protocol (IP) Address of host
159   * where the event was performed. This is an additional way to filter a report's
160   * summary using the IP address of the user whose activity is being reported.
161   * This IP address may or may not reflect the user's physical location. For
162   * example, the IP address can be the user's proxy server's address or a virtual
163   * private network (VPN) address. This parameter supports both IPv4 and IPv6
164   * address versions.
165   * @opt_param string customerId The unique ID of the customer to retrieve data
166   * for.
167   * @opt_param string endTime Sets the end of the range of time shown in the
168   * report. The date is in the RFC 3339 format, for example
169   * 2010-10-28T10:26:35.000Z. The default value is the approximate time of the
170   * API request. An API report has three basic time concepts: - *Date of the
171   * API's request for a report*: When the API created and retrieved the report. -
172   * *Report's start time*: The beginning of the timespan shown in the report. The
173   * `startTime` must be before the `endTime` (if specified) and the current time
174   * when the request is made, or the API returns an error. - *Report's end time*:
175   * The end of the timespan shown in the report. For example, the timespan of
176   * events summarized in a report can start in April and end in May. The report
177   * itself can be requested in August. If the `endTime` is not specified, the
178   * report returns all activities from the `startTime` until the current time or
179   * the most recent 180 days if the `startTime` is more than 180 days in the
180   * past.
181   * @opt_param string eventName The name of the event being queried by the API.
182   * Each `eventName` is related to a specific Google Workspace service or feature
183   * which the API organizes into types of events. An example is the Google
184   * Calendar events in the Admin console application's reports. The Calendar
185   * Settings `type` structure has all of the Calendar `eventName` activities
186   * reported by the API. When an administrator changes a Calendar setting, the
187   * API reports this activity in the Calendar Settings `type` and `eventName`
188   * parameters. For more information about `eventName` query strings and
189   * parameters, see the list of event names for various applications above in
190   * `applicationName`.
191   * @opt_param string filters The `filters` query string is a comma-separated
192   * list. The list is composed of event parameters that are manipulated by
193   * relational operators. Event parameters are in the form `parameter1
194   * name[parameter1 value],parameter2 name[parameter2 value],...` These event
195   * parameters are associated with a specific `eventName`. An empty report is
196   * returned if the filtered request's parameter does not belong to the
197   * `eventName`. For more information about `eventName` parameters, see the list
198   * of event names for various applications above in `applicationName`. In the
199   * following Admin Activity example, the <> operator is URL-encoded in the
200   * request's query string (%3C%3E): GET...=CHANGE_CALENDAR_SETTING
201   * =NEW_VALUE%3C%3EREAD_ONLY_ACCESS In the following Drive example, the list can
202   * be a view or edit event's `doc_id` parameter with a value that is manipulated
203   * by an 'equal to' (==) or 'not equal to' (<>) relational operator. In the
204   * first example, the report returns each edited document's `doc_id`. In the
205   * second example, the report returns each viewed document's `doc_id` that
206   * equals the value 12345 and does not return any viewed document's which have a
207   * `doc_id` value of 98765. The <> operator is URL-encoded in the request's
208   * query string (%3C%3E): GET...=edit=doc_id
209   * GET...=view=doc_id==12345,doc_id%3C%3E98765 The relational operators include:
210   * - `==` - 'equal to'. - `<>` - 'not equal to'. It is URL-encoded (%3C%3E). -
211   * `<` - 'less than'. It is URL-encoded (%3C). - `<=` - 'less than or equal to'.
212   * It is URL-encoded (%3C=). - `>` - 'greater than'. It is URL-encoded (%3E). -
213   * `>=` - 'greater than or equal to'. It is URL-encoded (%3E=). *Note:* The API
214   * doesn't accept multiple values of a parameter. If a particular parameter is
215   * supplied more than once in the API request, the API only accepts the last
216   * value of that request parameter. In addition, if an invalid request parameter
217   * is supplied in the API request, the API ignores that request parameter and
218   * returns the response corresponding to the remaining valid request parameters.
219   * If no parameters are requested, all parameters are returned.
220   * @opt_param string groupIdFilter Comma separated group ids (obfuscated) on
221   * which user activities are filtered, i.e. the response will contain activities
222   * for only those users that are a part of at least one of the group ids
223   * mentioned here. Format: "id:abc123,id:xyz456"
224   * @opt_param int maxResults Determines how many activity records are shown on
225   * each response page. For example, if the request sets `maxResults=1` and the
226   * report has two activities, the report has two pages. The response's
227   * `nextPageToken` property has the token to the second page. The `maxResults`
228   * query string is optional in the request. The default value is 1000.
229   * @opt_param string orgUnitID ID of the organizational unit to report on.
230   * Activity records will be shown only for users who belong to the specified
231   * organizational unit. Data before Dec 17, 2018 doesn't appear in the filtered
232   * results.
233   * @opt_param string pageToken The token to specify next page. A report with
234   * multiple pages has a `nextPageToken` property in the response. In your
235   * follow-on request getting the next page of the report, enter the
236   * `nextPageToken` value in the `pageToken` query string.
237   * @opt_param string startTime Sets the beginning of the range of time shown in
238   * the report. The date is in the RFC 3339 format, for example
239   * 2010-10-28T10:26:35.000Z. The report returns all activities from `startTime`
240   * until `endTime`. The `startTime` must be before the `endTime` (if specified)
241   * and the current time when the request is made, or the API returns an error.
242   * @return Channel
243   */
244  public function watch($userKey, $applicationName, Channel $postBody, $optParams = [])
245  {
246    $params = ['userKey' => $userKey, 'applicationName' => $applicationName, 'postBody' => $postBody];
247    $params = array_merge($params, $optParams);
248    return $this->call('watch', [$params], Channel::class);
249  }
250}
251
252// Adding a class alias for backwards compatibility with the previous class name.
253class_alias(Activities::class, 'Google_Service_Reports_Resource_Activities');
254