Added emergency remote breakers

This commit is contained in:
2023-08-07 22:10:56 +02:00
parent ddae68825c
commit 86c3a397da
15 changed files with 271 additions and 30 deletions

26
lib/api/mhsl/mhslApi.dart Normal file
View File

@ -0,0 +1,26 @@
import 'dart:convert';
import 'package:http/http.dart' as http;
import '../apiError.dart';
import '../apiRequest.dart';
abstract class MhslApi<T> extends ApiRequest {
String subpath;
MhslApi(this.subpath);
http.Response? response;
Future<http.Response>? request(Uri uri);
T assemble(String raw);
Future<T> run() async {
Uri endpoint = Uri.parse("https://mhsl.eu/marianum/marianummobile/$subpath");
http.Response? data = await request(endpoint);
if(data == null) {
throw ApiError("Request could not be dispatched!");
}
return assemble(utf8.decode(data.bodyBytes));
}
}