Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Support for multiple subscription tiers #3036

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 3 additions & 0 deletions src/Discord.Net.Rest/API/Common/Subscription.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Expand Down Expand Up @@ -52,6 +55,7 @@ internal void Update(API.Subscription model)
UserId = model.UserId;
SKUIds = model.SKUIds.ToImmutableArray();
EntitlementIds = model.EntitlementIds.ToImmutableArray();
RenewalSKUIds = model.RenewalSKUIds?.ToImmutableArray() ?? [];
CurrentPeriodStart = model.CurrentPeriodStart;
CurrentPeriodEnd = model.CurrentPeriodEnd;
Status = model.Status;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Expand Down Expand Up @@ -52,6 +55,7 @@ internal void Update(API.Subscription model)
UserId = model.UserId;
SKUIds = model.SKUIds.ToImmutableArray();
EntitlementIds = model.EntitlementIds.ToImmutableArray();
RenewalSKUIds = model.RenewalSKUIds?.ToImmutableArray() ?? [];
CurrentPeriodStart = model.CurrentPeriodStart;
CurrentPeriodEnd = model.CurrentPeriodEnd;
Status = model.Status;
Expand Down
Loading