using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Discord
{
/// An extension class for squashing .
///
/// This set of extension methods will squash an into a
/// single . This is often associated with requests that has a
/// set limit when requesting.
///
public static class AsyncEnumerableExtensions
{
/// Flattens the specified pages into one asynchronously.
public static async Task> FlattenAsync(this IAsyncEnumerable> source)
{
return await source.Flatten().ToArrayAsync().ConfigureAwait(false);
}
/// Flattens the specified pages into one .
public static IAsyncEnumerable Flatten(this IAsyncEnumerable> source)
{
return source.SelectMany(enumerable => enumerable.ToAsyncEnumerable());
}
}
}