using Elsa.Http.Contexts; using Elsa.Http.Contracts; using Elsa.Http.Models; namespace Elsa.Http.Abstractions; /// /// Provides a base class for implementations. /// public abstract class DownloadableProviderBase : IDownloadableProvider { /// public virtual float Priority => 0; /// public abstract bool GetSupportsContent(object content); /// /// Returns a list of downloadables from the specified content. /// protected virtual async ValueTask> GetDownloadablesAsync(DownloadableContext context) { var downloadable = await GetDownloadableAsync(context); return new[]{ downloadable }; } /// /// Returns a downloadable from the specified content. /// protected virtual ValueTask GetDownloadableAsync(DownloadableContext context) { var downloadable = GetDownloadable(context); return new (downloadable); } /// /// Returns a downloadable from the specified content. /// /// This method is not implemented. The derived class must implement at least one of the GetDownloadable methods. protected virtual Downloadable GetDownloadable(DownloadableContext context) { throw new NotImplementedException(); } async ValueTask> IDownloadableProvider.GetDownloadablesAsync(DownloadableContext context) { return await GetDownloadablesAsync(context); } }