aurcache/frontend/lib/api/packages.dart
lukas-heiligenbrunner 600c2057fe add endpoint for general stats
load build data to graph
redesign top info tiles
place add button on header
folder restructure
2023-12-30 00:45:33 +01:00

23 lines
663 B
Dart

import '../models/package.dart';
import 'api_client.dart';
extension PackagesAPI on ApiClient {
Future<List<Package>> listPackages() async {
final resp = await getRawClient().get("/packages/list");
print(resp.data);
// todo error handling
final responseObject = resp.data as List;
final List<Package> packages =
responseObject.map((e) => Package.fromJson(e)).toList(growable: false);
return packages;
}
Future<void> addPackage({bool force = false, required String name}) async {
final resp = await getRawClient()
.post("/packages/add", data: {'force_build': force, 'name': name});
print(resp.data);
}
}