Skip to content

Commit

Permalink
https://api.playfab.com/releaseNotes/#180316
Browse files Browse the repository at this point in the history
  • Loading branch information
PlayFabJenkinsBot committed Mar 16, 2018
2 parents 82bc12f + f6d3196 commit 5290b7a
Show file tree
Hide file tree
Showing 18 changed files with 1,407 additions and 125 deletions.
3 changes: 0 additions & 3 deletions .arcconfig

This file was deleted.

Binary file modified Defold/PlayFabClientSdk.zip
Binary file not shown.
Binary file modified Defold/PlayFabClientTestExample.zip
Binary file not shown.
Binary file modified Defold/PlayFabComboSdk.zip
Binary file not shown.
Binary file modified Defold/PlayFabServerSdk.zip
Binary file not shown.
87 changes: 56 additions & 31 deletions PlayFabClientSDK/PlayFab/PlayFabClientApi.lua

Large diffs are not rendered by default.

371 changes: 371 additions & 0 deletions PlayFabClientSDK/PlayFab/PlayFabEntityApi.lua

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions PlayFabClientSDK/PlayFab/PlayFabSettings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
local PlayFabSettings = {
_internalSettings = {
sessionTicket = nil,
sdkVersionString = "LuaSdk_0.30.180213",
buildIdentifier = "jbuild_luasdk_1"
sdkVersionString = "LuaSdk_0.31.180316",
buildIdentifier = "jbuild_luasdk_0"
},
settings = {
devSecretKey = nil,
disableAdvertising = false,
advertisingIdType = nil,
advertisingIdValue = nil,
Expand Down
106 changes: 96 additions & 10 deletions PlayFabClientSDK/PlayFabTesting/PlayFabApiTestSuite.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

local json = require("PlayFab.json")
local PlayFabClientApi = require("PlayFab.PlayFabClientApi")
local PlayFabEntityApiExists, PlayFabEntityApi = pcall(require, "PlayFab.PlayFabEntityApi")
-- Most users won't need to import PlayFabSettings, as the public settings are available via PlayFabClientApi.settings
local PlayFabSettings = require("PlayFab.PlayFabSettings")
local AsyncTestSuite = require("PlayFabTesting.AsyncTestSuite")
Expand Down Expand Up @@ -33,7 +34,8 @@ local PlayFabApiTestSuite = {

-- TEST VARIABLES
playFabId = nil,
testDataValue = nil,
entityKey = nil,
testNumber = nil,
testStatValue = nil,
}

Expand Down Expand Up @@ -118,7 +120,7 @@ end
function PlayFabApiTestSuite.OnLoginSuccess(result)
if (result.PlayFabId) then
PlayFabApiTestSuite.playFabId = result.PlayFabId
AsyncTestSuite.EndTest("PASSED", nil)
AsyncTestSuite.EndTest("PASSED", PlayFabApiTestSuite.playFabId)
else
AsyncTestSuite.EndTest("FAILED", "PlayFabId not found in login result" .. json.encode(result))
end
Expand Down Expand Up @@ -174,18 +176,18 @@ function PlayFabApiTestSuite.UserDataApi()
PlayFabClientApi.GetUserData(getDataRequest, AsyncTestSuite.WrapCallback("OnGetUserData1", PlayFabApiTestSuite.OnGetUserData1), PlayFabApiTestSuite.OnSharedError)
end
function PlayFabApiTestSuite.OnGetUserData1(result)
PlayFabApiTestSuite.testDataValue = 0
PlayFabApiTestSuite.testNumber = 0
if (result.Data and result.Data[PlayFabApiTestSuite.TEST_DATA_KEY]) then
PlayFabApiTestSuite.testDataValue = tonumber(result.Data[PlayFabApiTestSuite.TEST_DATA_KEY].Value)
PlayFabApiTestSuite.testNumber = tonumber(result.Data[PlayFabApiTestSuite.TEST_DATA_KEY].Value)
end
PlayFabApiTestSuite.testDataValue = (PlayFabApiTestSuite.testDataValue + 1) % 100 -- This test is about the expected value changing - but not testing more complicated issues like bounds
PlayFabApiTestSuite.testNumber = (PlayFabApiTestSuite.testNumber + 1) % 100 -- This test is about the expected value changing - but not testing more complicated issues like bounds

local updateRequest = {
-- Currently, you need to look up the correct format for this object in the API-docs:
-- https://api.playfab.com/Documentation/Client/method/UpdateUserData
Data = {}
}
updateRequest.Data[PlayFabApiTestSuite.TEST_DATA_KEY] = tostring(PlayFabApiTestSuite.testDataValue)
updateRequest.Data[PlayFabApiTestSuite.TEST_DATA_KEY] = tostring(PlayFabApiTestSuite.testNumber)
PlayFabClientApi.UpdateUserData(updateRequest, AsyncTestSuite.WrapCallback("OnUpdateUserData", PlayFabApiTestSuite.OnUpdateUserData), PlayFabApiTestSuite.OnSharedError)
end
function PlayFabApiTestSuite.OnUpdateUserData(result)
Expand All @@ -198,10 +200,10 @@ function PlayFabApiTestSuite.OnGetUserData2(result)
actualValue = tonumber(result.Data[PlayFabApiTestSuite.TEST_DATA_KEY].Value)
end

if (actualValue == PlayFabApiTestSuite.testDataValue) then
if (actualValue == PlayFabApiTestSuite.testNumber) then
AsyncTestSuite.EndTest("PASSED", nil)
else
AsyncTestSuite.EndTest("FAILED", "UserDataApi failed: " .. tostring(PlayFabApiTestSuite.testDataValue) .. " != " .. tostring(actualValue) .. " Json: " .. json.encode(result))
AsyncTestSuite.EndTest("FAILED", "UserDataApi failed: " .. tostring(PlayFabApiTestSuite.testNumber) .. " != " .. tostring(actualValue) .. " Json: " .. json.encode(result))
end
end

Expand Down Expand Up @@ -361,12 +363,92 @@ function PlayFabApiTestSuite.WriteEvent()
Body = "This is my awesome post."
}
}
PlayFabClientApi.WritePlayerEvent(writeEventRequest, AsyncTestSuite.WrapCallback("OnLeaderboard", PlayFabApiTestSuite.OnLeaderboard), PlayFabApiTestSuite.OnSharedError)
PlayFabClientApi.WritePlayerEvent(writeEventRequest, AsyncTestSuite.WrapCallback("OnWriteEvent", PlayFabApiTestSuite.OnWriteEvent), PlayFabApiTestSuite.OnSharedError)
end
function PlayFabApiTestSuite.OnLeaderboard(result)
function PlayFabApiTestSuite.OnWriteEvent(result)
AsyncTestSuite.EndTest("PASSED", nil)
end

