From 4456cc6f8acbfd27640c0752cd3ca009e5bc696b Mon Sep 17 00:00:00 2001 From: PlayFab SDK Team Date: Mon, 5 Aug 2024 22:22:47 +0000 Subject: [PATCH] https://docs.microsoft.com/en-us/gaming/playfab/release-notes/#240802 --- PlayFabSdk/package.json | 2 +- PlayFabSdk/src/PlayFab/PlayFabAdminApi.js | 8 +- .../src/PlayFab/PlayFabAuthenticationApi.js | 8 +- PlayFabSdk/src/PlayFab/PlayFabClientApi.js | 8 +- .../src/PlayFab/PlayFabCloudScriptApi.js | 8 +- PlayFabSdk/src/PlayFab/PlayFabDataApi.js | 8 +- PlayFabSdk/src/PlayFab/PlayFabEconomyApi.js | 8 +- PlayFabSdk/src/PlayFab/PlayFabEventsApi.js | 8 +- .../src/PlayFab/PlayFabExperimentationApi.js | 8 +- PlayFabSdk/src/PlayFab/PlayFabGroupsApi.js | 8 +- PlayFabSdk/src/PlayFab/PlayFabInsightsApi.js | 8 +- .../src/PlayFab/PlayFabLeaderboardsApi.js | 335 +++++++++ .../src/PlayFab/PlayFabLocalizationApi.js | 8 +- .../src/PlayFab/PlayFabMultiplayerApi.js | 8 +- PlayFabSdk/src/PlayFab/PlayFabProfilesApi.js | 8 +- PlayFabSdk/src/PlayFab/PlayFabServerApi.js | 8 +- .../src/Typings/PlayFab/PlayFabAdminApi.d.ts | 4 + .../PlayFab/PlayFabLeaderboardsApi.d.ts | 680 ++++++++++++++++++ .../src/Typings/PlayFab/PlayFabServerApi.d.ts | 6 +- PlayFabSdk/src/Typings/PlayFab/Playfab.d.ts | 3 + PlayFabTestingExample/PlayFabApiTest.csproj | 2 + PlayFabTestingExample/index.html | 1 + .../src/PlayFab/PlayFabAdminApi.js | 8 +- .../src/PlayFab/PlayFabAuthenticationApi.js | 8 +- .../src/PlayFab/PlayFabClientApi.js | 8 +- .../src/PlayFab/PlayFabCloudScriptApi.js | 8 +- .../src/PlayFab/PlayFabDataApi.js | 8 +- .../src/PlayFab/PlayFabEconomyApi.js | 8 +- .../src/PlayFab/PlayFabEventsApi.js | 8 +- .../src/PlayFab/PlayFabExperimentationApi.js | 8 +- .../src/PlayFab/PlayFabGroupsApi.js | 8 +- .../src/PlayFab/PlayFabInsightsApi.js | 8 +- .../src/PlayFab/PlayFabLeaderboardsApi.js | 335 +++++++++ .../src/PlayFab/PlayFabLocalizationApi.js | 8 +- .../src/PlayFab/PlayFabMultiplayerApi.js | 8 +- .../src/PlayFab/PlayFabProfilesApi.js | 8 +- .../src/PlayFab/PlayFabServerApi.js | 8 +- .../src/typings/PlayFab/PlayFab.d.ts | 3 + .../src/typings/PlayFab/PlayFabAdminApi.d.ts | 4 + .../PlayFab/PlayFabLeaderboardsApi.d.ts | 680 ++++++++++++++++++ .../src/typings/PlayFab/PlayFabServerApi.d.ts | 6 +- 41 files changed, 2170 insertions(+), 115 deletions(-) create mode 100644 PlayFabSdk/src/PlayFab/PlayFabLeaderboardsApi.js create mode 100644 PlayFabSdk/src/Typings/PlayFab/PlayFabLeaderboardsApi.d.ts create mode 100644 PlayFabTestingExample/src/PlayFab/PlayFabLeaderboardsApi.js create mode 100644 PlayFabTestingExample/src/typings/PlayFab/PlayFabLeaderboardsApi.d.ts diff --git a/PlayFabSdk/package.json b/PlayFabSdk/package.json index b0097777..62571259 100644 --- a/PlayFabSdk/package.json +++ b/PlayFabSdk/package.json @@ -1,6 +1,6 @@ { "name": "playfab-web-sdk", - "version": "1.175.240719", + "version": "1.176.240802", "description": "Playfab SDK for JS client applications", "license": "Apache-2.0", "repository": { diff --git a/PlayFabSdk/src/PlayFab/PlayFabAdminApi.js b/PlayFabSdk/src/PlayFab/PlayFabAdminApi.js index 39b83a8b..2085abfc 100644 --- a/PlayFabSdk/src/PlayFab/PlayFabAdminApi.js +++ b/PlayFabSdk/src/PlayFab/PlayFabAdminApi.js @@ -14,9 +14,9 @@ if(!PlayFab.settings) { if(!PlayFab._internalSettings) { PlayFab._internalSettings = { entityToken: null, - sdkVersion: "1.175.240719", + sdkVersion: "1.176.240802", requestGetParams: { - sdk: "JavaScriptSDK-1.175.240719" + sdk: "JavaScriptSDK-1.176.240802" }, sessionTicket: null, verticalName: null, // The name of a customer vertical. This is only for customers running a private cluster. Generally you shouldn't touch this @@ -223,8 +223,8 @@ if(!PlayFab._internalSettings) { } } -PlayFab.buildIdentifier = "adobuild_javascriptsdk_115"; -PlayFab.sdkVersion = "1.175.240719"; +PlayFab.buildIdentifier = "adobuild_javascriptsdk_117"; +PlayFab.sdkVersion = "1.176.240802"; PlayFab.GenerateErrorReport = function (error) { if (error == null) return ""; diff --git a/PlayFabSdk/src/PlayFab/PlayFabAuthenticationApi.js b/PlayFabSdk/src/PlayFab/PlayFabAuthenticationApi.js index eff9e7b9..114bf710 100644 --- a/PlayFabSdk/src/PlayFab/PlayFabAuthenticationApi.js +++ b/PlayFabSdk/src/PlayFab/PlayFabAuthenticationApi.js @@ -14,9 +14,9 @@ if(!PlayFab.settings) { if(!PlayFab._internalSettings) { PlayFab._internalSettings = { entityToken: null, - sdkVersion: "1.175.240719", + sdkVersion: "1.176.240802", requestGetParams: { - sdk: "JavaScriptSDK-1.175.240719" + sdk: "JavaScriptSDK-1.176.240802" }, sessionTicket: null, verticalName: null, // The name of a customer vertical. This is only for customers running a private cluster. Generally you shouldn't touch this @@ -223,8 +223,8 @@ if(!PlayFab._internalSettings) { } } -PlayFab.buildIdentifier = "adobuild_javascriptsdk_115"; -PlayFab.sdkVersion = "1.175.240719"; +PlayFab.buildIdentifier = "adobuild_javascriptsdk_117"; +PlayFab.sdkVersion = "1.176.240802"; PlayFab.GenerateErrorReport = function (error) { if (error == null) return ""; diff --git a/PlayFabSdk/src/PlayFab/PlayFabClientApi.js b/PlayFabSdk/src/PlayFab/PlayFabClientApi.js index 214ed874..b3bc6c4a 100644 --- a/PlayFabSdk/src/PlayFab/PlayFabClientApi.js +++ b/PlayFabSdk/src/PlayFab/PlayFabClientApi.js @@ -14,9 +14,9 @@ if(!PlayFab.settings) { if(!PlayFab._internalSettings) { PlayFab._internalSettings = { entityToken: null, - sdkVersion: "1.175.240719", + sdkVersion: "1.176.240802", requestGetParams: { - sdk: "JavaScriptSDK-1.175.240719" + sdk: "JavaScriptSDK-1.176.240802" }, sessionTicket: null, verticalName: null, // The name of a customer vertical. This is only for customers running a private cluster. Generally you shouldn't touch this @@ -223,8 +223,8 @@ if(!PlayFab._internalSettings) { } } -PlayFab.buildIdentifier = "adobuild_javascriptsdk_115"; -PlayFab.sdkVersion = "1.175.240719"; +PlayFab.buildIdentifier = "adobuild_javascriptsdk_117"; +PlayFab.sdkVersion = "1.176.240802"; PlayFab.GenerateErrorReport = function (error) { if (error == null) return ""; diff --git a/PlayFabSdk/src/PlayFab/PlayFabCloudScriptApi.js b/PlayFabSdk/src/PlayFab/PlayFabCloudScriptApi.js index 55ea90cf..e9d19a2c 100644 --- a/PlayFabSdk/src/PlayFab/PlayFabCloudScriptApi.js +++ b/PlayFabSdk/src/PlayFab/PlayFabCloudScriptApi.js @@ -14,9 +14,9 @@ if(!PlayFab.settings) { if(!PlayFab._internalSettings) { PlayFab._internalSettings = { entityToken: null, - sdkVersion: "1.175.240719", + sdkVersion: "1.176.240802", requestGetParams: { - sdk: "JavaScriptSDK-1.175.240719" + sdk: "JavaScriptSDK-1.176.240802" }, sessionTicket: null, verticalName: null, // The name of a customer vertical. This is only for customers running a private cluster. Generally you shouldn't touch this @@ -223,8 +223,8 @@ if(!PlayFab._internalSettings) { } } -PlayFab.buildIdentifier = "adobuild_javascriptsdk_115"; -PlayFab.sdkVersion = "1.175.240719"; +PlayFab.buildIdentifier = "adobuild_javascriptsdk_117"; +PlayFab.sdkVersion = "1.176.240802"; PlayFab.GenerateErrorReport = function (error) { if (error == null) return ""; diff --git a/PlayFabSdk/src/PlayFab/PlayFabDataApi.js b/PlayFabSdk/src/PlayFab/PlayFabDataApi.js index 81a18c4e..f75a22b0 100644 --- a/PlayFabSdk/src/PlayFab/PlayFabDataApi.js +++ b/PlayFabSdk/src/PlayFab/PlayFabDataApi.js @@ -14,9 +14,9 @@ if(!PlayFab.settings) { if(!PlayFab._internalSettings) { PlayFab._internalSettings = { entityToken: null, - sdkVersion: "1.175.240719", + sdkVersion: "1.176.240802", requestGetParams: { - sdk: "JavaScriptSDK-1.175.240719" + sdk: "JavaScriptSDK-1.176.240802" }, sessionTicket: null, verticalName: null, // The name of a customer vertical. This is only for customers running a private cluster. Generally you shouldn't touch this @@ -223,8 +223,8 @@ if(!PlayFab._internalSettings) { } } -PlayFab.buildIdentifier = "adobuild_javascriptsdk_115"; -PlayFab.sdkVersion = "1.175.240719"; +PlayFab.buildIdentifier = "adobuild_javascriptsdk_117"; +PlayFab.sdkVersion = "1.176.240802"; PlayFab.GenerateErrorReport = function (error) { if (error == null) return ""; diff --git a/PlayFabSdk/src/PlayFab/PlayFabEconomyApi.js b/PlayFabSdk/src/PlayFab/PlayFabEconomyApi.js index b9f164e5..cef1a5c3 100644 --- a/PlayFabSdk/src/PlayFab/PlayFabEconomyApi.js +++ b/PlayFabSdk/src/PlayFab/PlayFabEconomyApi.js @@ -14,9 +14,9 @@ if(!PlayFab.settings) { if(!PlayFab._internalSettings) { PlayFab._internalSettings = { entityToken: null, - sdkVersion: "1.175.240719", + sdkVersion: "1.176.240802", requestGetParams: { - sdk: "JavaScriptSDK-1.175.240719" + sdk: "JavaScriptSDK-1.176.240802" }, sessionTicket: null, verticalName: null, // The name of a customer vertical. This is only for customers running a private cluster. Generally you shouldn't touch this @@ -223,8 +223,8 @@ if(!PlayFab._internalSettings) { } } -PlayFab.buildIdentifier = "adobuild_javascriptsdk_115"; -PlayFab.sdkVersion = "1.175.240719"; +PlayFab.buildIdentifier = "adobuild_javascriptsdk_117"; +PlayFab.sdkVersion = "1.176.240802"; PlayFab.GenerateErrorReport = function (error) { if (error == null) return ""; diff --git a/PlayFabSdk/src/PlayFab/PlayFabEventsApi.js b/PlayFabSdk/src/PlayFab/PlayFabEventsApi.js index 9fa6f08b..775507b9 100644 --- a/PlayFabSdk/src/PlayFab/PlayFabEventsApi.js +++ b/PlayFabSdk/src/PlayFab/PlayFabEventsApi.js @@ -14,9 +14,9 @@ if(!PlayFab.settings) { if(!PlayFab._internalSettings) { PlayFab._internalSettings = { entityToken: null, - sdkVersion: "1.175.240719", + sdkVersion: "1.176.240802", requestGetParams: { - sdk: "JavaScriptSDK-1.175.240719" + sdk: "JavaScriptSDK-1.176.240802" }, sessionTicket: null, verticalName: null, // The name of a customer vertical. This is only for customers running a private cluster. Generally you shouldn't touch this @@ -223,8 +223,8 @@ if(!PlayFab._internalSettings) { } } -PlayFab.buildIdentifier = "adobuild_javascriptsdk_115"; -PlayFab.sdkVersion = "1.175.240719"; +PlayFab.buildIdentifier = "adobuild_javascriptsdk_117"; +PlayFab.sdkVersion = "1.176.240802"; PlayFab.GenerateErrorReport = function (error) { if (error == null) return ""; diff --git a/PlayFabSdk/src/PlayFab/PlayFabExperimentationApi.js b/PlayFabSdk/src/PlayFab/PlayFabExperimentationApi.js index 581acf2d..1b83781e 100644 --- a/PlayFabSdk/src/PlayFab/PlayFabExperimentationApi.js +++ b/PlayFabSdk/src/PlayFab/PlayFabExperimentationApi.js @@ -14,9 +14,9 @@ if(!PlayFab.settings) { if(!PlayFab._internalSettings) { PlayFab._internalSettings = { entityToken: null, - sdkVersion: "1.175.240719", + sdkVersion: "1.176.240802", requestGetParams: { - sdk: "JavaScriptSDK-1.175.240719" + sdk: "JavaScriptSDK-1.176.240802" }, sessionTicket: null, verticalName: null, // The name of a customer vertical. This is only for customers running a private cluster. Generally you shouldn't touch this @@ -223,8 +223,8 @@ if(!PlayFab._internalSettings) { } } -PlayFab.buildIdentifier = "adobuild_javascriptsdk_115"; -PlayFab.sdkVersion = "1.175.240719"; +PlayFab.buildIdentifier = "adobuild_javascriptsdk_117"; +PlayFab.sdkVersion = "1.176.240802"; PlayFab.GenerateErrorReport = function (error) { if (error == null) return ""; diff --git a/PlayFabSdk/src/PlayFab/PlayFabGroupsApi.js b/PlayFabSdk/src/PlayFab/PlayFabGroupsApi.js index c770f22a..a3dc3c03 100644 --- a/PlayFabSdk/src/PlayFab/PlayFabGroupsApi.js +++ b/PlayFabSdk/src/PlayFab/PlayFabGroupsApi.js @@ -14,9 +14,9 @@ if(!PlayFab.settings) { if(!PlayFab._internalSettings) { PlayFab._internalSettings = { entityToken: null, - sdkVersion: "1.175.240719", + sdkVersion: "1.176.240802", requestGetParams: { - sdk: "JavaScriptSDK-1.175.240719" + sdk: "JavaScriptSDK-1.176.240802" }, sessionTicket: null, verticalName: null, // The name of a customer vertical. This is only for customers running a private cluster. Generally you shouldn't touch this @@ -223,8 +223,8 @@ if(!PlayFab._internalSettings) { } } -PlayFab.buildIdentifier = "adobuild_javascriptsdk_115"; -PlayFab.sdkVersion = "1.175.240719"; +PlayFab.buildIdentifier = "adobuild_javascriptsdk_117"; +PlayFab.sdkVersion = "1.176.240802"; PlayFab.GenerateErrorReport = function (error) { if (error == null) return ""; diff --git a/PlayFabSdk/src/PlayFab/PlayFabInsightsApi.js b/PlayFabSdk/src/PlayFab/PlayFabInsightsApi.js index d35419f1..ffed01c1 100644 --- a/PlayFabSdk/src/PlayFab/PlayFabInsightsApi.js +++ b/PlayFabSdk/src/PlayFab/PlayFabInsightsApi.js @@ -14,9 +14,9 @@ if(!PlayFab.settings) { if(!PlayFab._internalSettings) { PlayFab._internalSettings = { entityToken: null, - sdkVersion: "1.175.240719", + sdkVersion: "1.176.240802", requestGetParams: { - sdk: "JavaScriptSDK-1.175.240719" + sdk: "JavaScriptSDK-1.176.240802" }, sessionTicket: null, verticalName: null, // The name of a customer vertical. This is only for customers running a private cluster. Generally you shouldn't touch this @@ -223,8 +223,8 @@ if(!PlayFab._internalSettings) { } } -PlayFab.buildIdentifier = "adobuild_javascriptsdk_115"; -PlayFab.sdkVersion = "1.175.240719"; +PlayFab.buildIdentifier = "adobuild_javascriptsdk_117"; +PlayFab.sdkVersion = "1.176.240802"; PlayFab.GenerateErrorReport = function (error) { if (error == null) return ""; diff --git a/PlayFabSdk/src/PlayFab/PlayFabLeaderboardsApi.js b/PlayFabSdk/src/PlayFab/PlayFabLeaderboardsApi.js new file mode 100644 index 00000000..a1c296fd --- /dev/null +++ b/PlayFabSdk/src/PlayFab/PlayFabLeaderboardsApi.js @@ -0,0 +1,335 @@ +/// + +var PlayFab = typeof PlayFab != "undefined" ? PlayFab : {}; + +if(!PlayFab.settings) { + PlayFab.settings = { + titleId: null, // You must set this value for PlayFabSdk to work properly (Found in the Game Manager for your title, at the PlayFab Website) + developerSecretKey: null, // For security reasons you must never expose this value to the client or players - You must set this value for Server-APIs to work properly (Found in the Game Manager for your title, at the PlayFab Website) + GlobalHeaderInjection: null, + productionServerUrl: ".playfabapi.com" + } +} + +if(!PlayFab._internalSettings) { + PlayFab._internalSettings = { + entityToken: null, + sdkVersion: "1.176.240802", + requestGetParams: { + sdk: "JavaScriptSDK-1.176.240802" + }, + sessionTicket: null, + verticalName: null, // The name of a customer vertical. This is only for customers running a private cluster. Generally you shouldn't touch this + errorTitleId: "Must be have PlayFab.settings.titleId set to call this method", + errorLoggedIn: "Must be logged in to call this method", + errorEntityToken: "You must successfully call GetEntityToken before calling this", + errorSecretKey: "Must have PlayFab.settings.developerSecretKey set to call this method", + + GetServerUrl: function () { + if (!(PlayFab.settings.productionServerUrl.substring(0, 4) === "http")) { + if (PlayFab._internalSettings.verticalName) { + return "https://" + PlayFab._internalSettings.verticalName + PlayFab.settings.productionServerUrl; + } else { + return "https://" + PlayFab.settings.titleId + PlayFab.settings.productionServerUrl; + } + } else { + return PlayFab.settings.productionServerUrl; + } + }, + + InjectHeaders: function (xhr, headersObj) { + if (!headersObj) + return; + + for (var headerKey in headersObj) + { + try { + xhr.setRequestHeader(gHeaderKey, headersObj[headerKey]); + } catch (e) { + console.log("Failed to append header: " + headerKey + " = " + headersObj[headerKey] + "Error: " + e); + } + } + }, + + ExecuteRequest: function (url, request, authkey, authValue, callback, customData, extraHeaders) { + var resultPromise = new Promise(function (resolve, reject) { + if (callback != null && typeof (callback) !== "function") + throw "Callback must be null or a function"; + + if (request == null) + request = {}; + + var startTime = new Date(); + var requestBody = JSON.stringify(request); + + var urlArr = [url]; + var getParams = PlayFab._internalSettings.requestGetParams; + if (getParams != null) { + var firstParam = true; + for (var key in getParams) { + if (firstParam) { + urlArr.push("?"); + firstParam = false; + } else { + urlArr.push("&"); + } + urlArr.push(key); + urlArr.push("="); + urlArr.push(getParams[key]); + } + } + + var completeUrl = urlArr.join(""); + + var xhr = new XMLHttpRequest(); + // window.console.log("URL: " + completeUrl); + xhr.open("POST", completeUrl, true); + + xhr.setRequestHeader("Content-Type", "application/json"); + xhr.setRequestHeader("X-PlayFabSDK", "JavaScriptSDK-" + PlayFab._internalSettings.sdkVersion); + if (authkey != null) + xhr.setRequestHeader(authkey, authValue); + PlayFab._internalSettings.InjectHeaders(xhr, PlayFab.settings.GlobalHeaderInjection); + PlayFab._internalSettings.InjectHeaders(xhr, extraHeaders); + + xhr.onloadend = function () { + if (callback == null) + return; + + var result = PlayFab._internalSettings.GetPlayFabResponse(request, xhr, startTime, customData); + if (result.code === 200) { + callback(result, null); + } else { + callback(null, result); + } + } + + xhr.onerror = function () { + if (callback == null) + return; + + var result = PlayFab._internalSettings.GetPlayFabResponse(request, xhr, startTime, customData); + callback(null, result); + } + + xhr.send(requestBody); + xhr.onreadystatechange = function () { + if (this.readyState === 4) { + var xhrResult = PlayFab._internalSettings.GetPlayFabResponse(request, this, startTime, customData); + if (this.status === 200) { + resolve(xhrResult); + } else { + reject(xhrResult); + } + } + }; + }); + // Return a Promise so that calls to various API methods can be handled asynchronously + return resultPromise; + }, + + GetPlayFabResponse: function(request, xhr, startTime, customData) { + var result = null; + try { + // window.console.log("parsing json result: " + xhr.responseText); + result = JSON.parse(xhr.responseText); + } catch (e) { + result = { + code: 503, // Service Unavailable + status: "Service Unavailable", + error: "Connection error", + errorCode: 2, // PlayFabErrorCode.ConnectionError + errorMessage: xhr.responseText + }; + } + + result.CallBackTimeMS = new Date() - startTime; + result.Request = request; + result.CustomData = customData; + return result; + }, + + authenticationContext: { + PlayFabId: null, + EntityId: null, + EntityType: null, + SessionTicket: null, + EntityToken: null + }, + + UpdateAuthenticationContext: function (authenticationContext, result) { + var authenticationContextUpdates = {}; + if(result.data.PlayFabId !== null) { + PlayFab._internalSettings.authenticationContext.PlayFabId = result.data.PlayFabId; + authenticationContextUpdates.PlayFabId = result.data.PlayFabId; + } + if(result.data.SessionTicket !== null) { + PlayFab._internalSettings.authenticationContext.SessionTicket = result.data.SessionTicket; + authenticationContextUpdates.SessionTicket = result.data.SessionTicket; + } + if (result.data.EntityToken !== null) { + PlayFab._internalSettings.authenticationContext.EntityId = result.data.EntityToken.Entity.Id; + authenticationContextUpdates.EntityId = result.data.EntityToken.Entity.Id; + PlayFab._internalSettings.authenticationContext.EntityType = result.data.EntityToken.Entity.Type; + authenticationContextUpdates.EntityType = result.data.EntityToken.Entity.Type; + PlayFab._internalSettings.authenticationContext.EntityToken = result.data.EntityToken.EntityToken; + authenticationContextUpdates.EntityToken = result.data.EntityToken.EntityToken; + } + // Update the authenticationContext with values from the result + authenticationContext = Object.assign(authenticationContext, authenticationContextUpdates); + return authenticationContext; + }, + + AuthInfoMap: { + "X-EntityToken": { + authAttr: "entityToken", + authError: "errorEntityToken" + }, + "X-Authorization": { + authAttr: "sessionTicket", + authError: "errorLoggedIn" + }, + "X-SecretKey": { + authAttr: "developerSecretKey", + authError: "errorSecretKey" + } + }, + + GetAuthInfo: function (request, authKey) { + // Use the most-recently saved authKey, unless one was provided in the request via the AuthenticationContext + var authError = PlayFab._internalSettings.AuthInfoMap[authKey].authError; + var authAttr = PlayFab._internalSettings.AuthInfoMap[authKey].authAttr; + var defaultAuthValue = null; + if (authAttr === "entityToken") + defaultAuthValue = PlayFab._internalSettings.entityToken; + else if (authAttr === "sessionTicket") + defaultAuthValue = PlayFab._internalSettings.sessionTicket; + else if (authAttr === "developerSecretKey") + defaultAuthValue = PlayFab.settings.developerSecretKey; + var authValue = request.AuthenticationContext ? request.AuthenticationContext[authAttr] : defaultAuthValue; + return {"authKey": authKey, "authValue": authValue, "authError": authError}; + }, + + ExecuteRequestWrapper: function (apiURL, request, authKey, callback, customData, extraHeaders) { + var authValue = null; + if (authKey !== null){ + var authInfo = PlayFab._internalSettings.GetAuthInfo(request, authKey=authKey); + var authKey = authInfo.authKey, authValue = authInfo.authValue, authError = authInfo.authError; + + if (!authValue) throw authError; + } + return PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + apiURL, request, authKey, authValue, callback, customData, extraHeaders); + } + } +} + +PlayFab.buildIdentifier = "adobuild_javascriptsdk_117"; +PlayFab.sdkVersion = "1.176.240802"; +PlayFab.GenerateErrorReport = function (error) { + if (error == null) + return ""; + var fullErrors = error.errorMessage; + for (var paramName in error.errorDetails) + for (var msgIdx in error.errorDetails[paramName]) + fullErrors += "\n" + paramName + ": " + error.errorDetails[paramName][msgIdx]; + return fullErrors; +}; + +PlayFab.LeaderboardsApi = { + ForgetAllCredentials: function () { + PlayFab._internalSettings.sessionTicket = null; + PlayFab._internalSettings.entityToken = null; + }, + + CreateLeaderboardDefinition: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Leaderboard/CreateLeaderboardDefinition", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + CreateStatisticDefinition: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Statistic/CreateStatisticDefinition", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + DeleteLeaderboardDefinition: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Leaderboard/DeleteLeaderboardDefinition", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + DeleteLeaderboardEntries: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Leaderboard/DeleteLeaderboardEntries", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + DeleteStatisticDefinition: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Statistic/DeleteStatisticDefinition", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + DeleteStatistics: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Statistic/DeleteStatistics", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + GetFriendLeaderboardForEntity: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Leaderboard/GetFriendLeaderboardForEntity", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + GetLeaderboard: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Leaderboard/GetLeaderboard", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + GetLeaderboardAroundEntity: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Leaderboard/GetLeaderboardAroundEntity", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + GetLeaderboardDefinition: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Leaderboard/GetLeaderboardDefinition", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + GetLeaderboardForEntities: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Leaderboard/GetLeaderboardForEntities", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + GetStatisticDefinition: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Statistic/GetStatisticDefinition", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + GetStatisticDefinitions: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Statistic/GetStatisticDefinitions", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + GetStatistics: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Statistic/GetStatistics", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + GetStatisticsForEntities: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Statistic/GetStatisticsForEntities", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + IncrementLeaderboardVersion: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Leaderboard/IncrementLeaderboardVersion", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + IncrementStatisticVersion: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Statistic/IncrementStatisticVersion", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + ListLeaderboardDefinitions: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Leaderboard/ListLeaderboardDefinitions", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + ListStatisticDefinitions: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Statistic/ListStatisticDefinitions", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + UnlinkLeaderboardFromStatistic: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Leaderboard/UnlinkLeaderboardFromStatistic", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + UpdateLeaderboardEntries: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Leaderboard/UpdateLeaderboardEntries", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + UpdateStatistics: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Statistic/UpdateStatistics", request, "X-EntityToken", callback, customData, extraHeaders); + }, + +}; + +var PlayFabLeaderboardsSDK = PlayFab.LeaderboardsApi; + diff --git a/PlayFabSdk/src/PlayFab/PlayFabLocalizationApi.js b/PlayFabSdk/src/PlayFab/PlayFabLocalizationApi.js index 3f50e88c..83b82e4f 100644 --- a/PlayFabSdk/src/PlayFab/PlayFabLocalizationApi.js +++ b/PlayFabSdk/src/PlayFab/PlayFabLocalizationApi.js @@ -14,9 +14,9 @@ if(!PlayFab.settings) { if(!PlayFab._internalSettings) { PlayFab._internalSettings = { entityToken: null, - sdkVersion: "1.175.240719", + sdkVersion: "1.176.240802", requestGetParams: { - sdk: "JavaScriptSDK-1.175.240719" + sdk: "JavaScriptSDK-1.176.240802" }, sessionTicket: null, verticalName: null, // The name of a customer vertical. This is only for customers running a private cluster. Generally you shouldn't touch this @@ -223,8 +223,8 @@ if(!PlayFab._internalSettings) { } } -PlayFab.buildIdentifier = "adobuild_javascriptsdk_115"; -PlayFab.sdkVersion = "1.175.240719"; +PlayFab.buildIdentifier = "adobuild_javascriptsdk_117"; +PlayFab.sdkVersion = "1.176.240802"; PlayFab.GenerateErrorReport = function (error) { if (error == null) return ""; diff --git a/PlayFabSdk/src/PlayFab/PlayFabMultiplayerApi.js b/PlayFabSdk/src/PlayFab/PlayFabMultiplayerApi.js index 4fcb043b..9c590960 100644 --- a/PlayFabSdk/src/PlayFab/PlayFabMultiplayerApi.js +++ b/PlayFabSdk/src/PlayFab/PlayFabMultiplayerApi.js @@ -14,9 +14,9 @@ if(!PlayFab.settings) { if(!PlayFab._internalSettings) { PlayFab._internalSettings = { entityToken: null, - sdkVersion: "1.175.240719", + sdkVersion: "1.176.240802", requestGetParams: { - sdk: "JavaScriptSDK-1.175.240719" + sdk: "JavaScriptSDK-1.176.240802" }, sessionTicket: null, verticalName: null, // The name of a customer vertical. This is only for customers running a private cluster. Generally you shouldn't touch this @@ -223,8 +223,8 @@ if(!PlayFab._internalSettings) { } } -PlayFab.buildIdentifier = "adobuild_javascriptsdk_115"; -PlayFab.sdkVersion = "1.175.240719"; +PlayFab.buildIdentifier = "adobuild_javascriptsdk_117"; +PlayFab.sdkVersion = "1.176.240802"; PlayFab.GenerateErrorReport = function (error) { if (error == null) return ""; diff --git a/PlayFabSdk/src/PlayFab/PlayFabProfilesApi.js b/PlayFabSdk/src/PlayFab/PlayFabProfilesApi.js index a8156391..6451bc46 100644 --- a/PlayFabSdk/src/PlayFab/PlayFabProfilesApi.js +++ b/PlayFabSdk/src/PlayFab/PlayFabProfilesApi.js @@ -14,9 +14,9 @@ if(!PlayFab.settings) { if(!PlayFab._internalSettings) { PlayFab._internalSettings = { entityToken: null, - sdkVersion: "1.175.240719", + sdkVersion: "1.176.240802", requestGetParams: { - sdk: "JavaScriptSDK-1.175.240719" + sdk: "JavaScriptSDK-1.176.240802" }, sessionTicket: null, verticalName: null, // The name of a customer vertical. This is only for customers running a private cluster. Generally you shouldn't touch this @@ -223,8 +223,8 @@ if(!PlayFab._internalSettings) { } } -PlayFab.buildIdentifier = "adobuild_javascriptsdk_115"; -PlayFab.sdkVersion = "1.175.240719"; +PlayFab.buildIdentifier = "adobuild_javascriptsdk_117"; +PlayFab.sdkVersion = "1.176.240802"; PlayFab.GenerateErrorReport = function (error) { if (error == null) return ""; diff --git a/PlayFabSdk/src/PlayFab/PlayFabServerApi.js b/PlayFabSdk/src/PlayFab/PlayFabServerApi.js index 37554061..e0d6024e 100644 --- a/PlayFabSdk/src/PlayFab/PlayFabServerApi.js +++ b/PlayFabSdk/src/PlayFab/PlayFabServerApi.js @@ -14,9 +14,9 @@ if(!PlayFab.settings) { if(!PlayFab._internalSettings) { PlayFab._internalSettings = { entityToken: null, - sdkVersion: "1.175.240719", + sdkVersion: "1.176.240802", requestGetParams: { - sdk: "JavaScriptSDK-1.175.240719" + sdk: "JavaScriptSDK-1.176.240802" }, sessionTicket: null, verticalName: null, // The name of a customer vertical. This is only for customers running a private cluster. Generally you shouldn't touch this @@ -223,8 +223,8 @@ if(!PlayFab._internalSettings) { } } -PlayFab.buildIdentifier = "adobuild_javascriptsdk_115"; -PlayFab.sdkVersion = "1.175.240719"; +PlayFab.buildIdentifier = "adobuild_javascriptsdk_117"; +PlayFab.sdkVersion = "1.176.240802"; PlayFab.GenerateErrorReport = function (error) { if (error == null) return ""; diff --git a/PlayFabSdk/src/Typings/PlayFab/PlayFabAdminApi.d.ts b/PlayFabSdk/src/Typings/PlayFab/PlayFabAdminApi.d.ts index 5edaef47..ca3fde7d 100644 --- a/PlayFabSdk/src/Typings/PlayFab/PlayFabAdminApi.d.ts +++ b/PlayFabSdk/src/Typings/PlayFab/PlayFabAdminApi.d.ts @@ -2569,7 +2569,11 @@ declare module PlayFabAdminModels { | "LinkedStatisticColumnNotFound" | "LinkedStatisticColumnRequired" | "MultipleLinkedStatisticsNotAllowed" + | "DuplicateLinkedStatisticColumnNameFound" + | "AggregationTypeNotAllowedForMultiColumnStatistic" | "MaxQueryableVerionsValueNotAllowedForTier" + | "StatisticDefinitionHasNullOrEmptyVersionConfiguration" + | "StatisticColumnLengthMismatch" | "MatchmakingEntityInvalid" | "MatchmakingPlayerAttributesInvalid" | "MatchmakingQueueNotFound" diff --git a/PlayFabSdk/src/Typings/PlayFab/PlayFabLeaderboardsApi.d.ts b/PlayFabSdk/src/Typings/PlayFab/PlayFabLeaderboardsApi.d.ts new file mode 100644 index 00000000..6c2e7695 --- /dev/null +++ b/PlayFabSdk/src/Typings/PlayFab/PlayFabLeaderboardsApi.d.ts @@ -0,0 +1,680 @@ +/// + +declare module PlayFabLeaderboardsModule { + export interface IPlayFabLeaderboards { + ForgetAllCredentials(): void; + + /** + * Creates a new leaderboard definition. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/leaderboards/createleaderboarddefinition + */ + CreateLeaderboardDefinition(request: PlayFabLeaderboardsModels.CreateLeaderboardDefinitionRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Create a new entity statistic definition. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/statistics-and-leaderboards/createstatisticdefinition + */ + CreateStatisticDefinition(request: PlayFabLeaderboardsModels.CreateStatisticDefinitionRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Deletes a leaderboard definition. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/leaderboards/deleteleaderboarddefinition + */ + DeleteLeaderboardDefinition(request: PlayFabLeaderboardsModels.DeleteLeaderboardDefinitionRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Deletes the specified entries from the given leaderboard. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/leaderboards/deleteleaderboardentries + */ + DeleteLeaderboardEntries(request: PlayFabLeaderboardsModels.DeleteLeaderboardEntriesRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Delete an entity statistic definition. Will delete all statistics on entity profiles and leaderboards. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/statistics-and-leaderboards/deletestatisticdefinition + */ + DeleteStatisticDefinition(request: PlayFabLeaderboardsModels.DeleteStatisticDefinitionRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Delete statistics on an entity profile. This will remove all rankings from associated leaderboards. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/statistics-and-leaderboards/deletestatistics + */ + DeleteStatistics(request: PlayFabLeaderboardsModels.DeleteStatisticsRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Get the friend leaderboard for the specified entity. A maximum of 100 friend entries are listed in the leaderboard. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/statistics-and-leaderboards/getfriendleaderboardforentity + */ + GetFriendLeaderboardForEntity(request: PlayFabLeaderboardsModels.GetFriendLeaderboardForEntityRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Get the leaderboard for a specific entity type and statistic. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/statistics-and-leaderboards/getleaderboard + */ + GetLeaderboard(request: PlayFabLeaderboardsModels.GetEntityLeaderboardRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Get the leaderboard around a specific entity. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/statistics-and-leaderboards/getleaderboardaroundentity + */ + GetLeaderboardAroundEntity(request: PlayFabLeaderboardsModels.GetLeaderboardAroundEntityRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Gets the specified leaderboard definition. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/leaderboards/getleaderboarddefinition + */ + GetLeaderboardDefinition(request: PlayFabLeaderboardsModels.GetLeaderboardDefinitionRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Get the leaderboard limited to a set of entities. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/statistics-and-leaderboards/getleaderboardforentities + */ + GetLeaderboardForEntities(request: PlayFabLeaderboardsModels.GetLeaderboardForEntitiesRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Get current statistic definition information + * https://docs.microsoft.com/rest/api/playfab/leaderboards/statistics-and-leaderboards/getstatisticdefinition + */ + GetStatisticDefinition(request: PlayFabLeaderboardsModels.GetStatisticDefinitionRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Get all current statistic definitions information + * https://docs.microsoft.com/rest/api/playfab/leaderboards/statistics-and-leaderboards/getstatisticdefinitions + */ + GetStatisticDefinitions(request: PlayFabLeaderboardsModels.GetStatisticDefinitionsRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Gets statistics for the specified entity. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/statistics-and-leaderboards/getstatistics + */ + GetStatistics(request: PlayFabLeaderboardsModels.GetStatisticsRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Gets statistics for the specified collection of entities. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/statistics-and-leaderboards/getstatisticsforentities + */ + GetStatisticsForEntities(request: PlayFabLeaderboardsModels.GetStatisticsForEntitiesRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Increment a leaderboard version. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/leaderboards/incrementleaderboardversion + */ + IncrementLeaderboardVersion(request: PlayFabLeaderboardsModels.IncrementLeaderboardVersionRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Increment an entity statistic definition version. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/statistics-and-leaderboards/incrementstatisticversion + */ + IncrementStatisticVersion(request: PlayFabLeaderboardsModels.IncrementStatisticVersionRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Lists the leaderboard definitions defined for the Title. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/leaderboards/listleaderboarddefinitions + */ + ListLeaderboardDefinitions(request: PlayFabLeaderboardsModels.ListLeaderboardDefinitionsRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Get all current statistic definitions information + * https://docs.microsoft.com/rest/api/playfab/leaderboards/statistics-and-leaderboards/liststatisticdefinitions + */ + ListStatisticDefinitions(request: PlayFabLeaderboardsModels.ListStatisticDefinitionsRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Unlinks a leaderboard definition from it's linked statistic definition. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/leaderboards/unlinkleaderboardfromstatistic + */ + UnlinkLeaderboardFromStatistic(request: PlayFabLeaderboardsModels.UnlinkLeaderboardFromStatisticRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Adds or updates entries on the specified leaderboard. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/leaderboards/updateleaderboardentries + */ + UpdateLeaderboardEntries(request: PlayFabLeaderboardsModels.UpdateLeaderboardEntriesRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Update statistics on an entity profile. Depending on the statistic definition, this may result in entity being ranked on + * various leaderboards. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/statistics-and-leaderboards/updatestatistics + */ + UpdateStatistics(request: PlayFabLeaderboardsModels.UpdateStatisticsRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + + } +} + +declare module PlayFabLeaderboardsModels { + export interface CreateLeaderboardDefinitionRequest extends PlayFabModule.IPlayFabRequestCommon { + /** Leaderboard columns describing the sort directions, cannot be changed after creation. */ + Columns: LeaderboardColumn[]; + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** + * The entity type being represented on the leaderboard. If it doesn't correspond to the PlayFab entity types, use + * 'external' as the type. + */ + EntityType: string; + /** A name for the leaderboard, unique per title. */ + Name: string; + /** Maximum number of entries on this leaderboard */ + SizeLimit: number; + /** The version reset configuration for the leaderboard definition. */ + VersionConfiguration: VersionConfiguration; + + } + + export interface CreateStatisticDefinitionRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The columns for the statistic defining the aggregation method for each column. */ + Columns?: StatisticColumn[]; + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** The entity type allowed to have score(s) for this statistic. */ + EntityType?: string; + /** Name of the statistic. Must be less than 50 characters. Restricted to a-Z, 0-9, '(', ')', '_', '-' and '.'. */ + Name: string; + /** The version reset configuration for the statistic definition. */ + VersionConfiguration?: VersionConfiguration; + + } + + export interface DeleteLeaderboardDefinitionRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** The name of the leaderboard definition to delete. */ + Name: string; + + } + + export interface DeleteLeaderboardEntriesRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** The unique Ids of the entries to delete from the leaderboard. */ + EntityIds?: string[]; + /** The name of the leaderboard. */ + Name: string; + + } + + export interface DeleteStatisticDefinitionRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** Name of the statistic to delete. */ + Name: string; + + } + + export interface DeleteStatisticsRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** The optional entity to perform this action on. Defaults to the currently logged in entity. */ + Entity?: EntityKey; + /** Collection of statistics to remove from this entity. */ + Statistics: StatisticDelete[]; + + } + + export interface DeleteStatisticsResponse extends PlayFabModule.IPlayFabResultCommon { + /** The entity id and type. */ + Entity?: EntityKey; + + } + + export interface EmptyResponse extends PlayFabModule.IPlayFabResultCommon { + + } + + export interface EntityKey { + /** Unique ID of the entity. */ + Id: string; + /** Entity type. See https://docs.microsoft.com/gaming/playfab/features/data/entities/available-built-in-entity-types */ + Type?: string; + + } + + export interface EntityLeaderboardEntry { + /** Entity's display name. */ + DisplayName?: string; + /** Entity identifier. */ + Entity?: EntityKey; + /** The time at which the last update to the entry was recorded on the server. */ + LastUpdated: string; + /** An opaque blob of data stored on the leaderboard entry. Note that the metadata is not used for ranking purposes. */ + Metadata?: string; + /** Position on the leaderboard. */ + Rank: number; + /** Scores for the entry. */ + Scores?: string[]; + + } + + export interface EntityStatistics { + /** Entity key */ + EntityKey?: EntityKey; + /** All statistics for the given entitykey */ + Statistics?: EntityStatisticValue[]; + + } + + export interface EntityStatisticValue { + /** Metadata associated with the Statistic. */ + Metadata?: string; + /** Statistic name */ + Name?: string; + /** Statistic scores */ + Scores?: string[]; + /** Statistic version */ + Version: number; + + } + + type ExternalFriendSources = "None" + + | "Steam" + | "Facebook" + | "Xbox" + | "Psn" + | "All"; + + export interface GetEntityLeaderboardRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** Name of the leaderboard. */ + LeaderboardName: string; + /** Maximum number of results to return from the leaderboard. Minimum 1, maximum 1,000. */ + PageSize: number; + /** Index position to start from. 1 is beginning of leaderboard. */ + StartingPosition?: number; + /** Optional version of the leaderboard, defaults to current version. */ + Version?: number; + + } + + export interface GetEntityLeaderboardResponse extends PlayFabModule.IPlayFabResultCommon { + /** Leaderboard columns describing the sort directions, */ + Columns?: LeaderboardColumn[]; + /** Individual entity rankings in the leaderboard, in sorted order by rank. */ + Rankings?: EntityLeaderboardEntry[]; + /** Version of the leaderboard being returned. */ + Version: number; + + } + + export interface GetFriendLeaderboardForEntityRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** The optional entity to perform this action on. Defaults to the currently logged in entity. */ + Entity?: EntityKey; + /** + * Indicates which other platforms' friends should be included in the response. In HTTP, it is represented as a + * comma-separated list of platforms. + */ + ExternalFriendSources?: string; + /** Name of the leaderboard. */ + LeaderboardName: string; + /** Optional version of the leaderboard, defaults to current version. */ + Version?: number; + /** Xbox token if Xbox friends should be included. Requires Xbox be configured on PlayFab. */ + XboxToken?: string; + + } + + export interface GetLeaderboardAroundEntityRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** The optional entity to perform this action on. Defaults to the currently logged in entity. */ + Entity?: EntityKey; + /** Name of the leaderboard. */ + LeaderboardName: string; + /** + * Number of surrounding entries to return (in addition to specified entity). In general, the number of ranks above and + * below will be split into half. For example, if the specified value is 10, 5 ranks above and 5 ranks below will be + * retrieved. However, the numbers will get skewed in either direction when the specified entity is towards the top or + * bottom of the leaderboard. Also, the number of entries returned can be lower than the value specified for entries at the + * bottom of the leaderboard. + */ + MaxSurroundingEntries: number; + /** Optional version of the leaderboard, defaults to current. */ + Version?: number; + + } + + export interface GetLeaderboardDefinitionRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** The name of the leaderboard to retrieve the definition for. */ + Name: string; + + } + + export interface GetLeaderboardDefinitionResponse extends PlayFabModule.IPlayFabResultCommon { + /** Sort direction of the leaderboard columns, cannot be changed after creation. */ + Columns: LeaderboardColumn[]; + /** Created time, in UTC */ + Created: string; + /** + * The entity type being represented on the leaderboard. If it doesn't correspond to the PlayFab entity types, use + * 'external' as the type. + */ + EntityType: string; + /** Last time, in UTC, leaderboard version was incremented. */ + LastResetTime?: string; + /** A name for the leaderboard, unique per title. */ + Name: string; + /** Maximum number of entries on this leaderboard */ + SizeLimit: number; + /** Latest Leaderboard version. */ + Version: number; + /** The version reset configuration for the leaderboard definition. */ + VersionConfiguration: VersionConfiguration; + + } + + export interface GetLeaderboardForEntitiesRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** Collection of Entity IDs to include in the leaderboard. */ + EntityIds: string[]; + /** Name of the leaderboard. */ + LeaderboardName: string; + /** Optional version of the leaderboard, defaults to current. */ + Version?: number; + + } + + export interface GetStatisticDefinitionRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** Name of the statistic. Must be less than 50 characters. */ + Name: string; + + } + + export interface GetStatisticDefinitionResponse extends PlayFabModule.IPlayFabResultCommon { + /** The columns for the statistic defining the aggregation method for each column. */ + Columns?: StatisticColumn[]; + /** Created time, in UTC */ + Created: string; + /** The entity type that can have this statistic. */ + EntityType?: string; + /** Last time, in UTC, statistic version was incremented. */ + LastResetTime?: string; + /** The list of leaderboards that are linked to this statistic definition. */ + LinkedLeaderboardNames?: string[]; + /** Name of the statistic. */ + Name?: string; + /** Statistic version. */ + Version: number; + /** The version reset configuration for the leaderboard definition. */ + VersionConfiguration?: VersionConfiguration; + + } + + export interface GetStatisticDefinitionsRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + + } + + export interface GetStatisticDefinitionsResponse extends PlayFabModule.IPlayFabResultCommon { + /** List of statistic definitions for the title. */ + StatisticDefinitions?: StatisticDefinition[]; + + } + + export interface GetStatisticsForEntitiesRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** Collection of Entity IDs to retrieve statistics for. */ + Entities: EntityKey[]; + + } + + export interface GetStatisticsForEntitiesResponse extends PlayFabModule.IPlayFabResultCommon { + /** A mapping of statistic name to the columns defined in the corresponding definition. */ + ColumnDetails?: { [key: string]: StatisticColumnCollection }; + /** List of entities mapped to their statistics. Only the latest version of a statistic is returned. */ + EntitiesStatistics?: EntityStatistics[]; + + } + + export interface GetStatisticsRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** The optional entity to perform this action on. Defaults to the currently logged in entity. */ + Entity?: EntityKey; + + } + + export interface GetStatisticsResponse extends PlayFabModule.IPlayFabResultCommon { + /** A mapping of statistic name to the columns defined in the corresponding definition. */ + ColumnDetails?: { [key: string]: StatisticColumnCollection }; + /** The entity id and type. */ + Entity?: EntityKey; + /** List of statistics keyed by Name. Only the latest version of a statistic is returned. */ + Statistics?: { [key: string]: EntityStatisticValue }; + + } + + export interface IncrementLeaderboardVersionRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** The name of the leaderboard to increment the version for. */ + Name: string; + + } + + export interface IncrementLeaderboardVersionResponse extends PlayFabModule.IPlayFabResultCommon { + /** New Leaderboard version. */ + Version: number; + + } + + export interface IncrementStatisticVersionRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** Name of the statistic to increment the version of. */ + Name: string; + + } + + export interface IncrementStatisticVersionResponse extends PlayFabModule.IPlayFabResultCommon { + /** New statistic version. */ + Version: number; + + } + + export interface LeaderboardColumn { + /** + * If the value for this column is sourced from a statistic, details of the linked column. Null if the leaderboard is not + * linked. + */ + LinkedStatisticColumn?: LinkedStatisticColumn; + /** A name for the leaderboard column, unique per leaderboard definition. */ + Name: string; + /** The sort direction for this column. */ + SortDirection: string; + + } + + export interface LeaderboardDefinition { + /** Sort direction of the leaderboard columns, cannot be changed after creation. */ + Columns: LeaderboardColumn[]; + /** Created time, in UTC */ + Created: string; + /** + * The entity type being represented on the leaderboard. If it doesn't correspond to the PlayFab entity types, use + * 'external' as the type. + */ + EntityType: string; + /** Last time, in UTC, leaderboard version was incremented. */ + LastResetTime?: string; + /** A name for the leaderboard, unique per title. */ + Name: string; + /** Maximum number of entries on this leaderboard */ + SizeLimit: number; + /** Latest Leaderboard version. */ + Version: number; + /** The version reset configuration for the leaderboard definition. */ + VersionConfiguration: VersionConfiguration; + + } + + export interface LeaderboardEntryUpdate { + /** The unique Id for the entry. If using PlayFab Entities, this would be the entityId of the entity. */ + EntityId: string; + /** + * Arbitrary metadata to store along side the leaderboard entry, will be returned by all Leaderboard APIs. Must be less + * than 50 UTF8 encoded characters. + */ + Metadata?: string; + /** + * The scores for the leaderboard. The number of values provided here must match the number of columns in the Leaderboard + * definition. + */ + Scores?: string[]; + + } + + type LeaderboardSortDirection = "Descending" + + | "Ascending"; + + export interface LinkedStatisticColumn { + /** The name of the statistic column that this leaderboard column is sourced from. */ + LinkedStatisticColumnName: string; + /** The name of the statistic. */ + LinkedStatisticName: string; + + } + + export interface ListLeaderboardDefinitionsRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + + } + + export interface ListLeaderboardDefinitionsResponse extends PlayFabModule.IPlayFabResultCommon { + /** List of leaderboard definitions for the title. */ + LeaderboardDefinitions?: LeaderboardDefinition[]; + + } + + export interface ListStatisticDefinitionsRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + + } + + export interface ListStatisticDefinitionsResponse extends PlayFabModule.IPlayFabResultCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** List of statistic definitions for the title. */ + StatisticDefinitions?: StatisticDefinition[]; + + } + + type ResetInterval = "Manual" + + | "Hour" + | "Day" + | "Week" + | "Month"; + + type StatisticAggregationMethod = "Last" + + | "Min" + | "Max" + | "Sum"; + + export interface StatisticColumn { + /** Aggregation method for calculating new value of a statistic. */ + AggregationMethod: string; + /** Name of the statistic column, as originally configured. */ + Name: string; + + } + + export interface StatisticColumnCollection { + /** Columns for the statistic defining the aggregation method for each column. */ + Columns?: StatisticColumn[]; + + } + + export interface StatisticDefinition { + /** The columns for the statistic defining the aggregation method for each column. */ + Columns?: StatisticColumn[]; + /** Created time, in UTC */ + Created: string; + /** The entity type that can have this statistic. */ + EntityType?: string; + /** Last time, in UTC, statistic version was incremented. */ + LastResetTime?: string; + /** The list of leaderboards that are linked to this statistic definition. */ + LinkedLeaderboardNames?: string[]; + /** Name of the statistic. */ + Name?: string; + /** Statistic version. */ + Version: number; + /** The version reset configuration for the leaderboard definition. */ + VersionConfiguration?: VersionConfiguration; + + } + + export interface StatisticDelete { + /** Name of the statistic, as originally configured. */ + Name: string; + + } + + export interface StatisticUpdate { + /** + * Arbitrary metadata to store along side the statistic, will be returned by all Leaderboard APIs. Must be less than 50 + * UTF8 encoded characters. + */ + Metadata?: string; + /** Name of the statistic, as originally configured. */ + Name: string; + /** + * Statistic scores for the entity. This will be used in accordance with the aggregation method configured for the + * statistics.The maximum value allowed for each individual score is 9223372036854775807. The minimum value for each + * individual score is -9223372036854775807The values are formatted as strings to avoid interop issues with client + * libraries unable to handle 64bit integers. + */ + Scores?: string[]; + /** Optional field to indicate the version of the statistic to set. When empty defaults to the statistic's current version. */ + Version?: number; + + } + + export interface UnlinkLeaderboardFromStatisticRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** The name of the leaderboard definition to unlink. */ + Name: string; + /** The name of the statistic definition to unlink. */ + StatisticName: string; + + } + + export interface UpdateLeaderboardEntriesRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** The entries to add or update on the leaderboard. */ + Entries?: LeaderboardEntryUpdate[]; + /** The name of the leaderboard. */ + LeaderboardName: string; + + } + + export interface UpdateStatisticsRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** The optional entity to perform this action on. Defaults to the currently logged in entity. */ + Entity?: EntityKey; + /** Collection of statistics to update, maximum 50. */ + Statistics: StatisticUpdate[]; + + } + + export interface UpdateStatisticsResponse extends PlayFabModule.IPlayFabResultCommon { + /** A mapping of statistic name to the columns defined in the corresponding definition. */ + ColumnDetails?: { [key: string]: StatisticColumnCollection }; + /** The entity id and type. */ + Entity?: EntityKey; + /** Updated entity profile statistics. */ + Statistics?: { [key: string]: EntityStatisticValue }; + + } + + export interface VersionConfiguration { + /** The maximum number of versions of this leaderboard/statistic that can be queried. */ + MaxQueryableVersions: number; + /** + * Reset interval that statistics or leaderboards will reset on. When using Manual intervalthe reset can only be increased + * by calling the Increase version API. When using Hour interval the resetwill occur at the start of the next hour UTC + * time. When using Day interval the reset will occur at thestart of the next day in UTC time. When using the Week interval + * the reset will occur at the start ofthe next Monday in UTC time. When using Month interval the reset will occur at the + * start of the nextmonth in UTC time. + */ + ResetInterval: string; + + } + + +} diff --git a/PlayFabSdk/src/Typings/PlayFab/PlayFabServerApi.d.ts b/PlayFabSdk/src/Typings/PlayFab/PlayFabServerApi.d.ts index 4ff9b455..9b2be511 100644 --- a/PlayFabSdk/src/Typings/PlayFab/PlayFabServerApi.d.ts +++ b/PlayFabSdk/src/Typings/PlayFab/PlayFabServerApi.d.ts @@ -2396,7 +2396,11 @@ declare module PlayFabServerModels { | "LinkedStatisticColumnNotFound" | "LinkedStatisticColumnRequired" | "MultipleLinkedStatisticsNotAllowed" + | "DuplicateLinkedStatisticColumnNameFound" + | "AggregationTypeNotAllowedForMultiColumnStatistic" | "MaxQueryableVerionsValueNotAllowedForTier" + | "StatisticDefinitionHasNullOrEmptyVersionConfiguration" + | "StatisticColumnLengthMismatch" | "MatchmakingEntityInvalid" | "MatchmakingPlayerAttributesInvalid" | "MatchmakingQueueNotFound" @@ -3823,7 +3827,7 @@ declare module PlayFabServerModels { IssuerId?: number; /** Unique PlayFab assigned ID of the user on whom the operation will be performed. */ PlayFabId: string; - /** Id of the PlayStation :tm: Network user. */ + /** Id of the PlayStation :tm: Network user. Also known as the PSN Account Id. */ PSNUserId: string; } diff --git a/PlayFabSdk/src/Typings/PlayFab/Playfab.d.ts b/PlayFabSdk/src/Typings/PlayFab/Playfab.d.ts index 83b58b30..c646e249 100644 --- a/PlayFabSdk/src/Typings/PlayFab/Playfab.d.ts +++ b/PlayFabSdk/src/Typings/PlayFab/Playfab.d.ts @@ -9,6 +9,7 @@ /// /// /// +/// /// /// /// @@ -56,6 +57,7 @@ declare var PlayFab: { ExperimentationApi: PlayFabExperimentationModule.IPlayFabExperimentation; InsightsApi: PlayFabInsightsModule.IPlayFabInsights; GroupsApi: PlayFabGroupsModule.IPlayFabGroups; + LeaderboardsApi: PlayFabLeaderboardsModule.IPlayFabLeaderboards; LocalizationApi: PlayFabLocalizationModule.IPlayFabLocalization; MultiplayerApi: PlayFabMultiplayerModule.IPlayFabMultiplayer; ProfilesApi: PlayFabProfilesModule.IPlayFabProfiles; @@ -73,6 +75,7 @@ declare var PlayFabEventsSDK: PlayFabEventsModule.IPlayFabEvents; declare var PlayFabExperimentationSDK: PlayFabExperimentationModule.IPlayFabExperimentation; declare var PlayFabInsightsSDK: PlayFabInsightsModule.IPlayFabInsights; declare var PlayFabGroupsSDK: PlayFabGroupsModule.IPlayFabGroups; +declare var PlayFabLeaderboardsSDK: PlayFabLeaderboardsModule.IPlayFabLeaderboards; declare var PlayFabLocalizationSDK: PlayFabLocalizationModule.IPlayFabLocalization; declare var PlayFabMultiplayerSDK: PlayFabMultiplayerModule.IPlayFabMultiplayer; declare var PlayFabProfilesSDK: PlayFabProfilesModule.IPlayFabProfiles; diff --git a/PlayFabTestingExample/PlayFabApiTest.csproj b/PlayFabTestingExample/PlayFabApiTest.csproj index dd1c9eba..6d80b641 100644 --- a/PlayFabTestingExample/PlayFabApiTest.csproj +++ b/PlayFabTestingExample/PlayFabApiTest.csproj @@ -35,6 +35,7 @@ + @@ -54,6 +55,7 @@ + diff --git a/PlayFabTestingExample/index.html b/PlayFabTestingExample/index.html index 724b0b69..3c6b3272 100644 --- a/PlayFabTestingExample/index.html +++ b/PlayFabTestingExample/index.html @@ -21,6 +21,7 @@ + diff --git a/PlayFabTestingExample/src/PlayFab/PlayFabAdminApi.js b/PlayFabTestingExample/src/PlayFab/PlayFabAdminApi.js index 39b83a8b..2085abfc 100644 --- a/PlayFabTestingExample/src/PlayFab/PlayFabAdminApi.js +++ b/PlayFabTestingExample/src/PlayFab/PlayFabAdminApi.js @@ -14,9 +14,9 @@ if(!PlayFab.settings) { if(!PlayFab._internalSettings) { PlayFab._internalSettings = { entityToken: null, - sdkVersion: "1.175.240719", + sdkVersion: "1.176.240802", requestGetParams: { - sdk: "JavaScriptSDK-1.175.240719" + sdk: "JavaScriptSDK-1.176.240802" }, sessionTicket: null, verticalName: null, // The name of a customer vertical. This is only for customers running a private cluster. Generally you shouldn't touch this @@ -223,8 +223,8 @@ if(!PlayFab._internalSettings) { } } -PlayFab.buildIdentifier = "adobuild_javascriptsdk_115"; -PlayFab.sdkVersion = "1.175.240719"; +PlayFab.buildIdentifier = "adobuild_javascriptsdk_117"; +PlayFab.sdkVersion = "1.176.240802"; PlayFab.GenerateErrorReport = function (error) { if (error == null) return ""; diff --git a/PlayFabTestingExample/src/PlayFab/PlayFabAuthenticationApi.js b/PlayFabTestingExample/src/PlayFab/PlayFabAuthenticationApi.js index eff9e7b9..114bf710 100644 --- a/PlayFabTestingExample/src/PlayFab/PlayFabAuthenticationApi.js +++ b/PlayFabTestingExample/src/PlayFab/PlayFabAuthenticationApi.js @@ -14,9 +14,9 @@ if(!PlayFab.settings) { if(!PlayFab._internalSettings) { PlayFab._internalSettings = { entityToken: null, - sdkVersion: "1.175.240719", + sdkVersion: "1.176.240802", requestGetParams: { - sdk: "JavaScriptSDK-1.175.240719" + sdk: "JavaScriptSDK-1.176.240802" }, sessionTicket: null, verticalName: null, // The name of a customer vertical. This is only for customers running a private cluster. Generally you shouldn't touch this @@ -223,8 +223,8 @@ if(!PlayFab._internalSettings) { } } -PlayFab.buildIdentifier = "adobuild_javascriptsdk_115"; -PlayFab.sdkVersion = "1.175.240719"; +PlayFab.buildIdentifier = "adobuild_javascriptsdk_117"; +PlayFab.sdkVersion = "1.176.240802"; PlayFab.GenerateErrorReport = function (error) { if (error == null) return ""; diff --git a/PlayFabTestingExample/src/PlayFab/PlayFabClientApi.js b/PlayFabTestingExample/src/PlayFab/PlayFabClientApi.js index 214ed874..b3bc6c4a 100644 --- a/PlayFabTestingExample/src/PlayFab/PlayFabClientApi.js +++ b/PlayFabTestingExample/src/PlayFab/PlayFabClientApi.js @@ -14,9 +14,9 @@ if(!PlayFab.settings) { if(!PlayFab._internalSettings) { PlayFab._internalSettings = { entityToken: null, - sdkVersion: "1.175.240719", + sdkVersion: "1.176.240802", requestGetParams: { - sdk: "JavaScriptSDK-1.175.240719" + sdk: "JavaScriptSDK-1.176.240802" }, sessionTicket: null, verticalName: null, // The name of a customer vertical. This is only for customers running a private cluster. Generally you shouldn't touch this @@ -223,8 +223,8 @@ if(!PlayFab._internalSettings) { } } -PlayFab.buildIdentifier = "adobuild_javascriptsdk_115"; -PlayFab.sdkVersion = "1.175.240719"; +PlayFab.buildIdentifier = "adobuild_javascriptsdk_117"; +PlayFab.sdkVersion = "1.176.240802"; PlayFab.GenerateErrorReport = function (error) { if (error == null) return ""; diff --git a/PlayFabTestingExample/src/PlayFab/PlayFabCloudScriptApi.js b/PlayFabTestingExample/src/PlayFab/PlayFabCloudScriptApi.js index 55ea90cf..e9d19a2c 100644 --- a/PlayFabTestingExample/src/PlayFab/PlayFabCloudScriptApi.js +++ b/PlayFabTestingExample/src/PlayFab/PlayFabCloudScriptApi.js @@ -14,9 +14,9 @@ if(!PlayFab.settings) { if(!PlayFab._internalSettings) { PlayFab._internalSettings = { entityToken: null, - sdkVersion: "1.175.240719", + sdkVersion: "1.176.240802", requestGetParams: { - sdk: "JavaScriptSDK-1.175.240719" + sdk: "JavaScriptSDK-1.176.240802" }, sessionTicket: null, verticalName: null, // The name of a customer vertical. This is only for customers running a private cluster. Generally you shouldn't touch this @@ -223,8 +223,8 @@ if(!PlayFab._internalSettings) { } } -PlayFab.buildIdentifier = "adobuild_javascriptsdk_115"; -PlayFab.sdkVersion = "1.175.240719"; +PlayFab.buildIdentifier = "adobuild_javascriptsdk_117"; +PlayFab.sdkVersion = "1.176.240802"; PlayFab.GenerateErrorReport = function (error) { if (error == null) return ""; diff --git a/PlayFabTestingExample/src/PlayFab/PlayFabDataApi.js b/PlayFabTestingExample/src/PlayFab/PlayFabDataApi.js index 81a18c4e..f75a22b0 100644 --- a/PlayFabTestingExample/src/PlayFab/PlayFabDataApi.js +++ b/PlayFabTestingExample/src/PlayFab/PlayFabDataApi.js @@ -14,9 +14,9 @@ if(!PlayFab.settings) { if(!PlayFab._internalSettings) { PlayFab._internalSettings = { entityToken: null, - sdkVersion: "1.175.240719", + sdkVersion: "1.176.240802", requestGetParams: { - sdk: "JavaScriptSDK-1.175.240719" + sdk: "JavaScriptSDK-1.176.240802" }, sessionTicket: null, verticalName: null, // The name of a customer vertical. This is only for customers running a private cluster. Generally you shouldn't touch this @@ -223,8 +223,8 @@ if(!PlayFab._internalSettings) { } } -PlayFab.buildIdentifier = "adobuild_javascriptsdk_115"; -PlayFab.sdkVersion = "1.175.240719"; +PlayFab.buildIdentifier = "adobuild_javascriptsdk_117"; +PlayFab.sdkVersion = "1.176.240802"; PlayFab.GenerateErrorReport = function (error) { if (error == null) return ""; diff --git a/PlayFabTestingExample/src/PlayFab/PlayFabEconomyApi.js b/PlayFabTestingExample/src/PlayFab/PlayFabEconomyApi.js index b9f164e5..cef1a5c3 100644 --- a/PlayFabTestingExample/src/PlayFab/PlayFabEconomyApi.js +++ b/PlayFabTestingExample/src/PlayFab/PlayFabEconomyApi.js @@ -14,9 +14,9 @@ if(!PlayFab.settings) { if(!PlayFab._internalSettings) { PlayFab._internalSettings = { entityToken: null, - sdkVersion: "1.175.240719", + sdkVersion: "1.176.240802", requestGetParams: { - sdk: "JavaScriptSDK-1.175.240719" + sdk: "JavaScriptSDK-1.176.240802" }, sessionTicket: null, verticalName: null, // The name of a customer vertical. This is only for customers running a private cluster. Generally you shouldn't touch this @@ -223,8 +223,8 @@ if(!PlayFab._internalSettings) { } } -PlayFab.buildIdentifier = "adobuild_javascriptsdk_115"; -PlayFab.sdkVersion = "1.175.240719"; +PlayFab.buildIdentifier = "adobuild_javascriptsdk_117"; +PlayFab.sdkVersion = "1.176.240802"; PlayFab.GenerateErrorReport = function (error) { if (error == null) return ""; diff --git a/PlayFabTestingExample/src/PlayFab/PlayFabEventsApi.js b/PlayFabTestingExample/src/PlayFab/PlayFabEventsApi.js index 9fa6f08b..775507b9 100644 --- a/PlayFabTestingExample/src/PlayFab/PlayFabEventsApi.js +++ b/PlayFabTestingExample/src/PlayFab/PlayFabEventsApi.js @@ -14,9 +14,9 @@ if(!PlayFab.settings) { if(!PlayFab._internalSettings) { PlayFab._internalSettings = { entityToken: null, - sdkVersion: "1.175.240719", + sdkVersion: "1.176.240802", requestGetParams: { - sdk: "JavaScriptSDK-1.175.240719" + sdk: "JavaScriptSDK-1.176.240802" }, sessionTicket: null, verticalName: null, // The name of a customer vertical. This is only for customers running a private cluster. Generally you shouldn't touch this @@ -223,8 +223,8 @@ if(!PlayFab._internalSettings) { } } -PlayFab.buildIdentifier = "adobuild_javascriptsdk_115"; -PlayFab.sdkVersion = "1.175.240719"; +PlayFab.buildIdentifier = "adobuild_javascriptsdk_117"; +PlayFab.sdkVersion = "1.176.240802"; PlayFab.GenerateErrorReport = function (error) { if (error == null) return ""; diff --git a/PlayFabTestingExample/src/PlayFab/PlayFabExperimentationApi.js b/PlayFabTestingExample/src/PlayFab/PlayFabExperimentationApi.js index 581acf2d..1b83781e 100644 --- a/PlayFabTestingExample/src/PlayFab/PlayFabExperimentationApi.js +++ b/PlayFabTestingExample/src/PlayFab/PlayFabExperimentationApi.js @@ -14,9 +14,9 @@ if(!PlayFab.settings) { if(!PlayFab._internalSettings) { PlayFab._internalSettings = { entityToken: null, - sdkVersion: "1.175.240719", + sdkVersion: "1.176.240802", requestGetParams: { - sdk: "JavaScriptSDK-1.175.240719" + sdk: "JavaScriptSDK-1.176.240802" }, sessionTicket: null, verticalName: null, // The name of a customer vertical. This is only for customers running a private cluster. Generally you shouldn't touch this @@ -223,8 +223,8 @@ if(!PlayFab._internalSettings) { } } -PlayFab.buildIdentifier = "adobuild_javascriptsdk_115"; -PlayFab.sdkVersion = "1.175.240719"; +PlayFab.buildIdentifier = "adobuild_javascriptsdk_117"; +PlayFab.sdkVersion = "1.176.240802"; PlayFab.GenerateErrorReport = function (error) { if (error == null) return ""; diff --git a/PlayFabTestingExample/src/PlayFab/PlayFabGroupsApi.js b/PlayFabTestingExample/src/PlayFab/PlayFabGroupsApi.js index c770f22a..a3dc3c03 100644 --- a/PlayFabTestingExample/src/PlayFab/PlayFabGroupsApi.js +++ b/PlayFabTestingExample/src/PlayFab/PlayFabGroupsApi.js @@ -14,9 +14,9 @@ if(!PlayFab.settings) { if(!PlayFab._internalSettings) { PlayFab._internalSettings = { entityToken: null, - sdkVersion: "1.175.240719", + sdkVersion: "1.176.240802", requestGetParams: { - sdk: "JavaScriptSDK-1.175.240719" + sdk: "JavaScriptSDK-1.176.240802" }, sessionTicket: null, verticalName: null, // The name of a customer vertical. This is only for customers running a private cluster. Generally you shouldn't touch this @@ -223,8 +223,8 @@ if(!PlayFab._internalSettings) { } } -PlayFab.buildIdentifier = "adobuild_javascriptsdk_115"; -PlayFab.sdkVersion = "1.175.240719"; +PlayFab.buildIdentifier = "adobuild_javascriptsdk_117"; +PlayFab.sdkVersion = "1.176.240802"; PlayFab.GenerateErrorReport = function (error) { if (error == null) return ""; diff --git a/PlayFabTestingExample/src/PlayFab/PlayFabInsightsApi.js b/PlayFabTestingExample/src/PlayFab/PlayFabInsightsApi.js index d35419f1..ffed01c1 100644 --- a/PlayFabTestingExample/src/PlayFab/PlayFabInsightsApi.js +++ b/PlayFabTestingExample/src/PlayFab/PlayFabInsightsApi.js @@ -14,9 +14,9 @@ if(!PlayFab.settings) { if(!PlayFab._internalSettings) { PlayFab._internalSettings = { entityToken: null, - sdkVersion: "1.175.240719", + sdkVersion: "1.176.240802", requestGetParams: { - sdk: "JavaScriptSDK-1.175.240719" + sdk: "JavaScriptSDK-1.176.240802" }, sessionTicket: null, verticalName: null, // The name of a customer vertical. This is only for customers running a private cluster. Generally you shouldn't touch this @@ -223,8 +223,8 @@ if(!PlayFab._internalSettings) { } } -PlayFab.buildIdentifier = "adobuild_javascriptsdk_115"; -PlayFab.sdkVersion = "1.175.240719"; +PlayFab.buildIdentifier = "adobuild_javascriptsdk_117"; +PlayFab.sdkVersion = "1.176.240802"; PlayFab.GenerateErrorReport = function (error) { if (error == null) return ""; diff --git a/PlayFabTestingExample/src/PlayFab/PlayFabLeaderboardsApi.js b/PlayFabTestingExample/src/PlayFab/PlayFabLeaderboardsApi.js new file mode 100644 index 00000000..a1c296fd --- /dev/null +++ b/PlayFabTestingExample/src/PlayFab/PlayFabLeaderboardsApi.js @@ -0,0 +1,335 @@ +/// + +var PlayFab = typeof PlayFab != "undefined" ? PlayFab : {}; + +if(!PlayFab.settings) { + PlayFab.settings = { + titleId: null, // You must set this value for PlayFabSdk to work properly (Found in the Game Manager for your title, at the PlayFab Website) + developerSecretKey: null, // For security reasons you must never expose this value to the client or players - You must set this value for Server-APIs to work properly (Found in the Game Manager for your title, at the PlayFab Website) + GlobalHeaderInjection: null, + productionServerUrl: ".playfabapi.com" + } +} + +if(!PlayFab._internalSettings) { + PlayFab._internalSettings = { + entityToken: null, + sdkVersion: "1.176.240802", + requestGetParams: { + sdk: "JavaScriptSDK-1.176.240802" + }, + sessionTicket: null, + verticalName: null, // The name of a customer vertical. This is only for customers running a private cluster. Generally you shouldn't touch this + errorTitleId: "Must be have PlayFab.settings.titleId set to call this method", + errorLoggedIn: "Must be logged in to call this method", + errorEntityToken: "You must successfully call GetEntityToken before calling this", + errorSecretKey: "Must have PlayFab.settings.developerSecretKey set to call this method", + + GetServerUrl: function () { + if (!(PlayFab.settings.productionServerUrl.substring(0, 4) === "http")) { + if (PlayFab._internalSettings.verticalName) { + return "https://" + PlayFab._internalSettings.verticalName + PlayFab.settings.productionServerUrl; + } else { + return "https://" + PlayFab.settings.titleId + PlayFab.settings.productionServerUrl; + } + } else { + return PlayFab.settings.productionServerUrl; + } + }, + + InjectHeaders: function (xhr, headersObj) { + if (!headersObj) + return; + + for (var headerKey in headersObj) + { + try { + xhr.setRequestHeader(gHeaderKey, headersObj[headerKey]); + } catch (e) { + console.log("Failed to append header: " + headerKey + " = " + headersObj[headerKey] + "Error: " + e); + } + } + }, + + ExecuteRequest: function (url, request, authkey, authValue, callback, customData, extraHeaders) { + var resultPromise = new Promise(function (resolve, reject) { + if (callback != null && typeof (callback) !== "function") + throw "Callback must be null or a function"; + + if (request == null) + request = {}; + + var startTime = new Date(); + var requestBody = JSON.stringify(request); + + var urlArr = [url]; + var getParams = PlayFab._internalSettings.requestGetParams; + if (getParams != null) { + var firstParam = true; + for (var key in getParams) { + if (firstParam) { + urlArr.push("?"); + firstParam = false; + } else { + urlArr.push("&"); + } + urlArr.push(key); + urlArr.push("="); + urlArr.push(getParams[key]); + } + } + + var completeUrl = urlArr.join(""); + + var xhr = new XMLHttpRequest(); + // window.console.log("URL: " + completeUrl); + xhr.open("POST", completeUrl, true); + + xhr.setRequestHeader("Content-Type", "application/json"); + xhr.setRequestHeader("X-PlayFabSDK", "JavaScriptSDK-" + PlayFab._internalSettings.sdkVersion); + if (authkey != null) + xhr.setRequestHeader(authkey, authValue); + PlayFab._internalSettings.InjectHeaders(xhr, PlayFab.settings.GlobalHeaderInjection); + PlayFab._internalSettings.InjectHeaders(xhr, extraHeaders); + + xhr.onloadend = function () { + if (callback == null) + return; + + var result = PlayFab._internalSettings.GetPlayFabResponse(request, xhr, startTime, customData); + if (result.code === 200) { + callback(result, null); + } else { + callback(null, result); + } + } + + xhr.onerror = function () { + if (callback == null) + return; + + var result = PlayFab._internalSettings.GetPlayFabResponse(request, xhr, startTime, customData); + callback(null, result); + } + + xhr.send(requestBody); + xhr.onreadystatechange = function () { + if (this.readyState === 4) { + var xhrResult = PlayFab._internalSettings.GetPlayFabResponse(request, this, startTime, customData); + if (this.status === 200) { + resolve(xhrResult); + } else { + reject(xhrResult); + } + } + }; + }); + // Return a Promise so that calls to various API methods can be handled asynchronously + return resultPromise; + }, + + GetPlayFabResponse: function(request, xhr, startTime, customData) { + var result = null; + try { + // window.console.log("parsing json result: " + xhr.responseText); + result = JSON.parse(xhr.responseText); + } catch (e) { + result = { + code: 503, // Service Unavailable + status: "Service Unavailable", + error: "Connection error", + errorCode: 2, // PlayFabErrorCode.ConnectionError + errorMessage: xhr.responseText + }; + } + + result.CallBackTimeMS = new Date() - startTime; + result.Request = request; + result.CustomData = customData; + return result; + }, + + authenticationContext: { + PlayFabId: null, + EntityId: null, + EntityType: null, + SessionTicket: null, + EntityToken: null + }, + + UpdateAuthenticationContext: function (authenticationContext, result) { + var authenticationContextUpdates = {}; + if(result.data.PlayFabId !== null) { + PlayFab._internalSettings.authenticationContext.PlayFabId = result.data.PlayFabId; + authenticationContextUpdates.PlayFabId = result.data.PlayFabId; + } + if(result.data.SessionTicket !== null) { + PlayFab._internalSettings.authenticationContext.SessionTicket = result.data.SessionTicket; + authenticationContextUpdates.SessionTicket = result.data.SessionTicket; + } + if (result.data.EntityToken !== null) { + PlayFab._internalSettings.authenticationContext.EntityId = result.data.EntityToken.Entity.Id; + authenticationContextUpdates.EntityId = result.data.EntityToken.Entity.Id; + PlayFab._internalSettings.authenticationContext.EntityType = result.data.EntityToken.Entity.Type; + authenticationContextUpdates.EntityType = result.data.EntityToken.Entity.Type; + PlayFab._internalSettings.authenticationContext.EntityToken = result.data.EntityToken.EntityToken; + authenticationContextUpdates.EntityToken = result.data.EntityToken.EntityToken; + } + // Update the authenticationContext with values from the result + authenticationContext = Object.assign(authenticationContext, authenticationContextUpdates); + return authenticationContext; + }, + + AuthInfoMap: { + "X-EntityToken": { + authAttr: "entityToken", + authError: "errorEntityToken" + }, + "X-Authorization": { + authAttr: "sessionTicket", + authError: "errorLoggedIn" + }, + "X-SecretKey": { + authAttr: "developerSecretKey", + authError: "errorSecretKey" + } + }, + + GetAuthInfo: function (request, authKey) { + // Use the most-recently saved authKey, unless one was provided in the request via the AuthenticationContext + var authError = PlayFab._internalSettings.AuthInfoMap[authKey].authError; + var authAttr = PlayFab._internalSettings.AuthInfoMap[authKey].authAttr; + var defaultAuthValue = null; + if (authAttr === "entityToken") + defaultAuthValue = PlayFab._internalSettings.entityToken; + else if (authAttr === "sessionTicket") + defaultAuthValue = PlayFab._internalSettings.sessionTicket; + else if (authAttr === "developerSecretKey") + defaultAuthValue = PlayFab.settings.developerSecretKey; + var authValue = request.AuthenticationContext ? request.AuthenticationContext[authAttr] : defaultAuthValue; + return {"authKey": authKey, "authValue": authValue, "authError": authError}; + }, + + ExecuteRequestWrapper: function (apiURL, request, authKey, callback, customData, extraHeaders) { + var authValue = null; + if (authKey !== null){ + var authInfo = PlayFab._internalSettings.GetAuthInfo(request, authKey=authKey); + var authKey = authInfo.authKey, authValue = authInfo.authValue, authError = authInfo.authError; + + if (!authValue) throw authError; + } + return PlayFab._internalSettings.ExecuteRequest(PlayFab._internalSettings.GetServerUrl() + apiURL, request, authKey, authValue, callback, customData, extraHeaders); + } + } +} + +PlayFab.buildIdentifier = "adobuild_javascriptsdk_117"; +PlayFab.sdkVersion = "1.176.240802"; +PlayFab.GenerateErrorReport = function (error) { + if (error == null) + return ""; + var fullErrors = error.errorMessage; + for (var paramName in error.errorDetails) + for (var msgIdx in error.errorDetails[paramName]) + fullErrors += "\n" + paramName + ": " + error.errorDetails[paramName][msgIdx]; + return fullErrors; +}; + +PlayFab.LeaderboardsApi = { + ForgetAllCredentials: function () { + PlayFab._internalSettings.sessionTicket = null; + PlayFab._internalSettings.entityToken = null; + }, + + CreateLeaderboardDefinition: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Leaderboard/CreateLeaderboardDefinition", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + CreateStatisticDefinition: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Statistic/CreateStatisticDefinition", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + DeleteLeaderboardDefinition: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Leaderboard/DeleteLeaderboardDefinition", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + DeleteLeaderboardEntries: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Leaderboard/DeleteLeaderboardEntries", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + DeleteStatisticDefinition: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Statistic/DeleteStatisticDefinition", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + DeleteStatistics: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Statistic/DeleteStatistics", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + GetFriendLeaderboardForEntity: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Leaderboard/GetFriendLeaderboardForEntity", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + GetLeaderboard: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Leaderboard/GetLeaderboard", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + GetLeaderboardAroundEntity: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Leaderboard/GetLeaderboardAroundEntity", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + GetLeaderboardDefinition: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Leaderboard/GetLeaderboardDefinition", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + GetLeaderboardForEntities: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Leaderboard/GetLeaderboardForEntities", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + GetStatisticDefinition: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Statistic/GetStatisticDefinition", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + GetStatisticDefinitions: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Statistic/GetStatisticDefinitions", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + GetStatistics: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Statistic/GetStatistics", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + GetStatisticsForEntities: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Statistic/GetStatisticsForEntities", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + IncrementLeaderboardVersion: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Leaderboard/IncrementLeaderboardVersion", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + IncrementStatisticVersion: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Statistic/IncrementStatisticVersion", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + ListLeaderboardDefinitions: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Leaderboard/ListLeaderboardDefinitions", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + ListStatisticDefinitions: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Statistic/ListStatisticDefinitions", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + UnlinkLeaderboardFromStatistic: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Leaderboard/UnlinkLeaderboardFromStatistic", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + UpdateLeaderboardEntries: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Leaderboard/UpdateLeaderboardEntries", request, "X-EntityToken", callback, customData, extraHeaders); + }, + + UpdateStatistics: function (request, callback, customData, extraHeaders) { + return PlayFab._internalSettings.ExecuteRequestWrapper("/Statistic/UpdateStatistics", request, "X-EntityToken", callback, customData, extraHeaders); + }, + +}; + +var PlayFabLeaderboardsSDK = PlayFab.LeaderboardsApi; + diff --git a/PlayFabTestingExample/src/PlayFab/PlayFabLocalizationApi.js b/PlayFabTestingExample/src/PlayFab/PlayFabLocalizationApi.js index 3f50e88c..83b82e4f 100644 --- a/PlayFabTestingExample/src/PlayFab/PlayFabLocalizationApi.js +++ b/PlayFabTestingExample/src/PlayFab/PlayFabLocalizationApi.js @@ -14,9 +14,9 @@ if(!PlayFab.settings) { if(!PlayFab._internalSettings) { PlayFab._internalSettings = { entityToken: null, - sdkVersion: "1.175.240719", + sdkVersion: "1.176.240802", requestGetParams: { - sdk: "JavaScriptSDK-1.175.240719" + sdk: "JavaScriptSDK-1.176.240802" }, sessionTicket: null, verticalName: null, // The name of a customer vertical. This is only for customers running a private cluster. Generally you shouldn't touch this @@ -223,8 +223,8 @@ if(!PlayFab._internalSettings) { } } -PlayFab.buildIdentifier = "adobuild_javascriptsdk_115"; -PlayFab.sdkVersion = "1.175.240719"; +PlayFab.buildIdentifier = "adobuild_javascriptsdk_117"; +PlayFab.sdkVersion = "1.176.240802"; PlayFab.GenerateErrorReport = function (error) { if (error == null) return ""; diff --git a/PlayFabTestingExample/src/PlayFab/PlayFabMultiplayerApi.js b/PlayFabTestingExample/src/PlayFab/PlayFabMultiplayerApi.js index 4fcb043b..9c590960 100644 --- a/PlayFabTestingExample/src/PlayFab/PlayFabMultiplayerApi.js +++ b/PlayFabTestingExample/src/PlayFab/PlayFabMultiplayerApi.js @@ -14,9 +14,9 @@ if(!PlayFab.settings) { if(!PlayFab._internalSettings) { PlayFab._internalSettings = { entityToken: null, - sdkVersion: "1.175.240719", + sdkVersion: "1.176.240802", requestGetParams: { - sdk: "JavaScriptSDK-1.175.240719" + sdk: "JavaScriptSDK-1.176.240802" }, sessionTicket: null, verticalName: null, // The name of a customer vertical. This is only for customers running a private cluster. Generally you shouldn't touch this @@ -223,8 +223,8 @@ if(!PlayFab._internalSettings) { } } -PlayFab.buildIdentifier = "adobuild_javascriptsdk_115"; -PlayFab.sdkVersion = "1.175.240719"; +PlayFab.buildIdentifier = "adobuild_javascriptsdk_117"; +PlayFab.sdkVersion = "1.176.240802"; PlayFab.GenerateErrorReport = function (error) { if (error == null) return ""; diff --git a/PlayFabTestingExample/src/PlayFab/PlayFabProfilesApi.js b/PlayFabTestingExample/src/PlayFab/PlayFabProfilesApi.js index a8156391..6451bc46 100644 --- a/PlayFabTestingExample/src/PlayFab/PlayFabProfilesApi.js +++ b/PlayFabTestingExample/src/PlayFab/PlayFabProfilesApi.js @@ -14,9 +14,9 @@ if(!PlayFab.settings) { if(!PlayFab._internalSettings) { PlayFab._internalSettings = { entityToken: null, - sdkVersion: "1.175.240719", + sdkVersion: "1.176.240802", requestGetParams: { - sdk: "JavaScriptSDK-1.175.240719" + sdk: "JavaScriptSDK-1.176.240802" }, sessionTicket: null, verticalName: null, // The name of a customer vertical. This is only for customers running a private cluster. Generally you shouldn't touch this @@ -223,8 +223,8 @@ if(!PlayFab._internalSettings) { } } -PlayFab.buildIdentifier = "adobuild_javascriptsdk_115"; -PlayFab.sdkVersion = "1.175.240719"; +PlayFab.buildIdentifier = "adobuild_javascriptsdk_117"; +PlayFab.sdkVersion = "1.176.240802"; PlayFab.GenerateErrorReport = function (error) { if (error == null) return ""; diff --git a/PlayFabTestingExample/src/PlayFab/PlayFabServerApi.js b/PlayFabTestingExample/src/PlayFab/PlayFabServerApi.js index 37554061..e0d6024e 100644 --- a/PlayFabTestingExample/src/PlayFab/PlayFabServerApi.js +++ b/PlayFabTestingExample/src/PlayFab/PlayFabServerApi.js @@ -14,9 +14,9 @@ if(!PlayFab.settings) { if(!PlayFab._internalSettings) { PlayFab._internalSettings = { entityToken: null, - sdkVersion: "1.175.240719", + sdkVersion: "1.176.240802", requestGetParams: { - sdk: "JavaScriptSDK-1.175.240719" + sdk: "JavaScriptSDK-1.176.240802" }, sessionTicket: null, verticalName: null, // The name of a customer vertical. This is only for customers running a private cluster. Generally you shouldn't touch this @@ -223,8 +223,8 @@ if(!PlayFab._internalSettings) { } } -PlayFab.buildIdentifier = "adobuild_javascriptsdk_115"; -PlayFab.sdkVersion = "1.175.240719"; +PlayFab.buildIdentifier = "adobuild_javascriptsdk_117"; +PlayFab.sdkVersion = "1.176.240802"; PlayFab.GenerateErrorReport = function (error) { if (error == null) return ""; diff --git a/PlayFabTestingExample/src/typings/PlayFab/PlayFab.d.ts b/PlayFabTestingExample/src/typings/PlayFab/PlayFab.d.ts index 83b58b30..c646e249 100644 --- a/PlayFabTestingExample/src/typings/PlayFab/PlayFab.d.ts +++ b/PlayFabTestingExample/src/typings/PlayFab/PlayFab.d.ts @@ -9,6 +9,7 @@ /// /// /// +/// /// /// /// @@ -56,6 +57,7 @@ declare var PlayFab: { ExperimentationApi: PlayFabExperimentationModule.IPlayFabExperimentation; InsightsApi: PlayFabInsightsModule.IPlayFabInsights; GroupsApi: PlayFabGroupsModule.IPlayFabGroups; + LeaderboardsApi: PlayFabLeaderboardsModule.IPlayFabLeaderboards; LocalizationApi: PlayFabLocalizationModule.IPlayFabLocalization; MultiplayerApi: PlayFabMultiplayerModule.IPlayFabMultiplayer; ProfilesApi: PlayFabProfilesModule.IPlayFabProfiles; @@ -73,6 +75,7 @@ declare var PlayFabEventsSDK: PlayFabEventsModule.IPlayFabEvents; declare var PlayFabExperimentationSDK: PlayFabExperimentationModule.IPlayFabExperimentation; declare var PlayFabInsightsSDK: PlayFabInsightsModule.IPlayFabInsights; declare var PlayFabGroupsSDK: PlayFabGroupsModule.IPlayFabGroups; +declare var PlayFabLeaderboardsSDK: PlayFabLeaderboardsModule.IPlayFabLeaderboards; declare var PlayFabLocalizationSDK: PlayFabLocalizationModule.IPlayFabLocalization; declare var PlayFabMultiplayerSDK: PlayFabMultiplayerModule.IPlayFabMultiplayer; declare var PlayFabProfilesSDK: PlayFabProfilesModule.IPlayFabProfiles; diff --git a/PlayFabTestingExample/src/typings/PlayFab/PlayFabAdminApi.d.ts b/PlayFabTestingExample/src/typings/PlayFab/PlayFabAdminApi.d.ts index 5edaef47..ca3fde7d 100644 --- a/PlayFabTestingExample/src/typings/PlayFab/PlayFabAdminApi.d.ts +++ b/PlayFabTestingExample/src/typings/PlayFab/PlayFabAdminApi.d.ts @@ -2569,7 +2569,11 @@ declare module PlayFabAdminModels { | "LinkedStatisticColumnNotFound" | "LinkedStatisticColumnRequired" | "MultipleLinkedStatisticsNotAllowed" + | "DuplicateLinkedStatisticColumnNameFound" + | "AggregationTypeNotAllowedForMultiColumnStatistic" | "MaxQueryableVerionsValueNotAllowedForTier" + | "StatisticDefinitionHasNullOrEmptyVersionConfiguration" + | "StatisticColumnLengthMismatch" | "MatchmakingEntityInvalid" | "MatchmakingPlayerAttributesInvalid" | "MatchmakingQueueNotFound" diff --git a/PlayFabTestingExample/src/typings/PlayFab/PlayFabLeaderboardsApi.d.ts b/PlayFabTestingExample/src/typings/PlayFab/PlayFabLeaderboardsApi.d.ts new file mode 100644 index 00000000..6c2e7695 --- /dev/null +++ b/PlayFabTestingExample/src/typings/PlayFab/PlayFabLeaderboardsApi.d.ts @@ -0,0 +1,680 @@ +/// + +declare module PlayFabLeaderboardsModule { + export interface IPlayFabLeaderboards { + ForgetAllCredentials(): void; + + /** + * Creates a new leaderboard definition. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/leaderboards/createleaderboarddefinition + */ + CreateLeaderboardDefinition(request: PlayFabLeaderboardsModels.CreateLeaderboardDefinitionRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Create a new entity statistic definition. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/statistics-and-leaderboards/createstatisticdefinition + */ + CreateStatisticDefinition(request: PlayFabLeaderboardsModels.CreateStatisticDefinitionRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Deletes a leaderboard definition. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/leaderboards/deleteleaderboarddefinition + */ + DeleteLeaderboardDefinition(request: PlayFabLeaderboardsModels.DeleteLeaderboardDefinitionRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Deletes the specified entries from the given leaderboard. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/leaderboards/deleteleaderboardentries + */ + DeleteLeaderboardEntries(request: PlayFabLeaderboardsModels.DeleteLeaderboardEntriesRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Delete an entity statistic definition. Will delete all statistics on entity profiles and leaderboards. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/statistics-and-leaderboards/deletestatisticdefinition + */ + DeleteStatisticDefinition(request: PlayFabLeaderboardsModels.DeleteStatisticDefinitionRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Delete statistics on an entity profile. This will remove all rankings from associated leaderboards. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/statistics-and-leaderboards/deletestatistics + */ + DeleteStatistics(request: PlayFabLeaderboardsModels.DeleteStatisticsRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Get the friend leaderboard for the specified entity. A maximum of 100 friend entries are listed in the leaderboard. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/statistics-and-leaderboards/getfriendleaderboardforentity + */ + GetFriendLeaderboardForEntity(request: PlayFabLeaderboardsModels.GetFriendLeaderboardForEntityRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Get the leaderboard for a specific entity type and statistic. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/statistics-and-leaderboards/getleaderboard + */ + GetLeaderboard(request: PlayFabLeaderboardsModels.GetEntityLeaderboardRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Get the leaderboard around a specific entity. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/statistics-and-leaderboards/getleaderboardaroundentity + */ + GetLeaderboardAroundEntity(request: PlayFabLeaderboardsModels.GetLeaderboardAroundEntityRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Gets the specified leaderboard definition. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/leaderboards/getleaderboarddefinition + */ + GetLeaderboardDefinition(request: PlayFabLeaderboardsModels.GetLeaderboardDefinitionRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Get the leaderboard limited to a set of entities. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/statistics-and-leaderboards/getleaderboardforentities + */ + GetLeaderboardForEntities(request: PlayFabLeaderboardsModels.GetLeaderboardForEntitiesRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Get current statistic definition information + * https://docs.microsoft.com/rest/api/playfab/leaderboards/statistics-and-leaderboards/getstatisticdefinition + */ + GetStatisticDefinition(request: PlayFabLeaderboardsModels.GetStatisticDefinitionRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Get all current statistic definitions information + * https://docs.microsoft.com/rest/api/playfab/leaderboards/statistics-and-leaderboards/getstatisticdefinitions + */ + GetStatisticDefinitions(request: PlayFabLeaderboardsModels.GetStatisticDefinitionsRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Gets statistics for the specified entity. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/statistics-and-leaderboards/getstatistics + */ + GetStatistics(request: PlayFabLeaderboardsModels.GetStatisticsRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Gets statistics for the specified collection of entities. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/statistics-and-leaderboards/getstatisticsforentities + */ + GetStatisticsForEntities(request: PlayFabLeaderboardsModels.GetStatisticsForEntitiesRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Increment a leaderboard version. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/leaderboards/incrementleaderboardversion + */ + IncrementLeaderboardVersion(request: PlayFabLeaderboardsModels.IncrementLeaderboardVersionRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Increment an entity statistic definition version. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/statistics-and-leaderboards/incrementstatisticversion + */ + IncrementStatisticVersion(request: PlayFabLeaderboardsModels.IncrementStatisticVersionRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Lists the leaderboard definitions defined for the Title. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/leaderboards/listleaderboarddefinitions + */ + ListLeaderboardDefinitions(request: PlayFabLeaderboardsModels.ListLeaderboardDefinitionsRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Get all current statistic definitions information + * https://docs.microsoft.com/rest/api/playfab/leaderboards/statistics-and-leaderboards/liststatisticdefinitions + */ + ListStatisticDefinitions(request: PlayFabLeaderboardsModels.ListStatisticDefinitionsRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Unlinks a leaderboard definition from it's linked statistic definition. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/leaderboards/unlinkleaderboardfromstatistic + */ + UnlinkLeaderboardFromStatistic(request: PlayFabLeaderboardsModels.UnlinkLeaderboardFromStatisticRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Adds or updates entries on the specified leaderboard. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/leaderboards/updateleaderboardentries + */ + UpdateLeaderboardEntries(request: PlayFabLeaderboardsModels.UpdateLeaderboardEntriesRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + /** + * Update statistics on an entity profile. Depending on the statistic definition, this may result in entity being ranked on + * various leaderboards. + * https://docs.microsoft.com/rest/api/playfab/leaderboards/statistics-and-leaderboards/updatestatistics + */ + UpdateStatistics(request: PlayFabLeaderboardsModels.UpdateStatisticsRequest, callback: PlayFabModule.ApiCallback, customData?: any, extraHeaders?: { [key: string]: string }): Promise>; + + } +} + +declare module PlayFabLeaderboardsModels { + export interface CreateLeaderboardDefinitionRequest extends PlayFabModule.IPlayFabRequestCommon { + /** Leaderboard columns describing the sort directions, cannot be changed after creation. */ + Columns: LeaderboardColumn[]; + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** + * The entity type being represented on the leaderboard. If it doesn't correspond to the PlayFab entity types, use + * 'external' as the type. + */ + EntityType: string; + /** A name for the leaderboard, unique per title. */ + Name: string; + /** Maximum number of entries on this leaderboard */ + SizeLimit: number; + /** The version reset configuration for the leaderboard definition. */ + VersionConfiguration: VersionConfiguration; + + } + + export interface CreateStatisticDefinitionRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The columns for the statistic defining the aggregation method for each column. */ + Columns?: StatisticColumn[]; + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** The entity type allowed to have score(s) for this statistic. */ + EntityType?: string; + /** Name of the statistic. Must be less than 50 characters. Restricted to a-Z, 0-9, '(', ')', '_', '-' and '.'. */ + Name: string; + /** The version reset configuration for the statistic definition. */ + VersionConfiguration?: VersionConfiguration; + + } + + export interface DeleteLeaderboardDefinitionRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** The name of the leaderboard definition to delete. */ + Name: string; + + } + + export interface DeleteLeaderboardEntriesRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** The unique Ids of the entries to delete from the leaderboard. */ + EntityIds?: string[]; + /** The name of the leaderboard. */ + Name: string; + + } + + export interface DeleteStatisticDefinitionRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** Name of the statistic to delete. */ + Name: string; + + } + + export interface DeleteStatisticsRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** The optional entity to perform this action on. Defaults to the currently logged in entity. */ + Entity?: EntityKey; + /** Collection of statistics to remove from this entity. */ + Statistics: StatisticDelete[]; + + } + + export interface DeleteStatisticsResponse extends PlayFabModule.IPlayFabResultCommon { + /** The entity id and type. */ + Entity?: EntityKey; + + } + + export interface EmptyResponse extends PlayFabModule.IPlayFabResultCommon { + + } + + export interface EntityKey { + /** Unique ID of the entity. */ + Id: string; + /** Entity type. See https://docs.microsoft.com/gaming/playfab/features/data/entities/available-built-in-entity-types */ + Type?: string; + + } + + export interface EntityLeaderboardEntry { + /** Entity's display name. */ + DisplayName?: string; + /** Entity identifier. */ + Entity?: EntityKey; + /** The time at which the last update to the entry was recorded on the server. */ + LastUpdated: string; + /** An opaque blob of data stored on the leaderboard entry. Note that the metadata is not used for ranking purposes. */ + Metadata?: string; + /** Position on the leaderboard. */ + Rank: number; + /** Scores for the entry. */ + Scores?: string[]; + + } + + export interface EntityStatistics { + /** Entity key */ + EntityKey?: EntityKey; + /** All statistics for the given entitykey */ + Statistics?: EntityStatisticValue[]; + + } + + export interface EntityStatisticValue { + /** Metadata associated with the Statistic. */ + Metadata?: string; + /** Statistic name */ + Name?: string; + /** Statistic scores */ + Scores?: string[]; + /** Statistic version */ + Version: number; + + } + + type ExternalFriendSources = "None" + + | "Steam" + | "Facebook" + | "Xbox" + | "Psn" + | "All"; + + export interface GetEntityLeaderboardRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** Name of the leaderboard. */ + LeaderboardName: string; + /** Maximum number of results to return from the leaderboard. Minimum 1, maximum 1,000. */ + PageSize: number; + /** Index position to start from. 1 is beginning of leaderboard. */ + StartingPosition?: number; + /** Optional version of the leaderboard, defaults to current version. */ + Version?: number; + + } + + export interface GetEntityLeaderboardResponse extends PlayFabModule.IPlayFabResultCommon { + /** Leaderboard columns describing the sort directions, */ + Columns?: LeaderboardColumn[]; + /** Individual entity rankings in the leaderboard, in sorted order by rank. */ + Rankings?: EntityLeaderboardEntry[]; + /** Version of the leaderboard being returned. */ + Version: number; + + } + + export interface GetFriendLeaderboardForEntityRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** The optional entity to perform this action on. Defaults to the currently logged in entity. */ + Entity?: EntityKey; + /** + * Indicates which other platforms' friends should be included in the response. In HTTP, it is represented as a + * comma-separated list of platforms. + */ + ExternalFriendSources?: string; + /** Name of the leaderboard. */ + LeaderboardName: string; + /** Optional version of the leaderboard, defaults to current version. */ + Version?: number; + /** Xbox token if Xbox friends should be included. Requires Xbox be configured on PlayFab. */ + XboxToken?: string; + + } + + export interface GetLeaderboardAroundEntityRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** The optional entity to perform this action on. Defaults to the currently logged in entity. */ + Entity?: EntityKey; + /** Name of the leaderboard. */ + LeaderboardName: string; + /** + * Number of surrounding entries to return (in addition to specified entity). In general, the number of ranks above and + * below will be split into half. For example, if the specified value is 10, 5 ranks above and 5 ranks below will be + * retrieved. However, the numbers will get skewed in either direction when the specified entity is towards the top or + * bottom of the leaderboard. Also, the number of entries returned can be lower than the value specified for entries at the + * bottom of the leaderboard. + */ + MaxSurroundingEntries: number; + /** Optional version of the leaderboard, defaults to current. */ + Version?: number; + + } + + export interface GetLeaderboardDefinitionRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** The name of the leaderboard to retrieve the definition for. */ + Name: string; + + } + + export interface GetLeaderboardDefinitionResponse extends PlayFabModule.IPlayFabResultCommon { + /** Sort direction of the leaderboard columns, cannot be changed after creation. */ + Columns: LeaderboardColumn[]; + /** Created time, in UTC */ + Created: string; + /** + * The entity type being represented on the leaderboard. If it doesn't correspond to the PlayFab entity types, use + * 'external' as the type. + */ + EntityType: string; + /** Last time, in UTC, leaderboard version was incremented. */ + LastResetTime?: string; + /** A name for the leaderboard, unique per title. */ + Name: string; + /** Maximum number of entries on this leaderboard */ + SizeLimit: number; + /** Latest Leaderboard version. */ + Version: number; + /** The version reset configuration for the leaderboard definition. */ + VersionConfiguration: VersionConfiguration; + + } + + export interface GetLeaderboardForEntitiesRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** Collection of Entity IDs to include in the leaderboard. */ + EntityIds: string[]; + /** Name of the leaderboard. */ + LeaderboardName: string; + /** Optional version of the leaderboard, defaults to current. */ + Version?: number; + + } + + export interface GetStatisticDefinitionRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** Name of the statistic. Must be less than 50 characters. */ + Name: string; + + } + + export interface GetStatisticDefinitionResponse extends PlayFabModule.IPlayFabResultCommon { + /** The columns for the statistic defining the aggregation method for each column. */ + Columns?: StatisticColumn[]; + /** Created time, in UTC */ + Created: string; + /** The entity type that can have this statistic. */ + EntityType?: string; + /** Last time, in UTC, statistic version was incremented. */ + LastResetTime?: string; + /** The list of leaderboards that are linked to this statistic definition. */ + LinkedLeaderboardNames?: string[]; + /** Name of the statistic. */ + Name?: string; + /** Statistic version. */ + Version: number; + /** The version reset configuration for the leaderboard definition. */ + VersionConfiguration?: VersionConfiguration; + + } + + export interface GetStatisticDefinitionsRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + + } + + export interface GetStatisticDefinitionsResponse extends PlayFabModule.IPlayFabResultCommon { + /** List of statistic definitions for the title. */ + StatisticDefinitions?: StatisticDefinition[]; + + } + + export interface GetStatisticsForEntitiesRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** Collection of Entity IDs to retrieve statistics for. */ + Entities: EntityKey[]; + + } + + export interface GetStatisticsForEntitiesResponse extends PlayFabModule.IPlayFabResultCommon { + /** A mapping of statistic name to the columns defined in the corresponding definition. */ + ColumnDetails?: { [key: string]: StatisticColumnCollection }; + /** List of entities mapped to their statistics. Only the latest version of a statistic is returned. */ + EntitiesStatistics?: EntityStatistics[]; + + } + + export interface GetStatisticsRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** The optional entity to perform this action on. Defaults to the currently logged in entity. */ + Entity?: EntityKey; + + } + + export interface GetStatisticsResponse extends PlayFabModule.IPlayFabResultCommon { + /** A mapping of statistic name to the columns defined in the corresponding definition. */ + ColumnDetails?: { [key: string]: StatisticColumnCollection }; + /** The entity id and type. */ + Entity?: EntityKey; + /** List of statistics keyed by Name. Only the latest version of a statistic is returned. */ + Statistics?: { [key: string]: EntityStatisticValue }; + + } + + export interface IncrementLeaderboardVersionRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** The name of the leaderboard to increment the version for. */ + Name: string; + + } + + export interface IncrementLeaderboardVersionResponse extends PlayFabModule.IPlayFabResultCommon { + /** New Leaderboard version. */ + Version: number; + + } + + export interface IncrementStatisticVersionRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** Name of the statistic to increment the version of. */ + Name: string; + + } + + export interface IncrementStatisticVersionResponse extends PlayFabModule.IPlayFabResultCommon { + /** New statistic version. */ + Version: number; + + } + + export interface LeaderboardColumn { + /** + * If the value for this column is sourced from a statistic, details of the linked column. Null if the leaderboard is not + * linked. + */ + LinkedStatisticColumn?: LinkedStatisticColumn; + /** A name for the leaderboard column, unique per leaderboard definition. */ + Name: string; + /** The sort direction for this column. */ + SortDirection: string; + + } + + export interface LeaderboardDefinition { + /** Sort direction of the leaderboard columns, cannot be changed after creation. */ + Columns: LeaderboardColumn[]; + /** Created time, in UTC */ + Created: string; + /** + * The entity type being represented on the leaderboard. If it doesn't correspond to the PlayFab entity types, use + * 'external' as the type. + */ + EntityType: string; + /** Last time, in UTC, leaderboard version was incremented. */ + LastResetTime?: string; + /** A name for the leaderboard, unique per title. */ + Name: string; + /** Maximum number of entries on this leaderboard */ + SizeLimit: number; + /** Latest Leaderboard version. */ + Version: number; + /** The version reset configuration for the leaderboard definition. */ + VersionConfiguration: VersionConfiguration; + + } + + export interface LeaderboardEntryUpdate { + /** The unique Id for the entry. If using PlayFab Entities, this would be the entityId of the entity. */ + EntityId: string; + /** + * Arbitrary metadata to store along side the leaderboard entry, will be returned by all Leaderboard APIs. Must be less + * than 50 UTF8 encoded characters. + */ + Metadata?: string; + /** + * The scores for the leaderboard. The number of values provided here must match the number of columns in the Leaderboard + * definition. + */ + Scores?: string[]; + + } + + type LeaderboardSortDirection = "Descending" + + | "Ascending"; + + export interface LinkedStatisticColumn { + /** The name of the statistic column that this leaderboard column is sourced from. */ + LinkedStatisticColumnName: string; + /** The name of the statistic. */ + LinkedStatisticName: string; + + } + + export interface ListLeaderboardDefinitionsRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + + } + + export interface ListLeaderboardDefinitionsResponse extends PlayFabModule.IPlayFabResultCommon { + /** List of leaderboard definitions for the title. */ + LeaderboardDefinitions?: LeaderboardDefinition[]; + + } + + export interface ListStatisticDefinitionsRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + + } + + export interface ListStatisticDefinitionsResponse extends PlayFabModule.IPlayFabResultCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** List of statistic definitions for the title. */ + StatisticDefinitions?: StatisticDefinition[]; + + } + + type ResetInterval = "Manual" + + | "Hour" + | "Day" + | "Week" + | "Month"; + + type StatisticAggregationMethod = "Last" + + | "Min" + | "Max" + | "Sum"; + + export interface StatisticColumn { + /** Aggregation method for calculating new value of a statistic. */ + AggregationMethod: string; + /** Name of the statistic column, as originally configured. */ + Name: string; + + } + + export interface StatisticColumnCollection { + /** Columns for the statistic defining the aggregation method for each column. */ + Columns?: StatisticColumn[]; + + } + + export interface StatisticDefinition { + /** The columns for the statistic defining the aggregation method for each column. */ + Columns?: StatisticColumn[]; + /** Created time, in UTC */ + Created: string; + /** The entity type that can have this statistic. */ + EntityType?: string; + /** Last time, in UTC, statistic version was incremented. */ + LastResetTime?: string; + /** The list of leaderboards that are linked to this statistic definition. */ + LinkedLeaderboardNames?: string[]; + /** Name of the statistic. */ + Name?: string; + /** Statistic version. */ + Version: number; + /** The version reset configuration for the leaderboard definition. */ + VersionConfiguration?: VersionConfiguration; + + } + + export interface StatisticDelete { + /** Name of the statistic, as originally configured. */ + Name: string; + + } + + export interface StatisticUpdate { + /** + * Arbitrary metadata to store along side the statistic, will be returned by all Leaderboard APIs. Must be less than 50 + * UTF8 encoded characters. + */ + Metadata?: string; + /** Name of the statistic, as originally configured. */ + Name: string; + /** + * Statistic scores for the entity. This will be used in accordance with the aggregation method configured for the + * statistics.The maximum value allowed for each individual score is 9223372036854775807. The minimum value for each + * individual score is -9223372036854775807The values are formatted as strings to avoid interop issues with client + * libraries unable to handle 64bit integers. + */ + Scores?: string[]; + /** Optional field to indicate the version of the statistic to set. When empty defaults to the statistic's current version. */ + Version?: number; + + } + + export interface UnlinkLeaderboardFromStatisticRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** The name of the leaderboard definition to unlink. */ + Name: string; + /** The name of the statistic definition to unlink. */ + StatisticName: string; + + } + + export interface UpdateLeaderboardEntriesRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** The entries to add or update on the leaderboard. */ + Entries?: LeaderboardEntryUpdate[]; + /** The name of the leaderboard. */ + LeaderboardName: string; + + } + + export interface UpdateStatisticsRequest extends PlayFabModule.IPlayFabRequestCommon { + /** The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.). */ + CustomTags?: { [key: string]: string | null }; + /** The optional entity to perform this action on. Defaults to the currently logged in entity. */ + Entity?: EntityKey; + /** Collection of statistics to update, maximum 50. */ + Statistics: StatisticUpdate[]; + + } + + export interface UpdateStatisticsResponse extends PlayFabModule.IPlayFabResultCommon { + /** A mapping of statistic name to the columns defined in the corresponding definition. */ + ColumnDetails?: { [key: string]: StatisticColumnCollection }; + /** The entity id and type. */ + Entity?: EntityKey; + /** Updated entity profile statistics. */ + Statistics?: { [key: string]: EntityStatisticValue }; + + } + + export interface VersionConfiguration { + /** The maximum number of versions of this leaderboard/statistic that can be queried. */ + MaxQueryableVersions: number; + /** + * Reset interval that statistics or leaderboards will reset on. When using Manual intervalthe reset can only be increased + * by calling the Increase version API. When using Hour interval the resetwill occur at the start of the next hour UTC + * time. When using Day interval the reset will occur at thestart of the next day in UTC time. When using the Week interval + * the reset will occur at the start ofthe next Monday in UTC time. When using Month interval the reset will occur at the + * start of the nextmonth in UTC time. + */ + ResetInterval: string; + + } + + +} diff --git a/PlayFabTestingExample/src/typings/PlayFab/PlayFabServerApi.d.ts b/PlayFabTestingExample/src/typings/PlayFab/PlayFabServerApi.d.ts index 4ff9b455..9b2be511 100644 --- a/PlayFabTestingExample/src/typings/PlayFab/PlayFabServerApi.d.ts +++ b/PlayFabTestingExample/src/typings/PlayFab/PlayFabServerApi.d.ts @@ -2396,7 +2396,11 @@ declare module PlayFabServerModels { | "LinkedStatisticColumnNotFound" | "LinkedStatisticColumnRequired" | "MultipleLinkedStatisticsNotAllowed" + | "DuplicateLinkedStatisticColumnNameFound" + | "AggregationTypeNotAllowedForMultiColumnStatistic" | "MaxQueryableVerionsValueNotAllowedForTier" + | "StatisticDefinitionHasNullOrEmptyVersionConfiguration" + | "StatisticColumnLengthMismatch" | "MatchmakingEntityInvalid" | "MatchmakingPlayerAttributesInvalid" | "MatchmakingQueueNotFound" @@ -3823,7 +3827,7 @@ declare module PlayFabServerModels { IssuerId?: number; /** Unique PlayFab assigned ID of the user on whom the operation will be performed. */ PlayFabId: string; - /** Id of the PlayStation :tm: Network user. */ + /** Id of the PlayStation :tm: Network user. Also known as the PSN Account Id. */ PSNUserId: string; }