feat: create MusicBrainz client and data models
Add internal/musicbrainz/ package with: - client.go: MusicBrainzClient struct wrapping net/http.Client with channel-based rate limiter (1 req/sec), doGet method with proper User-Agent header, and Close for cleanup - model.go: ReleaseGroup, Artist, ExternalRelease, and Parsed* structs - XML parsing functions for release-group list and artist responses - Comprehensive tests: XML parsing (success, empty, malformed), client constructor, doGet (success, non-200, unreachable server), rate limiter behavior
This commit is contained in:
@@ -47,13 +47,13 @@ Implement a MusicBrainz API provider with strict 1 request/second rate limiting,
|
||||
## Implementation Steps
|
||||
|
||||
### Task 1: Create MusicBrainz client and data models
|
||||
- [ ] create `internal/musicbrainz/client.go` with MusicBrainzClient struct wrapping net/http.Client
|
||||
- [ ] implement constructor taking config and rate limiter
|
||||
- [ ] create `internal/musicbrainz/model.go` with structs for MusicBrainz API responses (ReleaseGroup, Artist, etc.)
|
||||
- [ ] implement XML parsing functions for MusicBrainz responses
|
||||
- [ ] write tests for XML parsing (success + error cases)
|
||||
- [ ] write tests for client constructor and basic API call structure
|
||||
- [ ] run tests - must pass before next task
|
||||
- [x] create `internal/musicbrainz/client.go` with MusicBrainzClient struct wrapping net/http.Client
|
||||
- [x] implement constructor taking config and rate limiter
|
||||
- [x] create `internal/musicbrainz/model.go` with structs for MusicBrainz API responses (ReleaseGroup, Artist, etc.)
|
||||
- [x] implement XML parsing functions for MusicBrainz responses
|
||||
- [x] write tests for XML parsing (success + error cases)
|
||||
- [x] write tests for client constructor and basic API call structure
|
||||
- [x] run tests - must pass before next task
|
||||
|
||||
### Task 2: Implement rate limiting and caching layer
|
||||
- [ ] add golang.org/x/time/rate dependency to go.mod
|
||||
|
||||
Reference in New Issue
Block a user