-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstationapi.proto
More file actions
364 lines (315 loc) · 10.1 KB
/
stationapi.proto
File metadata and controls
364 lines (315 loc) · 10.1 KB
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
syntax = "proto3";
package app.trainlcd.grpc;
service StationAPI {
rpc GetStationById(GetStationByIdRequest) returns (SingleStationResponse) {}
rpc GetStationByIdList(GetStationByIdListRequest)
returns (MultipleStationResponse) {}
rpc GetStationsByGroupId(GetStationByGroupIdRequest)
returns (MultipleStationResponse) {}
rpc GetStationsByCoordinates(GetStationByCoordinatesRequest)
returns (MultipleStationResponse) {}
rpc GetStationsByLineId(GetStationByLineIdRequest)
returns (MultipleStationResponse) {}
rpc GetStationsByLineIdList(GetStationByLineIdListRequest)
returns (MultipleStationResponse) {}
rpc GetStationsByName(GetStationsByNameRequest)
returns (MultipleStationResponse) {}
rpc GetStationsByLineGroupId(GetStationsByLineGroupIdRequest)
returns (MultipleStationResponse) {}
rpc GetStationsByLineGroupIdList(GetStationsByLineGroupIdListRequest)
returns (MultipleStationResponse) {}
rpc GetTrainTypesByStationId(GetTrainTypesByStationIdRequest)
returns (MultipleTrainTypeResponse) {}
rpc GetRoutes(GetRouteRequest) returns (RouteResponse) {}
rpc GetRoutesMinimal(GetRouteRequest) returns (RouteMinimalResponse) {}
rpc GetLineById(GetLineByIdRequest) returns (SingleLineResponse) {}
rpc GetLinesByIdList(GetLinesByIdListRequest) returns (MultipleLineResponse) {}
rpc GetLinesByName(GetLinesByNameRequest) returns (MultipleLineResponse) {}
rpc GetConnectedRoutes(GetConnectedStationsRequest) returns (RouteResponse) {}
rpc GetRouteTypes(GetRouteRequest) returns (RouteTypeResponse) {}
}
message GetStationByIdRequest {
uint32 id = 1;
optional TransportType transport_type = 2; // Unspecified = rail only (default)
}
message GetStationByIdListRequest {
repeated uint32 ids = 1;
optional TransportType transport_type = 2; // Unspecified = rail only (default)
}
message GetStationByGroupIdRequest {
uint32 group_id = 1;
optional TransportType transport_type = 2; // Filter by transport type. Unspecified = rail only (default)
}
message GetStationByCoordinatesRequest {
double latitude = 1;
double longitude = 2;
optional uint32 limit = 3;
optional TransportType transport_type = 4; // Filter by transport type. Unspecified = rail only (default)
}
message GetStationByLineIdRequest {
uint32 line_id = 1;
optional uint32 station_id = 2;
optional uint32 direction_id = 3; // Direction: 0 = default order, 1 or 2 = reverse order
optional TransportType transport_type = 4; // Unspecified = rail only (default)
}
message GetStationByLineIdListRequest {
repeated uint32 line_ids = 1;
optional TransportType transport_type = 2;
}
message GetStationsByNameRequest {
string station_name = 1;
optional uint32 limit = 2;
optional uint32 from_station_group_id = 3;
optional TransportType transport_type = 4; // Filter by transport type. Unspecified = rail only (default)
}
message GetRouteRequest {
uint32 from_station_group_id = 1;
uint32 to_station_group_id = 2;
uint32 page_size = 3;
string page_token = 4;
optional uint32 via_line_id = 5;
}
message GetStationsByLineGroupIdRequest {
uint32 line_group_id = 1;
optional TransportType transport_type = 2; // Unspecified = rail only (default)
optional uint32 direction_id = 3; // Direction: 0 = default order, 1 or 2 = reverse order
}
message GetStationsByLineGroupIdListRequest {
repeated uint32 line_group_ids = 1;
optional TransportType transport_type = 2;
}
message GetTrainTypesByStationIdRequest { uint32 station_id = 1; }
message GetLineByIdRequest { uint32 line_id = 1; }
message GetLinesByIdListRequest { repeated uint32 line_ids = 1; }
message CoordinatesRequest {
double latitude = 1;
double longitude = 2;
optional uint32 line_id = 3;
}
message GetLinesByNameRequest {
string line_name = 1;
optional uint32 limit = 2;
}
message GetConnectedStationsRequest {
uint32 from_station_group_id = 1;
uint32 to_station_group_id = 2;
}
enum OperationStatus {
InOperation = 0;
NotOpened = 1;
Closed = 2;
}
// Transport type for filtering rail/bus
enum TransportType {
TransportTypeUnspecified = 0; // Default: rail only
Rail = 1; // Rail only (stations)
Bus = 2; // Bus only (bus stops)
RailAndBus = 3; // Rail + nearby bus stops
}
message StationNumber {
string line_symbol = 1;
string line_symbol_color = 2;
string line_symbol_shape = 3;
string station_number = 4;
}
enum TtsAlphabet {
TTS_ALPHABET_UNSPECIFIED = 0;
TTS_ALPHABET_IPA = 1;
TTS_ALPHABET_YOMIGANA = 2;
TTS_ALPHABET_PLAIN = 3;
}
// TTS用の1セグメント。`lang` は "en-US" や "ja-JP" のような BCP-47 言語タグで、
// `surface` / `fallback_text` / `pronunciation` をクライアントがどの言語として
// 解釈するかを示す。`separator` はこのセグメントの後ろにだけ付与する接尾区切りで、
// 次のセグメントとの間に挿入し、セグメント列の末尾では無視する。
message TtsSegment {
string surface = 1;
string fallback_text = 2;
string pronunciation = 3;
TtsAlphabet alphabet = 4;
string lang = 5;
string separator = 6;
}
enum StopCondition {
All = 0;
Not = 1;
Partial = 2;
Weekday = 3;
Holiday = 4;
PartialStop = 5;
}
enum TrainDirection {
Both = 0;
Inbound = 1;
Outbound = 2;
}
enum TrainTypeKind {
Default = 0;
Branch = 1;
Rapid = 2;
Express = 3;
LimitedExpress = 4;
HighSpeedRapid = 5;
}
message TrainType {
uint32 id = 1;
uint32 type_id = 2;
uint32 group_id = 3;
string name = 4;
string name_katakana = 5;
optional string name_roman = 6;
optional string name_chinese = 7;
optional string name_korean = 8;
string color = 9;
repeated Line lines = 10;
optional Line line = 11;
TrainDirection direction = 12;
TrainTypeKind kind = 13;
optional string name_ipa = 14; // TTS用カタカナ名のIPA転写
optional string name_roman_ipa = 15; // TTS用英語名のIPA転写
repeated TtsSegment name_tts_segments = 16; // TTS用読みセグメント
}
message Station {
uint32 id = 1;
uint32 group_id = 2;
string name = 3;
string name_katakana = 4;
optional string name_roman = 5;
optional string name_chinese = 6;
optional string name_korean = 7;
optional string three_letter_code = 8;
repeated Line lines = 9;
optional Line line = 10;
uint32 prefecture_id = 11;
string postal_code = 12;
string address = 13;
double latitude = 14;
double longitude = 15;
string opened_at = 16;
string closed_at = 17;
OperationStatus status = 18;
repeated StationNumber station_numbers = 19;
StopCondition stop_condition = 20;
optional double distance = 21;
optional bool has_train_types = 22;
optional TrainType train_type = 23;
TransportType transport_type = 24; // Rail or Bus
optional string name_ipa = 25; // TTS用カタカナ名のIPA転写
optional string name_roman_ipa = 26; // TTS用英語名のIPA転写
repeated TtsSegment name_tts_segments = 27; // TTS用読みセグメント
}
message SingleStationResponse { Station station = 1; }
message MultipleStationResponse { repeated Station stations = 1; }
message MultipleTrainTypeResponse { repeated TrainType train_types = 1; }
message SingleLineResponse { Line line = 1; }
message MultipleLineResponse { repeated Line lines = 1; }
enum DistanceResponseState {
Away = 0;
Arrived = 1;
Approaching = 2;
}
message DistanceResponse {
uint32 station_id = 1;
double distance = 2;
DistanceResponseState state = 3;
}
message RouteResponse {
repeated Route routes = 1;
string next_page_token = 2;
}
message RouteTypeResponse {
repeated TrainType train_types = 1;
string next_page_token = 2;
}
enum LineType {
OtherLineType = 0;
BulletTrain = 1;
Normal = 2;
Subway = 3;
Tram = 4;
MonorailOrAGT = 5;
}
message LineSymbol {
string symbol = 1;
string color = 2;
string shape = 3;
}
enum CompanyType {
OtherCompany = 0;
JR = 1;
Private = 2;
Major = 3;
SemiMajor = 4;
}
message Company {
uint32 id = 1;
uint32 railroad_id = 2;
string name_short = 3;
string name_katakana = 4;
string name_full = 5;
string name_english_short = 6;
string name_english_full = 7;
optional string url = 8;
CompanyType type = 9;
OperationStatus status = 10;
string name = 11;
}
message Line {
uint32 id = 1;
string name_short = 2;
string name_katakana = 3;
string name_full = 4;
optional string name_roman = 5;
optional string name_chinese = 6;
optional string name_korean = 7;
string color = 8;
LineType line_type = 9;
repeated LineSymbol line_symbols = 10;
OperationStatus status = 11;
optional Station station = 12;
optional Company company = 13;
optional TrainType train_type = 14; // 同一種別のリクエストの場合出力する
double average_distance = 15;
TransportType transport_type = 16; // Rail or Bus
optional string name_ipa = 17; // TTS用カタカナ名のIPA転写
optional string name_roman_ipa = 18; // TTS用英語名のIPA転写
repeated TtsSegment name_tts_segments = 19; // TTS用読みセグメント
}
message SingleLine { Line line = 1; }
message MultipleLine { repeated Line lines = 1; }
message Route {
uint32 id = 1;
repeated Station stops = 2;
}
// Minimal message definitions for optimized GetRoutesMinimal RPC
message StationMinimal {
uint32 id = 1;
uint32 group_id = 2;
string name = 3;
string name_katakana = 4;
optional string name_roman = 5;
repeated uint32 line_ids = 6; // IDs only, not full Line objects
repeated StationNumber station_numbers = 7;
StopCondition stop_condition = 8;
optional bool has_train_types = 9;
optional uint32 train_type_id = 10; // ID only to avoid circular reference
optional string name_ipa = 11; // TTS用カタカナ名のIPA転写
optional string name_roman_ipa = 12; // TTS用英語名のIPA転写
repeated TtsSegment name_tts_segments = 13; // TTS用読みセグメント
}
message LineMinimal {
uint32 id = 1;
string name_short = 2;
string color = 3;
LineType line_type = 4;
repeated LineSymbol line_symbols = 5;
}
message RouteMinimal {
uint32 id = 1;
repeated StationMinimal stops = 2;
}
message RouteMinimalResponse {
repeated RouteMinimal routes = 1;
repeated LineMinimal lines = 2; // Normalized line data (deduplicated)
string next_page_token = 3;
}