-
Notifications
You must be signed in to change notification settings - Fork 6
/
public.proto
1208 lines (1088 loc) · 39.6 KB
/
public.proto
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
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
Public API
The Transiter public API is based around hierarchal resources, like many REST APIs.
This is the resource hierarchy:
```
System
|- Agency
|- Alert
|- Feed
| |- Feed update
|- Route
| |- Trip
| |- Vehicle with no ID
|- Stop
|- Transfer
|- Vehicle with ID
```
For each resource there is a proto message type, a list endpoint, and a get endpoints.
For stops, the message is [Stop](#stop), the list endpoint is [ListStops], and the get endpoint is [GetStop].
The URLs in the HTTP API are determined by the hierarchy; thus:
- List all systems has URL `/systems`,
- Get system with ID `<system_id>` has URL `/systems/<system_id>`,
- List all routes in the system has URL `/systems/<system_id>/routes`,
- Get route has URL `/systems/<system_id>/routes/<route_id>`,
and so on.
Many resources refer to other resources across the hierarchy.
For example, each route has an agency it is attached to.
Each stop has a list of service maps, each of which contains a set of routes.
In these situations the resource message contains a _reference_ to the other resource.
The [Route](#route) message contains an agency reference, in the form of an [Agency.Reference](#agencyreference)
message.
These reference messages contain at least enough information to uniquely identify the resource.
However they also contain additional information that is considered generally useful;
thus, the [Stop.Reference](#stopreference) message contains the stop's name.
What counts as "considered generally" is obviously very subjective and open to change.
The following table summarizes all of the resources and their types.
The right-most column describes the source_of the resource.
The public API is a read-only API so all of the resources come from somewhere else.
| Resource | Reference type | List endpoint | Get endpoint | Source |
| ----------- | --------------- | ---------- | ------------------ | -------|
| [Agency](#agency) | [Agency.Reference](#agencyreference) | [GetAgency] | [ListAgency] | GTFS static
| Alert | System | [Alert] | [Alert.Reference] | GTFS realtime
| Feed | System | | | system config
| Feed update | Feed | | | Transiter update process
| Route | System | | | GTFS static
| Trip | Route | | | GTFS realtime
| Stop | System | | | GTFS static
| System | None | | | system config
| Transfer | System | | | GTFS static
| Vehicle | System or trip | | | GTFS realtime
*/
syntax = "proto3";
import "google/api/annotations.proto";
option go_package = "github.com/jamespfennell/transiter/api";
service Public {
// API entrypoint
//
// `GET /`
//
// Provides basic information about this Transiter instance and the Transit systems it contains.
rpc Entrypoint(EntrypointRequest) returns (EntrypointReply) {
option (google.api.http) = {
get: "/"
};
}
// List systems
//
// `GET /systems`
//
// List all transit systems that are installed in this Transiter instance.
rpc ListSystems(ListSystemsRequest) returns (ListSystemsReply) {
option (google.api.http) = {
get: "/systems"
};
}
// Get system
//
// `GET /systems/<system_id>`
//
// Get a system by its ID.
rpc GetSystem(GetSystemRequest) returns (System) {
option (google.api.http) = {
get: "/systems/{system_id}"
};
}
// List agencies
//
// `GET /systems/<system_id>/agencies`
//
// List all agencies in a system.
rpc ListAgencies(ListAgenciesRequest) returns (ListAgenciesReply) {
option (google.api.http) = {
get: "/systems/{system_id}/agencies"
};
}
// Get agency
//
// `GET /systems/<system_id>/agencies/<agency_id>`
//
// Get an agency in a system by its ID.
rpc GetAgency(GetAgencyRequest) returns (Agency) {
option (google.api.http) = {
get: "/systems/{system_id}/agencies/{agency_id}"
};
}
// List stops
//
// `GET /systems/<system_id>/stops`
//
// List all stops in a system.
//
// This endpoint is paginated.
// If there are more results, the `next_id` field of the response will be populated.
// To get more results, make the same request with the `first_id` field set to the value of `next_id` in the response.
rpc ListStops(ListStopsRequest) returns (ListStopsReply) {
option (google.api.http) = {
get: "/systems/{system_id}/stops"
};
}
// Get stop
//
// `GET /systems/<system_id>/stops/<stop_id>`
//
// Get a stop in a system by its ID.
rpc GetStop(GetStopRequest) returns (Stop) {
option (google.api.http) = {
get: "/systems/{system_id}/stops/{stop_id}"
};
}
// List routes
//
// `GET /systems/<system_id>/routes`
//
// List all routes in a system.
rpc ListRoutes(ListRoutesRequest) returns (ListRoutesReply) {
option (google.api.http) = {
get: "/systems/{system_id}/routes"
};
}
// Get route
//
// `GET /systems/<system_id>/routes/<route_id>`
//
// Get a route in a system by its ID.
rpc GetRoute(GetRouteRequest) returns (Route) {
option (google.api.http) = {
get: "/systems/{system_id}/routes/{route_id}"
};
}
// List trips
//
// `GET /systems/<system_id>/routes/<route_id>/trips`
//
// List all trips in a route.
rpc ListTrips(ListTripsRequest) returns (ListTripsReply) {
option (google.api.http) = {
get: "/systems/{system_id}/routes/{route_id}/trips"
};
}
// Get trip
//
// `GET /systems/<system_id>/routes/<route_id>/trips/<trip_id>`
//
// Get a trip by its ID.
rpc GetTrip(GetTripRequest) returns (Trip) {
option (google.api.http) = {
get: "/systems/{system_id}/routes/{route_id}/trips/{trip_id}"
};
}
// List alerts
//
// `GET /systems/<system_id>/alerts`
//
// List all alerts in a system.
// By default this endpoint returns both active alerts
// (alerts which have an active period containing the current time) and non-active alerts.
rpc ListAlerts(ListAlertsRequest) returns (ListAlertsReply) {
option (google.api.http) = {
get: "/systems/{system_id}/alerts"
};
}
// Get alert
//
// `GET /systems/<system_id>/alerts/<alert_id>`
//
// Get an alert by its ID.
rpc GetAlert(GetAlertRequest) returns (Alert) {
option (google.api.http) = {
get: "/systems/{system_id}/alerts/{alert_id}"
};
}
// List transfers
//
// `GET /systems/<system_id>/transfers`
//
// List all transfers in a system.
rpc ListTransfers(ListTransfersRequest) returns (ListTransfersReply) {
option (google.api.http) = {
get: "/systems/{system_id}/transfers"
};
}
// List feeds
//
// `GET /systems/<system_id>/feeds`
//
// List all feeds for a system.
rpc ListFeeds(ListFeedsRequest) returns (ListFeedsReply) {
option (google.api.http) = {
get: "/systems/{system_id}/feeds"
};
}
// Get feed
//
// `GET /systems/<system_id>/feeds/<feed_id>`
//
// Get a feed in a system by its ID.
rpc GetFeed(GetFeedRequest) returns (Feed) {
option (google.api.http) = {
get: "/systems/{system_id}/feeds/{feed_id}"
};
}
// List feed updates
//
// `GET /systems/<system_id>/feeds/<feed_id>/updates`
//
// List feeds updates for a feed.
rpc ListFeedUpdates(ListFeedUpdatesRequest) returns (ListFeedUpdatesReply) {
option (google.api.http) = {
get: "/systems/{system_id}/feeds/{feed_id}/updates"
};
}
}
// Request payload for the entrypoint endpoint.
message EntrypointRequest {}
// Response payload for the entrypoint endpoint.
message EntrypointReply {
// Message containing version information about a Transiter binary.
message TransiterDetails {
// The version of the Transiter binary this instance is running.
string version = 1;
// URL of the Transiter GitHub respository.
string href = 2;
// Message containing information about a specific Transiter CI build.
message Build {
// The GitHub build number.
string number = 3;
// Time the binary was built, in the form of a human readable string.
string built_at = 4;
// Time the binary was built, in the form of a Unix timestamp.
string built_at_timestamp = 5;
// Hash of the Git commit that the binary was built at.
string git_commit_hash = 6;
// URL of the GitHub actions CI run.
string href = 7;
}
// Information about the CI build invocation that built this Transiter binary.
optional Build build = 3;
}
// Version and other information about this Transiter binary.
TransiterDetails transiter = 1;
// Systems that are installed in this Transiter instance.
ChildResources systems = 2;
}
// Request payload for the list systems endpoint.
message ListSystemsRequest {}
// Response payload for the list systems endpoint.
message ListSystemsReply {
// List of systems.
repeated System systems = 1;
}
// Request payload for the get system endpoint.
message GetSystemRequest {
// ID of the system to get.
//
// This is a URL parameter in the HTTP API.
string system_id = 1;
}
// Request payload for the list agencies endpoint.
message ListAgenciesRequest {
// ID of the system for which to list agencies.
//
// This is a URL parameter in the HTTP API.
string system_id = 1;
}
// Response payload for the list agencies endpoint.
message ListAgenciesReply {
// List of agencies.
repeated Agency agencies = 1;
}
// Request payload for the get agency endpoint.
message GetAgencyRequest {
// ID of the system the agency is in.
//
// This is a URL parameter in the HTTP API.
string system_id = 1;
// ID of the agency.
//
// This is a URL parameter in the HTTP API.
string agency_id = 2;
}
// Request payload for the list stops endpoint.
message ListStopsRequest {
// ID of the system for which to list stops.
//
// This is a URL parameter in the HTTP API.
string system_id = 1;
// The possible search modes when listing stops.
enum SearchMode {
// Return a paginated list of stops sorted by stop ID.
ID = 0;
// Return all stops within max_distance of (latitude, longitude), sorted by the distance.
DISTANCE = 1;
}
// The type of search to perform when listing stops.
optional SearchMode search_mode = 13;
// If true, only return stops whose IDs are specified in the repeated `id` field.
// Only supported when the search mode is ID.
bool only_return_specified_ids = 8;
// IDs to return if `only_return_specified_ids` is set to true. It is an error to
// populate this field if `only_return_specified_ids` is false.
// Only supported when the search mode is ID.
repeated string id = 9;
// ID of the first stop to return. If not set, the stop with the smallest ID will be first.
// Only supported when the search mode is ID.
optional string first_id = 2;
// Maximum number of stops to return.
// This is supported in all search modes.
// For performance reasons, if it is larger than 100 it is rounded down to 100.
optional int32 limit = 3;
// If true, the stop times field will not be populated.
// This will generally make the response faster to generate.
bool skip_stop_times = 4;
// If true, the service maps field will not be populated.
// This will generally make the response faster to generate.
bool skip_service_maps = 5;
// If true, the alerts field will not be populated.
// This will generally make the response faster to generate.
bool skip_alerts = 6;
// If true, the transfers field will not be populated.
// This will generally make the response faster to generate.
bool skip_transfers = 7;
// The maximum distance in kilometers that a stop must be from
// latitude, longitude to be listed when using DISTANCE search mode.
optional double max_distance = 10;
// The latitude relative to the returned stops when using DISTANCE search mode.
optional double latitude = 11;
// The longitude relative to the returned stops when using DISTANCE search mode.
optional double longitude = 12;
}
// Response payload for the list stops endpoint.
message ListStopsReply {
// List of stops.
repeated Stop stops = 1;
// ID of the next stop to return, if there are more results.
optional string next_id = 2;
}
// Reqeust payload for the get stop endpoint.
message GetStopRequest {
// ID of the system the stop is in.
//
// This is a URL parameter in the HTTP API.
string system_id = 1;
// ID of the stop.
//
// This is a URL parameter in the HTTP API.
string stop_id = 2;
// If true, the stop times field will not be populated.
// This will generally make the response faster to generate.
bool skip_stop_times = 4;
// If true, the service maps field will not be populated.
// This will generally make the response faster to generate.
bool skip_service_maps = 5;
// If true, the alerts field will not be populated.
// This will generally make the response faster to generate.
bool skip_alerts = 6;
// If true, the transfers field will not be populated.
// This will generally make the response faster to generate.
bool skip_transfers = 7;
}
// Request payload for the list routes endpoint.
message ListRoutesRequest {
// ID of the system for which to list routes.
//
// This is a URL parameter in the HTTP API.
string system_id = 1;
// If true, the estimated headway fields will not be populated.
// This will generally make the response faster to generate.
bool skip_estimated_headways = 2;
// If true, the service maps field will not be populated.
// This will generally make the response faster to generate.
bool skip_service_maps = 3;
// If true, the alerts field will not be populated.
// This will generally make the response faster to generate.
bool skip_alerts = 4;
}
// Response payload for the list routes endpoint.
message ListRoutesReply {
// List of routes.
repeated Route routes = 1;
}
// Request payload for the get route endpoint.
message GetRouteRequest {
// ID of the system the route is in.
//
// This is a URL parameter in the HTTP API.
string system_id = 1;
// ID of the route.
//
// This is a URL parameter in the HTTP API.
string route_id = 2;
// If true, the estimated headway field will not be populated.
// This will generally make the response faster to generate.
bool skip_estimated_headways = 3;
// If true, the service maps field will not be populated.
// This will generally make the response faster to generate.
bool skip_service_maps = 4;
// If true, the alerts field will not be populated.
// This will generally make the response faster to generate.
bool skip_alerts = 5;
}
// Request payload for the list trips endpoint.
message ListTripsRequest {
// ID of the system the route is in.
//
// This is a URL parameter in the HTTP API.
string system_id = 1;
// ID of the route for which to list trips
//
// This is a URL parameter in the HTTP API.
string route_id = 2;
}
// Response payload for the list trips endpoint.
message ListTripsReply {
// List of trips.
repeated Trip trips = 1;
}
// Request payload for the list alerts endpoint.
message ListAlertsRequest {
// ID of the system for which to list alerts.
//
// This is a URL parameter in the HTTP API.
string system_id = 1;
// If non-empty, only alerts with the provided IDs are returned.
// This is interpreted as a filtering condition, so it is not an error to provide non-existent IDs.
//
// If empty, all alerts in the system are returned.
// TODO: add a boolean filter_on_alert_ids field
repeated string alert_id = 2;
}
// Response payload for the list alerts endpoiont.
message ListAlertsReply {
// List of alerts.
repeated Alert alerts = 1;
}
// Request payload for the get alert endpoint.
message GetAlertRequest {
// ID of the system the alert is in.
//
// This is a URL parameter in the HTTP API.
string system_id = 1;
// ID of the alert.
//
// This is a URL parameter in the HTTP API.
string alert_id = 2;
}
// Request payload for the get trip endpoint.
message GetTripRequest {
// ID of the system the trip is in.
//
// This is a URL parameter in the HTTP API.
string system_id = 1;
// ID of the route the trip is in.
//
// This is a URL parameter in the HTTP API.
string route_id = 2;
// ID of the route.
//
// This is a URL parameter in the HTTP API.
string trip_id = 3;
}
// Request payload for the list feeds endpoint.
message ListFeedsRequest {
// ID of the system for which to list feeds.
string system_id = 1;
}
// Response payload for the list feeds endpoint.
message ListFeedsReply {
// List of feeds.
repeated Feed feeds = 1;
}
// Request payload for the list feed updates endpoint.
message ListFeedUpdatesRequest {
// ID of the system the feed is in.
//
// This is a URL parameter in the HTTP API.
string system_id = 1;
// ID of the feed for which to list updates.
//
// This is a URL parameter in the HTTP API.
string feed_id = 2;
}
// Response payload for the list feed updates endpoint.
message ListFeedUpdatesReply {
// List of updates.
repeated FeedUpdate updates = 1;
}
// Request payload for the get feed endpoint.
message GetFeedRequest {
// ID of the system the feed is in.
//
// This is a URL parameter in the HTTP API.
string system_id = 1;
// ID of the feed.
//
// This is a URL parameter in the HTTP API.
string feed_id = 2;
}
// Request payload for the list transfers endpoint.
message ListTransfersRequest {
// ID of the system for which to list transfers.
string system_id = 1;
}
// Response payload for the list transfers endpoint.
message ListTransfersReply {
// List of transfers.
repeated Transfer transfers = 1;
}
// The System resource.
message System {
// ID of the system as specified in the install request.
string id = 1;
// Generic metadata about the system resource.
Resource resource = 2;
// Name of the system as specified in the system configuration file.
string name = 4;
// Enum describing the possible statuses of a system.
enum Status {
// Unknown status, included for protobuf reasons.
UNKNOWN = 0;
// The system is currently being installed through an asychronous install request.
INSTALLING = 1;
// The system was successfully installed and is now active.
ACTIVE = 2;
// The system was added through an asynchronous install request, but the install failed.
INSTALL_FAILED = 3;
// The system is currently being updated through an asynchronous update request.
UPDATING = 4;
// An asynchronous update of the system failed.
UPDATE_FAILED = 5;
// The system is in the process of being deleted through an asynchronous delete request.
DELETING = 6;
}
// Status of the system.
Status status = 5;
ChildResources agencies = 6;
ChildResources feeds = 7;
ChildResources routes = 8;
ChildResources stops = 9;
ChildResources transfers = 10;
// Reference is the reference type for the system resource.
message Reference {
string id = 1;
Resource resource = 2;
}
}
// The resource message contains generic metadata that applies to all resources.
message Resource {
string path = 1;
optional string href = 2;
}
// Description of a collection of child resources for a resource.
// This message and fields using this message exist to support API discoverability.
message ChildResources {
// Number of child resources.
int64 count = 1;
// URL of the endpoint to list child resources.
optional string href = 2;
}
// The Stop resource.
//
// This resource corresponds to the [stop type in the GTFS static
// specification](https://developers.google.com/transit/gtfs/reference#stopstxt).
// Most of the static fields in the resource come directly from the `stops.txt` table.
// Transiter adds some additional related fields (transfers, alerts, stop times)
// and computed fields (service maps).
message Stop {
// ID of the stop. This is the `stop_id` column in `stops.txt`.
string id = 1;
// Generic metadata about the stop resource.
Resource resource = 2;
// System corresponding to this stop.
// This is the parent resource in Transiter's resource hierarchy.
System.Reference system = 3;
// Code of the stop. This is the `stop_code` column in `stops.txt`.
optional string code = 4;
// Name of the stop. This is the `stop_name` column in `stops.txt`.
optional string name = 5;
// Description of the stop. This is the `stop_desc` column in `stops.txt`.
optional string description = 6;
// Zone ID of the stop. This is the `zone_id` column in `stops.txt`.
optional string zone_id = 7;
// Latitude of the stop. This is the `stop_lat` column in `stops.txt`.
optional double latitude = 8;
// Longitude of the stop. This is the `stop_lon` column in `stops.txt`.
optional double longitude = 9;
// URL of a webpage about the stop. This is the `stop_url` column in `stops.txt`.
optional string url = 10;
// Enum describing the possible stop types
enum Type {
STOP = 0;
STATION = 1;
ENTRANCE_OR_EXIT = 2;
GENERIC_NODE = 3;
BOARDING_AREA = 4;
}
// Type of the stop. This is the `platform_type` column in `stops.txt`.
Type type = 11;
// Parent stop. This is determined using the `parent_station` column in `stops.txt`.
optional Stop.Reference parent_stop = 12;
// Child stops. This are determined using the `parent_station` column in `stops.txt`.
repeated Stop.Reference child_stops = 13;
// Timezone of the stop. This is the `stop_timezone` column in `stops.txt`.
optional string timezone = 14;
// If there is wheelchair boarding for this stop. This is the `wheelchair_boarding` column in `stops.txt`.
optional bool wheelchair_boarding = 15;
// Platform code of the stop. This is the `platform_code` column in `stops.txt`.
optional string platform_code = 16;
// Message describing the service maps view in stops.
//
// See the service maps documentation for more information on this
// message and the associated field.
message ServiceMap {
// Config ID of the service map, as specified in the system configuration file.
string config_id = 1;
// List of routes which call at this stop.
//
// This list may be empty, in which case the stop has no service in the service map.
repeated Route.Reference routes = 2;
}
// List of service maps for this stop.
repeated ServiceMap service_maps = 17;
// Active alerts for this stop.
//
// These are determined using the `informed_entity` field in
// the [GTFS realtime alerts
// message](https://developers.google.com/transit/gtfs-realtime/reference#message-alert).
repeated Alert.Reference alerts = 18;
// List of realtime stop times for this stop.
//
// A stop time is an event at which a trip calls at a stop.
repeated StopTime stop_times = 19;
// Transfers out of this stop.
//
// These are determined using the `from_stop_id` field in the GTFS static `transfers.txt` file.
repeated Transfer transfers = 20;
// Message describing a headsign rule.
message HeadsignRule {
// Stop the rule is for.
Stop.Reference stop = 1;
// Priority of the rule (lower is higher priority).
int32 priority = 2;
// NYCT track.
optional string track = 3;
// Headsign.
string headsign = 4;
}
// List of headsign rules for this stop.
repeated HeadsignRule headsign_rules = 21;
// Reference is the reference type for the stop resource.
message Reference {
string id = 1;
Resource resource = 2;
System.Reference system = 3;
optional string name = 4;
}
}
// Message describing a realtime stop time.
//
// A stop time is an event in which a trip calls at a stop.
// This message corresponds to the [GTFS realtime `StopTimeUpdate`
// message](https://developers.google.com/transit/gtfs-realtime/reference#message-stoptimeupdate)
message StopTime {
// The stop.
Stop.Reference stop = 1;
// The trip.
Trip.Reference trip = 2;
// Message describing the arrival or departure time of a stop time.
// This corresponds to the [GTFS realtime `StopTimeEvent`
// message](https://developers.google.com/transit/gtfs-realtime/reference#message-stoptimeevent).
message EstimatedTime {
optional int64 time = 1;
optional int32 delay = 2;
optional int32 uncertainty = 3;
}
// Arrival time.
EstimatedTime arrival = 3;
// Departure time.
EstimatedTime departure = 4;
// If this stop time is in the future.
// This field is *not* based on the arrival or departure time.
// Instead, a stop time is considered in the future if it appeared in the most recent
// GTFS realtime feed for its trip.
// When this stop time disappears from the trip, Transiter marks it as past and freezes
// its data.
bool future = 5;
// Stop sequence.
int32 stop_sequence = 6;
// Headsign.
optional string headsign = 7;
// Track, from the NYCT realtime extension.
optional string track = 8;
}
message Trip {
string id = 1;
// Generic metadata about the trip resource.
Resource resource = 2;
// Route corresponding to this trip.
// This is the parent resource in Transiter's resource hierarchy.
// It is determined using the `route_id` field in the GTFS realtime feed.
Route.Reference route = 3;
optional int64 started_at = 4;
optional Vehicle.Reference vehicle = 5;
bool direction_id = 6;
repeated StopTime stop_times = 7;
// Reference is the reference type for the trip resource.
message Reference {
string id = 1;
Resource resource = 2;
Route.Reference route = 3;
Stop.Reference destination = 4;
optional Vehicle.Reference vehicle = 5;
}
}
message Vehicle {
// Reference is the reference type for the vehicle resource.
message Reference {
string id = 1;
}
}
// The Route resource.
//
// This resource corresponds to the [route type in the GTFS static
// specification](https://developers.google.com/transit/gtfs/reference#routestxt).
// Most of the fields in the resource come directly from the `routes.txt` table.
// Transiter adds some additional related fields (agency, alerts)
// and computed fields (estimated headway, service maps).
message Route {
// ID of the route. This is the `route_id` column in `routes.txt`.
string id = 1;
// Generic metadata about the route resource.
Resource resource = 2;
// System corresponding to this route.
// This is the parent resource in Transiter's resource hierarchy.
System.Reference system = 3;
// Short name of the route. This is the `route_short_name` column in `routes.txt`.
optional string short_name = 4;
// Long name of the route. This is the `route_long_name` column in `routes.txt`.
optional string long_name = 5;
// Color of the route. This is the `route_color` column in `routes.txt`.
string color = 6;
// Text color of the route. This is the `route_text_color` column in `routes.txt`.
string text_color = 7;
// Description of the route. This is the `route_desc` column in `routes.txt`.
optional string description = 8;
// URL of a web page about the route. This is the `route_url` column in `routes.txt`.
optional string url = 9;
// Sort order of the route. This is the `route_sort_order` column in `routes.txt`.
optional int32 sort_order = 10;
// Enum describing possible policies for continuous pickup or drop-off.
enum ContinuousPolicy {
// Continuous pickup or drop-off allowed.
ALLOWED = 0;
// Continuous pickup or drop-off not allowed.
NOT_ALLOWED = 1;
// Must phone the agency to arrange continuous pickup or drop-off.
PHONE_AGENCY = 2;
// Must coordinate with driver to arrange continuous pickup or drop-off.
COORDINATE_WITH_DRIVER = 3;
}
// Continuous pickup policy. This is the `continuous_pickup` column in `routes.txt`.
ContinuousPolicy continuous_pickup = 11;
// Continuous dropoff policy. This is the `continuous_dropoff` column in `routes.txt`.
ContinuousPolicy continuous_drop_off = 12;
// Enum describing possible route types.
// This corresponds to possible values of the `route_type` column in `routes.txt`.
enum Type {
LIGHT_RAIL = 0;
SUBWAY = 1;
RAIL = 2;
BUS = 3;
FERRY = 4;
CABLE_TRAM = 5;
AERIAL_LIFT = 6;
FUNICULAR = 7;
TROLLEY_BUS = 11;
MONORAIL = 12;
UNKNOWN = 100;
}
// Type of the route. This is the `route_type` column in `routes.txt`.
Type type = 13;
// Agency this route is associated to.
//
// This is determined using the `agency_id` column in `routes.txt`.
Agency.Reference agency = 14;
// Active alerts for this route.
//
// These are determined using the `informed_entity` field in
// the [GTFS realtime alerts
// message](https://developers.google.com/transit/gtfs-realtime/reference#message-alert).
repeated Alert.Reference alerts = 15;
// An estimate of the interval of time between consecutive realtime trips, in seconds.
//
// If there is insufficient data to compute an estimate, the field will be empty.
//
// The estimate is computed as follows.
// For each stop that has realtime trips for the route,
// the list of arrival times for those trips is examined.
// The difference between consecutive arrival times is calculated.
// If there are `N` trips, there will be `N-1` such arrival time diffs.
// The estimated headway is the average of these diffs across
// all stops.
optional int32 estimated_headway = 16;
// Message describing the service maps view in routes.
//
// See the service maps documentation for more information on this
// message and the associated field.
message ServiceMap {
// Config ID of the service map, as specified in the system configuration file.
string config_id = 1;
// Ordered list of stop at which this route calls.
//
// This list may be empty, in which case the route has no service in the service map.
repeated Stop.Reference stops = 2;
}
// List of service maps for this route.
repeated ServiceMap service_maps = 17;
// Reference is the reference type for the route resource.
message Reference {
string id = 1;
Resource resource = 2;
System.Reference system = 3;
string color = 4;
}
}
// The feed resource.
//
// Each feed is defined in the system configuration file.
// Feeds are included in the public API because there are non-admin use-cases for this resource.
// For example, an app might publish the staleness of realtime data
// by checking for the last succesful feed update.
//
// More detailed information on a feed -- its full configuration, and the
// current status of its periodic updates -- can be retrieved through the admin API.
message Feed {
// ID of the feed, as specified in the system configuration file.
string id = 1;
// Generic metadata about the feed resource.
Resource resource = 2;
// System corresponding to this feed.
// This is the parent resource in Transiter's resource hierarchy.
System.Reference system = 3;
// Updates for this feed.
ChildResources updates = 4;
// Reference is the reference type for the feed resource.
message Reference {
string id = 1;
Resource resource = 2;
System.Reference system = 3;
}
}
// The Agency resource.
//
// This resource corresponds to the [agency type in the GTFS static
// specification](https://developers.google.com/transit/gtfs/reference#agencytxt).
// Most of the fields in the resource come directly from the `agency.txt` table.
// Transiter adds some additional related fields (alerts).
message Agency {
// ID of the agency. This is the `agency_id` column in `agency.txt`.
string id = 1;
// Generic metadata about the agency resource.
Resource resource = 2;
// System corresponding to this agency.
// This is the parent resource in Transiter's resource hierarchy.
System.Reference system = 3;
// Name of the agency. This is the `agency_name` column in `agency.txt`.
string name = 4;
// URL of the agency. This is the `agency_url` column in `agency.txt`.
string url = 5;
// Timezone of the agency. This is the `agency_timezone` column in `agency.txt`.
string timezone = 6;
// Language of the agency. This is the `agency_lang` column in `agency.txt`.
optional string language = 7;
// Phone number of the agency. This is the `agency_phone` column in `agency.txt`.
optional string phone = 8;
// URL where tickets for the agency's services ban be bought.
// This is the `agency_fare_url` column in `agency.txt`.