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;
19
20use Google\Client;
21
22/**
23 * Service definition for Reports (reports_v1).
24 *
25 * <p>
26 * Admin SDK lets administrators of enterprise domains to view and manage
27 * resources like user, groups etc. It also provides audit and usage reports of
28 * domain.</p>
29 *
30 * <p>
31 * For more information about this service, see the API
32 * <a href="https://developers.google.com/admin-sdk/" target="_blank">Documentation</a>
33 * </p>
34 *
35 * @author Google, Inc.
36 */
37class Reports extends \Google\Service
38{
39  /** View audit reports for your G Suite domain. */
40  const ADMIN_REPORTS_AUDIT_READONLY =
41      "https://www.googleapis.com/auth/admin.reports.audit.readonly";
42  /** View usage reports for your G Suite domain. */
43  const ADMIN_REPORTS_USAGE_READONLY =
44      "https://www.googleapis.com/auth/admin.reports.usage.readonly";
45
46  public $activities;
47  public $channels;
48  public $customerUsageReports;
49  public $entityUsageReports;
50  public $userUsageReport;
51
52  /**
53   * Constructs the internal representation of the Reports service.
54   *
55   * @param Client|array $clientOrConfig The client used to deliver requests, or a
56   *                                     config array to pass to a new Client instance.
57   * @param string $rootUrl The root URL used for requests to the service.
58   */
59  public function __construct($clientOrConfig = [], $rootUrl = null)
60  {
61    parent::__construct($clientOrConfig);
62    $this->rootUrl = $rootUrl ?: 'https://admin.googleapis.com/';
63    $this->servicePath = '';
64    $this->batchPath = 'batch';
65    $this->version = 'reports_v1';
66    $this->serviceName = 'admin';
67
68    $this->activities = new Reports\Resource\Activities(
69        $this,
70        $this->serviceName,
71        'activities',
72        [
73          'methods' => [
74            'list' => [
75              'path' => 'admin/reports/v1/activity/users/{userKey}/applications/{applicationName}',
76              'httpMethod' => 'GET',
77              'parameters' => [
78                'userKey' => [
79                  'location' => 'path',
80                  'type' => 'string',
81                  'required' => true,
82                ],
83                'applicationName' => [
84                  'location' => 'path',
85                  'type' => 'string',
86                  'required' => true,
87                ],
88                'actorIpAddress' => [
89                  'location' => 'query',
90                  'type' => 'string',
91                ],
92                'customerId' => [
93                  'location' => 'query',
94                  'type' => 'string',
95                ],
96                'endTime' => [
97                  'location' => 'query',
98                  'type' => 'string',
99                ],
100                'eventName' => [
101                  'location' => 'query',
102                  'type' => 'string',
103                ],
104                'filters' => [
105                  'location' => 'query',
106                  'type' => 'string',
107                ],
108                'groupIdFilter' => [
109                  'location' => 'query',
110                  'type' => 'string',
111                ],
112                'maxResults' => [
113                  'location' => 'query',
114                  'type' => 'integer',
115                ],
116                'orgUnitID' => [
117                  'location' => 'query',
118                  'type' => 'string',
119                ],
120                'pageToken' => [
121                  'location' => 'query',
122                  'type' => 'string',
123                ],
124                'startTime' => [
125                  'location' => 'query',
126                  'type' => 'string',
127                ],
128              ],
129            ],'watch' => [
130              'path' => 'admin/reports/v1/activity/users/{userKey}/applications/{applicationName}/watch',
131              'httpMethod' => 'POST',
132              'parameters' => [
133                'userKey' => [
134                  'location' => 'path',
135                  'type' => 'string',
136                  'required' => true,
137                ],
138                'applicationName' => [
139                  'location' => 'path',
140                  'type' => 'string',
141                  'required' => true,
142                ],
143                'actorIpAddress' => [
144                  'location' => 'query',
145                  'type' => 'string',
146                ],
147                'customerId' => [
148                  'location' => 'query',
149                  'type' => 'string',
150                ],
151                'endTime' => [
152                  'location' => 'query',
153                  'type' => 'string',
154                ],
155                'eventName' => [
156                  'location' => 'query',
157                  'type' => 'string',
158                ],
159                'filters' => [
160                  'location' => 'query',
161                  'type' => 'string',
162                ],
163                'groupIdFilter' => [
164                  'location' => 'query',
165                  'type' => 'string',
166                ],
167                'maxResults' => [
168                  'location' => 'query',
169                  'type' => 'integer',
170                ],
171                'orgUnitID' => [
172                  'location' => 'query',
173                  'type' => 'string',
174                ],
175                'pageToken' => [
176                  'location' => 'query',
177                  'type' => 'string',
178                ],
179                'startTime' => [
180                  'location' => 'query',
181                  'type' => 'string',
182                ],
183              ],
184            ],
185          ]
186        ]
187    );
188    $this->channels = new Reports\Resource\Channels(
189        $this,
190        $this->serviceName,
191        'channels',
192        [
193          'methods' => [
194            'stop' => [
195              'path' => 'admin/reports_v1/channels/stop',
196              'httpMethod' => 'POST',
197              'parameters' => [],
198            ],
199          ]
200        ]
201    );
202    $this->customerUsageReports = new Reports\Resource\CustomerUsageReports(
203        $this,
204        $this->serviceName,
205        'customerUsageReports',
206        [
207          'methods' => [
208            'get' => [
209              'path' => 'admin/reports/v1/usage/dates/{date}',
210              'httpMethod' => 'GET',
211              'parameters' => [
212                'date' => [
213                  'location' => 'path',
214                  'type' => 'string',
215                  'required' => true,
216                ],
217                'customerId' => [
218                  'location' => 'query',
219                  'type' => 'string',
220                ],
221                'pageToken' => [
222                  'location' => 'query',
223                  'type' => 'string',
224                ],
225                'parameters' => [
226                  'location' => 'query',
227                  'type' => 'string',
228                ],
229              ],
230            ],
231          ]
232        ]
233    );
234    $this->entityUsageReports = new Reports\Resource\EntityUsageReports(
235        $this,
236        $this->serviceName,
237        'entityUsageReports',
238        [
239          'methods' => [
240            'get' => [
241              'path' => 'admin/reports/v1/usage/{entityType}/{entityKey}/dates/{date}',
242              'httpMethod' => 'GET',
243              'parameters' => [
244                'entityType' => [
245                  'location' => 'path',
246                  'type' => 'string',
247                  'required' => true,
248                ],
249                'entityKey' => [
250                  'location' => 'path',
251                  'type' => 'string',
252                  'required' => true,
253                ],
254                'date' => [
255                  'location' => 'path',
256                  'type' => 'string',
257                  'required' => true,
258                ],
259                'customerId' => [
260                  'location' => 'query',
261                  'type' => 'string',
262                ],
263                'filters' => [
264                  'location' => 'query',
265                  'type' => 'string',
266                ],
267                'maxResults' => [
268                  'location' => 'query',
269                  'type' => 'integer',
270                ],
271                'pageToken' => [
272                  'location' => 'query',
273                  'type' => 'string',
274                ],
275                'parameters' => [
276                  'location' => 'query',
277                  'type' => 'string',
278                ],
279              ],
280            ],
281          ]
282        ]
283    );
284    $this->userUsageReport = new Reports\Resource\UserUsageReport(
285        $this,
286        $this->serviceName,
287        'userUsageReport',
288        [
289          'methods' => [
290            'get' => [
291              'path' => 'admin/reports/v1/usage/users/{userKey}/dates/{date}',
292              'httpMethod' => 'GET',
293              'parameters' => [
294                'userKey' => [
295                  'location' => 'path',
296                  'type' => 'string',
297                  'required' => true,
298                ],
299                'date' => [
300                  'location' => 'path',
301                  'type' => 'string',
302                  'required' => true,
303                ],
304                'customerId' => [
305                  'location' => 'query',
306                  'type' => 'string',
307                ],
308                'filters' => [
309                  'location' => 'query',
310                  'type' => 'string',
311                ],
312                'groupIdFilter' => [
313                  'location' => 'query',
314                  'type' => 'string',
315                ],
316                'maxResults' => [
317                  'location' => 'query',
318                  'type' => 'integer',
319                ],
320                'orgUnitID' => [
321                  'location' => 'query',
322                  'type' => 'string',
323                ],
324                'pageToken' => [
325                  'location' => 'query',
326                  'type' => 'string',
327                ],
328                'parameters' => [
329                  'location' => 'query',
330                  'type' => 'string',
331                ],
332              ],
333            ],
334          ]
335        ]
336    );
337  }
338}
339
340// Adding a class alias for backwards compatibility with the previous class name.
341class_alias(Reports::class, 'Google_Service_Reports');
342