Class SocialLeaderboardService

java.lang.Object
com.bitheads.braincloud.services.SocialLeaderboardService

public class SocialLeaderboardService
extends Object
  • Constructor Details

    • SocialLeaderboardService

      public SocialLeaderboardService​(BrainCloudClient client)
  • Method Details

    • getSocialLeaderboard

      public void getSocialLeaderboard​(String leaderboardId, boolean replaceName, IServerCallback callback)
      Method returns the social leaderboard. A player's social leaderboard is comprised of players who are recognized as being your friend. For now, The getSocialLeaderboard will retrieve all friends from all friend platforms, so - all external friends (Facebook, Steam, PlaystationNetwork) - all internal friends (brainCloud) - plus "self". Leaderboards entries contain the player's score and optionally, some user-defined data associated with the score. The currently logged in player will also be returned in the social leaderboard. Note: If no friends have played the game, the bestScore, createdAt, updatedAt will contain NULL.
      Parameters:
      leaderboardId - The id of the leaderboard to retrieve
      replaceName - If true, the currently logged in player's name will be replaced by the String "You".
      callback - The method to be invoked when the server response is received
    • getSocialLeaderboardByVersion

      public void getSocialLeaderboardByVersion​(String leaderboardId, boolean replaceName, int versionId, IServerCallback callback)
      Method returns the social leaderboard by the. A player's social leaderboard is comprised of players who are recognized as being your friend. The getSocialLeaderboard will retrieve all friends from all friend platforms, so - all external friends (Facebook, Steam, PlaystationNetwork) - all internal friends (brainCloud) - plus "self". Leaderboards entries contain the player's score and optionally, some user-defined data associated with the score. The currently logged in player will also be returned in the social leaderboard. Note: If no friends have played the game, the bestScore, createdAt, updatedAt will contain NULL.
      Parameters:
      leaderboardId - The id of the leaderboard to retrieve
      replaceName - If true, the currently logged in player's name will be replaced by the String "You".
      versionId - the version of the leaderboard
      callback - The method to be invoked when the server response is received
    • getMultiSocialLeaderboard

      public void getMultiSocialLeaderboard​(String[] leaderboardIds, int leaderboardResultCount, boolean replaceName, IServerCallback callback)
      Reads multiple social leaderboards.
      Parameters:
      leaderboardIds - Collection of leaderboard IDs.
      leaderboardResultCount - Maximum count of entries to return for each leaderboard.
      replaceName - If true, the currently logged in player's name will be replaced by the string "You".
      callback - The method to be invoked when the server response is received
    • getGlobalLeaderboardPage

      public void getGlobalLeaderboardPage​(String leaderboardId, SocialLeaderboardService.SortOrder sort, int startIndex, int endIndex, IServerCallback callback)
      Method returns a page of results of the global leaderboard. Leaderboards entries contain the player's score and optionally, some user-defined data associated with the score. Note: If no leaderboard records exist then this method will empty list. Service Name - SocialLeaderboard Service Operation - GetGlobalLeaderboardPage
      Parameters:
      leaderboardId - The id of the leaderboard to retrieve
      sort - Sort order of the returned list.
      startIndex - The index at which to start the page.
      endIndex - The index at which to end the page.
      callback - The method to be invoked when the server response is received
    • getGlobalLeaderboardPageByVersion

      public void getGlobalLeaderboardPageByVersion​(String leaderboardId, SocialLeaderboardService.SortOrder sort, int startIndex, int endIndex, int versionId, IServerCallback callback)
      Method returns a page of results of the global leaderboard. By using a non-current version id, the user can retrieve a historial leaderboard. See GetGlobalLeaderboardVersions method to retrieve the version id. Service Name - SocialLeaderboard Service Operation - GetGlobalLeaderboardPage
      Parameters:
      leaderboardId - The id of the leaderboard to retrieve
      sort - Sort order of the returned list.
      startIndex - The index at which to start the page.
      endIndex - The index at which to end the page.
      versionId - The historical version to retrieve
      callback - The method to be invoked when the server response is received
    • getGlobalLeaderboardView

      public void getGlobalLeaderboardView​(String leaderboardId, SocialLeaderboardService.SortOrder sort, int beforeCount, int afterCount, IServerCallback callback)
      Method returns a page of results of the global leaderboard. Leaderboards entries contain the player's score and optionally, some user-defined data associated with the score. Note: If no leaderboard records exist then this method will empty list. Service Name - SocialLeaderboard Service Operation - GetGlobalLeaderboardPage
      Parameters:
      leaderboardId - The id of the leaderboard to retrieve
      sort - Sort order of the returned list.
      beforeCount - The count of number of players before the current player to include.
      afterCount - The count of number of players after the current player to include.
      callback - The method to be invoked when the server response is received
    • getGlobalLeaderboardViewByVersion

      public void getGlobalLeaderboardViewByVersion​(String leaderboardId, SocialLeaderboardService.SortOrder sort, int beforeCount, int afterCount, int versionId, IServerCallback callback)
      Method returns a page of results of the global leaderboard. By using a non-current version id, the user can retrieve a historial leaderboard. See GetGlobalLeaderboardVersions method to retrieve the version id. Service Name - SocialLeaderboard Service Operation - GetGlobalLeaderboardPage
      Parameters:
      leaderboardId - The id of the leaderboard to retrieve
      sort - Sort order of the returned list.
      beforeCount - The count of number of players before the current player to include.
      afterCount - The count of number of players after the current player to include.
      versionId - The historical version id
      callback - The method to be invoked when the server response is received See GetGlobalLeaderboardView documentation. Note that historial leaderboards do not include the 'timeBeforeReset' parameter.
    • getGlobalLeaderboardVersions

      public void getGlobalLeaderboardVersions​(String leaderboardId, IServerCallback callback)
      Gets the global leaderboard versions. Service Name - SocialLeaderboard Service Operation - GetGlobalLeaderboardVersions
      Parameters:
      leaderboardId - The leaderboard
      callback - The method to be invoked when the server response is received
    • getGlobalLeaderboardEntryCount

      public void getGlobalLeaderboardEntryCount​(String leaderboardId, IServerCallback callback)
      Gets the number of entries in a global leaderboard Service Name - leaderboard Service Operation - GET_GLOBAL_LEADERBOARD_ENTRY_COUNT
      Parameters:
      leaderboardId - The leaderboard ID
      callback - The method to be invoked when the server response is received
    • getGlobalLeaderboardEntryCountByVersion

      public void getGlobalLeaderboardEntryCountByVersion​(String leaderboardId, int versionId, IServerCallback callback)
      Gets the number of entries in a global leaderboard Service Name - leaderboard Service Operation - GET_GLOBAL_LEADERBOARD_ENTRY_COUNT
      Parameters:
      leaderboardId - The leaderboard ID
      versionId - The version of the leaderboard
      callback - The method to be invoked when the server response is received
    • postScoreToLeaderboard

      public void postScoreToLeaderboard​(String leaderboardId, long score, String jsonData, IServerCallback callback)
      Post the players score to the given social leaderboard. You can optionally send a user-defined json String of data with the posted score. This String could include information relevant to the posted score. Note that the behaviour of posting a score can be modified in the brainCloud portal. By default, the server will only keep the player's best score.
      Parameters:
      leaderboardId - The leaderboard to post to
      score - The score to post
      jsonData - Optional user-defined data to post with the score
      callback - The callback.
    • postScoreToDynamicLeaderboard

      public void postScoreToDynamicLeaderboard​(String leaderboardId, long score, String jsonData, String leaderboardType, String rotationType, Date rotationReset, int retainedCount, IServerCallback callback)
      Deprecated.
      Use postScoreToDynamicLeaderboardUTC instead - Removal September 1, 2021
      Post the players score to the given social leaderboard. You can optionally send a user-defined json string of data with the posted score. This string could include information relevant to the posted score.
      Parameters:
      leaderboardId - The leaderboard to post to
      score - The score to post
      jsonData - Optional user-defined data to post with the score
      leaderboardType - Leaderboard type
      rotationType - Type of rotation
      rotationReset - Date to next rotate rotation (date in millis UTC)
      retainedCount - How many previous rotations to keep
      callback - The callback handler
    • postScoreToDynamicLeaderboardUTC

      public void postScoreToDynamicLeaderboardUTC​(String leaderboardId, long score, String jsonData, String leaderboardType, String rotationType, long rotationResetUTC, int retainedCount, IServerCallback callback)
      Post the players score to the given social leaderboard. Pass leaderboard config data to dynamically create if necessary. You can optionally send a user-defined json String of data with the posted score. This String could include information relevant to the posted score.
      Parameters:
      leaderboardId - The leaderboard to post to
      score - The score to post
      jsonData - Optional user-defined data to post with the score
      leaderboardType - leaderboard type
      rotationType - Type of rotation
      rotationResetUTC - Date to reset the leaderboard - in UTC milliseconds since epoch
      retainedCount - How many rotations to keep
      callback - The callback.
    • postScoreToDynamicGroupLeaderboardDaysUTC

      public void postScoreToDynamicGroupLeaderboardDaysUTC​(String leaderboardId, String groupId, long score, String jsonData, String leaderboardType, long rotationResetUTC, int retainedCount, int numDaysToRotate, IServerCallback callback)
      Posts score to group leaderbopard and dynamically creates if necessary. leaderboardType, rotationReset, retainedCount and rotationType are required. uses UTC time in milliseconds since epoch
      Parameters:
      leaderboardId - The leaderboard to post to
      groupId - the group's id
      score - The score to post
      jsonData - Optional user-defined data to post with the score
      leaderboardType - leaderboard type
      rotationResetUTC - Date to reset the leaderboard - in UTC milliseconds since epoch
      retainedCount - How many rotations to keep
      numDaysToRotate - How many days between each rotation
      callback - The callback.
    • postScoreToDynamicLeaderboardDays

      public void postScoreToDynamicLeaderboardDays​(String leaderboardId, long score, String jsonData, String leaderboardType, Date rotationReset, int retainedCount, int numDaysToRotate, IServerCallback callback)
      Deprecated.
      Use postScoreToDynamicLeaderboardDaysUTC instead - Removal September 1, 2021
      Post the players score to the given social leaderboard. Pass leaderboard config data to dynamically create if necessary. You can optionally send a user-defined json String of data with the posted score. This String could include information relevant to the posted score.
      Parameters:
      leaderboardId - The leaderboard to post to
      score - The score to post
      jsonData - Optional user-defined data to post with the score
      leaderboardType - leaderboard type
      rotationReset - Date to reset the leaderboard
      retainedCount - How many rotations to keep
      numDaysToRotate - How many days between each rotation
      callback - The callback.
    • postScoreToDynamicLeaderboardDaysUTC

      public void postScoreToDynamicLeaderboardDaysUTC​(String leaderboardId, long score, String jsonData, String leaderboardType, long rotationResetUTC, int retainedCount, int numDaysToRotate, IServerCallback callback)
      Post the players score to the given social leaderboard. Pass leaderboard config data to dynamically create if necessary. You can optionally send a user-defined json String of data with the posted score. This String could include information relevant to the posted score.
      Parameters:
      leaderboardId - The leaderboard to post to
      score - The score to post
      jsonData - Optional user-defined data to post with the score
      leaderboardType - leaderboard type
      rotationResetUTC - Date to reset the leaderboard
      retainedCount - How many rotations to keep
      numDaysToRotate - How many days between each rotation
      callback - The callback.
    • removePlayerScore

      public void removePlayerScore​(String leaderboardId, int versionId, IServerCallback callback)
      Removes a player's score from the leaderboard Service Name - leaderboard Service Operation - REMOVE_PLAYER_SCORE
      Parameters:
      leaderboardId - The leaderboard ID
      versionId - The version of the leaderboard. Use -1 to specifiy the currently active leaderboard version
      callback - The method to be invoked when the server response is received
    • getGroupSocialLeaderboard

      public void getGroupSocialLeaderboard​(String leaderboardId, String groupId, IServerCallback callback)
      Retrieve the social leaderboard for a group. Service Name - leaderboard Service Operation - GET_GROUP_SOCIAL_LEADERBOARD
      Parameters:
      leaderboardId - The leaderboard to retrieve
      groupId - The ID of the group
      callback - The method to be invoked when the server response is received
    • getGroupSocialLeaderboardByVersion

      public void getGroupSocialLeaderboardByVersion​(String leaderboardId, String groupId, int versionId, IServerCallback callback)
      Retrieve the social leaderboard for a group by version. Service Name - leaderboard Service Operation - GET_GROUP_SOCIAL_LEADERBOARD_BY_VERSION
      Parameters:
      leaderboardId - The leaderboard to retrieve
      groupId - The ID of the group
      versionId - The ID of the group
      callback - The method to be invoked when the server response is received
    • getPlayersSocialLeaderboard

      public void getPlayersSocialLeaderboard​(String leaderboardId, String[] profileIds, IServerCallback callback)
      Retrieve the social leaderboard for a list of players. Service Name - leaderboard Service Operation - GET_PLAYERS_SOCIAL_LEADERBOARD
      Parameters:
      leaderboardId - The leaderboard to retrieve
      profileIds - The IDs of the players
      callback - The method to be invoked when the server response is received
    • getPlayersSocialLeaderboardByVersion

      public void getPlayersSocialLeaderboardByVersion​(String leaderboardId, String[] profileIds, int versionId, IServerCallback callback)
      Retrieve the social leaderboard for a list of players by version. Service Name - leaderboard Service Operation - GET_PLAYERS_SOCIAL_LEADERBOARD_BY_VERSION
      Parameters:
      leaderboardId - The leaderboard to retrieve
      profileIds - The IDs of the players
      versionId - The IDs of the players
      callback - The method to be invoked when the server response is received
    • listAllLeaderboards

      public void listAllLeaderboards​(IServerCallback callback)
      Retrieve a list of all leaderboards Service Name - leaderboard Service Operation - LIST_ALL_LEADERBOARDS
      Parameters:
      callback - The method to be invoked when the server response is received
    • getPlayerScore

      public void getPlayerScore​(String leaderboardId, int versionId, IServerCallback callback)
      Gets a player's score from a leaderboard Service Name - leaderboard Service Operation - GET_PLAYER_SCORE
      Parameters:
      leaderboardId - The leaderboard ID
      versionId - The version of the leaderboard. Use -1 for current.
      callback - The method to be invoked when the server response is received
    • getPlayerScores

      public void getPlayerScores​(String leaderboardId, int versionId, int maxResults, IServerCallback callback)
      Gets a player's highest scores from a leaderboard Service Name - leaderboard Service Operation - GET_PLAYER_SCORES
      Parameters:
      leaderboardId - The leaderboard ID
      versionId - The version of the leaderboard. Use -1 for current.
      maxResults - The maximum number of returned results
      callback - The method to be invoked when the server response is received
    • getPlayerScoresFromLeaderboards

      public void getPlayerScoresFromLeaderboards​(String[] leaderboardIds, IServerCallback callback)
      Gets a player's score from multiple leaderboards Service Name - leaderboard Service Operation - GET_PLAYER_SCORES_FROM_LEADERBOARDS
      Parameters:
      leaderboardIds - A collection of leaderboardIds to retrieve scores from
      callback - The method to be invoked when the server response is received
    • postScoreToGroupLeaderboard

      public void postScoreToGroupLeaderboard​(String leaderboardId, String groupId, int score, String jsonData, IServerCallback callback)
      Posts score to Group's leaderboard - Note the user must be a member of the group Service Name - leaderboard Service Operation - POST_GROUP_SCORE
      Parameters:
      leaderboardId - the leaderboard
      groupId - the groups id
      score - the score you want to post
      jsonData - extra json data
      callback - The method to be invoked when the server response is received
    • postScoreToDynamicGroupLeaderboard

      public void postScoreToDynamicGroupLeaderboard​(String leaderboardId, String groupId, long score, String data, String leaderboardType, String rotationType, Date rotationReset, int retainedCount, IServerCallback callback)
      Deprecated.
      Use postScoreToDynamicGroupLeaderboardUTC instead - Removal September 1, 2021
      Post the group score to the given group leaderboard and dynamically create if necessary. LeaderboardType, rotationType, rotationReset, and retainedCount are required. Service Name - leaderboard Service Operation - POST_GROUP_SCORE_DYNAMIC
      Parameters:
      leaderboardId - the leaderboard
      groupId - the groups id
      score - the score you want to post
      data - Optional user-defined data to post with the score.
      leaderboardType - the type of leaderboard
      rotationType - daily, weekly, monthly
      rotationReset - time that rotation resets
      retainedCount - times to retain the leaderboard
      callback - The method to be invoked when the server response is received
    • postScoreToDynamicGroupLeaderboardUTC

      public void postScoreToDynamicGroupLeaderboardUTC​(String leaderboardId, String groupId, long score, String data, String leaderboardType, String rotationType, long rotationResetUTC, int retainedCount, IServerCallback callback)
      Post the group score to the given group leaderboard and dynamically create if necessary. LeaderboardType, rotationType, rotationReset, and retainedCount are required. * Service Name - leaderboard Service Operation - POST_GROUP_SCORE_DYNAMIC
      Parameters:
      leaderboardId - the leaderboard
      groupId - the groups id
      score - the score you want to post
      data - Optional user-defined data to post with the score.
      leaderboardType - the type of leaderboard
      rotationType - daily, weekly, monthly
      rotationResetUTC - time that rotation resets in UTC mmilliseconds time
      retainedCount - times to retain the leaderboard
      callback - The method to be invoked when the server response is received
    • removeGroupScore

      public void removeGroupScore​(String leaderboardId, String groupId, int versionId, IServerCallback callback)
      Removes score from group leaderboard Service Name - leaderboard Service Operation - REMOVE_GROUP_SCORE
      Parameters:
      leaderboardId - the leaderboard
      groupId - the groups id
      versionId - the version
      callback - The method to be invoked when the server response is received
    • getGroupLeaderboardView

      public void getGroupLeaderboardView​(String leaderboardId, String groupId, SocialLeaderboardService.SortOrder sort, int beforeCount, int afterCount, IServerCallback callback)
      Retrieve a view of the group leaderbaord surrounding the current group Service Name - leaderboard Service Operation - GET_GROUP_LEADERBOARD_VIEW
      Parameters:
      leaderboardId - the leaderboard
      groupId - the groups id
      sort - the sort order
      beforeCount - count of players before current player to include
      afterCount - count of the players after current player to include
      callback - The method to be invoked when the server response is received
    • getGroupLeaderboardViewByVersion

      public void getGroupLeaderboardViewByVersion​(String leaderboardId, String groupId, int versionId, SocialLeaderboardService.SortOrder sort, int beforeCount, int afterCount, IServerCallback callback)
      Retrieve a view of the group leaderbaord surrounding the current group by version Service Name - leaderboard Service Operation - GET_GROUP_LEADERBOARD_VIEW
      Parameters:
      leaderboardId - the leaderboard
      groupId - the groups id
      versionId - The historical version to retrieve.
      sort - the sort order
      beforeCount - count of players before current player to include
      afterCount - count of the players after current player to include
      callback - The method to be invoked when the server response is received