diff --git a/AndroidStudioExample/app/src/main/java/com/playfab/PlayFabClientAPI.java b/AndroidStudioExample/app/src/main/java/com/playfab/PlayFabClientAPI.java index 2c9a0887..b943b09c 100644 --- a/AndroidStudioExample/app/src/main/java/com/playfab/PlayFabClientAPI.java +++ b/AndroidStudioExample/app/src/main/java/com/playfab/PlayFabClientAPI.java @@ -79,6 +79,67 @@ private static PlayFabResult privateGetPhoto return pfResult; } + /** + * Returns the title's base 64 encoded RSA CSP blob. + * @param request GetTitlePublicKeyRequest + * @return Async Task will return GetTitlePublicKeyResult + */ + @SuppressWarnings("unchecked") + public static FutureTask> GetTitlePublicKeyAsync(final GetTitlePublicKeyRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateGetTitlePublicKeyAsync(request); + } + }); + } + + /** + * Returns the title's base 64 encoded RSA CSP blob. + * @param request GetTitlePublicKeyRequest + * @return GetTitlePublicKeyResult + */ + @SuppressWarnings("unchecked") + public static PlayFabResult GetTitlePublicKey(final GetTitlePublicKeyRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateGetTitlePublicKeyAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Returns the title's base 64 encoded RSA CSP blob. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateGetTitlePublicKeyAsync(final GetTitlePublicKeyRequest request) throws Exception { + + FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL() + "/Client/GetTitlePublicKey", request, null, null); + task.run(); + Object httpResult = task.get(); + if(httpResult instanceof PlayFabError) { + PlayFabError error = (PlayFabError)httpResult; + if (PlayFabSettings.GlobalErrorHandler != null) + PlayFabSettings.GlobalErrorHandler.callback(error); + PlayFabResult result = new PlayFabResult(); + result.Error = error; + return result; + } + String resultRawJson = (String) httpResult; + + PlayFabJsonSuccess resultData = gson.fromJson(resultRawJson, new TypeToken>(){}.getType()); + GetTitlePublicKeyResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + /** * Requests a challenge from the server to be signed by Windows Hello Passport service to authenticate. * @param request GetWindowsHelloChallengeRequest @@ -1050,6 +1111,68 @@ private static PlayFabResult privateRegisterWithWindowsHelloAsync(f return pfResult; } + /** + * Sets the player's secret if it is not already set. Player secrets are used to sign API requests. To reset a player's secret use the Admin or Server API method SetPlayerSecret. + * @param request SetPlayerSecretRequest + * @return Async Task will return SetPlayerSecretResult + */ + @SuppressWarnings("unchecked") + public static FutureTask> SetPlayerSecretAsync(final SetPlayerSecretRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateSetPlayerSecretAsync(request); + } + }); + } + + /** + * Sets the player's secret if it is not already set. Player secrets are used to sign API requests. To reset a player's secret use the Admin or Server API method SetPlayerSecret. + * @param request SetPlayerSecretRequest + * @return SetPlayerSecretResult + */ + @SuppressWarnings("unchecked") + public static PlayFabResult SetPlayerSecret(final SetPlayerSecretRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateSetPlayerSecretAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Sets the player's secret if it is not already set. Player secrets are used to sign API requests. To reset a player's secret use the Admin or Server API method SetPlayerSecret. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateSetPlayerSecretAsync(final SetPlayerSecretRequest request) throws Exception { + if (_authKey == null) throw new Exception ("Must be logged in to call this method"); + + FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL() + "/Client/SetPlayerSecret", request, "X-Authorization", _authKey); + task.run(); + Object httpResult = task.get(); + if(httpResult instanceof PlayFabError) { + PlayFabError error = (PlayFabError)httpResult; + if (PlayFabSettings.GlobalErrorHandler != null) + PlayFabSettings.GlobalErrorHandler.callback(error); + PlayFabResult result = new PlayFabResult(); + result.Error = error; + return result; + } + String resultRawJson = (String) httpResult; + + PlayFabJsonSuccess resultData = gson.fromJson(resultRawJson, new TypeToken>(){}.getType()); + SetPlayerSecretResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + /** * Adds the specified generic service identifier to the player's PlayFab account. This is designed to allow for a PlayFab ID lookup of any arbitrary service identifier a title wants to add. This identifier should never be used as authentication credentials, as the intent is that it is easily accessible by other players. * @param request AddGenericIDRequest diff --git a/AndroidStudioExample/app/src/main/java/com/playfab/PlayFabClientModels.java b/AndroidStudioExample/app/src/main/java/com/playfab/PlayFabClientModels.java index 3649ead6..d1ffd89d 100644 --- a/AndroidStudioExample/app/src/main/java/com/playfab/PlayFabClientModels.java +++ b/AndroidStudioExample/app/src/main/java/com/playfab/PlayFabClientModels.java @@ -1443,13 +1443,9 @@ public static class GetFriendLeaderboardAroundPlayerRequest { */ public Boolean IncludeFacebookFriends; /** - * The version of the leaderboard to get, when UseSpecificVersion is true. + * The version of the leaderboard to get. */ public Integer Version; - /** - * If true, uses the specified version. If false, gets the most recent version. - */ - public Boolean UseSpecificVersion; /** * If non-null, this determines which properties of the profile to return. If null, playfab will only include display names. For API calls from the client, only ShowDisplayName, ShowAvatarUrl are allowed at this time. */ @@ -1495,13 +1491,9 @@ public static class GetFriendLeaderboardRequest { */ public Boolean IncludeFacebookFriends; /** - * The version of the leaderboard to get, when UseSpecificVersion is true. + * The version of the leaderboard to get. */ public Integer Version; - /** - * If true, uses the specified version. If false, gets the most recent version. - */ - public Boolean UseSpecificVersion; /** * If non-null, this determines which properties of the profile to return. If null, playfab will only include display names. For API calls from the client, only ShowDisplayName, ShowAvatarUrl are allowed at this time. */ @@ -1571,13 +1563,9 @@ public static class GetLeaderboardAroundPlayerRequest { */ public Integer MaxResultsCount; /** - * The version of the leaderboard to get, when UseSpecificVersion is true. + * The version of the leaderboard to get. */ public Integer Version; - /** - * If true, uses the specified version. If false, gets the most recent version. - */ - public Boolean UseSpecificVersion; /** * If non-null, this determines which properties of the profile to return. If null, playfab will only include display names. For API calls from the client, only ShowDisplayName, ShowAvatarUrl are allowed at this time. */ @@ -1635,13 +1623,9 @@ public static class GetLeaderboardRequest { */ public Integer MaxResultsCount; /** - * The version of the leaderboard to get, when UseSpecificVersion is true. + * The version of the leaderboard to get. */ public Integer Version; - /** - * If true, uses the specified version. If false, gets the most recent version. - */ - public Boolean UseSpecificVersion; /** * If non-null, this determines which properties of the profile to return. If null, playfab will only include display names. For API calls from the client, only ShowDisplayName, ShowAvatarUrl are allowed at this time. */ @@ -2223,6 +2207,26 @@ public static class GetTitleNewsResult { } + public static class GetTitlePublicKeyRequest { + /** + * Unique identifier for the title, found in the Settings > Game Properties section of the PlayFab developer site when a title has been selected. + */ + public String TitleId; + /** + * The shared secret key for this title + */ + public String TitleSharedSecret; + + } + + public static class GetTitlePublicKeyResult { + /** + * Base64 encoded RSA CSP byte array blob containing the title's public RSA key + */ + public String RSAPublicKey; + + } + public static class GetTradeStatusRequest { /** * Player who opened trade. @@ -3843,6 +3847,22 @@ public static class SetFriendTagsResult { } + public static class SetPlayerSecretRequest { + /** + * Player secret that is used to verify API request signatures (Enterprise Only). + */ + public String PlayerSecret; + /** + * Base64 encoded body that is encrypted with the Title's public RSA key (Enterprise Only). + */ + public String EncryptedRequest; + + } + + public static class SetPlayerSecretResult { + + } + public static class SharedGroupDataRecord { /** * Data stored for the specified group data key. diff --git a/AndroidStudioExample/app/src/main/java/com/playfab/PlayFabSettings.java b/AndroidStudioExample/app/src/main/java/com/playfab/PlayFabSettings.java index 75c85797..df52fdbf 100644 --- a/AndroidStudioExample/app/src/main/java/com/playfab/PlayFabSettings.java +++ b/AndroidStudioExample/app/src/main/java/com/playfab/PlayFabSettings.java @@ -4,9 +4,9 @@ import com.playfab.PlayFabErrors.ErrorCallback; public class PlayFabSettings { - public static String SdkVersion = "0.51.170612"; - public static String BuildIdentifier = "jbuild_javasdk_1"; - public static String SdkVersionString = "JavaSDK-0.51.170612"; + public static String SdkVersion = "0.52.170710"; + public static String BuildIdentifier = "jbuild_javasdk_2"; + public static String SdkVersionString = "JavaSDK-0.52.170710"; public static String TitleId = null; // You must set this value for PlayFabSdk to work properly (Found in the Game Manager for your title, at the PlayFab Website) public static ErrorCallback GlobalErrorHandler; diff --git a/PlayFabClientSDK/pom.xml b/PlayFabClientSDK/pom.xml index 5af3c487..974660c7 100644 --- a/PlayFabClientSDK/pom.xml +++ b/PlayFabClientSDK/pom.xml @@ -4,7 +4,7 @@ 2016 com.playfab client-sdk - 0.51.170612 + 0.52.170710 PlayFab Client API PlayFab is the unified backend platform for games — everything you need to build and operate your game, all in one place, so you can focus on creating and delivering a great player experience. http://api.playfab.com/ diff --git a/PlayFabClientSDK/src/main/java/com/playfab/PlayFabClientAPI.java b/PlayFabClientSDK/src/main/java/com/playfab/PlayFabClientAPI.java index 7fb49b9b..d41095b8 100644 --- a/PlayFabClientSDK/src/main/java/com/playfab/PlayFabClientAPI.java +++ b/PlayFabClientSDK/src/main/java/com/playfab/PlayFabClientAPI.java @@ -78,6 +78,67 @@ private static PlayFabResult privateGetPhoto return pfResult; } + /** + * Returns the title's base 64 encoded RSA CSP blob. + * @param request GetTitlePublicKeyRequest + * @return Async Task will return GetTitlePublicKeyResult + */ + @SuppressWarnings("unchecked") + public static FutureTask> GetTitlePublicKeyAsync(final GetTitlePublicKeyRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateGetTitlePublicKeyAsync(request); + } + }); + } + + /** + * Returns the title's base 64 encoded RSA CSP blob. + * @param request GetTitlePublicKeyRequest + * @return GetTitlePublicKeyResult + */ + @SuppressWarnings("unchecked") + public static PlayFabResult GetTitlePublicKey(final GetTitlePublicKeyRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateGetTitlePublicKeyAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Returns the title's base 64 encoded RSA CSP blob. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateGetTitlePublicKeyAsync(final GetTitlePublicKeyRequest request) throws Exception { + + FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL() + "/Client/GetTitlePublicKey", request, null, null); + task.run(); + Object httpResult = task.get(); + if(httpResult instanceof PlayFabError) { + PlayFabError error = (PlayFabError)httpResult; + if (PlayFabSettings.GlobalErrorHandler != null) + PlayFabSettings.GlobalErrorHandler.callback(error); + PlayFabResult result = new PlayFabResult(); + result.Error = error; + return result; + } + String resultRawJson = (String) httpResult; + + PlayFabJsonSuccess resultData = gson.fromJson(resultRawJson, new TypeToken>(){}.getType()); + GetTitlePublicKeyResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + /** * Requests a challenge from the server to be signed by Windows Hello Passport service to authenticate. * @param request GetWindowsHelloChallengeRequest @@ -1049,6 +1110,68 @@ private static PlayFabResult privateRegisterWithWindowsHelloAsync(f return pfResult; } + /** + * Sets the player's secret if it is not already set. Player secrets are used to sign API requests. To reset a player's secret use the Admin or Server API method SetPlayerSecret. + * @param request SetPlayerSecretRequest + * @return Async Task will return SetPlayerSecretResult + */ + @SuppressWarnings("unchecked") + public static FutureTask> SetPlayerSecretAsync(final SetPlayerSecretRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateSetPlayerSecretAsync(request); + } + }); + } + + /** + * Sets the player's secret if it is not already set. Player secrets are used to sign API requests. To reset a player's secret use the Admin or Server API method SetPlayerSecret. + * @param request SetPlayerSecretRequest + * @return SetPlayerSecretResult + */ + @SuppressWarnings("unchecked") + public static PlayFabResult SetPlayerSecret(final SetPlayerSecretRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateSetPlayerSecretAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Sets the player's secret if it is not already set. Player secrets are used to sign API requests. To reset a player's secret use the Admin or Server API method SetPlayerSecret. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateSetPlayerSecretAsync(final SetPlayerSecretRequest request) throws Exception { + if (_authKey == null) throw new Exception ("Must be logged in to call this method"); + + FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL() + "/Client/SetPlayerSecret", request, "X-Authorization", _authKey); + task.run(); + Object httpResult = task.get(); + if(httpResult instanceof PlayFabError) { + PlayFabError error = (PlayFabError)httpResult; + if (PlayFabSettings.GlobalErrorHandler != null) + PlayFabSettings.GlobalErrorHandler.callback(error); + PlayFabResult result = new PlayFabResult(); + result.Error = error; + return result; + } + String resultRawJson = (String) httpResult; + + PlayFabJsonSuccess resultData = gson.fromJson(resultRawJson, new TypeToken>(){}.getType()); + SetPlayerSecretResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + /** * Adds the specified generic service identifier to the player's PlayFab account. This is designed to allow for a PlayFab ID lookup of any arbitrary service identifier a title wants to add. This identifier should never be used as authentication credentials, as the intent is that it is easily accessible by other players. * @param request AddGenericIDRequest diff --git a/PlayFabClientSDK/src/main/java/com/playfab/PlayFabClientModels.java b/PlayFabClientSDK/src/main/java/com/playfab/PlayFabClientModels.java index 3649ead6..d1ffd89d 100644 --- a/PlayFabClientSDK/src/main/java/com/playfab/PlayFabClientModels.java +++ b/PlayFabClientSDK/src/main/java/com/playfab/PlayFabClientModels.java @@ -1443,13 +1443,9 @@ public static class GetFriendLeaderboardAroundPlayerRequest { */ public Boolean IncludeFacebookFriends; /** - * The version of the leaderboard to get, when UseSpecificVersion is true. + * The version of the leaderboard to get. */ public Integer Version; - /** - * If true, uses the specified version. If false, gets the most recent version. - */ - public Boolean UseSpecificVersion; /** * If non-null, this determines which properties of the profile to return. If null, playfab will only include display names. For API calls from the client, only ShowDisplayName, ShowAvatarUrl are allowed at this time. */ @@ -1495,13 +1491,9 @@ public static class GetFriendLeaderboardRequest { */ public Boolean IncludeFacebookFriends; /** - * The version of the leaderboard to get, when UseSpecificVersion is true. + * The version of the leaderboard to get. */ public Integer Version; - /** - * If true, uses the specified version. If false, gets the most recent version. - */ - public Boolean UseSpecificVersion; /** * If non-null, this determines which properties of the profile to return. If null, playfab will only include display names. For API calls from the client, only ShowDisplayName, ShowAvatarUrl are allowed at this time. */ @@ -1571,13 +1563,9 @@ public static class GetLeaderboardAroundPlayerRequest { */ public Integer MaxResultsCount; /** - * The version of the leaderboard to get, when UseSpecificVersion is true. + * The version of the leaderboard to get. */ public Integer Version; - /** - * If true, uses the specified version. If false, gets the most recent version. - */ - public Boolean UseSpecificVersion; /** * If non-null, this determines which properties of the profile to return. If null, playfab will only include display names. For API calls from the client, only ShowDisplayName, ShowAvatarUrl are allowed at this time. */ @@ -1635,13 +1623,9 @@ public static class GetLeaderboardRequest { */ public Integer MaxResultsCount; /** - * The version of the leaderboard to get, when UseSpecificVersion is true. + * The version of the leaderboard to get. */ public Integer Version; - /** - * If true, uses the specified version. If false, gets the most recent version. - */ - public Boolean UseSpecificVersion; /** * If non-null, this determines which properties of the profile to return. If null, playfab will only include display names. For API calls from the client, only ShowDisplayName, ShowAvatarUrl are allowed at this time. */ @@ -2223,6 +2207,26 @@ public static class GetTitleNewsResult { } + public static class GetTitlePublicKeyRequest { + /** + * Unique identifier for the title, found in the Settings > Game Properties section of the PlayFab developer site when a title has been selected. + */ + public String TitleId; + /** + * The shared secret key for this title + */ + public String TitleSharedSecret; + + } + + public static class GetTitlePublicKeyResult { + /** + * Base64 encoded RSA CSP byte array blob containing the title's public RSA key + */ + public String RSAPublicKey; + + } + public static class GetTradeStatusRequest { /** * Player who opened trade. @@ -3843,6 +3847,22 @@ public static class SetFriendTagsResult { } + public static class SetPlayerSecretRequest { + /** + * Player secret that is used to verify API request signatures (Enterprise Only). + */ + public String PlayerSecret; + /** + * Base64 encoded body that is encrypted with the Title's public RSA key (Enterprise Only). + */ + public String EncryptedRequest; + + } + + public static class SetPlayerSecretResult { + + } + public static class SharedGroupDataRecord { /** * Data stored for the specified group data key. diff --git a/PlayFabClientSDK/src/main/java/com/playfab/PlayFabSettings.java b/PlayFabClientSDK/src/main/java/com/playfab/PlayFabSettings.java index 490308a4..f9018e1c 100644 --- a/PlayFabClientSDK/src/main/java/com/playfab/PlayFabSettings.java +++ b/PlayFabClientSDK/src/main/java/com/playfab/PlayFabSettings.java @@ -3,9 +3,9 @@ import com.playfab.PlayFabErrors.ErrorCallback; public class PlayFabSettings { - public static String SdkVersion = "0.51.170612"; - public static String BuildIdentifier = "jbuild_javasdk_1"; - public static String SdkVersionString = "JavaSDK-0.51.170612"; + public static String SdkVersion = "0.52.170710"; + public static String BuildIdentifier = "jbuild_javasdk_2"; + public static String SdkVersionString = "JavaSDK-0.52.170710"; public static String TitleId = null; // You must set this value for PlayFabSdk to work properly (Found in the Game Manager for your title, at the PlayFab Website) public static ErrorCallback GlobalErrorHandler; diff --git a/PlayFabSDK/pom.xml b/PlayFabSDK/pom.xml index b02a54d8..ddd3fb55 100644 --- a/PlayFabSDK/pom.xml +++ b/PlayFabSDK/pom.xml @@ -4,7 +4,7 @@ 2016 com.playfab combo-sdk - 0.51.170612 + 0.52.170710 PlayFab Combo API PlayFab is the unified backend platform for games — everything you need to build and operate your game, all in one place, so you can focus on creating and delivering a great player experience. http://api.playfab.com/ diff --git a/PlayFabSDK/src/main/java/com/playfab/PlayFabAdminAPI.java b/PlayFabSDK/src/main/java/com/playfab/PlayFabAdminAPI.java index 506302f9..8897b032 100644 --- a/PlayFabSDK/src/main/java/com/playfab/PlayFabAdminAPI.java +++ b/PlayFabSDK/src/main/java/com/playfab/PlayFabAdminAPI.java @@ -16,6 +16,192 @@ public class PlayFabAdminAPI { private static Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").create(); + /** + * Creates a new Player Shared Secret Key. It may take up to 5 minutes for this key to become generally available after this API returns. + * @param request CreatePlayerSharedSecretRequest + * @return Async Task will return CreatePlayerSharedSecretResult + */ + @SuppressWarnings("unchecked") + public static FutureTask> CreatePlayerSharedSecretAsync(final CreatePlayerSharedSecretRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateCreatePlayerSharedSecretAsync(request); + } + }); + } + + /** + * Creates a new Player Shared Secret Key. It may take up to 5 minutes for this key to become generally available after this API returns. + * @param request CreatePlayerSharedSecretRequest + * @return CreatePlayerSharedSecretResult + */ + @SuppressWarnings("unchecked") + public static PlayFabResult CreatePlayerSharedSecret(final CreatePlayerSharedSecretRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateCreatePlayerSharedSecretAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Creates a new Player Shared Secret Key. It may take up to 5 minutes for this key to become generally available after this API returns. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateCreatePlayerSharedSecretAsync(final CreatePlayerSharedSecretRequest request) throws Exception { + if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method"); + + FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL() + "/Admin/CreatePlayerSharedSecret", request, "X-SecretKey", PlayFabSettings.DeveloperSecretKey); + task.run(); + Object httpResult = task.get(); + if(httpResult instanceof PlayFabError) { + PlayFabError error = (PlayFabError)httpResult; + if (PlayFabSettings.GlobalErrorHandler != null) + PlayFabSettings.GlobalErrorHandler.callback(error); + PlayFabResult result = new PlayFabResult(); + result.Error = error; + return result; + } + String resultRawJson = (String) httpResult; + + PlayFabJsonSuccess resultData = gson.fromJson(resultRawJson, new TypeToken>(){}.getType()); + CreatePlayerSharedSecretResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + + /** + * Deletes an existing Player Shared Secret Key. It may take up to 5 minutes for this delete to be reflected after this API returns. + * @param request DeletePlayerSharedSecretRequest + * @return Async Task will return DeletePlayerSharedSecretResult + */ + @SuppressWarnings("unchecked") + public static FutureTask> DeletePlayerSharedSecretAsync(final DeletePlayerSharedSecretRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateDeletePlayerSharedSecretAsync(request); + } + }); + } + + /** + * Deletes an existing Player Shared Secret Key. It may take up to 5 minutes for this delete to be reflected after this API returns. + * @param request DeletePlayerSharedSecretRequest + * @return DeletePlayerSharedSecretResult + */ + @SuppressWarnings("unchecked") + public static PlayFabResult DeletePlayerSharedSecret(final DeletePlayerSharedSecretRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateDeletePlayerSharedSecretAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Deletes an existing Player Shared Secret Key. It may take up to 5 minutes for this delete to be reflected after this API returns. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateDeletePlayerSharedSecretAsync(final DeletePlayerSharedSecretRequest request) throws Exception { + if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method"); + + FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL() + "/Admin/DeletePlayerSharedSecret", request, "X-SecretKey", PlayFabSettings.DeveloperSecretKey); + task.run(); + Object httpResult = task.get(); + if(httpResult instanceof PlayFabError) { + PlayFabError error = (PlayFabError)httpResult; + if (PlayFabSettings.GlobalErrorHandler != null) + PlayFabSettings.GlobalErrorHandler.callback(error); + PlayFabResult result = new PlayFabResult(); + result.Error = error; + return result; + } + String resultRawJson = (String) httpResult; + + PlayFabJsonSuccess resultData = gson.fromJson(resultRawJson, new TypeToken>(){}.getType()); + DeletePlayerSharedSecretResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + + /** + * Returns all Player Shared Secret Keys including disabled and expired. + * @param request GetPlayerSharedSecretsRequest + * @return Async Task will return GetPlayerSharedSecretsResult + */ + @SuppressWarnings("unchecked") + public static FutureTask> GetPlayerSharedSecretsAsync(final GetPlayerSharedSecretsRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateGetPlayerSharedSecretsAsync(request); + } + }); + } + + /** + * Returns all Player Shared Secret Keys including disabled and expired. + * @param request GetPlayerSharedSecretsRequest + * @return GetPlayerSharedSecretsResult + */ + @SuppressWarnings("unchecked") + public static PlayFabResult GetPlayerSharedSecrets(final GetPlayerSharedSecretsRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateGetPlayerSharedSecretsAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Returns all Player Shared Secret Keys including disabled and expired. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateGetPlayerSharedSecretsAsync(final GetPlayerSharedSecretsRequest request) throws Exception { + if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method"); + + FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL() + "/Admin/GetPlayerSharedSecrets", request, "X-SecretKey", PlayFabSettings.DeveloperSecretKey); + task.run(); + Object httpResult = task.get(); + if(httpResult instanceof PlayFabError) { + PlayFabError error = (PlayFabError)httpResult; + if (PlayFabSettings.GlobalErrorHandler != null) + PlayFabSettings.GlobalErrorHandler.callback(error); + PlayFabResult result = new PlayFabResult(); + result.Error = error; + return result; + } + String resultRawJson = (String) httpResult; + + PlayFabJsonSuccess resultData = gson.fromJson(resultRawJson, new TypeToken>(){}.getType()); + GetPlayerSharedSecretsResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + /** * Gets the requested policy. * @param request GetPolicyRequest @@ -78,6 +264,130 @@ private static PlayFabResult privateGetPolicyAsync(final GetP return pfResult; } + /** + * Sets or resets the player's secret. Player secrets are used to sign API requests. + * @param request SetPlayerSecretRequest + * @return Async Task will return SetPlayerSecretResult + */ + @SuppressWarnings("unchecked") + public static FutureTask> SetPlayerSecretAsync(final SetPlayerSecretRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateSetPlayerSecretAsync(request); + } + }); + } + + /** + * Sets or resets the player's secret. Player secrets are used to sign API requests. + * @param request SetPlayerSecretRequest + * @return SetPlayerSecretResult + */ + @SuppressWarnings("unchecked") + public static PlayFabResult SetPlayerSecret(final SetPlayerSecretRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateSetPlayerSecretAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Sets or resets the player's secret. Player secrets are used to sign API requests. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateSetPlayerSecretAsync(final SetPlayerSecretRequest request) throws Exception { + if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method"); + + FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL() + "/Admin/SetPlayerSecret", request, "X-SecretKey", PlayFabSettings.DeveloperSecretKey); + task.run(); + Object httpResult = task.get(); + if(httpResult instanceof PlayFabError) { + PlayFabError error = (PlayFabError)httpResult; + if (PlayFabSettings.GlobalErrorHandler != null) + PlayFabSettings.GlobalErrorHandler.callback(error); + PlayFabResult result = new PlayFabResult(); + result.Error = error; + return result; + } + String resultRawJson = (String) httpResult; + + PlayFabJsonSuccess resultData = gson.fromJson(resultRawJson, new TypeToken>(){}.getType()); + SetPlayerSecretResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + + /** + * Updates a existing Player Shared Secret Key. It may take up to 5 minutes for this update to become generally available after this API returns. + * @param request UpdatePlayerSharedSecretRequest + * @return Async Task will return UpdatePlayerSharedSecretResult + */ + @SuppressWarnings("unchecked") + public static FutureTask> UpdatePlayerSharedSecretAsync(final UpdatePlayerSharedSecretRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateUpdatePlayerSharedSecretAsync(request); + } + }); + } + + /** + * Updates a existing Player Shared Secret Key. It may take up to 5 minutes for this update to become generally available after this API returns. + * @param request UpdatePlayerSharedSecretRequest + * @return UpdatePlayerSharedSecretResult + */ + @SuppressWarnings("unchecked") + public static PlayFabResult UpdatePlayerSharedSecret(final UpdatePlayerSharedSecretRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateUpdatePlayerSharedSecretAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Updates a existing Player Shared Secret Key. It may take up to 5 minutes for this update to become generally available after this API returns. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateUpdatePlayerSharedSecretAsync(final UpdatePlayerSharedSecretRequest request) throws Exception { + if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method"); + + FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL() + "/Admin/UpdatePlayerSharedSecret", request, "X-SecretKey", PlayFabSettings.DeveloperSecretKey); + task.run(); + Object httpResult = task.get(); + if(httpResult instanceof PlayFabError) { + PlayFabError error = (PlayFabError)httpResult; + if (PlayFabSettings.GlobalErrorHandler != null) + PlayFabSettings.GlobalErrorHandler.callback(error); + PlayFabResult result = new PlayFabResult(); + result.Error = error; + return result; + } + String resultRawJson = (String) httpResult; + + PlayFabJsonSuccess resultData = gson.fromJson(resultRawJson, new TypeToken>(){}.getType()); + UpdatePlayerSharedSecretResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + /** * Changes a policy for a title * @param request UpdatePolicyRequest diff --git a/PlayFabSDK/src/main/java/com/playfab/PlayFabAdminModels.java b/PlayFabSDK/src/main/java/com/playfab/PlayFabAdminModels.java index 796eb065..344a1d5e 100644 --- a/PlayFabSDK/src/main/java/com/playfab/PlayFabAdminModels.java +++ b/PlayFabSDK/src/main/java/com/playfab/PlayFabAdminModels.java @@ -883,6 +883,22 @@ public static class CreateCloudScriptTaskRequest { } + public static class CreatePlayerSharedSecretRequest { + /** + * Friendly name for this key + */ + public String FriendlyName; + + } + + public static class CreatePlayerSharedSecretResult { + /** + * The player shared secret to use when calling Client/GetTitlePublicKey + */ + public String SecretKey; + + } + public static class CreatePlayerStatisticDefinitionRequest { /** * unique name of the statistic @@ -1088,6 +1104,18 @@ public static class DeleteContentRequest { } + public static class DeletePlayerSharedSecretRequest { + /** + * The shared secret key to delete + */ + public String SecretKey; + + } + + public static class DeletePlayerSharedSecretResult { + + } + public static class DeleteStoreRequest { /** * catalog version of the store to delete. If null, uses the default catalog. @@ -1485,6 +1513,18 @@ public static class GetPlayerSegmentsResult { } + public static class GetPlayerSharedSecretsRequest { + + } + + public static class GetPlayerSharedSecretsResult { + /** + * The player shared secret to use when calling Client/GetTitlePublicKey + */ + public ArrayList SharedSecrets; + + } + public static class GetPlayersInSegmentRequest { /** * Unique identifier for this segment. @@ -2579,6 +2619,12 @@ public static class PushNotificationRegistration { } + public static enum PushSetupPlatform { + GCM, + APNS, + APNS_SANDBOX + } + public static class RandomResultTable { /** * Unique name for this drop table @@ -2909,6 +2955,22 @@ public static class SendAccountRecoveryEmailResult { } + public static class SetPlayerSecretRequest { + /** + * Player secret that is used to verify API request signatures (Enterprise Only). + */ + public String PlayerSecret; + /** + * Unique PlayFab assigned ID of the user on whom the operation will be performed. + */ + public String PlayFabId; + + } + + public static class SetPlayerSecretResult { + + } + public static class SetPublishedRevisionRequest { /** * Version number @@ -2965,7 +3027,7 @@ public static class SetupPushNotificationRequest { /** * supported notification platforms are Apple Push Notification Service (APNS and APNS_SANDBOX) for iOS and Google Cloud Messaging (GCM) for Android */ - public String Platform; + public PushSetupPlatform Platform; /** * for APNS, this is the PlatformPrincipal (SSL Certificate) */ @@ -2989,6 +3051,22 @@ public static class SetupPushNotificationResult { } + public static class SharedSecret { + /** + * The player shared secret to use when calling Client/GetTitlePublicKey + */ + public String SecretKey; + /** + * Friendly name for this key + */ + public String FriendlyName; + /** + * Flag to indicate if this key is disabled + */ + public Boolean Disabled; + + } + public static enum SourceType { Admin, BackEnd, @@ -3251,6 +3329,26 @@ public static class UpdateCloudScriptResult { } + public static class UpdatePlayerSharedSecretRequest { + /** + * The shared secret key to update + */ + public String SecretKey; + /** + * Friendly name for this key + */ + public String FriendlyName; + /** + * Disable or Enable this key + */ + public Boolean Disabled; + + } + + public static class UpdatePlayerSharedSecretResult { + + } + public static class UpdatePlayerStatisticDefinitionRequest { /** * unique name of the statistic diff --git a/PlayFabSDK/src/main/java/com/playfab/PlayFabClientAPI.java b/PlayFabSDK/src/main/java/com/playfab/PlayFabClientAPI.java index 7fb49b9b..d41095b8 100644 --- a/PlayFabSDK/src/main/java/com/playfab/PlayFabClientAPI.java +++ b/PlayFabSDK/src/main/java/com/playfab/PlayFabClientAPI.java @@ -78,6 +78,67 @@ private static PlayFabResult privateGetPhoto return pfResult; } + /** + * Returns the title's base 64 encoded RSA CSP blob. + * @param request GetTitlePublicKeyRequest + * @return Async Task will return GetTitlePublicKeyResult + */ + @SuppressWarnings("unchecked") + public static FutureTask> GetTitlePublicKeyAsync(final GetTitlePublicKeyRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateGetTitlePublicKeyAsync(request); + } + }); + } + + /** + * Returns the title's base 64 encoded RSA CSP blob. + * @param request GetTitlePublicKeyRequest + * @return GetTitlePublicKeyResult + */ + @SuppressWarnings("unchecked") + public static PlayFabResult GetTitlePublicKey(final GetTitlePublicKeyRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateGetTitlePublicKeyAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Returns the title's base 64 encoded RSA CSP blob. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateGetTitlePublicKeyAsync(final GetTitlePublicKeyRequest request) throws Exception { + + FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL() + "/Client/GetTitlePublicKey", request, null, null); + task.run(); + Object httpResult = task.get(); + if(httpResult instanceof PlayFabError) { + PlayFabError error = (PlayFabError)httpResult; + if (PlayFabSettings.GlobalErrorHandler != null) + PlayFabSettings.GlobalErrorHandler.callback(error); + PlayFabResult result = new PlayFabResult(); + result.Error = error; + return result; + } + String resultRawJson = (String) httpResult; + + PlayFabJsonSuccess resultData = gson.fromJson(resultRawJson, new TypeToken>(){}.getType()); + GetTitlePublicKeyResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + /** * Requests a challenge from the server to be signed by Windows Hello Passport service to authenticate. * @param request GetWindowsHelloChallengeRequest @@ -1049,6 +1110,68 @@ private static PlayFabResult privateRegisterWithWindowsHelloAsync(f return pfResult; } + /** + * Sets the player's secret if it is not already set. Player secrets are used to sign API requests. To reset a player's secret use the Admin or Server API method SetPlayerSecret. + * @param request SetPlayerSecretRequest + * @return Async Task will return SetPlayerSecretResult + */ + @SuppressWarnings("unchecked") + public static FutureTask> SetPlayerSecretAsync(final SetPlayerSecretRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateSetPlayerSecretAsync(request); + } + }); + } + + /** + * Sets the player's secret if it is not already set. Player secrets are used to sign API requests. To reset a player's secret use the Admin or Server API method SetPlayerSecret. + * @param request SetPlayerSecretRequest + * @return SetPlayerSecretResult + */ + @SuppressWarnings("unchecked") + public static PlayFabResult SetPlayerSecret(final SetPlayerSecretRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateSetPlayerSecretAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Sets the player's secret if it is not already set. Player secrets are used to sign API requests. To reset a player's secret use the Admin or Server API method SetPlayerSecret. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateSetPlayerSecretAsync(final SetPlayerSecretRequest request) throws Exception { + if (_authKey == null) throw new Exception ("Must be logged in to call this method"); + + FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL() + "/Client/SetPlayerSecret", request, "X-Authorization", _authKey); + task.run(); + Object httpResult = task.get(); + if(httpResult instanceof PlayFabError) { + PlayFabError error = (PlayFabError)httpResult; + if (PlayFabSettings.GlobalErrorHandler != null) + PlayFabSettings.GlobalErrorHandler.callback(error); + PlayFabResult result = new PlayFabResult(); + result.Error = error; + return result; + } + String resultRawJson = (String) httpResult; + + PlayFabJsonSuccess resultData = gson.fromJson(resultRawJson, new TypeToken>(){}.getType()); + SetPlayerSecretResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + /** * Adds the specified generic service identifier to the player's PlayFab account. This is designed to allow for a PlayFab ID lookup of any arbitrary service identifier a title wants to add. This identifier should never be used as authentication credentials, as the intent is that it is easily accessible by other players. * @param request AddGenericIDRequest diff --git a/PlayFabSDK/src/main/java/com/playfab/PlayFabClientModels.java b/PlayFabSDK/src/main/java/com/playfab/PlayFabClientModels.java index 3649ead6..d1ffd89d 100644 --- a/PlayFabSDK/src/main/java/com/playfab/PlayFabClientModels.java +++ b/PlayFabSDK/src/main/java/com/playfab/PlayFabClientModels.java @@ -1443,13 +1443,9 @@ public static class GetFriendLeaderboardAroundPlayerRequest { */ public Boolean IncludeFacebookFriends; /** - * The version of the leaderboard to get, when UseSpecificVersion is true. + * The version of the leaderboard to get. */ public Integer Version; - /** - * If true, uses the specified version. If false, gets the most recent version. - */ - public Boolean UseSpecificVersion; /** * If non-null, this determines which properties of the profile to return. If null, playfab will only include display names. For API calls from the client, only ShowDisplayName, ShowAvatarUrl are allowed at this time. */ @@ -1495,13 +1491,9 @@ public static class GetFriendLeaderboardRequest { */ public Boolean IncludeFacebookFriends; /** - * The version of the leaderboard to get, when UseSpecificVersion is true. + * The version of the leaderboard to get. */ public Integer Version; - /** - * If true, uses the specified version. If false, gets the most recent version. - */ - public Boolean UseSpecificVersion; /** * If non-null, this determines which properties of the profile to return. If null, playfab will only include display names. For API calls from the client, only ShowDisplayName, ShowAvatarUrl are allowed at this time. */ @@ -1571,13 +1563,9 @@ public static class GetLeaderboardAroundPlayerRequest { */ public Integer MaxResultsCount; /** - * The version of the leaderboard to get, when UseSpecificVersion is true. + * The version of the leaderboard to get. */ public Integer Version; - /** - * If true, uses the specified version. If false, gets the most recent version. - */ - public Boolean UseSpecificVersion; /** * If non-null, this determines which properties of the profile to return. If null, playfab will only include display names. For API calls from the client, only ShowDisplayName, ShowAvatarUrl are allowed at this time. */ @@ -1635,13 +1623,9 @@ public static class GetLeaderboardRequest { */ public Integer MaxResultsCount; /** - * The version of the leaderboard to get, when UseSpecificVersion is true. + * The version of the leaderboard to get. */ public Integer Version; - /** - * If true, uses the specified version. If false, gets the most recent version. - */ - public Boolean UseSpecificVersion; /** * If non-null, this determines which properties of the profile to return. If null, playfab will only include display names. For API calls from the client, only ShowDisplayName, ShowAvatarUrl are allowed at this time. */ @@ -2223,6 +2207,26 @@ public static class GetTitleNewsResult { } + public static class GetTitlePublicKeyRequest { + /** + * Unique identifier for the title, found in the Settings > Game Properties section of the PlayFab developer site when a title has been selected. + */ + public String TitleId; + /** + * The shared secret key for this title + */ + public String TitleSharedSecret; + + } + + public static class GetTitlePublicKeyResult { + /** + * Base64 encoded RSA CSP byte array blob containing the title's public RSA key + */ + public String RSAPublicKey; + + } + public static class GetTradeStatusRequest { /** * Player who opened trade. @@ -3843,6 +3847,22 @@ public static class SetFriendTagsResult { } + public static class SetPlayerSecretRequest { + /** + * Player secret that is used to verify API request signatures (Enterprise Only). + */ + public String PlayerSecret; + /** + * Base64 encoded body that is encrypted with the Title's public RSA key (Enterprise Only). + */ + public String EncryptedRequest; + + } + + public static class SetPlayerSecretResult { + + } + public static class SharedGroupDataRecord { /** * Data stored for the specified group data key. diff --git a/PlayFabSDK/src/main/java/com/playfab/PlayFabMatchmakerModels.java b/PlayFabSDK/src/main/java/com/playfab/PlayFabMatchmakerModels.java index bbbba1b7..6a7d7938 100644 --- a/PlayFabSDK/src/main/java/com/playfab/PlayFabMatchmakerModels.java +++ b/PlayFabSDK/src/main/java/com/playfab/PlayFabMatchmakerModels.java @@ -152,6 +152,10 @@ public static enum Region { } public static class RegisterGameRequest { + /** + * Previous lobby id if re-registering an existing game. + */ + public String LobbyId; /** * IP address of the Game Server Instance. */ @@ -181,7 +185,7 @@ public static class RegisterGameRequest { public static class RegisterGameResponse { /** - * Unique identifier generated for the Game Server Instance that is registered. + * Unique identifier generated for the Game Server Instance that is registered. If LobbyId is specified in request and the game still exists in PlayFab, the LobbyId in request is returned. Otherwise a new lobby id will be returned. */ public String LobbyId; diff --git a/PlayFabSDK/src/main/java/com/playfab/PlayFabServerAPI.java b/PlayFabSDK/src/main/java/com/playfab/PlayFabServerAPI.java index 44c6e6ea..1f6123a6 100644 --- a/PlayFabSDK/src/main/java/com/playfab/PlayFabServerAPI.java +++ b/PlayFabSDK/src/main/java/com/playfab/PlayFabServerAPI.java @@ -78,6 +78,68 @@ private static PlayFabResult privateAuthenticat return pfResult; } + /** + * Sets the player's secret if it is not already set. Player secrets are used to sign API requests. To reset a player's secret use the Admin or Server API method SetPlayerSecret. + * @param request SetPlayerSecretRequest + * @return Async Task will return SetPlayerSecretResult + */ + @SuppressWarnings("unchecked") + public static FutureTask> SetPlayerSecretAsync(final SetPlayerSecretRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateSetPlayerSecretAsync(request); + } + }); + } + + /** + * Sets the player's secret if it is not already set. Player secrets are used to sign API requests. To reset a player's secret use the Admin or Server API method SetPlayerSecret. + * @param request SetPlayerSecretRequest + * @return SetPlayerSecretResult + */ + @SuppressWarnings("unchecked") + public static PlayFabResult SetPlayerSecret(final SetPlayerSecretRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateSetPlayerSecretAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Sets the player's secret if it is not already set. Player secrets are used to sign API requests. To reset a player's secret use the Admin or Server API method SetPlayerSecret. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateSetPlayerSecretAsync(final SetPlayerSecretRequest request) throws Exception { + if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method"); + + FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL() + "/Server/SetPlayerSecret", request, "X-SecretKey", PlayFabSettings.DeveloperSecretKey); + task.run(); + Object httpResult = task.get(); + if(httpResult instanceof PlayFabError) { + PlayFabError error = (PlayFabError)httpResult; + if (PlayFabSettings.GlobalErrorHandler != null) + PlayFabSettings.GlobalErrorHandler.callback(error); + PlayFabResult result = new PlayFabResult(); + result.Error = error; + return result; + } + String resultRawJson = (String) httpResult; + + PlayFabJsonSuccess resultData = gson.fromJson(resultRawJson, new TypeToken>(){}.getType()); + SetPlayerSecretResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + /** * Bans users by PlayFab ID with optional IP address, or MAC address for the provided game. * @param request BanUsersRequest diff --git a/PlayFabSDK/src/main/java/com/playfab/PlayFabServerModels.java b/PlayFabSDK/src/main/java/com/playfab/PlayFabServerModels.java index a3569caa..c8fe2347 100644 --- a/PlayFabSDK/src/main/java/com/playfab/PlayFabServerModels.java +++ b/PlayFabSDK/src/main/java/com/playfab/PlayFabServerModels.java @@ -1447,13 +1447,9 @@ public static class GetFriendLeaderboardRequest { */ public Boolean IncludeFacebookFriends; /** - * The version of the leaderboard to get, when UseSpecificVersion is true. + * The version of the leaderboard to get. */ public Integer Version; - /** - * If true, uses the specified version. If false, gets the most recent version. - */ - public Boolean UseSpecificVersion; /** * If non-null, this determines which properties of the profile to return. If null, playfab will only include display names. For API calls from the client, only ShowDisplayName, ShowAvatarUrl are allowed at this time. */ @@ -1535,13 +1531,9 @@ public static class GetLeaderboardAroundUserRequest { */ public PlayerProfileViewConstraints ProfileConstraints; /** - * The version of the leaderboard to get, when UseSpecificVersion is true. + * The version of the leaderboard to get. */ public Integer Version; - /** - * If true, uses the specified version. If false, gets the most recent version. - */ - public Boolean UseSpecificVersion; } @@ -1603,13 +1595,9 @@ public static class GetLeaderboardRequest { */ public PlayerProfileViewConstraints ProfileConstraints; /** - * The version of the leaderboard to get, when UseSpecificVersion is true. + * The version of the leaderboard to get. */ public Integer Version; - /** - * If true, uses the specified version. If false, gets the most recent version. - */ - public Boolean UseSpecificVersion; } @@ -3034,6 +3022,34 @@ public static class PlayerStatisticVersion { } + public static class PushNotificationPackage { + /** + * If set, represents a timestamp for when the device should display the message. Local format should be formatted as: yyyy-MM-dd HH:mm:ss or UTC timestamp formatted as yyyy-MM-ddTHH:mm:ssZ. Delivery is not delayed, scheduling is expected to be handled by the device. + */ + public String ScheduleDate; + /** + * Title/Subject of the message + */ + public String Title; + /** + * Content of the message + */ + public String Message; + /** + * Icon file to display with the message + */ + public String Icon; + /** + * Sound file to play with the message + */ + public String Sound; + /** + * Arbitrary string that will be delivered with the message. Suggested use: JSON formatted object + */ + public String CustomData; + + } + public static enum PushNotificationPlatform { ApplePushNotificationService, GoogleCloudMessaging @@ -3158,6 +3174,10 @@ public static enum Region { } public static class RegisterGameRequest { + /** + * Previous lobby id if re-registering an existing game. + */ + public String LobbyId; /** * IP address of the Game Server Instance. */ @@ -3187,7 +3207,7 @@ public static class RegisterGameRequest { public static class RegisterGameResponse { /** - * Unique identifier generated for the Game Server Instance that is registered. + * Unique identifier generated for the Game Server Instance that is registered. If LobbyId is specified in request and the game still exists in PlayFab, the LobbyId in request is returned. Otherwise a new lobby id will be returned. */ public String LobbyId; @@ -3361,9 +3381,14 @@ public static class SendPushNotificationRequest { */ public String Recipient; /** - * Text of message to send. + * @deprecated Please use Package instead. */ + @Deprecated public String Message; + /** + * Defines all possible push attributes like message, title, icon, etc + */ + public PushNotificationPackage Package; /** * Subject of message to send (may not be displayed in all platforms. */ @@ -3439,6 +3464,22 @@ public static class SetGameServerInstanceTagsResult { } + public static class SetPlayerSecretRequest { + /** + * Player secret that is used to verify API request signatures (Enterprise Only). + */ + public String PlayerSecret; + /** + * Unique PlayFab assigned ID of the user on whom the operation will be performed. + */ + public String PlayFabId; + + } + + public static class SetPlayerSecretResult { + + } + public static class SetPublisherDataRequest { /** * key we want to set a value on (note, this is additive - will only replace an existing key's value if they are the same name.) Keys are trimmed of whitespace. Keys may not begin with the '!' character. diff --git a/PlayFabSDK/src/main/java/com/playfab/PlayFabSettings.java b/PlayFabSDK/src/main/java/com/playfab/PlayFabSettings.java index bb9cf0c3..e12ccd13 100644 --- a/PlayFabSDK/src/main/java/com/playfab/PlayFabSettings.java +++ b/PlayFabSDK/src/main/java/com/playfab/PlayFabSettings.java @@ -3,9 +3,9 @@ import com.playfab.PlayFabErrors.ErrorCallback; public class PlayFabSettings { - public static String SdkVersion = "0.51.170612"; - public static String BuildIdentifier = "jbuild_javasdk_1"; - public static String SdkVersionString = "JavaSDK-0.51.170612"; + public static String SdkVersion = "0.52.170710"; + public static String BuildIdentifier = "jbuild_javasdk_2"; + public static String SdkVersionString = "JavaSDK-0.52.170710"; public static String TitleId = null; // You must set this value for PlayFabSdk to work properly (Found in the Game Manager for your title, at the PlayFab Website) public static ErrorCallback GlobalErrorHandler; diff --git a/PlayFabServerSDK/pom.xml b/PlayFabServerSDK/pom.xml index 56f51539..a7df374e 100644 --- a/PlayFabServerSDK/pom.xml +++ b/PlayFabServerSDK/pom.xml @@ -4,7 +4,7 @@ 2016 com.playfab server-sdk - 0.51.170612 + 0.52.170710 PlayFab Server API PlayFab is the unified backend platform for games — everything you need to build and operate your game, all in one place, so you can focus on creating and delivering a great player experience. http://api.playfab.com/ diff --git a/PlayFabServerSDK/src/main/java/com/playfab/PlayFabAdminAPI.java b/PlayFabServerSDK/src/main/java/com/playfab/PlayFabAdminAPI.java index 506302f9..8897b032 100644 --- a/PlayFabServerSDK/src/main/java/com/playfab/PlayFabAdminAPI.java +++ b/PlayFabServerSDK/src/main/java/com/playfab/PlayFabAdminAPI.java @@ -16,6 +16,192 @@ public class PlayFabAdminAPI { private static Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").create(); + /** + * Creates a new Player Shared Secret Key. It may take up to 5 minutes for this key to become generally available after this API returns. + * @param request CreatePlayerSharedSecretRequest + * @return Async Task will return CreatePlayerSharedSecretResult + */ + @SuppressWarnings("unchecked") + public static FutureTask> CreatePlayerSharedSecretAsync(final CreatePlayerSharedSecretRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateCreatePlayerSharedSecretAsync(request); + } + }); + } + + /** + * Creates a new Player Shared Secret Key. It may take up to 5 minutes for this key to become generally available after this API returns. + * @param request CreatePlayerSharedSecretRequest + * @return CreatePlayerSharedSecretResult + */ + @SuppressWarnings("unchecked") + public static PlayFabResult CreatePlayerSharedSecret(final CreatePlayerSharedSecretRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateCreatePlayerSharedSecretAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Creates a new Player Shared Secret Key. It may take up to 5 minutes for this key to become generally available after this API returns. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateCreatePlayerSharedSecretAsync(final CreatePlayerSharedSecretRequest request) throws Exception { + if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method"); + + FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL() + "/Admin/CreatePlayerSharedSecret", request, "X-SecretKey", PlayFabSettings.DeveloperSecretKey); + task.run(); + Object httpResult = task.get(); + if(httpResult instanceof PlayFabError) { + PlayFabError error = (PlayFabError)httpResult; + if (PlayFabSettings.GlobalErrorHandler != null) + PlayFabSettings.GlobalErrorHandler.callback(error); + PlayFabResult result = new PlayFabResult(); + result.Error = error; + return result; + } + String resultRawJson = (String) httpResult; + + PlayFabJsonSuccess resultData = gson.fromJson(resultRawJson, new TypeToken>(){}.getType()); + CreatePlayerSharedSecretResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + + /** + * Deletes an existing Player Shared Secret Key. It may take up to 5 minutes for this delete to be reflected after this API returns. + * @param request DeletePlayerSharedSecretRequest + * @return Async Task will return DeletePlayerSharedSecretResult + */ + @SuppressWarnings("unchecked") + public static FutureTask> DeletePlayerSharedSecretAsync(final DeletePlayerSharedSecretRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateDeletePlayerSharedSecretAsync(request); + } + }); + } + + /** + * Deletes an existing Player Shared Secret Key. It may take up to 5 minutes for this delete to be reflected after this API returns. + * @param request DeletePlayerSharedSecretRequest + * @return DeletePlayerSharedSecretResult + */ + @SuppressWarnings("unchecked") + public static PlayFabResult DeletePlayerSharedSecret(final DeletePlayerSharedSecretRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateDeletePlayerSharedSecretAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Deletes an existing Player Shared Secret Key. It may take up to 5 minutes for this delete to be reflected after this API returns. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateDeletePlayerSharedSecretAsync(final DeletePlayerSharedSecretRequest request) throws Exception { + if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method"); + + FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL() + "/Admin/DeletePlayerSharedSecret", request, "X-SecretKey", PlayFabSettings.DeveloperSecretKey); + task.run(); + Object httpResult = task.get(); + if(httpResult instanceof PlayFabError) { + PlayFabError error = (PlayFabError)httpResult; + if (PlayFabSettings.GlobalErrorHandler != null) + PlayFabSettings.GlobalErrorHandler.callback(error); + PlayFabResult result = new PlayFabResult(); + result.Error = error; + return result; + } + String resultRawJson = (String) httpResult; + + PlayFabJsonSuccess resultData = gson.fromJson(resultRawJson, new TypeToken>(){}.getType()); + DeletePlayerSharedSecretResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + + /** + * Returns all Player Shared Secret Keys including disabled and expired. + * @param request GetPlayerSharedSecretsRequest + * @return Async Task will return GetPlayerSharedSecretsResult + */ + @SuppressWarnings("unchecked") + public static FutureTask> GetPlayerSharedSecretsAsync(final GetPlayerSharedSecretsRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateGetPlayerSharedSecretsAsync(request); + } + }); + } + + /** + * Returns all Player Shared Secret Keys including disabled and expired. + * @param request GetPlayerSharedSecretsRequest + * @return GetPlayerSharedSecretsResult + */ + @SuppressWarnings("unchecked") + public static PlayFabResult GetPlayerSharedSecrets(final GetPlayerSharedSecretsRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateGetPlayerSharedSecretsAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Returns all Player Shared Secret Keys including disabled and expired. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateGetPlayerSharedSecretsAsync(final GetPlayerSharedSecretsRequest request) throws Exception { + if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method"); + + FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL() + "/Admin/GetPlayerSharedSecrets", request, "X-SecretKey", PlayFabSettings.DeveloperSecretKey); + task.run(); + Object httpResult = task.get(); + if(httpResult instanceof PlayFabError) { + PlayFabError error = (PlayFabError)httpResult; + if (PlayFabSettings.GlobalErrorHandler != null) + PlayFabSettings.GlobalErrorHandler.callback(error); + PlayFabResult result = new PlayFabResult(); + result.Error = error; + return result; + } + String resultRawJson = (String) httpResult; + + PlayFabJsonSuccess resultData = gson.fromJson(resultRawJson, new TypeToken>(){}.getType()); + GetPlayerSharedSecretsResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + /** * Gets the requested policy. * @param request GetPolicyRequest @@ -78,6 +264,130 @@ private static PlayFabResult privateGetPolicyAsync(final GetP return pfResult; } + /** + * Sets or resets the player's secret. Player secrets are used to sign API requests. + * @param request SetPlayerSecretRequest + * @return Async Task will return SetPlayerSecretResult + */ + @SuppressWarnings("unchecked") + public static FutureTask> SetPlayerSecretAsync(final SetPlayerSecretRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateSetPlayerSecretAsync(request); + } + }); + } + + /** + * Sets or resets the player's secret. Player secrets are used to sign API requests. + * @param request SetPlayerSecretRequest + * @return SetPlayerSecretResult + */ + @SuppressWarnings("unchecked") + public static PlayFabResult SetPlayerSecret(final SetPlayerSecretRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateSetPlayerSecretAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Sets or resets the player's secret. Player secrets are used to sign API requests. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateSetPlayerSecretAsync(final SetPlayerSecretRequest request) throws Exception { + if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method"); + + FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL() + "/Admin/SetPlayerSecret", request, "X-SecretKey", PlayFabSettings.DeveloperSecretKey); + task.run(); + Object httpResult = task.get(); + if(httpResult instanceof PlayFabError) { + PlayFabError error = (PlayFabError)httpResult; + if (PlayFabSettings.GlobalErrorHandler != null) + PlayFabSettings.GlobalErrorHandler.callback(error); + PlayFabResult result = new PlayFabResult(); + result.Error = error; + return result; + } + String resultRawJson = (String) httpResult; + + PlayFabJsonSuccess resultData = gson.fromJson(resultRawJson, new TypeToken>(){}.getType()); + SetPlayerSecretResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + + /** + * Updates a existing Player Shared Secret Key. It may take up to 5 minutes for this update to become generally available after this API returns. + * @param request UpdatePlayerSharedSecretRequest + * @return Async Task will return UpdatePlayerSharedSecretResult + */ + @SuppressWarnings("unchecked") + public static FutureTask> UpdatePlayerSharedSecretAsync(final UpdatePlayerSharedSecretRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateUpdatePlayerSharedSecretAsync(request); + } + }); + } + + /** + * Updates a existing Player Shared Secret Key. It may take up to 5 minutes for this update to become generally available after this API returns. + * @param request UpdatePlayerSharedSecretRequest + * @return UpdatePlayerSharedSecretResult + */ + @SuppressWarnings("unchecked") + public static PlayFabResult UpdatePlayerSharedSecret(final UpdatePlayerSharedSecretRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateUpdatePlayerSharedSecretAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Updates a existing Player Shared Secret Key. It may take up to 5 minutes for this update to become generally available after this API returns. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateUpdatePlayerSharedSecretAsync(final UpdatePlayerSharedSecretRequest request) throws Exception { + if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method"); + + FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL() + "/Admin/UpdatePlayerSharedSecret", request, "X-SecretKey", PlayFabSettings.DeveloperSecretKey); + task.run(); + Object httpResult = task.get(); + if(httpResult instanceof PlayFabError) { + PlayFabError error = (PlayFabError)httpResult; + if (PlayFabSettings.GlobalErrorHandler != null) + PlayFabSettings.GlobalErrorHandler.callback(error); + PlayFabResult result = new PlayFabResult(); + result.Error = error; + return result; + } + String resultRawJson = (String) httpResult; + + PlayFabJsonSuccess resultData = gson.fromJson(resultRawJson, new TypeToken>(){}.getType()); + UpdatePlayerSharedSecretResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + /** * Changes a policy for a title * @param request UpdatePolicyRequest diff --git a/PlayFabServerSDK/src/main/java/com/playfab/PlayFabAdminModels.java b/PlayFabServerSDK/src/main/java/com/playfab/PlayFabAdminModels.java index 796eb065..344a1d5e 100644 --- a/PlayFabServerSDK/src/main/java/com/playfab/PlayFabAdminModels.java +++ b/PlayFabServerSDK/src/main/java/com/playfab/PlayFabAdminModels.java @@ -883,6 +883,22 @@ public static class CreateCloudScriptTaskRequest { } + public static class CreatePlayerSharedSecretRequest { + /** + * Friendly name for this key + */ + public String FriendlyName; + + } + + public static class CreatePlayerSharedSecretResult { + /** + * The player shared secret to use when calling Client/GetTitlePublicKey + */ + public String SecretKey; + + } + public static class CreatePlayerStatisticDefinitionRequest { /** * unique name of the statistic @@ -1088,6 +1104,18 @@ public static class DeleteContentRequest { } + public static class DeletePlayerSharedSecretRequest { + /** + * The shared secret key to delete + */ + public String SecretKey; + + } + + public static class DeletePlayerSharedSecretResult { + + } + public static class DeleteStoreRequest { /** * catalog version of the store to delete. If null, uses the default catalog. @@ -1485,6 +1513,18 @@ public static class GetPlayerSegmentsResult { } + public static class GetPlayerSharedSecretsRequest { + + } + + public static class GetPlayerSharedSecretsResult { + /** + * The player shared secret to use when calling Client/GetTitlePublicKey + */ + public ArrayList SharedSecrets; + + } + public static class GetPlayersInSegmentRequest { /** * Unique identifier for this segment. @@ -2579,6 +2619,12 @@ public static class PushNotificationRegistration { } + public static enum PushSetupPlatform { + GCM, + APNS, + APNS_SANDBOX + } + public static class RandomResultTable { /** * Unique name for this drop table @@ -2909,6 +2955,22 @@ public static class SendAccountRecoveryEmailResult { } + public static class SetPlayerSecretRequest { + /** + * Player secret that is used to verify API request signatures (Enterprise Only). + */ + public String PlayerSecret; + /** + * Unique PlayFab assigned ID of the user on whom the operation will be performed. + */ + public String PlayFabId; + + } + + public static class SetPlayerSecretResult { + + } + public static class SetPublishedRevisionRequest { /** * Version number @@ -2965,7 +3027,7 @@ public static class SetupPushNotificationRequest { /** * supported notification platforms are Apple Push Notification Service (APNS and APNS_SANDBOX) for iOS and Google Cloud Messaging (GCM) for Android */ - public String Platform; + public PushSetupPlatform Platform; /** * for APNS, this is the PlatformPrincipal (SSL Certificate) */ @@ -2989,6 +3051,22 @@ public static class SetupPushNotificationResult { } + public static class SharedSecret { + /** + * The player shared secret to use when calling Client/GetTitlePublicKey + */ + public String SecretKey; + /** + * Friendly name for this key + */ + public String FriendlyName; + /** + * Flag to indicate if this key is disabled + */ + public Boolean Disabled; + + } + public static enum SourceType { Admin, BackEnd, @@ -3251,6 +3329,26 @@ public static class UpdateCloudScriptResult { } + public static class UpdatePlayerSharedSecretRequest { + /** + * The shared secret key to update + */ + public String SecretKey; + /** + * Friendly name for this key + */ + public String FriendlyName; + /** + * Disable or Enable this key + */ + public Boolean Disabled; + + } + + public static class UpdatePlayerSharedSecretResult { + + } + public static class UpdatePlayerStatisticDefinitionRequest { /** * unique name of the statistic diff --git a/PlayFabServerSDK/src/main/java/com/playfab/PlayFabMatchmakerModels.java b/PlayFabServerSDK/src/main/java/com/playfab/PlayFabMatchmakerModels.java index bbbba1b7..6a7d7938 100644 --- a/PlayFabServerSDK/src/main/java/com/playfab/PlayFabMatchmakerModels.java +++ b/PlayFabServerSDK/src/main/java/com/playfab/PlayFabMatchmakerModels.java @@ -152,6 +152,10 @@ public static enum Region { } public static class RegisterGameRequest { + /** + * Previous lobby id if re-registering an existing game. + */ + public String LobbyId; /** * IP address of the Game Server Instance. */ @@ -181,7 +185,7 @@ public static class RegisterGameRequest { public static class RegisterGameResponse { /** - * Unique identifier generated for the Game Server Instance that is registered. + * Unique identifier generated for the Game Server Instance that is registered. If LobbyId is specified in request and the game still exists in PlayFab, the LobbyId in request is returned. Otherwise a new lobby id will be returned. */ public String LobbyId; diff --git a/PlayFabServerSDK/src/main/java/com/playfab/PlayFabServerAPI.java b/PlayFabServerSDK/src/main/java/com/playfab/PlayFabServerAPI.java index 44c6e6ea..1f6123a6 100644 --- a/PlayFabServerSDK/src/main/java/com/playfab/PlayFabServerAPI.java +++ b/PlayFabServerSDK/src/main/java/com/playfab/PlayFabServerAPI.java @@ -78,6 +78,68 @@ private static PlayFabResult privateAuthenticat return pfResult; } + /** + * Sets the player's secret if it is not already set. Player secrets are used to sign API requests. To reset a player's secret use the Admin or Server API method SetPlayerSecret. + * @param request SetPlayerSecretRequest + * @return Async Task will return SetPlayerSecretResult + */ + @SuppressWarnings("unchecked") + public static FutureTask> SetPlayerSecretAsync(final SetPlayerSecretRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateSetPlayerSecretAsync(request); + } + }); + } + + /** + * Sets the player's secret if it is not already set. Player secrets are used to sign API requests. To reset a player's secret use the Admin or Server API method SetPlayerSecret. + * @param request SetPlayerSecretRequest + * @return SetPlayerSecretResult + */ + @SuppressWarnings("unchecked") + public static PlayFabResult SetPlayerSecret(final SetPlayerSecretRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateSetPlayerSecretAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Sets the player's secret if it is not already set. Player secrets are used to sign API requests. To reset a player's secret use the Admin or Server API method SetPlayerSecret. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateSetPlayerSecretAsync(final SetPlayerSecretRequest request) throws Exception { + if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method"); + + FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL() + "/Server/SetPlayerSecret", request, "X-SecretKey", PlayFabSettings.DeveloperSecretKey); + task.run(); + Object httpResult = task.get(); + if(httpResult instanceof PlayFabError) { + PlayFabError error = (PlayFabError)httpResult; + if (PlayFabSettings.GlobalErrorHandler != null) + PlayFabSettings.GlobalErrorHandler.callback(error); + PlayFabResult result = new PlayFabResult(); + result.Error = error; + return result; + } + String resultRawJson = (String) httpResult; + + PlayFabJsonSuccess resultData = gson.fromJson(resultRawJson, new TypeToken>(){}.getType()); + SetPlayerSecretResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + /** * Bans users by PlayFab ID with optional IP address, or MAC address for the provided game. * @param request BanUsersRequest diff --git a/PlayFabServerSDK/src/main/java/com/playfab/PlayFabServerModels.java b/PlayFabServerSDK/src/main/java/com/playfab/PlayFabServerModels.java index a3569caa..c8fe2347 100644 --- a/PlayFabServerSDK/src/main/java/com/playfab/PlayFabServerModels.java +++ b/PlayFabServerSDK/src/main/java/com/playfab/PlayFabServerModels.java @@ -1447,13 +1447,9 @@ public static class GetFriendLeaderboardRequest { */ public Boolean IncludeFacebookFriends; /** - * The version of the leaderboard to get, when UseSpecificVersion is true. + * The version of the leaderboard to get. */ public Integer Version; - /** - * If true, uses the specified version. If false, gets the most recent version. - */ - public Boolean UseSpecificVersion; /** * If non-null, this determines which properties of the profile to return. If null, playfab will only include display names. For API calls from the client, only ShowDisplayName, ShowAvatarUrl are allowed at this time. */ @@ -1535,13 +1531,9 @@ public static class GetLeaderboardAroundUserRequest { */ public PlayerProfileViewConstraints ProfileConstraints; /** - * The version of the leaderboard to get, when UseSpecificVersion is true. + * The version of the leaderboard to get. */ public Integer Version; - /** - * If true, uses the specified version. If false, gets the most recent version. - */ - public Boolean UseSpecificVersion; } @@ -1603,13 +1595,9 @@ public static class GetLeaderboardRequest { */ public PlayerProfileViewConstraints ProfileConstraints; /** - * The version of the leaderboard to get, when UseSpecificVersion is true. + * The version of the leaderboard to get. */ public Integer Version; - /** - * If true, uses the specified version. If false, gets the most recent version. - */ - public Boolean UseSpecificVersion; } @@ -3034,6 +3022,34 @@ public static class PlayerStatisticVersion { } + public static class PushNotificationPackage { + /** + * If set, represents a timestamp for when the device should display the message. Local format should be formatted as: yyyy-MM-dd HH:mm:ss or UTC timestamp formatted as yyyy-MM-ddTHH:mm:ssZ. Delivery is not delayed, scheduling is expected to be handled by the device. + */ + public String ScheduleDate; + /** + * Title/Subject of the message + */ + public String Title; + /** + * Content of the message + */ + public String Message; + /** + * Icon file to display with the message + */ + public String Icon; + /** + * Sound file to play with the message + */ + public String Sound; + /** + * Arbitrary string that will be delivered with the message. Suggested use: JSON formatted object + */ + public String CustomData; + + } + public static enum PushNotificationPlatform { ApplePushNotificationService, GoogleCloudMessaging @@ -3158,6 +3174,10 @@ public static enum Region { } public static class RegisterGameRequest { + /** + * Previous lobby id if re-registering an existing game. + */ + public String LobbyId; /** * IP address of the Game Server Instance. */ @@ -3187,7 +3207,7 @@ public static class RegisterGameRequest { public static class RegisterGameResponse { /** - * Unique identifier generated for the Game Server Instance that is registered. + * Unique identifier generated for the Game Server Instance that is registered. If LobbyId is specified in request and the game still exists in PlayFab, the LobbyId in request is returned. Otherwise a new lobby id will be returned. */ public String LobbyId; @@ -3361,9 +3381,14 @@ public static class SendPushNotificationRequest { */ public String Recipient; /** - * Text of message to send. + * @deprecated Please use Package instead. */ + @Deprecated public String Message; + /** + * Defines all possible push attributes like message, title, icon, etc + */ + public PushNotificationPackage Package; /** * Subject of message to send (may not be displayed in all platforms. */ @@ -3439,6 +3464,22 @@ public static class SetGameServerInstanceTagsResult { } + public static class SetPlayerSecretRequest { + /** + * Player secret that is used to verify API request signatures (Enterprise Only). + */ + public String PlayerSecret; + /** + * Unique PlayFab assigned ID of the user on whom the operation will be performed. + */ + public String PlayFabId; + + } + + public static class SetPlayerSecretResult { + + } + public static class SetPublisherDataRequest { /** * key we want to set a value on (note, this is additive - will only replace an existing key's value if they are the same name.) Keys are trimmed of whitespace. Keys may not begin with the '!' character. diff --git a/PlayFabServerSDK/src/main/java/com/playfab/PlayFabSettings.java b/PlayFabServerSDK/src/main/java/com/playfab/PlayFabSettings.java index 3fb87a32..f01bb25f 100644 --- a/PlayFabServerSDK/src/main/java/com/playfab/PlayFabSettings.java +++ b/PlayFabServerSDK/src/main/java/com/playfab/PlayFabSettings.java @@ -3,9 +3,9 @@ import com.playfab.PlayFabErrors.ErrorCallback; public class PlayFabSettings { - public static String SdkVersion = "0.51.170612"; - public static String BuildIdentifier = "jbuild_javasdk_1"; - public static String SdkVersionString = "JavaSDK-0.51.170612"; + public static String SdkVersion = "0.52.170710"; + public static String BuildIdentifier = "jbuild_javasdk_2"; + public static String SdkVersionString = "JavaSDK-0.52.170710"; public static String TitleId = null; // You must set this value for PlayFabSdk to work properly (Found in the Game Manager for your title, at the PlayFab Website) public static ErrorCallback GlobalErrorHandler; diff --git a/builds/client-sdk-0.51.170612-javadoc.jar b/builds/client-sdk-0.51.170612-javadoc.jar deleted file mode 100644 index d4fddd59..00000000 Binary files a/builds/client-sdk-0.51.170612-javadoc.jar and /dev/null differ diff --git a/builds/client-sdk-0.51.170612.jar b/builds/client-sdk-0.51.170612.jar deleted file mode 100644 index 3530b2c8..00000000 Binary files a/builds/client-sdk-0.51.170612.jar and /dev/null differ diff --git a/builds/client-sdk-0.52.170710-javadoc.jar b/builds/client-sdk-0.52.170710-javadoc.jar new file mode 100644 index 00000000..99235222 Binary files /dev/null and b/builds/client-sdk-0.52.170710-javadoc.jar differ diff --git a/builds/client-sdk-0.52.170710.jar b/builds/client-sdk-0.52.170710.jar new file mode 100644 index 00000000..9485bebe Binary files /dev/null and b/builds/client-sdk-0.52.170710.jar differ diff --git a/builds/combo-sdk-0.51.170612-javadoc.jar b/builds/combo-sdk-0.51.170612-javadoc.jar deleted file mode 100644 index cc86ba35..00000000 Binary files a/builds/combo-sdk-0.51.170612-javadoc.jar and /dev/null differ diff --git a/builds/combo-sdk-0.51.170612.jar b/builds/combo-sdk-0.51.170612.jar deleted file mode 100644 index a3274c5e..00000000 Binary files a/builds/combo-sdk-0.51.170612.jar and /dev/null differ diff --git a/builds/combo-sdk-0.52.170710-javadoc.jar b/builds/combo-sdk-0.52.170710-javadoc.jar new file mode 100644 index 00000000..1df05aeb Binary files /dev/null and b/builds/combo-sdk-0.52.170710-javadoc.jar differ diff --git a/builds/combo-sdk-0.52.170710.jar b/builds/combo-sdk-0.52.170710.jar new file mode 100644 index 00000000..3e1874fd Binary files /dev/null and b/builds/combo-sdk-0.52.170710.jar differ diff --git a/builds/server-sdk-0.51.170612-javadoc.jar b/builds/server-sdk-0.51.170612-javadoc.jar deleted file mode 100644 index e670309b..00000000 Binary files a/builds/server-sdk-0.51.170612-javadoc.jar and /dev/null differ diff --git a/builds/server-sdk-0.51.170612.jar b/builds/server-sdk-0.51.170612.jar deleted file mode 100644 index eed3e4a0..00000000 Binary files a/builds/server-sdk-0.51.170612.jar and /dev/null differ diff --git a/builds/server-sdk-0.52.170710-javadoc.jar b/builds/server-sdk-0.52.170710-javadoc.jar new file mode 100644 index 00000000..1f85c836 Binary files /dev/null and b/builds/server-sdk-0.52.170710-javadoc.jar differ diff --git a/builds/server-sdk-0.52.170710.jar b/builds/server-sdk-0.52.170710.jar new file mode 100644 index 00000000..a5b78015 Binary files /dev/null and b/builds/server-sdk-0.52.170710.jar differ