Skip to content

Commit

Permalink
Merge pull request #50 from PlayFab/master
Browse files Browse the repository at this point in the history
Weekly Versioning PR: 160208
  • Loading branch information
zac-playfab committed Feb 8, 2016
2 parents 473f321 + b9332ea commit c4c956e
Show file tree
Hide file tree
Showing 20 changed files with 660 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4406,7 +4406,65 @@ private static PlayFabResult<ModifyUserVirtualCurrencyResult> 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<PlayFabResult<UnlockContainerItemResult>> UnlockContainerInstanceAsync(final UnlockContainerInstanceRequest request) {
return new FutureTask(new Callable<PlayFabResult<UnlockContainerItemResult>>() {
public PlayFabResult<UnlockContainerItemResult> 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<UnlockContainerItemResult> UnlockContainerInstance(final UnlockContainerInstanceRequest request) {
FutureTask<PlayFabResult<UnlockContainerItemResult>> task = new FutureTask(new Callable<PlayFabResult<UnlockContainerItemResult>>() {
public PlayFabResult<UnlockContainerItemResult> 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<UnlockContainerItemResult> privateUnlockContainerInstanceAsync(final UnlockContainerInstanceRequest request) throws Exception {
if (_authKey == null) throw new Exception ("Must be logged in to call this method");

FutureTask<Object> 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<UnlockContainerItemResult>();
result.Error = error;
return result;
}
String resultRawJson = (String) httpResult;

PlayFabJsonSuccess<UnlockContainerItemResult> resultData = gson.fromJson(resultRawJson, new TypeToken<PlayFabJsonSuccess<UnlockContainerItemResult>>(){}.getType());
UnlockContainerItemResult result = resultData.data;

PlayFabResult<UnlockContainerItemResult> pfResult = new PlayFabResult<UnlockContainerItemResult>();
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<PlayFabResult<UnlockContainerItemResult>> UnlockContainerItemAsync(final UnlockContainerItemRequest request) {
Expand All @@ -4418,7 +4476,7 @@ public PlayFabResult<UnlockContainerItemResult> 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<UnlockContainerItemResult> UnlockContainerItem(final UnlockContainerItemRequest request) {
Expand All @@ -4436,7 +4494,7 @@ public PlayFabResult<UnlockContainerItemResult> 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<UnlockContainerItemResult> privateUnlockContainerItemAsync(final UnlockContainerItemRequest request) throws Exception {
Expand Down Expand Up @@ -5857,7 +5915,7 @@ private static PlayFabResult<RunCloudScriptResult> 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<PlayFabResult<GetContentDownloadUrlResult>> GetContentDownloadUrlAsync(final GetContentDownloadUrlRequest request) {
Expand All @@ -5869,7 +5927,7 @@ public PlayFabResult<GetContentDownloadUrlResult> 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<GetContentDownloadUrlResult> GetContentDownloadUrl(final GetContentDownloadUrlRequest request) {
Expand All @@ -5887,7 +5945,7 @@ public PlayFabResult<GetContentDownloadUrlResult> 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<GetContentDownloadUrlResult> privateGetContentDownloadUrlAsync(final GetContentDownloadUrlRequest request) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ public static enum PlayFabErrorCode {
InvalidDropTable(1201),
StatisticVersionAlreadyIncrementedForScheduledInterval(1202),
StatisticCountLimitExceeded(1203),
StatisticVersionIncrementRateExceeded(1204);
StatisticVersionIncrementRateExceeded(1204),
ContainerKeyInvalid(1205);

public int id;

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
Expand Down
Loading

0 comments on commit c4c956e

Please sign in to comment.