Added emergency remote breakers
This commit is contained in:
@ -2,10 +2,12 @@ import 'dart:convert';
|
||||
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../messageApi.dart';
|
||||
import '../../mhslApi.dart';
|
||||
import 'getMessagesResponse.dart';
|
||||
|
||||
class GetMessages extends MessageApi<GetMessagesResponse> {
|
||||
class GetMessages extends MhslApi<GetMessagesResponse> {
|
||||
GetMessages() : super("message/messages.json");
|
||||
|
||||
|
||||
@override
|
||||
GetMessagesResponse assemble(String raw) {
|
||||
|
@ -1,24 +0,0 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:http/http.dart' as http;
|
||||
import '../../apiError.dart';
|
||||
import '../../apiRequest.dart';
|
||||
|
||||
abstract class MessageApi<T> extends ApiRequest {
|
||||
String path = "https://mhsl.eu/marianum/marianummobile/message/messages.json";
|
||||
http.Response? response;
|
||||
|
||||
Future<http.Response>? request(Uri uri);
|
||||
T assemble(String raw);
|
||||
|
||||
Future<T> run() async {
|
||||
Uri endpoint = Uri.parse(path);
|
||||
|
||||
http.Response? data = await request(endpoint);
|
||||
if(data == null) {
|
||||
throw ApiError("Request could not be dispatched!");
|
||||
}
|
||||
|
||||
return assemble(utf8.decode(data.bodyBytes));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user