Package com.bitheads.braincloud.services
Class SocialLeaderboardService
java.lang.Object
com.bitheads.braincloud.services.SocialLeaderboardService
public class SocialLeaderboardService extends Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSocialLeaderboardService.RotationTypestatic classSocialLeaderboardService.SocialLeaderboardTypestatic classSocialLeaderboardService.SortOrder -
Constructor Summary
Constructors Constructor Description SocialLeaderboardService(BrainCloudClient client) -
Method Summary
Modifier and Type Method Description voidgetGlobalLeaderboardEntryCount(String leaderboardId, IServerCallback callback)Gets the number of entries in a global leaderboard Service Name - leaderboard Service Operation - GET_GLOBAL_LEADERBOARD_ENTRY_COUNTvoidgetGlobalLeaderboardEntryCountByVersion(String leaderboardId, int versionId, IServerCallback callback)Gets the number of entries in a global leaderboard Service Name - leaderboard Service Operation - GET_GLOBAL_LEADERBOARD_ENTRY_COUNTvoidgetGlobalLeaderboardPage(String leaderboardId, SocialLeaderboardService.SortOrder sort, int startIndex, int endIndex, IServerCallback callback)Method returns a page of results of the global leaderboard.voidgetGlobalLeaderboardPageByVersion(String leaderboardId, SocialLeaderboardService.SortOrder sort, int startIndex, int endIndex, int versionId, IServerCallback callback)Method returns a page of results of the global leaderboard.voidgetGlobalLeaderboardVersions(String leaderboardId, IServerCallback callback)Gets the global leaderboard versions.voidgetGlobalLeaderboardView(String leaderboardId, SocialLeaderboardService.SortOrder sort, int beforeCount, int afterCount, IServerCallback callback)Method returns a page of results of the global leaderboard.voidgetGlobalLeaderboardViewByVersion(String leaderboardId, SocialLeaderboardService.SortOrder sort, int beforeCount, int afterCount, int versionId, IServerCallback callback)Method returns a page of results of the global leaderboard.voidgetGroupLeaderboardView(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_VIEWvoidgetGroupLeaderboardViewByVersion(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_VIEWvoidgetGroupSocialLeaderboard(String leaderboardId, String groupId, IServerCallback callback)Retrieve the social leaderboard for a group.voidgetGroupSocialLeaderboardByVersion(String leaderboardId, String groupId, int versionId, IServerCallback callback)Retrieve the social leaderboard for a group by version.voidgetMultiSocialLeaderboard(String[] leaderboardIds, int leaderboardResultCount, boolean replaceName, IServerCallback callback)Reads multiple social leaderboards.voidgetPlayerScore(String leaderboardId, int versionId, IServerCallback callback)Gets a player's score from a leaderboard Service Name - leaderboard Service Operation - GET_PLAYER_SCOREvoidgetPlayerScores(String leaderboardId, int versionId, int maxResults, IServerCallback callback)Gets a player's highest scores from a leaderboard Service Name - leaderboard Service Operation - GET_PLAYER_SCORESvoidgetPlayerScoresFromLeaderboards(String[] leaderboardIds, IServerCallback callback)Gets a player's score from multiple leaderboards Service Name - leaderboard Service Operation - GET_PLAYER_SCORES_FROM_LEADERBOARDSvoidgetPlayersSocialLeaderboard(String leaderboardId, String[] profileIds, IServerCallback callback)Retrieve the social leaderboard for a list of players.voidgetPlayersSocialLeaderboardByVersion(String leaderboardId, String[] profileIds, int versionId, IServerCallback callback)Retrieve the social leaderboard for a list of players by version.voidgetSocialLeaderboard(String leaderboardId, boolean replaceName, IServerCallback callback)Method returns the social leaderboard.voidgetSocialLeaderboardByVersion(String leaderboardId, boolean replaceName, int versionId, IServerCallback callback)Method returns the social leaderboard by the.voidlistAllLeaderboards(IServerCallback callback)Retrieve a list of all leaderboards Service Name - leaderboard Service Operation - LIST_ALL_LEADERBOARDSvoidpostScoreToDynamicGroupLeaderboard(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, 2021voidpostScoreToDynamicGroupLeaderboardDaysUTC(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.voidpostScoreToDynamicGroupLeaderboardUTC(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.voidpostScoreToDynamicLeaderboard(String leaderboardId, long score, String jsonData, String leaderboardType, String rotationType, Date rotationReset, int retainedCount, IServerCallback callback)Deprecated.Use postScoreToDynamicLeaderboardUTC instead - Removal September 1, 2021voidpostScoreToDynamicLeaderboardDays(String leaderboardId, long score, String jsonData, String leaderboardType, Date rotationReset, int retainedCount, int numDaysToRotate, IServerCallback callback)Deprecated.Use postScoreToDynamicLeaderboardDaysUTC instead - Removal September 1, 2021voidpostScoreToDynamicLeaderboardDaysUTC(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.voidpostScoreToDynamicLeaderboardUTC(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.voidpostScoreToGroupLeaderboard(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_SCOREvoidpostScoreToLeaderboard(String leaderboardId, long score, String jsonData, IServerCallback callback)Post the players score to the given social leaderboard.voidremoveGroupScore(String leaderboardId, String groupId, int versionId, IServerCallback callback)Removes score from group leaderboard Service Name - leaderboard Service Operation - REMOVE_GROUP_SCOREvoidremovePlayerScore(String leaderboardId, int versionId, IServerCallback callback)Removes a player's score from the leaderboard Service Name - leaderboard Service Operation - REMOVE_PLAYER_SCORE
-
Constructor Details
-
SocialLeaderboardService
-
-
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 retrievereplaceName- 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 retrievereplaceName- If true, the currently logged in player's name will be replaced by the String "You".versionId- the version of the leaderboardcallback- 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 retrievesort- 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 retrievesort- 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 retrievecallback- 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 retrievesort- 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 retrievesort- 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 idcallback- 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
Gets the global leaderboard versions. Service Name - SocialLeaderboard Service Operation - GetGlobalLeaderboardVersions- Parameters:
leaderboardId- The leaderboardcallback- The method to be invoked when the server response is received
-
getGlobalLeaderboardEntryCount
Gets the number of entries in a global leaderboard Service Name - leaderboard Service Operation - GET_GLOBAL_LEADERBOARD_ENTRY_COUNT- Parameters:
leaderboardId- The leaderboard IDcallback- 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 IDversionId- The version of the leaderboardcallback- 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 toscore- The score to postjsonData- Optional user-defined data to post with the scorecallback- 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, 2021Post 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 toscore- The score to postjsonData- Optional user-defined data to post with the scoreleaderboardType- Leaderboard typerotationType- Type of rotationrotationReset- Date to next rotate rotation (date in millis UTC)retainedCount- How many previous rotations to keepcallback- 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 toscore- The score to postjsonData- Optional user-defined data to post with the scoreleaderboardType- leaderboard typerotationType- Type of rotationrotationResetUTC- Date to reset the leaderboard - in UTC milliseconds since epochretainedCount- How many rotations to keepcallback- 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 togroupId- the group's idscore- The score to postjsonData- Optional user-defined data to post with the scoreleaderboardType- leaderboard typerotationResetUTC- Date to reset the leaderboard - in UTC milliseconds since epochretainedCount- How many rotations to keepnumDaysToRotate- How many days between each rotationcallback- 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, 2021Post 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 toscore- The score to postjsonData- Optional user-defined data to post with the scoreleaderboardType- leaderboard typerotationReset- Date to reset the leaderboardretainedCount- How many rotations to keepnumDaysToRotate- How many days between each rotationcallback- 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 toscore- The score to postjsonData- Optional user-defined data to post with the scoreleaderboardType- leaderboard typerotationResetUTC- Date to reset the leaderboardretainedCount- How many rotations to keepnumDaysToRotate- How many days between each rotationcallback- The callback.
-
removePlayerScore
Removes a player's score from the leaderboard Service Name - leaderboard Service Operation - REMOVE_PLAYER_SCORE- Parameters:
leaderboardId- The leaderboard IDversionId- The version of the leaderboard. Use -1 to specifiy the currently active leaderboard versioncallback- 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 retrievegroupId- The ID of the groupcallback- 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 retrievegroupId- The ID of the groupversionId- The ID of the groupcallback- 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 retrieveprofileIds- The IDs of the playerscallback- 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 retrieveprofileIds- The IDs of the playersversionId- The IDs of the playerscallback- The method to be invoked when the server response is received
-
listAllLeaderboards
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
Gets a player's score from a leaderboard Service Name - leaderboard Service Operation - GET_PLAYER_SCORE- Parameters:
leaderboardId- The leaderboard IDversionId- 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 IDversionId- The version of the leaderboard. Use -1 for current.maxResults- The maximum number of returned resultscallback- The method to be invoked when the server response is received
-
getPlayerScoresFromLeaderboards
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 fromcallback- 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 leaderboardgroupId- the groups idscore- the score you want to postjsonData- extra json datacallback- 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, 2021Post 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 leaderboardgroupId- the groups idscore- the score you want to postdata- Optional user-defined data to post with the score.leaderboardType- the type of leaderboardrotationType- daily, weekly, monthlyrotationReset- time that rotation resetsretainedCount- times to retain the leaderboardcallback- 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 leaderboardgroupId- the groups idscore- the score you want to postdata- Optional user-defined data to post with the score.leaderboardType- the type of leaderboardrotationType- daily, weekly, monthlyrotationResetUTC- time that rotation resets in UTC mmilliseconds timeretainedCount- times to retain the leaderboardcallback- 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 leaderboardgroupId- the groups idversionId- the versioncallback- 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 leaderboardgroupId- the groups idsort- the sort orderbeforeCount- count of players before current player to includeafterCount- count of the players after current player to includecallback- 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 leaderboardgroupId- the groups idversionId- The historical version to retrieve.sort- the sort orderbeforeCount- count of players before current player to includeafterCount- count of the players after current player to includecallback- The method to be invoked when the server response is received
-