Files
rudder-csharp-sdk/Services/InventoryService.cs
T

26 lines
784 B
C#
Raw Permalink Normal View History

2026-08-12 14:04:55 +03:00
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>();
}
}