diff --git a/src/brainCloudClient-social-leaderboards.js b/src/brainCloudClient-social-leaderboards.js index 3a40739..3fdf4a0 100644 --- a/src/brainCloudClient-social-leaderboards.js +++ b/src/brainCloudClient-social-leaderboards.js @@ -14,15 +14,21 @@ function BCSocialLeaderboard() { bc.socialLeaderboard.OPERATION_POST_SCORE_DYNAMIC_USING_CONFIG = "POST_SCORE_DYNAMIC_USING_CONFIG"; bc.socialLeaderboard.OPERATION_RESET = "RESET"; bc.socialLeaderboard.OPERATION_GET_SOCIAL_LEADERBOARD = "GET_SOCIAL_LEADERBOARD"; + bc.socialLeaderboard.OPERATION_GET_SOCIAL_LEADERBOARD_IF_EXISTS = "GET_SOCIAL_LEADERBOARD_IF_EXISTS"; bc.socialLeaderboard.OPERATION_GET_SOCIAL_LEADERBOARD_BY_VERSION = "GET_SOCIAL_LEADERBOARD_BY_VERSION"; + bc.socialLeaderboard.OPERATION_GET_SOCIAL_LEADERBOARD_BY_VERSION_IF_EXISTS = "GET_SOCIAL_LEADERBOARD_BY_VERSION_IF_EXISTS"; bc.socialLeaderboard.OPERATION_GET_MULTI_SOCIAL_LEADERBOARD = "GET_MULTI_SOCIAL_LEADERBOARD"; bc.socialLeaderboard.OPERATION_GET_GLOBAL_LEADERBOARD_PAGE = "GET_GLOBAL_LEADERBOARD_PAGE"; + bc.socialLeaderboard.OPERATION_GET_GLOBAL_LEADERBOARD_PAGE_IF_EXISTS = "GET_GLOBAL_LEADERBOARD_PAGE_IF_EXISTS"; bc.socialLeaderboard.OPERATION_GET_GLOBAL_LEADERBOARD_VIEW = "GET_GLOBAL_LEADERBOARD_VIEW"; + bc.socialLeaderboard.OPERATION_GET_GLOBAL_LEADERBOARD_VIEW_IF_EXISTS = "GET_GLOBAL_LEADERBOARD_VIEW_IF_EXISTS"; bc.socialLeaderboard.OPERATION_GET_GLOBAL_LEADERBOARD_VERSIONS = "GET_GLOBAL_LEADERBOARD_VERSIONS"; bc.socialLeaderboard.OPERATION_GET_GROUP_SOCIAL_LEADERBOARD = "GET_GROUP_SOCIAL_LEADERBOARD"; bc.socialLeaderboard.OPERATION_GET_GROUP_SOCIAL_LEADERBOARD_BY_VERSION = "GET_GROUP_SOCIAL_LEADERBOARD_BY_VERSION"; bc.socialLeaderboard.OPERATION_GET_PLAYERS_SOCIAL_LEADERBOARD = "GET_PLAYERS_SOCIAL_LEADERBOARD"; + bc.socialLeaderboard.OPERATION_GET_PLAYERS_SOCIAL_LEADERBOARD_IF_EXISTS = "GET_PLAYERS_SOCIAL_LEADERBOARD_IF_EXISTS"; bc.socialLeaderboard.OPERATION_GET_PLAYERS_SOCIAL_LEADERBOARD_BY_VERSION = "GET_PLAYERS_SOCIAL_LEADERBOARD_BY_VERSION"; + bc.socialLeaderboard.OPERATION_GET_PLAYERS_SOCIAL_LEADERBOARD_BY_VERSION_IF_EXISTS = "GET_PLAYERS_SOCIAL_LEADERBOARD_BY_VERSION_IF_EXISTS"; bc.socialLeaderboard.OPERATION_LIST_ALL_LEADERBOARDS = "LIST_ALL_LEADERBOARDS"; bc.socialLeaderboard.OPERATION_GET_GLOBAL_LEADERBOARD_ENTRY_COUNT = "GET_GLOBAL_LEADERBOARD_ENTRY_COUNT"; bc.socialLeaderboard.OPERATION_REMOVE_PLAYER_SCORE = "REMOVE_PLAYER_SCORE"; @@ -79,6 +85,43 @@ function BCSocialLeaderboard() { }); }; + /** + * Method returns a page of global leaderboard results. + * + * Leaderboards entries contain the player's score and optionally, some user-defined + * data associated with the score. + * + * Note: This method allows the client to retrieve pages from within the global leaderboard list + * + * This method returns the same data as getGlobalLeaderboardPage, but it will not return an error if the leaderboard does not exist. + * + * Service Name - SocialLeaderboard + * Service Operation - GetGlobalLeaderboardPage + * + * @param leaderboardId {string} The id of the leaderboard to retrieve. + * @param sortOrder {string} Sort key Sort order of page. + * @param startRank {int} The rank at which to start the page. + * @param endRank {int} The rank at which to end the page. + * @param callback The method to be invoked when the server response is received + * + * @see bc.socialLeaderboard.SortOrder + */ + bc.socialLeaderboard.getGlobalLeaderboardPageIfExists = function ( + leaderboardId, sortOrder, startIndex, endIndex, callback) { + bc.brainCloudManager + .sendRequest({ + service: bc.SERVICE_LEADERBOARD, + operation: bc.socialLeaderboard.OPERATION_GET_GLOBAL_LEADERBOARD_PAGE_IF_EXISTS, + data: { + leaderboardId: leaderboardId, + sort: sortOrder, + startIndex: startIndex, + endIndex: endIndex + }, + callback: callback + }); + }; + /** * Method returns a page of global leaderboard results. * By using a non-current version id, the user can retrieve a historial leaderboard. @@ -113,6 +156,42 @@ function BCSocialLeaderboard() { }); }; + /** + * Method returns a page of global leaderboard results. + * By using a non-current version id, the user can retrieve a historial leaderboard. + * See GetGlobalLeaderboardVersions method to retrieve the version id. + * + * This method returns the same data as getGlobalLeaderboardPageByVersion, but it will not return an error if the leaderboard does not exist. + * + * Service Name - SocialLeaderboard + * Service Operation - GetGlobalLeaderboardPage + * + * @param leaderboardId {string} The id of the leaderboard to retrieve. + * @param sortOrder {string} Sort key Sort order of page. + * @param startRank {int} The rank at which to start the page. + * @param endRank {int} The rank at which to end the page. + * @param versionId The historical version to retrieve + * @param callback The method to be invoked when the server response is received + * + * @see bc.socialLeaderboard.SortOrder + */ + bc.socialLeaderboard.getGlobalLeaderboardPageByVersionIfExists = function( + leaderboardId, sortOrder, startIndex, endIndex, versionId, callback) { + bc.brainCloudManager + .sendRequest({ + service : bc.SERVICE_LEADERBOARD, + operation : bc.socialLeaderboard.OPERATION_GET_GLOBAL_LEADERBOARD_PAGE_IF_EXISTS, + data : { + leaderboardId : leaderboardId, + sort : sortOrder, + startIndex : startIndex, + endIndex : endIndex, + versionId : versionId + }, + callback : callback + }); + }; + /** * Method returns a view of global leaderboard results. * @@ -148,6 +227,43 @@ function BCSocialLeaderboard() { }); }; + /** + * Method returns a view of global leaderboard results. + * + * Leaderboards entries contain the player's score and optionally, some user-defined + * data associated with the score. + * + * Note: This method allows the client to retrieve pages from within the global leaderboard list + * + * This method returns the same data as getGlobalLeaderboardView, but it will not return an error if the leaderboard does not exist. + * + * Service Name - SocialLeaderboard + * Service Operation - GetGlobalLeaderboardPage + * + * @param leaderboardId {string} The id of the leaderboard to retrieve. + * @param sortOrder {string} Sort key Sort order of page. + * @param beforeCount {int} The count of number of players before the current player to include. + * @param afterCount {int} The count of number of players after the current player to include. + * @param callback The method to be invoked when the server response is received + * + * @see bc.socialLeaderboard.SortOrder + */ + bc.socialLeaderboard.getGlobalLeaderboardViewIfExists = function( + leaderboardId, sortOrder, beforeCount, afterCount, callback) { + bc.brainCloudManager + .sendRequest({ + service : bc.SERVICE_LEADERBOARD, + operation : bc.socialLeaderboard.OPERATION_GET_GLOBAL_LEADERBOARD_VIEW_IF_EXISTS, + data : { + leaderboardId : leaderboardId, + sort : sortOrder, + beforeCount : beforeCount, + afterCount : afterCount + }, + callback : callback + }); + }; + /** * Method returns a view of global leaderboard results. * By using a non-current version id, the user can retrieve a historial leaderboard. @@ -182,6 +298,42 @@ function BCSocialLeaderboard() { }); }; + /** + * Method returns a view of global leaderboard results. + * By using a non-current version id, the user can retrieve a historial leaderboard. + * See GetGlobalLeaderboardVersions method to retrieve the version id. + * + * This method returns the same data as getGlobalLeaderboardViewByVersion, but it will not return an error if the leaderboard does not exist. + * + * Service Name - SocialLeaderboard + * Service Operation - GetGlobalLeaderboardView + * + * @param leaderboardId {string} The id of the leaderboard to retrieve. + * @param sortOrder {string} Sort key Sort order of page. + * @param beforeCount {int} The count of number of players before the current player to include. + * @param afterCount {int} The count of number of players after the current player to include. + * @param versionId The historical version to retrieve + * @param callback The method to be invoked when the server response is received + * + * @see bc.socialLeaderboard.SortOrder + */ + bc.socialLeaderboard.getGlobalLeaderboardViewByVersionIfExists = function( + leaderboardId, sortOrder, beforeCount, afterCount, versionId, callback) { + bc.brainCloudManager + .sendRequest({ + service : bc.SERVICE_LEADERBOARD, + operation : bc.socialLeaderboard.OPERATION_GET_GLOBAL_LEADERBOARD_VIEW_IF_EXISTS, + data : { + leaderboardId : leaderboardId, + sort : sortOrder, + beforeCount : beforeCount, + afterCount : afterCount, + versionId : versionId + }, + callback : callback + }); + }; + /** * Gets the number of entries in a global leaderboard * @@ -262,6 +414,44 @@ function BCSocialLeaderboard() { }); }; + /** + * Method returns the social leaderboard. A player's social leaderboard is + * comprised of players who are recognized as being your friend. + * + * This method returns the same data as getSocialLeaderboard, but it will not return an error if the leaderboard does not exist. + * + * 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. + * + * @param leaderboardId The id of the leaderboard to retrieve + * @param replaceName If true, the currently logged in player's name will be replaced + * by the string "You". + * @param callback The method to be invoked when the server response is received + * + */ + bc.socialLeaderboard.getSocialLeaderboardIfExists = function ( + leaderboardId, replaceName, callback) { + bc.brainCloudManager + .sendRequest({ + service: bc.SERVICE_LEADERBOARD, + operation: bc.socialLeaderboard.OPERATION_GET_SOCIAL_LEADERBOARD_IF_EXISTS, + data: { + leaderboardId: leaderboardId, + replaceName: replaceName + }, + callback: callback + }); + }; + /** * Method returns the social leaderboard by version. A player's social leaderboard is * comprised of players who are recognized as being your friend. @@ -300,6 +490,46 @@ function BCSocialLeaderboard() { }); }; + /** + * Method returns the social leaderboard by version. A player's social leaderboard is + * comprised of players who are recognized as being your friend. + * + * This method returns the same data as getSocialLeaderboardByVersion, but it will not return an error if the leaderboard does not exist. + * + * 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. + * + * @param leaderboardId The id of the leaderboard to retrieve + * @param replaceName If true, the currently logged in player's name will be replaced + * by the string "You". + * @param versionId the version of the social leaderboard + * @param callback The method to be invoked when the server response is received + * + */ + bc.socialLeaderboard.getSocialLeaderboardByVersionIfExists = function ( + leaderboardId, replaceName, versionId, callback) { + bc.brainCloudManager + .sendRequest({ + service: bc.SERVICE_LEADERBOARD, + operation: bc.socialLeaderboard.OPERATION_GET_SOCIAL_LEADERBOARD_BY_VERSION_IF_EXISTS, + data: { + leaderboardId: leaderboardId, + replaceName: replaceName, + versionId: versionId + }, + callback: callback + }); + }; + /** * Reads multiple social leaderboards. * @@ -652,6 +882,32 @@ function BCSocialLeaderboard() { }); } + /** + * Retrieve the social leaderboard for a group. + * + * This method returns the same data as getPlayersSocialLeaderboard, but it will not return an error if the leaderboard does not exist. + * + * Service Name - leaderboard + * Service Operation - GET_GROUP_SOCIAL_LEADERBOARD + * + * @param leaderboardId The leaderboard to retrieve + * @param profileIds The IDs of the players + * @param callback The method to be invoked when the server response is received + */ + bc.socialLeaderboard.getPlayersSocialLeaderboardIfExists = function (leaderboardId, profileIds, callback) { + var message = { + leaderboardId: leaderboardId, + profileIds: profileIds + }; + + bc.brainCloudManager.sendRequest({ + service: bc.SERVICE_LEADERBOARD, + operation: bc.socialLeaderboard.OPERATION_GET_PLAYERS_SOCIAL_LEADERBOARD_IF_EXISTS, + data: message, + callback: callback + }); + } + /** * Retrieve the social leaderboard for a player by the version. * @@ -678,6 +934,34 @@ function BCSocialLeaderboard() { }); } + /** + * Retrieve the social leaderboard for a player by the version. + * + * This method returns the same data as getPlayersSocialLeaderboardByVersion, but it will not return an error if the leaderboard does not exist. + * + * Service Name - leaderboard + * Service Operation - GET_PLAYER_SOCIAL_LEADERBOARD_BY_VERSION + * + * @param leaderboardId The leaderboard to retrieve + * @param profileIds The IDs of the players + * @param versionId The version of the leaderboard + * @param callback The method to be invoked when the server response is received + */ + bc.socialLeaderboard.getPlayersSocialLeaderboardByVersionIfExists = function(leaderboardId, profileIds, versionId, callback) { + var message = { + leaderboardId : leaderboardId, + profileIds : profileIds, + versionId : versionId + }; + + bc.brainCloudManager.sendRequest({ + service : bc.SERVICE_LEADERBOARD, + operation : bc.socialLeaderboard.OPERATION_GET_PLAYERS_SOCIAL_LEADERBOARD_BY_VERSION_IF_EXISTS, + data : message, + callback : callback + }); + } + /** * Retrieve a list of all leaderboards * diff --git a/test/test.js b/test/test.js index c10d173..d319aaf 100644 --- a/test/test.js +++ b/test/test.js @@ -4622,17 +4622,61 @@ async function testSocialLeaderboard() { }); }); - await asyncTest("getGlobalLeaderboardView()", 2, function() { - bc.leaderboard.getGlobalLeaderboardView( + await asyncTest("getGlobalLeaderboardPageIfExistsTrue()", 2, function() { + bc.leaderboard.getGlobalLeaderboardPageIfExists( leaderboardName, bc.leaderboard.sortOrder.HIGH_TO_LOW, - 4, 5, function(result) { + 0, 10, function(result) { ok(true, JSON.stringify(result)); equal(result.status, 200, "Expecting 200"); resolve_test(); }); }); + await asyncTest("getGlobalLeaderboardPageIfExistsFalse()", 2, function() { + bc.leaderboard.getGlobalLeaderboardPageIfExists( + "nonExistentLeaderboard", + bc.leaderboard.sortOrder.HIGH_TO_LOW, + 0, 10, function(result) { + ok(true, JSON.stringify(result)); + equal(result.status, 200, "Expecting 200"); + resolve_test(); + }); + }); + + await asyncTest("getGlobalLeaderboardView()", 2, function () { + bc.leaderboard.getGlobalLeaderboardView( + leaderboardName, + bc.leaderboard.sortOrder.HIGH_TO_LOW, + 4, 5, function (result) { + ok(true, JSON.stringify(result)); + equal(result.status, 200, "Expecting 200"); + resolve_test(); + }); + }); + + await asyncTest("getGlobalLeaderboardViewIfExistsTrue()", 2, function () { + bc.leaderboard.getGlobalLeaderboardViewIfExists( + leaderboardName, + bc.leaderboard.sortOrder.HIGH_TO_LOW, + 4, 5, function (result) { + ok(true, JSON.stringify(result)); + equal(result.status, 200, "Expecting 200"); + resolve_test(); + }); + }); + + await asyncTest("getGlobalLeaderboardViewIfExistsFalse()", 2, function () { + bc.leaderboard.getGlobalLeaderboardViewIfExists( + "nonExistentLeaderboard", + bc.leaderboard.sortOrder.HIGH_TO_LOW, + 4, 5, function (result) { + ok(true, JSON.stringify(result)); + equal(result.status, 200, "Expecting 200"); + resolve_test(); + }); + }); + var versionId = 0; await asyncTest("getGlobalLeaderboardVersions()", 2, function() { @@ -4647,33 +4691,80 @@ async function testSocialLeaderboard() { }); }); - await asyncTest( - "getGlobalLeaderboardPageByVersion()", - 2, - function() { - bc.leaderboard - .getGlobalLeaderboardPageByVersion( - leaderboardName, - bc.leaderboard.sortOrder.HIGH_TO_LOW, - 0, 10, versionId, function(result) { - ok(true, JSON.stringify(result)); - equal(result.status, 200, - "Expecting 200"); - resolve_test(); - }); - }); + await asyncTest("getGlobalLeaderboardPageByVersion()", 2, function () { + bc.leaderboard + .getGlobalLeaderboardPageByVersion( + leaderboardName, + bc.leaderboard.sortOrder.HIGH_TO_LOW, + 0, 10, versionId, function (result) { + ok(true, JSON.stringify(result)); + equal(result.status, 200, "Expecting 200"); + resolve_test(); + }); + }); - await asyncTest("getGlobalLeaderboardViewByVersion()", 2, function() { + await asyncTest("getGlobalLeaderboardPageByVersionIfExistsTrue()", 2, function () { bc.leaderboard - .getGlobalLeaderboardViewByVersion( - leaderboardName, - bc.leaderboard.sortOrder.HIGH_TO_LOW, - 4, 5, versionId, function(result) { - ok(true, JSON.stringify(result)); - equal(result.status, 200, - "Expecting 200"); - resolve_test(); - }); + .getGlobalLeaderboardPageByVersionIfExists( + leaderboardName, + bc.leaderboard.sortOrder.HIGH_TO_LOW, + 0, 10, versionId, function (result) { + ok(true, JSON.stringify(result)); + equal(result.status, 200, "Expecting 200"); + resolve_test(); + }); + }); + + await asyncTest("getGlobalLeaderboardPageByVersionIfExistsFalse()", 2, function () { + bc.leaderboard + .getGlobalLeaderboardPageByVersionIfExists( + "nonExistentLeaderboard", + bc.leaderboard.sortOrder.HIGH_TO_LOW, + 0, 10, versionId, function (result) { + ok(true, JSON.stringify(result)); + equal(result.status, 200, "Expecting 200"); + resolve_test(); + }); + }); + + await asyncTest("getGlobalLeaderboardViewByVersion()", 2, function () { + bc.leaderboard + .getGlobalLeaderboardViewByVersion( + leaderboardName, + bc.leaderboard.sortOrder.HIGH_TO_LOW, + 4, 5, versionId, function (result) { + ok(true, JSON.stringify(result)); + equal(result.status, 200, "Expecting 200"); + resolve_test(); + }); + }); + + await asyncTest("getGlobalLeaderboardViewByVersionIfExistsTrue()", 2, function () { + bc.leaderboard.getGlobalLeaderboardViewByVersionIfExists( + leaderboardName, + bc.leaderboard.sortOrder.HIGH_TO_LOW, + 4, + 5, + versionId, + function (result) { + ok(true, JSON.stringify(result)); + equal(result.status, 200, "Expecting 200"); + resolve_test(); + }); + }); + + await asyncTest("getGlobalLeaderboardViewByVersionIfExistsFalse()", 2, function () { + bc.leaderboard.getGlobalLeaderboardViewByVersionIfExists( + "nonExistentLeaderboard", + bc.leaderboard.sortOrder.HIGH_TO_LOW, + 4, + 5, + versionId, + function (result) { + ok(true, JSON.stringify(result)); + equal(result.status, 200, "Expecting 200"); + resolve_test(); + }); }); await asyncTest("getGlobalLeaderboardEntryCount()", 2, function() { @@ -4767,24 +4858,64 @@ async function testSocialLeaderboard() { }); }); - await asyncTest("getSocialLeaderboard()", 2, function() { + await asyncTest("getSocialLeaderboard()", 2, function () { bc.leaderboard.getSocialLeaderboard(leaderboardName, - true, function(result) { - ok(true, JSON.stringify(result)); - equal(result.status, 200, "Expecting 200"); - resolve_test(); - }); + true, function (result) { + ok(true, JSON.stringify(result)); + equal(result.status, 200, "Expecting 200"); + resolve_test(); + }); }); - await asyncTest("getSocialLeaderboardByVersion()", 2, function() { + await asyncTest("getSocialLeaderboardIfExistsTrue()", 2, function () { + bc.leaderboard.getSocialLeaderboardIfExists(leaderboardName, + true, function (result) { + ok(true, JSON.stringify(result)); + equal(result.status, 200, "Expecting 200"); + resolve_test(); + }); + }); + + await asyncTest("getSocialLeaderboardIfExistsFalse()", 2, function () { + bc.leaderboard.getSocialLeaderboardIfExists("nonExistentLeaderboard", + true, function (result) { + ok(true, JSON.stringify(result)); + equal(result.status, 200, "Expecting 200"); + resolve_test(); + }); + }); + + await asyncTest("getSocialLeaderboardByVersion()", 2, function () { bc.leaderboard.getSocialLeaderboardByVersion(leaderboardName, - true, - 0, - function(result) { - ok(true, JSON.stringify(result)); - equal(result.status, 200, "Expecting 200"); - resolve_test(); - }); + true, + 0, + function (result) { + ok(true, JSON.stringify(result)); + equal(result.status, 200, "Expecting 200"); + resolve_test(); + }); + }); + + await asyncTest("getSocialLeaderboardByVersionIfExistsTrue()", 2, function () { + bc.leaderboard.getSocialLeaderboardByVersionIfExists(leaderboardName, + true, + 0, + function (result) { + ok(true, JSON.stringify(result)); + equal(result.status, 200, "Expecting 200"); + resolve_test(); + }); + }); + + await asyncTest("getSocialLeaderboardByVersionIfExistsFalse()", 2, function () { + bc.leaderboard.getSocialLeaderboardByVersionIfExists("nonExistentLeaderboard", + true, + 0, + function (result) { + ok(true, JSON.stringify(result)); + equal(result.status, 200, "Expecting 200"); + resolve_test(); + }); }); await asyncTest("getMultiSocialLeaderboard()", 2, function() { @@ -4932,7 +5063,6 @@ async function testSocialLeaderboard() { }); }); -///////////////////////// await asyncTest("deleteGroup()", 2, function() { bc.group.deleteGroup( groupId, @@ -4944,27 +5074,73 @@ async function testSocialLeaderboard() { }); }); - await asyncTest("getPlayersSocialLeaderboard()", 2, function() { + await asyncTest("getPlayersSocialLeaderboard()", 2, function () { bc.leaderboard.getPlayersSocialLeaderboard( - leaderboardName, - [ UserA.profileId, UserB.profileId ], - function(result) { - ok(true, JSON.stringify(result)); - equal(result.status, 200, "Expecting 200"); - resolve_test(); - }); + leaderboardName, + [UserA.profileId, UserB.profileId], + function (result) { + ok(true, JSON.stringify(result)); + equal(result.status, 200, "Expecting 200"); + resolve_test(); + }); }); - await asyncTest("getPlayersSocialLeaderboardByVersion()", 2, function() { + await asyncTest("getPlayersSocialLeaderboardIfExistsTrue()", 2, function () { + bc.leaderboard.getPlayersSocialLeaderboardIfExists( + leaderboardName, + [UserA.profileId, UserB.profileId], + function (result) { + ok(true, JSON.stringify(result)); + equal(result.status, 200, "Expecting 200"); + resolve_test(); + }); + }); + + await asyncTest("getPlayersSocialLeaderboardIfExistsFalse()", 2, function () { + bc.leaderboard.getPlayersSocialLeaderboardIfExists( + "nonExistentLeaderboard", + [UserA.profileId, UserB.profileId], + function (result) { + ok(true, JSON.stringify(result)); + equal(result.status, 200, "Expecting 200"); + resolve_test(); + }); + }); + + await asyncTest("getPlayersSocialLeaderboardByVersion()", 2, function () { bc.leaderboard.getPlayersSocialLeaderboardByVersion( - leaderboardName, - [ UserA.profileId, UserB.profileId ], - 0, - function(result) { - ok(true, JSON.stringify(result)); - equal(result.status, 200, "Expecting 200"); - resolve_test(); - }); + leaderboardName, + [UserA.profileId, UserB.profileId], + 0, + function (result) { + ok(true, JSON.stringify(result)); + equal(result.status, 200, "Expecting 200"); + resolve_test(); + }); + }); + + await asyncTest("getPlayersSocialLeaderboardByVersionIfExistsTrue()", 2, function () { + bc.leaderboard.getPlayersSocialLeaderboardByVersionIfExists( + leaderboardName, + [UserA.profileId, UserB.profileId], + 0, + function (result) { + ok(true, JSON.stringify(result)); + equal(result.status, 200, "Expecting 200"); + resolve_test(); + }); + }); + + await asyncTest("getPlayersSocialLeaderboardByVersionIfExistsFalse()", 2, function () { + bc.leaderboard.getPlayersSocialLeaderboardByVersionIfExists( + "nonExistentLeaderboard", + [UserA.profileId, UserB.profileId], + 0, + function (result) { + ok(true, JSON.stringify(result)); + equal(result.status, 200, "Expecting 200"); + resolve_test(); + }); }); await asyncTest("getPlayerScore()", 2, function() {