gofeed
gofeed copied to clipboard
v2: Implement ParseOptions foundation for parser API
Overview
This PR implements the foundation for ParseOptions as specified in #244. It establishes the basic structure and API changes needed for v2, with some features left for future implementation.
What's Implemented
Core ParseOptions Structure
- Created
ParseOptionsstruct with all fields from the RFC - Added
RequestOptionssub-struct for HTTP configuration - Added
StrictnessOptionsfor parsing behavior control
API Updates
- All parsers now accept
*ParseOptionsparameter (can be nil) - Changed
ParseURLto context-first:ParseURL(ctx, url, opts) - Removed
ParseURLWithContext- context is now always required - Updated translators to accept ParseOptions for future extensibility
Basic Features
- MaxItems limiting - implemented at parse level (not translation)
-
KeepOriginalFeed - stores format-specific feed in
Feed.OriginalFeed - UserAgent and AuthConfig support in ParseURL
- Client and Timeout configuration
Left for Future PRs
- Conditional requests (IfNoneMatch, IfModifiedSince) - see #247
- HTTP response metadata collection - see #247
- ParseDates toggle
- StrictnessOptions implementation
Breaking Changes
-
All Parse methods now require
*ParseOptions:// Old feed, err := parser.Parse(reader) // New feed, err := parser.Parse(reader, nil) // nil for defaults -
ParseURL is now context-first:
// Old feed, err := parser.ParseURL(url) feed, err := parser.ParseURLWithContext(url, ctx) // New feed, err := parser.ParseURL(context.Background(), url, nil)
Testing
All existing tests have been updated and are passing. The API is ready for use, though some ParseOptions fields are not yet implemented.
Closes #244