--- <summary>
--- ENTITY API
--- Verify that a client login can be converted into an entity token
--- </summary>
function PlayFabApiTestSuite.GetEntityToken()
local getTokenRequest = {
-- Currently, you need to look up the correct format for this object in the API-docs:
-- https://api.playfab.com/Documentation/Entity/method/GetEntityToken
}
PlayFabEntityApi.GetEntityToken(getTokenRequest, AsyncTestSuite.WrapCallback("OnGetEntityToken", PlayFabApiTestSuite.OnGetEntityToken), PlayFabApiTestSuite.OnSharedError)
end
function PlayFabApiTestSuite.OnGetEntityToken(result)
if (result.Entity) then
PlayFabApiTestSuite.entityKey = result.Entity
AsyncTestSuite.EndTest("PASSED", PlayFabApiTestSuite.entityKey.Id)
else
AsyncTestSuite.EndTest("FAILED", "EntityId not found in GetEntityToken result" .. json.encode(result))
end
end

--- <summary>
--- CLIENT API
--- Test a sequence of calls that modifies entity objects,
--- and verifies that the next sequential API call contains updated information.
--- Verify that the object is correctly modified on the next call.
--- </summary>
function PlayFabApiTestSuite.ObjectApi()
local getObjRequest = {
-- Currently, you need to look up the correct format for this object in the API-docs:
-- https://api.playfab.com/Documentation/Entity/method/GetObjects
Entity = PlayFabApiTestSuite.entityKey,
EntityType = "title_player_account",
EscapeObject = true,
}
PlayFabEntityApi.GetObjects(getObjRequest, AsyncTestSuite.WrapCallback("OnGetObj1", PlayFabApiTestSuite.OnGetObj1), PlayFabApiTestSuite.OnSharedError)
end
function PlayFabApiTestSuite.OnGetObj1(result)
PlayFabApiTestSuite.testNumber = 0
if (result.Objects and result.Objects[PlayFabApiTestSuite.TEST_DATA_KEY] and result.Objects[PlayFabApiTestSuite.TEST_DATA_KEY].ObjectName == PlayFabApiTestSuite.TEST_DATA_KEY) then
PlayFabApiTestSuite.testNumber = tonumber(result.Objects[PlayFabApiTestSuite.TEST_DATA_KEY].EscapedDataObject)
end
PlayFabApiTestSuite.testNumber = (PlayFabApiTestSuite.testNumber + 1) % 100 -- This test is about the expected value changing - but not testing more complicated issues like bounds

