Refactor downloaders to use ByteDocument and add options builders
Replaces generic RawType with ByteDocument in downloaders and context classes, simplifying type usage. Adds builder classes for FailurePredicateOptions, FragmentOptions, SkipPredicateOptions, and UnitDownloaderOptions to improve configuration flexibility. Introduces DownloadTarget enum and SkipPredicate delegate for more granular download control. Refactors Fluent API interfaces and implementations to remove RawType generics and streamline usage. Adds Playwright and Stealth download strategies for extensibility.
This commit is contained in:
@@ -6,15 +6,15 @@ using Beam.Stealth;
|
||||
|
||||
namespace Beam.Fluent;
|
||||
|
||||
public interface IContextStage<RawType, OutType> {
|
||||
IContextStage<RawType, OutType> Configure(Action<DownloadContextBuilder<RawType>> configure);
|
||||
IContextStage<RawType, OutType> WithParallelism(int degree);
|
||||
IContextStage<RawType, OutType> WithTimeout(TimeSpan timeout);
|
||||
IContextStage<RawType, OutType> WithRetryReporter(IProgress<IRetryReport> reporter);
|
||||
IContextStage<RawType, OutType> UseFragments();
|
||||
IContextStage<RawType, OutType> UsePlaywright(PlaywrightAsyncManipulator manipulator);
|
||||
IContextStage<RawType, OutType> UseStealth(StealthAsyncManipulator manipulator, StealthConfig config);
|
||||
IContextStage<RawType, OutType> ConfigureUnitDownloaderOptions(
|
||||
Action<UnitDownloaderOptionsBuilder<RawType, OutType>> configure);
|
||||
public interface IContextStage<OutType> {
|
||||
IContextStage<OutType> Configure(Action<DownloadContextBuilder> configure);
|
||||
IContextStage<OutType> WithParallelism(int degree);
|
||||
IContextStage<OutType> WithTimeout(TimeSpan timeout);
|
||||
IContextStage<OutType> WithRetryReporter(IProgress<IRetryReport> reporter);
|
||||
IContextStage<OutType> UseFragments();
|
||||
IContextStage<OutType> UsePlaywright(PlaywrightAsyncManipulator manipulator);
|
||||
IContextStage<OutType> UseStealth(StealthAsyncManipulator manipulator, StealthConfig config);
|
||||
IContextStage<OutType> ConfigureUnitDownloaderOptions(
|
||||
Action<UnitDownloaderOptionsBuilder<OutType>> configure);
|
||||
DownloadEnumerable<OutType> Build();
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace Beam.Fluent;
|
||||
|
||||
public interface IDownloadStage<RawType, OutType> {
|
||||
IDownloadStage<RawType, OutType> SaveToDirectory(string dir);
|
||||
IDownloadStage<RawType, OutType> SaveToFiles(IEnumerable<string> files);
|
||||
IDownloadStage<RawType, OutType> SaveToMemory(ConcurrentBag<OutType> bag);
|
||||
public interface IDownloadStage<OutType> {
|
||||
IDownloadStage<OutType> SaveToDirectory(string dir);
|
||||
IDownloadStage<OutType> SaveToFiles(IEnumerable<string> files);
|
||||
IDownloadStage<OutType> SaveToMemory(ConcurrentBag<OutType> bag);
|
||||
void WaitForDownload();
|
||||
Task WaitForDownloadAsync();
|
||||
DownloadEnumerable<OutType> AsAsyncEnumerable();
|
||||
|
||||
@@ -3,6 +3,6 @@ using Beam.Models;
|
||||
|
||||
namespace Beam.Fluent;
|
||||
|
||||
public interface ITransformStage<RawType, OutType> {
|
||||
IContextStage<RawType, OutType> WithTransformer(AsyncTransformer<RawType, OutType> factory);
|
||||
public interface ITransformStage<OutType> {
|
||||
IContextStage<OutType> WithTransformer(AsyncTransformer<ByteDocument, OutType> factory);
|
||||
}
|
||||
Reference in New Issue
Block a user