Skip to content

Commit

Permalink
https://docs.microsoft.com/en-us/gaming/playfab/release-notes/#240401
Browse files Browse the repository at this point in the history
  • Loading branch information
PlayFab SDK Team authored and PlayFab SDK Team committed Apr 1, 2024
2 parents 4488eef + ceee0a0 commit eb4ce49
Show file tree
Hide file tree
Showing 11 changed files with 513 additions and 17 deletions.
62 changes: 61 additions & 1 deletion PlayFabSDK/source/PlayFabEconomyAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,36 @@ public static async Task<PlayFabResult<ExecuteInventoryOperationsResponse>> Exec
return new PlayFabResult<ExecuteInventoryOperationsResponse> { Result = result, CustomData = customData };
}

/// <summary>
/// Transfer a list of inventory items. A maximum list of 50 operations can be performed by a single request. When the
/// response code is 202, one or more operations did not complete within the timeframe of the request. You can identify the
/// pending operations by looking for OperationStatus = 'InProgress'. You can check on the operation status at anytime
/// within 1 day of the request by passing the TransactionToken to the GetInventoryOperationStatus API.
/// </summary>
public static async Task<PlayFabResult<ExecuteTransferOperationsResponse>> ExecuteTransferOperationsAsync(ExecuteTransferOperationsRequest request, object customData = null, Dictionary<string, string> extraHeaders = null)
{
await new PlayFabUtil.SynchronizationContextRemover();

var requestContext = request?.AuthenticationContext ?? PlayFabSettings.staticPlayer;
var requestSettings = PlayFabSettings.staticSettings;
if (requestContext.EntityToken == null) throw new PlayFabException(PlayFabExceptionCode.EntityTokenNotSet, "Must call Client Login or GetEntityToken before calling this method");


var httpResult = await PlayFabHttp.DoPost("/Inventory/ExecuteTransferOperations", request, "X-EntityToken", requestContext.EntityToken, extraHeaders);
if (httpResult is PlayFabError)
{
var error = (PlayFabError)httpResult;
PlayFabSettings.GlobalErrorHandler?.Invoke(error);
return new PlayFabResult<ExecuteTransferOperationsResponse> { Error = error, CustomData = customData };
}

var resultRawJson = (string)httpResult;
var resultData = PluginManager.GetPlugin<ISerializerPlugin>(PluginContract.PlayFab_Serializer).DeserializeObject<PlayFabJsonSuccess<ExecuteTransferOperationsResponse>>(resultRawJson);
var result = resultData.data;

return new PlayFabResult<ExecuteTransferOperationsResponse> { Result = result, CustomData = customData };
}

/// <summary>
/// Gets the configuration for the catalog. Only Title Entities can call this API. There is a limit of 100 requests in 10
/// seconds for this API. More information about the Catalog Config can be found here:
Expand Down Expand Up @@ -456,6 +486,34 @@ public static async Task<PlayFabResult<GetInventoryItemsResponse>> GetInventoryI
return new PlayFabResult<GetInventoryItemsResponse> { Result = result, CustomData = customData };
}

/// <summary>
/// Get the status of an inventory operation using an OperationToken. You can check on the operation status at anytime
/// within 1 day of the request by passing the TransactionToken to the this API.
/// </summary>
public static async Task<PlayFabResult<GetInventoryOperationStatusResponse>> GetInventoryOperationStatusAsync(GetInventoryOperationStatusRequest request, object customData = null, Dictionary<string, string> extraHeaders = null)
{
await new PlayFabUtil.SynchronizationContextRemover();

var requestContext = request?.AuthenticationContext ?? PlayFabSettings.staticPlayer;
var requestSettings = PlayFabSettings.staticSettings;
if (requestContext.EntityToken == null) throw new PlayFabException(PlayFabExceptionCode.EntityTokenNotSet, "Must call Client Login or GetEntityToken before calling this method");


var httpResult = await PlayFabHttp.DoPost("/Inventory/GetInventoryOperationStatus", request, "X-EntityToken", requestContext.EntityToken, extraHeaders);
if (httpResult is PlayFabError)
{
var error = (PlayFabError)httpResult;
PlayFabSettings.GlobalErrorHandler?.Invoke(error);
return new PlayFabResult<GetInventoryOperationStatusResponse> { Error = error, CustomData = customData };
}

var resultRawJson = (string)httpResult;
var resultData = PluginManager.GetPlugin<ISerializerPlugin>(PluginContract.PlayFab_Serializer).DeserializeObject<PlayFabJsonSuccess<GetInventoryOperationStatusResponse>>(resultRawJson);
var result = resultData.data;

return new PlayFabResult<GetInventoryOperationStatusResponse> { Result = result, CustomData = customData };
}

