1<?php
2/*
3 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
4 * use this file except in compliance with the License. You may obtain a copy of
5 * the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 * License for the specific language governing permissions and limitations under
13 * the License.
14 */
15
16
17  /**
18   * The "activities" collection of methods.
19   * Typical usage is:
20   *  <code>
21   *   $adminService = new Google_ReportsService(...);
22   *   $activities = $adminService->activities;
23   *  </code>
24   */
25  class Google_ActivitiesServiceResource extends Google_ServiceResource {
26
27    /**
28     * Retrieves a list of activities for a specific customer and application. (activities.list)
29     *
30     * @param string $userKey Represents the profile id or the user email for which the data should be filtered. When 'all' is specified as the userKey, it returns usageReports for all users.
31     * @param string $applicationName Application name for which the events are to be retrieved.
32     * @param array $optParams Optional parameters.
33     *
34     * @opt_param string actorIpAddress IP Address of host where the event was performed. Supports both IPv4 and IPv6 addresses.
35     * @opt_param string endTime Return events which occured at or before this time.
36     * @opt_param string eventName Name of the event being queried.
37     * @opt_param string filters Event parameters in the form [parameter1 name][operator][parameter1 value],[parameter2 name][operator][parameter2 value],...
38     * @opt_param int maxResults Number of activity records to be shown in each page.
39     * @opt_param string pageToken Token to specify next page.
40     * @opt_param string startTime Return events which occured at or after this time.
41     * @return Google_Activities
42     */
43    public function listActivities($userKey, $applicationName, $optParams = array()) {
44      $params = array('userKey' => $userKey, 'applicationName' => $applicationName);
45      $params = array_merge($params, $optParams);
46      $data = $this->__call('list', array($params));
47      if ($this->useObjects()) {
48        return new Google_Activities($data);
49      } else {
50        return $data;
51      }
52    }
53  }
54
55  /**
56   * The "customerUsageReports" collection of methods.
57   * Typical usage is:
58   *  <code>
59   *   $adminService = new Google_ReportsService(...);
60   *   $customerUsageReports = $adminService->customerUsageReports;
61   *  </code>
62   */
63  class Google_CustomerUsageReportsServiceResource extends Google_ServiceResource {
64
65    /**
66     * Retrieves a report which is a collection of properties / statistics for a specific customer.
67     * (customerUsageReports.get)
68     *
69     * @param string $date Represents the date in yyyy-mm-dd format for which the data is to be fetched.
70     * @param array $optParams Optional parameters.
71     *
72     * @opt_param string pageToken Token to specify next page.
73     * @opt_param string parameters Represents the application name, parameter name pairs to fetch in csv as app_name1:param_name1, app_name2:param_name2.
74     * @return Google_UsageReports
75     */
76    public function get($date, $optParams = array()) {
77      $params = array('date' => $date);
78      $params = array_merge($params, $optParams);
79      $data = $this->__call('get', array($params));
80      if ($this->useObjects()) {
81        return new Google_UsageReports($data);
82      } else {
83        return $data;
84      }
85    }
86  }
87
88  /**
89   * The "userUsageReport" collection of methods.
90   * Typical usage is:
91   *  <code>
92   *   $adminService = new Google_ReportsService(...);
93   *   $userUsageReport = $adminService->userUsageReport;
94   *  </code>
95   */
96  class Google_UserUsageReportServiceResource extends Google_ServiceResource {
97
98    /**
99     * Retrieves a report which is a collection of properties / statistics for a set of users.
100     * (userUsageReport.get)
101     *
102     * @param string $userKey Represents the profile id or the user email for which the data should be filtered.
103     * @param string $date Represents the date in yyyy-mm-dd format for which the data is to be fetched.
104     * @param array $optParams Optional parameters.
105     *
106     * @opt_param string filters Represents the set of filters including parameter operator value.
107     * @opt_param string maxResults Maximum number of results to return. Maximum allowed is 1000
108     * @opt_param string pageToken Token to specify next page.
109     * @opt_param string parameters Represents the application name, parameter name pairs to fetch in csv as app_name1:param_name1, app_name2:param_name2.
110     * @return Google_UsageReports
111     */
112    public function get($userKey, $date, $optParams = array()) {
113      $params = array('userKey' => $userKey, 'date' => $date);
114      $params = array_merge($params, $optParams);
115      $data = $this->__call('get', array($params));
116      if ($this->useObjects()) {
117        return new Google_UsageReports($data);
118      } else {
119        return $data;
120      }
121    }
122  }
123
124/**
125 * Service definition for Google_Reports (reports_v1).
126 *
127 * <p>
128 * Allows the administrators of Google Apps customers to fetch reports about the usage, collaboration, security and risk for their users.
129 * </p>
130 *
131 * <p>
132 * For more information about this service, see the
133 * <a href="https://developers.google.com/admin-sdk/reports/" target="_blank">API Documentation</a>
134 * </p>
135 *
136 * @author Google, Inc.
137 */
138class Google_ReportsService extends Google_Service {
139  public $activities;
140  public $customerUsageReports;
141  public $userUsageReport;
142  /**
143   * Constructs the internal representation of the Reports service.
144   *
145   * @param Google_Client $client
146   */
147  public function __construct(Google_Client $client) {
148    $this->servicePath = 'admin/reports/v1/';
149    $this->version = 'reports_v1';
150    $this->serviceName = 'admin';
151
152    $client->addService($this->serviceName, $this->version);
153    $this->activities = new Google_ActivitiesServiceResource($this, $this->serviceName, 'activities', json_decode('{"methods": {"list": {"id": "reports.activities.list", "path": "activity/users/{userKey}/applications/{applicationName}", "httpMethod": "GET", "parameters": {"actorIpAddress": {"type": "string", "location": "query"}, "applicationName": {"type": "string", "required": true, "location": "path"}, "endTime": {"type": "string", "location": "query"}, "eventName": {"type": "string", "location": "query"}, "filters": {"type": "string", "location": "query"}, "maxResults": {"type": "integer", "format": "int32", "minimum": "1", "maximum": "1000", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "startTime": {"type": "string", "location": "query"}, "userKey": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "Activities"}, "scopes": ["https://www.googleapis.com/auth/admin.reports.audit.readonly"]}}}', true));
154    $this->customerUsageReports = new Google_CustomerUsageReportsServiceResource($this, $this->serviceName, 'customerUsageReports', json_decode('{"methods": {"get": {"id": "reports.customerUsageReports.get", "path": "usage/dates/{date}", "httpMethod": "GET", "parameters": {"date": {"type": "string", "required": true, "location": "path"}, "pageToken": {"type": "string", "location": "query"}, "parameters": {"type": "string", "location": "query"}}, "response": {"$ref": "UsageReports"}, "scopes": ["https://www.googleapis.com/auth/admin.reports.usage.readonly"]}}}', true));
155    $this->userUsageReport = new Google_UserUsageReportServiceResource($this, $this->serviceName, 'userUsageReport', json_decode('{"methods": {"get": {"id": "reports.userUsageReport.get", "path": "usage/users/{userKey}/dates/{date}", "httpMethod": "GET", "parameters": {"date": {"type": "string", "required": true, "location": "path"}, "filters": {"type": "string", "location": "query"}, "maxResults": {"type": "integer", "format": "uint32", "maximum": "1000", "location": "query"}, "pageToken": {"type": "string", "location": "query"}, "parameters": {"type": "string", "location": "query"}, "userKey": {"type": "string", "required": true, "location": "path"}}, "response": {"$ref": "UsageReports"}, "scopes": ["https://www.googleapis.com/auth/admin.reports.usage.readonly"]}}}', true));
156
157  }
158}
159
160
161
162class Google_Activities extends Google_Model {
163  protected $__itemsType = 'Google_Activity';
164  protected $__itemsDataType = 'array';
165  public $items;
166  public $kind;
167  public $nextPageToken;
168  public function setItems(/* array(Google_Activity) */ $items) {
169    $this->assertIsArray($items, 'Google_Activity', __METHOD__);
170    $this->items = $items;
171  }
172  public function getItems() {
173    return $this->items;
174  }
175  public function setKind( $kind) {
176    $this->kind = $kind;
177  }
178  public function getKind() {
179    return $this->kind;
180  }
181  public function setNextPageToken( $nextPageToken) {
182    $this->nextPageToken = $nextPageToken;
183  }
184  public function getNextPageToken() {
185    return $this->nextPageToken;
186  }
187}
188
189class Google_Activity extends Google_Model {
190  protected $__actorType = 'Google_ActivityActor';
191  protected $__actorDataType = '';
192  public $actor;
193  protected $__eventsType = 'Google_ActivityEvents';
194  protected $__eventsDataType = 'array';
195  public $events;
196  protected $__idType = 'Google_ActivityId';
197  protected $__idDataType = '';
198  public $id;
199  public $ipAddress;
200  public $kind;
201  public $ownerDomain;
202  public function setActor(Google_ActivityActor $actor) {
203    $this->actor = $actor;
204  }
205  public function getActor() {
206    return $this->actor;
207  }
208  public function setEvents(/* array(Google_ActivityEvents) */ $events) {
209    $this->assertIsArray($events, 'Google_ActivityEvents', __METHOD__);
210    $this->events = $events;
211  }
212  public function getEvents() {
213    return $this->events;
214  }
215  public function setId(Google_ActivityId $id) {
216    $this->id = $id;
217  }
218  public function getId() {
219    return $this->id;
220  }
221  public function setIpAddress( $ipAddress) {
222    $this->ipAddress = $ipAddress;
223  }
224  public function getIpAddress() {
225    return $this->ipAddress;
226  }
227  public function setKind( $kind) {
228    $this->kind = $kind;
229  }
230  public function getKind() {
231    return $this->kind;
232  }
233  public function setOwnerDomain( $ownerDomain) {
234    $this->ownerDomain = $ownerDomain;
235  }
236  public function getOwnerDomain() {
237    return $this->ownerDomain;
238  }
239}
240
241class Google_ActivityActor extends Google_Model {
242  public $callerType;
243  public $email;
244  public $key;
245  public $profileId;
246  public function setCallerType( $callerType) {
247    $this->callerType = $callerType;
248  }
249  public function getCallerType() {
250    return $this->callerType;
251  }
252  public function setEmail( $email) {
253    $this->email = $email;
254  }
255  public function getEmail() {
256    return $this->email;
257  }
258  public function setKey( $key) {
259    $this->key = $key;
260  }
261  public function getKey() {
262    return $this->key;
263  }
264  public function setProfileId( $profileId) {
265    $this->profileId = $profileId;
266  }
267  public function getProfileId() {
268    return $this->profileId;
269  }
270}
271
272class Google_ActivityEvents extends Google_Model {
273  public $name;
274  protected $__parametersType = 'Google_ActivityEventsParameters';
275  protected $__parametersDataType = 'array';
276  public $parameters;
277  public $type;
278  public function setName( $name) {
279    $this->name = $name;
280  }
281  public function getName() {
282    return $this->name;
283  }
284  public function setParameters(/* array(Google_ActivityEventsParameters) */ $parameters) {
285    $this->assertIsArray($parameters, 'Google_ActivityEventsParameters', __METHOD__);
286    $this->parameters = $parameters;
287  }
288  public function getParameters() {
289    return $this->parameters;
290  }
291  public function setType( $type) {
292    $this->type = $type;
293  }
294  public function getType() {
295    return $this->type;
296  }
297}
298
299class Google_ActivityEventsParameters extends Google_Model {
300  public $boolValue;
301  public $intValue;
302  public $name;
303  public $value;
304  public function setBoolValue( $boolValue) {
305    $this->boolValue = $boolValue;
306  }
307  public function getBoolValue() {
308    return $this->boolValue;
309  }
310  public function setIntValue( $intValue) {
311    $this->intValue = $intValue;
312  }
313  public function getIntValue() {
314    return $this->intValue;
315  }
316  public function setName( $name) {
317    $this->name = $name;
318  }
319  public function getName() {
320    return $this->name;
321  }
322  public function setValue( $value) {
323    $this->value = $value;
324  }
325  public function getValue() {
326    return $this->value;
327  }
328}
329
330class Google_ActivityId extends Google_Model {
331  public $applicationName;
332  public $customerId;
333  public $time;
334  public $uniqueQualifier;
335  public function setApplicationName( $applicationName) {
336    $this->applicationName = $applicationName;
337  }
338  public function getApplicationName() {
339    return $this->applicationName;
340  }
341  public function setCustomerId( $customerId) {
342    $this->customerId = $customerId;
343  }
344  public function getCustomerId() {
345    return $this->customerId;
346  }
347  public function setTime( $time) {
348    $this->time = $time;
349  }
350  public function getTime() {
351    return $this->time;
352  }
353  public function setUniqueQualifier( $uniqueQualifier) {
354    $this->uniqueQualifier = $uniqueQualifier;
355  }
356  public function getUniqueQualifier() {
357    return $this->uniqueQualifier;
358  }
359}
360
361class Google_UsageReport extends Google_Model {
362  public $date;
363  protected $__entityType = 'Google_UsageReportEntity';
364  protected $__entityDataType = '';
365  public $entity;
366  public $kind;
367  protected $__parametersType = 'Google_UsageReportParameters';
368  protected $__parametersDataType = 'array';
369  public $parameters;
370  public function setDate( $date) {
371    $this->date = $date;
372  }
373  public function getDate() {
374    return $this->date;
375  }
376  public function setEntity(Google_UsageReportEntity $entity) {
377    $this->entity = $entity;
378  }
379  public function getEntity() {
380    return $this->entity;
381  }
382  public function setKind( $kind) {
383    $this->kind = $kind;
384  }
385  public function getKind() {
386    return $this->kind;
387  }
388  public function setParameters(/* array(Google_UsageReportParameters) */ $parameters) {
389    $this->assertIsArray($parameters, 'Google_UsageReportParameters', __METHOD__);
390    $this->parameters = $parameters;
391  }
392  public function getParameters() {
393    return $this->parameters;
394  }
395}
396
397class Google_UsageReportEntity extends Google_Model {
398  public $customerId;
399  public $profileId;
400  public $type;
401  public $userEmail;
402  public function setCustomerId( $customerId) {
403    $this->customerId = $customerId;
404  }
405  public function getCustomerId() {
406    return $this->customerId;
407  }
408  public function setProfileId( $profileId) {
409    $this->profileId = $profileId;
410  }
411  public function getProfileId() {
412    return $this->profileId;
413  }
414  public function setType( $type) {
415    $this->type = $type;
416  }
417  public function getType() {
418    return $this->type;
419  }
420  public function setUserEmail( $userEmail) {
421    $this->userEmail = $userEmail;
422  }
423  public function getUserEmail() {
424    return $this->userEmail;
425  }
426}
427
428class Google_UsageReportParameters extends Google_Model {
429  public $boolValue;
430  public $datetimeValue;
431  public $intValue;
432  public $name;
433  public $stringValue;
434  public function setBoolValue( $boolValue) {
435    $this->boolValue = $boolValue;
436  }
437  public function getBoolValue() {
438    return $this->boolValue;
439  }
440  public function setDatetimeValue( $datetimeValue) {
441    $this->datetimeValue = $datetimeValue;
442  }
443  public function getDatetimeValue() {
444    return $this->datetimeValue;
445  }
446  public function setIntValue( $intValue) {
447    $this->intValue = $intValue;
448  }
449  public function getIntValue() {
450    return $this->intValue;
451  }
452  public function setName( $name) {
453    $this->name = $name;
454  }
455  public function getName() {
456    return $this->name;
457  }
458  public function setStringValue( $stringValue) {
459    $this->stringValue = $stringValue;
460  }
461  public function getStringValue() {
462    return $this->stringValue;
463  }
464}
465
466class Google_UsageReports extends Google_Model {
467  public $kind;
468  public $nextPageToken;
469  protected $__usageReportsType = 'Google_UsageReport';
470  protected $__usageReportsDataType = 'array';
471  public $usageReports;
472  protected $__warningsType = 'Google_UsageReportsWarnings';
473  protected $__warningsDataType = 'array';
474  public $warnings;
475  public function setKind( $kind) {
476    $this->kind = $kind;
477  }
478  public function getKind() {
479    return $this->kind;
480  }
481  public function setNextPageToken( $nextPageToken) {
482    $this->nextPageToken = $nextPageToken;
483  }
484  public function getNextPageToken() {
485    return $this->nextPageToken;
486  }
487  public function setUsageReports(/* array(Google_UsageReport) */ $usageReports) {
488    $this->assertIsArray($usageReports, 'Google_UsageReport', __METHOD__);
489    $this->usageReports = $usageReports;
490  }
491  public function getUsageReports() {
492    return $this->usageReports;
493  }
494  public function setWarnings(/* array(Google_UsageReportsWarnings) */ $warnings) {
495    $this->assertIsArray($warnings, 'Google_UsageReportsWarnings', __METHOD__);
496    $this->warnings = $warnings;
497  }
498  public function getWarnings() {
499    return $this->warnings;
500  }
501}
502
503class Google_UsageReportsWarnings extends Google_Model {
504  public $code;
505  protected $__dataType = 'Google_UsageReportsWarningsData';
506  protected $__dataDataType = 'array';
507  public $data;
508  public $message;
509  public function setCode( $code) {
510    $this->code = $code;
511  }
512  public function getCode() {
513    return $this->code;
514  }
515  public function setData(/* array(Google_UsageReportsWarningsData) */ $data) {
516    $this->assertIsArray($data, 'Google_UsageReportsWarningsData', __METHOD__);
517    $this->data = $data;
518  }
519  public function getData() {
520    return $this->data;
521  }
522  public function setMessage( $message) {
523    $this->message = $message;
524  }
525  public function getMessage() {
526    return $this->message;
527  }
528}
529
530class Google_UsageReportsWarningsData extends Google_Model {
531  public $key;
532  public $value;
533  public function setKey( $key) {
534    $this->key = $key;
535  }
536  public function getKey() {
537    return $this->key;
538  }
539  public function setValue( $value) {
540    $this->value = $value;
541  }
542  public function getValue() {
543    return $this->value;
544  }
545}
546