updated project linter-rules and enforced them
This commit is contained in:
@ -6,7 +6,7 @@ import '../../mhslApi.dart';
|
||||
import 'getBreakersResponse.dart';
|
||||
|
||||
class GetBreakers extends MhslApi<GetBreakersResponse> {
|
||||
GetBreakers() : super("breaker/");
|
||||
GetBreakers() : super('breaker/');
|
||||
|
||||
@override
|
||||
GetBreakersResponse assemble(String raw) {
|
||||
|
@ -6,7 +6,7 @@ import 'getBreakersResponse.dart';
|
||||
|
||||
class GetBreakersCache extends RequestCache<GetBreakersResponse> {
|
||||
GetBreakersCache({onUpdate, renew}) : super(RequestCache.cacheMinute, onUpdate, renew: renew) {
|
||||
start("MarianumMobile", "breakers");
|
||||
start('MarianumMobile', 'breakers');
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -28,9 +28,9 @@ class GetBreakersReponseObject {
|
||||
}
|
||||
|
||||
enum BreakerArea {
|
||||
@JsonValue("GLOBAL") global,
|
||||
@JsonValue("TIMETABLE") timetable,
|
||||
@JsonValue("TALK") talk,
|
||||
@JsonValue("FILES") files,
|
||||
@JsonValue("MORE") more,
|
||||
@JsonValue('GLOBAL') global,
|
||||
@JsonValue('TIMETABLE') timetable,
|
||||
@JsonValue('TALK') talk,
|
||||
@JsonValue('FILES') files,
|
||||
@JsonValue('MORE') more,
|
||||
}
|
@ -9,11 +9,11 @@ import 'getCustomTimetableEventResponse.dart';
|
||||
|
||||
class GetCustomTimetableEvent extends MhslApi<GetCustomTimetableEventResponse> {
|
||||
GetCustomTimetableEventParams params;
|
||||
GetCustomTimetableEvent(this.params) : super("server/timetable/customEvents?user=${params.user}");
|
||||
GetCustomTimetableEvent(this.params) : super('server/timetable/customEvents?user=${params.user}');
|
||||
|
||||
@override
|
||||
GetCustomTimetableEventResponse assemble(String raw) {
|
||||
return GetCustomTimetableEventResponse.fromJson({"events": jsonDecode(raw)});
|
||||
return GetCustomTimetableEventResponse.fromJson({'events': jsonDecode(raw)});
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -9,7 +9,7 @@ class GetCustomTimetableEventCache extends RequestCache<GetCustomTimetableEventR
|
||||
GetCustomTimetableEventParams params;
|
||||
|
||||
GetCustomTimetableEventCache(this.params, {onUpdate, renew}) : super(RequestCache.cacheMinute, onUpdate, renew: renew) {
|
||||
start("MarianumMobile", "customTimetableEvents");
|
||||
start('MarianumMobile', 'customTimetableEvents');
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -6,7 +6,7 @@ import '../../mhslApi.dart';
|
||||
import 'getMessagesResponse.dart';
|
||||
|
||||
class GetMessages extends MhslApi<GetMessagesResponse> {
|
||||
GetMessages() : super("message/messages.json");
|
||||
GetMessages() : super('message/messages.json');
|
||||
|
||||
|
||||
@override
|
||||
|
@ -6,7 +6,7 @@ import 'getMessagesResponse.dart';
|
||||
|
||||
class GetMessagesCache extends RequestCache<GetMessagesResponse> {
|
||||
GetMessagesCache({onUpdate, renew}) : super(RequestCache.cacheMinute, onUpdate, renew: renew) {
|
||||
start("MarianumMobile", "message");
|
||||
start('MarianumMobile', 'message');
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -15,21 +15,21 @@ abstract class MhslApi<T> extends ApiRequest {
|
||||
T assemble(String raw);
|
||||
|
||||
Future<T> run() async {
|
||||
Uri endpoint = Uri.parse("https://mhsl.eu/marianum/marianummobile/$subpath");
|
||||
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!");
|
||||
throw ApiError('Request could not be dispatched!');
|
||||
}
|
||||
|
||||
if(data.statusCode > 299) {
|
||||
throw ApiError("Non 200 Status code from mhsl services: $subpath: ${data.statusCode}");
|
||||
throw ApiError('Non 200 Status code from mhsl services: $subpath: ${data.statusCode}');
|
||||
}
|
||||
|
||||
return assemble(utf8.decode(data.bodyBytes));
|
||||
}
|
||||
|
||||
static String dateTimeToJson(DateTime time) => Jiffy.parseFromDateTime(time).format(pattern: "yyyy-MM-dd HH:mm:ss");
|
||||
static String dateTimeToJson(DateTime time) => Jiffy.parseFromDateTime(time).format(pattern: 'yyyy-MM-dd HH:mm:ss');
|
||||
static DateTime dateTimeFromJson(String time) => DateTime.parse(time);
|
||||
|
||||
}
|
@ -9,7 +9,7 @@ import 'notifyRegisterParams.dart';
|
||||
|
||||
class NotifyRegister extends MhslApi<void> {
|
||||
NotifyRegisterParams params;
|
||||
NotifyRegister(this.params) : super("notify/register/");
|
||||
NotifyRegister(this.params) : super('notify/register/');
|
||||
|
||||
|
||||
@override
|
||||
|
@ -12,7 +12,7 @@ import 'updateUserIndexParams.dart';
|
||||
|
||||
class UpdateUserIndex extends MhslApi<void> {
|
||||
UpdateUserIndexParams params;
|
||||
UpdateUserIndex(this.params) : super("server/userIndex/update");
|
||||
UpdateUserIndex(this.params) : super('server/userIndex/update');
|
||||
|
||||
@override
|
||||
void assemble(String raw) {}
|
||||
@ -20,7 +20,7 @@ class UpdateUserIndex extends MhslApi<void> {
|
||||
@override
|
||||
Future<http.Response> request(Uri uri) {
|
||||
String data = jsonEncode(params.toJson());
|
||||
log("Updating userindex:\n $data");
|
||||
log('Updating userindex:\n $data');
|
||||
return http.post(uri, body: data);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user