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