Added api for custom timetable events
This commit is contained in:
@ -0,0 +1,22 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:http/http.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../../mhslApi.dart';
|
||||
import 'updateCustomTimetableEventParams.dart';
|
||||
|
||||
class UpdateCustomTimetableEvent extends MhslApi<void> {
|
||||
UpdateCustomTimetableEventParams params;
|
||||
|
||||
UpdateCustomTimetableEvent(this.params) : super('server/timetable/customEvents');
|
||||
|
||||
@override
|
||||
void assemble(String raw) {}
|
||||
|
||||
@override
|
||||
Future<Response>? request(Uri uri) {
|
||||
return http.patch(uri, body: jsonEncode(params.toJson()));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import '../customTimetableEvent.dart';
|
||||
|
||||
part 'updateCustomTimetableEventParams.g.dart';
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class UpdateCustomTimetableEventParams {
|
||||
String id;
|
||||
CustomTimetableEvent event;
|
||||
|
||||
UpdateCustomTimetableEventParams(this.id, this.event);
|
||||
|
||||
factory UpdateCustomTimetableEventParams.fromJson(Map<String, dynamic> json) => _$UpdateCustomTimetableEventParamsFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$UpdateCustomTimetableEventParamsToJson(this);
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'updateCustomTimetableEventParams.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
UpdateCustomTimetableEventParams _$UpdateCustomTimetableEventParamsFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
UpdateCustomTimetableEventParams(
|
||||
json['id'] as String,
|
||||
CustomTimetableEvent.fromJson(json['event'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$UpdateCustomTimetableEventParamsToJson(
|
||||
UpdateCustomTimetableEventParams instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'event': instance.event.toJson(),
|
||||
};
|
Reference in New Issue
Block a user