[Feature] Add excludeDeleted argument to GetEntitlementsAsync (#3074)
* add `excludeDeleted` argument * i love when it still builds locally somehow
This commit is contained in:
@@ -343,7 +343,7 @@ namespace Discord
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
IAsyncEnumerable<IReadOnlyCollection<IEntitlement>> GetEntitlementsAsync(int limit = 100,
|
IAsyncEnumerable<IReadOnlyCollection<IEntitlement>> GetEntitlementsAsync(int limit = 100,
|
||||||
ulong? afterId = null, ulong? beforeId = null, bool excludeEnded = false, ulong? guildId = null, ulong? userId = null,
|
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);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns all SKUs for a given application.
|
/// Returns all SKUs for a given application.
|
||||||
|
|||||||
@@ -15,4 +15,6 @@ internal class ListEntitlementsParams
|
|||||||
public Optional<ulong> GuildId { get; set; }
|
public Optional<ulong> GuildId { get; set; }
|
||||||
|
|
||||||
public Optional<bool> ExcludeEnded { get; set; }
|
public Optional<bool> ExcludeEnded { get; set; }
|
||||||
|
|
||||||
|
public Optional<bool> ExcludeDeleted { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -287,7 +287,7 @@ namespace Discord.Rest
|
|||||||
/// Returns all entitlements for a given app.
|
/// Returns all entitlements for a given app.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
IAsyncEnumerable<IReadOnlyCollection<IEntitlement>> IDiscordClient.GetEntitlementsAsync(int limit, ulong? afterId, ulong? beforeId,
|
IAsyncEnumerable<IReadOnlyCollection<IEntitlement>> IDiscordClient.GetEntitlementsAsync(int limit, ulong? afterId, ulong? beforeId,
|
||||||
bool excludeEnded, ulong? guildId, ulong? userId, ulong[] skuIds, RequestOptions options) => AsyncEnumerable.Empty<IReadOnlyCollection<IEntitlement>>();
|
bool excludeEnded, ulong? guildId, ulong? userId, ulong[] skuIds, RequestOptions options, bool? excludeDeleted) => AsyncEnumerable.Empty<IReadOnlyCollection<IEntitlement>>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets all SKUs for a given application.
|
/// Gets all SKUs for a given application.
|
||||||
|
|||||||
@@ -405,7 +405,7 @@ namespace Discord.Rest
|
|||||||
|
|
||||||
public static IAsyncEnumerable<IReadOnlyCollection<RestEntitlement>> ListEntitlementsAsync(BaseDiscordClient client, int? limit = 100,
|
public static IAsyncEnumerable<IReadOnlyCollection<RestEntitlement>> ListEntitlementsAsync(BaseDiscordClient client, int? limit = 100,
|
||||||
ulong? afterId = null, ulong? beforeId = null, bool excludeEnded = false, ulong? guildId = null, ulong? userId = null,
|
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<RestEntitlement>(
|
return new PagedAsyncEnumerable<RestEntitlement>(
|
||||||
DiscordConfig.MaxEntitlementsPerBatch,
|
DiscordConfig.MaxEntitlementsPerBatch,
|
||||||
@@ -419,6 +419,7 @@ namespace Discord.Rest
|
|||||||
GuildId = guildId ?? Optional<ulong>.Unspecified,
|
GuildId = guildId ?? Optional<ulong>.Unspecified,
|
||||||
UserId = userId ?? Optional<ulong>.Unspecified,
|
UserId = userId ?? Optional<ulong>.Unspecified,
|
||||||
SkuIds = skuIds ?? Optional<ulong[]>.Unspecified,
|
SkuIds = skuIds ?? Optional<ulong[]>.Unspecified,
|
||||||
|
ExcludeDeleted = excludeDeleted ?? Optional<bool>.Unspecified
|
||||||
};
|
};
|
||||||
if (info.Position != null)
|
if (info.Position != null)
|
||||||
args.AfterId = info.Position.Value;
|
args.AfterId = info.Position.Value;
|
||||||
|
|||||||
@@ -2842,6 +2842,11 @@ namespace Discord.API
|
|||||||
query += $"&exclude_ended={args.ExcludeEnded.Value}";
|
query += $"&exclude_ended={args.ExcludeEnded.Value}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args.ExcludeDeleted.IsSpecified)
|
||||||
|
{
|
||||||
|
query += $"&exclude_deleted={args.ExcludeDeleted.Value}";
|
||||||
|
}
|
||||||
|
|
||||||
return SendAsync<Entitlement[]>("GET", () => $"applications/{CurrentApplicationId}/entitlements{query}", new BucketIds(), options: options);
|
return SendAsync<Entitlement[]>("GET", () => $"applications/{CurrentApplicationId}/entitlements{query}", new BucketIds(), options: options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -289,8 +289,8 @@ namespace Discord.Rest
|
|||||||
/// <inheritdoc cref="IDiscordClient.GetEntitlementsAsync" />
|
/// <inheritdoc cref="IDiscordClient.GetEntitlementsAsync" />
|
||||||
public IAsyncEnumerable<IReadOnlyCollection<IEntitlement>> GetEntitlementsAsync(int? limit = 100,
|
public IAsyncEnumerable<IReadOnlyCollection<IEntitlement>> GetEntitlementsAsync(int? limit = 100,
|
||||||
ulong? afterId = null, ulong? beforeId = null, bool excludeEnded = false, ulong? guildId = null, ulong? userId = null,
|
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)
|
||||||
=> ClientHelper.ListEntitlementsAsync(this, limit, afterId, beforeId, excludeEnded, guildId, userId, skuIds, options);
|
=> ClientHelper.ListEntitlementsAsync(this, limit, afterId, beforeId, excludeEnded, guildId, userId, skuIds, excludeDeleted, options);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public Task<IReadOnlyCollection<SKU>> GetSKUsAsync(RequestOptions options = null)
|
public Task<IReadOnlyCollection<SKU>> GetSKUsAsync(RequestOptions options = null)
|
||||||
|
|||||||
@@ -442,8 +442,8 @@ namespace Discord.WebSocket
|
|||||||
/// <inheritdoc cref="IDiscordClient.GetEntitlementsAsync"/>
|
/// <inheritdoc cref="IDiscordClient.GetEntitlementsAsync"/>
|
||||||
public IAsyncEnumerable<IReadOnlyCollection<IEntitlement>> GetEntitlementsAsync(int? limit = 100,
|
public IAsyncEnumerable<IReadOnlyCollection<IEntitlement>> GetEntitlementsAsync(int? limit = 100,
|
||||||
ulong? afterId = null, ulong? beforeId = null, bool excludeEnded = false, ulong? guildId = null, ulong? userId = null,
|
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)
|
||||||
=> ClientHelper.ListEntitlementsAsync(this, limit, afterId, beforeId, excludeEnded, guildId, userId, skuIds, options);
|
=> ClientHelper.ListEntitlementsAsync(this, limit, afterId, beforeId, excludeEnded, guildId, userId, skuIds, excludeDeleted, options);
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public Task<IReadOnlyCollection<SKU>> GetSKUsAsync(RequestOptions options = null)
|
public Task<IReadOnlyCollection<SKU>> GetSKUsAsync(RequestOptions options = null)
|
||||||
|
|||||||
Reference in New Issue
Block a user