structs_gen.go 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257
  1. package api
  2. // Code generated by go-bare/cmd/gen, DO NOT EDIT.
  3. import (
  4. "errors"
  5. "git.sr.ht/~sircmpwn/go-bare"
  6. )
  7. type LineResponseDev struct {
  8. Line LineV3 `bare:"line"`
  9. }
  10. func (t *LineResponseDev) Decode(data []byte) error {
  11. return bare.Unmarshal(data, t)
  12. }
  13. func (t *LineResponseDev) Encode() ([]byte, error) {
  14. return bare.Marshal(t)
  15. }
  16. type LineResponseV3 struct {
  17. Line LineV3 `bare:"line"`
  18. }
  19. func (t *LineResponseV3) Decode(data []byte) error {
  20. return bare.Unmarshal(data, t)
  21. }
  22. func (t *LineResponseV3) Encode() ([]byte, error) {
  23. return bare.Marshal(t)
  24. }
  25. type LineResponseV2 struct {
  26. Line LineV2 `bare:"line"`
  27. }
  28. func (t *LineResponseV2) Decode(data []byte) error {
  29. return bare.Unmarshal(data, t)
  30. }
  31. func (t *LineResponseV2) Encode() ([]byte, error) {
  32. return bare.Marshal(t)
  33. }
  34. type LineResponseV1 struct {
  35. Line LineV1 `bare:"line"`
  36. }
  37. func (t *LineResponseV1) Decode(data []byte) error {
  38. return bare.Unmarshal(data, t)
  39. }
  40. func (t *LineResponseV1) Encode() ([]byte, error) {
  41. return bare.Marshal(t)
  42. }
  43. type FeedsResponseDev struct {
  44. Feeds []FeedInfoV2 `bare:"feeds"`
  45. }
  46. func (t *FeedsResponseDev) Decode(data []byte) error {
  47. return bare.Unmarshal(data, t)
  48. }
  49. func (t *FeedsResponseDev) Encode() ([]byte, error) {
  50. return bare.Marshal(t)
  51. }
  52. type FeedsResponseV2 struct {
  53. Feeds []FeedInfoV2 `bare:"feeds"`
  54. }
  55. func (t *FeedsResponseV2) Decode(data []byte) error {
  56. return bare.Unmarshal(data, t)
  57. }
  58. func (t *FeedsResponseV2) Encode() ([]byte, error) {
  59. return bare.Marshal(t)
  60. }
  61. type FeedsResponseV1 struct {
  62. Feeds []FeedInfoV1 `bare:"feeds"`
  63. }
  64. func (t *FeedsResponseV1) Decode(data []byte) error {
  65. return bare.Unmarshal(data, t)
  66. }
  67. func (t *FeedsResponseV1) Encode() ([]byte, error) {
  68. return bare.Marshal(t)
  69. }
  70. type FeedInfoV1 struct {
  71. Name string `bare:"name"`
  72. Id string `bare:"id"`
  73. Attribution string `bare:"attribution"`
  74. Description string `bare:"description"`
  75. LastUpdate string `bare:"lastUpdate"`
  76. }
  77. func (t *FeedInfoV1) Decode(data []byte) error {
  78. return bare.Unmarshal(data, t)
  79. }
  80. func (t *FeedInfoV1) Encode() ([]byte, error) {
  81. return bare.Marshal(t)
  82. }
  83. type FeedInfoV2 struct {
  84. Name string `bare:"name"`
  85. Id string `bare:"id"`
  86. Attribution string `bare:"attribution"`
  87. Description string `bare:"description"`
  88. LastUpdate string `bare:"lastUpdate"`
  89. QrHost string `bare:"qrHost"`
  90. QrIn QRLocationV1 `bare:"qrIn"`
  91. QrSelector string `bare:"qrSelector"`
  92. ValidSince string `bare:"validSince"`
  93. ValidTill string `bare:"validTill"`
  94. }
  95. func (t *FeedInfoV2) Decode(data []byte) error {
  96. return bare.Unmarshal(data, t)
  97. }
  98. func (t *FeedInfoV2) Encode() ([]byte, error) {
  99. return bare.Marshal(t)
  100. }
  101. type QueryablesResponseDev struct {
  102. Queryables []QueryableV5 `bare:"queryables"`
  103. }
  104. func (t *QueryablesResponseDev) Decode(data []byte) error {
  105. return bare.Unmarshal(data, t)
  106. }
  107. func (t *QueryablesResponseDev) Encode() ([]byte, error) {
  108. return bare.Marshal(t)
  109. }
  110. type QueryablesResponseV4 struct {
  111. Queryables []QueryableV4 `bare:"queryables"`
  112. }
  113. func (t *QueryablesResponseV4) Decode(data []byte) error {
  114. return bare.Unmarshal(data, t)
  115. }
  116. func (t *QueryablesResponseV4) Encode() ([]byte, error) {
  117. return bare.Marshal(t)
  118. }
  119. type QueryablesResponseV3 struct {
  120. Queryables []QueryableV3 `bare:"queryables"`
  121. }
  122. func (t *QueryablesResponseV3) Decode(data []byte) error {
  123. return bare.Unmarshal(data, t)
  124. }
  125. func (t *QueryablesResponseV3) Encode() ([]byte, error) {
  126. return bare.Marshal(t)
  127. }
  128. type QueryablesResponseV2 struct {
  129. Queryables []QueryableV2 `bare:"queryables"`
  130. }
  131. func (t *QueryablesResponseV2) Decode(data []byte) error {
  132. return bare.Unmarshal(data, t)
  133. }
  134. func (t *QueryablesResponseV2) Encode() ([]byte, error) {
  135. return bare.Marshal(t)
  136. }
  137. type QueryablesResponseV1 struct {
  138. Queryables []QueryableV1 `bare:"queryables"`
  139. }
  140. func (t *QueryablesResponseV1) Decode(data []byte) error {
  141. return bare.Unmarshal(data, t)
  142. }
  143. func (t *QueryablesResponseV1) Encode() ([]byte, error) {
  144. return bare.Marshal(t)
  145. }
  146. type StopV1 struct {
  147. Code string `bare:"code"`
  148. Name string `bare:"name"`
  149. Zone string `bare:"zone"`
  150. Position PositionV1 `bare:"position"`
  151. ChangeOptions []ChangeOptionV1 `bare:"changeOptions"`
  152. }
  153. func (t *StopV1) Decode(data []byte) error {
  154. return bare.Unmarshal(data, t)
  155. }
  156. func (t *StopV1) Encode() ([]byte, error) {
  157. return bare.Marshal(t)
  158. }
  159. type StopV2 struct {
  160. Code string `bare:"code"`
  161. Name string `bare:"name"`
  162. NodeName string `bare:"nodeName"`
  163. Zone string `bare:"zone"`
  164. FeedID string `bare:"feedID"`
  165. Position PositionV1 `bare:"position"`
  166. ChangeOptions []ChangeOptionV1 `bare:"changeOptions"`
  167. }
  168. func (t *StopV2) Decode(data []byte) error {
  169. return bare.Unmarshal(data, t)
  170. }
  171. func (t *StopV2) Encode() ([]byte, error) {
  172. return bare.Marshal(t)
  173. }
  174. type StopV3 struct {
  175. Code string `bare:"code"`
  176. Name string `bare:"name"`
  177. NodeName string `bare:"nodeName"`
  178. Zone string `bare:"zone"`
  179. FeedID string `bare:"feedID"`
  180. Position PositionV1 `bare:"position"`
  181. ChangeOptions []ChangeOptionV2 `bare:"changeOptions"`
  182. }
  183. func (t *StopV3) Decode(data []byte) error {
  184. return bare.Unmarshal(data, t)
  185. }
  186. func (t *StopV3) Encode() ([]byte, error) {
  187. return bare.Marshal(t)
  188. }
  189. type LineV1 struct {
  190. Name string `bare:"name"`
  191. Colour ColourV1 `bare:"colour"`
  192. Kind LineTypeV2 `bare:"kind"`
  193. FeedID string `bare:"feedID"`
  194. Headsigns [][]string `bare:"headsigns"`
  195. Graphs []LineGraphV1 `bare:"graphs"`
  196. }
  197. func (t *LineV1) Decode(data []byte) error {
  198. return bare.Unmarshal(data, t)
  199. }
  200. func (t *LineV1) Encode() ([]byte, error) {
  201. return bare.Marshal(t)
  202. }
  203. type LineV2 struct {
  204. Name string `bare:"name"`
  205. Colour ColourV1 `bare:"colour"`
  206. Kind LineTypeV3 `bare:"kind"`
  207. FeedID string `bare:"feedID"`
  208. Headsigns [][]string `bare:"headsigns"`
  209. Graphs []LineGraphV1 `bare:"graphs"`
  210. }
  211. func (t *LineV2) Decode(data []byte) error {
  212. return bare.Unmarshal(data, t)
  213. }
  214. func (t *LineV2) Encode() ([]byte, error) {
  215. return bare.Marshal(t)
  216. }
  217. type LineV3 struct {
  218. Id string `bare:"id"`
  219. Name string `bare:"name"`
  220. Colour ColourV1 `bare:"colour"`
  221. Kind LineTypeV3 `bare:"kind"`
  222. FeedID string `bare:"feedID"`
  223. Headsigns [][]string `bare:"headsigns"`
  224. Graphs []LineGraphV1 `bare:"graphs"`
  225. }
  226. func (t *LineV3) Decode(data []byte) error {
  227. return bare.Unmarshal(data, t)
  228. }
  229. func (t *LineV3) Encode() ([]byte, error) {
  230. return bare.Marshal(t)
  231. }
  232. type LineGraphV1 struct {
  233. Stops []StopStubV1 `bare:"stops"`
  234. NextNodes map[int][]int `bare:"nextNodes"`
  235. }
  236. func (t *LineGraphV1) Decode(data []byte) error {
  237. return bare.Unmarshal(data, t)
  238. }
  239. func (t *LineGraphV1) Encode() ([]byte, error) {
  240. return bare.Marshal(t)
  241. }
  242. type StopStubV1 struct {
  243. Code string `bare:"code"`
  244. Name string `bare:"name"`
  245. NodeName string `bare:"nodeName"`
  246. Zone string `bare:"zone"`
  247. OnDemand bool `bare:"onDemand"`
  248. }
  249. func (t *StopStubV1) Decode(data []byte) error {
  250. return bare.Unmarshal(data, t)
  251. }
  252. func (t *StopStubV1) Encode() ([]byte, error) {
  253. return bare.Marshal(t)
  254. }
  255. type PositionV1 struct {
  256. Lat float64 `bare:"lat"`
  257. Lon float64 `bare:"lon"`
  258. }
  259. func (t *PositionV1) Decode(data []byte) error {
  260. return bare.Unmarshal(data, t)
  261. }
  262. func (t *PositionV1) Encode() ([]byte, error) {
  263. return bare.Marshal(t)
  264. }
  265. type ChangeOptionV1 struct {
  266. LineName string `bare:"lineName"`
  267. Headsign string `bare:"headsign"`
  268. }
  269. func (t *ChangeOptionV1) Decode(data []byte) error {
  270. return bare.Unmarshal(data, t)
  271. }
  272. func (t *ChangeOptionV1) Encode() ([]byte, error) {
  273. return bare.Marshal(t)
  274. }
  275. type ChangeOptionV2 struct {
  276. Line LineStubV1 `bare:"line"`
  277. Headsigns []string `bare:"headsigns"`
  278. }
  279. func (t *ChangeOptionV2) Decode(data []byte) error {
  280. return bare.Unmarshal(data, t)
  281. }
  282. func (t *ChangeOptionV2) Encode() ([]byte, error) {
  283. return bare.Marshal(t)
  284. }
  285. type LocatablesResponseDev struct {
  286. Locatables []LocatableV4 `bare:"locatables"`
  287. }
  288. func (t *LocatablesResponseDev) Decode(data []byte) error {
  289. return bare.Unmarshal(data, t)
  290. }
  291. func (t *LocatablesResponseDev) Encode() ([]byte, error) {
  292. return bare.Marshal(t)
  293. }
  294. type LocatablesResponseV3 struct {
  295. Locatables []LocatableV3 `bare:"locatables"`
  296. }
  297. func (t *LocatablesResponseV3) Decode(data []byte) error {
  298. return bare.Unmarshal(data, t)
  299. }
  300. func (t *LocatablesResponseV3) Encode() ([]byte, error) {
  301. return bare.Marshal(t)
  302. }
  303. type LocatablesResponseV2 struct {
  304. Locatables []LocatableV2 `bare:"locatables"`
  305. }
  306. func (t *LocatablesResponseV2) Decode(data []byte) error {
  307. return bare.Unmarshal(data, t)
  308. }
  309. func (t *LocatablesResponseV2) Encode() ([]byte, error) {
  310. return bare.Marshal(t)
  311. }
  312. type LocatablesResponseV1 struct {
  313. Locatables []LocatableV1 `bare:"locatables"`
  314. }
  315. func (t *LocatablesResponseV1) Decode(data []byte) error {
  316. return bare.Unmarshal(data, t)
  317. }
  318. func (t *LocatablesResponseV1) Encode() ([]byte, error) {
  319. return bare.Marshal(t)
  320. }
  321. type VehicleV1 struct {
  322. Id string `bare:"id"`
  323. Position PositionV1 `bare:"position"`
  324. Capabilities uint16 `bare:"capabilities"`
  325. Speed float32 `bare:"speed"`
  326. Line LineStubV1 `bare:"line"`
  327. Headsign string `bare:"headsign"`
  328. CongestionLevel CongestionLevelV1 `bare:"congestionLevel"`
  329. OccupancyStatus OccupancyStatusV1 `bare:"occupancyStatus"`
  330. }
  331. func (t *VehicleV1) Decode(data []byte) error {
  332. return bare.Unmarshal(data, t)
  333. }
  334. func (t *VehicleV1) Encode() ([]byte, error) {
  335. return bare.Marshal(t)
  336. }
  337. type VehicleV2 struct {
  338. Id string `bare:"id"`
  339. Position PositionV1 `bare:"position"`
  340. Capabilities uint16 `bare:"capabilities"`
  341. Speed float32 `bare:"speed"`
  342. Line LineStubV2 `bare:"line"`
  343. Headsign string `bare:"headsign"`
  344. CongestionLevel CongestionLevelV1 `bare:"congestionLevel"`
  345. OccupancyStatus OccupancyStatusV1 `bare:"occupancyStatus"`
  346. }
  347. func (t *VehicleV2) Decode(data []byte) error {
  348. return bare.Unmarshal(data, t)
  349. }
  350. func (t *VehicleV2) Encode() ([]byte, error) {
  351. return bare.Marshal(t)
  352. }
  353. type VehicleV3 struct {
  354. Id string `bare:"id"`
  355. Position PositionV1 `bare:"position"`
  356. Capabilities uint16 `bare:"capabilities"`
  357. Speed float32 `bare:"speed"`
  358. Line LineStubV3 `bare:"line"`
  359. Headsign string `bare:"headsign"`
  360. CongestionLevel CongestionLevelV1 `bare:"congestionLevel"`
  361. OccupancyStatus OccupancyStatusV1 `bare:"occupancyStatus"`
  362. }
  363. func (t *VehicleV3) Decode(data []byte) error {
  364. return bare.Unmarshal(data, t)
  365. }
  366. func (t *VehicleV3) Encode() ([]byte, error) {
  367. return bare.Marshal(t)
  368. }
  369. type LineStubV1 struct {
  370. Name string `bare:"name"`
  371. Kind LineTypeV1 `bare:"kind"`
  372. Colour ColourV1 `bare:"colour"`
  373. }
  374. func (t *LineStubV1) Decode(data []byte) error {
  375. return bare.Unmarshal(data, t)
  376. }
  377. func (t *LineStubV1) Encode() ([]byte, error) {
  378. return bare.Marshal(t)
  379. }
  380. type LineStubV2 struct {
  381. Name string `bare:"name"`
  382. Kind LineTypeV2 `bare:"kind"`
  383. Colour ColourV1 `bare:"colour"`
  384. }
  385. func (t *LineStubV2) Decode(data []byte) error {
  386. return bare.Unmarshal(data, t)
  387. }
  388. func (t *LineStubV2) Encode() ([]byte, error) {
  389. return bare.Marshal(t)
  390. }
  391. type LineStubV3 struct {
  392. Name string `bare:"name"`
  393. Kind LineTypeV3 `bare:"kind"`
  394. Colour ColourV1 `bare:"colour"`
  395. }
  396. func (t *LineStubV3) Decode(data []byte) error {
  397. return bare.Unmarshal(data, t)
  398. }
  399. func (t *LineStubV3) Encode() ([]byte, error) {
  400. return bare.Marshal(t)
  401. }
  402. type ColourV1 struct {
  403. R uint8 `bare:"r"`
  404. G uint8 `bare:"g"`
  405. B uint8 `bare:"b"`
  406. }
  407. func (t *ColourV1) Decode(data []byte) error {
  408. return bare.Unmarshal(data, t)
  409. }
  410. func (t *ColourV1) Encode() ([]byte, error) {
  411. return bare.Marshal(t)
  412. }
  413. type DeparturesResponseDev struct {
  414. Alerts []AlertV1 `bare:"alerts"`
  415. Departures []DepartureV5 `bare:"departures"`
  416. Stop StopV3 `bare:"stop"`
  417. }
  418. func (t *DeparturesResponseDev) Decode(data []byte) error {
  419. return bare.Unmarshal(data, t)
  420. }
  421. func (t *DeparturesResponseDev) Encode() ([]byte, error) {
  422. return bare.Marshal(t)
  423. }
  424. type DeparturesResponseV4 struct {
  425. Alerts []AlertV1 `bare:"alerts"`
  426. Departures []DepartureV4 `bare:"departures"`
  427. Stop StopV2 `bare:"stop"`
  428. }
  429. func (t *DeparturesResponseV4) Decode(data []byte) error {
  430. return bare.Unmarshal(data, t)
  431. }
  432. func (t *DeparturesResponseV4) Encode() ([]byte, error) {
  433. return bare.Marshal(t)
  434. }
  435. type DeparturesResponseV3 struct {
  436. Alerts []AlertV1 `bare:"alerts"`
  437. Departures []DepartureV3 `bare:"departures"`
  438. Stop StopV2 `bare:"stop"`
  439. }
  440. func (t *DeparturesResponseV3) Decode(data []byte) error {
  441. return bare.Unmarshal(data, t)
  442. }
  443. func (t *DeparturesResponseV3) Encode() ([]byte, error) {
  444. return bare.Marshal(t)
  445. }
  446. type DeparturesResponseV2 struct {
  447. Alerts []AlertV1 `bare:"alerts"`
  448. Departures []DepartureV2 `bare:"departures"`
  449. Stop StopV2 `bare:"stop"`
  450. }
  451. func (t *DeparturesResponseV2) Decode(data []byte) error {
  452. return bare.Unmarshal(data, t)
  453. }
  454. func (t *DeparturesResponseV2) Encode() ([]byte, error) {
  455. return bare.Marshal(t)
  456. }
  457. type DeparturesResponseV1 struct {
  458. Alerts []AlertV1 `bare:"alerts"`
  459. Departures []DepartureV1 `bare:"departures"`
  460. Stop StopV1 `bare:"stop"`
  461. }
  462. func (t *DeparturesResponseV1) Decode(data []byte) error {
  463. return bare.Unmarshal(data, t)
  464. }
  465. func (t *DeparturesResponseV1) Encode() ([]byte, error) {
  466. return bare.Marshal(t)
  467. }
  468. type AlertV1 struct {
  469. Header string `bare:"header"`
  470. Description string `bare:"description"`
  471. Url string `bare:"url"`
  472. Cause AlertCauseV1 `bare:"cause"`
  473. Effect AlertEffectV1 `bare:"effect"`
  474. }
  475. func (t *AlertV1) Decode(data []byte) error {
  476. return bare.Unmarshal(data, t)
  477. }
  478. func (t *AlertV1) Encode() ([]byte, error) {
  479. return bare.Marshal(t)
  480. }
  481. type DepartureV1 struct {
  482. Id string `bare:"id"`
  483. Time TimeV1 `bare:"time"`
  484. Status VehicleStatusV1 `bare:"status"`
  485. IsRealtime bool `bare:"isRealtime"`
  486. Vehicle VehicleV1 `bare:"vehicle"`
  487. Boarding uint8 `bare:"boarding"`
  488. }
  489. func (t *DepartureV1) Decode(data []byte) error {
  490. return bare.Unmarshal(data, t)
  491. }
  492. func (t *DepartureV1) Encode() ([]byte, error) {
  493. return bare.Marshal(t)
  494. }
  495. type DepartureV2 struct {
  496. Id string `bare:"id"`
  497. Time TimeV1 `bare:"time"`
  498. Status VehicleStatusV1 `bare:"status"`
  499. IsRealtime bool `bare:"isRealtime"`
  500. Vehicle VehicleV2 `bare:"vehicle"`
  501. Boarding uint8 `bare:"boarding"`
  502. }
  503. func (t *DepartureV2) Decode(data []byte) error {
  504. return bare.Unmarshal(data, t)
  505. }
  506. func (t *DepartureV2) Encode() ([]byte, error) {
  507. return bare.Marshal(t)
  508. }
  509. type DepartureV3 struct {
  510. Id string `bare:"id"`
  511. Time TimeV1 `bare:"time"`
  512. Status VehicleStatusV1 `bare:"status"`
  513. IsRealtime bool `bare:"isRealtime"`
  514. Vehicle VehicleV3 `bare:"vehicle"`
  515. Boarding uint8 `bare:"boarding"`
  516. }
  517. func (t *DepartureV3) Decode(data []byte) error {
  518. return bare.Unmarshal(data, t)
  519. }
  520. func (t *DepartureV3) Encode() ([]byte, error) {
  521. return bare.Marshal(t)
  522. }
  523. type DepartureV4 struct {
  524. Id string `bare:"id"`
  525. Time TimeV1 `bare:"time"`
  526. Status VehicleStatusV1 `bare:"status"`
  527. IsRealtime bool `bare:"isRealtime"`
  528. Vehicle VehicleV3 `bare:"vehicle"`
  529. Boarding uint8 `bare:"boarding"`
  530. Alerts []AlertV1 `bare:"alerts"`
  531. }
  532. func (t *DepartureV4) Decode(data []byte) error {
  533. return bare.Unmarshal(data, t)
  534. }
  535. func (t *DepartureV4) Encode() ([]byte, error) {
  536. return bare.Marshal(t)
  537. }
  538. type DepartureV5 struct {
  539. Id string `bare:"id"`
  540. Time TimeV1 `bare:"time"`
  541. Status VehicleStatusV1 `bare:"status"`
  542. IsRealtime bool `bare:"isRealtime"`
  543. Vehicle VehicleV3 `bare:"vehicle"`
  544. Boarding uint8 `bare:"boarding"`
  545. Alerts []AlertV1 `bare:"alerts"`
  546. Exact bool `bare:"exact"`
  547. Ordinality DepartureOrdinalityV1 `bare:"ordinality"`
  548. }
  549. func (t *DepartureV5) Decode(data []byte) error {
  550. return bare.Unmarshal(data, t)
  551. }
  552. func (t *DepartureV5) Encode() ([]byte, error) {
  553. return bare.Marshal(t)
  554. }
  555. type TimeV1 struct {
  556. Hour uint8 `bare:"hour"`
  557. Minute uint8 `bare:"minute"`
  558. Second uint8 `bare:"second"`
  559. DayOffset int8 `bare:"dayOffset"`
  560. Zone string `bare:"zone"`
  561. }
  562. func (t *TimeV1) Decode(data []byte) error {
  563. return bare.Unmarshal(data, t)
  564. }
  565. func (t *TimeV1) Encode() ([]byte, error) {
  566. return bare.Marshal(t)
  567. }
  568. type ErrorResponse struct {
  569. Field string `bare:"field"`
  570. Message string `bare:"message"`
  571. }
  572. func (t *ErrorResponse) Decode(data []byte) error {
  573. return bare.Unmarshal(data, t)
  574. }
  575. func (t *ErrorResponse) Encode() ([]byte, error) {
  576. return bare.Marshal(t)
  577. }
  578. type QRLocationV1 uint
  579. const (
  580. UNKNOWN QRLocationV1 = 0
  581. NONE QRLocationV1 = 1
  582. PATH QRLocationV1 = 2
  583. QUERY QRLocationV1 = 3
  584. )
  585. func (t QRLocationV1) String() string {
  586. switch t {
  587. case UNKNOWN:
  588. return "UNKNOWN"
  589. case NONE:
  590. return "NONE"
  591. case PATH:
  592. return "PATH"
  593. case QUERY:
  594. return "QUERY"
  595. }
  596. panic(errors.New("Invalid QRLocationV1 value"))
  597. }
  598. type CongestionLevelV1 uint
  599. const (
  600. CONGESTION_UNKNOWN CongestionLevelV1 = 0
  601. CONGESTION_SMOOTH CongestionLevelV1 = 1
  602. CONGESTION_STOP_AND_GO CongestionLevelV1 = 2
  603. CONGESTION_SIGNIFICANT CongestionLevelV1 = 3
  604. CONGESTION_SEVERE CongestionLevelV1 = 4
  605. )
  606. func (t CongestionLevelV1) String() string {
  607. switch t {
  608. case CONGESTION_UNKNOWN:
  609. return "CONGESTION_UNKNOWN"
  610. case CONGESTION_SMOOTH:
  611. return "CONGESTION_SMOOTH"
  612. case CONGESTION_STOP_AND_GO:
  613. return "CONGESTION_STOP_AND_GO"
  614. case CONGESTION_SIGNIFICANT:
  615. return "CONGESTION_SIGNIFICANT"
  616. case CONGESTION_SEVERE:
  617. return "CONGESTION_SEVERE"
  618. }
  619. panic(errors.New("Invalid CongestionLevelV1 value"))
  620. }
  621. type OccupancyStatusV1 uint
  622. const (
  623. OCCUPANCY_UNKNOWN OccupancyStatusV1 = 0
  624. OCCUPANCY_EMPTY OccupancyStatusV1 = 1
  625. OCCUPANCY_MANY_AVAILABLE OccupancyStatusV1 = 2
  626. OCCUPANCY_FEW_AVAILABLE OccupancyStatusV1 = 3
  627. OCCUPANCY_STANDING_ONLY OccupancyStatusV1 = 4
  628. OCCUPANCY_CRUSHED OccupancyStatusV1 = 5
  629. OCCUPANCY_FULL OccupancyStatusV1 = 6
  630. OCCUPANCY_NOT_ACCEPTING OccupancyStatusV1 = 7
  631. )
  632. func (t OccupancyStatusV1) String() string {
  633. switch t {
  634. case OCCUPANCY_UNKNOWN:
  635. return "OCCUPANCY_UNKNOWN"
  636. case OCCUPANCY_EMPTY:
  637. return "OCCUPANCY_EMPTY"
  638. case OCCUPANCY_MANY_AVAILABLE:
  639. return "OCCUPANCY_MANY_AVAILABLE"
  640. case OCCUPANCY_FEW_AVAILABLE:
  641. return "OCCUPANCY_FEW_AVAILABLE"
  642. case OCCUPANCY_STANDING_ONLY:
  643. return "OCCUPANCY_STANDING_ONLY"
  644. case OCCUPANCY_CRUSHED:
  645. return "OCCUPANCY_CRUSHED"
  646. case OCCUPANCY_FULL:
  647. return "OCCUPANCY_FULL"
  648. case OCCUPANCY_NOT_ACCEPTING:
  649. return "OCCUPANCY_NOT_ACCEPTING"
  650. }
  651. panic(errors.New("Invalid OccupancyStatusV1 value"))
  652. }
  653. type LineTypeV1 uint
  654. const (
  655. LINE_UNKNOWN LineTypeV1 = 0
  656. TRAM LineTypeV1 = 1
  657. BUS LineTypeV1 = 2
  658. )
  659. func (t LineTypeV1) String() string {
  660. switch t {
  661. case LINE_UNKNOWN:
  662. return "LINE_UNKNOWN"
  663. case TRAM:
  664. return "TRAM"
  665. case BUS:
  666. return "BUS"
  667. }
  668. panic(errors.New("Invalid LineTypeV1 value"))
  669. }
  670. type LineTypeV2 uint
  671. const (
  672. LINE_V2_UNKNOWN LineTypeV2 = 0
  673. LINE_V2_TRAM LineTypeV2 = 1
  674. LINE_V2_BUS LineTypeV2 = 2
  675. LINE_V2_TROLLEYBUS LineTypeV2 = 3
  676. )
  677. func (t LineTypeV2) String() string {
  678. switch t {
  679. case LINE_V2_UNKNOWN:
  680. return "LINE_V2_UNKNOWN"
  681. case LINE_V2_TRAM:
  682. return "LINE_V2_TRAM"
  683. case LINE_V2_BUS:
  684. return "LINE_V2_BUS"
  685. case LINE_V2_TROLLEYBUS:
  686. return "LINE_V2_TROLLEYBUS"
  687. }
  688. panic(errors.New("Invalid LineTypeV2 value"))
  689. }
  690. type LineTypeV3 uint
  691. const (
  692. LINE_V3_UNKNOWN LineTypeV3 = 0
  693. LINE_V3_TRAM LineTypeV3 = 1
  694. LINE_V3_BUS LineTypeV3 = 2
  695. LINE_V3_TROLLEYBUS LineTypeV3 = 3
  696. LINE_V3_METRO LineTypeV3 = 4
  697. LINE_V3_RAIL LineTypeV3 = 5
  698. LINE_V3_FERRY LineTypeV3 = 6
  699. LINE_V3_CABLE_TRAM LineTypeV3 = 7
  700. LINE_V3_CABLE_CAR LineTypeV3 = 8
  701. LINE_V3_FUNICULAR LineTypeV3 = 9
  702. LINE_V3_MONORAIL LineTypeV3 = 10
  703. )
  704. func (t LineTypeV3) String() string {
  705. switch t {
  706. case LINE_V3_UNKNOWN:
  707. return "LINE_V3_UNKNOWN"
  708. case LINE_V3_TRAM:
  709. return "LINE_V3_TRAM"
  710. case LINE_V3_BUS:
  711. return "LINE_V3_BUS"
  712. case LINE_V3_TROLLEYBUS:
  713. return "LINE_V3_TROLLEYBUS"
  714. case LINE_V3_METRO:
  715. return "LINE_V3_METRO"
  716. case LINE_V3_RAIL:
  717. return "LINE_V3_RAIL"
  718. case LINE_V3_FERRY:
  719. return "LINE_V3_FERRY"
  720. case LINE_V3_CABLE_TRAM:
  721. return "LINE_V3_CABLE_TRAM"
  722. case LINE_V3_CABLE_CAR:
  723. return "LINE_V3_CABLE_CAR"
  724. case LINE_V3_FUNICULAR:
  725. return "LINE_V3_FUNICULAR"
  726. case LINE_V3_MONORAIL:
  727. return "LINE_V3_MONORAIL"
  728. }
  729. panic(errors.New("Invalid LineTypeV3 value"))
  730. }
  731. type AlertCauseV1 uint
  732. const (
  733. CAUSE_UNKNOWN AlertCauseV1 = 0
  734. CAUSE_OTHER AlertCauseV1 = 1
  735. CAUSE_TECHNICAL_PROBLEM AlertCauseV1 = 2
  736. CAUSE_STRIKE AlertCauseV1 = 3
  737. CAUSE_DEMONSTRATION AlertCauseV1 = 4
  738. CAUSE_ACCIDENT AlertCauseV1 = 5
  739. CAUSE_HOLIDAY AlertCauseV1 = 6
  740. CAUSE_WEATHER AlertCauseV1 = 7
  741. CAUSE_MAINTENANCE AlertCauseV1 = 8
  742. CAUSE_CONSTRUCTION AlertCauseV1 = 9
  743. CAUSE_POLICE_ACTIVITY AlertCauseV1 = 10
  744. CAUSE_MEDICAL_EMERGENCY AlertCauseV1 = 11
  745. )
  746. func (t AlertCauseV1) String() string {
  747. switch t {
  748. case CAUSE_UNKNOWN:
  749. return "CAUSE_UNKNOWN"
  750. case CAUSE_OTHER:
  751. return "CAUSE_OTHER"
  752. case CAUSE_TECHNICAL_PROBLEM:
  753. return "CAUSE_TECHNICAL_PROBLEM"
  754. case CAUSE_STRIKE:
  755. return "CAUSE_STRIKE"
  756. case CAUSE_DEMONSTRATION:
  757. return "CAUSE_DEMONSTRATION"
  758. case CAUSE_ACCIDENT:
  759. return "CAUSE_ACCIDENT"
  760. case CAUSE_HOLIDAY:
  761. return "CAUSE_HOLIDAY"
  762. case CAUSE_WEATHER:
  763. return "CAUSE_WEATHER"
  764. case CAUSE_MAINTENANCE:
  765. return "CAUSE_MAINTENANCE"
  766. case CAUSE_CONSTRUCTION:
  767. return "CAUSE_CONSTRUCTION"
  768. case CAUSE_POLICE_ACTIVITY:
  769. return "CAUSE_POLICE_ACTIVITY"
  770. case CAUSE_MEDICAL_EMERGENCY:
  771. return "CAUSE_MEDICAL_EMERGENCY"
  772. }
  773. panic(errors.New("Invalid AlertCauseV1 value"))
  774. }
  775. type AlertEffectV1 uint
  776. const (
  777. EFFECT_UNKNOWN AlertEffectV1 = 0
  778. EFFECT_OTHER AlertEffectV1 = 1
  779. EFFECT_NO_SERVICE AlertEffectV1 = 2
  780. EFFECT_REDUCED_SERVICE AlertEffectV1 = 3
  781. EFFECT_SIGNIFICANT_DELAYS AlertEffectV1 = 4
  782. EFFECT_DETOUR AlertEffectV1 = 5
  783. EFFECT_ADDITIONAL_SERVICE AlertEffectV1 = 6
  784. EFFECT_MODIFIED_SERVICE AlertEffectV1 = 7
  785. EFFECT_STOP_MOVED AlertEffectV1 = 8
  786. EFFECT_NONE AlertEffectV1 = 9
  787. EFFECT_ACCESSIBILITY_ISSUE AlertEffectV1 = 10
  788. )
  789. func (t AlertEffectV1) String() string {
  790. switch t {
  791. case EFFECT_UNKNOWN:
  792. return "EFFECT_UNKNOWN"
  793. case EFFECT_OTHER:
  794. return "EFFECT_OTHER"
  795. case EFFECT_NO_SERVICE:
  796. return "EFFECT_NO_SERVICE"
  797. case EFFECT_REDUCED_SERVICE:
  798. return "EFFECT_REDUCED_SERVICE"
  799. case EFFECT_SIGNIFICANT_DELAYS:
  800. return "EFFECT_SIGNIFICANT_DELAYS"
  801. case EFFECT_DETOUR:
  802. return "EFFECT_DETOUR"
  803. case EFFECT_ADDITIONAL_SERVICE:
  804. return "EFFECT_ADDITIONAL_SERVICE"
  805. case EFFECT_MODIFIED_SERVICE:
  806. return "EFFECT_MODIFIED_SERVICE"
  807. case EFFECT_STOP_MOVED:
  808. return "EFFECT_STOP_MOVED"
  809. case EFFECT_NONE:
  810. return "EFFECT_NONE"
  811. case EFFECT_ACCESSIBILITY_ISSUE:
  812. return "EFFECT_ACCESSIBILITY_ISSUE"
  813. }
  814. panic(errors.New("Invalid AlertEffectV1 value"))
  815. }
  816. type DepartureOrdinalityV1 uint
  817. const (
  818. MIDPOINT DepartureOrdinalityV1 = 0
  819. ORIGIN DepartureOrdinalityV1 = 1
  820. TERMINUS DepartureOrdinalityV1 = 2
  821. )
  822. func (t DepartureOrdinalityV1) String() string {
  823. switch t {
  824. case MIDPOINT:
  825. return "MIDPOINT"
  826. case ORIGIN:
  827. return "ORIGIN"
  828. case TERMINUS:
  829. return "TERMINUS"
  830. }
  831. panic(errors.New("Invalid DepartureOrdinalityV1 value"))
  832. }
  833. type VehicleStatusV1 uint
  834. const (
  835. STATUS_IN_TRANSIT VehicleStatusV1 = 0
  836. STATUS_INCOMING VehicleStatusV1 = 1
  837. STATUS_AT_STOP VehicleStatusV1 = 2
  838. STATUS_DEPARTED VehicleStatusV1 = 3
  839. )
  840. func (t VehicleStatusV1) String() string {
  841. switch t {
  842. case STATUS_IN_TRANSIT:
  843. return "STATUS_IN_TRANSIT"
  844. case STATUS_INCOMING:
  845. return "STATUS_INCOMING"
  846. case STATUS_AT_STOP:
  847. return "STATUS_AT_STOP"
  848. case STATUS_DEPARTED:
  849. return "STATUS_DEPARTED"
  850. }
  851. panic(errors.New("Invalid VehicleStatusV1 value"))
  852. }
  853. type BoardingV1 uint
  854. const (
  855. BOARDING_NONE BoardingV1 = 0
  856. ONBOARDING_REGULAR BoardingV1 = 1
  857. ONBOARDING_PHONE BoardingV1 = 2
  858. ONBOARDING_DRIVER BoardingV1 = 3
  859. OFFBOARDING_REGULAR BoardingV1 = 16
  860. OFFBOARDING_PHONE BoardingV1 = 32
  861. OFFBOARDING_DRIVER BoardingV1 = 48
  862. )
  863. func (t BoardingV1) String() string {
  864. switch t {
  865. case BOARDING_NONE:
  866. return "BOARDING_NONE"
  867. case ONBOARDING_REGULAR:
  868. return "ONBOARDING_REGULAR"
  869. case ONBOARDING_PHONE:
  870. return "ONBOARDING_PHONE"
  871. case ONBOARDING_DRIVER:
  872. return "ONBOARDING_DRIVER"
  873. case OFFBOARDING_REGULAR:
  874. return "OFFBOARDING_REGULAR"
  875. case OFFBOARDING_PHONE:
  876. return "OFFBOARDING_PHONE"
  877. case OFFBOARDING_DRIVER:
  878. return "OFFBOARDING_DRIVER"
  879. }
  880. panic(errors.New("Invalid BoardingV1 value"))
  881. }
  882. type LineResponse interface {
  883. bare.Union
  884. }
  885. func (_ LineResponseDev) IsUnion() {}
  886. func (_ LineResponseV1) IsUnion() {}
  887. func (_ LineResponseV2) IsUnion() {}
  888. func (_ LineResponseV3) IsUnion() {}
  889. type FeedsResponse interface {
  890. bare.Union
  891. }
  892. func (_ FeedsResponseDev) IsUnion() {}
  893. func (_ FeedsResponseV1) IsUnion() {}
  894. func (_ FeedsResponseV2) IsUnion() {}
  895. type QueryablesResponse interface {
  896. bare.Union
  897. }
  898. func (_ QueryablesResponseDev) IsUnion() {}
  899. func (_ QueryablesResponseV1) IsUnion() {}
  900. func (_ QueryablesResponseV2) IsUnion() {}
  901. func (_ QueryablesResponseV3) IsUnion() {}
  902. func (_ QueryablesResponseV4) IsUnion() {}
  903. type QueryableV1 interface {
  904. bare.Union
  905. }
  906. func (_ StopV1) IsUnion() {}
  907. type QueryableV2 interface {
  908. bare.Union
  909. }
  910. func (_ StopV2) IsUnion() {}
  911. func (_ LineV1) IsUnion() {}
  912. type QueryableV3 interface {
  913. bare.Union
  914. }
  915. func (_ LineV2) IsUnion() {}
  916. type QueryableV4 interface {
  917. bare.Union
  918. }
  919. func (_ LineV3) IsUnion() {}
  920. type QueryableV5 interface {
  921. bare.Union
  922. }
  923. func (_ StopV3) IsUnion() {}
  924. type LocatablesResponse interface {
  925. bare.Union
  926. }
  927. func (_ LocatablesResponseDev) IsUnion() {}
  928. func (_ LocatablesResponseV1) IsUnion() {}
  929. func (_ LocatablesResponseV2) IsUnion() {}
  930. func (_ LocatablesResponseV3) IsUnion() {}
  931. type LocatableV1 interface {
  932. bare.Union
  933. }
  934. func (_ VehicleV1) IsUnion() {}
  935. type LocatableV2 interface {
  936. bare.Union
  937. }
  938. func (_ VehicleV2) IsUnion() {}
  939. type LocatableV3 interface {
  940. bare.Union
  941. }
  942. func (_ VehicleV3) IsUnion() {}
  943. type LocatableV4 interface {
  944. bare.Union
  945. }
  946. type DeparturesResponse interface {
  947. bare.Union
  948. }
  949. func (_ DeparturesResponseDev) IsUnion() {}
  950. func (_ DeparturesResponseV1) IsUnion() {}
  951. func (_ DeparturesResponseV2) IsUnion() {}
  952. func (_ DeparturesResponseV3) IsUnion() {}
  953. func (_ DeparturesResponseV4) IsUnion() {}
  954. func init() {
  955. bare.RegisterUnion((*LineResponse)(nil)).
  956. Member(*new(LineResponseDev), 0).
  957. Member(*new(LineResponseV1), 1).
  958. Member(*new(LineResponseV2), 2).
  959. Member(*new(LineResponseV3), 3)
  960. bare.RegisterUnion((*FeedsResponse)(nil)).
  961. Member(*new(FeedsResponseDev), 0).
  962. Member(*new(FeedsResponseV1), 1).
  963. Member(*new(FeedsResponseV2), 2)
  964. bare.RegisterUnion((*QueryablesResponse)(nil)).
  965. Member(*new(QueryablesResponseDev), 0).
  966. Member(*new(QueryablesResponseV1), 1).
  967. Member(*new(QueryablesResponseV2), 2).
  968. Member(*new(QueryablesResponseV3), 3).
  969. Member(*new(QueryablesResponseV4), 4)
  970. bare.RegisterUnion((*QueryableV1)(nil)).
  971. Member(*new(StopV1), 0)
  972. bare.RegisterUnion((*QueryableV2)(nil)).
  973. Member(*new(StopV2), 0).
  974. Member(*new(LineV1), 1)
  975. bare.RegisterUnion((*QueryableV3)(nil)).
  976. Member(*new(StopV2), 0).
  977. Member(*new(LineV2), 1)
  978. bare.RegisterUnion((*QueryableV4)(nil)).
  979. Member(*new(StopV2), 0).
  980. Member(*new(LineV3), 1)
  981. bare.RegisterUnion((*QueryableV5)(nil)).
  982. Member(*new(StopV3), 0).
  983. Member(*new(LineV3), 1)
  984. bare.RegisterUnion((*LocatablesResponse)(nil)).
  985. Member(*new(LocatablesResponseDev), 0).
  986. Member(*new(LocatablesResponseV1), 1).
  987. Member(*new(LocatablesResponseV2), 2).
  988. Member(*new(LocatablesResponseV3), 3)
  989. bare.RegisterUnion((*LocatableV1)(nil)).
  990. Member(*new(StopV1), 0).
  991. Member(*new(VehicleV1), 1)
  992. bare.RegisterUnion((*LocatableV2)(nil)).
  993. Member(*new(StopV2), 0).
  994. Member(*new(VehicleV2), 1)
  995. bare.RegisterUnion((*LocatableV3)(nil)).
  996. Member(*new(StopV2), 0).
  997. Member(*new(VehicleV3), 1)
  998. bare.RegisterUnion((*LocatableV4)(nil)).
  999. Member(*new(StopV3), 0).
  1000. Member(*new(VehicleV3), 1)
  1001. bare.RegisterUnion((*DeparturesResponse)(nil)).
  1002. Member(*new(DeparturesResponseDev), 0).
  1003. Member(*new(DeparturesResponseV1), 1).
  1004. Member(*new(DeparturesResponseV2), 2).
  1005. Member(*new(DeparturesResponseV3), 3).
  1006. Member(*new(DeparturesResponseV4), 4)
  1007. }