19 lines
471 B
Dart
19 lines
471 B
Dart
|
|
/// 앨범 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();
|
||
|
|
}
|