Google_ScoresServiceResource

The "scores" collection of methods.

Defined (1)

The class is defined in the following location(s).

/google-api/src/contrib/Google_GamesService.php  
  1. class Google_ScoresServiceResource extends Google_ServiceResource { 
  2.  
  3.  
  4. /** 
  5. * Get high scores and optionally, ranks in leaderboards for the currently authenticated player. For 
  6. * a specific time span, leaderboardId can be set to ALL to retrieve data for all leaderboards in a 
  7. * given time span. (scores.get) 
  8. * @param string $playerId A player ID. A value of me may be used in place of the authenticated player's ID. 
  9. * @param string $leaderboardId The ID of the leaderboard. 
  10. * @param string $timeSpan The time span for the scores and ranks you're requesting. 
  11. * @param array $optParams Optional parameters. 
  12. * @opt_param string includeRankType The types of ranks to return. If the parameter is omitted, no ranks will be returned. 
  13. * @opt_param string language The preferred language to use for strings returned by this method. 
  14. * @opt_param int maxResults The maximum number of leaderboard scores to return in the response. For any response, the actual number of leaderboard scores returned may be less than the specified maxResults. 
  15. * @opt_param string pageToken The token returned by the previous request. 
  16. * @return Google_PlayerLeaderboardScoreListResponse 
  17. */ 
  18. public function get($playerId, $leaderboardId, $timeSpan, $optParams = array()) { 
  19. $params = array('playerId' => $playerId, 'leaderboardId' => $leaderboardId, 'timeSpan' => $timeSpan); 
  20. $params = array_merge($params, $optParams); 
  21. $data = $this->__call('get', array($params)); 
  22. if ($this->useObjects()) { 
  23. return new Google_PlayerLeaderboardScoreListResponse($data); 
  24. } else { 
  25. return $data; 
  26. /** 
  27. * Lists the scores in a leaderboard, starting from the top. (scores.list) 
  28. * @param string $leaderboardId The ID of the leaderboard. 
  29. * @param string $collection The collection of scores you're requesting. 
  30. * @param string $timeSpan The time span for the scores and ranks you're requesting. 
  31. * @param array $optParams Optional parameters. 
  32. * @opt_param string language The preferred language to use for strings returned by this method. 
  33. * @opt_param int maxResults The maximum number of leaderboard scores to return in the response. For any response, the actual number of leaderboard scores returned may be less than the specified maxResults. 
  34. * @opt_param string pageToken The token returned by the previous request. 
  35. * @return Google_LeaderboardScores 
  36. */ 
  37. public function listScores($leaderboardId, $collection, $timeSpan, $optParams = array()) { 
  38. $params = array('leaderboardId' => $leaderboardId, 'collection' => $collection, 'timeSpan' => $timeSpan); 
  39. $params = array_merge($params, $optParams); 
  40. $data = $this->__call('list', array($params)); 
  41. if ($this->useObjects()) { 
  42. return new Google_LeaderboardScores($data); 
  43. } else { 
  44. return $data; 
  45. /** 
  46. * Lists the scores in a leaderboard around (and including) a player's score. (scores.listWindow) 
  47. * @param string $leaderboardId The ID of the leaderboard. 
  48. * @param string $collection The collection of scores you're requesting. 
  49. * @param string $timeSpan The time span for the scores and ranks you're requesting. 
  50. * @param array $optParams Optional parameters. 
  51. * @opt_param string language The preferred language to use for strings returned by this method. 
  52. * @opt_param int maxResults The maximum number of leaderboard scores to return in the response. For any response, the actual number of leaderboard scores returned may be less than the specified maxResults. 
  53. * @opt_param string pageToken The token returned by the previous request. 
  54. * @opt_param int resultsAbove The preferred number of scores to return above the player's score. More scores may be returned if the player is at the bottom of the leaderboard; fewer may be returned if the player is at the top. Must be less than or equal to maxResults. 
  55. * @opt_param bool returnTopIfAbsent True if the top scores should be returned when the player is not in the leaderboard. Defaults to true. 
  56. * @return Google_LeaderboardScores 
  57. */ 
  58. public function listWindow($leaderboardId, $collection, $timeSpan, $optParams = array()) { 
  59. $params = array('leaderboardId' => $leaderboardId, 'collection' => $collection, 'timeSpan' => $timeSpan); 
  60. $params = array_merge($params, $optParams); 
  61. $data = $this->__call('listWindow', array($params)); 
  62. if ($this->useObjects()) { 
  63. return new Google_LeaderboardScores($data); 
  64. } else { 
  65. return $data; 
  66. /** 
  67. * Submits a score to the specified leaderboard. (scores.submit) 
  68. * @param string $leaderboardId The ID of the leaderboard. 
  69. * @param string $score The score you're submitting. The submitted score is ignored if it is worse than a previously submitted score, where worse depends on the leaderboard sort order. The meaning of the score value depends on the leaderboard format type. For fixed-point, the score represents the raw value. For time, the score represents elapsed time in milliseconds. For currency, the score represents a value in micro units. 
  70. * @param array $optParams Optional parameters. 
  71. * @opt_param string language The preferred language to use for strings returned by this method. 
  72. * @return Google_PlayerScoreResponse 
  73. */ 
  74. public function submit($leaderboardId, $score, $optParams = array()) { 
  75. $params = array('leaderboardId' => $leaderboardId, 'score' => $score); 
  76. $params = array_merge($params, $optParams); 
  77. $data = $this->__call('submit', array($params)); 
  78. if ($this->useObjects()) { 
  79. return new Google_PlayerScoreResponse($data); 
  80. } else { 
  81. return $data; 
  82. /** 
  83. * Submits multiple scores to leaderboards. (scores.submitMultiple) 
  84. * @param Google_PlayerScoreSubmissionList $postBody 
  85. * @param array $optParams Optional parameters. 
  86. * @opt_param string language The preferred language to use for strings returned by this method. 
  87. * @return Google_PlayerScoreListResponse 
  88. */ 
  89. public function submitMultiple(Google_PlayerScoreSubmissionList $postBody, $optParams = array()) { 
  90. $params = array('postBody' => $postBody); 
  91. $params = array_merge($params, $optParams); 
  92. $data = $this->__call('submitMultiple', array($params)); 
  93. if ($this->useObjects()) { 
  94. return new Google_PlayerScoreListResponse($data); 
  95. } else { 
  96. return $data;