-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharrivalanddeparture.go
788 lines (725 loc) · 35.1 KB
/
arrivalanddeparture.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
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package onebusaway
import (
"context"
"errors"
"fmt"
"net/http"
"net/url"
"time"
"github.com/OneBusAway/go-sdk/internal/apijson"
"github.com/OneBusAway/go-sdk/internal/apiquery"
"github.com/OneBusAway/go-sdk/internal/param"
"github.com/OneBusAway/go-sdk/internal/requestconfig"
"github.com/OneBusAway/go-sdk/option"
"github.com/OneBusAway/go-sdk/shared"
)
// ArrivalAndDepartureService contains methods and other services that help with
// interacting with the onebusaway-sdk API.
//
// Note, unlike clients, this service does not read variables from the environment
// automatically. You should not instantiate this service directly, and instead use
// the [NewArrivalAndDepartureService] method instead.
type ArrivalAndDepartureService struct {
Options []option.RequestOption
}
// NewArrivalAndDepartureService generates a new service that applies the given
// options to each request. These options are applied after the parent client's
// options (if there is one), and before any request-specific options.
func NewArrivalAndDepartureService(opts ...option.RequestOption) (r *ArrivalAndDepartureService) {
r = &ArrivalAndDepartureService{}
r.Options = opts
return
}
// arrival-and-departure-for-stop
func (r *ArrivalAndDepartureService) Get(ctx context.Context, stopID string, query ArrivalAndDepartureGetParams, opts ...option.RequestOption) (res *ArrivalAndDepartureGetResponse, err error) {
opts = append(r.Options[:], opts...)
if stopID == "" {
err = errors.New("missing required stopID parameter")
return
}
path := fmt.Sprintf("api/where/arrival-and-departure-for-stop/%s.json", stopID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
return
}
// arrivals-and-departures-for-stop
func (r *ArrivalAndDepartureService) List(ctx context.Context, stopID string, query ArrivalAndDepartureListParams, opts ...option.RequestOption) (res *ArrivalAndDepartureListResponse, err error) {
opts = append(r.Options[:], opts...)
if stopID == "" {
err = errors.New("missing required stopID parameter")
return
}
path := fmt.Sprintf("api/where/arrivals-and-departures-for-stop/%s.json", stopID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, query, &res, opts...)
return
}
type ArrivalAndDepartureGetResponse struct {
Data ArrivalAndDepartureGetResponseData `json:"data,required"`
JSON arrivalAndDepartureGetResponseJSON `json:"-"`
shared.ResponseWrapper
}
// arrivalAndDepartureGetResponseJSON contains the JSON metadata for the struct
// [ArrivalAndDepartureGetResponse]
type arrivalAndDepartureGetResponseJSON struct {
Data apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ArrivalAndDepartureGetResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r arrivalAndDepartureGetResponseJSON) RawJSON() string {
return r.raw
}
type ArrivalAndDepartureGetResponseData struct {
Entry ArrivalAndDepartureGetResponseDataEntry `json:"entry,required"`
References shared.References `json:"references,required"`
JSON arrivalAndDepartureGetResponseDataJSON `json:"-"`
}
// arrivalAndDepartureGetResponseDataJSON contains the JSON metadata for the struct
// [ArrivalAndDepartureGetResponseData]
type arrivalAndDepartureGetResponseDataJSON struct {
Entry apijson.Field
References apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ArrivalAndDepartureGetResponseData) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r arrivalAndDepartureGetResponseDataJSON) RawJSON() string {
return r.raw
}
type ArrivalAndDepartureGetResponseDataEntry struct {
// Indicates if riders can arrive on this transit vehicle.
ArrivalEnabled bool `json:"arrivalEnabled,required"`
// Index of this arrival’s trip into the sequence of trips for the active block.
BlockTripSequence int64 `json:"blockTripSequence,required"`
// Indicates if riders can depart from this transit vehicle.
DepartureEnabled bool `json:"departureEnabled,required"`
// Number of stops between the arriving transit vehicle and the current stop
// (excluding the current stop).
NumberOfStopsAway int64 `json:"numberOfStopsAway,required"`
// Predicted arrival time, in milliseconds since Unix epoch (zero if no real-time
// available).
PredictedArrivalTime int64 `json:"predictedArrivalTime,required"`
// Predicted departure time, in milliseconds since Unix epoch (zero if no real-time
// available).
PredictedDepartureTime int64 `json:"predictedDepartureTime,required"`
// The ID of the route for the arriving vehicle.
RouteID string `json:"routeId,required"`
// Scheduled arrival time, in milliseconds since Unix epoch.
ScheduledArrivalTime int64 `json:"scheduledArrivalTime,required"`
// Scheduled departure time, in milliseconds since Unix epoch.
ScheduledDepartureTime int64 `json:"scheduledDepartureTime,required"`
// Time, in milliseconds since the Unix epoch, of midnight for the start of the
// service date for the trip.
ServiceDate int64 `json:"serviceDate,required"`
// The ID of the stop the vehicle is arriving at.
StopID string `json:"stopId,required"`
// Index of the stop into the sequence of stops that make up the trip for this
// arrival.
StopSequence int64 `json:"stopSequence,required"`
// Total number of stops visited on the trip for this arrival.
TotalStopsInTrip int64 `json:"totalStopsInTrip,required"`
// Optional trip headsign that potentially overrides the trip headsign in the
// referenced trip element.
TripHeadsign string `json:"tripHeadsign,required"`
// The ID of the trip for the arriving vehicle.
TripID string `json:"tripId,required"`
// ID of the transit vehicle serving this trip.
VehicleID string `json:"vehicleId,required"`
// The actual track information of the arriving transit vehicle.
ActualTrack string `json:"actualTrack"`
// Distance of the arriving transit vehicle from the stop, in meters.
DistanceFromStop float64 `json:"distanceFromStop"`
// Information about frequency-based scheduling, if applicable to the trip.
Frequency string `json:"frequency"`
// Historical occupancy information of the transit vehicle.
HistoricalOccupancy string `json:"historicalOccupancy"`
// Timestamp of the last update time for this arrival.
LastUpdateTime int64 `json:"lastUpdateTime"`
// Current occupancy status of the transit vehicle.
OccupancyStatus string `json:"occupancyStatus"`
// Indicates if real-time arrival info is available for this trip.
Predicted bool `json:"predicted"`
// Interval for predicted arrival time, if available.
PredictedArrivalInterval string `json:"predictedArrivalInterval"`
// Interval for predicted departure time, if available.
PredictedDepartureInterval string `json:"predictedDepartureInterval"`
// Predicted occupancy status of the transit vehicle.
PredictedOccupancy string `json:"predictedOccupancy"`
// Optional route long name that potentially overrides the route long name in the
// referenced route element.
RouteLongName string `json:"routeLongName"`
// Optional route short name that potentially overrides the route short name in the
// referenced route element.
RouteShortName string `json:"routeShortName"`
// Interval for scheduled arrival time.
ScheduledArrivalInterval string `json:"scheduledArrivalInterval"`
// Interval for scheduled departure time.
ScheduledDepartureInterval string `json:"scheduledDepartureInterval"`
// Scheduled track information of the arriving transit vehicle.
ScheduledTrack string `json:"scheduledTrack"`
// References to situation elements (if any) applicable to this arrival.
SituationIDs []string `json:"situationIds"`
// Current status of the arrival.
Status string `json:"status"`
// Trip-specific status for the arriving transit vehicle.
TripStatus ArrivalAndDepartureGetResponseDataEntryTripStatus `json:"tripStatus"`
JSON arrivalAndDepartureGetResponseDataEntryJSON `json:"-"`
}
// arrivalAndDepartureGetResponseDataEntryJSON contains the JSON metadata for the
// struct [ArrivalAndDepartureGetResponseDataEntry]
type arrivalAndDepartureGetResponseDataEntryJSON struct {
ArrivalEnabled apijson.Field
BlockTripSequence apijson.Field
DepartureEnabled apijson.Field
NumberOfStopsAway apijson.Field
PredictedArrivalTime apijson.Field
PredictedDepartureTime apijson.Field
RouteID apijson.Field
ScheduledArrivalTime apijson.Field
ScheduledDepartureTime apijson.Field
ServiceDate apijson.Field
StopID apijson.Field
StopSequence apijson.Field
TotalStopsInTrip apijson.Field
TripHeadsign apijson.Field
TripID apijson.Field
VehicleID apijson.Field
ActualTrack apijson.Field
DistanceFromStop apijson.Field
Frequency apijson.Field
HistoricalOccupancy apijson.Field
LastUpdateTime apijson.Field
OccupancyStatus apijson.Field
Predicted apijson.Field
PredictedArrivalInterval apijson.Field
PredictedDepartureInterval apijson.Field
PredictedOccupancy apijson.Field
RouteLongName apijson.Field
RouteShortName apijson.Field
ScheduledArrivalInterval apijson.Field
ScheduledDepartureInterval apijson.Field
ScheduledTrack apijson.Field
SituationIDs apijson.Field
Status apijson.Field
TripStatus apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ArrivalAndDepartureGetResponseDataEntry) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r arrivalAndDepartureGetResponseDataEntryJSON) RawJSON() string {
return r.raw
}
// Trip-specific status for the arriving transit vehicle.
type ArrivalAndDepartureGetResponseDataEntryTripStatus struct {
// Trip ID of the trip the vehicle is actively serving.
ActiveTripID string `json:"activeTripId,required"`
// Index of the active trip into the sequence of trips for the active block.
BlockTripSequence int64 `json:"blockTripSequence,required"`
// ID of the closest stop to the current location of the transit vehicle.
ClosestStop string `json:"closestStop,required"`
// Distance, in meters, the transit vehicle has progressed along the active trip.
DistanceAlongTrip float64 `json:"distanceAlongTrip,required"`
// Last known distance along the trip received in real-time from the transit
// vehicle.
LastKnownDistanceAlongTrip float64 `json:"lastKnownDistanceAlongTrip,required"`
// Timestamp of the last known real-time location update from the transit vehicle.
LastLocationUpdateTime int64 `json:"lastLocationUpdateTime,required"`
// Timestamp of the last known real-time update from the transit vehicle.
LastUpdateTime int64 `json:"lastUpdateTime,required"`
// Capacity of the transit vehicle in terms of occupancy.
OccupancyCapacity int64 `json:"occupancyCapacity,required"`
// Current count of occupants in the transit vehicle.
OccupancyCount int64 `json:"occupancyCount,required"`
// Current occupancy status of the transit vehicle.
OccupancyStatus string `json:"occupancyStatus,required"`
// Current journey phase of the trip.
Phase string `json:"phase,required"`
// Indicates if real-time arrival info is available for this trip.
Predicted bool `json:"predicted,required"`
// Deviation from the schedule in seconds (positive for late, negative for early).
ScheduleDeviation int64 `json:"scheduleDeviation,required"`
// Time, in milliseconds since the Unix epoch, of midnight for the start of the
// service date for the trip.
ServiceDate int64 `json:"serviceDate,required"`
// Current status modifiers for the trip.
Status string `json:"status,required"`
// Total length of the trip, in meters.
TotalDistanceAlongTrip float64 `json:"totalDistanceAlongTrip,required"`
// Time offset from the closest stop to the current position of the transit vehicle
// (in seconds).
ClosestStopTimeOffset int64 `json:"closestStopTimeOffset"`
// Information about frequency-based scheduling, if applicable to the trip.
Frequency string `json:"frequency"`
// Last known location of the transit vehicle.
LastKnownLocation ArrivalAndDepartureGetResponseDataEntryTripStatusLastKnownLocation `json:"lastKnownLocation"`
// Last known orientation value received in real-time from the transit vehicle.
LastKnownOrientation float64 `json:"lastKnownOrientation"`
// ID of the next stop the transit vehicle is scheduled to arrive at.
NextStop string `json:"nextStop"`
// Time offset from the next stop to the current position of the transit vehicle
// (in seconds).
NextStopTimeOffset int64 `json:"nextStopTimeOffset"`
// Orientation of the transit vehicle, represented as an angle in degrees.
Orientation float64 `json:"orientation"`
// Current position of the transit vehicle.
Position ArrivalAndDepartureGetResponseDataEntryTripStatusPosition `json:"position"`
// Distance, in meters, the transit vehicle is scheduled to have progressed along
// the active trip.
ScheduledDistanceAlongTrip float64 `json:"scheduledDistanceAlongTrip"`
// References to situation elements (if any) applicable to this trip.
SituationIDs []string `json:"situationIds"`
// ID of the transit vehicle currently serving the trip.
VehicleID string `json:"vehicleId"`
JSON arrivalAndDepartureGetResponseDataEntryTripStatusJSON `json:"-"`
}
// arrivalAndDepartureGetResponseDataEntryTripStatusJSON contains the JSON metadata
// for the struct [ArrivalAndDepartureGetResponseDataEntryTripStatus]
type arrivalAndDepartureGetResponseDataEntryTripStatusJSON struct {
ActiveTripID apijson.Field
BlockTripSequence apijson.Field
ClosestStop apijson.Field
DistanceAlongTrip apijson.Field
LastKnownDistanceAlongTrip apijson.Field
LastLocationUpdateTime apijson.Field
LastUpdateTime apijson.Field
OccupancyCapacity apijson.Field
OccupancyCount apijson.Field
OccupancyStatus apijson.Field
Phase apijson.Field
Predicted apijson.Field
ScheduleDeviation apijson.Field
ServiceDate apijson.Field
Status apijson.Field
TotalDistanceAlongTrip apijson.Field
ClosestStopTimeOffset apijson.Field
Frequency apijson.Field
LastKnownLocation apijson.Field
LastKnownOrientation apijson.Field
NextStop apijson.Field
NextStopTimeOffset apijson.Field
Orientation apijson.Field
Position apijson.Field
ScheduledDistanceAlongTrip apijson.Field
SituationIDs apijson.Field
VehicleID apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ArrivalAndDepartureGetResponseDataEntryTripStatus) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r arrivalAndDepartureGetResponseDataEntryTripStatusJSON) RawJSON() string {
return r.raw
}
// Last known location of the transit vehicle.
type ArrivalAndDepartureGetResponseDataEntryTripStatusLastKnownLocation struct {
// Latitude of the last known location of the transit vehicle.
Lat float64 `json:"lat"`
// Longitude of the last known location of the transit vehicle.
Lon float64 `json:"lon"`
JSON arrivalAndDepartureGetResponseDataEntryTripStatusLastKnownLocationJSON `json:"-"`
}
// arrivalAndDepartureGetResponseDataEntryTripStatusLastKnownLocationJSON contains
// the JSON metadata for the struct
// [ArrivalAndDepartureGetResponseDataEntryTripStatusLastKnownLocation]
type arrivalAndDepartureGetResponseDataEntryTripStatusLastKnownLocationJSON struct {
Lat apijson.Field
Lon apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ArrivalAndDepartureGetResponseDataEntryTripStatusLastKnownLocation) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r arrivalAndDepartureGetResponseDataEntryTripStatusLastKnownLocationJSON) RawJSON() string {
return r.raw
}
// Current position of the transit vehicle.
type ArrivalAndDepartureGetResponseDataEntryTripStatusPosition struct {
// Latitude of the current position of the transit vehicle.
Lat float64 `json:"lat"`
// Longitude of the current position of the transit vehicle.
Lon float64 `json:"lon"`
JSON arrivalAndDepartureGetResponseDataEntryTripStatusPositionJSON `json:"-"`
}
// arrivalAndDepartureGetResponseDataEntryTripStatusPositionJSON contains the JSON
// metadata for the struct
// [ArrivalAndDepartureGetResponseDataEntryTripStatusPosition]
type arrivalAndDepartureGetResponseDataEntryTripStatusPositionJSON struct {
Lat apijson.Field
Lon apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ArrivalAndDepartureGetResponseDataEntryTripStatusPosition) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r arrivalAndDepartureGetResponseDataEntryTripStatusPositionJSON) RawJSON() string {
return r.raw
}
type ArrivalAndDepartureListResponse struct {
Data ArrivalAndDepartureListResponseData `json:"data,required"`
JSON arrivalAndDepartureListResponseJSON `json:"-"`
shared.ResponseWrapper
}
// arrivalAndDepartureListResponseJSON contains the JSON metadata for the struct
// [ArrivalAndDepartureListResponse]
type arrivalAndDepartureListResponseJSON struct {
Data apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ArrivalAndDepartureListResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r arrivalAndDepartureListResponseJSON) RawJSON() string {
return r.raw
}
type ArrivalAndDepartureListResponseData struct {
Entry ArrivalAndDepartureListResponseDataEntry `json:"entry,required"`
References shared.References `json:"references,required"`
JSON arrivalAndDepartureListResponseDataJSON `json:"-"`
}
// arrivalAndDepartureListResponseDataJSON contains the JSON metadata for the
// struct [ArrivalAndDepartureListResponseData]
type arrivalAndDepartureListResponseDataJSON struct {
Entry apijson.Field
References apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ArrivalAndDepartureListResponseData) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r arrivalAndDepartureListResponseDataJSON) RawJSON() string {
return r.raw
}
type ArrivalAndDepartureListResponseDataEntry struct {
ArrivalsAndDepartures []ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture `json:"arrivalsAndDepartures,required"`
JSON arrivalAndDepartureListResponseDataEntryJSON `json:"-"`
}
// arrivalAndDepartureListResponseDataEntryJSON contains the JSON metadata for the
// struct [ArrivalAndDepartureListResponseDataEntry]
type arrivalAndDepartureListResponseDataEntryJSON struct {
ArrivalsAndDepartures apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ArrivalAndDepartureListResponseDataEntry) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r arrivalAndDepartureListResponseDataEntryJSON) RawJSON() string {
return r.raw
}
type ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture struct {
// Indicates if riders can arrive on this transit vehicle.
ArrivalEnabled bool `json:"arrivalEnabled,required"`
// Index of this arrival’s trip into the sequence of trips for the active block.
BlockTripSequence int64 `json:"blockTripSequence,required"`
// Indicates if riders can depart from this transit vehicle.
DepartureEnabled bool `json:"departureEnabled,required"`
// Number of stops between the arriving transit vehicle and the current stop
// (excluding the current stop).
NumberOfStopsAway int64 `json:"numberOfStopsAway,required"`
// Predicted arrival time, in milliseconds since Unix epoch (zero if no real-time
// available).
PredictedArrivalTime int64 `json:"predictedArrivalTime,required"`
// Predicted departure time, in milliseconds since Unix epoch (zero if no real-time
// available).
PredictedDepartureTime int64 `json:"predictedDepartureTime,required"`
// The ID of the route for the arriving vehicle.
RouteID string `json:"routeId,required"`
// Scheduled arrival time, in milliseconds since Unix epoch.
ScheduledArrivalTime int64 `json:"scheduledArrivalTime,required"`
// Scheduled departure time, in milliseconds since Unix epoch.
ScheduledDepartureTime int64 `json:"scheduledDepartureTime,required"`
// Time, in milliseconds since the Unix epoch, of midnight for the start of the
// service date for the trip.
ServiceDate int64 `json:"serviceDate,required"`
// The ID of the stop the vehicle is arriving at.
StopID string `json:"stopId,required"`
// Index of the stop into the sequence of stops that make up the trip for this
// arrival.
StopSequence int64 `json:"stopSequence,required"`
// Total number of stops visited on the trip for this arrival.
TotalStopsInTrip int64 `json:"totalStopsInTrip,required"`
// Optional trip headsign that potentially overrides the trip headsign in the
// referenced trip element.
TripHeadsign string `json:"tripHeadsign,required"`
// The ID of the trip for the arriving vehicle.
TripID string `json:"tripId,required"`
// ID of the transit vehicle serving this trip.
VehicleID string `json:"vehicleId,required"`
// The actual track information of the arriving transit vehicle.
ActualTrack string `json:"actualTrack"`
// Distance of the arriving transit vehicle from the stop, in meters.
DistanceFromStop float64 `json:"distanceFromStop"`
// Information about frequency-based scheduling, if applicable to the trip.
Frequency string `json:"frequency"`
// Historical occupancy information of the transit vehicle.
HistoricalOccupancy string `json:"historicalOccupancy"`
// Timestamp of the last update time for this arrival.
LastUpdateTime int64 `json:"lastUpdateTime"`
// Current occupancy status of the transit vehicle.
OccupancyStatus string `json:"occupancyStatus"`
// Indicates if real-time arrival info is available for this trip.
Predicted bool `json:"predicted"`
// Interval for predicted arrival time, if available.
PredictedArrivalInterval string `json:"predictedArrivalInterval"`
// Interval for predicted departure time, if available.
PredictedDepartureInterval string `json:"predictedDepartureInterval"`
// Predicted occupancy status of the transit vehicle.
PredictedOccupancy string `json:"predictedOccupancy"`
// Optional route long name that potentially overrides the route long name in the
// referenced route element.
RouteLongName string `json:"routeLongName"`
// Optional route short name that potentially overrides the route short name in the
// referenced route element.
RouteShortName string `json:"routeShortName"`
// Interval for scheduled arrival time.
ScheduledArrivalInterval string `json:"scheduledArrivalInterval"`
// Interval for scheduled departure time.
ScheduledDepartureInterval string `json:"scheduledDepartureInterval"`
// Scheduled track information of the arriving transit vehicle.
ScheduledTrack string `json:"scheduledTrack"`
// References to situation elements (if any) applicable to this arrival.
SituationIDs []string `json:"situationIds"`
// Current status of the arrival.
Status string `json:"status"`
// Trip-specific status for the arriving transit vehicle.
TripStatus ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparturesTripStatus `json:"tripStatus"`
JSON arrivalAndDepartureListResponseDataEntryArrivalsAndDepartureJSON `json:"-"`
}
// arrivalAndDepartureListResponseDataEntryArrivalsAndDepartureJSON contains the
// JSON metadata for the struct
// [ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture]
type arrivalAndDepartureListResponseDataEntryArrivalsAndDepartureJSON struct {
ArrivalEnabled apijson.Field
BlockTripSequence apijson.Field
DepartureEnabled apijson.Field
NumberOfStopsAway apijson.Field
PredictedArrivalTime apijson.Field
PredictedDepartureTime apijson.Field
RouteID apijson.Field
ScheduledArrivalTime apijson.Field
ScheduledDepartureTime apijson.Field
ServiceDate apijson.Field
StopID apijson.Field
StopSequence apijson.Field
TotalStopsInTrip apijson.Field
TripHeadsign apijson.Field
TripID apijson.Field
VehicleID apijson.Field
ActualTrack apijson.Field
DistanceFromStop apijson.Field
Frequency apijson.Field
HistoricalOccupancy apijson.Field
LastUpdateTime apijson.Field
OccupancyStatus apijson.Field
Predicted apijson.Field
PredictedArrivalInterval apijson.Field
PredictedDepartureInterval apijson.Field
PredictedOccupancy apijson.Field
RouteLongName apijson.Field
RouteShortName apijson.Field
ScheduledArrivalInterval apijson.Field
ScheduledDepartureInterval apijson.Field
ScheduledTrack apijson.Field
SituationIDs apijson.Field
Status apijson.Field
TripStatus apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparture) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r arrivalAndDepartureListResponseDataEntryArrivalsAndDepartureJSON) RawJSON() string {
return r.raw
}
// Trip-specific status for the arriving transit vehicle.
type ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparturesTripStatus struct {
// Trip ID of the trip the vehicle is actively serving.
ActiveTripID string `json:"activeTripId,required"`
// Index of the active trip into the sequence of trips for the active block.
BlockTripSequence int64 `json:"blockTripSequence,required"`
// ID of the closest stop to the current location of the transit vehicle.
ClosestStop string `json:"closestStop,required"`
// Distance, in meters, the transit vehicle has progressed along the active trip.
DistanceAlongTrip float64 `json:"distanceAlongTrip,required"`
// Last known distance along the trip received in real-time from the transit
// vehicle.
LastKnownDistanceAlongTrip float64 `json:"lastKnownDistanceAlongTrip,required"`
// Timestamp of the last known real-time location update from the transit vehicle.
LastLocationUpdateTime int64 `json:"lastLocationUpdateTime,required"`
// Timestamp of the last known real-time update from the transit vehicle.
LastUpdateTime int64 `json:"lastUpdateTime,required"`
// Capacity of the transit vehicle in terms of occupancy.
OccupancyCapacity int64 `json:"occupancyCapacity,required"`
// Current count of occupants in the transit vehicle.
OccupancyCount int64 `json:"occupancyCount,required"`
// Current occupancy status of the transit vehicle.
OccupancyStatus string `json:"occupancyStatus,required"`
// Current journey phase of the trip.
Phase string `json:"phase,required"`
// Indicates if real-time arrival info is available for this trip.
Predicted bool `json:"predicted,required"`
// Deviation from the schedule in seconds (positive for late, negative for early).
ScheduleDeviation int64 `json:"scheduleDeviation,required"`
// Time, in milliseconds since the Unix epoch, of midnight for the start of the
// service date for the trip.
ServiceDate int64 `json:"serviceDate,required"`
// Current status modifiers for the trip.
Status string `json:"status,required"`
// Total length of the trip, in meters.
TotalDistanceAlongTrip float64 `json:"totalDistanceAlongTrip,required"`
// Time offset from the closest stop to the current position of the transit vehicle
// (in seconds).
ClosestStopTimeOffset int64 `json:"closestStopTimeOffset"`
// Information about frequency-based scheduling, if applicable to the trip.
Frequency string `json:"frequency"`
// Last known location of the transit vehicle.
LastKnownLocation ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparturesTripStatusLastKnownLocation `json:"lastKnownLocation"`
// Last known orientation value received in real-time from the transit vehicle.
LastKnownOrientation float64 `json:"lastKnownOrientation"`
// ID of the next stop the transit vehicle is scheduled to arrive at.
NextStop string `json:"nextStop"`
// Time offset from the next stop to the current position of the transit vehicle
// (in seconds).
NextStopTimeOffset int64 `json:"nextStopTimeOffset"`
// Orientation of the transit vehicle, represented as an angle in degrees.
Orientation float64 `json:"orientation"`
// Current position of the transit vehicle.
Position ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparturesTripStatusPosition `json:"position"`
// Distance, in meters, the transit vehicle is scheduled to have progressed along
// the active trip.
ScheduledDistanceAlongTrip float64 `json:"scheduledDistanceAlongTrip"`
// References to situation elements (if any) applicable to this trip.
SituationIDs []string `json:"situationIds"`
// ID of the transit vehicle currently serving the trip.
VehicleID string `json:"vehicleId"`
JSON arrivalAndDepartureListResponseDataEntryArrivalsAndDeparturesTripStatusJSON `json:"-"`
}
// arrivalAndDepartureListResponseDataEntryArrivalsAndDeparturesTripStatusJSON
// contains the JSON metadata for the struct
// [ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparturesTripStatus]
type arrivalAndDepartureListResponseDataEntryArrivalsAndDeparturesTripStatusJSON struct {
ActiveTripID apijson.Field
BlockTripSequence apijson.Field
ClosestStop apijson.Field
DistanceAlongTrip apijson.Field
LastKnownDistanceAlongTrip apijson.Field
LastLocationUpdateTime apijson.Field
LastUpdateTime apijson.Field
OccupancyCapacity apijson.Field
OccupancyCount apijson.Field
OccupancyStatus apijson.Field
Phase apijson.Field
Predicted apijson.Field
ScheduleDeviation apijson.Field
ServiceDate apijson.Field
Status apijson.Field
TotalDistanceAlongTrip apijson.Field
ClosestStopTimeOffset apijson.Field
Frequency apijson.Field
LastKnownLocation apijson.Field
LastKnownOrientation apijson.Field
NextStop apijson.Field
NextStopTimeOffset apijson.Field
Orientation apijson.Field
Position apijson.Field
ScheduledDistanceAlongTrip apijson.Field
SituationIDs apijson.Field
VehicleID apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparturesTripStatus) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r arrivalAndDepartureListResponseDataEntryArrivalsAndDeparturesTripStatusJSON) RawJSON() string {
return r.raw
}
// Last known location of the transit vehicle.
type ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparturesTripStatusLastKnownLocation struct {
// Latitude of the last known location of the transit vehicle.
Lat float64 `json:"lat"`
// Longitude of the last known location of the transit vehicle.
Lon float64 `json:"lon"`
JSON arrivalAndDepartureListResponseDataEntryArrivalsAndDeparturesTripStatusLastKnownLocationJSON `json:"-"`
}
// arrivalAndDepartureListResponseDataEntryArrivalsAndDeparturesTripStatusLastKnownLocationJSON
// contains the JSON metadata for the struct
// [ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparturesTripStatusLastKnownLocation]
type arrivalAndDepartureListResponseDataEntryArrivalsAndDeparturesTripStatusLastKnownLocationJSON struct {
Lat apijson.Field
Lon apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparturesTripStatusLastKnownLocation) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r arrivalAndDepartureListResponseDataEntryArrivalsAndDeparturesTripStatusLastKnownLocationJSON) RawJSON() string {
return r.raw
}
// Current position of the transit vehicle.
type ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparturesTripStatusPosition struct {
// Latitude of the current position of the transit vehicle.
Lat float64 `json:"lat"`
// Longitude of the current position of the transit vehicle.
Lon float64 `json:"lon"`
JSON arrivalAndDepartureListResponseDataEntryArrivalsAndDeparturesTripStatusPositionJSON `json:"-"`
}
// arrivalAndDepartureListResponseDataEntryArrivalsAndDeparturesTripStatusPositionJSON
// contains the JSON metadata for the struct
// [ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparturesTripStatusPosition]
type arrivalAndDepartureListResponseDataEntryArrivalsAndDeparturesTripStatusPositionJSON struct {
Lat apijson.Field
Lon apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ArrivalAndDepartureListResponseDataEntryArrivalsAndDeparturesTripStatusPosition) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r arrivalAndDepartureListResponseDataEntryArrivalsAndDeparturesTripStatusPositionJSON) RawJSON() string {
return r.raw
}
type ArrivalAndDepartureGetParams struct {
ServiceDate param.Field[int64] `query:"serviceDate,required"`
TripID param.Field[string] `query:"tripId,required"`
StopSequence param.Field[int64] `query:"stopSequence"`
Time param.Field[int64] `query:"time"`
VehicleID param.Field[string] `query:"vehicleId"`
}
// URLQuery serializes [ArrivalAndDepartureGetParams]'s query parameters as
// `url.Values`.
func (r ArrivalAndDepartureGetParams) URLQuery() (v url.Values) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatRepeat,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}
type ArrivalAndDepartureListParams struct {
// Include vehicles arriving or departing in the next n minutes.
MinutesAfter param.Field[int64] `query:"minutesAfter"`
// Include vehicles having arrived or departed in the previous n minutes.
MinutesBefore param.Field[int64] `query:"minutesBefore"`
// The specific time for querying the system status.
Time param.Field[time.Time] `query:"time" format:"date-time"`
}
// URLQuery serializes [ArrivalAndDepartureListParams]'s query parameters as
// `url.Values`.
func (r ArrivalAndDepartureListParams) URLQuery() (v url.Values) {
return apiquery.MarshalWithSettings(r, apiquery.QuerySettings{
ArrayFormat: apiquery.ArrayQueryFormatRepeat,
NestedFormat: apiquery.NestedQueryFormatBrackets,
})
}