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\Games\Resource;
19
20use Google\Service\Games\EventDefinitionListResponse;
21use Google\Service\Games\EventRecordRequest;
22use Google\Service\Games\EventUpdateResponse;
23use Google\Service\Games\PlayerEventListResponse;
24
25/**
26 * The "events" collection of methods.
27 * Typical usage is:
28 *  <code>
29 *   $gamesService = new Google\Service\Games(...);
30 *   $events = $gamesService->events;
31 *  </code>
32 */
33class Events extends \Google\Service\Resource
34{
35  /**
36   * Returns a list showing the current progress on events in this application for
37   * the currently authenticated user. (events.listByPlayer)
38   *
39   * @param array $optParams Optional parameters.
40   *
41   * @opt_param string language The preferred language to use for strings returned
42   * by this method.
43   * @opt_param int maxResults The maximum number of events to return in the
44   * response, used for paging. For any response, the actual number of events to
45   * return may be less than the specified maxResults.
46   * @opt_param string pageToken The token returned by the previous request.
47   * @return PlayerEventListResponse
48   */
49  public function listByPlayer($optParams = [])
50  {
51    $params = [];
52    $params = array_merge($params, $optParams);
53    return $this->call('listByPlayer', [$params], PlayerEventListResponse::class);
54  }
55  /**
56   * Returns a list of the event definitions in this application.
57   * (events.listDefinitions)
58   *
59   * @param array $optParams Optional parameters.
60   *
61   * @opt_param string language The preferred language to use for strings returned
62   * by this method.
63   * @opt_param int maxResults The maximum number of event definitions to return
64   * in the response, used for paging. For any response, the actual number of
65   * event definitions to return may be less than the specified `maxResults`.
66   * @opt_param string pageToken The token returned by the previous request.
67   * @return EventDefinitionListResponse
68   */
69  public function listDefinitions($optParams = [])
70  {
71    $params = [];
72    $params = array_merge($params, $optParams);
73    return $this->call('listDefinitions', [$params], EventDefinitionListResponse::class);
74  }
75  /**
76   * Records a batch of changes to the number of times events have occurred for
77   * the currently authenticated user of this application. (events.record)
78   *
79   * @param EventRecordRequest $postBody
80   * @param array $optParams Optional parameters.
81   *
82   * @opt_param string language The preferred language to use for strings returned
83   * by this method.
84   * @return EventUpdateResponse
85   */
86  public function record(EventRecordRequest $postBody, $optParams = [])
87  {
88    $params = ['postBody' => $postBody];
89    $params = array_merge($params, $optParams);
90    return $this->call('record', [$params], EventUpdateResponse::class);
91  }
92}
93
94// Adding a class alias for backwards compatibility with the previous class name.
95class_alias(Events::class, 'Google_Service_Games_Resource_Events');
96