Files
Bose-SoundTouch/pkg/client
Tobias Gesellchen aca141ecc2 feat: Add comprehensive navigation and station management functionality
Implements the complete /navigate, /searchStation, /addStation, and /removeStation
API endpoints with full client support, models, tests, and documentation.

This resolves GitHub issue #14 by enabling direct radio station and custom
stream playback without requiring preset storage first.

## New Features

### Content Navigation
- Browse content sources (TuneIn, Pandora, Spotify, stored music)
- Navigate directory structures in music libraries
- Paginated browsing with configurable page sizes
- Menu-based navigation for services like Pandora

### Station Search & Discovery
- Search across music services for stations, artists, songs
- Service-specific search methods for TuneIn, Pandora, Spotify
- Smart result categorization (songs vs artists vs stations)
- Rich metadata including artwork and descriptions

### Station Management
- Add stations to collections with immediate playback
- Remove stations from user collections
- Token-based operations for discovered content
- WebSocket event generation for real-time updates

## Implementation Details

### New Client Methods
- Navigate(), NavigateWithMenu(), NavigateContainer()
- SearchStation(), SearchTuneInStations(), SearchPandoraStations(), SearchSpotifyContent()
- AddStation(), RemoveStation()
- GetTuneInStations(), GetPandoraStations(), GetStoredMusicLibrary()

### New Models (pkg/models/navigation.go)
- NavigateRequest/Response with helper methods
- SearchStationRequest/Response with result filtering
- AddStationRequest, RemoveStationRequest, StationResponse
- Rich helper methods for type detection and display formatting

### Enhanced HTTP Client
- Added postWithResponse() method for POST requests with XML response parsing
- Proper error handling with API error response parsing
- XML marshaling/unmarshaling for all new request/response types

## Testing

### Comprehensive Test Suite
- Unit tests for all client methods (navigation_test.go)
- XML validation tests (navigation_xml_test.go)
- Integration tests for real devices (navigation_integration_test.go)
- Example workflows (navigation_examples_test.go)
- Complete model tests (navigation_test.go)
- Edge case and error handling tests

### Test Coverage
- ~50 new test cases across different categories
- 100% coverage of new navigation methods
- XML protocol compliance verification
- Performance benchmarking capabilities
- Integration testing ready for real devices

## Documentation

### User-Focused Guide (docs/NAVIGATION-GUIDE.md)
- Complete usage examples from basic to advanced
- Real-world workflows (discover → search → add → play)
- Error handling patterns and best practices
- Service-specific guidance (TuneIn vs Pandora vs Spotify)
- Performance optimization tips

### Technical Reference (docs/API-NAVIGATION-REFERENCE.md)
- Complete API method documentation
- Model specifications with helper methods
- HTTP endpoint mapping with XML examples
- Error codes and troubleshooting guide
- XML schema definitions

### Updated README.md
- Added navigation to API coverage
- Updated documentation links
- Enhanced feature list

## API Endpoints Implemented

- POST /navigate - Browse content sources
- POST /searchStation - Search for stations and content
- POST /addStation - Add station and immediately play
- POST /removeStation - Remove station from collection

## Breaking Changes
None - all additions are backwards compatible.

## Usage Examples

This implementation enables the complete workflow requested in issue #14:
direct radio station and custom stream playback without preset dependencies.
2026-01-31 00:43:57 +01:00
..