diff --git a/AndroidStudioExample/app/src/main/java/com/playfab/PlayFabClientAPI.java b/AndroidStudioExample/app/src/main/java/com/playfab/PlayFabClientAPI.java index 45dc59d8..4ade7593 100644 --- a/AndroidStudioExample/app/src/main/java/com/playfab/PlayFabClientAPI.java +++ b/AndroidStudioExample/app/src/main/java/com/playfab/PlayFabClientAPI.java @@ -4406,7 +4406,65 @@ private static PlayFabResult privateSubtractUse } /** - * Unlocks a container item in the user's inventory and consumes a key item of the type indicated by the container item + * Opens the specified container, with the specified key (when required), and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem. + */ + @SuppressWarnings("unchecked") + public static FutureTask> UnlockContainerInstanceAsync(final UnlockContainerInstanceRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateUnlockContainerInstanceAsync(request); + } + }); + } + + /** + * Opens the specified container, with the specified key (when required), and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem. + */ + @SuppressWarnings("unchecked") + public static PlayFabResult UnlockContainerInstance(final UnlockContainerInstanceRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateUnlockContainerInstanceAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Opens the specified container, with the specified key (when required), and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateUnlockContainerInstanceAsync(final UnlockContainerInstanceRequest request) throws Exception { + if (_authKey == null) throw new Exception ("Must be logged in to call this method"); + + FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL() + "/Client/UnlockContainerInstance", 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()); + UnlockContainerItemResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + + /** + * Searches target inventory for an ItemInstance matching the given CatalogItemId, if necessary unlocks it using an appropriate key, and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem. */ @SuppressWarnings("unchecked") public static FutureTask> UnlockContainerItemAsync(final UnlockContainerItemRequest request) { @@ -4418,7 +4476,7 @@ public PlayFabResult call() throws Exception { } /** - * Unlocks a container item in the user's inventory and consumes a key item of the type indicated by the container item + * Searches target inventory for an ItemInstance matching the given CatalogItemId, if necessary unlocks it using an appropriate key, and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem. */ @SuppressWarnings("unchecked") public static PlayFabResult UnlockContainerItem(final UnlockContainerItemRequest request) { @@ -4436,7 +4494,7 @@ public PlayFabResult call() throws Exception { } /** - * Unlocks a container item in the user's inventory and consumes a key item of the type indicated by the container item + * Searches target inventory for an ItemInstance matching the given CatalogItemId, if necessary unlocks it using an appropriate key, and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem. */ @SuppressWarnings("unchecked") private static PlayFabResult privateUnlockContainerItemAsync(final UnlockContainerItemRequest request) throws Exception { @@ -5857,7 +5915,7 @@ private static PlayFabResult privateRunCloudScriptAsync(fi } /** - * This API retrieves a pre-signed URL for accessing a content file for the title. A subsequent HTTP GET to the returned URL will attempt to download the content. A HEAD query to the returned URL will attempt to retrieve the metadata of the content. Note that a successful result does not guarantee the existence of this content - if it has not been uploaded, the query to retrieve the data will fail. See this post for more information: https://support.playfab.com/support/discussions/topics/1000059929 + * This API retrieves a pre-signed URL for accessing a content file for the title. A subsequent HTTP GET to the returned URL will attempt to download the content. A HEAD query to the returned URL will attempt to retrieve the metadata of the content. Note that a successful result does not guarantee the existence of this content - if it has not been uploaded, the query to retrieve the data will fail. See this post for more information: https://community.playfab.com/hc/en-us/community/posts/205469488-How-to-upload-files-to-PlayFab-s-Content-Service */ @SuppressWarnings("unchecked") public static FutureTask> GetContentDownloadUrlAsync(final GetContentDownloadUrlRequest request) { @@ -5869,7 +5927,7 @@ public PlayFabResult call() throws Exception { } /** - * This API retrieves a pre-signed URL for accessing a content file for the title. A subsequent HTTP GET to the returned URL will attempt to download the content. A HEAD query to the returned URL will attempt to retrieve the metadata of the content. Note that a successful result does not guarantee the existence of this content - if it has not been uploaded, the query to retrieve the data will fail. See this post for more information: https://support.playfab.com/support/discussions/topics/1000059929 + * This API retrieves a pre-signed URL for accessing a content file for the title. A subsequent HTTP GET to the returned URL will attempt to download the content. A HEAD query to the returned URL will attempt to retrieve the metadata of the content. Note that a successful result does not guarantee the existence of this content - if it has not been uploaded, the query to retrieve the data will fail. See this post for more information: https://community.playfab.com/hc/en-us/community/posts/205469488-How-to-upload-files-to-PlayFab-s-Content-Service */ @SuppressWarnings("unchecked") public static PlayFabResult GetContentDownloadUrl(final GetContentDownloadUrlRequest request) { @@ -5887,7 +5945,7 @@ public PlayFabResult call() throws Exception { } /** - * This API retrieves a pre-signed URL for accessing a content file for the title. A subsequent HTTP GET to the returned URL will attempt to download the content. A HEAD query to the returned URL will attempt to retrieve the metadata of the content. Note that a successful result does not guarantee the existence of this content - if it has not been uploaded, the query to retrieve the data will fail. See this post for more information: https://support.playfab.com/support/discussions/topics/1000059929 + * This API retrieves a pre-signed URL for accessing a content file for the title. A subsequent HTTP GET to the returned URL will attempt to download the content. A HEAD query to the returned URL will attempt to retrieve the metadata of the content. Note that a successful result does not guarantee the existence of this content - if it has not been uploaded, the query to retrieve the data will fail. See this post for more information: https://community.playfab.com/hc/en-us/community/posts/205469488-How-to-upload-files-to-PlayFab-s-Content-Service */ @SuppressWarnings("unchecked") private static PlayFabResult privateGetContentDownloadUrlAsync(final GetContentDownloadUrlRequest request) throws Exception { diff --git a/AndroidStudioExample/app/src/main/java/com/playfab/PlayFabClientModels.java b/AndroidStudioExample/app/src/main/java/com/playfab/PlayFabClientModels.java index 0d353dbc..cb925cb7 100644 --- a/AndroidStudioExample/app/src/main/java/com/playfab/PlayFabClientModels.java +++ b/AndroidStudioExample/app/src/main/java/com/playfab/PlayFabClientModels.java @@ -3220,13 +3220,33 @@ public static class UnlinkXboxAccountResult { } + public static class UnlockContainerInstanceRequest { + /** + * Unique PlayFab assigned ID for a specific character owned by a user + */ + public String CharacterId; + /** + * ItemInstanceId of the container to unlock. + */ + public String ContainerItemInstanceId; + /** + * ItemInstanceId of the key that will be consumed by unlocking this container. If the container requires a key, this parameter is required. + */ + public String KeyItemInstanceId; + /** + * Specifies the catalog version that should be used to determine container contents. If unspecified, uses catalog associated with the item instance. + */ + public String CatalogVersion; + + } + public static class UnlockContainerItemRequest { /** - * Category ItemId of the container type to unlock. + * Catalog ItemId of the container type to unlock. */ public String ContainerItemId; /** - * Catalog version of the container. + * Specifies the catalog version that should be used to determine container contents. If unspecified, uses default/primary catalog. */ public String CatalogVersion; /** diff --git a/AndroidStudioExample/app/src/main/java/com/playfab/PlayFabErrors.java b/AndroidStudioExample/app/src/main/java/com/playfab/PlayFabErrors.java index cf8d5471..428536c1 100644 --- a/AndroidStudioExample/app/src/main/java/com/playfab/PlayFabErrors.java +++ b/AndroidStudioExample/app/src/main/java/com/playfab/PlayFabErrors.java @@ -205,7 +205,8 @@ public static enum PlayFabErrorCode { InvalidDropTable(1201), StatisticVersionAlreadyIncrementedForScheduledInterval(1202), StatisticCountLimitExceeded(1203), - StatisticVersionIncrementRateExceeded(1204); + StatisticVersionIncrementRateExceeded(1204), + ContainerKeyInvalid(1205); public int id; diff --git a/AndroidStudioExample/app/src/main/java/com/playfab/internal/PlayFabVersion.java b/AndroidStudioExample/app/src/main/java/com/playfab/internal/PlayFabVersion.java index 95e40551..09c3f9c0 100644 --- a/AndroidStudioExample/app/src/main/java/com/playfab/internal/PlayFabVersion.java +++ b/AndroidStudioExample/app/src/main/java/com/playfab/internal/PlayFabVersion.java @@ -1,7 +1,7 @@ package com.playfab.internal; public class PlayFabVersion { - public static String SdkRevision = "0.15.160201"; + public static String SdkRevision = "0.16.160208"; public static String getVersionString() { return "JavaSDK-" + SdkRevision; } diff --git a/PlayFabClientSDK/src/com/playfab/PlayFabClientAPI.java b/PlayFabClientSDK/src/com/playfab/PlayFabClientAPI.java index 170aa166..4d81f546 100644 --- a/PlayFabClientSDK/src/com/playfab/PlayFabClientAPI.java +++ b/PlayFabClientSDK/src/com/playfab/PlayFabClientAPI.java @@ -4405,7 +4405,65 @@ private static PlayFabResult privateSubtractUse } /** - * Unlocks a container item in the user's inventory and consumes a key item of the type indicated by the container item + * Opens the specified container, with the specified key (when required), and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem. + */ + @SuppressWarnings("unchecked") + public static FutureTask> UnlockContainerInstanceAsync(final UnlockContainerInstanceRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateUnlockContainerInstanceAsync(request); + } + }); + } + + /** + * Opens the specified container, with the specified key (when required), and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem. + */ + @SuppressWarnings("unchecked") + public static PlayFabResult UnlockContainerInstance(final UnlockContainerInstanceRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateUnlockContainerInstanceAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Opens the specified container, with the specified key (when required), and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateUnlockContainerInstanceAsync(final UnlockContainerInstanceRequest request) throws Exception { + if (_authKey == null) throw new Exception ("Must be logged in to call this method"); + + FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL() + "/Client/UnlockContainerInstance", 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()); + UnlockContainerItemResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + + /** + * Searches target inventory for an ItemInstance matching the given CatalogItemId, if necessary unlocks it using an appropriate key, and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem. */ @SuppressWarnings("unchecked") public static FutureTask> UnlockContainerItemAsync(final UnlockContainerItemRequest request) { @@ -4417,7 +4475,7 @@ public PlayFabResult call() throws Exception { } /** - * Unlocks a container item in the user's inventory and consumes a key item of the type indicated by the container item + * Searches target inventory for an ItemInstance matching the given CatalogItemId, if necessary unlocks it using an appropriate key, and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem. */ @SuppressWarnings("unchecked") public static PlayFabResult UnlockContainerItem(final UnlockContainerItemRequest request) { @@ -4435,7 +4493,7 @@ public PlayFabResult call() throws Exception { } /** - * Unlocks a container item in the user's inventory and consumes a key item of the type indicated by the container item + * Searches target inventory for an ItemInstance matching the given CatalogItemId, if necessary unlocks it using an appropriate key, and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem. */ @SuppressWarnings("unchecked") private static PlayFabResult privateUnlockContainerItemAsync(final UnlockContainerItemRequest request) throws Exception { @@ -5856,7 +5914,7 @@ private static PlayFabResult privateRunCloudScriptAsync(fi } /** - * This API retrieves a pre-signed URL for accessing a content file for the title. A subsequent HTTP GET to the returned URL will attempt to download the content. A HEAD query to the returned URL will attempt to retrieve the metadata of the content. Note that a successful result does not guarantee the existence of this content - if it has not been uploaded, the query to retrieve the data will fail. See this post for more information: https://support.playfab.com/support/discussions/topics/1000059929 + * This API retrieves a pre-signed URL for accessing a content file for the title. A subsequent HTTP GET to the returned URL will attempt to download the content. A HEAD query to the returned URL will attempt to retrieve the metadata of the content. Note that a successful result does not guarantee the existence of this content - if it has not been uploaded, the query to retrieve the data will fail. See this post for more information: https://community.playfab.com/hc/en-us/community/posts/205469488-How-to-upload-files-to-PlayFab-s-Content-Service */ @SuppressWarnings("unchecked") public static FutureTask> GetContentDownloadUrlAsync(final GetContentDownloadUrlRequest request) { @@ -5868,7 +5926,7 @@ public PlayFabResult call() throws Exception { } /** - * This API retrieves a pre-signed URL for accessing a content file for the title. A subsequent HTTP GET to the returned URL will attempt to download the content. A HEAD query to the returned URL will attempt to retrieve the metadata of the content. Note that a successful result does not guarantee the existence of this content - if it has not been uploaded, the query to retrieve the data will fail. See this post for more information: https://support.playfab.com/support/discussions/topics/1000059929 + * This API retrieves a pre-signed URL for accessing a content file for the title. A subsequent HTTP GET to the returned URL will attempt to download the content. A HEAD query to the returned URL will attempt to retrieve the metadata of the content. Note that a successful result does not guarantee the existence of this content - if it has not been uploaded, the query to retrieve the data will fail. See this post for more information: https://community.playfab.com/hc/en-us/community/posts/205469488-How-to-upload-files-to-PlayFab-s-Content-Service */ @SuppressWarnings("unchecked") public static PlayFabResult GetContentDownloadUrl(final GetContentDownloadUrlRequest request) { @@ -5886,7 +5944,7 @@ public PlayFabResult call() throws Exception { } /** - * This API retrieves a pre-signed URL for accessing a content file for the title. A subsequent HTTP GET to the returned URL will attempt to download the content. A HEAD query to the returned URL will attempt to retrieve the metadata of the content. Note that a successful result does not guarantee the existence of this content - if it has not been uploaded, the query to retrieve the data will fail. See this post for more information: https://support.playfab.com/support/discussions/topics/1000059929 + * This API retrieves a pre-signed URL for accessing a content file for the title. A subsequent HTTP GET to the returned URL will attempt to download the content. A HEAD query to the returned URL will attempt to retrieve the metadata of the content. Note that a successful result does not guarantee the existence of this content - if it has not been uploaded, the query to retrieve the data will fail. See this post for more information: https://community.playfab.com/hc/en-us/community/posts/205469488-How-to-upload-files-to-PlayFab-s-Content-Service */ @SuppressWarnings("unchecked") private static PlayFabResult privateGetContentDownloadUrlAsync(final GetContentDownloadUrlRequest request) throws Exception { diff --git a/PlayFabClientSDK/src/com/playfab/PlayFabClientModels.java b/PlayFabClientSDK/src/com/playfab/PlayFabClientModels.java index 0d353dbc..cb925cb7 100644 --- a/PlayFabClientSDK/src/com/playfab/PlayFabClientModels.java +++ b/PlayFabClientSDK/src/com/playfab/PlayFabClientModels.java @@ -3220,13 +3220,33 @@ public static class UnlinkXboxAccountResult { } + public static class UnlockContainerInstanceRequest { + /** + * Unique PlayFab assigned ID for a specific character owned by a user + */ + public String CharacterId; + /** + * ItemInstanceId of the container to unlock. + */ + public String ContainerItemInstanceId; + /** + * ItemInstanceId of the key that will be consumed by unlocking this container. If the container requires a key, this parameter is required. + */ + public String KeyItemInstanceId; + /** + * Specifies the catalog version that should be used to determine container contents. If unspecified, uses catalog associated with the item instance. + */ + public String CatalogVersion; + + } + public static class UnlockContainerItemRequest { /** - * Category ItemId of the container type to unlock. + * Catalog ItemId of the container type to unlock. */ public String ContainerItemId; /** - * Catalog version of the container. + * Specifies the catalog version that should be used to determine container contents. If unspecified, uses default/primary catalog. */ public String CatalogVersion; /** diff --git a/PlayFabClientSDK/src/com/playfab/PlayFabErrors.java b/PlayFabClientSDK/src/com/playfab/PlayFabErrors.java index cf8d5471..428536c1 100644 --- a/PlayFabClientSDK/src/com/playfab/PlayFabErrors.java +++ b/PlayFabClientSDK/src/com/playfab/PlayFabErrors.java @@ -205,7 +205,8 @@ public static enum PlayFabErrorCode { InvalidDropTable(1201), StatisticVersionAlreadyIncrementedForScheduledInterval(1202), StatisticCountLimitExceeded(1203), - StatisticVersionIncrementRateExceeded(1204); + StatisticVersionIncrementRateExceeded(1204), + ContainerKeyInvalid(1205); public int id; diff --git a/PlayFabClientSDK/src/com/playfab/internal/PlayFabVersion.java b/PlayFabClientSDK/src/com/playfab/internal/PlayFabVersion.java index 95e40551..09c3f9c0 100644 --- a/PlayFabClientSDK/src/com/playfab/internal/PlayFabVersion.java +++ b/PlayFabClientSDK/src/com/playfab/internal/PlayFabVersion.java @@ -1,7 +1,7 @@ package com.playfab.internal; public class PlayFabVersion { - public static String SdkRevision = "0.15.160201"; + public static String SdkRevision = "0.16.160208"; public static String getVersionString() { return "JavaSDK-" + SdkRevision; } diff --git a/PlayFabSDK/src/com/playfab/PlayFabAdminModels.java b/PlayFabSDK/src/com/playfab/PlayFabAdminModels.java index 58dbf46e..258bfe12 100644 --- a/PlayFabSDK/src/com/playfab/PlayFabAdminModels.java +++ b/PlayFabSDK/src/com/playfab/PlayFabAdminModels.java @@ -316,11 +316,11 @@ public static class CreatePlayerStatisticDefinitionRequest { /** * unique name of the statistic */ - public String Name; + public String StatisticName; /** * interval at which the values of the statistic for all players are reset. Resets begin at the next interval boundary */ - public Interval VersionChangeInterval; + public StatisticResetIntervalOption VersionChangeInterval; } @@ -1103,15 +1103,6 @@ public static class IncrementPlayerStatisticVersionResult { } - public static enum Interval { - FiveMinutes, - FifteenMinutes, - Hour, - Day, - Week, - Month - } - public static class ItemGrant { /** * Unique PlayFab assigned ID of the user on whom the operation will be performed. @@ -1386,7 +1377,7 @@ public static class PlayerStatisticDefinition { /** * interval at which the values of the statistic for all players are reset */ - public Interval VersionChangeInterval; + public StatisticResetIntervalOption VersionChangeInterval; } @@ -1703,6 +1694,14 @@ public static class SetupPushNotificationResult { } + public static enum StatisticResetIntervalOption { + Never, + Hour, + Day, + Week, + Month + } + public static enum StatisticVersionArchivalStatus { NotScheduled, Scheduled, @@ -1807,7 +1806,7 @@ public static class UpdatePlayerStatisticDefinitionRequest { /** * interval at which the values of the statistic for all players are reset. Changes are effective at the next interval boundary */ - public Interval VersionChangeInterval; + public StatisticResetIntervalOption VersionChangeInterval; } diff --git a/PlayFabSDK/src/com/playfab/PlayFabClientAPI.java b/PlayFabSDK/src/com/playfab/PlayFabClientAPI.java index 170aa166..4d81f546 100644 --- a/PlayFabSDK/src/com/playfab/PlayFabClientAPI.java +++ b/PlayFabSDK/src/com/playfab/PlayFabClientAPI.java @@ -4405,7 +4405,65 @@ private static PlayFabResult privateSubtractUse } /** - * Unlocks a container item in the user's inventory and consumes a key item of the type indicated by the container item + * Opens the specified container, with the specified key (when required), and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem. + */ + @SuppressWarnings("unchecked") + public static FutureTask> UnlockContainerInstanceAsync(final UnlockContainerInstanceRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateUnlockContainerInstanceAsync(request); + } + }); + } + + /** + * Opens the specified container, with the specified key (when required), and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem. + */ + @SuppressWarnings("unchecked") + public static PlayFabResult UnlockContainerInstance(final UnlockContainerInstanceRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateUnlockContainerInstanceAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Opens the specified container, with the specified key (when required), and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateUnlockContainerInstanceAsync(final UnlockContainerInstanceRequest request) throws Exception { + if (_authKey == null) throw new Exception ("Must be logged in to call this method"); + + FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL() + "/Client/UnlockContainerInstance", 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()); + UnlockContainerItemResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + + /** + * Searches target inventory for an ItemInstance matching the given CatalogItemId, if necessary unlocks it using an appropriate key, and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem. */ @SuppressWarnings("unchecked") public static FutureTask> UnlockContainerItemAsync(final UnlockContainerItemRequest request) { @@ -4417,7 +4475,7 @@ public PlayFabResult call() throws Exception { } /** - * Unlocks a container item in the user's inventory and consumes a key item of the type indicated by the container item + * Searches target inventory for an ItemInstance matching the given CatalogItemId, if necessary unlocks it using an appropriate key, and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem. */ @SuppressWarnings("unchecked") public static PlayFabResult UnlockContainerItem(final UnlockContainerItemRequest request) { @@ -4435,7 +4493,7 @@ public PlayFabResult call() throws Exception { } /** - * Unlocks a container item in the user's inventory and consumes a key item of the type indicated by the container item + * Searches target inventory for an ItemInstance matching the given CatalogItemId, if necessary unlocks it using an appropriate key, and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem. */ @SuppressWarnings("unchecked") private static PlayFabResult privateUnlockContainerItemAsync(final UnlockContainerItemRequest request) throws Exception { @@ -5856,7 +5914,7 @@ private static PlayFabResult privateRunCloudScriptAsync(fi } /** - * This API retrieves a pre-signed URL for accessing a content file for the title. A subsequent HTTP GET to the returned URL will attempt to download the content. A HEAD query to the returned URL will attempt to retrieve the metadata of the content. Note that a successful result does not guarantee the existence of this content - if it has not been uploaded, the query to retrieve the data will fail. See this post for more information: https://support.playfab.com/support/discussions/topics/1000059929 + * This API retrieves a pre-signed URL for accessing a content file for the title. A subsequent HTTP GET to the returned URL will attempt to download the content. A HEAD query to the returned URL will attempt to retrieve the metadata of the content. Note that a successful result does not guarantee the existence of this content - if it has not been uploaded, the query to retrieve the data will fail. See this post for more information: https://community.playfab.com/hc/en-us/community/posts/205469488-How-to-upload-files-to-PlayFab-s-Content-Service */ @SuppressWarnings("unchecked") public static FutureTask> GetContentDownloadUrlAsync(final GetContentDownloadUrlRequest request) { @@ -5868,7 +5926,7 @@ public PlayFabResult call() throws Exception { } /** - * This API retrieves a pre-signed URL for accessing a content file for the title. A subsequent HTTP GET to the returned URL will attempt to download the content. A HEAD query to the returned URL will attempt to retrieve the metadata of the content. Note that a successful result does not guarantee the existence of this content - if it has not been uploaded, the query to retrieve the data will fail. See this post for more information: https://support.playfab.com/support/discussions/topics/1000059929 + * This API retrieves a pre-signed URL for accessing a content file for the title. A subsequent HTTP GET to the returned URL will attempt to download the content. A HEAD query to the returned URL will attempt to retrieve the metadata of the content. Note that a successful result does not guarantee the existence of this content - if it has not been uploaded, the query to retrieve the data will fail. See this post for more information: https://community.playfab.com/hc/en-us/community/posts/205469488-How-to-upload-files-to-PlayFab-s-Content-Service */ @SuppressWarnings("unchecked") public static PlayFabResult GetContentDownloadUrl(final GetContentDownloadUrlRequest request) { @@ -5886,7 +5944,7 @@ public PlayFabResult call() throws Exception { } /** - * This API retrieves a pre-signed URL for accessing a content file for the title. A subsequent HTTP GET to the returned URL will attempt to download the content. A HEAD query to the returned URL will attempt to retrieve the metadata of the content. Note that a successful result does not guarantee the existence of this content - if it has not been uploaded, the query to retrieve the data will fail. See this post for more information: https://support.playfab.com/support/discussions/topics/1000059929 + * This API retrieves a pre-signed URL for accessing a content file for the title. A subsequent HTTP GET to the returned URL will attempt to download the content. A HEAD query to the returned URL will attempt to retrieve the metadata of the content. Note that a successful result does not guarantee the existence of this content - if it has not been uploaded, the query to retrieve the data will fail. See this post for more information: https://community.playfab.com/hc/en-us/community/posts/205469488-How-to-upload-files-to-PlayFab-s-Content-Service */ @SuppressWarnings("unchecked") private static PlayFabResult privateGetContentDownloadUrlAsync(final GetContentDownloadUrlRequest request) throws Exception { diff --git a/PlayFabSDK/src/com/playfab/PlayFabClientModels.java b/PlayFabSDK/src/com/playfab/PlayFabClientModels.java index 0d353dbc..cb925cb7 100644 --- a/PlayFabSDK/src/com/playfab/PlayFabClientModels.java +++ b/PlayFabSDK/src/com/playfab/PlayFabClientModels.java @@ -3220,13 +3220,33 @@ public static class UnlinkXboxAccountResult { } + public static class UnlockContainerInstanceRequest { + /** + * Unique PlayFab assigned ID for a specific character owned by a user + */ + public String CharacterId; + /** + * ItemInstanceId of the container to unlock. + */ + public String ContainerItemInstanceId; + /** + * ItemInstanceId of the key that will be consumed by unlocking this container. If the container requires a key, this parameter is required. + */ + public String KeyItemInstanceId; + /** + * Specifies the catalog version that should be used to determine container contents. If unspecified, uses catalog associated with the item instance. + */ + public String CatalogVersion; + + } + public static class UnlockContainerItemRequest { /** - * Category ItemId of the container type to unlock. + * Catalog ItemId of the container type to unlock. */ public String ContainerItemId; /** - * Catalog version of the container. + * Specifies the catalog version that should be used to determine container contents. If unspecified, uses default/primary catalog. */ public String CatalogVersion; /** diff --git a/PlayFabSDK/src/com/playfab/PlayFabErrors.java b/PlayFabSDK/src/com/playfab/PlayFabErrors.java index cf8d5471..428536c1 100644 --- a/PlayFabSDK/src/com/playfab/PlayFabErrors.java +++ b/PlayFabSDK/src/com/playfab/PlayFabErrors.java @@ -205,7 +205,8 @@ public static enum PlayFabErrorCode { InvalidDropTable(1201), StatisticVersionAlreadyIncrementedForScheduledInterval(1202), StatisticCountLimitExceeded(1203), - StatisticVersionIncrementRateExceeded(1204); + StatisticVersionIncrementRateExceeded(1204), + ContainerKeyInvalid(1205); public int id; diff --git a/PlayFabSDK/src/com/playfab/PlayFabServerAPI.java b/PlayFabSDK/src/com/playfab/PlayFabServerAPI.java index 186f5bef..25440f56 100644 --- a/PlayFabSDK/src/com/playfab/PlayFabServerAPI.java +++ b/PlayFabSDK/src/com/playfab/PlayFabServerAPI.java @@ -2568,6 +2568,122 @@ private static PlayFabResult privateSubtractUse return pfResult; } + /** + * Opens a specific container (ContainerItemInstanceId), with a specific key (KeyItemInstanceId, when required), and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem. + */ + @SuppressWarnings("unchecked") + public static FutureTask> UnlockContainerInstanceAsync(final UnlockContainerInstanceRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateUnlockContainerInstanceAsync(request); + } + }); + } + + /** + * Opens a specific container (ContainerItemInstanceId), with a specific key (KeyItemInstanceId, when required), and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem. + */ + @SuppressWarnings("unchecked") + public static PlayFabResult UnlockContainerInstance(final UnlockContainerInstanceRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateUnlockContainerInstanceAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Opens a specific container (ContainerItemInstanceId), with a specific key (KeyItemInstanceId, when required), and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateUnlockContainerInstanceAsync(final UnlockContainerInstanceRequest 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/UnlockContainerInstance", 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()); + UnlockContainerItemResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + + /** + * Searches Player or Character inventory for any ItemInstance matching the given CatalogItemId, if necessary unlocks it using any appropriate key, and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem. + */ + @SuppressWarnings("unchecked") + public static FutureTask> UnlockContainerItemAsync(final UnlockContainerItemRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateUnlockContainerItemAsync(request); + } + }); + } + + /** + * Searches Player or Character inventory for any ItemInstance matching the given CatalogItemId, if necessary unlocks it using any appropriate key, and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem. + */ + @SuppressWarnings("unchecked") + public static PlayFabResult UnlockContainerItem(final UnlockContainerItemRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateUnlockContainerItemAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Searches Player or Character inventory for any ItemInstance matching the given CatalogItemId, if necessary unlocks it using any appropriate key, and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateUnlockContainerItemAsync(final UnlockContainerItemRequest 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/UnlockContainerItem", 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()); + UnlockContainerItemResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + /** * Updates the key-value pair data tagged to the specified item, which is read-only from the client. */ @@ -3323,7 +3439,7 @@ private static PlayFabResult privateUpdateSharedGro } /** - * This API retrieves a pre-signed URL for accessing a content file for the title. A subsequent HTTP GET to the returned URL will attempt to download the content. A HEAD query to the returned URL will attempt to retrieve the metadata of the content. Note that a successful result does not guarantee the existence of this content - if it has not been uploaded, the query to retrieve the data will fail. See this post for more information: https://support.playfab.com/support/discussions/topics/1000059929 + * This API retrieves a pre-signed URL for accessing a content file for the title. A subsequent HTTP GET to the returned URL will attempt to download the content. A HEAD query to the returned URL will attempt to retrieve the metadata of the content. Note that a successful result does not guarantee the existence of this content - if it has not been uploaded, the query to retrieve the data will fail. See this post for more information: https://community.playfab.com/hc/en-us/community/posts/205469488-How-to-upload-files-to-PlayFab-s-Content-Service */ @SuppressWarnings("unchecked") public static FutureTask> GetContentDownloadUrlAsync(final GetContentDownloadUrlRequest request) { @@ -3335,7 +3451,7 @@ public PlayFabResult call() throws Exception { } /** - * This API retrieves a pre-signed URL for accessing a content file for the title. A subsequent HTTP GET to the returned URL will attempt to download the content. A HEAD query to the returned URL will attempt to retrieve the metadata of the content. Note that a successful result does not guarantee the existence of this content - if it has not been uploaded, the query to retrieve the data will fail. See this post for more information: https://support.playfab.com/support/discussions/topics/1000059929 + * This API retrieves a pre-signed URL for accessing a content file for the title. A subsequent HTTP GET to the returned URL will attempt to download the content. A HEAD query to the returned URL will attempt to retrieve the metadata of the content. Note that a successful result does not guarantee the existence of this content - if it has not been uploaded, the query to retrieve the data will fail. See this post for more information: https://community.playfab.com/hc/en-us/community/posts/205469488-How-to-upload-files-to-PlayFab-s-Content-Service */ @SuppressWarnings("unchecked") public static PlayFabResult GetContentDownloadUrl(final GetContentDownloadUrlRequest request) { @@ -3353,7 +3469,7 @@ public PlayFabResult call() throws Exception { } /** - * This API retrieves a pre-signed URL for accessing a content file for the title. A subsequent HTTP GET to the returned URL will attempt to download the content. A HEAD query to the returned URL will attempt to retrieve the metadata of the content. Note that a successful result does not guarantee the existence of this content - if it has not been uploaded, the query to retrieve the data will fail. See this post for more information: https://support.playfab.com/support/discussions/topics/1000059929 + * This API retrieves a pre-signed URL for accessing a content file for the title. A subsequent HTTP GET to the returned URL will attempt to download the content. A HEAD query to the returned URL will attempt to retrieve the metadata of the content. Note that a successful result does not guarantee the existence of this content - if it has not been uploaded, the query to retrieve the data will fail. See this post for more information: https://community.playfab.com/hc/en-us/community/posts/205469488-How-to-upload-files-to-PlayFab-s-Content-Service */ @SuppressWarnings("unchecked") private static PlayFabResult privateGetContentDownloadUrlAsync(final GetContentDownloadUrlRequest request) throws Exception { diff --git a/PlayFabSDK/src/com/playfab/PlayFabServerModels.java b/PlayFabSDK/src/com/playfab/PlayFabServerModels.java index ef0ebccf..84341d8f 100644 --- a/PlayFabSDK/src/com/playfab/PlayFabServerModels.java +++ b/PlayFabSDK/src/com/playfab/PlayFabServerModels.java @@ -1977,6 +1977,70 @@ public static class TitleNewsItem { } + public static class UnlockContainerInstanceRequest { + /** + * Unique PlayFab assigned ID of the user on whom the operation will be performed. + */ + public String PlayFabId; + /** + * Unique PlayFab assigned ID for a specific character owned by a user + */ + public String CharacterId; + /** + * ItemInstanceId of the container to unlock. + */ + public String ContainerItemInstanceId; + /** + * ItemInstanceId of the key that will be consumed by unlocking this container. If the container requires a key, this parameter is required. + */ + public String KeyItemInstanceId; + /** + * Specifies the catalog version that should be used to determine container contents. If unspecified, uses catalog associated with the item instance. + */ + public String CatalogVersion; + + } + + public static class UnlockContainerItemRequest { + /** + * Unique PlayFab assigned ID of the user on whom the operation will be performed. + */ + public String PlayFabId; + /** + * Unique PlayFab assigned ID for a specific character owned by a user + */ + public String CharacterId; + /** + * Catalog ItemId of the container type to unlock. + */ + public String ContainerItemId; + /** + * Specifies the catalog version that should be used to determine container contents. If unspecified, uses default/primary catalog. + */ + public String CatalogVersion; + + } + + public static class UnlockContainerItemResult { + /** + * Unique instance identifier of the container unlocked. + */ + public String UnlockedItemInstanceId; + /** + * Unique instance identifier of the key used to unlock the container, if applicable. + */ + public String UnlockedWithItemInstanceId; + /** + * Items granted to the player as a result of unlocking the container. + */ + public ArrayList GrantedItems; + /** + * Virtual currency granted to the player as a result of unlocking the container. + */ + public Map VirtualCurrency; + + } + public static class UpdateCharacterDataRequest { /** * Unique PlayFab assigned ID of the user on whom the operation will be performed. diff --git a/PlayFabSDK/src/com/playfab/internal/PlayFabVersion.java b/PlayFabSDK/src/com/playfab/internal/PlayFabVersion.java index 95e40551..09c3f9c0 100644 --- a/PlayFabSDK/src/com/playfab/internal/PlayFabVersion.java +++ b/PlayFabSDK/src/com/playfab/internal/PlayFabVersion.java @@ -1,7 +1,7 @@ package com.playfab.internal; public class PlayFabVersion { - public static String SdkRevision = "0.15.160201"; + public static String SdkRevision = "0.16.160208"; public static String getVersionString() { return "JavaSDK-" + SdkRevision; } diff --git a/PlayFabServerSDK/src/com/playfab/PlayFabAdminModels.java b/PlayFabServerSDK/src/com/playfab/PlayFabAdminModels.java index 58dbf46e..258bfe12 100644 --- a/PlayFabServerSDK/src/com/playfab/PlayFabAdminModels.java +++ b/PlayFabServerSDK/src/com/playfab/PlayFabAdminModels.java @@ -316,11 +316,11 @@ public static class CreatePlayerStatisticDefinitionRequest { /** * unique name of the statistic */ - public String Name; + public String StatisticName; /** * interval at which the values of the statistic for all players are reset. Resets begin at the next interval boundary */ - public Interval VersionChangeInterval; + public StatisticResetIntervalOption VersionChangeInterval; } @@ -1103,15 +1103,6 @@ public static class IncrementPlayerStatisticVersionResult { } - public static enum Interval { - FiveMinutes, - FifteenMinutes, - Hour, - Day, - Week, - Month - } - public static class ItemGrant { /** * Unique PlayFab assigned ID of the user on whom the operation will be performed. @@ -1386,7 +1377,7 @@ public static class PlayerStatisticDefinition { /** * interval at which the values of the statistic for all players are reset */ - public Interval VersionChangeInterval; + public StatisticResetIntervalOption VersionChangeInterval; } @@ -1703,6 +1694,14 @@ public static class SetupPushNotificationResult { } + public static enum StatisticResetIntervalOption { + Never, + Hour, + Day, + Week, + Month + } + public static enum StatisticVersionArchivalStatus { NotScheduled, Scheduled, @@ -1807,7 +1806,7 @@ public static class UpdatePlayerStatisticDefinitionRequest { /** * interval at which the values of the statistic for all players are reset. Changes are effective at the next interval boundary */ - public Interval VersionChangeInterval; + public StatisticResetIntervalOption VersionChangeInterval; } diff --git a/PlayFabServerSDK/src/com/playfab/PlayFabErrors.java b/PlayFabServerSDK/src/com/playfab/PlayFabErrors.java index cf8d5471..428536c1 100644 --- a/PlayFabServerSDK/src/com/playfab/PlayFabErrors.java +++ b/PlayFabServerSDK/src/com/playfab/PlayFabErrors.java @@ -205,7 +205,8 @@ public static enum PlayFabErrorCode { InvalidDropTable(1201), StatisticVersionAlreadyIncrementedForScheduledInterval(1202), StatisticCountLimitExceeded(1203), - StatisticVersionIncrementRateExceeded(1204); + StatisticVersionIncrementRateExceeded(1204), + ContainerKeyInvalid(1205); public int id; diff --git a/PlayFabServerSDK/src/com/playfab/PlayFabServerAPI.java b/PlayFabServerSDK/src/com/playfab/PlayFabServerAPI.java index 186f5bef..25440f56 100644 --- a/PlayFabServerSDK/src/com/playfab/PlayFabServerAPI.java +++ b/PlayFabServerSDK/src/com/playfab/PlayFabServerAPI.java @@ -2568,6 +2568,122 @@ private static PlayFabResult privateSubtractUse return pfResult; } + /** + * Opens a specific container (ContainerItemInstanceId), with a specific key (KeyItemInstanceId, when required), and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem. + */ + @SuppressWarnings("unchecked") + public static FutureTask> UnlockContainerInstanceAsync(final UnlockContainerInstanceRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateUnlockContainerInstanceAsync(request); + } + }); + } + + /** + * Opens a specific container (ContainerItemInstanceId), with a specific key (KeyItemInstanceId, when required), and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem. + */ + @SuppressWarnings("unchecked") + public static PlayFabResult UnlockContainerInstance(final UnlockContainerInstanceRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateUnlockContainerInstanceAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Opens a specific container (ContainerItemInstanceId), with a specific key (KeyItemInstanceId, when required), and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateUnlockContainerInstanceAsync(final UnlockContainerInstanceRequest 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/UnlockContainerInstance", 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()); + UnlockContainerItemResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + + /** + * Searches Player or Character inventory for any ItemInstance matching the given CatalogItemId, if necessary unlocks it using any appropriate key, and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem. + */ + @SuppressWarnings("unchecked") + public static FutureTask> UnlockContainerItemAsync(final UnlockContainerItemRequest request) { + return new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateUnlockContainerItemAsync(request); + } + }); + } + + /** + * Searches Player or Character inventory for any ItemInstance matching the given CatalogItemId, if necessary unlocks it using any appropriate key, and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem. + */ + @SuppressWarnings("unchecked") + public static PlayFabResult UnlockContainerItem(final UnlockContainerItemRequest request) { + FutureTask> task = new FutureTask(new Callable>() { + public PlayFabResult call() throws Exception { + return privateUnlockContainerItemAsync(request); + } + }); + try { + task.run(); + return task.get(); + } catch(Exception e) { + return null; + } + } + + /** + * Searches Player or Character inventory for any ItemInstance matching the given CatalogItemId, if necessary unlocks it using any appropriate key, and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem. + */ + @SuppressWarnings("unchecked") + private static PlayFabResult privateUnlockContainerItemAsync(final UnlockContainerItemRequest 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/UnlockContainerItem", 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()); + UnlockContainerItemResult result = resultData.data; + + PlayFabResult pfResult = new PlayFabResult(); + pfResult.Result = result; + return pfResult; + } + /** * Updates the key-value pair data tagged to the specified item, which is read-only from the client. */ @@ -3323,7 +3439,7 @@ private static PlayFabResult privateUpdateSharedGro } /** - * This API retrieves a pre-signed URL for accessing a content file for the title. A subsequent HTTP GET to the returned URL will attempt to download the content. A HEAD query to the returned URL will attempt to retrieve the metadata of the content. Note that a successful result does not guarantee the existence of this content - if it has not been uploaded, the query to retrieve the data will fail. See this post for more information: https://support.playfab.com/support/discussions/topics/1000059929 + * This API retrieves a pre-signed URL for accessing a content file for the title. A subsequent HTTP GET to the returned URL will attempt to download the content. A HEAD query to the returned URL will attempt to retrieve the metadata of the content. Note that a successful result does not guarantee the existence of this content - if it has not been uploaded, the query to retrieve the data will fail. See this post for more information: https://community.playfab.com/hc/en-us/community/posts/205469488-How-to-upload-files-to-PlayFab-s-Content-Service */ @SuppressWarnings("unchecked") public static FutureTask> GetContentDownloadUrlAsync(final GetContentDownloadUrlRequest request) { @@ -3335,7 +3451,7 @@ public PlayFabResult call() throws Exception { } /** - * This API retrieves a pre-signed URL for accessing a content file for the title. A subsequent HTTP GET to the returned URL will attempt to download the content. A HEAD query to the returned URL will attempt to retrieve the metadata of the content. Note that a successful result does not guarantee the existence of this content - if it has not been uploaded, the query to retrieve the data will fail. See this post for more information: https://support.playfab.com/support/discussions/topics/1000059929 + * This API retrieves a pre-signed URL for accessing a content file for the title. A subsequent HTTP GET to the returned URL will attempt to download the content. A HEAD query to the returned URL will attempt to retrieve the metadata of the content. Note that a successful result does not guarantee the existence of this content - if it has not been uploaded, the query to retrieve the data will fail. See this post for more information: https://community.playfab.com/hc/en-us/community/posts/205469488-How-to-upload-files-to-PlayFab-s-Content-Service */ @SuppressWarnings("unchecked") public static PlayFabResult GetContentDownloadUrl(final GetContentDownloadUrlRequest request) { @@ -3353,7 +3469,7 @@ public PlayFabResult call() throws Exception { } /** - * This API retrieves a pre-signed URL for accessing a content file for the title. A subsequent HTTP GET to the returned URL will attempt to download the content. A HEAD query to the returned URL will attempt to retrieve the metadata of the content. Note that a successful result does not guarantee the existence of this content - if it has not been uploaded, the query to retrieve the data will fail. See this post for more information: https://support.playfab.com/support/discussions/topics/1000059929 + * This API retrieves a pre-signed URL for accessing a content file for the title. A subsequent HTTP GET to the returned URL will attempt to download the content. A HEAD query to the returned URL will attempt to retrieve the metadata of the content. Note that a successful result does not guarantee the existence of this content - if it has not been uploaded, the query to retrieve the data will fail. See this post for more information: https://community.playfab.com/hc/en-us/community/posts/205469488-How-to-upload-files-to-PlayFab-s-Content-Service */ @SuppressWarnings("unchecked") private static PlayFabResult privateGetContentDownloadUrlAsync(final GetContentDownloadUrlRequest request) throws Exception { diff --git a/PlayFabServerSDK/src/com/playfab/PlayFabServerModels.java b/PlayFabServerSDK/src/com/playfab/PlayFabServerModels.java index ef0ebccf..84341d8f 100644 --- a/PlayFabServerSDK/src/com/playfab/PlayFabServerModels.java +++ b/PlayFabServerSDK/src/com/playfab/PlayFabServerModels.java @@ -1977,6 +1977,70 @@ public static class TitleNewsItem { } + public static class UnlockContainerInstanceRequest { + /** + * Unique PlayFab assigned ID of the user on whom the operation will be performed. + */ + public String PlayFabId; + /** + * Unique PlayFab assigned ID for a specific character owned by a user + */ + public String CharacterId; + /** + * ItemInstanceId of the container to unlock. + */ + public String ContainerItemInstanceId; + /** + * ItemInstanceId of the key that will be consumed by unlocking this container. If the container requires a key, this parameter is required. + */ + public String KeyItemInstanceId; + /** + * Specifies the catalog version that should be used to determine container contents. If unspecified, uses catalog associated with the item instance. + */ + public String CatalogVersion; + + } + + public static class UnlockContainerItemRequest { + /** + * Unique PlayFab assigned ID of the user on whom the operation will be performed. + */ + public String PlayFabId; + /** + * Unique PlayFab assigned ID for a specific character owned by a user + */ + public String CharacterId; + /** + * Catalog ItemId of the container type to unlock. + */ + public String ContainerItemId; + /** + * Specifies the catalog version that should be used to determine container contents. If unspecified, uses default/primary catalog. + */ + public String CatalogVersion; + + } + + public static class UnlockContainerItemResult { + /** + * Unique instance identifier of the container unlocked. + */ + public String UnlockedItemInstanceId; + /** + * Unique instance identifier of the key used to unlock the container, if applicable. + */ + public String UnlockedWithItemInstanceId; + /** + * Items granted to the player as a result of unlocking the container. + */ + public ArrayList GrantedItems; + /** + * Virtual currency granted to the player as a result of unlocking the container. + */ + public Map VirtualCurrency; + + } + public static class UpdateCharacterDataRequest { /** * Unique PlayFab assigned ID of the user on whom the operation will be performed. diff --git a/PlayFabServerSDK/src/com/playfab/internal/PlayFabVersion.java b/PlayFabServerSDK/src/com/playfab/internal/PlayFabVersion.java index 95e40551..09c3f9c0 100644 --- a/PlayFabServerSDK/src/com/playfab/internal/PlayFabVersion.java +++ b/PlayFabServerSDK/src/com/playfab/internal/PlayFabVersion.java @@ -1,7 +1,7 @@ package com.playfab.internal; public class PlayFabVersion { - public static String SdkRevision = "0.15.160201"; + public static String SdkRevision = "0.16.160208"; public static String getVersionString() { return "JavaSDK-" + SdkRevision; }