Skip to content

Commit

Permalink
https://api.playfab.com/releaseNotes/#160822
Browse files Browse the repository at this point in the history
  • Loading branch information
pgilmorepf committed Aug 22, 2016
2 parents 07a690e + 79391d0 commit 4c1e8f4
Show file tree
Hide file tree
Showing 23 changed files with 2,372 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4519,7 +4519,7 @@ private static PlayFabResult<PurchaseItemResult> privatePurchaseItemAsync(final
}

/**
* Adds the virtual goods associated with the coupon to the user's inventory. Coupons can be generated via the Promotions->Coupons tab in the PlayFab Game Manager. See this post for more information on coupons: https://playfab.com/blog/using-stores-and-coupons-game-manager/
* Adds the virtual goods associated with the coupon to the user's inventory. Coupons can be generated via the Economy->Catalogs tab in the PlayFab Game Manager.
*/
@SuppressWarnings("unchecked")
public static FutureTask<PlayFabResult<RedeemCouponResult>> RedeemCouponAsync(final RedeemCouponRequest request) {
Expand All @@ -4531,7 +4531,7 @@ public PlayFabResult<RedeemCouponResult> call() throws Exception {
}

/**
* Adds the virtual goods associated with the coupon to the user's inventory. Coupons can be generated via the Promotions->Coupons tab in the PlayFab Game Manager. See this post for more information on coupons: https://playfab.com/blog/using-stores-and-coupons-game-manager/
* Adds the virtual goods associated with the coupon to the user's inventory. Coupons can be generated via the Economy->Catalogs tab in the PlayFab Game Manager.
*/
@SuppressWarnings("unchecked")
public static PlayFabResult<RedeemCouponResult> RedeemCoupon(final RedeemCouponRequest request) {
Expand All @@ -4549,7 +4549,7 @@ public PlayFabResult<RedeemCouponResult> call() throws Exception {
}

/**
* Adds the virtual goods associated with the coupon to the user's inventory. Coupons can be generated via the Promotions->Coupons tab in the PlayFab Game Manager. See this post for more information on coupons: https://playfab.com/blog/using-stores-and-coupons-game-manager/
* Adds the virtual goods associated with the coupon to the user's inventory. Coupons can be generated via the Economy->Catalogs tab in the PlayFab Game Manager.
*/
@SuppressWarnings("unchecked")
private static PlayFabResult<RedeemCouponResult> privateRedeemCouponAsync(final RedeemCouponRequest request) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2470,7 +2470,7 @@ public static class LoginWithGoogleAccountRequest {
*/
public Boolean CreateAccount;
/**
* Deprecated - unused
* Deprecated - Do not use
*/
public String PublisherId;
/**
Expand Down Expand Up @@ -2639,7 +2639,7 @@ public static class MatchmakeRequest {
*/
public CollectionFilter TagFilter;
/**
* [deprecated]
* Deprecated - Do not use
*/
public Boolean EnableQueue;

Expand All @@ -2659,7 +2659,7 @@ public static class MatchmakeResult {
*/
public Integer ServerPort;
/**
* server authorization ticket (used by RedeemCoupon to validate user insertion into the game)
* server authorization ticket (used by RedeemMatchmakerTicket to validate user insertion into the game)
*/
public String Ticket;
/**
Expand Down Expand Up @@ -2899,7 +2899,7 @@ public static class RedeemCouponRequest {
*/
public String CouponCode;
/**
* Catalog version of the coupon.
* Catalog version of the coupon. If null, uses the default catalog
*/
public String CatalogVersion;

Expand Down Expand Up @@ -2989,7 +2989,7 @@ public static class RegisterPlayFabUserRequest {
*/
public String DisplayName;
/**
* [Deprecated - The Origination of a user is determined by the API call used to create the account. In the case of RegisterPlayFabUser, it will be Organic.
* The Origination of a user is determined by the API call used to create the account. In the case of RegisterPlayFabUser, it will be Organic.
*/
public String Origination;

Expand Down Expand Up @@ -3165,7 +3165,7 @@ public static class SendAccountRecoveryEmailRequest {
*/
public String TitleId;
/**
* Deprecated - unused
* Deprecated - Do not use
*/
public String PublisherId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,9 @@ public static enum PlayFabErrorCode {
InvalidSegment(1242),
InvalidSessionId(1243),
SessionLogNotFound(1244),
InvalidSearchTerm(1245);
InvalidSearchTerm(1245),
TwoFactorAuthenticationTokenRequired(1246),
GameServerHostCountLimitExceeded(1247);

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.33.160815";
public static String SdkVersion = "0.34.160822";
public static String BuildIdentifier = "jbuild_javasdk_0";
public static String SdkVersionString = "JavaSDK-0.33.160815";
public static String SdkVersionString = "JavaSDK-0.34.160822";

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
6 changes: 3 additions & 3 deletions PlayFabClientSDK/src/com/playfab/PlayFabClientAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -4518,7 +4518,7 @@ private static PlayFabResult<PurchaseItemResult> privatePurchaseItemAsync(final
}

/**
* Adds the virtual goods associated with the coupon to the user's inventory. Coupons can be generated via the Promotions->Coupons tab in the PlayFab Game Manager. See this post for more information on coupons: https://playfab.com/blog/using-stores-and-coupons-game-manager/
* Adds the virtual goods associated with the coupon to the user's inventory. Coupons can be generated via the Economy->Catalogs tab in the PlayFab Game Manager.
*/
@SuppressWarnings("unchecked")
public static FutureTask<PlayFabResult<RedeemCouponResult>> RedeemCouponAsync(final RedeemCouponRequest request) {
Expand All @@ -4530,7 +4530,7 @@ public PlayFabResult<RedeemCouponResult> call() throws Exception {
}

/**
* Adds the virtual goods associated with the coupon to the user's inventory. Coupons can be generated via the Promotions->Coupons tab in the PlayFab Game Manager. See this post for more information on coupons: https://playfab.com/blog/using-stores-and-coupons-game-manager/
* Adds the virtual goods associated with the coupon to the user's inventory. Coupons can be generated via the Economy->Catalogs tab in the PlayFab Game Manager.
*/
@SuppressWarnings("unchecked")
public static PlayFabResult<RedeemCouponResult> RedeemCoupon(final RedeemCouponRequest request) {
Expand All @@ -4548,7 +4548,7 @@ public PlayFabResult<RedeemCouponResult> call() throws Exception {
}

/**
* Adds the virtual goods associated with the coupon to the user's inventory. Coupons can be generated via the Promotions->Coupons tab in the PlayFab Game Manager. See this post for more information on coupons: https://playfab.com/blog/using-stores-and-coupons-game-manager/
* Adds the virtual goods associated with the coupon to the user's inventory. Coupons can be generated via the Economy->Catalogs tab in the PlayFab Game Manager.
*/
@SuppressWarnings("unchecked")
private static PlayFabResult<RedeemCouponResult> privateRedeemCouponAsync(final RedeemCouponRequest request) throws Exception {
Expand Down
12 changes: 6 additions & 6 deletions PlayFabClientSDK/src/com/playfab/PlayFabClientModels.java
Original file line number Diff line number Diff line change
Expand Up @@ -2470,7 +2470,7 @@ public static class LoginWithGoogleAccountRequest {
*/
public Boolean CreateAccount;
/**
* Deprecated - unused
* Deprecated - Do not use
*/
public String PublisherId;
/**
Expand Down Expand Up @@ -2639,7 +2639,7 @@ public static class MatchmakeRequest {
*/
public CollectionFilter TagFilter;
/**
* [deprecated]
* Deprecated - Do not use
*/
public Boolean EnableQueue;

Expand All @@ -2659,7 +2659,7 @@ public static class MatchmakeResult {
*/
public Integer ServerPort;
/**
* server authorization ticket (used by RedeemCoupon to validate user insertion into the game)
* server authorization ticket (used by RedeemMatchmakerTicket to validate user insertion into the game)
*/
public String Ticket;
/**
Expand Down Expand Up @@ -2899,7 +2899,7 @@ public static class RedeemCouponRequest {
*/
public String CouponCode;
/**
* Catalog version of the coupon.
* Catalog version of the coupon. If null, uses the default catalog
*/
public String CatalogVersion;

Expand Down Expand Up @@ -2989,7 +2989,7 @@ public static class RegisterPlayFabUserRequest {
*/
public String DisplayName;
/**
* [Deprecated - The Origination of a user is determined by the API call used to create the account. In the case of RegisterPlayFabUser, it will be Organic.
* The Origination of a user is determined by the API call used to create the account. In the case of RegisterPlayFabUser, it will be Organic.
*/
public String Origination;

Expand Down Expand Up @@ -3165,7 +3165,7 @@ public static class SendAccountRecoveryEmailRequest {
*/
public String TitleId;
/**
* Deprecated - unused
* Deprecated - Do not use
*/
public String PublisherId;

Expand Down
4 changes: 3 additions & 1 deletion PlayFabClientSDK/src/com/playfab/PlayFabErrors.java
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,9 @@ public static enum PlayFabErrorCode {
InvalidSegment(1242),
InvalidSessionId(1243),
SessionLogNotFound(1244),
InvalidSearchTerm(1245);
InvalidSearchTerm(1245),
TwoFactorAuthenticationTokenRequired(1246),
GameServerHostCountLimitExceeded(1247);

public int id;

Expand Down
4 changes: 2 additions & 2 deletions PlayFabClientSDK/src/com/playfab/PlayFabSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import com.playfab.PlayFabErrors.ErrorCallback;

public class PlayFabSettings {
public static String SdkVersion = "0.33.160815";
public static String SdkVersion = "0.34.160822";
public static String BuildIdentifier = "jbuild_javasdk_0";
public static String SdkVersionString = "JavaSDK-0.33.160815";
public static String SdkVersionString = "JavaSDK-0.34.160822";

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
53 changes: 27 additions & 26 deletions PlayFabSDK/src/PlayFabApiTest.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import static org.junit.Assert.*;
import org.junit.*;

import java.util.Arrays;
import java.util.Map;
import java.util.HashMap;
import java.util.List;
import java.util.Date;
import java.util.Calendar;
import java.util.TimeZone;
import java.util.*;
import java.io.*;
import java.util.Properties;

Expand Down Expand Up @@ -248,33 +242,40 @@ public void UserDataApi()
/// Test a sequence of calls that modifies saved data,
/// and verifies that the next sequential API call contains updated data.
/// Verify that the data is saved correctly, and that specific types are tested
/// Parameter types tested: Dictionary<string, int>
/// Parameter types tested: Dictionary<string, int>
/// </summary>
@Test
public void UserStatisticsApi()
public void PlayerStatisticsApi()
{
LoginOrRegister();
Gson gson = new GsonBuilder().create();

PlayFabClientModels.GetUserStatisticsRequest getRequest = new PlayFabClientModels.GetUserStatisticsRequest();
PlayFabResult<PlayFabClientModels.GetUserStatisticsResult> getStatsResult = PlayFabClientAPI.GetUserStatistics(getRequest);
VerifyResult(getStatsResult, true);
boolean hasStat = getStatsResult.Result.UserStatistics != null && getStatsResult.Result.UserStatistics.containsKey(TEST_STAT_NAME);
int testStatExpected = !hasStat ? 0 : getStatsResult.Result.UserStatistics.get(TEST_STAT_NAME);
PlayFabClientModels.GetPlayerStatisticsRequest getRequest = new PlayFabClientModels.GetPlayerStatisticsRequest();
PlayFabResult<PlayFabClientModels.GetPlayerStatisticsResult> getStatsResult1 = PlayFabClientAPI.GetPlayerStatistics(getRequest);
VerifyResult(getStatsResult1, true);
int testStatExpected = 0;
for(PlayFabClientModels.StatisticValue eachStat : getStatsResult1.Result.Statistics)
if (eachStat.StatisticName.equals(TEST_STAT_NAME))
testStatExpected = eachStat.Value;
testStatExpected = (testStatExpected + 1) % 100; // This test is about the expected value changing - but not testing more complicated issues like bounds

PlayFabClientModels.UpdateUserStatisticsRequest updateRequest = new PlayFabClientModels.UpdateUserStatisticsRequest();
updateRequest.UserStatistics = new HashMap<String,Integer>();
updateRequest.UserStatistics.put(TEST_STAT_NAME, testStatExpected);
PlayFabResult<PlayFabClientModels.UpdateUserStatisticsResult> updateStatsResult = PlayFabClientAPI.UpdateUserStatistics(updateRequest);
PlayFabClientModels.UpdatePlayerStatisticsRequest updateRequest = new PlayFabClientModels.UpdatePlayerStatisticsRequest();
updateRequest.Statistics = new ArrayList<PlayFabClientModels.StatisticUpdate>();
PlayFabClientModels.StatisticUpdate statUpdate = new PlayFabClientModels.StatisticUpdate();
statUpdate.StatisticName = TEST_STAT_NAME;
statUpdate.Value = testStatExpected;
updateRequest.Statistics.add(statUpdate);
PlayFabResult<PlayFabClientModels.UpdatePlayerStatisticsResult> updateStatsResult = PlayFabClientAPI.UpdatePlayerStatistics(updateRequest);
VerifyResult(updateStatsResult, true);

getStatsResult = PlayFabClientAPI.GetUserStatistics(getRequest);
VerifyResult(getStatsResult, true);
hasStat = getStatsResult.Result.UserStatistics != null && getStatsResult.Result.UserStatistics.containsKey(TEST_STAT_NAME);
assertTrue(hasStat);
int testStatActual = getStatsResult.Result.UserStatistics.get(TEST_STAT_NAME);

assertEquals(testStatExpected, testStatActual);
PlayFabResult<PlayFabClientModels.GetPlayerStatisticsResult> getStatsResult2 = PlayFabClientAPI.GetPlayerStatistics(getRequest);
VerifyResult(getStatsResult2, true);
int testStatActual = -1000;
for(PlayFabClientModels.StatisticValue eachStat : getStatsResult2.Result.Statistics)
if (eachStat.StatisticName.equals(TEST_STAT_NAME))
testStatActual = eachStat.Value;
assertTrue(String.format("Stat not found: %d, Actual: %d", testStatExpected, testStatActual), testStatActual != -1000);
assertEquals(String.format("Stats were not updated. Expected: %d, Actual: %d", testStatExpected, testStatActual), testStatExpected, testStatActual);
}

/// <summary>
Expand Down Expand Up @@ -330,7 +331,7 @@ private void SaveCharacterId(List<PlayFabServerModels.CharacterResult> character
public void LeaderBoard()
{
LoginOrRegister();
UserStatisticsApi();
PlayerStatisticsApi();

PlayFabClientModels.GetLeaderboardRequest clientRequest = new PlayFabClientModels.GetLeaderboardRequest();
clientRequest.MaxResultsCount = 3;
Expand Down
Loading

0 comments on commit 4c1e8f4

Please sign in to comment.