import 'package:dio/dio.dart'; import '../../models/history_event.dart'; import '../../models/quarantine_mine.dart'; import '../../models/system_playlists_status.dart'; /// /api/me/* endpoints — caller-scoped data (history, profile, etc.). class MeApi { MeApi(this._dio); final Dio _dio; /// GET /api/me/history. Paginated via offset/limit; server emits /// `{events, has_more}` rather than the standard `Page` envelope. Future history({int limit = 50, int offset = 0}) async { final r = await _dio.get>( '/api/me/history', queryParameters: {'limit': limit, 'offset': offset}, ); return HistoryPage.fromJson(r.data ?? const {}); } /// GET /api/quarantine/mine — flat list (no envelope). Future> quarantineMine() async { final r = await _dio.get>('/api/quarantine/mine'); final raw = r.data ?? const []; return raw .map((e) => QuarantineMineRow.fromJson((e as Map).cast())) .toList(growable: false); } /// GET /api/me/system-playlists-status. Returns the caller's most /// recent system-playlist build state. Used by the home Playlists /// row to choose between real and placeholder cards. Future systemPlaylistsStatus() async { final r = await _dio.get>( '/api/me/system-playlists-status', ); return SystemPlaylistsStatus.fromJson(r.data ?? const {}); } }