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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
import options
export types
import json
import asynchttpserver
type
CommonData* = object
lines*: JsonNode
remarks*: seq[Remark]
operators*: seq[Operator]
points*: seq[Point]
polylines*: seq[Polyline]
dateStr*: string
timestamp*: int64
HafasStopParams* = object
aTimeS*: Option[string]
aPlatfS*: Option[string]
aTZOffset*: Option[int]
aCncl*: Option[bool]
aTimeR*: Option[string]
aPlatfR*: Option[string]
dTimeS*: Option[string]
dPlatfS*: Option[string]
dTZOffset*: Option[int]
dCncl*: Option[bool]
dTimeR*: Option[string]
dPlatfR*: Option[string]
locX*: Option[int]
HafasProdCtx* = object
name*: string
num*: string
catOut*: Option[string]
catOutL*: string
lineId*: Option[string]
HafasProd* = object
name*: string
cls*: int
icoX*: int
nameS*: Option[string]
addName*: Option[string]
opX*: Option[int]
prodCtx*: HafasProdCtx
HafasLocRef* = object
ppIdx*: int
locX*: int
HafasPolyline* = object
crdEncYX*: string
ppLocRefL*: Option[seq[HafasLocRef]]
Stop* = object
id*: string
name*: string
location*: Location
products*: Products
station*: Option[Station]
Station* = object
id*: int
name*: string
location*: Location
products*: Products
Location* = object
latitude*: float
longitude*: float
name*: Option[string]
address*: Option[string]
id*: Option[string]
Product* = enum
nationalExp, national, regionalExp, regional, suburban, bus, ferry, subway, tram, taxi
Mode* = enum
Train, Bus, Watercraft, Taxi, Walking
Products* = object
nationalExp*: bool
national*: bool
regionalExp*: bool
regional*: bool
suburban*: bool
bus*: bool
ferry*: bool
subway*: bool
tram*: bool
taxi*: bool
Point* = object
stop*: Option[Stop]
location*: Option[Location]
Journey* = object
refreshToken*: string
lastUpdated*: int64
legs*: seq[Leg]
cycle*: Option[Cycle]
price*: Option[Price]
LegPart* = object
point*: Point
plannedTime*: int64
prognosedTime*: Option[int64]
plannedPlatform*: Option[string]
prognosedPlatform*: Option[string]
Leg* = object
isWalking*: bool
isTransfer*: bool
cancelled*: bool
departure*: LegPart
arrival*: LegPart
polyline*: Option[Polyline]
distance*: Option[int] # required for isWalking or isTransfer
tripId*: Option[string] # required for not isWalking and not isTranfer
line*: Option[Line] # required for not isWalking and not isTranfer
direction*: Option[string] # required for not isWalking and not isTranfer
cycle*: Option[Cycle]
stopovers*: Option[seq[Stopover]]
remarks*: Option[seq[Remark]]
Line* = object
id*: string
name*: string
mode*: Mode
product*: Product
tripNum*: string
productName*: string
fullProductName*: string
operator*: Option[Operator]
additionalName*: Option[string]
trainType*: Option[string]
trainTypeShort*: Option[string]
Operator* = object
id*: string
name*: string
Cycle* = object
min*: Option[int]
max*: Option[int]
nr*: Option[int]
# TODO: Make this unnecessary :3
Price* = object
amount*: float
currency*: Option[string]
StopoverPart* = object
plannedTime*: Option[int64]
prognosedTime*: Option[int64]
plannedPlatform*: Option[string]
prognosedPlatform*: Option[string]
Stopover* = object
stop*: Stop
cancelled*: bool
departure*: StopoverPart
arrival*: StopoverPart
Remark* = object
`type`*: Option[string]
code*: Option[string]
summary*: Option[string]
text*: Option[string]
tripId*: Option[string]
JourneysResponse* = object
earlierRef*: string
laterRef*: string
journeys*: seq[Journey]
Accessibility* = enum
none, partial, complete
SuggestionsParams* = object
query*: string
results*: Option[int] #default value: 10
stations*: Option[bool] #default value: true
poi*: Option[bool] #default value: true
addresses*: Option[bool] #default value: true
JourneysParams* = object
fromPoint*: Point
toPoint*: Point
viaPoint*: Option[Point] #default value: null support in hafas backend: ✅
earlierRef*: Option[string] #default value: null support in hafas backend: ✅
laterRef*: Option[string] #default value: null support in hafas backend: ✅
results*: Option[int] #default value: 5 support in hafas backend: ✅
stopovers*: Option[bool] #default value: false support in hafas backend: ✅
polylines*: Option[bool] #default value: false support in hafas backend: ✅
remarks*: Option[bool] #default value: true support in hafas backend:
bikeFriendly*: Option[bool] #default value: false support in hafas backend:
tickets*: Option[bool] #default value: false support in hafas backend: ✅
startWithWalking*: Option[bool] #default value: true support in hafas backend: ✅
scheduledDays*: Option[bool]
accessibility*: Option[Accessibility] #default value: none support in hafas backend: ✅
transfers*: Option[int] #default value: -1 support in hafas backend: ✅
transferTime*: Option[int] #default value: 00 support in hafas backend: ✅
arrival*: Option[int64] #default value: null support in hafas backend: ✅
departure*: Option[int64] #default value: null support in hafas backend: ✅
products*: Option[Products] #default value: all true support in hafas backend: ✅
RefreshJourneyParams* = object
refreshToken*: string
stopovers*: Option[bool] #default value: false support in hafas backend: ✅
polylines*: Option[bool] #default value: false support in hafas backend: ✅
tickets*: Option[bool] #default value: false support in hafas backend: ✅
Polyline* = object
`type`*: string
features*: seq[Feature]
Feature* = object
`type`*: string
properties*: Option[Stop]
geometry*: FeatureGeometry
FeatureGeometry* = object
`type`*: string
coordinates*: seq[float]
hafasExceptionKind* = enum
SERVER_ERROR, ACCESS_DENIED, INVALID_REQUEST, NOT_FOUND
hafasException* = ref object of ValueError
code*: hafasExceptionKind
message*: string
statusCode*: HttpCode
const MODES* = [
Train, # nationalExp
Train, # national
Train, # regionalExp
Train, # regional
Train, # suburban
Bus, # bus
Watercraft, # ferry
Train, # subway
Train, # tram
Taxi, # taxi
]