ea20ea6d51
LeaderboardSession.ClaimAsync sends onClaim. Generated DTOs live under Models/ with nullable wire fields. Remove incomplete duplicate type files.
41 lines
1.8 KiB
C#
41 lines
1.8 KiB
C#
using System;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace RudderSdk.Core;
|
|
|
|
/// <summary>Session of a scenario leaderboard node.</summary>
|
|
public sealed class LeaderboardSession
|
|
{
|
|
internal LeaderboardSession(ScenarioNodeContext context) => Context = context;
|
|
|
|
/// <summary>Underlying node context.</summary>
|
|
public ScenarioNodeContext Context { get; }
|
|
|
|
/// <summary>Node id.</summary>
|
|
public string Id => Context.NodeId;
|
|
|
|
/// <summary>Reads a typed value from the node data.</summary>
|
|
public T Get<T>(string key, T defaultValue = default!) => Context.Get(key, defaultValue);
|
|
|
|
/// <summary>Advances the run through the onEnd handle.</summary>
|
|
public Task EndAsync(CancellationToken cancellationToken = default) => Context.CompleteAsync("onEnd", cancellationToken);
|
|
|
|
/// <summary>Advances the run through the onEnd handle (fire-and-forget).</summary>
|
|
public void End() => Context.Complete("onEnd");
|
|
|
|
/// <summary>Advances the run through the onClaim handle. The server matches live rank to a place.</summary>
|
|
public Task ClaimAsync(CancellationToken cancellationToken = default) => Context.CompleteAsync("onClaim", cancellationToken);
|
|
|
|
/// <summary>Advances the run through the onClaim handle (fire-and-forget).</summary>
|
|
public void Claim() => Context.Complete("onClaim");
|
|
|
|
/// <summary>Advances the run through the onClaim handle.</summary>
|
|
[Obsolete("Use ClaimAsync. Removed in the next SDK version.")]
|
|
public Task RewardClaimedAsync(CancellationToken cancellationToken = default) => ClaimAsync(cancellationToken);
|
|
|
|
/// <summary>Advances the run through the onClaim handle (fire-and-forget).</summary>
|
|
[Obsolete("Use Claim. Removed in the next SDK version.")]
|
|
public void RewardClaimed() => Claim();
|
|
}
|