[Feature] Support for multiple subscription tiers (#3036)

This commit is contained in:
Mihail Gribkov
2024-12-13 03:10:59 +08:00
committed by GitHub
parent aaa8df944c
commit 79fade6762
4 changed files with 16 additions and 0 deletions

View File

@@ -23,6 +23,11 @@ public interface ISubscription : ISnowflakeEntity
/// </summary>
IReadOnlyCollection<ulong> EntitlementIds { get; }
/// <summary>
/// Gets the SKUs that this user will be subscribed to at renewal.
/// </summary>
IReadOnlyCollection<ulong> RenewalSKUIds { get; }
/// <summary>
/// Gets the start of the current subscription period.
/// </summary>

View File

@@ -17,6 +17,9 @@ internal class Subscription
[JsonProperty("entitlement_ids")]
public ulong[] EntitlementIds { get; set; }
[JsonProperty("renewal_sku_ids")]
public ulong[] RenewalSKUIds { get; set; }
[JsonProperty("current_period_start")]
public DateTimeOffset CurrentPeriodStart { get; set; }

View File

@@ -21,6 +21,9 @@ public class RestSubscription : RestEntity<ulong>, ISubscription
/// <inheritdoc />
public IReadOnlyCollection<ulong> EntitlementIds { get; private set; }
/// <inheritdoc />
public IReadOnlyCollection<ulong> RenewalSKUIds { get; private set; }
/// <inheritdoc />
public DateTimeOffset CurrentPeriodStart { get; private set; }
@@ -52,6 +55,7 @@ public class RestSubscription : RestEntity<ulong>, ISubscription
UserId = model.UserId;
SKUIds = model.SKUIds.ToImmutableArray();
EntitlementIds = model.EntitlementIds.ToImmutableArray();
RenewalSKUIds = model.RenewalSKUIds?.ToImmutableArray() ?? [];
CurrentPeriodStart = model.CurrentPeriodStart;
CurrentPeriodEnd = model.CurrentPeriodEnd;
Status = model.Status;

View File

@@ -21,6 +21,9 @@ public class SocketSubscription : SocketEntity<ulong>, ISubscription
/// <inheritdoc />
public IReadOnlyCollection<ulong> EntitlementIds { get; private set; }
/// <inheritdoc />
public IReadOnlyCollection<ulong> RenewalSKUIds { get; private set; }
/// <inheritdoc />
public DateTimeOffset CurrentPeriodStart { get; private set; }
@@ -52,6 +55,7 @@ public class SocketSubscription : SocketEntity<ulong>, ISubscription
UserId = model.UserId;
SKUIds = model.SKUIds.ToImmutableArray();
EntitlementIds = model.EntitlementIds.ToImmutableArray();
RenewalSKUIds = model.RenewalSKUIds?.ToImmutableArray() ?? [];
CurrentPeriodStart = model.CurrentPeriodStart;
CurrentPeriodEnd = model.CurrentPeriodEnd;
Status = model.Status;