Skip to content

Commit d902feb

Browse files
https://api.playfab.com/releaseNotes/#170530
2 parents cbe7c8b + eafb390 commit d902feb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+566
-177
lines changed

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

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,6 +1298,68 @@ private static PlayFabResult<GetPlayerCombinedInfoResult> privateGetPlayerCombin
12981298
return pfResult;
12991299
}
13001300

1301+
/**
1302+
* Retrieves the player's profile
1303+
* @param request GetPlayerProfileRequest
1304+
* @return Async Task will return GetPlayerProfileResult
1305+
*/
1306+
@SuppressWarnings("unchecked")
1307+
public static FutureTask<PlayFabResult<GetPlayerProfileResult>> GetPlayerProfileAsync(final GetPlayerProfileRequest request) {
1308+
return new FutureTask(new Callable<PlayFabResult<GetPlayerProfileResult>>() {
1309+
public PlayFabResult<GetPlayerProfileResult> call() throws Exception {
1310+
return privateGetPlayerProfileAsync(request);
1311+
}
1312+
});
1313+
}
1314+
1315+
/**
1316+
* Retrieves the player's profile
1317+
* @param request GetPlayerProfileRequest
1318+
* @return GetPlayerProfileResult
1319+
*/
1320+
@SuppressWarnings("unchecked")
1321+
public static PlayFabResult<GetPlayerProfileResult> GetPlayerProfile(final GetPlayerProfileRequest request) {
1322+
FutureTask<PlayFabResult<GetPlayerProfileResult>> task = new FutureTask(new Callable<PlayFabResult<GetPlayerProfileResult>>() {
1323+
public PlayFabResult<GetPlayerProfileResult> call() throws Exception {
1324+
return privateGetPlayerProfileAsync(request);
1325+
}
1326+
});
1327+
try {
1328+
task.run();
1329+
return task.get();
1330+
} catch(Exception e) {
1331+
return null;
1332+
}
1333+
}
1334+
1335+
/**
1336+
* Retrieves the player's profile
1337+
*/
1338+
@SuppressWarnings("unchecked")
1339+
private static PlayFabResult<GetPlayerProfileResult> privateGetPlayerProfileAsync(final GetPlayerProfileRequest request) throws Exception {
1340+
if (_authKey == null) throw new Exception ("Must be logged in to call this method");
1341+
1342+
FutureTask<Object> task = PlayFabHTTP.doPost(PlayFabSettings.GetURL() + "/Client/GetPlayerProfile", request, "X-Authorization", _authKey);
1343+
task.run();
1344+
Object httpResult = task.get();
1345+
if(httpResult instanceof PlayFabError) {
1346+
PlayFabError error = (PlayFabError)httpResult;
1347+
if (PlayFabSettings.GlobalErrorHandler != null)
1348+
PlayFabSettings.GlobalErrorHandler.callback(error);
1349+
PlayFabResult result = new PlayFabResult<GetPlayerProfileResult>();
1350+
result.Error = error;
1351+
return result;
1352+
}
1353+
String resultRawJson = (String) httpResult;
1354+
1355+
PlayFabJsonSuccess<GetPlayerProfileResult> resultData = gson.fromJson(resultRawJson, new TypeToken<PlayFabJsonSuccess<GetPlayerProfileResult>>(){}.getType());
1356+
GetPlayerProfileResult result = resultData.data;
1357+
1358+
PlayFabResult<GetPlayerProfileResult> pfResult = new PlayFabResult<GetPlayerProfileResult>();
1359+
pfResult.Result = result;
1360+
return pfResult;
1361+
}
1362+
13011363
/**
13021364
* Retrieves the unique PlayFab identifiers for the given set of Facebook identifiers.
13031365
* @param request GetPlayFabIDsFromFacebookIDsRequest

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

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,15 +1038,15 @@ public static class ExecuteCloudScriptResult {
10381038
*/
10391039
public Object FunctionResult;
10401040
/**
1041-
* Flag indicating if the FunctionResult was too large and was subsequently dropped from this event
1041+
* 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.
10421042
*/
10431043
public Boolean FunctionResultTooLarge;
10441044
/**
10451045
* 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.
10461046
*/
10471047
public ArrayList<LogStatement> Logs;
10481048
/**
1049-
* Flag indicating if the logs were too large and were subsequently dropped from this event
1049+
* 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.
10501050
*/
10511051
public Boolean LogsTooLarge;
10521052
public Double ExecutionTimeSeconds;
@@ -1746,6 +1746,14 @@ public static class GetPlayerCombinedInfoRequestParams {
17461746
* Specific statistics to retrieve. Leave null to get all keys. Has no effect if GetPlayerStatistics is false
17471747
*/
17481748
public ArrayList<String> PlayerStatisticNames;
1749+
/**
1750+
* Whether to get player profile. Defaults to false.
1751+
*/
1752+
public Boolean GetPlayerProfile;
1753+
/**
1754+
* Specifies the properties to return from the player profile. Defaults to returning the player's display name.
1755+
*/
1756+
public PlayerProfileViewConstraints ProfileConstraints;
17491757

17501758
}
17511759

