aurcache/frontend/lib/api/builds.dart

28 lines
793 B
Dart
Raw Normal View History

import '../models/build.dart';
2023-12-29 17:13:51 +00:00
import 'api_client.dart';
extension BuildsAPI on ApiClient {
Future<List<Build>> listAllBuilds() async {
final resp = await getRawClient().get("/builds");
final responseObject = resp.data as List;
final List<Build> packages =
responseObject.map((e) => Build.fromJson(e)).toList(growable: false);
2023-12-29 17:13:51 +00:00
return packages;
}
2023-12-30 15:46:13 +00:00
Future<Build> getBuild(int id) async {
final resp = await getRawClient().get("/builds/${id}");
return Build.fromJson(resp.data);
}
Future<String> getOutput({int? line, required int buildID}) async {
String uri = "/builds/output?buildid=$buildID";
if (line != null) {
uri += "&startline=$line";
}
final resp = await getRawClient().get(uri);
return resp.data.toString();
}
2023-12-29 17:13:51 +00:00
}