-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathobjects.go
466 lines (391 loc) · 8.83 KB
/
objects.go
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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
package oba
import (
"encoding/json"
)
type ArrivalsAndDepartures []ArrivalAndDeparture
type ArrivalAndDeparture struct {
ArrivalEnabled *bool
BlockTripSequence int
DepartureEnabled *bool
DistanceFromStop float64
Frequency *string
LastUpdateTime int
NumberOfStopsAway int
Predicted *bool
PredictedArrivalInterval int
PredictedArrivalTime int
PredictedDepartureInterval int
PredictedDepartureTime int
ScheduleDeviationHistogramID string
RouteID string
RouteLongName string
RouteShortName string
ScheduledArrivalInterval int
ScheduledArrivalTime int
ScheduledDepartureInterval int
ScheduledDepartureTime int
ServiceDate int
SituationIDs []string
Status string
StopID string
StopSequence int
TotalStopsInTrip int
TripHeadSign string
TripID string
TripStatus *TripStatus
VehicleID string
}
func (a ArrivalAndDeparture) String() string {
return jsonStringer(a)
}
type Histogram struct {
Counts []int
Labels []string
MaxCount int
Values []float64
}
func (h Histogram) String() string {
return jsonStringer(h)
}
type BlockConfiguration struct {
ActiveServiceIDs []string
InactiveServiceIDs []string
Trips []BlockTrip
}
func (b BlockConfiguration) String() string {
return jsonStringer(b)
}
type BlockStopTime struct {
AccumulatedSlackTime float64
BlockSequence int
DistanceAlongBlock float64
StopTime StopTime
}
func (b BlockStopTime) String() string {
return jsonStringer(b)
}
type BlockTrip struct {
TripID string
BlockStopTimes []BlockStopTime
}
func (b BlockTrip) String() string {
return jsonStringer(b)
}
type StopTime struct {
StopID string
ArrivalTime int
DepartureTime int
PickupType int
DropOffType int
}
func (s StopTime) String() string {
return jsonStringer(s)
}
type Frequency struct {
StartTime int
EndTime int
Headway int
}
func (f Frequency) String() string {
return jsonStringer(f)
}
type VehicleStatus struct {
VehicleID string
LastUpdateTime int
LastLocationUpdateTime int
Location Location
Phase string
Status string
Trip Trip
TripStatus TripStatus
}
func (v VehicleStatus) String() string {
return jsonStringer(v)
}
// Agency container object
type Agency struct {
Disclaimer string
Email string
FareURL string
ID string
Lang string
Name string
Phone string
PrivateService *bool
TimeZone string
URL string
}
func (a Agency) String() string {
return jsonStringer(a)
}
type Block struct {
ID string
Configurations []BlockConfiguration
}
func (b Block) String() string {
return jsonStringer(b)
}
type AgencyWithCoverage struct {
Agency Agency
Lat float64
LatSpan float64
Lon float64
LonSpan float64
}
func (a AgencyWithCoverage) String() string {
return jsonStringer(a)
}
type Coverage struct {
AgencyID string
Lat float64
LatSpan float64
Lon float64
LonSpan float64
}
func (c Coverage) String() string {
return jsonStringer(c)
}
type CurrentTime struct {
ReadableTime string
Time int
}
func (c CurrentTime) String() string {
return jsonStringer(c)
}
// Route object
type Route struct {
Agency Agency
Color string
Description string
ID string
LongName string
ShortName string
TextColor string
Type int
URL string
}
func (r Route) String() string {
return jsonStringer(r)
}
type RegisteredAlarm struct {
AlarmID string
}
func (r RegisteredAlarm) String() string {
return jsonStringer(r)
}
type Situation struct {
ID string
CreationTime string
EnvironmentReason string
Summary []string
Description []string
Affects []VehicleJourney
Consequences []Consequence
}
func (s Situation) String() string {
return jsonStringer(s)
}
type Consequence struct {
Condition string
ConditionDetailDiversionPathPoints []string
ConditionDetailDiversionStopIDs []string
}
func (c Consequence) String() string {
return jsonStringer(c)
}
type VehicleJourney struct {
LineID string
Direction string
CallStopIDs []string
}
func (v VehicleJourney) String() string {
return jsonStringer(v)
}
type Shape struct {
Points string
Length int
}
func (s Shape) String() string {
return jsonStringer(s)
}
type Stop struct {
Code string
Direction string
ID string
Lat float64
LocationType int
Lon float64
Name string
Routes []Route
WheelChairBoarding string
}
func (s Stop) String() string {
return jsonStringer(s)
}
type StopSchedule struct {
Date int
Stop Stop
StopRouteSchedules []StopRouteSchedule
TimeZone string
StopCalendarDays []StopCalendarDay
}
func (s StopSchedule) String() string {
return jsonStringer(s)
}
type StopCalendarDay struct {
Date string
Group string
}
func (s StopCalendarDay) String() string {
return jsonStringer(s)
}
type StopRouteSchedule struct {
Route Route
StopRouteDirectionSchedules []StopRouteDirectionSchedule
}
func (s StopRouteSchedule) String() string {
return jsonStringer(s)
}
type StopRouteDirectionSchedule struct {
ScheduleFrequencies []ScheduleFrequency
ScheduleStopTimes []ScheduleStopTime
TripHeadsign string
}
func (s StopRouteDirectionSchedule) String() string {
return jsonStringer(s)
}
type ScheduleFrequency struct {
*Frequency
}
func (s ScheduleFrequency) String() string {
return jsonStringer(s)
}
type StopsForRoute struct {
Route Route
Stops []Stop
StopGroupings []StopGrouping
}
func (s StopsForRoute) String() string {
return jsonStringer(s)
}
type StopGrouping struct {
Type string
Ordered *bool
StopGroups []StopGroup
}
func (s StopGrouping) String() string {
return jsonStringer(s)
}
type StopGroup struct {
ID string
Name Name
Stops []Stop
PolyLines []EncodedPolyLine
}
func (s StopGroup) String() string {
return jsonStringer(s)
}
type Name struct {
Name string
Names []string
Type string
}
func (n Name) String() string {
return jsonStringer(n)
}
type EncodedPolyLine struct {
Length int
Levels string
Points string
}
func (e EncodedPolyLine) String() string {
return jsonStringer(e)
}
type ScheduleStopTime struct {
ArrivalEnabled *bool
ArrivalTime int
DepartureEnabled *bool
DepartureTime int
ServiceID string
StopHeadsign string
TripID string
}
func (s ScheduleStopTime) String() string {
return jsonStringer(s)
}
type Trip struct {
BlockID string
DirectionID string
ID string
RouteID string
RouteShortName string
ServiceID string
ShapeID string
TimeZone string
TripHeadsign string
TripShortName string
}
func (t Trip) String() string {
return jsonStringer(t)
}
type TripDetails struct {
Trip Trip
ServiceDate int
Frequency *string
Status string
Situations []Situation
}
func (t TripDetails) String() string {
return jsonStringer(t)
}
type TripStatus struct {
ActiveTripID string
BlockTripSequence int
ClosestStop Stop
ClosestStopTimeOffset int
DistanceAlongTrip float64
Frequency *string
LastKnownDistanceAlongTrip float64
LastKnownLocation Location
LastKnownOrientation int
LastLocationUpdateTime int
LastUpdateTime int
NextStop Stop
NextStopTimeOffset int
Orientation float64
Phase string
Position Location
Predicted *bool
ScheduleDeviation int
ScheduledDistanceAlongTrip float64
ServiceDate int
SituationIDs []string
Status string
TotalDistanceAlongTrip float64
VehicleID string
}
func (t TripStatus) String() string {
return jsonStringer(t)
}
type Location struct {
Lat float64
Lon float64
}
func (l Location) String() string {
return jsonStringer(l)
}
type StopWithArrivalsAndDepartures struct {
StopID string
ArrivalsAndDepartures ArrivalsAndDepartures
NearByStopIDs []string
}
func (s StopWithArrivalsAndDepartures) String() string {
return jsonStringer(s)
}
func jsonStringer(i interface{}) string {
s, err := json.Marshal(i)
if err != nil {
panic(err)
}
return string(s)
}