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