fdaa1a0472
Dio client for /api/quarantine — flag a track with a reason + optional notes, unflag by track id. Mirrors the server's user-scoped quarantine endpoints (separate from /admin/quarantine). Used by the track-actions menu's Hide/Unhide action in the next slice of commits. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
26 lines
855 B
Dart
26 lines
855 B
Dart
import 'package:dio/dio.dart';
|
|
|
|
/// /api/quarantine — flag a track (with reason + optional notes) and
|
|
/// unflag it. Both endpoints are user-scoped: callers can only flag
|
|
/// their own quarantine entries; admins use a separate /admin/quarantine
|
|
/// surface.
|
|
class QuarantineApi {
|
|
QuarantineApi(this._dio);
|
|
final Dio _dio;
|
|
|
|
/// POST /api/quarantine. Server returns 201 with the row.
|
|
/// Reason values: bad_rip | wrong_file | wrong_tags | duplicate | other.
|
|
Future<void> flag(String trackId, String reason, {String notes = ''}) async {
|
|
await _dio.post<void>('/api/quarantine', data: {
|
|
'track_id': trackId,
|
|
'reason': reason,
|
|
'notes': notes,
|
|
});
|
|
}
|
|
|
|
/// DELETE /api/quarantine/{track_id}. Server returns 204.
|
|
Future<void> unflag(String trackId) async {
|
|
await _dio.delete<void>('/api/quarantine/$trackId');
|
|
}
|
|
}
|