Skip to content

Commit

Permalink
Merge pull request #55 from PlayFab/master
Browse files Browse the repository at this point in the history
Weekly Versioning PR: 160222
  • Loading branch information
zac-playfab committed Feb 22, 2016
2 parents db9ac73 + 03cb0c3 commit 0fb591e
Show file tree
Hide file tree
Showing 8 changed files with 568 additions and 4 deletions.
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.17.160215";
public static String SdkRevision = "0.18.160222";
public static String getVersionString() {
return "JavaSDK-" + SdkRevision;
}
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.17.160215";
public static String SdkRevision = "0.18.160222";
public static String getVersionString() {
return "JavaSDK-" + SdkRevision;
}
Expand Down
174 changes: 174 additions & 0 deletions PlayFabSDK/src/com/playfab/PlayFabServerAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,64 @@ private static PlayFabResult<GetPlayFabIDsFromFacebookIDsResult> privateGetPlayF
return pfResult;
}

/**
* Retrieves the unique PlayFab identifiers for the given set of Steam identifiers. The Steam identifiers are the profile IDs for the user accounts, available as SteamId in the Steamworks Community API calls.
*/
@SuppressWarnings("unchecked")
public static FutureTask<PlayFabResult<GetPlayFabIDsFromSteamIDsResult>> GetPlayFabIDsFromSteamIDsAsync(final GetPlayFabIDsFromSteamIDsRequest request) {
return new FutureTask(new Callable<PlayFabResult<GetPlayFabIDsFromSteamIDsResult>>() {
public PlayFabResult<GetPlayFabIDsFromSteamIDsResult> call() throws Exception {
return privateGetPlayFabIDsFromSteamIDsAsync(request);
}
});
}

