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/** 19 * The "scores" collection of methods. 20 * Typical usage is: 21 * <code> 22 * $gamesService = new Google_Service_Games(...); 23 * $scores = $gamesService->scores; 24 * </code> 25 */ 26class Google_Service_Games_Resource_Scores extends Google_Service_Resource 27{ 28 /** 29 * Get high scores, and optionally ranks, in leaderboards for the currently 30 * authenticated player. For a specific time span, leaderboardId can be set to 31 * ALL to retrieve data for all leaderboards in a given time span. NOTE: You 32 * cannot ask for 'ALL' leaderboards and 'ALL' timeSpans in the same request; 33 * only one parameter may be set to 'ALL'. (scores.get) 34 * 35 * @param string $playerId A player ID. A value of me may be used in place of 36 * the authenticated player's ID. 37 * @param string $leaderboardId The ID of the leaderboard. Can be set to 'ALL' 38 * to retrieve data for all leaderboards for this application. 39 * @param string $timeSpan The time span for the scores and ranks you're 40 * requesting. 41 * @param array $optParams Optional parameters. 42 * 43 * @opt_param string includeRankType The types of ranks to return. If the 44 * parameter is omitted, no ranks will be returned. 45 * @opt_param string language The preferred language to use for strings returned 46 * by this method. 47 * @opt_param int maxResults The maximum number of leaderboard scores to return 48 * in the response. For any response, the actual number of leaderboard scores 49 * returned may be less than the specified maxResults. 50 * @opt_param string pageToken The token returned by the previous request. 51 * @return Google_Service_Games_PlayerLeaderboardScoreListResponse 52 */ 53 public function get($playerId, $leaderboardId, $timeSpan, $optParams = array()) 54 { 55 $params = array('playerId' => $playerId, 'leaderboardId' => $leaderboardId, 'timeSpan' => $timeSpan); 56 $params = array_merge($params, $optParams); 57 return $this->call('get', array($params), "Google_Service_Games_PlayerLeaderboardScoreListResponse"); 58 } 59 /** 60 * Lists the scores in a leaderboard, starting from the top. (scores.listScores) 61 * 62 * @param string $leaderboardId The ID of the leaderboard. 63 * @param string $collection The collection of scores you're requesting. 64 * @param string $timeSpan The time span for the scores and ranks you're 65 * requesting. 66 * @param array $optParams Optional parameters. 67 * 68 * @opt_param string language The preferred language to use for strings returned 69 * by this method. 70 * @opt_param int maxResults The maximum number of leaderboard scores to return 71 * in the response. For any response, the actual number of leaderboard scores 72 * returned may be less than the specified maxResults. 73 * @opt_param string pageToken The token returned by the previous request. 74 * @return Google_Service_Games_LeaderboardScores 75 */ 76 public function listScores($leaderboardId, $collection, $timeSpan, $optParams = array()) 77 { 78 $params = array('leaderboardId' => $leaderboardId, 'collection' => $collection, 'timeSpan' => $timeSpan); 79 $params = array_merge($params, $optParams); 80 return $this->call('list', array($params), "Google_Service_Games_LeaderboardScores"); 81 } 82 /** 83 * Lists the scores in a leaderboard around (and including) a player's score. 84 * (scores.listWindow) 85 * 86 * @param string $leaderboardId The ID of the leaderboard. 87 * @param string $collection The collection of scores you're requesting. 88 * @param string $timeSpan The time span for the scores and ranks you're 89 * requesting. 90 * @param array $optParams Optional parameters. 91 * 92 * @opt_param string language The preferred language to use for strings returned 93 * by this method. 94 * @opt_param int maxResults The maximum number of leaderboard scores to return 95 * in the response. For any response, the actual number of leaderboard scores 96 * returned may be less than the specified maxResults. 97 * @opt_param string pageToken The token returned by the previous request. 98 * @opt_param int resultsAbove The preferred number of scores to return above 99 * the player's score. More scores may be returned if the player is at the 100 * bottom of the leaderboard; fewer may be returned if the player is at the top. 101 * Must be less than or equal to maxResults. 102 * @opt_param bool returnTopIfAbsent True if the top scores should be returned 103 * when the player is not in the leaderboard. Defaults to true. 104 * @return Google_Service_Games_LeaderboardScores 105 */ 106 public function listWindow($leaderboardId, $collection, $timeSpan, $optParams = array()) 107 { 108 $params = array('leaderboardId' => $leaderboardId, 'collection' => $collection, 'timeSpan' => $timeSpan); 109 $params = array_merge($params, $optParams); 110 return $this->call('listWindow', array($params), "Google_Service_Games_LeaderboardScores"); 111 } 112 /** 113 * Submits a score to the specified leaderboard. (scores.submit) 114 * 115 * @param string $leaderboardId The ID of the leaderboard. 116 * @param string $score The score you're submitting. The submitted score is 117 * ignored if it is worse than a previously submitted score, where worse depends 118 * on the leaderboard sort order. The meaning of the score value depends on the 119 * leaderboard format type. For fixed-point, the score represents the raw value. 120 * For time, the score represents elapsed time in milliseconds. For currency, 121 * the score represents a value in micro units. 122 * @param array $optParams Optional parameters. 123 * 124 * @opt_param string language The preferred language to use for strings returned 125 * by this method. 126 * @opt_param string scoreTag Additional information about the score you're 127 * submitting. Values must contain no more than 64 URI-safe characters as 128 * defined by section 2.3 of RFC 3986. 129 * @return Google_Service_Games_PlayerScoreResponse 130 */ 131 public function submit($leaderboardId, $score, $optParams = array()) 132 { 133 $params = array('leaderboardId' => $leaderboardId, 'score' => $score); 134 $params = array_merge($params, $optParams); 135 return $this->call('submit', array($params), "Google_Service_Games_PlayerScoreResponse"); 136 } 137 /** 138 * Submits multiple scores to leaderboards. (scores.submitMultiple) 139 * 140 * @param Google_Service_Games_PlayerScoreSubmissionList $postBody 141 * @param array $optParams Optional parameters. 142 * 143 * @opt_param string language The preferred language to use for strings returned 144 * by this method. 145 * @return Google_Service_Games_PlayerScoreListResponse 146 */ 147 public function submitMultiple(Google_Service_Games_PlayerScoreSubmissionList $postBody, $optParams = array()) 148 { 149 $params = array('postBody' => $postBody); 150 $params = array_merge($params, $optParams); 151 return $this->call('submitMultiple', array($params), "Google_Service_Games_PlayerScoreListResponse"); 152 } 153} 154