Skip to content

Commit 50b5f5c

Browse files
author
Paul Gilmore
committed
Merge pull request #40 from PlayFab/master
Weekly SDK Publish
2 parents 4d199a6 + e5e3aa6 commit 50b5f5c

File tree

5 files changed

+78
-32
lines changed

5 files changed

+78
-32
lines changed

PlayFabApiTest.js

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
if (typeof PlayFabClientSDK == 'undefined')
2-
Console.error("PlayFabApiTest requires PlayFabClientApi.js to be pre-loaded.");
2+
console.log("PlayFabApiTest requires PlayFabClientApi.js to be pre-loaded.");
33
if (typeof PlayFabServerSDK == 'undefined')
4-
Console.error("PlayFabApiTest requires PlayFabServerApi.js to be pre-loaded.");
4+
console.log("PlayFabApiTest requires PlayFabServerApi.js to be pre-loaded.");
55

66
var PlayFabApiTests = {
77
testTitleDataFilename: "testTitleData.json", // TODO: Do not hard code the location of this file (javascript can't really do relative paths either)
@@ -45,7 +45,6 @@ var PlayFabApiTests = {
4545
QUnit.test("LoginWithAdvertisingId", PlayFabApiTests.LoginWithAdvertisingId);
4646

4747
setTimeout(function () { PlayFabApiTests.PostLoginTests(0); }, 200);
48-
setTimeout(function () { PlayFabApiTests.PostCharacterTests(0); }, 200);
4948
},
5049

5150
PostLoginTests: function (count) {
@@ -60,23 +59,12 @@ var PlayFabApiTests = {
6059
QUnit.test("UserDataApi", PlayFabApiTests.UserDataApi);
6160
QUnit.test("UserStatisticsApi", PlayFabApiTests.UserStatisticsApi);
6261
QUnit.test("UserCharacter", PlayFabApiTests.UserCharacter);
62+
QUnit.test("LeaderBoard", PlayFabApiTests.LeaderBoard);
6363
QUnit.test("AccountInfo", PlayFabApiTests.AccountInfo);
6464
QUnit.test("CloudScript", PlayFabApiTests.CloudScript);
6565
}
6666
},
6767

68-
PostCharacterTests: function (count) {
69-
if (count > 5)
70-
return;
71-
72-
if (PlayFabApiTests.testData.characterId == null) {
73-
// Wait for characterId
74-
setTimeout(function () { PlayFabApiTests.PostCharacterTests(count + 1); }, 200);
75-
} else {
76-
QUnit.test("LeaderBoard", PlayFabApiTests.LeaderBoard);
77-
}
78-
},
79-
8068
SetUp: function (inputTitleData) {
8169
// All of these must exist for the titleData load to be successful
8270
var titleDataValid = inputTitleData.hasOwnProperty("titleId") && inputTitleData.titleId != null
@@ -90,7 +78,7 @@ var PlayFabApiTests = {
9078
if (titleDataValid)
9179
PlayFabApiTests.titleData = inputTitleData;
9280
else
93-
window.console.error("testTitleData input file did not parse correctly");
81+
console.log("testTitleData input file did not parse correctly");
9482

9583
PlayFab.settings.titleId = PlayFabApiTests.titleData.titleId;
9684
PlayFab.settings.developerSecretKey = PlayFabApiTests.titleData.developerSecretKey;
@@ -103,7 +91,7 @@ var PlayFabApiTests = {
10391
try {
10492
Callback(result, error);
10593
} catch (e) {
106-
window.console.error("Exception thrown during " + callbackName + " callback: " + e.toString() + "\n" + e.stack); // Very irritatingly, qunit doesn't report failure results until all async callbacks return, which doesn't always happen when there's an exception
94+
console.log("Exception thrown during " + callbackName + " callback: " + e.toString() + "\n" + e.stack); // Very irritatingly, qunit doesn't report failure results until all async callbacks return, which doesn't always happen when there's an exception
10795
assert.ok(false, "Exception thrown during " + callbackName + " callback: " + e.toString() + "\n" + e.stack);
10896
}
10997
};
@@ -114,7 +102,7 @@ var PlayFabApiTests = {
114102
try {
115103
Callback();
116104
} catch (e) {
117-
window.console.error("Exception thrown during " + callbackName + " callback: " + e.toString() + "\n" + e.stack); // Very irritatingly, qunit doesn't report failure results until all async callbacks return, which doesn't always happen when there's an exception
105+
console.log("Exception thrown during " + callbackName + " callback: " + e.toString() + "\n" + e.stack); // Very irritatingly, qunit doesn't report failure results until all async callbacks return, which doesn't always happen when there's an exception
118106
assert.ok(false, "Exception thrown during " + callbackName + " callback: " + e.toString() + "\n" + e.stack);
119107
}
120108
};
@@ -411,34 +399,32 @@ var PlayFabApiTests = {
411399
};
412400
var serverRequest = {
413401
MaxResultsCount: 3,
414-
PlayFabId: PlayFabApiTests.testData.playFabId,
415-
CharacterId: PlayFabApiTests.testData.characterId,
416402
StatisticName: PlayFabApiTests.testConstants.TEST_STAT_NAME,
417403
};
404+
var lbDoneC = assert.async();
405+
var lbDoneS = assert.async();
418406

419-
var GetLeaderboardCallback_C = function (result, error) {
407+
var getLeaderboardCallbackC = function (result, error) {
420408
PlayFabApiTests.VerifyNullError(result, error, assert, "Testing GetLeaderboard result");
421409
if (result != null) {
422410
assert.ok(result.data.Leaderboard != null, "Testing GetLeaderboard content");
423411
assert.ok(result.data.Leaderboard.length > 0, "Testing GetLeaderboard content-length");
424412
}
425413

426-
lbDone_C();
414+
lbDoneC();
427415
};
428-
var GetLeaderboardCallback_S = function (result, error) {
416+
var getLeaderboardCallbackS = function (result, error) {
429417
PlayFabApiTests.VerifyNullError(result, error, assert, "Testing GetLeaderboard result");
430418
if (result != null) {
431419
assert.ok(result.data.Leaderboard != null, "Testing GetLeaderboard content");
432420
assert.ok(result.data.Leaderboard.length > 0, "Testing GetLeaderboard content-length");
433421
}
434422

435-
lbDone_S();
423+
lbDoneS();
436424
};
437425

438-
var lbDone_C = assert.async();
439-
PlayFabClientSDK.GetLeaderboardAroundCurrentUser(clientRequest, PlayFabApiTests.CallbackWrapper("GetLeaderboardCallback_C", GetLeaderboardCallback_C, assert));
440-
var lbDone_S = assert.async();
441-
PlayFabServerSDK.GetLeaderboardAroundCharacter(serverRequest, PlayFabApiTests.CallbackWrapper("GetLeaderboardCallback_S", GetLeaderboardCallback_S, assert));
426+
PlayFabClientSDK.GetLeaderboard(clientRequest, PlayFabApiTests.CallbackWrapper("getLeaderboardCallbackC", getLeaderboardCallbackC, assert));
427+
PlayFabServerSDK.GetLeaderboard(serverRequest, PlayFabApiTests.CallbackWrapper("getLeaderboardCallbackS", getLeaderboardCallbackS, assert));
442428
},
443429

444430
/// <summary>

PlayFabSDK/PlayFabAdminApi.js

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ if(!PlayFab.settings) {
1818
if(!PlayFab._internalSettings) {
1919
PlayFab._internalSettings = {
2020
sessionTicket: null,
21-
sdkVersion: "0.9.160201",
21+
sdkVersion: "0.10.160201",
2222
productionServerUrl: ".playfabapi.com",
2323
logicServerUrl: null,
2424

@@ -128,6 +128,12 @@ PlayFab.AdminApi = {
128128
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/UpdateUserTitleDisplayName", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
129129
},
130130

131+
CreatePlayerStatisticDefinition: function (request, callback) {
132+
if (PlayFab.settings.developerSecretKey == null) throw "Must have PlayFab.settings.developerSecretKey set to call this method";
133+
134+
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/CreatePlayerStatisticDefinition", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
135+
},
136+
131137
DeleteUsers: function (request, callback) {
132138
if (PlayFab.settings.developerSecretKey == null) throw "Must have PlayFab.settings.developerSecretKey set to call this method";
133139

@@ -140,6 +146,18 @@ PlayFab.AdminApi = {
140146
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetDataReport", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
141147
},
142148

149+
GetPlayerStatisticDefinitions: function (request, callback) {
150+
if (PlayFab.settings.developerSecretKey == null) throw "Must have PlayFab.settings.developerSecretKey set to call this method";
151+
152+
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetPlayerStatisticDefinitions", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
153+
},
154+
155+
GetPlayerStatisticVersions: function (request, callback) {
156+
if (PlayFab.settings.developerSecretKey == null) throw "Must have PlayFab.settings.developerSecretKey set to call this method";
157+
158+
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetPlayerStatisticVersions", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
159+
},
160+
143161
GetUserData: function (request, callback) {
144162
if (PlayFab.settings.developerSecretKey == null) throw "Must have PlayFab.settings.developerSecretKey set to call this method";
145163

@@ -176,12 +194,24 @@ PlayFab.AdminApi = {
176194
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetUserReadOnlyData", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
177195
},
178196

197+
IncrementPlayerStatisticVersion: function (request, callback) {
198+
if (PlayFab.settings.developerSecretKey == null) throw "Must have PlayFab.settings.developerSecretKey set to call this method";
199+
200+
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/IncrementPlayerStatisticVersion", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
201+
},
202+
179203
ResetUserStatistics: function (request, callback) {
180204
if (PlayFab.settings.developerSecretKey == null) throw "Must have PlayFab.settings.developerSecretKey set to call this method";
181205

182206
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/ResetUserStatistics", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
183207
},
184208

209+
UpdatePlayerStatisticDefinition: function (request, callback) {
210+
if (PlayFab.settings.developerSecretKey == null) throw "Must have PlayFab.settings.developerSecretKey set to call this method";
211+
212+
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/UpdatePlayerStatisticDefinition", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
213+
},
214+
185215
UpdateUserData: function (request, callback) {
186216
if (PlayFab.settings.developerSecretKey == null) throw "Must have PlayFab.settings.developerSecretKey set to call this method";
187217

PlayFabSDK/PlayFabClientApi.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ if(!PlayFab.settings) {
1818
if(!PlayFab._internalSettings) {
1919
PlayFab._internalSettings = {
2020
sessionTicket: null,
21-
sdkVersion: "0.9.160201",
21+
sdkVersion: "0.10.160201",
2222
productionServerUrl: ".playfabapi.com",
2323
logicServerUrl: null,
2424

@@ -513,6 +513,12 @@ PlayFab.ClientApi = {
513513
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Client/GetLeaderboardAroundPlayer", request, "X-Authorization", PlayFab._internalSettings.sessionTicket, callback);
514514
},
515515

516+
GetPlayerStatistics: function (request, callback) {
517+
if (PlayFab._internalSettings.sessionTicket == null) throw "Must be logged in to call this method";
518+
519+
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Client/GetPlayerStatistics", request, "X-Authorization", PlayFab._internalSettings.sessionTicket, callback);
520+
},
521+
516522
GetUserData: function (request, callback) {
517523
if (PlayFab._internalSettings.sessionTicket == null) throw "Must be logged in to call this method";
518524

@@ -543,6 +549,12 @@ PlayFab.ClientApi = {
543549
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Client/GetUserStatistics", request, "X-Authorization", PlayFab._internalSettings.sessionTicket, callback);
544550
},
545551

552+
UpdatePlayerStatistics: function (request, callback) {
553+
if (PlayFab._internalSettings.sessionTicket == null) throw "Must be logged in to call this method";
554+
555+
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Client/UpdatePlayerStatistics", request, "X-Authorization", PlayFab._internalSettings.sessionTicket, callback);
556+
},
557+
546558
UpdateUserData: function (request, callback) {
547559
if (PlayFab._internalSettings.sessionTicket == null) throw "Must be logged in to call this method";
548560

@@ -657,6 +669,12 @@ PlayFab.ClientApi = {
657669
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Client/SubtractUserVirtualCurrency", request, "X-Authorization", PlayFab._internalSettings.sessionTicket, callback);
658670
},
659671

672+
UnlockContainerInstance: function (request, callback) {
673+
if (PlayFab._internalSettings.sessionTicket == null) throw "Must be logged in to call this method";
674+
675+
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Client/UnlockContainerInstance", request, "X-Authorization", PlayFab._internalSettings.sessionTicket, callback);
676+
},
677+
660678
UnlockContainerItem: function (request, callback) {
661679
if (PlayFab._internalSettings.sessionTicket == null) throw "Must be logged in to call this method";
662680

PlayFabSDK/PlayFabMatchmakerApi.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ if(!PlayFab.settings) {
1818
if(!PlayFab._internalSettings) {
1919
PlayFab._internalSettings = {
2020
sessionTicket: null,
21-
sdkVersion: "0.9.160201",
21+
sdkVersion: "0.10.160201",
2222
productionServerUrl: ".playfabapi.com",
2323
logicServerUrl: null,
2424

PlayFabSDK/PlayFabServerApi.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ if(!PlayFab.settings) {
1818
if(!PlayFab._internalSettings) {
1919
PlayFab._internalSettings = {
2020
sessionTicket: null,
21-
sdkVersion: "0.9.160201",
21+
sdkVersion: "0.10.160201",
2222
productionServerUrl: ".playfabapi.com",
2323
logicServerUrl: null,
2424

@@ -368,6 +368,18 @@ PlayFab.ServerApi = {
368368
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/SubtractUserVirtualCurrency", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
369369
},
370370

371+
UnlockContainerInstance: function (request, callback) {
372+
if (PlayFab.settings.developerSecretKey == null) throw "Must have PlayFab.settings.developerSecretKey set to call this method";
373+
374+
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/UnlockContainerInstance", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
375+
},
376+
377+
UnlockContainerItem: function (request, callback) {
378+
if (PlayFab.settings.developerSecretKey == null) throw "Must have PlayFab.settings.developerSecretKey set to call this method";
379+
380+
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/UnlockContainerItem", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
381+
},
382+
371383
UpdateUserInventoryItemCustomData: function (request, callback) {
372384
if (PlayFab.settings.developerSecretKey == null) throw "Must have PlayFab.settings.developerSecretKey set to call this method";
373385

0 commit comments

Comments
 (0)