|
| 1 | +import 'package:freezed_annotation/freezed_annotation.dart'; |
| 2 | + |
| 3 | +part 'contest.freezed.dart'; |
| 4 | +part 'contest.g.dart'; |
| 5 | + |
| 6 | +@freezed |
| 7 | +class Contest with _$Contest { |
| 8 | + factory Contest({ |
| 9 | + List<Ongoing>? ongoing, |
| 10 | + String? timestamp, |
| 11 | + List<Upcoming>? upcoming, |
| 12 | + }) = _Contest; |
| 13 | + |
| 14 | + factory Contest.fromJson(Map<String, dynamic> json) => |
| 15 | + _$ContestFromJson(json); |
| 16 | +} |
| 17 | + |
| 18 | +@freezed |
| 19 | +class Ongoing with _$Ongoing { |
| 20 | + factory Ongoing({ |
| 21 | + @JsonKey(name: 'EndTime') required DateTime endTime, |
| 22 | + @JsonKey(name: 'Name') required String name, |
| 23 | + @JsonKey(name: 'Platform') required String platform, |
| 24 | + required String url, |
| 25 | + @JsonKey(name: 'challenge_type') required String challengeType, |
| 26 | + }) = _Ongoing; |
| 27 | + |
| 28 | + factory Ongoing.fromJson(Map<String, dynamic> json) => |
| 29 | + _$OngoingFromJson(json); |
| 30 | +} |
| 31 | + |
| 32 | +@freezed |
| 33 | +class Upcoming with _$Upcoming { |
| 34 | + factory Upcoming({ |
| 35 | + @JsonKey(name: 'StartTime') required DateTime startTime, |
| 36 | + @JsonKey(name: 'EndTime') required DateTime endTime, |
| 37 | + @JsonKey(name: 'Name') required String name, |
| 38 | + @JsonKey(name: 'Platform') required String platform, |
| 39 | + required String url, |
| 40 | + @JsonKey(name: 'challenge_type') required String challengeType, |
| 41 | + String? duration, |
| 42 | + }) = _Upcoming; |
| 43 | + |
| 44 | + factory Upcoming.fromJson(Map<String, dynamic> json) => |
| 45 | + _$UpcomingFromJson(json); |
| 46 | +} |
0 commit comments