7ed05abdb8
- Introduced modularity by splitting Beam into new projects: Beam.Abstractions, Beam.Models, and Beam.Downloaders. - Refactored existing classes into appropriate namespaces and projects. - Replaced specific implementations with abstractions (e.g., SourceLinkBuilder to LinkBuilder, State to IState, etc.). - Updated interfaces: added ITemplate, IArticleData, IDownloadReport, and others for improved extensibility. - Removed deprecated classes like SourceLinkBuilder and StateChangerFactory. - Enhanced link handling in downloaders by refactoring to use `string` over `SourceLink`. - Consolidated shared logic under Beam.Abstractions.
23 lines
856 B
C#
23 lines
856 B
C#
using Beam.Data;
|
|
using Beam.Downloaders;
|
|
using Beam.Dynamic;
|
|
using Beam.Models;
|
|
|
|
namespace Beam.Fluent {
|
|
public static partial class DownloadBuilder<RawType, OutType> {
|
|
private sealed record TransformStage(
|
|
WebResource Source,
|
|
BeamDataContext Data,
|
|
DownloadContextBuilder<RawType> CtxBuilder) : ITransformStage, IAlternativeTransformStage {
|
|
public IContextStage WithTransformer(Func<DataBindings, AsyncTransformer<RawType, OutType>> factory) {
|
|
var transformer = factory(Data.Bindings[Source.Bindings]);
|
|
return new ContextStage(CtxBuilder, transformer);
|
|
}
|
|
|
|
public IContextStage WithTransformer(AsyncTransformer<RawType, OutType> transformer) {
|
|
return new ContextStage(CtxBuilder, transformer);
|
|
}
|
|
}
|
|
}
|
|
}
|