import 'package:dio/dio.dart'; import '../../models/track.dart'; /// `GET /api/radio?seed_track=&limit=`. Returns the seed /// at index 0 followed by up to `limit-1` weighted-shuffle picks /// scored by the server's recommendation engine. The shape matches /// what `playerActions.playTracks` expects, so a radio start is just /// one fetch + one playTracks call. class RadioApi { RadioApi(this._dio); final Dio _dio; Future> seedTrack(String trackId, {int? limit}) async { final r = await _dio.get>( '/api/radio', queryParameters: { 'seed_track': trackId, if (limit != null) 'limit': limit, }, ); final raw = (r.data?['tracks'] as List?) ?? const []; return raw .map((e) => TrackRef.fromJson((e as Map).cast())) .toList(growable: false); } }