/**
* Retrieves the unique PlayFab identifiers for the given set of Steam identifiers. The Steam identifiers are the profile IDs for the user accounts, available as SteamId in the Steamworks Community API calls.
*/
@SuppressWarnings("unchecked")
public static PlayFabResult<GetPlayFabIDsFromSteamIDsResult> GetPlayFabIDsFromSteamIDs(final GetPlayFabIDsFromSteamIDsRequest request) {
FutureTask<PlayFabResult<GetPlayFabIDsFromSteamIDsResult>> task = new FutureTask(new Callable<PlayFabResult<GetPlayFabIDsFromSteamIDsResult>>() {
public PlayFabResult<GetPlayFabIDsFromSteamIDsResult> call() throws Exception {
return privateGetPlayFabIDsFromSteamIDsAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
return null;
}
}

/**
* Retrieves the unique PlayFab identifiers for the given set of Steam identifiers. The Steam identifiers are the profile IDs for the user accounts, available as SteamId in the Steamworks Community API calls.
*/
@SuppressWarnings("unchecked")
private static PlayFabResult<GetPlayFabIDsFromSteamIDsResult> privateGetPlayFabIDsFromSteamIDsAsync(final GetPlayFabIDsFromSteamIDsRequest request) throws Exception {
if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method");

FutureTask<Object> task = PlayFabHTTP.doPost(PlayFabSettings.GetURL() + "/Server/GetPlayFabIDsFromSteamIDs", 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<GetPlayFabIDsFromSteamIDsResult>();
result.Error = error;
return result;
}
String resultRawJson = (String) httpResult;

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

PlayFabResult<GetPlayFabIDsFromSteamIDsResult> pfResult = new PlayFabResult<GetPlayFabIDsFromSteamIDsResult>();
pfResult.Result = result;
return pfResult;
}

/**
* Retrieves the relevant details for a specified user
*/
Expand Down Expand Up @@ -422,6 +480,64 @@ private static PlayFabResult<GetLeaderboardAroundUserResult> privateGetLeaderboa
return pfResult;
}

/**
* Retrieves the current version and values for the indicated statistics, for the local player.
*/
@SuppressWarnings("unchecked")
public static FutureTask<PlayFabResult<GetPlayerStatisticsResult>> GetPlayerStatisticsAsync(final GetPlayerStatisticsRequest request) {
return new FutureTask(new Callable<PlayFabResult<GetPlayerStatisticsResult>>() {
public PlayFabResult<GetPlayerStatisticsResult> call() throws Exception {
return privateGetPlayerStatisticsAsync(request);
}
});
}

/**
* Retrieves the current version and values for the indicated statistics, for the local player.
*/
@SuppressWarnings("unchecked")
public static PlayFabResult<GetPlayerStatisticsResult> GetPlayerStatistics(final GetPlayerStatisticsRequest request) {
FutureTask<PlayFabResult<GetPlayerStatisticsResult>> task = new FutureTask(new Callable<PlayFabResult<GetPlayerStatisticsResult>>() {
public PlayFabResult<GetPlayerStatisticsResult> call() throws Exception {
return privateGetPlayerStatisticsAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
return null;
}
}

/**
* Retrieves the current version and values for the indicated statistics, for the local player.
*/
@SuppressWarnings("unchecked")
private static PlayFabResult<GetPlayerStatisticsResult> privateGetPlayerStatisticsAsync(final GetPlayerStatisticsRequest request) throws Exception {
if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method");

FutureTask<Object> task = PlayFabHTTP.doPost(PlayFabSettings.GetURL() + "/Server/GetPlayerStatistics", 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<GetPlayerStatisticsResult>();
result.Error = error;
return result;
}
String resultRawJson = (String) httpResult;

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

PlayFabResult<GetPlayerStatisticsResult> pfResult = new PlayFabResult<GetPlayerStatisticsResult>();
pfResult.Result = result;
return pfResult;
}

/**
* Retrieves the title-specific custom data for the user which is readable and writable by the client
*/
Expand Down Expand Up @@ -828,6 +944,64 @@ private static PlayFabResult<GetUserStatisticsResult> privateGetUserStatisticsAs
return pfResult;
}

/**
* Updates the values of the specified title-specific statistics for the user
*/
@SuppressWarnings("unchecked")
public static FutureTask<PlayFabResult<UpdatePlayerStatisticsResult>> UpdatePlayerStatisticsAsync(final UpdatePlayerStatisticsRequest request) {
return new FutureTask(new Callable<PlayFabResult<UpdatePlayerStatisticsResult>>() {
public PlayFabResult<UpdatePlayerStatisticsResult> call() throws Exception {
return privateUpdatePlayerStatisticsAsync(request);
}
});
}

/**
* Updates the values of the specified title-specific statistics for the user
*/
@SuppressWarnings("unchecked")
public static PlayFabResult<UpdatePlayerStatisticsResult> UpdatePlayerStatistics(final UpdatePlayerStatisticsRequest request) {
FutureTask<PlayFabResult<UpdatePlayerStatisticsResult>> task = new FutureTask(new Callable<PlayFabResult<UpdatePlayerStatisticsResult>>() {
public PlayFabResult<UpdatePlayerStatisticsResult> call() throws Exception {
return privateUpdatePlayerStatisticsAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
return null;
}
}

/**
* Updates the values of the specified title-specific statistics for the user
*/
@SuppressWarnings("unchecked")
private static PlayFabResult<UpdatePlayerStatisticsResult> privateUpdatePlayerStatisticsAsync(final UpdatePlayerStatisticsRequest request) throws Exception {
if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method");

FutureTask<Object> task = PlayFabHTTP.doPost(PlayFabSettings.GetURL() + "/Server/UpdatePlayerStatistics", 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<UpdatePlayerStatisticsResult>();
result.Error = error;
return result;
}
String resultRawJson = (String) httpResult;

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

PlayFabResult<UpdatePlayerStatisticsResult> pfResult = new PlayFabResult<UpdatePlayerStatisticsResult>();
pfResult.Result = result;
return pfResult;
}

/**
* Updates the title-specific custom data for the user which is readable and writable by the client
*/
Expand Down
108 changes: 108 additions & 0 deletions PlayFabSDK/src/com/playfab/PlayFabServerModels.java
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,26 @@ public static class GetCharacterStatisticsResult {

}

public static class GetCloudScriptUrlRequest {
/**
* Cloud Script Version to use. Defaults to 1.
*/
public Integer Version;
/**
* Specifies whether the URL returned should be the one for the most recently uploaded Revision of the Cloud Script (true), or the Revision most recently set to live (false). Defaults to false.
*/
public Boolean Testing;

}

public static class GetCloudScriptUrlResult {
/**
* URL of the Cloud Script logic server.
*/
public String Url;

}

public static class GetContentDownloadUrlRequest {
/**
* Key of the content item to fetch, usually formatted as a path, e.g. images/a.png
Expand Down Expand Up @@ -999,6 +1019,26 @@ public static class GetPlayFabIDsFromFacebookIDsResult {

}

public static class GetPlayFabIDsFromSteamIDsRequest {
/**
* Deprecated: Please use SteamStringIDs
*/
public ArrayList<Long> SteamIDs;
/**
* Array of unique Steam identifiers (Steam profile IDs) for which the title needs to get PlayFab identifiers.
*/
public ArrayList<String> SteamStringIDs;

}

public static class GetPlayFabIDsFromSteamIDsResult {
/**
* Mapping of Steam identifiers to PlayFab identifiers.
*/
public ArrayList<SteamPlayFabIdPair> Data;

}

public static class GetPublisherDataRequest {
/**
* array of keys to get back data from the Publisher data blob, set by the admin tools
Expand Down Expand Up @@ -1809,6 +1849,58 @@ public static class RevokeInventoryResult {

}

public static class RunCloudScriptResult {
/**
* id of Cloud Script run
*/
public String ActionId;
/**
* version of Cloud Script run
*/
public Integer Version;
/**
* revision of Cloud Script run
*/
public Integer Revision;
/**
* return values from the server action as a dynamic object
*/
public Object Results;
/**
* return values from the server action as a JSON encoded string
*/
public String ResultsEncoded;
/**
* any log statements generated during the run of this action
*/
public String ActionLog;
/**
* time this script took to run, in seconds
*/
public Double ExecutionTime;

}

public static class RunServerCloudScriptRequest {
/**
* Unique PlayFab assigned ID of the user on whom the operation will be performed.
*/
public String PlayFabId;
/**
* server action to trigger
*/
public String ActionId;
/**
* parameters to pass into the action (If you use this, don't use ParamsEncoded)
*/
public Object Params;
/**
* json-encoded parameters to pass into the action (If you use this, don't use Params)
*/
public String ParamsEncoded;

}

public static class SendPushNotificationRequest {
/**
* PlayFabId of the recipient of the push notification.
Expand Down Expand Up @@ -1913,6 +2005,22 @@ public static class StatisticValue {

}

public static class SteamPlayFabIdPair {
/**
* Deprecated: Please use SteamStringId
*/
public Long SteamId;
/**
* Unique Steam identifier for a user.
*/
public String SteamStringId;
/**
* Unique PlayFab identifier for a user, or null if no PlayFab account is linked to the Steam identifier.
*/
public String PlayFabId;

}

public static class SubtractCharacterVirtualCurrencyRequest {
/**
* Unique PlayFab assigned ID of the user on whom the operation will be performed.
Expand Down
2 changes: 1 addition & 1 deletion PlayFabSDK/src/com/playfab/internal/PlayFabVersion.java
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.17.160215";
public static String SdkRevision = "0.18.160222";
public static String getVersionString() {
return "JavaSDK-" + SdkRevision;
}
Expand Down
Loading

0 comments on commit 0fb591e

Please sign in to comment.