@@ -1811,6 +1819,30 @@ public static class GetPlayerCombinedInfoResultPayload {
18111819
* List of statistics for this player.
18121820
*/
18131821
public ArrayList<StatisticValue> PlayerStatistics;
1822+
/**
1823+
* The profile of the players. This profile is not guaranteed to be up-to-date. For a new player, this profile will not exist.
1824+
*/
1825+
public PlayerProfileModel PlayerProfile;
1826+
1827+
}
1828+
1829+
public static class GetPlayerProfileRequest {
1830+
/**
1831+
* Unique PlayFab assigned ID of the user on whom the operation will be performed.
1832+
*/
1833+
public String PlayFabId;
1834+
/**
1835+
* If non-null, this determines which properties of the profile to return. If null, playfab will only include display names. On client, only ShowDisplayName, ShowStatistics, ShowAvatarUrl are allowed.
1836+
*/
1837+
public PlayerProfileViewConstraints ProfileConstraints;
1838+
1839+
}
1840+
1841+
public static class GetPlayerProfileResult {
1842+
/**
1843+
* The profile of the player. This profile is not guaranteed to be up-to-date. For a new player, this profile will not exist.
1844+
*/
1845+
public PlayerProfileModel PlayerProfile;
18141846

18151847
}
18161848

@@ -2063,11 +2095,6 @@ public static class GetPurchaseResult {
20632095
* Date and time of the purchase.
20642096
*/
20652097
public Date PurchaseDate;
2066-
/**
2067-
* @deprecated Please use instead.
2068-
*/
2069-
@Deprecated
2070-
public ArrayList<ItemInstance> Items;
20712098

20722099
}
20732100

