Skip to content

Commit 08c352d

Browse files
author
PlayFabJenkinsBot
committed
https://api.playfab.com/releaseNotes/#180705
2 parents 8577ea0 + 74942bc commit 08c352d

31 files changed

+997
-79
lines changed

AndroidStudioExample/app/src/main/java/com/playfab/PlayFabClientModels.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3018,7 +3018,9 @@ public static enum SourceType {
30183018
BackEnd,
30193019
GameClient,
30203020
GameServer,
3021-
Partner
3021+
Partner,
3022+
Custom,
3023+
API
30223024
}
30233025

30243026
public static class StartGameRequest {

AndroidStudioExample/app/src/main/java/com/playfab/PlayFabEntityModels.java

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,12 @@ public static class ChangeMemberRoleRequest {
105105

106106
}
107107

108+
public static enum CloudScriptRevisionOption {
109+
Live,
110+
Latest,
111+
Specific
112+
}
113+
108114
public static class CreateGroupRequest {
109115
/** The entity to perform this action on. */
110116
public EntityKey Entity;
@@ -309,6 +315,94 @@ public static class EntityWithLineage {
309315

310316
}
311317

318+
public static class EventContents {
319+
/** Entity associated with the event */
320+
public EntityKey Entity;
321+
/** The namespace in which the event is defined. It must be prepended with 'com.playfab.events.' */
322+
public String EventNamespace;
323+
/** The name of this event. */
324+
public String Name;
325+
/**
326+
* The original unique identifier associated with this event before it was posted to PlayFab. The value might differ from
327+
* the EventId value, which is assigned when the event is received by the server.
328+
*/
329+
public String OriginalId;
330+
/**
331+
* The time (in UTC) associated with this event when it occurred. If specified, this value is stored in the
332+
* OriginalTimestamp property of the PlayStream event.
333+
*/
334+
public Date OriginalTimestamp;
335+
/** Arbitrary data associated with the event. Only one of Payload or PayloadJSON is allowed. */
336+
public Object Payload;
337+
/**
338+
* Arbitrary data associated with the event, represented as a JSON serialized string. Only one of Payload or PayloadJSON is
339+
* allowed.
340+
*/
341+
public String PayloadJSON;
342+
343+
}
344+
345+
public static class ExecuteCloudScriptResult {
346+
/** Number of PlayFab API requests issued by the CloudScript function */
347+
public Integer APIRequestsIssued;
348+
/** Information about the error, if any, that occurred during execution */
349+
public ScriptExecutionError Error;
350+
public Double ExecutionTimeSeconds;
351+
/** The name of the function that executed */
352+
public String FunctionName;
353+
/** The object returned from the CloudScript function, if any */
354+
public Object FunctionResult;
355+
/**
356+
* Flag indicating if the FunctionResult was too large and was subsequently dropped from this event. This only occurs if
357+
* the total event size is larger than 350KB.
358+
*/
359+
public Boolean FunctionResultTooLarge;
360+
/** Number of external HTTP requests issued by the CloudScript function */
361+
public Integer HttpRequestsIssued;
362+
/**
363+
* Entries logged during the function execution. These include both entries logged in the function code using log.info()
364+
* and log.error() and error entries for API and HTTP request failures.
365+
*/
366+
public ArrayList<LogStatement> Logs;
367+
/**
368+
* Flag indicating if the logs were too large and were subsequently dropped from this event. This only occurs if the total
369+
* event size is larger than 350KB after the FunctionResult was removed.
370+
*/
371+
public Boolean LogsTooLarge;
372+
public Long MemoryConsumedBytes;
373+
/**
374+
* Processor time consumed while executing the function. This does not include time spent waiting on API calls or HTTP
375+
* requests.
376+
*/
377+
public Double ProcessorTimeSeconds;
378+
/** The revision of the CloudScript that executed */
379+
public Integer Revision;
380+
381+
}
382+
383+
public static class ExecuteEntityCloudScriptRequest {
384+
/** The entity to perform this action on. */
385+
public EntityKey Entity;
386+
/** The name of the CloudScript function to execute */
387+
public String FunctionName;
388+
/** Object that is passed in to the function as the first argument */
389+
public Object FunctionParameter;
390+
/**
391+
* Generate a 'entity_executed_cloudscript' PlayStream event containing the results of the function execution and other
392+
* contextual information. This event will show up in the PlayStream debugger console for the player in Game Manager.
393+
*/
394+
public Boolean GeneratePlayStreamEvent;
395+
/**
396+
* Option for which revision of the CloudScript to execute. 'Latest' executes the most recently created revision, 'Live'
397+
* executes the current live, published revision, and 'Specific' executes the specified revision. The default value is
398+
* 'Specific', if the SpecificRevision parameter is specified, otherwise it is 'Live'.
399+
*/
400+
public CloudScriptRevisionOption RevisionSelection;
401+
/** The specific revision to execute, when RevisionSelection is set to 'Specific' */
402+
public Integer SpecificRevision;
403+
404+
}
405+
312406
public static class FinalizeFileUploadsRequest {
313407
/** The entity to perform this action on. */
314408
public EntityKey Entity;
@@ -675,6 +769,15 @@ public static class ListMembershipResponse {
675769

676770
}
677771

772+
public static class LogStatement {
773+
/** Optional object accompanying the message as contextual information */
774+
public Object Data;
775+
/** 'Debug', 'Info', or 'Error' */
776+
public String Level;
777+
public String Message;
778+
779+
}
780+
678781
public static class ObjectResult {
679782
/** Un-escaped JSON object, if EscapeObject false or default. */
680783
public Object DataObject;
@@ -718,6 +821,19 @@ public static class RemoveMembersRequest {
718821

719822
}
720823

824+
public static class ScriptExecutionError {
825+
/**
826+
* Error code, such as CloudScriptNotFound, JavascriptException, CloudScriptFunctionArgumentSizeExceeded,
827+
* CloudScriptAPIRequestCountExceeded, CloudScriptAPIRequestError, or CloudScriptHTTPRequestError
828+
*/
829+
public String Error;
830+
/** Details about the error */
831+
public String Message;
832+
/** Point during the execution of the script at which the error occurred, if any */
833+
public String StackTrace;
834+
835+
}
836+
721837
public static class SetEntityProfilePolicyRequest {
722838
/** The entity to perform this action on. */
723839
public EntityKey Entity;
@@ -857,4 +973,19 @@ public static class UpdateGroupRoleResponse {
857973

858974
}
859975

976+
public static class WriteEventsRequest {
977+
/** Collection of events to write to PlayStream. */
978+
public ArrayList<EventContents> Events;
979+
980+
}
981+
982+
public static class WriteEventsResponse {
983+
/**
984+
* The unique identifiers assigned by the server to the events, in the same order as the events in the request. Only
985+
* returned if FlushToPlayStream option is true.
986+
*/
987+
public ArrayList<String> AssignedEventIds;
988+
989+
}
990+
860991
}

AndroidStudioExample/app/src/main/java/com/playfab/PlayFabErrors.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ public static enum PlayFabErrorCode {
1212
Unknown(1),
1313
ConnectionError(2),
1414
JsonParseError(3),
15-
MatchmakingHopperIdInvalid(230),
1615
UnkownError(500),
1716
InvalidParams(1000),
1817
AccountNotFound(1001),
@@ -391,9 +390,11 @@ public static enum PlayFabErrorCode {
391390
GameServerConflict(1386),
392391
GameServerInternalServerError(1387),
393392
GameServerServiceUnavailable(1388),
394-
MatchmakingInvalidEntityKeyList(2000),
395-
MatchmakingInvalidTicketCreatorProfile(2001),
396-
MatchmakingInvalidUserAttributes(2002),
393+
ExplicitContentDetected(1389),
394+
PIIContentDetected(1390),
395+
InvalidScheduledTaskParameter(1391),
396+
MatchmakingEntityInvalid(2001),
397+
MatchmakingPlayerAttributesInvalid(2002),
397398
MatchmakingCreateRequestMissing(2003),
398399
MatchmakingCreateRequestCreatorMissing(2004),
399400
MatchmakingCreateRequestCreatorIdMissing(2005),
@@ -405,7 +406,7 @@ public static enum PlayFabErrorCode {
405406
MatchmakingHopperIdMissing(2011),
406407
MatchmakingTitleIdMissing(2012),
407408
MatchmakingTicketIdIdMissing(2013),
408-
MatchmakingUserIdMissing(2014),
409+
MatchmakingPlayerIdMissing(2014),
409410
MatchmakingJoinRequestUserMissing(2015),
410411
MatchmakingHopperConfigNotFound(2016),
411412
MatchmakingMatchNotFound(2017),
@@ -418,10 +419,12 @@ public static enum PlayFabErrorCode {
418419
MatchmakingCancelTicketServerIdentityInvalid(2024),
419420
MatchmakingCancelTicketUserIdentityMismatch(2025),
420421
MatchmakingGetMatchIdentityMismatch(2026),
421-
MatchmakingUserIdentityMismatch(2027),
422+
MatchmakingPlayerIdentityMismatch(2027),
422423
MatchmakingAlreadyJoinedTicket(2028),
423424
MatchmakingTicketAlreadyCompleted(2029),
424-
MatchmakingHopperConfigInvalid(2031);
425+
MatchmakingHopperIdInvalid(2030),
426+
MatchmakingHopperConfigInvalid(2031),
427+
MatchmakingMemberProfileInvalid(2032);
425428

426429
public int id;
427430

AndroidStudioExample/app/src/main/java/com/playfab/PlayFabSettings.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
import com.playfab.PlayFabErrors.ErrorCallback;
55

66
public class PlayFabSettings {
7-
public static String SdkVersion = "0.68.180618";
8-
public static String BuildIdentifier = "jbuild_javasdk_1";
9-
public static String SdkVersionString = "JavaSDK-0.68.180618";
7+
public static String SdkVersion = "0.69.180705";
8+
public static String BuildIdentifier = "jbuild_javasdk_2";
9+
public static String SdkVersionString = "JavaSDK-0.69.180705";
1010

1111
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)
1212
public static ErrorCallback GlobalErrorHandler;

PlayFabClientSDK/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<!-- GAV & Meta -->
1515
<groupId>com.playfab</groupId>
1616
<artifactId>client-sdk</artifactId>
17-
<version>0.68.180618</version>
17+
<version>0.69.180705</version>
1818
<name>PlayFab Client API</name>
1919
<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>
2020
<url>http://api.playfab.com/</url>

PlayFabClientSDK/src/main/java/com/playfab/PlayFabClientModels.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3018,7 +3018,9 @@ public static enum SourceType {
30183018
BackEnd,
30193019
GameClient,
30203020
GameServer,
3021-
Partner
3021+
Partner,
3022+
Custom,
3023+
API
30223024
}
30233025

30243026
public static class StartGameRequest {

PlayFabClientSDK/src/main/java/com/playfab/PlayFabEntityAPI.java

Lines changed: 121 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

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

739+
/**
740+
* Executes CloudScript using the Entity Profile
741+
* @param request ExecuteEntityCloudScriptRequest
742+
* @return Async Task will return ExecuteCloudScriptResult
743+
*/
744+
@SuppressWarnings("unchecked")
745+
public static FutureTask<PlayFabResult<ExecuteCloudScriptResult>> ExecuteEntityCloudScriptAsync(final ExecuteEntityCloudScriptRequest request) {
746+
return new FutureTask(new Callable<PlayFabResult<ExecuteCloudScriptResult>>() {
747+
public PlayFabResult<ExecuteCloudScriptResult> call() throws Exception {
748+
return privateExecuteEntityCloudScriptAsync(request);
749+
}
750+
});
751+
}
752+
753+
/**
754+
* Executes CloudScript using the Entity Profile
755+
* @param request ExecuteEntityCloudScriptRequest
756+
* @return ExecuteCloudScriptResult
757+
*/
758+
@SuppressWarnings("unchecked")
759+
public static PlayFabResult<ExecuteCloudScriptResult> ExecuteEntityCloudScript(final ExecuteEntityCloudScriptRequest request) {
760+
FutureTask<PlayFabResult<ExecuteCloudScriptResult>> task = new FutureTask(new Callable<PlayFabResult<ExecuteCloudScriptResult>>() {
761+
public PlayFabResult<ExecuteCloudScriptResult> call() throws Exception {
762+
return privateExecuteEntityCloudScriptAsync(request);
763+
}
764+
});
765+
try {
766+
task.run();
767+
return task.get();
768+
} catch(Exception e) {
769+
return null;
770+
}
771+
}
772+
773+
/** Executes CloudScript using the Entity Profile */
774+
@SuppressWarnings("unchecked")
775+
private static PlayFabResult<ExecuteCloudScriptResult> privateExecuteEntityCloudScriptAsync(final ExecuteEntityCloudScriptRequest request) throws Exception {
776+
if (PlayFabSettings.EntityToken == null) throw new Exception ("Must call GetEntityToken before you can use the Entity API");
777+
778+
FutureTask<Object> task = PlayFabHTTP.doPost(PlayFabSettings.GetURL() + "/CloudScript/ExecuteEntityCloudScript", request, "X-EntityToken", PlayFabSettings.EntityToken);
779+
task.run();
780+
Object httpResult = task.get();
781+
if (httpResult instanceof PlayFabError) {
782+
PlayFabError error = (PlayFabError)httpResult;
783+
if (PlayFabSettings.GlobalErrorHandler != null)
784+
PlayFabSettings.GlobalErrorHandler.callback(error);
785+
PlayFabResult result = new PlayFabResult<ExecuteCloudScriptResult>();
786+
result.Error = error;
787+
return result;
788+
}
789+
String resultRawJson = (String) httpResult;
790+
791+
PlayFabJsonSuccess<ExecuteCloudScriptResult> resultData = gson.fromJson(resultRawJson, new TypeToken<PlayFabJsonSuccess<ExecuteCloudScriptResult>>(){}.getType());
792+
ExecuteCloudScriptResult result = resultData.data;
793+
794+
PlayFabResult<ExecuteCloudScriptResult> pfResult = new PlayFabResult<ExecuteCloudScriptResult>();
795+
pfResult.Result = result;
796+
return pfResult;
797+
}
798+
739799
/**
740800
* Finalize file uploads to an entity's profile.
741801
* @param request FinalizeFileUploadsRequest
@@ -2304,4 +2364,64 @@ private static PlayFabResult<UpdateGroupRoleResponse> privateUpdateRoleAsync(fin
23042364
pfResult.Result = result;
23052365
return pfResult;
23062366
}
2367+
2368+
/**
2369+
* Write batches of entity based events to PlayStream.
2370+
* @param request WriteEventsRequest
2371+
* @return Async Task will return WriteEventsResponse
2372+
*/
2373+
@SuppressWarnings("unchecked")
2374+
public static FutureTask<PlayFabResult<WriteEventsResponse>> WriteEventsAsync(final WriteEventsRequest request) {
2375+
return new FutureTask(new Callable<PlayFabResult<WriteEventsResponse>>() {
2376+
public PlayFabResult<WriteEventsResponse> call() throws Exception {
2377+
return privateWriteEventsAsync(request);
2378+
}
2379+
});
2380+
}
2381+
2382+
/**
2383+
* Write batches of entity based events to PlayStream.
2384+
* @param request WriteEventsRequest
2385+
* @return WriteEventsResponse
2386+
*/
2387+
@SuppressWarnings("unchecked")
2388+
public static PlayFabResult<WriteEventsResponse> WriteEvents(final WriteEventsRequest request) {
2389+
FutureTask<PlayFabResult<WriteEventsResponse>> task = new FutureTask(new Callable<PlayFabResult<WriteEventsResponse>>() {
2390+
public PlayFabResult<WriteEventsResponse> call() throws Exception {
2391+
return privateWriteEventsAsync(request);
2392+
}
2393+
});
2394+
try {
2395+
task.run();
2396+
return task.get();
2397+
} catch(Exception e) {
2398+
return null;
2399+
}
2400+
}
2401+
2402+
/** Write batches of entity based events to PlayStream. */
2403+
@SuppressWarnings("unchecked")
2404+
private static PlayFabResult<WriteEventsResponse> privateWriteEventsAsync(final WriteEventsRequest request) throws Exception {
2405+
if (PlayFabSettings.EntityToken == null) throw new Exception ("Must call GetEntityToken before you can use the Entity API");
2406+
2407+
FutureTask<Object> task = PlayFabHTTP.doPost(PlayFabSettings.GetURL() + "/Event/WriteEvents", request, "X-EntityToken", PlayFabSettings.EntityToken);
2408+
task.run();
2409+
Object httpResult = task.get();
2410+
if (httpResult instanceof PlayFabError) {
2411+
PlayFabError error = (PlayFabError)httpResult;
2412+
if (PlayFabSettings.GlobalErrorHandler != null)
2413+
PlayFabSettings.GlobalErrorHandler.callback(error);
2414+
PlayFabResult result = new PlayFabResult<WriteEventsResponse>();
2415+
result.Error = error;
2416+
return result;
2417+
}
2418+
String resultRawJson = (String) httpResult;
2419+
2420+
PlayFabJsonSuccess<WriteEventsResponse> resultData = gson.fromJson(resultRawJson, new TypeToken<PlayFabJsonSuccess<WriteEventsResponse>>(){}.getType());
2421+
WriteEventsResponse result = resultData.data;
2422+
2423+
PlayFabResult<WriteEventsResponse> pfResult = new PlayFabResult<WriteEventsResponse>();
2424+
pfResult.Result = result;
2425+
return pfResult;
2426+
}
23072427
}

0 commit comments

Comments
 (0)