Skip to content

Commit

Permalink
https://docs.microsoft.com/en-us/gaming/playfab/release-notes/#240301
Browse files Browse the repository at this point in the history
  • Loading branch information
PlayFab SDK Team authored and PlayFab SDK Team committed Mar 5, 2024
2 parents 07c73f6 + 880ec48 commit c535d88
Show file tree
Hide file tree
Showing 31 changed files with 141 additions and 81 deletions.
3 changes: 3 additions & 0 deletions PlayFabSDK/source/PlayFabAdminModels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2777,6 +2777,9 @@ public enum GenericErrorCodes
InvalidAttributeStatisticsSpecified,
LeaderboardNotFound,
TokenSigningKeyNotFound,
LeaderboardNameConflict,
LinkedStatisticColumnMismatch,
NoLinkedStatisticToLeaderboard,
MatchmakingEntityInvalid,
MatchmakingPlayerAttributesInvalid,
MatchmakingQueueNotFound,
Expand Down
3 changes: 3 additions & 0 deletions PlayFabSDK/source/PlayFabApiSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ public class PlayFabApiSettings
/// <summary> You must set this value for PlayFabSdk to work properly (Found in the Game Manager for your title, at the PlayFab Website) </summary>
public string TitleId;

/// <summary> Set to enable Gzip compression on all responses. Defaults to false. </summary>
public bool CompressResponses = false;


public virtual string GetFullUrl(string apiCall)
{
Expand Down
4 changes: 4 additions & 0 deletions PlayFabSDK/source/PlayFabEconomyModels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2194,6 +2194,10 @@ public class Rating

}

public class RealMoneyPriceDetails
{
}

/// <summary>
/// Redeem items from the Apple App Store.
/// </summary>
Expand Down
3 changes: 3 additions & 0 deletions PlayFabSDK/source/PlayFabErrors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,9 @@ public enum PlayFabErrorCode
InvalidAttributeStatisticsSpecified = 1566,
LeaderboardNotFound = 1567,
TokenSigningKeyNotFound = 1568,
LeaderboardNameConflict = 1569,
LinkedStatisticColumnMismatch = 1570,
NoLinkedStatisticToLeaderboard = 1571,
MatchmakingEntityInvalid = 2001,
MatchmakingPlayerAttributesInvalid = 2002,
MatchmakingQueueNotFound = 2016,
Expand Down
17 changes: 17 additions & 0 deletions PlayFabSDK/source/PlayFabHttp/HttpTransportWithDecompression.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System.Net;
using System.Net.Http;

