79d00ba001
Four small Dio-backed API classes mirroring the server's actual
contract (verified against internal/api/admin_*.go):
- Requests/Quarantine return flat lists; Users/Invites are enveloped
({"users": [...]}, {"invites": [...]}) and unwrap here
- setAutoApprove sends {auto_approve: bool} — different from the
response field name auto_approve_requests
- resetPassword takes admin-supplied {password: string}, returns 204
- Invite create takes optional {note: string}; expiry is server-fixed
at 24h
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
32 lines
957 B
Dart
32 lines
957 B
Dart
import 'package:dio/dio.dart';
|
|
|
|
import '../../models/admin_quarantine_item.dart';
|
|
|
|
class AdminQuarantineApi {
|
|
AdminQuarantineApi(this._dio);
|
|
final Dio _dio;
|
|
|
|
/// GET /api/admin/quarantine — flat list (no envelope) of aggregated
|
|
/// quarantine rows.
|
|
Future<List<AdminQuarantineItem>> list() async {
|
|
final r = await _dio.get<List<dynamic>>('/api/admin/quarantine');
|
|
final raw = r.data ?? const [];
|
|
return raw
|
|
.map((e) =>
|
|
AdminQuarantineItem.fromJson((e as Map).cast<String, dynamic>()))
|
|
.toList(growable: false);
|
|
}
|
|
|
|
Future<void> resolve(String trackId) async {
|
|
await _dio.post<void>('/api/admin/quarantine/$trackId/resolve');
|
|
}
|
|
|
|
Future<void> deleteFile(String trackId) async {
|
|
await _dio.post<void>('/api/admin/quarantine/$trackId/delete-file');
|
|
}
|
|
|
|
Future<void> deleteViaLidarr(String trackId) async {
|
|
await _dio.post<void>('/api/admin/quarantine/$trackId/delete-via-lidarr');
|
|
}
|
|
}
|