@@ -3745,8 +3772,9 @@ public static class ReportPlayerClientRequest {
37453772

37463773
public static class ReportPlayerClientResult {
37473774
/**
3748-
* Indicates whether this action completed successfully.
3775+
* @deprecated Do not use
37493776
*/
3777+
@Deprecated
37503778
public Boolean Updated;
37513779
/**
37523780
* The number of remaining reports which may be filed today.

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,10 @@ public static enum PlayFabErrorCode {
303303
InvalidEnvironmentForReceipt(1300),
304304
EncryptedRequestNotAllowed(1301),
305305
SignedRequestNotAllowed(1302),
306-
RequestViewConstraintParamsNotAllowed(1303);
306+
RequestViewConstraintParamsNotAllowed(1303),
307+
BadPartnerConfiguration(1304),
308+
XboxBPCertificateFailure(1305),
309+
XboxXASSExchangeFailure(1306);
307310

308311
public int id;
309312

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

Lines changed: 2 additions & 2 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.49.170508";
7+
public static String SdkVersion = "0.50.170530";
88
public static String BuildIdentifier = "jbuild_javasdk_0";
9-
public static String SdkVersionString = "JavaSDK-0.49.170508";
9+
public static String SdkVersionString = "JavaSDK-0.50.170530";
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;

JavaGettingStarted.md

Lines changed: 39 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,41 @@
11
# Java Getting Started Guide
22

3-
This guide will help you make your first API call in Java.
4-
5-
## Java Project Setup
6-
7-
* OS: This guide is written for Windows 10, however it should also work fine with a Mac
8-
* Installation
9-
* Download and install [Apache Maven](https://maven.apache.org/download.cgi)
10-
* You must add the {apache-maven-dir}/bin directory to your Windows Environment PATH variable
11-
* Download and install the [latest Java Development Kit (JDK)](http://www.oracle.com/technetwork/java/javase/downloads/index.html)
12-
* Download the [PlayFab JavaSDK](https://api.playfab.com/sdks/download/java)
13-
* Download the zip file, and extract it to a location of your choice {PlayFabJavaLocation}
14-
* New Project Setup
15-
* Create a new empty folder for your JavaGettingStarted project {NewProjectFolder}
16-
* Import the PlayFab JavaSDK into this project
17-
* In Windows-Explorer, navigate to [{PlayFabJavaLocation}/PlayFabClientSDK/](https://github.com/PlayFab/JavaSDK/tree/master/PlayFabClientSDK/)
18-
* Select the src folder, and copy it to {NewProjectFolder}
19-
* Create a new empty text file called pom.xml in {NewProjectFolder}
20-
* We will modify this file in the next section
21-
* Create a new empty text file called testTitleData.json in {NewProjectFolder}
22-
* We will modify this file in the next section
23-
* Create a new Windows Environment variable called: PF_TEST_TITLE_DATA_JSON
24-
* The value is the full path of your new {NewProjectFolder}/testTitleData.json file
25-
* Navigate to: {NewProjectFolder}/src/main/java
26-
* Create a new empty text file called GettingStarted.java (Full path: {NewProjectFolder}/src/main/java/GettingStarted.java )
27-
* We will modify this file in the next section
28-
* PlayFab Installation Complete!
3+
This tutorial aims to help you get up and running with PlayFab JavaSDK and simple Java program. The goals we persue in this tutorial:
4+
* Acquire necessary JAR files
5+
* Add JAR files to the classpath
6+
* Create minimal Java console application that executes Custom ID Login API Call
7+
8+
## Acquire necessary JAR files
9+
10+
In order to utilize PlayFab JavaSDK we will need PlayFab Client JavaSDK and it's dependency Google GSON.
11+
You may download PlayFab Client JavaSDK JAR library [here](https://github.com/PlayFab/JavaSDK/tree/versioned/builds). Look for client-sdk-\*.jar and the corresponding Java Doc [Optional but useful].
12+
You may download latest Google GSON [here](http://repo1.maven.org/maven2/com/google/code/gson/gson/2.8.0/). Look for gson-\*.jar.
13+
14+
## Project Setup with Intellij Idea
15+
16+
Once you have initialized simple Intellij Idea Java Project, make sure to place necessary JAR files as shown on the picture:
17+
18+
![Java Image](images/Java/Java-Getting-Started-1.png)
19+
20+
The next step is adding JAR files to the classpath. Navigate to File -> Project Structure... as shown on the picture:
21+
22+
![Java Image](images/Java/Java-Getting-Started-2.png)
23+
24+
Navigate to Libraries and add new Java library as shown on the picture:
25+
26+
![Java Image](images/Java/Java-Getting-Started-3.png)
27+
28+
Select the JAR files you have added to the libs folder, then click OK as shown on the picture:
29+
30+
![Java Image](images/Java/Java-Getting-Started-4.png)
31+
32+
If asked for the Module, select the first one in the list. Ensure that all the JAR files were added to the libraries list:
33+
34+
![Java Image](images/Java/Java-Getting-Started-6.png)
35+
36+
## Project Setup with any IDE
37+
38+
The main requirement is to have JAR files added to the classpath. Please, consult with the guide for your IDE on how to add jar files to classpath.
2939

3040
## Set up your first API call
3141

@@ -106,84 +116,11 @@ public class GettingStarted
106116
}
107117
```
108118

109-
In your favorite text-editor, update the contents of {NewProjectFolder}/pom.xml as follows:
110-
111-
```XML
112-
<?xml version="1.0" encoding="UTF-8"?>
113-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
114-
<modelVersion>4.0.0</modelVersion>
115-
<groupId>com.example</groupId>
116-
<artifactId>PlayFabExample</artifactId>
117-
<version>1.0.0</version>
118-
<prerequisites>
119-
<maven>3.1.9</maven>
120-
</prerequisites>
121-
<properties>
122-
<!-- Eliminates the file encoding warning. Of course, all of your files should probably be UTF-8 nowadays. -->
123-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
124-
<!-- Added to show how the dependency/property report will look at properties -->
125-
<javaLanguage.version>1.7</javaLanguage.version>
126-
<exec.mainClass>GettingStarted</exec.mainClass>
127-
</properties>
128-
<dependencies>
129-
<dependency>
130-
<groupId>junit</groupId>
131-
<artifactId>junit</artifactId>
132-
<version>4.12</version>
133-
<scope>test</scope>
134-
</dependency>
135-
<dependency>
136-
<groupId>com.google.code.gson</groupId>
137-
<artifactId>gson</artifactId>
138-
<version>2.8.0</version>
139-
</dependency>
140-
<!-- Excellent assertion library. Replaces FEST, which is no longer maintained. -->
141-
<!-- http://joel-costigliola.github.io/assertj/ -->
142-
<dependency>
143-
<groupId>org.assertj</groupId>
144-
<artifactId>assertj-core</artifactId>
145-
<version>3.6.2</version>
146-
<scope>test</scope>
147-
</dependency>
148-
</dependencies>
149-
<build>
150-
<plugins>
151-
<plugin>
152-
<groupId>org.apache.maven.plugins</groupId>
153-
<artifactId>maven-compiler-plugin</artifactId>
154-
<version>3.6.1</version>
155-
<configuration>
156-
<source>${javaLanguage.version}</source>
157-
<target>${javaLanguage.version}</target>
158-
</configuration>
159-
</plugin>
160-
</plugins>
161-
</build>
162-
</project>
163-
```
164-
165-
In your favorite text-editor, update the contents of {NewProjectFolder}/testTitleData.json as follows:
166-
167-
```Json
168-
{
169-
"titleId": "6195",
170-
"userEmail": "[email protected]"
171-
}
172-
```
173-
174119
## Finish and Execute
175120

176-
* Open a new command window in the {NewProjectFolder} folder
177-
* ![Java Image](images/Java/CmdExe.png)
178-
* In the command window, enter the following command:
179-
* mvn verify exec:java
180-
* You will see a bunch of logs, including PlayFab test results, and finally near the end:
181-
* Congratulations, you made your first successful API call!
182-
* If everything succeeds, and you see the indicated success line, you've succeeded
183-
* At this point, you can start making other api calls, and building your game
184-
* For a list of all available client API calls, see our documentation:
185-
* https://api.playfab.com/
186-
* Happy coding!
121+
![Java Image](images/Java/Java-Getting-Started-7.png)
122+
123+
To run the application, hit the play button in the top right corner **(1)**. This will start program execution, and output panel will pop up. Locate the debug message **(2)**. This indicates that API call was succesful. At this point, you can start making other api calls, and building your game. For a list of all available client API calls, see our documentation: [https://api.playfab.com/](https://api.playfab.com/)
187124

188125
## Deconstruct the code
189126

@@ -224,16 +161,3 @@ This optional last section describes every line in GettingStarted.java in detail
224161
* PlayFab server issue. As with all software, there can be issues. See our [release notes](https://api.playfab.com/releaseNotes/) for updates.
225162
* The internet is not 100% reliable. Sometimes the message is corrupted or fails to reach the PlayFab server.
226163
* If you are having difficulty debugging an issue, and the information within the error callback is not sufficient, please visit us on our [forums](https://community.playfab.com/index.html)
227-
228-
pom.xml is a complicated beast
229-
230-
* There are a few lines relevant to our example
231-
* &lt;exec.mainClass>GettingStarted&lt;/exec.mainClass>
232-
* This tells Maven to run our GettingStarted example when we call "mvn exec:java"
233-
* &lt;dependency>...&lt;groupId>com.google.code.gson&lt;/groupId>
234-
* PlayFab requires Google gson to operate
235-
* &lt;dependency>...&lt;groupId>junit&lt;/groupId>...&lt;scope>test&lt;/scope>
236-
* The PlayFab tests included with the project require JUnit to run [Optional, but included for simpler steps]
237-
* Everything else is standard stuff in a Maven pom.xml, and you should [dive into the documentation](https://maven.apache.org/guides/introduction/introduction-to-the-pom.html) for details.
238-
239-
Finally, see our separate [testTitleData.json documentation](https://github.com/PlayFab/SDKGenerator/blob/master/JenkinsConsoleUtility/testTitleData.md)

PlayFabClientSDK/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<inceptionYear>2016</inceptionYear>
55
<groupId>com.playfab</groupId>
66
<artifactId>client-sdk</artifactId>
7-
<version>0.49.170508</version>
7+
<version>0.50.170530</version>
88
<name>PlayFab Client API</name>
99
<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>
1010
<url>http://api.playfab.com/</url>

0 commit comments

Comments
 (0)