namespace PlayFab.Internal
{
internal class HttpTransportWithDecompression : PlayFabSysHttp
{
public HttpTransportWithDecompression()
{
var handler = new HttpClientHandler
{
AutomaticDecompression = DecompressionMethods.GZip,
};
_client = new HttpClient(handler);
}
}
}
4 changes: 3 additions & 1 deletion PlayFabSDK/source/PlayFabHttp/PlayFabHttp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ private static async Task<object> _DoPost(string fullPath, PlayFabRequestCommon
var titleId = settings.TitleId;
if (titleId == null)
throw new PlayFabException(PlayFabExceptionCode.TitleNotSet, "You must set your titleId before making an api call");
var transport = PluginManager.GetPlugin<ITransportPlugin>(PluginContract.PlayFab_Transport);
var transport = settings.CompressResponses ?
PluginManager.GetPlugin<ITransportPlugin>(PluginContract.PlayFab_Transport_Decompress) :
PluginManager.GetPlugin<ITransportPlugin>(PluginContract.PlayFab_Transport);

var headers = new Dictionary<string, string>();
if (authType != null && authKey != null)
Expand Down
2 changes: 1 addition & 1 deletion PlayFabSDK/source/PlayFabHttp/PlayFabSysHttp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace PlayFab.Internal
{
public class PlayFabSysHttp : ITransportPlugin
{
private readonly HttpClient _client = new HttpClient();
protected HttpClient _client = new HttpClient();

public async Task<object> DoPost(string fullUrl, object request, Dictionary<string, string> extraHeaders)
{
Expand Down
29 changes: 0 additions & 29 deletions PlayFabSDK/source/PlayFabProfilesModels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,32 +216,8 @@ public class EntityProfileFileMetadata

}

public class EntityStatisticAttributeValue
{
/// <summary>
/// Metadata associated with the Statistic.
/// </summary>
public string Metadata ;

/// <summary>
/// Attribute name.
/// </summary>
public string Name ;

/// <summary>
/// Attribute Statistic scores.
/// </summary>
public List<string> Scores ;

}

public class EntityStatisticValue
{
/// <summary>
/// Attribute Statistic values.
/// </summary>
public Dictionary<string,EntityStatisticAttributeValue> AttributeStatistics ;

/// <summary>
/// Metadata associated with the Statistic.
/// </summary>
Expand All @@ -257,11 +233,6 @@ public class EntityStatisticValue
/// </summary>
public List<string> Scores ;

/// <summary>
/// Statistic value
/// </summary>
public int? Value ;

/// <summary>
/// Statistic version
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions PlayFabSDK/source/PlayFabSDK.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<FileAlignment>512</FileAlignment>

<PackageId>PlayFabAllSDK</PackageId>
<Version>1.175.240202</Version>
<Version>1.176.240301</Version>
<Title>PlayFab CSharp Sdk</Title>
<Authors>Microsoft</Authors>
<Owners>Microsoft</Owners>
Expand All @@ -21,7 +21,7 @@
<Company>PlayFab</Company>
<Product>PlayFabSDK</Product>
<PackageTags>PlayFab, Baas, Paas, JSON, REST, HTTP, SSL, API, cloud, liveops, game, gamedev, native</PackageTags>
<PackageReleaseNotes>https://docs.microsoft.com/gaming/playfab/release-notes#240202</PackageReleaseNotes>
<PackageReleaseNotes>https://docs.microsoft.com/gaming/playfab/release-notes#240301</PackageReleaseNotes>
<NeutralLanguage>en</NeutralLanguage>
<AssemblyVersion>1</AssemblyVersion>
<FileVersion>1</FileVersion>
Expand Down
3 changes: 3 additions & 0 deletions PlayFabSDK/source/PlayFabServerModels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2097,6 +2097,9 @@ public enum GenericErrorCodes
InvalidAttributeStatisticsSpecified,
LeaderboardNotFound,
TokenSigningKeyNotFound,
LeaderboardNameConflict,
LinkedStatisticColumnMismatch,
NoLinkedStatisticToLeaderboard,
MatchmakingEntityInvalid,
MatchmakingPlayerAttributesInvalid,
MatchmakingQueueNotFound,
Expand Down
6 changes: 3 additions & 3 deletions PlayFabSDK/source/PlayFabSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ namespace PlayFab
{
public class PlayFabSettings
{
public const string SdkVersion = "1.175.240202";
public const string BuildIdentifier = "adobuild_csharpsdk_116";
public const string SdkVersionString = "CSharpSDK-1.175.240202";
public const string SdkVersion = "1.176.240301";
public const string BuildIdentifier = "adobuild_csharpsdk_118";
public const string SdkVersionString = "CSharpSDK-1.176.240301";
/// <summary> This is only for customers running a private cluster. Generally you shouldn't touch this </summary>
public static string DefaultProductionEnvironmentUrl = "playfabapi.com";

Expand Down
3 changes: 2 additions & 1 deletion PlayFabSDK/source/PluginContract.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
public enum PluginContract
{
PlayFab_Serializer,
PlayFab_Transport
PlayFab_Transport,
PlayFab_Transport_Decompress
}
}
3 changes: 3 additions & 0 deletions PlayFabSDK/source/PluginManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ private IPlayFabPlugin GetPluginInternal(PluginContract contract, string instanc
case PluginContract.PlayFab_Transport:
plugin = this.CreatePlugin<PlayFabSysHttp>();
break;
case PluginContract.PlayFab_Transport_Decompress:
plugin = this.CreatePlugin<HttpTransportWithDecompression>();
break;
default:
throw new ArgumentException("This contract is not supported", nameof(contract));
}
Expand Down
6 changes: 4 additions & 2 deletions PlayFabSDK/source/Uunit/tests/HttpTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ public void TestPluginWithPolly_Success(UUnitTestContext testContext)
{
PluginManager.SetPlugin(mockHttpPluginWithPolly, PluginContract.PlayFab_Transport);

PlayFabResult<ClientModels.GetTitlePublicKeyResult> result = clientApi.GetTitlePublicKeyAsync(null).GetAwaiter().GetResult();
LoginWithCustomIDRequest request = new LoginWithCustomIDRequest { CustomId = "TestPluginWithPolly", CreateAccount = true };
PlayFabResult<ClientModels.LoginResult> result = clientApi.LoginWithCustomIDAsync(request).GetAwaiter().GetResult();

testContext.NotNull(result.Result);
testContext.IsNull(result.Error);
Expand Down Expand Up @@ -128,7 +129,8 @@ public void Test500Response_WithoutPolly_Success(UUnitTestContext testContext)
testContext.EndTest(UUnitFinishState.PASSED, null);
}

[UUnitTest]
// TODO: reenable test when configuration is setup for CircuitBreaker
// [UUnitTest]
public void Test400Response_TriggerPollyOnExcessiveCalls_Success(UUnitTestContext testContext)
{
PluginManager.SetPlugin(mockHttpPluginWithPolly, PluginContract.PlayFab_Transport);
Expand Down
18 changes: 18 additions & 0 deletions PlayFabSDK/source/Uunit/tests/PlayFabApiTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,24 @@ private void LoginOrRegisterContinued(PlayFabResult<LoginResult> loginResult, UU
testContext.True(clientApi.IsClientLoggedIn(), failMessage);
}

/// <summary>
/// CLIENT API
/// Log in or create a user, but use response compression.
/// </summary>
[UUnitTest]
public void LoginWithCompression(UUnitTestContext testContext)
{
try
{
PlayFabSettings.staticSettings.CompressResponses = true;
LoginOrRegister(testContext);
}
finally
{
PlayFabSettings.staticSettings.CompressResponses = false;
}
}

/// <summary>
/// CLIENT API
/// Test a sequence of calls that modifies saved data,
Expand Down
6 changes: 3 additions & 3 deletions Plugins/CloudScript/source/PlayFabCloudScriptPlugin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<FileAlignment>512</FileAlignment>

<PackageId>PlayFabCloudScriptPlugin</PackageId>
<Version>1.175.240202-alpha</Version>
<Version>1.176.240301-alpha</Version>
<Title>PlayFab CSharp CloudScript Plugin</Title>
<Authors>Microsoft</Authors>
<Owners>Microsoft</Owners>
Expand All @@ -21,7 +21,7 @@
<Product>PlayFabCloudScriptPlugin</Product>
<Copyright>Copyright 2024</Copyright>
<PackageTags>PlayFab, Baas, Paas, JSON, REST, HTTP, SSL, API, cloud, liveops, game, gamedev, native</PackageTags>
<PackageReleaseNotes>https://docs.microsoft.com/gaming/playfab/release-notes#240202</PackageReleaseNotes>
<PackageReleaseNotes>https://docs.microsoft.com/gaming/playfab/release-notes#240301</PackageReleaseNotes>
<NeutralLanguage>en</NeutralLanguage>
<AssemblyVersion>1</AssemblyVersion>
<FileVersion>1</FileVersion>
Expand All @@ -45,7 +45,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="PlayFabAllSDK" Version="1.175.240202" />
<PackageReference Include="PlayFabAllSDK" Version="1.176.240301" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2777,6 +2777,9 @@ public enum GenericErrorCodes
InvalidAttributeStatisticsSpecified,
LeaderboardNotFound,
TokenSigningKeyNotFound,
LeaderboardNameConflict,
LinkedStatisticColumnMismatch,
NoLinkedStatisticToLeaderboard,
MatchmakingEntityInvalid,
MatchmakingPlayerAttributesInvalid,
MatchmakingQueueNotFound,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ public class PlayFabApiSettings
/// <summary> You must set this value for PlayFabSdk to work properly (Found in the Game Manager for your title, at the PlayFab Website) </summary>
public string TitleId;

/// <summary> Set to enable Gzip compression on all responses. Defaults to false. </summary>
public bool CompressResponses = false;


public virtual string GetFullUrl(string apiCall)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2194,6 +2194,10 @@ public class Rating

}

public class RealMoneyPriceDetails
{
}

/// <summary>
/// Redeem items from the Apple App Store.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,9 @@ public enum PlayFabErrorCode
InvalidAttributeStatisticsSpecified = 1566,
LeaderboardNotFound = 1567,
TokenSigningKeyNotFound = 1568,
LeaderboardNameConflict = 1569,
LinkedStatisticColumnMismatch = 1570,
NoLinkedStatisticToLeaderboard = 1571,
MatchmakingEntityInvalid = 2001,
MatchmakingPlayerAttributesInvalid = 2002,
MatchmakingQueueNotFound = 2016,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System.Net;
using System.Net.Http;

namespace PlayFab.Internal
{
internal class HttpTransportWithDecompression : PlayFabSysHttp
{
public HttpTransportWithDecompression()
{
var handler = new HttpClientHandler
{
AutomaticDecompression = DecompressionMethods.GZip,
};
_client = new HttpClient(handler);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ private static async Task<object> _DoPost(string fullPath, PlayFabRequestCommon
var titleId = settings.TitleId;
if (titleId == null)
throw new PlayFabException(PlayFabExceptionCode.TitleNotSet, "You must set your titleId before making an api call");
var transport = PluginManager.GetPlugin<ITransportPlugin>(PluginContract.PlayFab_Transport);
var transport = settings.CompressResponses ?
PluginManager.GetPlugin<ITransportPlugin>(PluginContract.PlayFab_Transport_Decompress) :
PluginManager.GetPlugin<ITransportPlugin>(PluginContract.PlayFab_Transport);

var headers = new Dictionary<string, string>();
if (authType != null && authKey != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace PlayFab.Internal
{
public class PlayFabSysHttp : ITransportPlugin
{
private readonly HttpClient _client = new HttpClient();
protected HttpClient _client = new HttpClient();

public async Task<object> DoPost(string fullUrl, object request, Dictionary<string, string> extraHeaders)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,32 +216,8 @@ public class EntityProfileFileMetadata

}

public class EntityStatisticAttributeValue
{
/// <summary>
/// Metadata associated with the Statistic.
/// </summary>
public string Metadata ;

/// <summary>
/// Attribute name.
/// </summary>
public string Name ;

/// <summary>
/// Attribute Statistic scores.
/// </summary>
public List<string> Scores ;

}

public class EntityStatisticValue
{
/// <summary>
/// Attribute Statistic values.
/// </summary>
public Dictionary<string,EntityStatisticAttributeValue> AttributeStatistics ;

/// <summary>
/// Metadata associated with the Statistic.
/// </summary>
Expand All @@ -257,11 +233,6 @@ public class EntityStatisticValue
/// </summary>
public List<string> Scores ;

/// <summary>
/// Statistic value
/// </summary>
public int? Value ;

/// <summary>
/// Statistic version
/// </summary>
Expand Down
Loading

0 comments on commit c535d88

Please sign in to comment.