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 Adsense (v2).
24 *
25 * <p>
26 * The AdSense Management API allows publishers to access their inventory and
27 * run earnings and performance reports.</p>
28 *
29 * <p>
30 * For more information about this service, see the API
31 * <a href="https://developers.google.com/adsense/management/" target="_blank">Documentation</a>
32 * </p>
33 *
34 * @author Google, Inc.
35 */
36class Adsense extends \Google\Service
37{
38  /** View and manage your AdSense data. */
39  const ADSENSE =
40      "https://www.googleapis.com/auth/adsense";
41  /** View your AdSense data. */
42  const ADSENSE_READONLY =
43      "https://www.googleapis.com/auth/adsense.readonly";
44
45  public $accounts;
46  public $accounts_adclients;
47  public $accounts_adclients_adunits;
48  public $accounts_adclients_customchannels;
49  public $accounts_adclients_urlchannels;
50  public $accounts_alerts;
51  public $accounts_payments;
52  public $accounts_reports;
53  public $accounts_reports_saved;
54  public $accounts_sites;
55
56  /**
57   * Constructs the internal representation of the Adsense service.
58   *
59   * @param Client|array $clientOrConfig The client used to deliver requests, or a
60   *                                     config array to pass to a new Client instance.
61   * @param string $rootUrl The root URL used for requests to the service.
62   */
63  public function __construct($clientOrConfig = [], $rootUrl = null)
64  {
65    parent::__construct($clientOrConfig);
66    $this->rootUrl = $rootUrl ?: 'https://adsense.googleapis.com/';
67    $this->servicePath = '';
68    $this->batchPath = 'batch';
69    $this->version = 'v2';
70    $this->serviceName = 'adsense';
71
72    $this->accounts = new Adsense\Resource\Accounts(
73        $this,
74        $this->serviceName,
75        'accounts',
76        [
77          'methods' => [
78            'get' => [
79              'path' => 'v2/{+name}',
80              'httpMethod' => 'GET',
81              'parameters' => [
82                'name' => [
83                  'location' => 'path',
84                  'type' => 'string',
85                  'required' => true,
86                ],
87              ],
88            ],'list' => [
89              'path' => 'v2/accounts',
90              'httpMethod' => 'GET',
91              'parameters' => [
92                'pageSize' => [
93                  'location' => 'query',
94                  'type' => 'integer',
95                ],
96                'pageToken' => [
97                  'location' => 'query',
98                  'type' => 'string',
99                ],
100              ],
101            ],'listChildAccounts' => [
102              'path' => 'v2/{+parent}:listChildAccounts',
103              'httpMethod' => 'GET',
104              'parameters' => [
105                'parent' => [
106                  'location' => 'path',
107                  'type' => 'string',
108                  'required' => true,
109                ],
110                'pageSize' => [
111                  'location' => 'query',
112                  'type' => 'integer',
113                ],
114                'pageToken' => [
115                  'location' => 'query',
116                  'type' => 'string',
117                ],
118              ],
119            ],
120          ]
121        ]
122    );
123    $this->accounts_adclients = new Adsense\Resource\AccountsAdclients(
124        $this,
125        $this->serviceName,
126        'adclients',
127        [
128          'methods' => [
129            'getAdcode' => [
130              'path' => 'v2/{+name}/adcode',
131              'httpMethod' => 'GET',
132              'parameters' => [
133                'name' => [
134                  'location' => 'path',
135                  'type' => 'string',
136                  'required' => true,
137                ],
138              ],
139            ],'list' => [
140              'path' => 'v2/{+parent}/adclients',
141              'httpMethod' => 'GET',
142              'parameters' => [
143                'parent' => [
144                  'location' => 'path',
145                  'type' => 'string',
146                  'required' => true,
147                ],
148                'pageSize' => [
149                  'location' => 'query',
150                  'type' => 'integer',
151                ],
152                'pageToken' => [
153                  'location' => 'query',
154                  'type' => 'string',
155                ],
156              ],
157            ],
158          ]
159        ]
160    );
161    $this->accounts_adclients_adunits = new Adsense\Resource\AccountsAdclientsAdunits(
162        $this,
163        $this->serviceName,
164        'adunits',
165        [
166          'methods' => [
167            'get' => [
168              'path' => 'v2/{+name}',
169              'httpMethod' => 'GET',
170              'parameters' => [
171                'name' => [
172                  'location' => 'path',
173                  'type' => 'string',
174                  'required' => true,
175                ],
176              ],
177            ],'getAdcode' => [
178              'path' => 'v2/{+name}/adcode',
179              'httpMethod' => 'GET',
180              'parameters' => [
181                'name' => [
182                  'location' => 'path',
183                  'type' => 'string',
184                  'required' => true,
185                ],
186              ],
187            ],'list' => [
188              'path' => 'v2/{+parent}/adunits',
189              'httpMethod' => 'GET',
190              'parameters' => [
191                'parent' => [
192                  'location' => 'path',
193                  'type' => 'string',
194                  'required' => true,
195                ],
196                'pageSize' => [
197                  'location' => 'query',
198                  'type' => 'integer',
199                ],
200                'pageToken' => [
201                  'location' => 'query',
202                  'type' => 'string',
203                ],
204              ],
205            ],'listLinkedCustomChannels' => [
206              'path' => 'v2/{+parent}:listLinkedCustomChannels',
207              'httpMethod' => 'GET',
208              'parameters' => [
209                'parent' => [
210                  'location' => 'path',
211                  'type' => 'string',
212                  'required' => true,
213                ],
214                'pageSize' => [
215                  'location' => 'query',
216                  'type' => 'integer',
217                ],
218                'pageToken' => [
219                  'location' => 'query',
220                  'type' => 'string',
221                ],
222              ],
223            ],
224          ]
225        ]
226    );
227    $this->accounts_adclients_customchannels = new Adsense\Resource\AccountsAdclientsCustomchannels(
228        $this,
229        $this->serviceName,
230        'customchannels',
231        [
232          'methods' => [
233            'get' => [
234              'path' => 'v2/{+name}',
235              'httpMethod' => 'GET',
236              'parameters' => [
237                'name' => [
238                  'location' => 'path',
239                  'type' => 'string',
240                  'required' => true,
241                ],
242              ],
243            ],'list' => [
244              'path' => 'v2/{+parent}/customchannels',
245              'httpMethod' => 'GET',
246              'parameters' => [
247                'parent' => [
248                  'location' => 'path',
249                  'type' => 'string',
250                  'required' => true,
251                ],
252                'pageSize' => [
253                  'location' => 'query',
254                  'type' => 'integer',
255                ],
256                'pageToken' => [
257                  'location' => 'query',
258                  'type' => 'string',
259                ],
260              ],
261            ],'listLinkedAdUnits' => [
262              'path' => 'v2/{+parent}:listLinkedAdUnits',
263              'httpMethod' => 'GET',
264              'parameters' => [
265                'parent' => [
266                  'location' => 'path',
267                  'type' => 'string',
268                  'required' => true,
269                ],
270                'pageSize' => [
271                  'location' => 'query',
272                  'type' => 'integer',
273                ],
274                'pageToken' => [
275                  'location' => 'query',
276                  'type' => 'string',
277                ],
278              ],
279            ],
280          ]
281        ]
282    );
283    $this->accounts_adclients_urlchannels = new Adsense\Resource\AccountsAdclientsUrlchannels(
284        $this,
285        $this->serviceName,
286        'urlchannels',
287        [
288          'methods' => [
289            'list' => [
290              'path' => 'v2/{+parent}/urlchannels',
291              'httpMethod' => 'GET',
292              'parameters' => [
293                'parent' => [
294                  'location' => 'path',
295                  'type' => 'string',
296                  'required' => true,
297                ],
298                'pageSize' => [
299                  'location' => 'query',
300                  'type' => 'integer',
301                ],
302                'pageToken' => [
303                  'location' => 'query',
304                  'type' => 'string',
305                ],
306              ],
307            ],
308          ]
309        ]
310    );
311    $this->accounts_alerts = new Adsense\Resource\AccountsAlerts(
312        $this,
313        $this->serviceName,
314        'alerts',
315        [
316          'methods' => [
317            'list' => [
318              'path' => 'v2/{+parent}/alerts',
319              'httpMethod' => 'GET',
320              'parameters' => [
321                'parent' => [
322                  'location' => 'path',
323                  'type' => 'string',
324                  'required' => true,
325                ],
326                'languageCode' => [
327                  'location' => 'query',
328                  'type' => 'string',
329                ],
330              ],
331            ],
332          ]
333        ]
334    );
335    $this->accounts_payments = new Adsense\Resource\AccountsPayments(
336        $this,
337        $this->serviceName,
338        'payments',
339        [
340          'methods' => [
341            'list' => [
342              'path' => 'v2/{+parent}/payments',
343              'httpMethod' => 'GET',
344              'parameters' => [
345                'parent' => [
346                  'location' => 'path',
347                  'type' => 'string',
348                  'required' => true,
349                ],
350              ],
351            ],
352          ]
353        ]
354    );
355    $this->accounts_reports = new Adsense\Resource\AccountsReports(
356        $this,
357        $this->serviceName,
358        'reports',
359        [
360          'methods' => [
361            'generate' => [
362              'path' => 'v2/{+account}/reports:generate',
363              'httpMethod' => 'GET',
364              'parameters' => [
365                'account' => [
366                  'location' => 'path',
367                  'type' => 'string',
368                  'required' => true,
369                ],
370                'currencyCode' => [
371                  'location' => 'query',
372                  'type' => 'string',
373                ],
374                'dateRange' => [
375                  'location' => 'query',
376                  'type' => 'string',
377                ],
378                'dimensions' => [
379                  'location' => 'query',
380                  'type' => 'string',
381                  'repeated' => true,
382                ],
383                'endDate.day' => [
384                  'location' => 'query',
385                  'type' => 'integer',
386                ],
387                'endDate.month' => [
388                  'location' => 'query',
389                  'type' => 'integer',
390                ],
391                'endDate.year' => [
392                  'location' => 'query',
393                  'type' => 'integer',
394                ],
395                'filters' => [
396                  'location' => 'query',
397                  'type' => 'string',
398                  'repeated' => true,
399                ],
400                'languageCode' => [
401                  'location' => 'query',
402                  'type' => 'string',
403                ],
404                'limit' => [
405                  'location' => 'query',
406                  'type' => 'integer',
407                ],
408                'metrics' => [
409                  'location' => 'query',
410                  'type' => 'string',
411                  'repeated' => true,
412                ],
413                'orderBy' => [
414                  'location' => 'query',
415                  'type' => 'string',
416                  'repeated' => true,
417                ],
418                'reportingTimeZone' => [
419                  'location' => 'query',
420                  'type' => 'string',
421                ],
422                'startDate.day' => [
423                  'location' => 'query',
424                  'type' => 'integer',
425                ],
426                'startDate.month' => [
427                  'location' => 'query',
428                  'type' => 'integer',
429                ],
430                'startDate.year' => [
431                  'location' => 'query',
432                  'type' => 'integer',
433                ],
434              ],
435            ],'generateCsv' => [
436              'path' => 'v2/{+account}/reports:generateCsv',
437              'httpMethod' => 'GET',
438              'parameters' => [
439                'account' => [
440                  'location' => 'path',
441                  'type' => 'string',
442                  'required' => true,
443                ],
444                'currencyCode' => [
445                  'location' => 'query',
446                  'type' => 'string',
447                ],
448                'dateRange' => [
449                  'location' => 'query',
450                  'type' => 'string',
451                ],
452                'dimensions' => [
453                  'location' => 'query',
454                  'type' => 'string',
455                  'repeated' => true,
456                ],
457                'endDate.day' => [
458                  'location' => 'query',
459                  'type' => 'integer',
460                ],
461                'endDate.month' => [
462                  'location' => 'query',
463                  'type' => 'integer',
464                ],
465                'endDate.year' => [
466                  'location' => 'query',
467                  'type' => 'integer',
468                ],
469                'filters' => [
470                  'location' => 'query',
471                  'type' => 'string',
472                  'repeated' => true,
473                ],
474                'languageCode' => [
475                  'location' => 'query',
476                  'type' => 'string',
477                ],
478                'limit' => [
479                  'location' => 'query',
480                  'type' => 'integer',
481                ],
482                'metrics' => [
483                  'location' => 'query',
484                  'type' => 'string',
485                  'repeated' => true,
486                ],
487                'orderBy' => [
488                  'location' => 'query',
489                  'type' => 'string',
490                  'repeated' => true,
491                ],
492                'reportingTimeZone' => [
493                  'location' => 'query',
494                  'type' => 'string',
495                ],
496                'startDate.day' => [
497                  'location' => 'query',
498                  'type' => 'integer',
499                ],
500                'startDate.month' => [
501                  'location' => 'query',
502                  'type' => 'integer',
503                ],
504                'startDate.year' => [
505                  'location' => 'query',
506                  'type' => 'integer',
507                ],
508              ],
509            ],
510          ]
511        ]
512    );
513    $this->accounts_reports_saved = new Adsense\Resource\AccountsReportsSaved(
514        $this,
515        $this->serviceName,
516        'saved',
517        [
518          'methods' => [
519            'generate' => [
520              'path' => 'v2/{+name}/saved:generate',
521              'httpMethod' => 'GET',
522              'parameters' => [
523                'name' => [
524                  'location' => 'path',
525                  'type' => 'string',
526                  'required' => true,
527                ],
528                'currencyCode' => [
529                  'location' => 'query',
530                  'type' => 'string',
531                ],
532                'dateRange' => [
533                  'location' => 'query',
534                  'type' => 'string',
535                ],
536                'endDate.day' => [
537                  'location' => 'query',
538                  'type' => 'integer',
539                ],
540                'endDate.month' => [
541                  'location' => 'query',
542                  'type' => 'integer',
543                ],
544                'endDate.year' => [
545                  'location' => 'query',
546                  'type' => 'integer',
547                ],
548                'languageCode' => [
549                  'location' => 'query',
550                  'type' => 'string',
551                ],
552                'reportingTimeZone' => [
553                  'location' => 'query',
554                  'type' => 'string',
555                ],
556                'startDate.day' => [
557                  'location' => 'query',
558                  'type' => 'integer',
559                ],
560                'startDate.month' => [
561                  'location' => 'query',
562                  'type' => 'integer',
563                ],
564                'startDate.year' => [
565                  'location' => 'query',
566                  'type' => 'integer',
567                ],
568              ],
569            ],'generateCsv' => [
570              'path' => 'v2/{+name}/saved:generateCsv',
571              'httpMethod' => 'GET',
572              'parameters' => [
573                'name' => [
574                  'location' => 'path',
575                  'type' => 'string',
576                  'required' => true,
577                ],
578                'currencyCode' => [
579                  'location' => 'query',
580                  'type' => 'string',
581                ],
582                'dateRange' => [
583                  'location' => 'query',
584                  'type' => 'string',
585                ],
586                'endDate.day' => [
587                  'location' => 'query',
588                  'type' => 'integer',
589                ],
590                'endDate.month' => [
591                  'location' => 'query',
592                  'type' => 'integer',
593                ],
594                'endDate.year' => [
595                  'location' => 'query',
596                  'type' => 'integer',
597                ],
598                'languageCode' => [
599                  'location' => 'query',
600                  'type' => 'string',
601                ],
602                'reportingTimeZone' => [
603                  'location' => 'query',
604                  'type' => 'string',
605                ],
606                'startDate.day' => [
607                  'location' => 'query',
608                  'type' => 'integer',
609                ],
610                'startDate.month' => [
611                  'location' => 'query',
612                  'type' => 'integer',
613                ],
614                'startDate.year' => [
615                  'location' => 'query',
616                  'type' => 'integer',
617                ],
618              ],
619            ],'list' => [
620              'path' => 'v2/{+parent}/reports/saved',
621              'httpMethod' => 'GET',
622              'parameters' => [
623                'parent' => [
624                  'location' => 'path',
625                  'type' => 'string',
626                  'required' => true,
627                ],
628                'pageSize' => [
629                  'location' => 'query',
630                  'type' => 'integer',
631                ],
632                'pageToken' => [
633                  'location' => 'query',
634                  'type' => 'string',
635                ],
636              ],
637            ],
638          ]
639        ]
640    );
641    $this->accounts_sites = new Adsense\Resource\AccountsSites(
642        $this,
643        $this->serviceName,
644        'sites',
645        [
646          'methods' => [
647            'get' => [
648              'path' => 'v2/{+name}',
649              'httpMethod' => 'GET',
650              'parameters' => [
651                'name' => [
652                  'location' => 'path',
653                  'type' => 'string',
654                  'required' => true,
655                ],
656              ],
657            ],'list' => [
658              'path' => 'v2/{+parent}/sites',
659              'httpMethod' => 'GET',
660              'parameters' => [
661                'parent' => [
662                  'location' => 'path',
663                  'type' => 'string',
664                  'required' => true,
665                ],
666                'pageSize' => [
667                  'location' => 'query',
668                  'type' => 'integer',
669                ],
670                'pageToken' => [
671                  'location' => 'query',
672                  'type' => 'string',
673                ],
674              ],
675            ],
676          ]
677        ]
678    );
679  }
680}
681
682// Adding a class alias for backwards compatibility with the previous class name.
683class_alias(Adsense::class, 'Google_Service_Adsense');
684