- Refactor SnFilePool using freezed + sealed for consistency with other Sn models - Add extension method listFromResponse for PoolService compatibility - Update PoolService and utils to use SnFilePool - Replace relative imports (../) with package imports for clarity and maintainability Signed-off-by: Texas0295 <kimura@texas0295.top>
20 lines
444 B
Dart
20 lines
444 B
Dart
import 'package:dio/dio.dart';
|
|
|
|
import 'package:island/models/file_pool.dart';
|
|
|
|
class PoolService {
|
|
final Dio _dio;
|
|
|
|
PoolService(this._dio);
|
|
|
|
Future<List<SnFilePool>> fetchPools() async {
|
|
final response = await _dio.get('/drive/pools');
|
|
|
|
if (response.statusCode == 200) {
|
|
return SnFilePoolList.listFromResponse(response.data);
|
|
} else {
|
|
throw Exception('Failed to fetch pools: ${response.statusCode}');
|
|
}
|
|
}
|
|
}
|