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\Player;
21use Google\Service\Games\PlayerListResponse;
22
23/**
24 * The "players" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $gamesService = new Google\Service\Games(...);
28 *   $players = $gamesService->players;
29 *  </code>
30 */
31class Players extends \Google\Service\Resource
32{
33  /**
34   * Retrieves the Player resource with the given ID. To retrieve the player for
35   * the currently authenticated user, set `playerId` to `me`. (players.get)
36   *
37   * @param string $playerId A player ID. A value of `me` may be used in place of
38   * the authenticated player's ID.
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 string playerIdConsistencyToken Consistency token of the player
44   * id. The call returns a 'not found' result when the token is present and
45   * invalid. Empty value is ignored. See also GlobalPlayerIdConsistencyTokenProto
46   * @return Player
47   */
48  public function get($playerId, $optParams = [])
49  {
50    $params = ['playerId' => $playerId];
51    $params = array_merge($params, $optParams);
52    return $this->call('get', [$params], Player::class);
53  }
54  /**
55   * Get the collection of players for the currently authenticated user.
56   * (players.listPlayers)
57   *
58   * @param string $collection Collection of players being retrieved
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 player resources to return in
64   * the response, used for paging. For any response, the actual number of player
65   * resources returned may be less than the specified `maxResults`.
66   * @opt_param string pageToken The token returned by the previous request.
67   * @return PlayerListResponse
68   */
69  public function listPlayers($collection, $optParams = [])
70  {
71    $params = ['collection' => $collection];
72    $params = array_merge($params, $optParams);
73    return $this->call('list', [$params], PlayerListResponse::class);
74  }
75}
76
77// Adding a class alias for backwards compatibility with the previous class name.
78class_alias(Players::class, 'Google_Service_Games_Resource_Players');
79