diff --git a/src/Discord.Net.Core/IDiscordClient.cs b/src/Discord.Net.Core/IDiscordClient.cs index 431d58168e..9170998942 100644 --- a/src/Discord.Net.Core/IDiscordClient.cs +++ b/src/Discord.Net.Core/IDiscordClient.cs @@ -343,7 +343,7 @@ public interface IDiscordClient : IDisposable, IAsyncDisposable /// IAsyncEnumerable> GetEntitlementsAsync(int limit = 100, ulong? afterId = null, ulong? beforeId = null, bool excludeEnded = false, ulong? guildId = null, ulong? userId = null, - ulong[] skuIds = null, RequestOptions options = null); + ulong[] skuIds = null, RequestOptions options = null, bool? excludeDeleted = null); /// /// Returns all SKUs for a given application. diff --git a/src/Discord.Net.Rest/API/Rest/ListEntitlementsParams.cs b/src/Discord.Net.Rest/API/Rest/ListEntitlementsParams.cs index 6e569efc72..5363634a19 100644 --- a/src/Discord.Net.Rest/API/Rest/ListEntitlementsParams.cs +++ b/src/Discord.Net.Rest/API/Rest/ListEntitlementsParams.cs @@ -15,4 +15,6 @@ internal class ListEntitlementsParams public Optional GuildId { get; set; } public Optional ExcludeEnded { get; set; } + + public Optional ExcludeDeleted { get; set; } } diff --git a/src/Discord.Net.Rest/BaseDiscordClient.cs b/src/Discord.Net.Rest/BaseDiscordClient.cs index 5eb56b6b13..a242dc77ea 100644 --- a/src/Discord.Net.Rest/BaseDiscordClient.cs +++ b/src/Discord.Net.Rest/BaseDiscordClient.cs @@ -287,7 +287,7 @@ Task IDiscordClient.DeleteTestEntitlementAsync(ulong entitlementId, RequestOptio /// Returns all entitlements for a given app. /// IAsyncEnumerable> IDiscordClient.GetEntitlementsAsync(int limit, ulong? afterId, ulong? beforeId, - bool excludeEnded, ulong? guildId, ulong? userId, ulong[] skuIds, RequestOptions options) => AsyncEnumerable.Empty>(); + bool excludeEnded, ulong? guildId, ulong? userId, ulong[] skuIds, RequestOptions options, bool? excludeDeleted) => AsyncEnumerable.Empty>(); /// /// Gets all SKUs for a given application. diff --git a/src/Discord.Net.Rest/ClientHelper.cs b/src/Discord.Net.Rest/ClientHelper.cs index 8eb9448755..d7d725117d 100644 --- a/src/Discord.Net.Rest/ClientHelper.cs +++ b/src/Discord.Net.Rest/ClientHelper.cs @@ -405,7 +405,7 @@ public static async Task CreateTestEntitlementAsync(BaseDiscord public static IAsyncEnumerable> ListEntitlementsAsync(BaseDiscordClient client, int? limit = 100, ulong? afterId = null, ulong? beforeId = null, bool excludeEnded = false, ulong? guildId = null, ulong? userId = null, - ulong[] skuIds = null, RequestOptions options = null) + ulong[] skuIds = null, bool? excludeDeleted = null, RequestOptions options = null) { return new PagedAsyncEnumerable( DiscordConfig.MaxEntitlementsPerBatch, @@ -419,6 +419,7 @@ public static IAsyncEnumerable> ListEntitle GuildId = guildId ?? Optional.Unspecified, UserId = userId ?? Optional.Unspecified, SkuIds = skuIds ?? Optional.Unspecified, + ExcludeDeleted = excludeDeleted ?? Optional.Unspecified }; if (info.Position != null) args.AfterId = info.Position.Value; diff --git a/src/Discord.Net.Rest/DiscordRestApiClient.cs b/src/Discord.Net.Rest/DiscordRestApiClient.cs index 91d533a596..e5257c8d7a 100644 --- a/src/Discord.Net.Rest/DiscordRestApiClient.cs +++ b/src/Discord.Net.Rest/DiscordRestApiClient.cs @@ -2842,6 +2842,11 @@ public Task ListEntitlementAsync(ListEntitlementsParams args, Req query += $"&exclude_ended={args.ExcludeEnded.Value}"; } + if (args.ExcludeDeleted.IsSpecified) + { + query += $"&exclude_deleted={args.ExcludeDeleted.Value}"; + } + return SendAsync("GET", () => $"applications/{CurrentApplicationId}/entitlements{query}", new BucketIds(), options: options); } diff --git a/src/Discord.Net.Rest/DiscordRestClient.cs b/src/Discord.Net.Rest/DiscordRestClient.cs index 2a010e7b0b..a59ac3e792 100644 --- a/src/Discord.Net.Rest/DiscordRestClient.cs +++ b/src/Discord.Net.Rest/DiscordRestClient.cs @@ -289,8 +289,8 @@ public Task DeleteTestEntitlementAsync(ulong entitlementId, RequestOptions optio /// public IAsyncEnumerable> GetEntitlementsAsync(int? limit = 100, ulong? afterId = null, ulong? beforeId = null, bool excludeEnded = false, ulong? guildId = null, ulong? userId = null, - ulong[] skuIds = null, RequestOptions options = null) - => ClientHelper.ListEntitlementsAsync(this, limit, afterId, beforeId, excludeEnded, guildId, userId, skuIds, options); + ulong[] skuIds = null, RequestOptions options = null, bool? excludeDeleted = null) + => ClientHelper.ListEntitlementsAsync(this, limit, afterId, beforeId, excludeEnded, guildId, userId, skuIds, excludeDeleted, options); /// public Task> GetSKUsAsync(RequestOptions options = null) diff --git a/src/Discord.Net.WebSocket/DiscordSocketClient.cs b/src/Discord.Net.WebSocket/DiscordSocketClient.cs index cc6753d1b4..cb7ba9b9d0 100644 --- a/src/Discord.Net.WebSocket/DiscordSocketClient.cs +++ b/src/Discord.Net.WebSocket/DiscordSocketClient.cs @@ -442,8 +442,8 @@ public Task DeleteTestEntitlementAsync(ulong entitlementId, RequestOptions optio /// public IAsyncEnumerable> GetEntitlementsAsync(int? limit = 100, ulong? afterId = null, ulong? beforeId = null, bool excludeEnded = false, ulong? guildId = null, ulong? userId = null, - ulong[] skuIds = null, RequestOptions options = null) - => ClientHelper.ListEntitlementsAsync(this, limit, afterId, beforeId, excludeEnded, guildId, userId, skuIds, options); + ulong[] skuIds = null, RequestOptions options = null, bool? excludeDeleted = null) + => ClientHelper.ListEntitlementsAsync(this, limit, afterId, beforeId, excludeEnded, guildId, userId, skuIds, excludeDeleted, options); /// public Task> GetSKUsAsync(RequestOptions options = null)