/// <summary>
/// Retrieves an item from the public catalog. GetItem does not work off a cache of the Catalog and should be used when
/// trying to get recent item updates. However, please note that item references data is cached and may take a few moments
Expand Down Expand Up @@ -1155,7 +1213,9 @@ public static async Task<PlayFabResult<TakedownItemReviewsResponse>> TakedownIte
/// <summary>
/// Transfer inventory items. When transferring across collections, a 202 response indicates that the transfer did not
/// complete within the timeframe of the request. You can identify the pending operations by looking for OperationStatus =
/// 'InProgress'. More information about item transfer scenarios can be found here:
/// 'InProgress'. You can check on the operation status at anytime within 1 day of the request by passing the
/// TransactionToken to the GetInventoryOperationStatus API. More information about item transfer scenarios can be found
/// here:
/// https://learn.microsoft.com/en-us/gaming/playfab/features/economy-v2/inventory/?tabs=inventory-game-manager#transfer-inventory-items
/// </summary>
public static async Task<PlayFabResult<TransferInventoryItemsResponse>> TransferInventoryItemsAsync(TransferInventoryItemsRequest request, object customData = null, Dictionary<string, string> extraHeaders = null)
Expand Down
60 changes: 59 additions & 1 deletion PlayFabSDK/source/PlayFabEconomyInstanceAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,35 @@ public async Task<PlayFabResult<ExecuteInventoryOperationsResponse>> ExecuteInve
return new PlayFabResult<ExecuteInventoryOperationsResponse> { Result = result, CustomData = customData };
}

/// <summary>
/// Transfer a list of inventory items. A maximum list of 50 operations can be performed by a single request. When the
/// response code is 202, one or more operations did not complete within the timeframe of the request. You can identify the
/// pending operations by looking for OperationStatus = 'InProgress'. You can check on the operation status at anytime
/// within 1 day of the request by passing the TransactionToken to the GetInventoryOperationStatus API.
/// </summary>
public async Task<PlayFabResult<ExecuteTransferOperationsResponse>> ExecuteTransferOperationsAsync(ExecuteTransferOperationsRequest request, object customData = null, Dictionary<string, string> extraHeaders = null)
{
await new PlayFabUtil.SynchronizationContextRemover();

var requestContext = request?.AuthenticationContext ?? authenticationContext;
var requestSettings = apiSettings ?? PlayFabSettings.staticSettings;
if (requestContext.EntityToken == null) throw new PlayFabException(PlayFabExceptionCode.EntityTokenNotSet, "Must call Client Login or GetEntityToken before calling this method");

var httpResult = await PlayFabHttp.DoPost("/Inventory/ExecuteTransferOperations", request, "X-EntityToken", requestContext.EntityToken, extraHeaders, requestSettings);
if (httpResult is PlayFabError)
{
var error = (PlayFabError)httpResult;
PlayFabSettings.GlobalErrorHandler?.Invoke(error);
return new PlayFabResult<ExecuteTransferOperationsResponse> { Error = error, CustomData = customData };
}

var resultRawJson = (string)httpResult;
var resultData = PluginManager.GetPlugin<ISerializerPlugin>(PluginContract.PlayFab_Serializer).DeserializeObject<PlayFabJsonSuccess<ExecuteTransferOperationsResponse>>(resultRawJson);
var result = resultData.data;

return new PlayFabResult<ExecuteTransferOperationsResponse> { Result = result, CustomData = customData };
}

