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\AchievementIncrementResponse;
|
---|
21 | use Google\Service\Games\AchievementRevealResponse;
|
---|
22 | use Google\Service\Games\AchievementSetStepsAtLeastResponse;
|
---|
23 | use Google\Service\Games\AchievementUnlockResponse;
|
---|
24 | use Google\Service\Games\AchievementUpdateMultipleRequest;
|
---|
25 | use Google\Service\Games\AchievementUpdateMultipleResponse;
|
---|
26 | use Google\Service\Games\PlayerAchievementListResponse;
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * The "achievements" collection of methods.
|
---|
30 | * Typical usage is:
|
---|
31 | * <code>
|
---|
32 | * $gamesService = new Google\Service\Games(...);
|
---|
33 | * $achievements = $gamesService->achievements;
|
---|
34 | * </code>
|
---|
35 | */
|
---|
36 | class Achievements extends \Google\Service\Resource
|
---|
37 | {
|
---|
38 | /**
|
---|
39 | * Increments the steps of the achievement with the given ID for the currently
|
---|
40 | * authenticated player. (achievements.increment)
|
---|
41 | *
|
---|
42 | * @param string $achievementId The ID of the achievement used by this method.
|
---|
43 | * @param int $stepsToIncrement Required. The number of steps to increment.
|
---|
44 | * @param array $optParams Optional parameters.
|
---|
45 | *
|
---|
46 | * @opt_param string requestId A randomly generated numeric ID for each request
|
---|
47 | * specified by the caller. This number is used at the server to ensure that the
|
---|
48 | * request is handled correctly across retries.
|
---|
49 | * @return AchievementIncrementResponse
|
---|
50 | * @throws \Google\Service\Exception
|
---|
51 | */
|
---|
52 | public function increment($achievementId, $stepsToIncrement, $optParams = [])
|
---|
53 | {
|
---|
54 | $params = ['achievementId' => $achievementId, 'stepsToIncrement' => $stepsToIncrement];
|
---|
55 | $params = array_merge($params, $optParams);
|
---|
56 | return $this->call('increment', [$params], AchievementIncrementResponse::class);
|
---|
57 | }
|
---|
58 | /**
|
---|
59 | * Lists the progress for all your application's achievements for the currently
|
---|
60 | * authenticated player. (achievements.listAchievements)
|
---|
61 | *
|
---|
62 | * @param string $playerId A player ID. A value of `me` may be used in place of
|
---|
63 | * the authenticated player's ID.
|
---|
64 | * @param array $optParams Optional parameters.
|
---|
65 | *
|
---|
66 | * @opt_param string language The preferred language to use for strings returned
|
---|
67 | * by this method.
|
---|
68 | * @opt_param int maxResults The maximum number of achievement resources to
|
---|
69 | * return in the response, used for paging. For any response, the actual number
|
---|
70 | * of achievement resources returned may be less than the specified
|
---|
71 | * `maxResults`.
|
---|
72 | * @opt_param string pageToken The token returned by the previous request.
|
---|
73 | * @opt_param string state Tells the server to return only achievements with the
|
---|
74 | * specified state. If this parameter isn't specified, all achievements are
|
---|
75 | * returned.
|
---|
76 | * @return PlayerAchievementListResponse
|
---|
77 | * @throws \Google\Service\Exception
|
---|
78 | */
|
---|
79 | public function listAchievements($playerId, $optParams = [])
|
---|
80 | {
|
---|
81 | $params = ['playerId' => $playerId];
|
---|
82 | $params = array_merge($params, $optParams);
|
---|
83 | return $this->call('list', [$params], PlayerAchievementListResponse::class);
|
---|
84 | }
|
---|
85 | /**
|
---|
86 | * Sets the state of the achievement with the given ID to `REVEALED` for the
|
---|
87 | * currently authenticated player. (achievements.reveal)
|
---|
88 | *
|
---|
89 | * @param string $achievementId The ID of the achievement used by this method.
|
---|
90 | * @param array $optParams Optional parameters.
|
---|
91 | * @return AchievementRevealResponse
|
---|
92 | * @throws \Google\Service\Exception
|
---|
93 | */
|
---|
94 | public function reveal($achievementId, $optParams = [])
|
---|
95 | {
|
---|
96 | $params = ['achievementId' => $achievementId];
|
---|
97 | $params = array_merge($params, $optParams);
|
---|
98 | return $this->call('reveal', [$params], AchievementRevealResponse::class);
|
---|
99 | }
|
---|
100 | /**
|
---|
101 | * Sets the steps for the currently authenticated player towards unlocking an
|
---|
102 | * achievement. If the steps parameter is less than the current number of steps
|
---|
103 | * that the player already gained for the achievement, the achievement is not
|
---|
104 | * modified. (achievements.setStepsAtLeast)
|
---|
105 | *
|
---|
106 | * @param string $achievementId The ID of the achievement used by this method.
|
---|
107 | * @param int $steps Required. The minimum value to set the steps to.
|
---|
108 | * @param array $optParams Optional parameters.
|
---|
109 | * @return AchievementSetStepsAtLeastResponse
|
---|
110 | * @throws \Google\Service\Exception
|
---|
111 | */
|
---|
112 | public function setStepsAtLeast($achievementId, $steps, $optParams = [])
|
---|
113 | {
|
---|
114 | $params = ['achievementId' => $achievementId, 'steps' => $steps];
|
---|
115 | $params = array_merge($params, $optParams);
|
---|
116 | return $this->call('setStepsAtLeast', [$params], AchievementSetStepsAtLeastResponse::class);
|
---|
117 | }
|
---|
118 | /**
|
---|
119 | * Unlocks this achievement for the currently authenticated player.
|
---|
120 | * (achievements.unlock)
|
---|
121 | *
|
---|
122 | * @param string $achievementId The ID of the achievement used by this method.
|
---|
123 | * @param array $optParams Optional parameters.
|
---|
124 | * @return AchievementUnlockResponse
|
---|
125 | * @throws \Google\Service\Exception
|
---|
126 | */
|
---|
127 | public function unlock($achievementId, $optParams = [])
|
---|
128 | {
|
---|
129 | $params = ['achievementId' => $achievementId];
|
---|
130 | $params = array_merge($params, $optParams);
|
---|
131 | return $this->call('unlock', [$params], AchievementUnlockResponse::class);
|
---|
132 | }
|
---|
133 | /**
|
---|
134 | * Updates multiple achievements for the currently authenticated player.
|
---|
135 | * (achievements.updateMultiple)
|
---|
136 | *
|
---|
137 | * @param AchievementUpdateMultipleRequest $postBody
|
---|
138 | * @param array $optParams Optional parameters.
|
---|
139 | * @return AchievementUpdateMultipleResponse
|
---|
140 | * @throws \Google\Service\Exception
|
---|
141 | */
|
---|
142 | public function updateMultiple(AchievementUpdateMultipleRequest $postBody, $optParams = [])
|
---|
143 | {
|
---|
144 | $params = ['postBody' => $postBody];
|
---|
145 | $params = array_merge($params, $optParams);
|
---|
146 | return $this->call('updateMultiple', [$params], AchievementUpdateMultipleResponse::class);
|
---|
147 | }
|
---|
148 | }
|
---|
149 |
|
---|
150 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
151 | class_alias(Achievements::class, 'Google_Service_Games_Resource_Achievements');
|
---|