dart format

This commit is contained in:
2026-05-08 20:12:40 +02:00
parent 9e139b5704
commit 3b8da1d3d6
295 changed files with 6404 additions and 4161 deletions
@@ -8,7 +8,7 @@ import 'add_custom_timetable_event_params.dart';
class AddCustomTimetableEvent extends MhslApi<void> {
AddCustomTimetableEventParams params;
AddCustomTimetableEvent(this.params) : super('server/timetable/customEvents');
@override
@@ -11,6 +11,7 @@ class AddCustomTimetableEventParams {
AddCustomTimetableEventParams(this.user, this.event);
factory AddCustomTimetableEventParams.fromJson(Map<String, dynamic> json) => _$AddCustomTimetableEventParamsFromJson(json);
factory AddCustomTimetableEventParams.fromJson(Map<String, dynamic> json) =>
_$AddCustomTimetableEventParamsFromJson(json);
Map<String, dynamic> toJson() => _$AddCustomTimetableEventParamsToJson(this);
}
@@ -20,9 +20,19 @@ class CustomTimetableEvent {
@JsonKey(toJson: MhslApi.dateTimeToJson, fromJson: MhslApi.dateTimeFromJson)
DateTime updatedAt;
CustomTimetableEvent({required this.id, required this.title, required this.description, required this.startDate,
required this.endDate, required this.color, required this.rrule, required this.createdAt, required this.updatedAt});
CustomTimetableEvent({
required this.id,
required this.title,
required this.description,
required this.startDate,
required this.endDate,
required this.color,
required this.rrule,
required this.createdAt,
required this.updatedAt,
});
factory CustomTimetableEvent.fromJson(Map<String, dynamic> json) => _$CustomTimetableEventFromJson(json);
factory CustomTimetableEvent.fromJson(Map<String, dynamic> json) =>
_$CustomTimetableEventFromJson(json);
Map<String, dynamic> toJson() => _$CustomTimetableEventToJson(this);
}
@@ -9,10 +9,12 @@ import 'get_custom_timetable_event_response.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) => GetCustomTimetableEventResponse.fromJson({'events': jsonDecode(raw)});
GetCustomTimetableEventResponse assemble(String raw) =>
GetCustomTimetableEventResponse.fromJson({'events': jsonDecode(raw)});
@override
Future<Response>? request(Uri uri) => http.get(uri);
@@ -3,17 +3,18 @@ import 'get_custom_timetable_event.dart';
import 'get_custom_timetable_event_params.dart';
import 'get_custom_timetable_event_response.dart';
class GetCustomTimetableEventCache extends SimpleCache<GetCustomTimetableEventResponse> {
class GetCustomTimetableEventCache
extends SimpleCache<GetCustomTimetableEventResponse> {
GetCustomTimetableEventCache(
GetCustomTimetableEventParams params, {
super.onUpdate,
super.onError,
super.renew,
}) : super(
cacheTime: RequestCache.cacheMinute,
loader: () => GetCustomTimetableEvent(params).run(),
fromJson: GetCustomTimetableEventResponse.fromJson,
) {
cacheTime: RequestCache.cacheMinute,
loader: () => GetCustomTimetableEvent(params).run(),
fromJson: GetCustomTimetableEventResponse.fromJson,
) {
start('customTimetableEvents');
}
}
@@ -8,6 +8,7 @@ class GetCustomTimetableEventParams {
GetCustomTimetableEventParams(this.user);
factory GetCustomTimetableEventParams.fromJson(Map<String, dynamic> json) => _$GetCustomTimetableEventParamsFromJson(json);
factory GetCustomTimetableEventParams.fromJson(Map<String, dynamic> json) =>
_$GetCustomTimetableEventParamsFromJson(json);
Map<String, dynamic> toJson() => _$GetCustomTimetableEventParamsToJson(this);
}
@@ -11,6 +11,8 @@ class GetCustomTimetableEventResponse extends ApiResponse {
GetCustomTimetableEventResponse(this.events);
factory GetCustomTimetableEventResponse.fromJson(Map<String, dynamic> json) => _$GetCustomTimetableEventResponseFromJson(json);
Map<String, dynamic> toJson() => _$GetCustomTimetableEventResponseToJson(this);
factory GetCustomTimetableEventResponse.fromJson(Map<String, dynamic> json) =>
_$GetCustomTimetableEventResponseFromJson(json);
Map<String, dynamic> toJson() =>
_$GetCustomTimetableEventResponseToJson(this);
}
@@ -9,11 +9,13 @@ import 'remove_custom_timetable_event_params.dart';
class RemoveCustomTimetableEvent extends MhslApi<void> {
RemoveCustomTimetableEventParams params;
RemoveCustomTimetableEvent(this.params) : super('server/timetable/customEvents');
RemoveCustomTimetableEvent(this.params)
: super('server/timetable/customEvents');
@override
void assemble(String raw) {}
@override
Future<Response>? request(Uri uri) => http.delete(uri, body: jsonEncode(params.toJson()));
Future<Response>? request(Uri uri) =>
http.delete(uri, body: jsonEncode(params.toJson()));
}
@@ -8,6 +8,9 @@ class RemoveCustomTimetableEventParams {
RemoveCustomTimetableEventParams(this.id);
factory RemoveCustomTimetableEventParams.fromJson(Map<String, dynamic> json) => _$RemoveCustomTimetableEventParamsFromJson(json);
Map<String, dynamic> toJson() => _$RemoveCustomTimetableEventParamsToJson(this);
factory RemoveCustomTimetableEventParams.fromJson(
Map<String, dynamic> json,
) => _$RemoveCustomTimetableEventParamsFromJson(json);
Map<String, dynamic> toJson() =>
_$RemoveCustomTimetableEventParamsToJson(this);
}
@@ -9,11 +9,13 @@ import 'update_custom_timetable_event_params.dart';
class UpdateCustomTimetableEvent extends MhslApi<void> {
UpdateCustomTimetableEventParams params;
UpdateCustomTimetableEvent(this.params) : super('server/timetable/customEvents');
UpdateCustomTimetableEvent(this.params)
: super('server/timetable/customEvents');
@override
void assemble(String raw) {}
@override
Future<Response>? request(Uri uri) => http.patch(uri, body: jsonEncode(params.toJson()));
Future<Response>? request(Uri uri) =>
http.patch(uri, body: jsonEncode(params.toJson()));
}
@@ -1,4 +1,3 @@
import 'package:json_annotation/json_annotation.dart';
import '../custom_timetable_event.dart';
@@ -12,6 +11,9 @@ class UpdateCustomTimetableEventParams {
UpdateCustomTimetableEventParams(this.id, this.event);
factory UpdateCustomTimetableEventParams.fromJson(Map<String, dynamic> json) => _$UpdateCustomTimetableEventParamsFromJson(json);
Map<String, dynamic> toJson() => _$UpdateCustomTimetableEventParamsToJson(this);
factory UpdateCustomTimetableEventParams.fromJson(
Map<String, dynamic> json,
) => _$UpdateCustomTimetableEventParamsFromJson(json);
Map<String, dynamic> toJson() =>
_$UpdateCustomTimetableEventParamsToJson(this);
}