/// <summary>
/// Gets the configuration for the catalog. Only Title Entities can call this API. There is a limit of 100 requests in 10
/// seconds for this API. More information about the Catalog Config can be found here:
Expand Down Expand Up @@ -459,6 +488,33 @@ public async Task<PlayFabResult<GetInventoryItemsResponse>> GetInventoryItemsAsy
return new PlayFabResult<GetInventoryItemsResponse> { Result = result, CustomData = customData };
}

/// <summary>
/// Get the status of an inventory operation using an OperationToken. You can check on the operation status at anytime
/// within 1 day of the request by passing the TransactionToken to the this API.
/// </summary>
public async Task<PlayFabResult<GetInventoryOperationStatusResponse>> GetInventoryOperationStatusAsync(GetInventoryOperationStatusRequest request, object customData = null, Dictionary<string, string> extraHeaders = null)
{
await new PlayFabUtil.SynchronizationContextRemover();

var requestContext = request?.AuthenticationContext ?? authenticationContext;
var requestSettings = apiSettings ?? PlayFabSettings.staticSettings;
if (requestContext.EntityToken == null) throw new PlayFabException(PlayFabExceptionCode.EntityTokenNotSet, "Must call Client Login or GetEntityToken before calling this method");

var httpResult = await PlayFabHttp.DoPost("/Inventory/GetInventoryOperationStatus", request, "X-EntityToken", requestContext.EntityToken, extraHeaders, requestSettings);
if (httpResult is PlayFabError)
{
var error = (PlayFabError)httpResult;
PlayFabSettings.GlobalErrorHandler?.Invoke(error);
return new PlayFabResult<GetInventoryOperationStatusResponse> { Error = error, CustomData = customData };
}

var resultRawJson = (string)httpResult;
var resultData = PluginManager.GetPlugin<ISerializerPlugin>(PluginContract.PlayFab_Serializer).DeserializeObject<PlayFabJsonSuccess<GetInventoryOperationStatusResponse>>(resultRawJson);
var result = resultData.data;

return new PlayFabResult<GetInventoryOperationStatusResponse> { Result = result, CustomData = customData };
}

/// <summary>
/// Retrieves an item from the public catalog. GetItem does not work off a cache of the Catalog and should be used when
/// trying to get recent item updates. However, please note that item references data is cached and may take a few moments
Expand Down Expand Up @@ -1133,7 +1189,9 @@ public async Task<PlayFabResult<TakedownItemReviewsResponse>> TakedownItemReview
/// <summary>
/// Transfer inventory items. When transferring across collections, a 202 response indicates that the transfer did not
/// complete within the timeframe of the request. You can identify the pending operations by looking for OperationStatus =
/// 'InProgress'. More information about item transfer scenarios can be found here:
/// 'InProgress'. You can check on the operation status at anytime within 1 day of the request by passing the
/// TransactionToken to the GetInventoryOperationStatus API. More information about item transfer scenarios can be found
/// here:
/// https://learn.microsoft.com/en-us/gaming/playfab/features/economy-v2/inventory/?tabs=inventory-game-manager#transfer-inventory-items
/// </summary>
public async Task<PlayFabResult<TransferInventoryItemsResponse>> TransferInventoryItemsAsync(TransferInventoryItemsRequest request, object customData = null, Dictionary<string, string> extraHeaders = null)
Expand Down
130 changes: 130 additions & 0 deletions PlayFabSDK/source/PlayFabEconomyModels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1095,6 +1095,99 @@ public class ExecuteInventoryOperationsResponse : PlayFabResultCommon

}

/// <summary>
/// Transfer the specified list of inventory items of an entity's container Id to another entity's container Id.
/// </summary>
public class ExecuteTransferOperationsRequest : PlayFabRequestCommon
{
/// <summary>
/// The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).
/// </summary>
public Dictionary<string,string> CustomTags ;

/// <summary>
/// The inventory collection id the request is transferring from. (Default="default")
/// </summary>
public string GivingCollectionId ;

/// <summary>
/// The entity the request is transferring from. Set to the caller by default.
/// </summary>
public EntityKey GivingEntity ;

/// <summary>
/// ETags are used for concurrency checking when updating resources. More information about using ETags can be found here:
/// https://learn.microsoft.com/en-us/gaming/playfab/features/economy-v2/catalog/etags
/// </summary>
public string GivingETag ;

/// <summary>
/// The idempotency id for the request.
/// </summary>
public string IdempotencyId ;

/// <summary>
/// The transfer operations to run transactionally. The operations will be executed in-order sequentially and will succeed
/// or fail as a batch. Up to 50 operations can be added.
/// </summary>
public List<TransferInventoryItemsOperation> Operations ;

/// <summary>
/// The inventory collection id the request is transferring to. (Default="default")
/// </summary>
public string ReceivingCollectionId ;

/// <summary>
/// The entity the request is transferring to. Set to the caller by default.
/// </summary>
public EntityKey ReceivingEntity ;

}

