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 |
|
---|
18 | namespace Google\Service\Games\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\Games\GetMultipleApplicationPlayerIdsResponse;
|
---|
21 | use Google\Service\Games\Player;
|
---|
22 | use Google\Service\Games\PlayerListResponse;
|
---|
23 | use Google\Service\Games\ScopedPlayerIds;
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * The "players" collection of methods.
|
---|
27 | * Typical usage is:
|
---|
28 | * <code>
|
---|
29 | * $gamesService = new Google\Service\Games(...);
|
---|
30 | * $players = $gamesService->players;
|
---|
31 | * </code>
|
---|
32 | */
|
---|
33 | class Players extends \Google\Service\Resource
|
---|
34 | {
|
---|
35 | /**
|
---|
36 | * Retrieves the Player resource with the given ID. To retrieve the player for
|
---|
37 | * the currently authenticated user, set `playerId` to `me`. (players.get)
|
---|
38 | *
|
---|
39 | * @param string $playerId A player ID. A value of `me` may be used in place of
|
---|
40 | * the authenticated player's ID.
|
---|
41 | * @param array $optParams Optional parameters.
|
---|
42 | *
|
---|
43 | * @opt_param string language The preferred language to use for strings returned
|
---|
44 | * by this method.
|
---|
45 | * @opt_param string playerIdConsistencyToken Consistency token of the player
|
---|
46 | * id. The call returns a 'not found' result when the token is present and
|
---|
47 | * invalid. Empty value is ignored. See also GlobalPlayerIdConsistencyTokenProto
|
---|
48 | * @return Player
|
---|
49 | * @throws \Google\Service\Exception
|
---|
50 | */
|
---|
51 | public function get($playerId, $optParams = [])
|
---|
52 | {
|
---|
53 | $params = ['playerId' => $playerId];
|
---|
54 | $params = array_merge($params, $optParams);
|
---|
55 | return $this->call('get', [$params], Player::class);
|
---|
56 | }
|
---|
57 | /**
|
---|
58 | * Get the application player ids for the currently authenticated player across
|
---|
59 | * all requested games by the same developer as the calling application. This
|
---|
60 | * will only return ids for players that actually have an id (scoped or
|
---|
61 | * otherwise) with that game. (players.getMultipleApplicationPlayerIds)
|
---|
62 | *
|
---|
63 | * @param array $optParams Optional parameters.
|
---|
64 | *
|
---|
65 | * @opt_param string applicationIds Required. The application IDs from the
|
---|
66 | * Google Play developer console for the games to return scoped ids for.
|
---|
67 | * @return GetMultipleApplicationPlayerIdsResponse
|
---|
68 | * @throws \Google\Service\Exception
|
---|
69 | */
|
---|
70 | public function getMultipleApplicationPlayerIds($optParams = [])
|
---|
71 | {
|
---|
72 | $params = [];
|
---|
73 | $params = array_merge($params, $optParams);
|
---|
74 | return $this->call('getMultipleApplicationPlayerIds', [$params], GetMultipleApplicationPlayerIdsResponse::class);
|
---|
75 | }
|
---|
76 | /**
|
---|
77 | * Retrieves scoped player identifiers for currently authenticated user.
|
---|
78 | * (players.getScopedPlayerIds)
|
---|
79 | *
|
---|
80 | * @param array $optParams Optional parameters.
|
---|
81 | * @return ScopedPlayerIds
|
---|
82 | * @throws \Google\Service\Exception
|
---|
83 | */
|
---|
84 | public function getScopedPlayerIds($optParams = [])
|
---|
85 | {
|
---|
86 | $params = [];
|
---|
87 | $params = array_merge($params, $optParams);
|
---|
88 | return $this->call('getScopedPlayerIds', [$params], ScopedPlayerIds::class);
|
---|
89 | }
|
---|
90 | /**
|
---|
91 | * Get the collection of players for the currently authenticated user.
|
---|
92 | * (players.listPlayers)
|
---|
93 | *
|
---|
94 | * @param string $collection Collection of players being retrieved
|
---|
95 | * @param array $optParams Optional parameters.
|
---|
96 | *
|
---|
97 | * @opt_param string language The preferred language to use for strings returned
|
---|
98 | * by this method.
|
---|
99 | * @opt_param int maxResults The maximum number of player resources to return in
|
---|
100 | * the response, used for paging. For any response, the actual number of player
|
---|
101 | * resources returned may be less than the specified `maxResults`.
|
---|
102 | * @opt_param string pageToken The token returned by the previous request.
|
---|
103 | * @return PlayerListResponse
|
---|
104 | * @throws \Google\Service\Exception
|
---|
105 | */
|
---|
106 | public function listPlayers($collection, $optParams = [])
|
---|
107 | {
|
---|
108 | $params = ['collection' => $collection];
|
---|
109 | $params = array_merge($params, $optParams);
|
---|
110 | return $this->call('list', [$params], PlayerListResponse::class);
|
---|
111 | }
|
---|
112 | }
|
---|
113 |
|
---|
114 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
115 | class_alias(Players::class, 'Google_Service_Games_Resource_Players');
|
---|