Unofficial Dart implementation of Deutsche Bahn’s construction site API https://pub.dev/packages/db_construction_site
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
db_construction_site/lib/models/connection.dart

54 lines
1.2 KiB

import 'package:db_construction_site/models/region.dart';
import 'package:json_annotation/json_annotation.dart';
import 'connection_type.dart';
part 'connection.g.dart';
@JsonSerializable(createToJson: false)
class Connection {
final String id;
final String name;
@JsonKey(name: "von")
final String origin;
@JsonKey(name: "nach")
final String destination;
@JsonKey(name: "kbnr")
final String courseBookNumber;
@JsonKey(name: "verlauf")
final List<String> stops;
@JsonKey(name: "via")
final String via;
final DateTime timestamp;
@JsonKey(name: "verfall")
final DateTime expiryDate;
@JsonKey(name: "verbindung")
final ConnectionType type;
@JsonKey(name: "land")
final Region region;
final String url;
@JsonKey(name: "ics")
final String icsUrl;
@JsonKey(name: "doc")
final String documentUrl;
const Connection({
this.id,
this.name,
this.origin,
this.destination,
this.courseBookNumber,
this.stops,
this.via,
this.timestamp,
this.expiryDate,
this.type,
this.region,
this.url,
this.icsUrl,
this.documentUrl,
});
factory Connection.fromJson(Map<String, dynamic> json) =>
_$ConnectionFromJson(json);
}