Initial commit
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using RudderSdk.Core.Models.Inventory;
|
||||
|
||||
namespace RudderSdk.Core;
|
||||
|
||||
/// <summary>Player inventory.</summary>
|
||||
public sealed class InventoryService
|
||||
{
|
||||
private readonly RudderClient _client;
|
||||
|
||||
internal InventoryService(RudderClient client) => _client = client;
|
||||
|
||||
/// <summary>Lists the items the player owns.</summary>
|
||||
public async Task<IReadOnlyList<PlayerInventoryItem>> GetAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
var response = await _client.SendAsync<GetInventoryResponse>(
|
||||
"GET",
|
||||
"/sdk/v1/inventory",
|
||||
cancellationToken).ConfigureAwait(false);
|
||||
|
||||
return response?.Items ?? new List<PlayerInventoryItem>();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user