Skip to content

Commit 7f78de8

Browse files
author
pgilmorepf
committed
https://api.playfab.com/releaseNotes/#160822
2 parents 48c50db + de97c44 commit 7f78de8

File tree

5 files changed

+96
-21
lines changed

5 files changed

+96
-21
lines changed

PlayFabApiTest.js

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ var PlayFabApiTests = {
6767
} else {
6868
// Continue with other tests that require login
6969
QUnit.test("UserDataApi", PlayFabApiTests.UserDataApi);
70-
QUnit.test("UserStatisticsApi", PlayFabApiTests.UserStatisticsApi);
70+
QUnit.test("PlayerStatisticsApi", PlayFabApiTests.PlayerStatisticsApi);
7171
QUnit.test("UserCharacter", PlayFabApiTests.UserCharacter);
7272
QUnit.test("LeaderBoard", PlayFabApiTests.LeaderBoard);
7373
QUnit.test("AccountInfo", PlayFabApiTests.AccountInfo);
@@ -317,7 +317,7 @@ var PlayFabApiTests = {
317317
/// Verify that the data is saved correctly, and that specific types are tested
318318
/// Parameter types tested: Dictionary<string, int>
319319
/// </summary>
320-
UserStatisticsApi: function (assert) {
320+
PlayerStatisticsApi: function (assert) {
321321
var getStatsRequest = {}; // null also works
322322

323323
// This test is always exactly 3 async calls
@@ -326,40 +326,43 @@ var PlayFabApiTests = {
326326
var get2Done = assert.async();
327327

328328
var getStatsCallback2 = function (result, error) {
329-
PlayFabApiTests.VerifyNullError(result, error, assert, "Testing GetUserStats result");
330-
assert.ok(result.data.UserStatistics != null, "Testing GetUserData Stats");
331-
assert.ok(result.data.UserStatistics.hasOwnProperty(PlayFabApiTests.testConstants.TEST_STAT_NAME), "Testing GetUserData Stat-value");
329+
PlayFabApiTests.VerifyNullError(result, error, assert, "Testing GetPlayerStats result");
330+
assert.ok(result.data.Statistics != null, "Testing GetUserData Stats");
332331

333-
var actualtestNumber = result.data.UserStatistics[PlayFabApiTests.testConstants.TEST_STAT_NAME];
332+
var actualtestNumber = -1000;
333+
for (var i = 0; i < result.data.Statistics.length; i++)
334+
if (result.data.Statistics[i].StatisticName === PlayFabApiTests.testConstants.TEST_STAT_NAME)
335+
actualtestNumber = result.data.Statistics[i].Value;
334336

335337
assert.equal(PlayFabApiTests.testData.testNumber, actualtestNumber, "Testing incrementing stat: " + PlayFabApiTests.testData.testNumber + "==" + actualtestNumber);
336338
get2Done();
337339
};
338340
var updateStatsCallback = function (result, error) {
339-
PlayFabApiTests.VerifyNullError(result, error, assert, "Testing UpdateUserStats result");
340-
PlayFabClientSDK.GetUserStatistics(getStatsRequest, PlayFabApiTests.CallbackWrapper("getStatsCallback2", getStatsCallback2, assert));
341+
PlayFabApiTests.VerifyNullError(result, error, assert, "Testing UpdatePlayerStats result");
342+
PlayFabClientSDK.GetPlayerStatistics(getStatsRequest, PlayFabApiTests.CallbackWrapper("getStatsCallback2", getStatsCallback2, assert));
341343
updateDone();
342344
};
343345
var getStatsCallback1 = function (result, error) {
344-
PlayFabApiTests.VerifyNullError(result, error, assert, "Testing GetUserStats result");
345-
assert.ok(result.data.UserStatistics != null, "Testing GetUserData Stats");
346+
PlayFabApiTests.VerifyNullError(result, error, assert, "Testing GetPlayerStats result");
347+
assert.ok(result.data.Statistics != null, "Testing GetUserData Stats");
346348

347-
var hasData = result.data.UserStatistics.hasOwnProperty(PlayFabApiTests.testConstants.TEST_STAT_NAME);
348-
PlayFabApiTests.testData.testNumber = !hasData ? 1 : result.data.UserStatistics[PlayFabApiTests.testConstants.TEST_STAT_NAME];
349+
PlayFabApiTests.testData.testNumber = 0;
350+
for (var i = 0; i < result.data.Statistics.length; i++)
351+
if (result.data.Statistics[i].StatisticName === PlayFabApiTests.testConstants.TEST_STAT_NAME)
352+
PlayFabApiTests.testData.testNumber = result.data.Statistics[i].Value;
349353
PlayFabApiTests.testData.testNumber = (PlayFabApiTests.testData.testNumber + 1) % 100; // This test is about the expected value changing - but not testing more complicated issues like bounds
350354

351355
var updateStatsRequest = {
352356
// Currently, you need to look up the correct format for this object in the API-docs:
353-
// https://api.playfab.com/Documentation/Client/method/UpdateUserStatistics
354-
UserStatistics: {} // Can't pre-define properties because the param-name is in a string
357+
// https://api.playfab.com/Documentation/Client/method/UpdatePlayerStatistics
358+
Statistics: [{ StatisticName: PlayFabApiTests.testConstants.TEST_STAT_NAME, Value: PlayFabApiTests.testData.testNumber }]
355359
};
356-
updateStatsRequest.UserStatistics[PlayFabApiTests.testConstants.TEST_STAT_NAME] = PlayFabApiTests.testData.testNumber;
357-
PlayFabClientSDK.UpdateUserStatistics(updateStatsRequest, PlayFabApiTests.CallbackWrapper("updateStatsCallback", updateStatsCallback, assert));
360+
PlayFabClientSDK.UpdatePlayerStatistics(updateStatsRequest, PlayFabApiTests.CallbackWrapper("updateStatsCallback", updateStatsCallback, assert));
358361
get1Done();
359362
};
360363

361364
// Kick off this test process
362-
PlayFabClientSDK.GetUserStatistics(getStatsRequest, PlayFabApiTests.CallbackWrapper("getStatsCallback1", getStatsCallback1, assert));
365+
PlayFabClientSDK.GetPlayerStatistics(getStatsRequest, PlayFabApiTests.CallbackWrapper("getStatsCallback1", getStatsCallback1, assert));
363366
},
364367

365368
/// <summary>

PlayFabSDK/PlayFabAdminApi.js

Lines changed: 37 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.26.160815",
21+
sdkVersion: "0.27.160822",
2222
buildIdentifier: "jbuild_javascriptsdk_0",
2323
productionServerUrl: ".playfabapi.com",
2424
logicServerUrl: null,
@@ -106,24 +106,54 @@ if(!PlayFab._internalSettings) {
106106

107107
PlayFab.AdminApi = {
108108

109+
BanUsers: function (request, callback) {
110+
if (PlayFab.settings.developerSecretKey == null) throw "Must have PlayFab.settings.developerSecretKey set to call this method";
111+
112+
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/BanUsers", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
113+
},
114+
109115
GetUserAccountInfo: function (request, callback) {
110116
if (PlayFab.settings.developerSecretKey == null) throw "Must have PlayFab.settings.developerSecretKey set to call this method";
111117

112118
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetUserAccountInfo", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
113119
},
114120

121+
GetUserBans: function (request, callback) {
122+
if (PlayFab.settings.developerSecretKey == null) throw "Must have PlayFab.settings.developerSecretKey set to call this method";
123+
124+
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/GetUserBans", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
125+
},
126+
115127
ResetUsers: function (request, callback) {
116128
if (PlayFab.settings.developerSecretKey == null) throw "Must have PlayFab.settings.developerSecretKey set to call this method";
117129

118130
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/ResetUsers", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
119131
},
120132

133+
RevokeAllBansForUser: function (request, callback) {
134+
if (PlayFab.settings.developerSecretKey == null) throw "Must have PlayFab.settings.developerSecretKey set to call this method";
135+
136+
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/RevokeAllBansForUser", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
137+
},
138+
139+
RevokeBans: function (request, callback) {
140+
if (PlayFab.settings.developerSecretKey == null) throw "Must have PlayFab.settings.developerSecretKey set to call this method";
141+
142+
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/RevokeBans", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
143+
},
144+
121145
SendAccountRecoveryEmail: function (request, callback) {
122146
if (PlayFab.settings.developerSecretKey == null) throw "Must have PlayFab.settings.developerSecretKey set to call this method";
123147

124148
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/SendAccountRecoveryEmail", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
125149
},
126150

151+
UpdateBans: function (request, callback) {
152+
if (PlayFab.settings.developerSecretKey == null) throw "Must have PlayFab.settings.developerSecretKey set to call this method";
153+
154+
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/UpdateBans", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
155+
},
156+
127157
UpdateUserTitleDisplayName: function (request, callback) {
128158
if (PlayFab.settings.developerSecretKey == null) throw "Must have PlayFab.settings.developerSecretKey set to call this method";
129159

@@ -262,6 +292,12 @@ PlayFab.AdminApi = {
262292
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/AddVirtualCurrencyTypes", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
263293
},
264294

295+
DeleteStore: function (request, callback) {
296+
if (PlayFab.settings.developerSecretKey == null) throw "Must have PlayFab.settings.developerSecretKey set to call this method";
297+
298+
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Admin/DeleteStore", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
299+
},
300+
265301
GetCatalogItems: function (request, callback) {
266302
if (PlayFab.settings.developerSecretKey == null) throw "Must have PlayFab.settings.developerSecretKey set to call this method";
267303

PlayFabSDK/PlayFabClientApi.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.26.160815",
21+
sdkVersion: "0.27.160822",
2222
buildIdentifier: "jbuild_javascriptsdk_0",
2323
productionServerUrl: ".playfabapi.com",
2424
logicServerUrl: null,

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.26.160815",
21+
sdkVersion: "0.27.160822",
2222
buildIdentifier: "jbuild_javascriptsdk_0",
2323
productionServerUrl: ".playfabapi.com",
2424
logicServerUrl: null,

PlayFabSDK/PlayFabServerApi.js

Lines changed: 37 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.26.160815",
21+
sdkVersion: "0.27.160822",
2222
buildIdentifier: "jbuild_javascriptsdk_0",
2323
productionServerUrl: ".playfabapi.com",
2424
logicServerUrl: null,
@@ -112,6 +112,12 @@ PlayFab.ServerApi = {
112112
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/AuthenticateSessionTicket", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
113113
},
114114

115+
BanUsers: function (request, callback) {
116+
if (PlayFab.settings.developerSecretKey == null) throw "Must have PlayFab.settings.developerSecretKey set to call this method";
117+
118+
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/BanUsers", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
119+
},
120+
115121
GetPlayFabIDsFromFacebookIDs: function (request, callback) {
116122
if (PlayFab.settings.developerSecretKey == null) throw "Must have PlayFab.settings.developerSecretKey set to call this method";
117123

@@ -130,12 +136,36 @@ PlayFab.ServerApi = {
130136
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetUserAccountInfo", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
131137
},
132138

139+
GetUserBans: function (request, callback) {
140+
if (PlayFab.settings.developerSecretKey == null) throw "Must have PlayFab.settings.developerSecretKey set to call this method";
141+
142+
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetUserBans", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
143+
},
144+
145+
RevokeAllBansForUser: function (request, callback) {
146+
if (PlayFab.settings.developerSecretKey == null) throw "Must have PlayFab.settings.developerSecretKey set to call this method";
147+
148+
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/RevokeAllBansForUser", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
149+
},
150+
151+
RevokeBans: function (request, callback) {
152+
if (PlayFab.settings.developerSecretKey == null) throw "Must have PlayFab.settings.developerSecretKey set to call this method";
153+
154+
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/RevokeBans", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
155+
},
156+
133157
SendPushNotification: function (request, callback) {
134158
if (PlayFab.settings.developerSecretKey == null) throw "Must have PlayFab.settings.developerSecretKey set to call this method";
135159

136160
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/SendPushNotification", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
137161
},
138162

163+
UpdateBans: function (request, callback) {
164+
if (PlayFab.settings.developerSecretKey == null) throw "Must have PlayFab.settings.developerSecretKey set to call this method";
165+
166+
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/UpdateBans", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
167+
},
168+
139169
DeleteUsers: function (request, callback) {
140170
if (PlayFab.settings.developerSecretKey == null) throw "Must have PlayFab.settings.developerSecretKey set to call this method";
141171

@@ -340,6 +370,12 @@ PlayFab.ServerApi = {
340370
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetCharacterInventory", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
341371
},
342372

373+
GetRandomResultTables: function (request, callback) {
374+
if (PlayFab.settings.developerSecretKey == null) throw "Must have PlayFab.settings.developerSecretKey set to call this method";
375+
376+
PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + "/Server/GetRandomResultTables", request, "X-SecretKey", PlayFab.settings.developerSecretKey, callback);
377+
},
378+
343379
GetUserInventory: function (request, callback) {
344380
if (PlayFab.settings.developerSecretKey == null) throw "Must have PlayFab.settings.developerSecretKey set to call this method";
345381

0 commit comments

Comments
 (0)