Skip to content

Commit 79fade6

Browse files
authored
[Feature] Support for multiple subscription tiers (#3036)
1 parent aaa8df9 commit 79fade6

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

src/Discord.Net.Core/Entities/AppSubscriptions/ISubscription.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ public interface ISubscription : ISnowflakeEntity
2323
/// </summary>
2424
IReadOnlyCollection<ulong> EntitlementIds { get; }
2525

26+
/// <summary>
27+
/// Gets the SKUs that this user will be subscribed to at renewal.
28+
/// </summary>
29+
IReadOnlyCollection<ulong> RenewalSKUIds { get; }
30+
2631
/// <summary>
2732
/// Gets the start of the current subscription period.
2833
/// </summary>

src/Discord.Net.Rest/API/Common/Subscription.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ internal class Subscription
1717
[JsonProperty("entitlement_ids")]
1818
public ulong[] EntitlementIds { get; set; }
1919

20+
[JsonProperty("renewal_sku_ids")]
21+
public ulong[] RenewalSKUIds { get; set; }
22+
2023
[JsonProperty("current_period_start")]
2124
public DateTimeOffset CurrentPeriodStart { get; set; }
2225

src/Discord.Net.Rest/Entities/AppSubscriptions/RestSubscription.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ public class RestSubscription : RestEntity<ulong>, ISubscription
2121
/// <inheritdoc />
2222
public IReadOnlyCollection<ulong> EntitlementIds { get; private set; }
2323

24+
/// <inheritdoc />
25+
public IReadOnlyCollection<ulong> RenewalSKUIds { get; private set; }
26+
2427
/// <inheritdoc />
2528
public DateTimeOffset CurrentPeriodStart { get; private set; }
2629

@@ -52,6 +55,7 @@ internal void Update(API.Subscription model)
5255
UserId = model.UserId;
5356
SKUIds = model.SKUIds.ToImmutableArray();
5457
EntitlementIds = model.EntitlementIds.ToImmutableArray();
58+
RenewalSKUIds = model.RenewalSKUIds?.ToImmutableArray() ?? [];
5559
CurrentPeriodStart = model.CurrentPeriodStart;
5660
CurrentPeriodEnd = model.CurrentPeriodEnd;
5761
Status = model.Status;

src/Discord.Net.WebSocket/Entities/AppSubscriptions/SocketSubscription.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ public class SocketSubscription : SocketEntity<ulong>, ISubscription
2121
/// <inheritdoc />
2222
public IReadOnlyCollection<ulong> EntitlementIds { get; private set; }
2323

24+
/// <inheritdoc />
25+
public IReadOnlyCollection<ulong> RenewalSKUIds { get; private set; }
26+
2427
/// <inheritdoc />
2528
public DateTimeOffset CurrentPeriodStart { get; private set; }
2629

@@ -52,6 +55,7 @@ internal void Update(API.Subscription model)
5255
UserId = model.UserId;
5356
SKUIds = model.SKUIds.ToImmutableArray();
5457
EntitlementIds = model.EntitlementIds.ToImmutableArray();
58+
RenewalSKUIds = model.RenewalSKUIds?.ToImmutableArray() ?? [];
5559
CurrentPeriodStart = model.CurrentPeriodStart;
5660
CurrentPeriodEnd = model.CurrentPeriodEnd;
5761
Status = model.Status;

0 commit comments

Comments
 (0)