-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.graphql
98 lines (87 loc) · 4.3 KB
/
schema.graphql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
scalar EvaNumber # response type: string (The station name)
scalar DateTime # response type: string (ISO-FORMAT DateTime)
scalar List # ',' seperated string values
scalar Since # e.g. '1y' (1 year) or '4m' (4 months) or '1w' (1 week) or '12d' (12 days)
type Autocomplete {
guess: String! # this means the autocompleted guess like "München"
type: String! # the type of the guess: train_vehicle, train_trip or guess
train_type: String! # the type of the train, e.g. ICE or IC
}
type MostStation {
count: Int!
station: EvaNumber!
}
type MostTrainVehicle {
count: Int!
train_vehicle: TrainVehicle!
}
type TrainStop {
cancelled: Boolean!
station: EvaNumber!
# scheduled_departure & departure OR/AND scheduled_arrival & arrival will be not null
scheduled_departure: DateTime
departure: DateTime
departure_delay: Int # in minutes
scheduled_arrival: DateTime
arrival: DateTime
arrival_delay: Int # in minutes
}
type TrainTrip {
train_number: String!
train_type: String!
origin_station: EvaNumber
destination_station: EvaNumber
initial_departure: DateTime! # The scheduled departure at the first stop: The combination of number, type and initial_departure is unique
bahn_expert: String # A generated link to https://bahn.expert
stops: [TrainStop!]!
train_vehicles: [TrainVehicle!]! # the train vehicles that will be driven on this trip (list because a trip can be driven by 2 ICE's)
coach_links(identificationNumber: String): [CoachLink!]!
# get some information about all train trips with this train type and number
train_trips_information: TrainTripsInformation!
}
type TrainTripsInformation {
average_delay(since: Since): Float! # default since 1 month; output in minutes
most_train_vehicles(limit: Int): [MostTrainVehicle]!
}
type CoachSequence {
timestamp: DateTime! # timestamp at which the coach sequence was found
coaches: [Coach!]!
train_vehicle: TrainVehicle! # the assigned train_vehicle of the coach_sequence
}
type Coach {
index: Int # index or (length - index - 1) (the first coach of a 10 coaches long coach_sequence has the index 0 or 9)
class: Int! # first, second or third class (third class means LOK i think)
type: String! # e.g. Bpmz
uic: String! # there are unique uic numbers for every coach
category: String! # e.g. STEUERWAGENERSTEKLASSE
coach_sequence: CoachSequence
coach_links(identification_number: String, limit: Int): [CoachLink!]!
}
type CoachLink {
trip: TrainTrip!
coach: Coach!
identification_number: String # coach number
}
type TrainVehicle {
building_series: String # e.g. 401
building_series_name: String # e.g. ICE 1 Modernisiert (BR401)
train_vehicle_name: String
train_vehicle_number: Int!
train_type(get_raw_type: Boolean): String! # e.g. ICE or IC ; get_raw_type=true means the type will not be IC but ICD or ICK
timestamp: DateTime! # the timestamp at which the train vehicle was found
trips(limit: Int, ignore_finished_trips: Boolean, min_trips: Int): [TrainTrip!]! # min_trips is relevant if you are using ignore_finished_trips to set the minimum of returned trips (also finished trips)
coach_sequences(limit: Int): [CoachSequence!]! # there are multiple coach_sequences (the first one is the current and the other ones are the old), use limit 1 (default value) to get only the current
most_stations(limit: Int): [MostStation!]! # get a list of stations where the train vehicle is at the most time
average_delay(since: Since): Float! # default since 1 month; output in minutes
}
type Query {
# q could be the vehicle number or name, train_type is ICE by default
train_vehicle(q: String!, train_type: String): TrainVehicle
# get the train trips by a number & train_type (ICE by default), use limit=1 to get the current train trip (today)
train_trip(train_number: Int!, train_type: String, limit: Int, initial_departure: DateTime): [TrainTrip!]!
# get information abot multiple trains
train_trips_information(train_number: Int!, train_type: String): TrainTripsInformation!
coach(uic: String!, limit: Int): [Coach!]!
# autcomplete train vehicles, train trips and coach uic numbers, you can configure the search types (train_trip,train_vehicle,coach)
autocomplete(q: String!, types: List): [Autocomplete!]!
}