fromis_9/app/lib/services/albums_service.dart

19 lines
471 B
Dart
Raw Normal View History

/// 앨범 API 서비스
library;
import '../models/album.dart';
import 'api_client.dart';
/// 앨범 목록 조회
Future<List<Album>> getAlbums() async {
final response = await dio.get('/albums');
final List<dynamic> data = response.data;
return data.map((json) => Album.fromJson(json)).toList();
}
/// 최신 앨범 N개 조회
Future<List<Album>> getRecentAlbums(int count) async {
final albums = await getAlbums();
return albums.take(count).toList();
}