Skip to content

Commit

Permalink
https://api.playfab.com/releaseNotes/#180705
Browse files Browse the repository at this point in the history
  • Loading branch information
PlayFabJenkinsBot committed Jul 6, 2018
2 parents 8577ea0 + 74942bc commit 08c352d
Show file tree
Hide file tree
Showing 31 changed files with 997 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3018,7 +3018,9 @@ public static enum SourceType {
BackEnd,
GameClient,
GameServer,
Partner
Partner,
Custom,
API
}

public static class StartGameRequest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ public static class ChangeMemberRoleRequest {

}

public static enum CloudScriptRevisionOption {
Live,
Latest,
Specific
}

public static class CreateGroupRequest {
/** The entity to perform this action on. */
public EntityKey Entity;
Expand Down Expand Up @@ -309,6 +315,94 @@ public static class EntityWithLineage {

}

public static class EventContents {
/** Entity associated with the event */
public EntityKey Entity;
/** The namespace in which the event is defined. It must be prepended with 'com.playfab.events.' */
public String EventNamespace;
/** The name of this event. */
public String Name;
/**
* The original unique identifier associated with this event before it was posted to PlayFab. The value might differ from
* the EventId value, which is assigned when the event is received by the server.
*/
public String OriginalId;
/**
* The time (in UTC) associated with this event when it occurred. If specified, this value is stored in the
* OriginalTimestamp property of the PlayStream event.
*/
public Date OriginalTimestamp;
/** Arbitrary data associated with the event. Only one of Payload or PayloadJSON is allowed. */
public Object Payload;
/**
* Arbitrary data associated with the event, represented as a JSON serialized string. Only one of Payload or PayloadJSON is
* allowed.
*/
public String PayloadJSON;

}

public static class ExecuteCloudScriptResult {
/** Number of PlayFab API requests issued by the CloudScript function */
public Integer APIRequestsIssued;
/** Information about the error, if any, that occurred during execution */
public ScriptExecutionError Error;
public Double ExecutionTimeSeconds;
/** The name of the function that executed */
public String FunctionName;
/** The object returned from the CloudScript function, if any */
public Object FunctionResult;
/**
* Flag indicating if the FunctionResult was too large and was subsequently dropped from this event. This only occurs if
* the total event size is larger than 350KB.
*/
public Boolean FunctionResultTooLarge;
/** Number of external HTTP requests issued by the CloudScript function */
public Integer HttpRequestsIssued;
/**
* Entries logged during the function execution. These include both entries logged in the function code using log.info()
* and log.error() and error entries for API and HTTP request failures.
*/
public ArrayList<LogStatement> Logs;
/**
* Flag indicating if the logs were too large and were subsequently dropped from this event. This only occurs if the total
* event size is larger than 350KB after the FunctionResult was removed.
*/
public Boolean LogsTooLarge;
public Long MemoryConsumedBytes;
/**
* Processor time consumed while executing the function. This does not include time spent waiting on API calls or HTTP
* requests.
*/
public Double ProcessorTimeSeconds;
/** The revision of the CloudScript that executed */
public Integer Revision;

}

public static class ExecuteEntityCloudScriptRequest {
/** The entity to perform this action on. */
public EntityKey Entity;
/** The name of the CloudScript function to execute */
public String FunctionName;
/** Object that is passed in to the function as the first argument */
public Object FunctionParameter;
/**
* Generate a 'entity_executed_cloudscript' PlayStream event containing the results of the function execution and other
* contextual information. This event will show up in the PlayStream debugger console for the player in Game Manager.
*/
public Boolean GeneratePlayStreamEvent;
/**
* Option for which revision of the CloudScript to execute. 'Latest' executes the most recently created revision, 'Live'
* executes the current live, published revision, and 'Specific' executes the specified revision. The default value is
* 'Specific', if the SpecificRevision parameter is specified, otherwise it is 'Live'.
*/
public CloudScriptRevisionOption RevisionSelection;
/** The specific revision to execute, when RevisionSelection is set to 'Specific' */
public Integer SpecificRevision;

}

public static class FinalizeFileUploadsRequest {
/** The entity to perform this action on. */
public EntityKey Entity;
Expand Down Expand Up @@ -675,6 +769,15 @@ public static class ListMembershipResponse {

}

public static class LogStatement {
/** Optional object accompanying the message as contextual information */
public Object Data;
/** 'Debug', 'Info', or 'Error' */
public String Level;
public String Message;

}

public static class ObjectResult {
/** Un-escaped JSON object, if EscapeObject false or default. */
public Object DataObject;
Expand Down Expand Up @@ -718,6 +821,19 @@ public static class RemoveMembersRequest {

}

public static class ScriptExecutionError {
/**
* Error code, such as CloudScriptNotFound, JavascriptException, CloudScriptFunctionArgumentSizeExceeded,
* CloudScriptAPIRequestCountExceeded, CloudScriptAPIRequestError, or CloudScriptHTTPRequestError
*/
public String Error;
/** Details about the error */
public String Message;
/** Point during the execution of the script at which the error occurred, if any */
public String StackTrace;

}

public static class SetEntityProfilePolicyRequest {
/** The entity to perform this action on. */
public EntityKey Entity;
Expand Down Expand Up @@ -857,4 +973,19 @@ public static class UpdateGroupRoleResponse {

}

public static class WriteEventsRequest {
/** Collection of events to write to PlayStream. */
public ArrayList<EventContents> Events;

}

public static class WriteEventsResponse {
/**
* The unique identifiers assigned by the server to the events, in the same order as the events in the request. Only
* returned if FlushToPlayStream option is true.
*/
public ArrayList<String> AssignedEventIds;

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ public static enum PlayFabErrorCode {
Unknown(1),
ConnectionError(2),
JsonParseError(3),
MatchmakingHopperIdInvalid(230),
UnkownError(500),
InvalidParams(1000),
AccountNotFound(1001),
Expand Down Expand Up @@ -391,9 +390,11 @@ public static enum PlayFabErrorCode {
GameServerConflict(1386),
GameServerInternalServerError(1387),
GameServerServiceUnavailable(1388),
MatchmakingInvalidEntityKeyList(2000),
MatchmakingInvalidTicketCreatorProfile(2001),
MatchmakingInvalidUserAttributes(2002),
ExplicitContentDetected(1389),
PIIContentDetected(1390),
InvalidScheduledTaskParameter(1391),
MatchmakingEntityInvalid(2001),
MatchmakingPlayerAttributesInvalid(2002),
MatchmakingCreateRequestMissing(2003),
MatchmakingCreateRequestCreatorMissing(2004),
MatchmakingCreateRequestCreatorIdMissing(2005),
Expand All @@ -405,7 +406,7 @@ public static enum PlayFabErrorCode {
MatchmakingHopperIdMissing(2011),
MatchmakingTitleIdMissing(2012),
MatchmakingTicketIdIdMissing(2013),
MatchmakingUserIdMissing(2014),
MatchmakingPlayerIdMissing(2014),
MatchmakingJoinRequestUserMissing(2015),
MatchmakingHopperConfigNotFound(2016),
MatchmakingMatchNotFound(2017),
Expand All @@ -418,10 +419,12 @@ public static enum PlayFabErrorCode {
MatchmakingCancelTicketServerIdentityInvalid(2024),
MatchmakingCancelTicketUserIdentityMismatch(2025),
MatchmakingGetMatchIdentityMismatch(2026),
MatchmakingUserIdentityMismatch(2027),
MatchmakingPlayerIdentityMismatch(2027),
MatchmakingAlreadyJoinedTicket(2028),
MatchmakingTicketAlreadyCompleted(2029),
MatchmakingHopperConfigInvalid(2031);
MatchmakingHopperIdInvalid(2030),
MatchmakingHopperConfigInvalid(2031),
MatchmakingMemberProfileInvalid(2032);

public int id;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import com.playfab.PlayFabErrors.ErrorCallback;

public class PlayFabSettings {
public static String SdkVersion = "0.68.180618";
public static String BuildIdentifier = "jbuild_javasdk_1";
public static String SdkVersionString = "JavaSDK-0.68.180618";
public static String SdkVersion = "0.69.180705";
public static String BuildIdentifier = "jbuild_javasdk_2";
public static String SdkVersionString = "JavaSDK-0.69.180705";

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;
Expand Down
2 changes: 1 addition & 1 deletion PlayFabClientSDK/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<!-- GAV & Meta -->
<groupId>com.playfab</groupId>
<artifactId>client-sdk</artifactId>
<version>0.68.180618</version>
<version>0.69.180705</version>
<name>PlayFab Client API</name>
<description>PlayFab is the unified backend platform for games — everything you need to build and operate your game, all in one place, so you can focus on creating and delivering a great player experience. </description>
<url>http://api.playfab.com/</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3018,7 +3018,9 @@ public static enum SourceType {
BackEnd,
GameClient,
GameServer,
Partner
Partner,
Custom,
API
}

public static class StartGameRequest {
Expand Down
122 changes: 121 additions & 1 deletion PlayFabClientSDK/src/main/java/com/playfab/PlayFabEntityAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

/**
* PlayFab Entity APIs provide a variety of core PlayFab features and work consistently across a broad set of entities,
* such as titles, players, characters, and more.
* such as titles, players, characters, and more. API methods for executing CloudScript with an Entity Profile
*/
public class PlayFabEntityAPI {
private static Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").create();
Expand Down Expand Up @@ -736,6 +736,66 @@ private static PlayFabResult<EmptyResult> privateDeleteRoleAsync(final DeleteRol
return pfResult;
}

/**
* Executes CloudScript using the Entity Profile
* @param request ExecuteEntityCloudScriptRequest
* @return Async Task will return ExecuteCloudScriptResult
*/
@SuppressWarnings("unchecked")
public static FutureTask<PlayFabResult<ExecuteCloudScriptResult>> ExecuteEntityCloudScriptAsync(final ExecuteEntityCloudScriptRequest request) {
return new FutureTask(new Callable<PlayFabResult<ExecuteCloudScriptResult>>() {
public PlayFabResult<ExecuteCloudScriptResult> call() throws Exception {
return privateExecuteEntityCloudScriptAsync(request);
}
});
}

/**
* Executes CloudScript using the Entity Profile
* @param request ExecuteEntityCloudScriptRequest
* @return ExecuteCloudScriptResult
*/
@SuppressWarnings("unchecked")
public static PlayFabResult<ExecuteCloudScriptResult> ExecuteEntityCloudScript(final ExecuteEntityCloudScriptRequest request) {
FutureTask<PlayFabResult<ExecuteCloudScriptResult>> task = new FutureTask(new Callable<PlayFabResult<ExecuteCloudScriptResult>>() {
public PlayFabResult<ExecuteCloudScriptResult> call() throws Exception {
return privateExecuteEntityCloudScriptAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
return null;
}
}

/** Executes CloudScript using the Entity Profile */
@SuppressWarnings("unchecked")
private static PlayFabResult<ExecuteCloudScriptResult> privateExecuteEntityCloudScriptAsync(final ExecuteEntityCloudScriptRequest request) throws Exception {
if (PlayFabSettings.EntityToken == null) throw new Exception ("Must call GetEntityToken before you can use the Entity API");

FutureTask<Object> task = PlayFabHTTP.doPost(PlayFabSettings.GetURL() + "/CloudScript/ExecuteEntityCloudScript", request, "X-EntityToken", PlayFabSettings.EntityToken);
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<ExecuteCloudScriptResult>();
result.Error = error;
return result;
}
String resultRawJson = (String) httpResult;

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

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

/**
* Finalize file uploads to an entity's profile.
* @param request FinalizeFileUploadsRequest
Expand Down Expand Up @@ -2304,4 +2364,64 @@ private static PlayFabResult<UpdateGroupRoleResponse> privateUpdateRoleAsync(fin
pfResult.Result = result;
return pfResult;
}

/**
* Write batches of entity based events to PlayStream.
* @param request WriteEventsRequest
* @return Async Task will return WriteEventsResponse
*/
@SuppressWarnings("unchecked")
public static FutureTask<PlayFabResult<WriteEventsResponse>> WriteEventsAsync(final WriteEventsRequest request) {
return new FutureTask(new Callable<PlayFabResult<WriteEventsResponse>>() {
public PlayFabResult<WriteEventsResponse> call() throws Exception {
return privateWriteEventsAsync(request);
}
});
}

/**
* Write batches of entity based events to PlayStream.
* @param request WriteEventsRequest
* @return WriteEventsResponse
*/
@SuppressWarnings("unchecked")
public static PlayFabResult<WriteEventsResponse> WriteEvents(final WriteEventsRequest request) {
FutureTask<PlayFabResult<WriteEventsResponse>> task = new FutureTask(new Callable<PlayFabResult<WriteEventsResponse>>() {
public PlayFabResult<WriteEventsResponse> call() throws Exception {
return privateWriteEventsAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
return null;
}
}

/** Write batches of entity based events to PlayStream. */
@SuppressWarnings("unchecked")
private static PlayFabResult<WriteEventsResponse> privateWriteEventsAsync(final WriteEventsRequest request) throws Exception {
if (PlayFabSettings.EntityToken == null) throw new Exception ("Must call GetEntityToken before you can use the Entity API");

FutureTask<Object> task = PlayFabHTTP.doPost(PlayFabSettings.GetURL() + "/Event/WriteEvents", request, "X-EntityToken", PlayFabSettings.EntityToken);
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<WriteEventsResponse>();
result.Error = error;
return result;
}
String resultRawJson = (String) httpResult;

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

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

0 comments on commit 08c352d

Please sign in to comment.