public class ExecuteTransferOperationsResponse : PlayFabResultCommon
{
/// <summary>
/// ETags are used for concurrency checking when updating resources (before transferring from). This value will be empty if
/// the operation has not completed yet. More information about using ETags can be found here:
/// https://learn.microsoft.com/en-us/gaming/playfab/features/economy-v2/catalog/etags
/// </summary>
public string GivingETag ;

/// <summary>
/// The ids of transactions that occurred as a result of the request's giving action.
/// </summary>
public List<string> GivingTransactionIds ;

/// <summary>
/// The Idempotency ID for this request.
/// </summary>
public string IdempotencyId ;

/// <summary>
/// The transfer operation status. Possible values are 'InProgress' or 'Completed'. If the operation has completed, the
/// response code will be 200. Otherwise, it will be 202.
/// </summary>
public string OperationStatus ;

/// <summary>
/// The token that can be used to get the status of the transfer operation. This will only have a value if OperationStatus
/// is 'InProgress'.
/// </summary>
public string OperationToken ;

/// <summary>
/// ETags are used for concurrency checking when updating resources (before transferring to). This value will be empty if
/// the operation has not completed yet.
/// </summary>
public string ReceivingETag ;

/// <summary>
/// The ids of transactions that occurred as a result of the request's receiving action.
/// </summary>
public List<string> ReceivingTransactionIds ;

}

public class FileConfig
{
/// <summary>
Expand Down Expand Up @@ -1393,6 +1486,37 @@ public class GetInventoryItemsResponse : PlayFabResultCommon

}

/// <summary>
/// Get the status of an Inventory Operation using an OperationToken.
/// </summary>
public class GetInventoryOperationStatusRequest : PlayFabRequestCommon
{
/// <summary>
/// The id of the entity's collection to perform this action on. (Default="default")
/// </summary>
public string CollectionId ;

/// <summary>
/// The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).
/// </summary>
public Dictionary<string,string> CustomTags ;

/// <summary>
/// The entity to perform this action on.
/// </summary>
public EntityKey Entity ;

}

public class GetInventoryOperationStatusResponse : PlayFabResultCommon
{
/// <summary>
/// The inventory operation status.
/// </summary>
public string OperationStatus ;

}

/// <summary>
/// Given an item, return a set of bundles and stores containing the item.
/// </summary>
Expand Down Expand Up @@ -3327,6 +3451,12 @@ public class TransferInventoryItemsResponse : PlayFabResultCommon
/// </summary>
public string OperationStatus ;

/// <summary>
/// The token that can be used to get the status of the transfer operation. This will only have a value if OperationStatus
/// is 'InProgress'.
/// </summary>
public string OperationToken ;

/// <summary>
/// The ids of transactions that occurred as a result of the request's receiving action.
/// </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.177.240315</Version>
<Version>1.178.240401</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#240315</PackageReleaseNotes>
<PackageReleaseNotes>https://docs.microsoft.com/gaming/playfab/release-notes#240401</PackageReleaseNotes>
<NeutralLanguage>en</NeutralLanguage>
<AssemblyVersion>1</AssemblyVersion>
<FileVersion>1</FileVersion>
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.177.240315";
public const string BuildIdentifier = "adobuild_csharpsdk_118";
public const string SdkVersionString = "CSharpSDK-1.177.240315";
public const string SdkVersion = "1.178.240401";
public const string BuildIdentifier = "adobuild_csharpsdk_114";
public const string SdkVersionString = "CSharpSDK-1.178.240401";
/// <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
Loading

0 comments on commit eb4ce49

Please sign in to comment.