local updateRequest = {
-- Currently, you need to look up the correct format for this object in the API-docs:
-- https://api.playfab.com/Documentation/Entity/method/SetObjects
Entity = PlayFabApiTestSuite.entityKey,
EntityType = "title_player_account",
Objects = {
{
ObjectName = PlayFabApiTestSuite.TEST_DATA_KEY,
DataObject = PlayFabApiTestSuite.testNumber,
}
},
}
PlayFabEntityApi.SetObjects(updateRequest, AsyncTestSuite.WrapCallback("OnSetObj", PlayFabApiTestSuite.OnSetObj), PlayFabApiTestSuite.OnSharedError)
end
function PlayFabApiTestSuite.OnSetObj(result)
local getObjRequest = {
-- Currently, you need to look up the correct format for this object in the API-docs:
-- https://api.playfab.com/Documentation/Entity/method/GetObjects
Entity = PlayFabApiTestSuite.entityKey,
EntityType = "title_player_account",
EscapeObject = true,
}
PlayFabEntityApi.GetObjects(getObjRequest, AsyncTestSuite.WrapCallback("OnGetObj2", PlayFabApiTestSuite.OnGetObj2), PlayFabApiTestSuite.OnSharedError)
end
function PlayFabApiTestSuite.OnGetObj2(result)
local actualValue = -1000
if (result.Objects and result.Objects[PlayFabApiTestSuite.TEST_DATA_KEY] and result.Objects[PlayFabApiTestSuite.TEST_DATA_KEY].ObjectName == PlayFabApiTestSuite.TEST_DATA_KEY) then
actualValue = tonumber(result.Objects[PlayFabApiTestSuite.TEST_DATA_KEY].EscapedDataObject)
end

if (actualValue == PlayFabApiTestSuite.testNumber) then
AsyncTestSuite.EndTest("PASSED", actualValue)
else
AsyncTestSuite.EndTest("FAILED", "ObjectApi failed: " .. tostring(PlayFabApiTestSuite.testNumber) .. " != " .. tostring(actualValue) .. " Json: " .. json.encode(result))
end
end

-- TEST SUITE MANAGEMENT SECTION
function PlayFabApiTestSuite.Start()
AsyncTestSuite.Init(buildIdentifier)
Expand All @@ -382,6 +464,10 @@ function PlayFabApiTestSuite.Start()
AsyncTestSuite.AddTest("CloudScript", PlayFabApiTestSuite.CloudScript)
AsyncTestSuite.AddTest("CloudScriptError", PlayFabApiTestSuite.CloudScriptError)
AsyncTestSuite.AddTest("WriteEvent", PlayFabApiTestSuite.WriteEvent)
if (PlayFabEntityApiExists) then
AsyncTestSuite.AddTest("GetEntityToken", PlayFabApiTestSuite.GetEntityToken)
AsyncTestSuite.AddTest("ObjectApi", PlayFabApiTestSuite.ObjectApi)
end
AsyncTestSuite.BeginTesting()
end

Expand Down
9 changes: 9 additions & 0 deletions PlayFabSDK/PlayFab/PlayFabAdminApi.lua
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,15 @@ function PlayFabAdminApi.RevokeInventoryItem(request, onSuccess, onError)
IPlayFabHttps.MakePlayFabApiCall("/Admin/RevokeInventoryItem", request, "X-SecretKey", PlayFabSettings.settings.devSecretKey, onSuccess, onError)
end

-- Revokes access for up to 25 items across multiple users and characters.
-- API Method Documentation: https://api.playfab.com/Documentation/Admin/method/RevokeInventoryItems
-- Request Documentation: https://api.playfab.com/Documentation/Admin/datatype/PlayFab.Admin.Models/PlayFab.Admin.Models.RevokeInventoryItemsRequest
-- Result Documentation: https://api.playfab.com/Documentation/Admin/datatype/PlayFab.Admin.Models/PlayFab.Admin.Models.RevokeInventoryItemsResult
function PlayFabAdminApi.RevokeInventoryItems(request, onSuccess, onError)
if (not PlayFabSettings.settings.titleId or not PlayFabSettings.settings.devSecretKey) then error("Must have PlayFabSettings.settings.devSecretKey set to call this method") end
IPlayFabHttps.MakePlayFabApiCall("/Admin/RevokeInventoryItems", request, "X-SecretKey", PlayFabSettings.settings.devSecretKey, onSuccess, onError)
end

-- Run a task immediately regardless of its schedule.
-- API Method Documentation: https://api.playfab.com/Documentation/Admin/method/RunTask
-- Request Documentation: https://api.playfab.com/Documentation/Admin/datatype/PlayFab.Admin.Models/PlayFab.Admin.Models.RunTaskRequest
Expand Down
Loading

0 comments on commit 5290b7a

Please sign in to comment.