diff --git a/AndroidStudioExample/app/src/main/java/com/playfab/PlayFabSettings.java b/AndroidStudioExample/app/src/main/java/com/playfab/PlayFabSettings.java index d0e0a6f04..967d1fcdb 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.36.160912"; + public static String SdkVersion = "0.37.160919"; public static String BuildIdentifier = "jbuild_javasdk_1"; - public static String SdkVersionString = "JavaSDK-0.36.160912"; + public static String SdkVersionString = "JavaSDK-0.37.160919"; 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/src/com/playfab/PlayFabSettings.java b/PlayFabClientSDK/src/com/playfab/PlayFabSettings.java index d3ed827fa..773d1f2c8 100644 --- a/PlayFabClientSDK/src/com/playfab/PlayFabSettings.java +++ b/PlayFabClientSDK/src/com/playfab/PlayFabSettings.java @@ -3,9 +3,9 @@ import com.playfab.PlayFabErrors.ErrorCallback; public class PlayFabSettings { - public static String SdkVersion = "0.36.160912"; + public static String SdkVersion = "0.37.160919"; public static String BuildIdentifier = "jbuild_javasdk_1"; - public static String SdkVersionString = "JavaSDK-0.36.160912"; + public static String SdkVersionString = "JavaSDK-0.37.160919"; 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/src/com/playfab/PlayFabAdminAPI.java b/PlayFabSDK/src/com/playfab/PlayFabAdminAPI.java index fe4988e41..667d9faa2 100644 --- a/PlayFabSDK/src/com/playfab/PlayFabAdminAPI.java +++ b/PlayFabSDK/src/com/playfab/PlayFabAdminAPI.java @@ -1234,6 +1234,64 @@ private static PlayFabResult privateIncre return pfResult; } + /** + * Attempts to process an order refund through the original real money payment provider. + */ + @SuppressWarnings("unchecked") + public static FutureTask> RefundPurchaseAsync(final RefundPurchaseRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateRefundPurchaseAsync(request); + } + }); + } + + /** + * Attempts to process an order refund through the original real money payment provider. + */ + @SuppressWarnings("unchecked") + public static PlayFabResult RefundPurchase(final RefundPurchaseRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateRefundPurchaseAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Attempts to process an order refund through the original real money payment provider. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateRefundPurchaseAsync(final RefundPurchaseRequest 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/RefundPurchase", 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()); + RefundPurchaseResponse result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + /** * Completely removes all statistics for the specified user, for the current game */ @@ -1292,6 +1350,64 @@ private static PlayFabResult privateResetUserStatisti return pfResult; } + /** + * Attempts to resolve a dispute with the original order's payment provider. + */ + @SuppressWarnings("unchecked") + public static FutureTask> ResolvePurchaseDisputeAsync(final ResolvePurchaseDisputeRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateResolvePurchaseDisputeAsync(request); + } + }); + } + + /** + * Attempts to resolve a dispute with the original order's payment provider. + */ + @SuppressWarnings("unchecked") + public static PlayFabResult ResolvePurchaseDispute(final ResolvePurchaseDisputeRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateResolvePurchaseDisputeAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Attempts to resolve a dispute with the original order's payment provider. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateResolvePurchaseDisputeAsync(final ResolvePurchaseDisputeRequest 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/ResolvePurchaseDispute", 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()); + ResolvePurchaseDisputeResponse result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + /** * Updates a player statistic configuration for the title, optionally allowing the developer to specify a reset interval. */ diff --git a/PlayFabSDK/src/com/playfab/PlayFabAdminModels.java b/PlayFabSDK/src/com/playfab/PlayFabAdminModels.java index e5623dc61..e1cca69c1 100644 --- a/PlayFabSDK/src/com/playfab/PlayFabAdminModels.java +++ b/PlayFabSDK/src/com/playfab/PlayFabAdminModels.java @@ -1909,6 +1909,30 @@ public static class RandomResultTableListing { } + public static class RefundPurchaseRequest { + /** + * Unique PlayFab assigned ID of the user on whom the operation will be performed. + */ + public String PlayFabId; + /** + * Unique order ID for the purchase in question. + */ + public String OrderId; + /** + * Reason for refund. In the case of Facebook this must match one of their refund or dispute resolution enums (See: https://developers.facebook.com/docs/payments/implementation-guide/handling-disputes-refunds) + */ + public String Reason; + + } + + public static class RefundPurchaseResponse { + /** + * The order's updated purchase status. + */ + public String PurchaseStatus; + + } + public static enum Region { USCentral, USEast, @@ -1991,6 +2015,40 @@ public static class ResetUserStatisticsResult { } + public static enum ResolutionOutcome { + Revoke, + Reinstate, + Manual + } + + public static class ResolvePurchaseDisputeRequest { + /** + * Unique PlayFab assigned ID of the user on whom the operation will be performed. + */ + public String PlayFabId; + /** + * Unique order ID for the purchase in question. + */ + public String OrderId; + /** + * Reason for refund. In the case of Facebook this must match one of their refund or dispute resolution enums (See: https://developers.facebook.com/docs/payments/implementation-guide/handling-disputes-refunds) + */ + public String Reason; + /** + * Enum for the desired purchase result state after notifying the payment provider. Valid values are Revoke, Reinstate and Manual. Manual will cause no change to the order state. + */ + public ResolutionOutcome Outcome; + + } + + public static class ResolvePurchaseDisputeResponse { + /** + * The order's updated purchase status. + */ + public String PurchaseStatus; + + } + public static class ResultTableNode { /** * Whether this entry in the table is an item or a link to another table diff --git a/PlayFabSDK/src/com/playfab/PlayFabMatchmakerModels.java b/PlayFabSDK/src/com/playfab/PlayFabMatchmakerModels.java index 28a1814e6..907307a8a 100644 --- a/PlayFabSDK/src/com/playfab/PlayFabMatchmakerModels.java +++ b/PlayFabSDK/src/com/playfab/PlayFabMatchmakerModels.java @@ -25,6 +25,18 @@ public static class AuthUserResponse { } + public static class DeregisterGameRequest { + /** + * Unique identifier for the Game Server Instance that is being deregistered. + */ + public String LobbyId; + + } + + public static class DeregisterGameResponse { + + } + /** * A unique instance of an item in a user's inventory. Note, to retrieve additional information for an item instance (such as Tags, Description, or Custom Data that are set on the root catalog item), a call to GetCatalogItems is required. The Item ID of the instance can then be matched to a catalog entry, which contains the additional information. Also note that Custom Data is only set here from a call to UpdateUserInventoryItemCustomData. */ @@ -139,6 +151,42 @@ public static enum Region { Australia } + public static class RegisterGameRequest { + /** + * IP address of the Game Server Instance. + */ + public String ServerHost; + /** + * Port number for communication with the Game Server Instance. + */ + public String ServerPort; + /** + * Unique identifier of the build running on the Game Server Instance. + */ + public String Build; + /** + * Unique identifier of the build running on the Game Server Instance. + */ + public Region Region; + /** + * Unique identifier of the build running on the Game Server Instance. + */ + public String GameMode; + /** + * Tags for the Game Server Instance + */ + public Map Tags; + + } + + public static class RegisterGameResponse { + /** + * Unique identifier generated for the Game Server Instance that is registered. + */ + public String LobbyId; + + } + public static class StartGameRequest { /** * Unique identifier of the previously uploaded build executable which is to be started. diff --git a/PlayFabSDK/src/com/playfab/PlayFabServerAPI.java b/PlayFabSDK/src/com/playfab/PlayFabServerAPI.java index 737a441a0..05f7b8c02 100644 --- a/PlayFabSDK/src/com/playfab/PlayFabServerAPI.java +++ b/PlayFabSDK/src/com/playfab/PlayFabServerAPI.java @@ -654,6 +654,64 @@ private static PlayFabResult privateDeleteUsersAsync(final De return pfResult; } + /** + * Retrieves a list of ranked friends of the given player for the given statistic, starting from the indicated point in the leaderboard + */ + @SuppressWarnings("unchecked") + public static FutureTask> GetFriendLeaderboardAsync(final GetFriendLeaderboardRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateGetFriendLeaderboardAsync(request); + } + }); + } + + /** + * Retrieves a list of ranked friends of the given player for the given statistic, starting from the indicated point in the leaderboard + */ + @SuppressWarnings("unchecked") + public static PlayFabResult GetFriendLeaderboard(final GetFriendLeaderboardRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateGetFriendLeaderboardAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Retrieves a list of ranked friends of the given player for the given statistic, starting from the indicated point in the leaderboard + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateGetFriendLeaderboardAsync(final GetFriendLeaderboardRequest 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/GetFriendLeaderboard", 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()); + GetLeaderboardResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + /** * Retrieves a list of ranked users for the given statistic, starting from the indicated point in the leaderboard */ @@ -3560,6 +3618,238 @@ private static PlayFabResult privateUpdateUserInventoryItemCustomDa return pfResult; } + /** + * Adds the Friend user to the friendlist of the user with PlayFabId. At least one of FriendPlayFabId,FriendUsername,FriendEmail, or FriendTitleDisplayName should be initialized. + */ + @SuppressWarnings("unchecked") + public static FutureTask> AddFriendAsync(final AddFriendRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateAddFriendAsync(request); + } + }); + } + + /** + * Adds the Friend user to the friendlist of the user with PlayFabId. At least one of FriendPlayFabId,FriendUsername,FriendEmail, or FriendTitleDisplayName should be initialized. + */ + @SuppressWarnings("unchecked") + public static PlayFabResult AddFriend(final AddFriendRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateAddFriendAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Adds the Friend user to the friendlist of the user with PlayFabId. At least one of FriendPlayFabId,FriendUsername,FriendEmail, or FriendTitleDisplayName should be initialized. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateAddFriendAsync(final AddFriendRequest 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/AddFriend", 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()); + EmptyResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + + /** + * Retrieves the current friends for the user with PlayFabId, constrained to users who have PlayFab accounts. Friends from linked accounts (Facebook, Steam) are also included. You may optionally exclude some linked services' friends. + */ + @SuppressWarnings("unchecked") + public static FutureTask> GetFriendsListAsync(final GetFriendsListRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateGetFriendsListAsync(request); + } + }); + } + + /** + * Retrieves the current friends for the user with PlayFabId, constrained to users who have PlayFab accounts. Friends from linked accounts (Facebook, Steam) are also included. You may optionally exclude some linked services' friends. + */ + @SuppressWarnings("unchecked") + public static PlayFabResult GetFriendsList(final GetFriendsListRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateGetFriendsListAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Retrieves the current friends for the user with PlayFabId, constrained to users who have PlayFab accounts. Friends from linked accounts (Facebook, Steam) are also included. You may optionally exclude some linked services' friends. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateGetFriendsListAsync(final GetFriendsListRequest 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/GetFriendsList", 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()); + GetFriendsListResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + + /** + * Removes the specified friend from the the user's friend list + */ + @SuppressWarnings("unchecked") + public static FutureTask> RemoveFriendAsync(final RemoveFriendRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateRemoveFriendAsync(request); + } + }); + } + + /** + * Removes the specified friend from the the user's friend list + */ + @SuppressWarnings("unchecked") + public static PlayFabResult RemoveFriend(final RemoveFriendRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateRemoveFriendAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Removes the specified friend from the the user's friend list + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateRemoveFriendAsync(final RemoveFriendRequest 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/RemoveFriend", 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()); + EmptyResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + + /** + * Inform the matchmaker that a Game Server Instance is removed. + */ + @SuppressWarnings("unchecked") + public static FutureTask> DeregisterGameAsync(final DeregisterGameRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateDeregisterGameAsync(request); + } + }); + } + + /** + * Inform the matchmaker that a Game Server Instance is removed. + */ + @SuppressWarnings("unchecked") + public static PlayFabResult DeregisterGame(final DeregisterGameRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateDeregisterGameAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Inform the matchmaker that a Game Server Instance is removed. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateDeregisterGameAsync(final DeregisterGameRequest 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/DeregisterGame", 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()); + DeregisterGameResponse result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + /** * Informs the PlayFab match-making service that the user specified has left the Game Server Instance */ @@ -3676,6 +3966,122 @@ private static PlayFabResult privateRedeemMatchmak return pfResult; } + /** + * Set the state of the indicated Game Server Instance. Also update the heartbeat for the instance. + */ + @SuppressWarnings("unchecked") + public static FutureTask> RefreshGameServerInstanceHeartbeatAsync(final RefreshGameServerInstanceHeartbeatRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateRefreshGameServerInstanceHeartbeatAsync(request); + } + }); + } + + /** + * Set the state of the indicated Game Server Instance. Also update the heartbeat for the instance. + */ + @SuppressWarnings("unchecked") + public static PlayFabResult RefreshGameServerInstanceHeartbeat(final RefreshGameServerInstanceHeartbeatRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateRefreshGameServerInstanceHeartbeatAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Set the state of the indicated Game Server Instance. Also update the heartbeat for the instance. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateRefreshGameServerInstanceHeartbeatAsync(final RefreshGameServerInstanceHeartbeatRequest 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/RefreshGameServerInstanceHeartbeat", 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()); + RefreshGameServerInstanceHeartbeatResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + + /** + * Inform the matchmaker that a new Game Server Instance is added. + */ + @SuppressWarnings("unchecked") + public static FutureTask> RegisterGameAsync(final RegisterGameRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateRegisterGameAsync(request); + } + }); + } + + /** + * Inform the matchmaker that a new Game Server Instance is added. + */ + @SuppressWarnings("unchecked") + public static PlayFabResult RegisterGame(final RegisterGameRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateRegisterGameAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Inform the matchmaker that a new Game Server Instance is added. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateRegisterGameAsync(final RegisterGameRequest 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/RegisterGame", 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()); + RegisterGameResponse result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + /** * Sets the custom data of the indicated Game Server Instance */ @@ -3792,6 +4198,64 @@ private static PlayFabResult privateSetGameSer return pfResult; } + /** + * Set custom tags for the specified Game Server Instance + */ + @SuppressWarnings("unchecked") + public static FutureTask> SetGameServerInstanceTagsAsync(final SetGameServerInstanceTagsRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateSetGameServerInstanceTagsAsync(request); + } + }); + } + + /** + * Set custom tags for the specified Game Server Instance + */ + @SuppressWarnings("unchecked") + public static PlayFabResult SetGameServerInstanceTags(final SetGameServerInstanceTagsRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateSetGameServerInstanceTagsAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Set custom tags for the specified Game Server Instance + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateSetGameServerInstanceTagsAsync(final SetGameServerInstanceTagsRequest 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/SetGameServerInstanceTags", 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()); + SetGameServerInstanceTagsResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + /** * Awards the specified users the specified Steam achievements */ diff --git a/PlayFabSDK/src/com/playfab/PlayFabServerModels.java b/PlayFabSDK/src/com/playfab/PlayFabServerModels.java index 9506e3ec8..d45cbd8d5 100644 --- a/PlayFabSDK/src/com/playfab/PlayFabServerModels.java +++ b/PlayFabSDK/src/com/playfab/PlayFabServerModels.java @@ -41,6 +41,30 @@ public static class AddCharacterVirtualCurrencyRequest { } + public static class AddFriendRequest { + /** + * PlayFab identifier of the player to add a new friend. + */ + public String PlayFabId; + /** + * The PlayFab identifier of the user being added. + */ + public String FriendPlayFabId; + /** + * The PlayFab username of the user being added + */ + public String FriendUsername; + /** + * Email address of the user being added. + */ + public String FriendEmail; + /** + * Title-specific display name of the user to being added. + */ + public String FriendTitleDisplayName; + + } + public static class AddPlayerTagRequest { /** * Unique PlayFab assigned ID of the user on whom the operation will be performed. @@ -686,6 +710,18 @@ public static class DeleteUsersResult { } + public static class DeregisterGameRequest { + /** + * Unique identifier for the Game Server Instance that is being deregistered. + */ + public String LobbyId; + + } + + public static class DeregisterGameResponse { + + } + public static class EmptyResult { } @@ -1047,6 +1083,58 @@ public static class GetContentDownloadUrlResult { } + public static class GetFriendLeaderboardRequest { + /** + * The player whose friend leaderboard to get + */ + public String PlayFabId; + /** + * Statistic used to rank friends for this leaderboard. + */ + public String StatisticName; + /** + * Position in the leaderboard to start this listing (defaults to the first entry). + */ + public Integer StartPosition; + /** + * Maximum number of entries to retrieve. + */ + public Integer MaxResultsCount; + /** + * Indicates whether Steam service friends should be included in the response. Default is true. + */ + public Boolean IncludeSteamFriends; + /** + * Indicates whether Facebook friends should be included in the response. Default is true. + */ + public Boolean IncludeFacebookFriends; + + } + + public static class GetFriendsListRequest { + /** + * PlayFab identifier of the player whose friend list to get. + */ + public String PlayFabId; + /** + * Indicates whether Steam service friends should be included in the response. Default is true. + */ + public Boolean IncludeSteamFriends; + /** + * Indicates whether Facebook friends should be included in the response. Default is true. + */ + public Boolean IncludeFacebookFriends; + + } + + public static class GetFriendsListResult { + /** + * Array of friends found. + */ + public ArrayList Friends; + + } + public static class GetLeaderboardAroundCharacterRequest { /** * Unique identifier for the title-specific statistic for the leaderboard. @@ -2449,6 +2537,76 @@ public static class RedeemMatchmakerTicketResult { } + public static class RefreshGameServerInstanceHeartbeatRequest { + /** + * Unique identifier of the Game Server Instance for which the heartbeat is updated. + */ + public String LobbyId; + + } + + public static class RefreshGameServerInstanceHeartbeatResult { + + } + + public static enum Region { + USCentral, + USEast, + EUWest, + Singapore, + Japan, + Brazil, + Australia + } + + public static class RegisterGameRequest { + /** + * IP address of the Game Server Instance. + */ + public String ServerHost; + /** + * Port number for communication with the Game Server Instance. + */ + public String ServerPort; + /** + * Unique identifier of the build running on the Game Server Instance. + */ + public String Build; + /** + * Unique identifier of the build running on the Game Server Instance. + */ + public Region Region; + /** + * Unique identifier of the build running on the Game Server Instance. + */ + public String GameMode; + /** + * Tags for the Game Server Instance + */ + public Map Tags; + + } + + public static class RegisterGameResponse { + /** + * Unique identifier generated for the Game Server Instance that is registered. + */ + public String LobbyId; + + } + + public static class RemoveFriendRequest { + /** + * PlayFab identifier of the friend account which is to be removed. + */ + public String FriendPlayFabId; + /** + * Unique PlayFab assigned ID of the user on whom the operation will be performed. + */ + public String PlayFabId; + + } + public static class RemovePlayerTagRequest { /** * Unique PlayFab assigned ID of the user on whom the operation will be performed. @@ -2654,6 +2812,22 @@ public static class SetGameServerInstanceStateResult { } + public static class SetGameServerInstanceTagsRequest { + /** + * Unique identifier of the Game Server Instance to be updated. + */ + public String LobbyId; + /** + * Tags to set for the specified Game Server Instance. Note that this is the complete list of tags to be associated with the Game Server Instance. + */ + public Map Tags; + + } + + public static class SetGameServerInstanceTagsResult { + + } + 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/com/playfab/PlayFabSettings.java b/PlayFabSDK/src/com/playfab/PlayFabSettings.java index b8241fce6..d87df79f7 100644 --- a/PlayFabSDK/src/com/playfab/PlayFabSettings.java +++ b/PlayFabSDK/src/com/playfab/PlayFabSettings.java @@ -3,9 +3,9 @@ import com.playfab.PlayFabErrors.ErrorCallback; public class PlayFabSettings { - public static String SdkVersion = "0.36.160912"; + public static String SdkVersion = "0.37.160919"; public static String BuildIdentifier = "jbuild_javasdk_1"; - public static String SdkVersionString = "JavaSDK-0.36.160912"; + public static String SdkVersionString = "JavaSDK-0.37.160919"; 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/src/com/playfab/PlayFabAdminAPI.java b/PlayFabServerSDK/src/com/playfab/PlayFabAdminAPI.java index fe4988e41..667d9faa2 100644 --- a/PlayFabServerSDK/src/com/playfab/PlayFabAdminAPI.java +++ b/PlayFabServerSDK/src/com/playfab/PlayFabAdminAPI.java @@ -1234,6 +1234,64 @@ private static PlayFabResult privateIncre return pfResult; } + /** + * Attempts to process an order refund through the original real money payment provider. + */ + @SuppressWarnings("unchecked") + public static FutureTask> RefundPurchaseAsync(final RefundPurchaseRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateRefundPurchaseAsync(request); + } + }); + } + + /** + * Attempts to process an order refund through the original real money payment provider. + */ + @SuppressWarnings("unchecked") + public static PlayFabResult RefundPurchase(final RefundPurchaseRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateRefundPurchaseAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Attempts to process an order refund through the original real money payment provider. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateRefundPurchaseAsync(final RefundPurchaseRequest 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/RefundPurchase", 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()); + RefundPurchaseResponse result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + /** * Completely removes all statistics for the specified user, for the current game */ @@ -1292,6 +1350,64 @@ private static PlayFabResult privateResetUserStatisti return pfResult; } + /** + * Attempts to resolve a dispute with the original order's payment provider. + */ + @SuppressWarnings("unchecked") + public static FutureTask> ResolvePurchaseDisputeAsync(final ResolvePurchaseDisputeRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateResolvePurchaseDisputeAsync(request); + } + }); + } + + /** + * Attempts to resolve a dispute with the original order's payment provider. + */ + @SuppressWarnings("unchecked") + public static PlayFabResult ResolvePurchaseDispute(final ResolvePurchaseDisputeRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateResolvePurchaseDisputeAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Attempts to resolve a dispute with the original order's payment provider. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateResolvePurchaseDisputeAsync(final ResolvePurchaseDisputeRequest 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/ResolvePurchaseDispute", 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()); + ResolvePurchaseDisputeResponse result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + /** * Updates a player statistic configuration for the title, optionally allowing the developer to specify a reset interval. */ diff --git a/PlayFabServerSDK/src/com/playfab/PlayFabAdminModels.java b/PlayFabServerSDK/src/com/playfab/PlayFabAdminModels.java index e5623dc61..e1cca69c1 100644 --- a/PlayFabServerSDK/src/com/playfab/PlayFabAdminModels.java +++ b/PlayFabServerSDK/src/com/playfab/PlayFabAdminModels.java @@ -1909,6 +1909,30 @@ public static class RandomResultTableListing { } + public static class RefundPurchaseRequest { + /** + * Unique PlayFab assigned ID of the user on whom the operation will be performed. + */ + public String PlayFabId; + /** + * Unique order ID for the purchase in question. + */ + public String OrderId; + /** + * Reason for refund. In the case of Facebook this must match one of their refund or dispute resolution enums (See: https://developers.facebook.com/docs/payments/implementation-guide/handling-disputes-refunds) + */ + public String Reason; + + } + + public static class RefundPurchaseResponse { + /** + * The order's updated purchase status. + */ + public String PurchaseStatus; + + } + public static enum Region { USCentral, USEast, @@ -1991,6 +2015,40 @@ public static class ResetUserStatisticsResult { } + public static enum ResolutionOutcome { + Revoke, + Reinstate, + Manual + } + + public static class ResolvePurchaseDisputeRequest { + /** + * Unique PlayFab assigned ID of the user on whom the operation will be performed. + */ + public String PlayFabId; + /** + * Unique order ID for the purchase in question. + */ + public String OrderId; + /** + * Reason for refund. In the case of Facebook this must match one of their refund or dispute resolution enums (See: https://developers.facebook.com/docs/payments/implementation-guide/handling-disputes-refunds) + */ + public String Reason; + /** + * Enum for the desired purchase result state after notifying the payment provider. Valid values are Revoke, Reinstate and Manual. Manual will cause no change to the order state. + */ + public ResolutionOutcome Outcome; + + } + + public static class ResolvePurchaseDisputeResponse { + /** + * The order's updated purchase status. + */ + public String PurchaseStatus; + + } + public static class ResultTableNode { /** * Whether this entry in the table is an item or a link to another table diff --git a/PlayFabServerSDK/src/com/playfab/PlayFabMatchmakerModels.java b/PlayFabServerSDK/src/com/playfab/PlayFabMatchmakerModels.java index 28a1814e6..907307a8a 100644 --- a/PlayFabServerSDK/src/com/playfab/PlayFabMatchmakerModels.java +++ b/PlayFabServerSDK/src/com/playfab/PlayFabMatchmakerModels.java @@ -25,6 +25,18 @@ public static class AuthUserResponse { } + public static class DeregisterGameRequest { + /** + * Unique identifier for the Game Server Instance that is being deregistered. + */ + public String LobbyId; + + } + + public static class DeregisterGameResponse { + + } + /** * A unique instance of an item in a user's inventory. Note, to retrieve additional information for an item instance (such as Tags, Description, or Custom Data that are set on the root catalog item), a call to GetCatalogItems is required. The Item ID of the instance can then be matched to a catalog entry, which contains the additional information. Also note that Custom Data is only set here from a call to UpdateUserInventoryItemCustomData. */ @@ -139,6 +151,42 @@ public static enum Region { Australia } + public static class RegisterGameRequest { + /** + * IP address of the Game Server Instance. + */ + public String ServerHost; + /** + * Port number for communication with the Game Server Instance. + */ + public String ServerPort; + /** + * Unique identifier of the build running on the Game Server Instance. + */ + public String Build; + /** + * Unique identifier of the build running on the Game Server Instance. + */ + public Region Region; + /** + * Unique identifier of the build running on the Game Server Instance. + */ + public String GameMode; + /** + * Tags for the Game Server Instance + */ + public Map Tags; + + } + + public static class RegisterGameResponse { + /** + * Unique identifier generated for the Game Server Instance that is registered. + */ + public String LobbyId; + + } + public static class StartGameRequest { /** * Unique identifier of the previously uploaded build executable which is to be started. diff --git a/PlayFabServerSDK/src/com/playfab/PlayFabServerAPI.java b/PlayFabServerSDK/src/com/playfab/PlayFabServerAPI.java index 737a441a0..05f7b8c02 100644 --- a/PlayFabServerSDK/src/com/playfab/PlayFabServerAPI.java +++ b/PlayFabServerSDK/src/com/playfab/PlayFabServerAPI.java @@ -654,6 +654,64 @@ private static PlayFabResult privateDeleteUsersAsync(final De return pfResult; } + /** + * Retrieves a list of ranked friends of the given player for the given statistic, starting from the indicated point in the leaderboard + */ + @SuppressWarnings("unchecked") + public static FutureTask> GetFriendLeaderboardAsync(final GetFriendLeaderboardRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateGetFriendLeaderboardAsync(request); + } + }); + } + + /** + * Retrieves a list of ranked friends of the given player for the given statistic, starting from the indicated point in the leaderboard + */ + @SuppressWarnings("unchecked") + public static PlayFabResult GetFriendLeaderboard(final GetFriendLeaderboardRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateGetFriendLeaderboardAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Retrieves a list of ranked friends of the given player for the given statistic, starting from the indicated point in the leaderboard + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateGetFriendLeaderboardAsync(final GetFriendLeaderboardRequest 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/GetFriendLeaderboard", 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()); + GetLeaderboardResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + /** * Retrieves a list of ranked users for the given statistic, starting from the indicated point in the leaderboard */ @@ -3560,6 +3618,238 @@ private static PlayFabResult privateUpdateUserInventoryItemCustomDa return pfResult; } + /** + * Adds the Friend user to the friendlist of the user with PlayFabId. At least one of FriendPlayFabId,FriendUsername,FriendEmail, or FriendTitleDisplayName should be initialized. + */ + @SuppressWarnings("unchecked") + public static FutureTask> AddFriendAsync(final AddFriendRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateAddFriendAsync(request); + } + }); + } + + /** + * Adds the Friend user to the friendlist of the user with PlayFabId. At least one of FriendPlayFabId,FriendUsername,FriendEmail, or FriendTitleDisplayName should be initialized. + */ + @SuppressWarnings("unchecked") + public static PlayFabResult AddFriend(final AddFriendRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateAddFriendAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Adds the Friend user to the friendlist of the user with PlayFabId. At least one of FriendPlayFabId,FriendUsername,FriendEmail, or FriendTitleDisplayName should be initialized. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateAddFriendAsync(final AddFriendRequest 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/AddFriend", 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()); + EmptyResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + + /** + * Retrieves the current friends for the user with PlayFabId, constrained to users who have PlayFab accounts. Friends from linked accounts (Facebook, Steam) are also included. You may optionally exclude some linked services' friends. + */ + @SuppressWarnings("unchecked") + public static FutureTask> GetFriendsListAsync(final GetFriendsListRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateGetFriendsListAsync(request); + } + }); + } + + /** + * Retrieves the current friends for the user with PlayFabId, constrained to users who have PlayFab accounts. Friends from linked accounts (Facebook, Steam) are also included. You may optionally exclude some linked services' friends. + */ + @SuppressWarnings("unchecked") + public static PlayFabResult GetFriendsList(final GetFriendsListRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateGetFriendsListAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Retrieves the current friends for the user with PlayFabId, constrained to users who have PlayFab accounts. Friends from linked accounts (Facebook, Steam) are also included. You may optionally exclude some linked services' friends. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateGetFriendsListAsync(final GetFriendsListRequest 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/GetFriendsList", 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()); + GetFriendsListResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + + /** + * Removes the specified friend from the the user's friend list + */ + @SuppressWarnings("unchecked") + public static FutureTask> RemoveFriendAsync(final RemoveFriendRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateRemoveFriendAsync(request); + } + }); + } + + /** + * Removes the specified friend from the the user's friend list + */ + @SuppressWarnings("unchecked") + public static PlayFabResult RemoveFriend(final RemoveFriendRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateRemoveFriendAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Removes the specified friend from the the user's friend list + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateRemoveFriendAsync(final RemoveFriendRequest 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/RemoveFriend", 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()); + EmptyResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + + /** + * Inform the matchmaker that a Game Server Instance is removed. + */ + @SuppressWarnings("unchecked") + public static FutureTask> DeregisterGameAsync(final DeregisterGameRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateDeregisterGameAsync(request); + } + }); + } + + /** + * Inform the matchmaker that a Game Server Instance is removed. + */ + @SuppressWarnings("unchecked") + public static PlayFabResult DeregisterGame(final DeregisterGameRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateDeregisterGameAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Inform the matchmaker that a Game Server Instance is removed. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateDeregisterGameAsync(final DeregisterGameRequest 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/DeregisterGame", 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()); + DeregisterGameResponse result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + /** * Informs the PlayFab match-making service that the user specified has left the Game Server Instance */ @@ -3676,6 +3966,122 @@ private static PlayFabResult privateRedeemMatchmak return pfResult; } + /** + * Set the state of the indicated Game Server Instance. Also update the heartbeat for the instance. + */ + @SuppressWarnings("unchecked") + public static FutureTask> RefreshGameServerInstanceHeartbeatAsync(final RefreshGameServerInstanceHeartbeatRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateRefreshGameServerInstanceHeartbeatAsync(request); + } + }); + } + + /** + * Set the state of the indicated Game Server Instance. Also update the heartbeat for the instance. + */ + @SuppressWarnings("unchecked") + public static PlayFabResult RefreshGameServerInstanceHeartbeat(final RefreshGameServerInstanceHeartbeatRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateRefreshGameServerInstanceHeartbeatAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Set the state of the indicated Game Server Instance. Also update the heartbeat for the instance. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateRefreshGameServerInstanceHeartbeatAsync(final RefreshGameServerInstanceHeartbeatRequest 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/RefreshGameServerInstanceHeartbeat", 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()); + RefreshGameServerInstanceHeartbeatResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + + /** + * Inform the matchmaker that a new Game Server Instance is added. + */ + @SuppressWarnings("unchecked") + public static FutureTask> RegisterGameAsync(final RegisterGameRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateRegisterGameAsync(request); + } + }); + } + + /** + * Inform the matchmaker that a new Game Server Instance is added. + */ + @SuppressWarnings("unchecked") + public static PlayFabResult RegisterGame(final RegisterGameRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateRegisterGameAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Inform the matchmaker that a new Game Server Instance is added. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateRegisterGameAsync(final RegisterGameRequest 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/RegisterGame", 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()); + RegisterGameResponse result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + /** * Sets the custom data of the indicated Game Server Instance */ @@ -3792,6 +4198,64 @@ private static PlayFabResult privateSetGameSer return pfResult; } + /** + * Set custom tags for the specified Game Server Instance + */ + @SuppressWarnings("unchecked") + public static FutureTask> SetGameServerInstanceTagsAsync(final SetGameServerInstanceTagsRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateSetGameServerInstanceTagsAsync(request); + } + }); + } + + /** + * Set custom tags for the specified Game Server Instance + */ + @SuppressWarnings("unchecked") + public static PlayFabResult SetGameServerInstanceTags(final SetGameServerInstanceTagsRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateSetGameServerInstanceTagsAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Set custom tags for the specified Game Server Instance + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateSetGameServerInstanceTagsAsync(final SetGameServerInstanceTagsRequest 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/SetGameServerInstanceTags", 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()); + SetGameServerInstanceTagsResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + /** * Awards the specified users the specified Steam achievements */ diff --git a/PlayFabServerSDK/src/com/playfab/PlayFabServerModels.java b/PlayFabServerSDK/src/com/playfab/PlayFabServerModels.java index 9506e3ec8..d45cbd8d5 100644 --- a/PlayFabServerSDK/src/com/playfab/PlayFabServerModels.java +++ b/PlayFabServerSDK/src/com/playfab/PlayFabServerModels.java @@ -41,6 +41,30 @@ public static class AddCharacterVirtualCurrencyRequest { } + public static class AddFriendRequest { + /** + * PlayFab identifier of the player to add a new friend. + */ + public String PlayFabId; + /** + * The PlayFab identifier of the user being added. + */ + public String FriendPlayFabId; + /** + * The PlayFab username of the user being added + */ + public String FriendUsername; + /** + * Email address of the user being added. + */ + public String FriendEmail; + /** + * Title-specific display name of the user to being added. + */ + public String FriendTitleDisplayName; + + } + public static class AddPlayerTagRequest { /** * Unique PlayFab assigned ID of the user on whom the operation will be performed. @@ -686,6 +710,18 @@ public static class DeleteUsersResult { } + public static class DeregisterGameRequest { + /** + * Unique identifier for the Game Server Instance that is being deregistered. + */ + public String LobbyId; + + } + + public static class DeregisterGameResponse { + + } + public static class EmptyResult { } @@ -1047,6 +1083,58 @@ public static class GetContentDownloadUrlResult { } + public static class GetFriendLeaderboardRequest { + /** + * The player whose friend leaderboard to get + */ + public String PlayFabId; + /** + * Statistic used to rank friends for this leaderboard. + */ + public String StatisticName; + /** + * Position in the leaderboard to start this listing (defaults to the first entry). + */ + public Integer StartPosition; + /** + * Maximum number of entries to retrieve. + */ + public Integer MaxResultsCount; + /** + * Indicates whether Steam service friends should be included in the response. Default is true. + */ + public Boolean IncludeSteamFriends; + /** + * Indicates whether Facebook friends should be included in the response. Default is true. + */ + public Boolean IncludeFacebookFriends; + + } + + public static class GetFriendsListRequest { + /** + * PlayFab identifier of the player whose friend list to get. + */ + public String PlayFabId; + /** + * Indicates whether Steam service friends should be included in the response. Default is true. + */ + public Boolean IncludeSteamFriends; + /** + * Indicates whether Facebook friends should be included in the response. Default is true. + */ + public Boolean IncludeFacebookFriends; + + } + + public static class GetFriendsListResult { + /** + * Array of friends found. + */ + public ArrayList Friends; + + } + public static class GetLeaderboardAroundCharacterRequest { /** * Unique identifier for the title-specific statistic for the leaderboard. @@ -2449,6 +2537,76 @@ public static class RedeemMatchmakerTicketResult { } + public static class RefreshGameServerInstanceHeartbeatRequest { + /** + * Unique identifier of the Game Server Instance for which the heartbeat is updated. + */ + public String LobbyId; + + } + + public static class RefreshGameServerInstanceHeartbeatResult { + + } + + public static enum Region { + USCentral, + USEast, + EUWest, + Singapore, + Japan, + Brazil, + Australia + } + + public static class RegisterGameRequest { + /** + * IP address of the Game Server Instance. + */ + public String ServerHost; + /** + * Port number for communication with the Game Server Instance. + */ + public String ServerPort; + /** + * Unique identifier of the build running on the Game Server Instance. + */ + public String Build; + /** + * Unique identifier of the build running on the Game Server Instance. + */ + public Region Region; + /** + * Unique identifier of the build running on the Game Server Instance. + */ + public String GameMode; + /** + * Tags for the Game Server Instance + */ + public Map Tags; + + } + + public static class RegisterGameResponse { + /** + * Unique identifier generated for the Game Server Instance that is registered. + */ + public String LobbyId; + + } + + public static class RemoveFriendRequest { + /** + * PlayFab identifier of the friend account which is to be removed. + */ + public String FriendPlayFabId; + /** + * Unique PlayFab assigned ID of the user on whom the operation will be performed. + */ + public String PlayFabId; + + } + public static class RemovePlayerTagRequest { /** * Unique PlayFab assigned ID of the user on whom the operation will be performed. @@ -2654,6 +2812,22 @@ public static class SetGameServerInstanceStateResult { } + public static class SetGameServerInstanceTagsRequest { + /** + * Unique identifier of the Game Server Instance to be updated. + */ + public String LobbyId; + /** + * Tags to set for the specified Game Server Instance. Note that this is the complete list of tags to be associated with the Game Server Instance. + */ + public Map Tags; + + } + + public static class SetGameServerInstanceTagsResult { + + } + 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/com/playfab/PlayFabSettings.java b/PlayFabServerSDK/src/com/playfab/PlayFabSettings.java index 4ecbe0a0e..aacb920ff 100644 --- a/PlayFabServerSDK/src/com/playfab/PlayFabSettings.java +++ b/PlayFabServerSDK/src/com/playfab/PlayFabSettings.java @@ -3,9 +3,9 @@ import com.playfab.PlayFabErrors.ErrorCallback; public class PlayFabSettings { - public static String SdkVersion = "0.36.160912"; + public static String SdkVersion = "0.37.160919"; public static String BuildIdentifier = "jbuild_javasdk_1"; - public static String SdkVersionString = "JavaSDK-0.36.160912"; + public static String SdkVersionString = "JavaSDK-0.37.160919"; 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;