gistools/readers/gbfs/schema_v2/
gbfs_versions.rs

1use crate::readers::GBFSVersion;
2use alloc::{string::String, vec::Vec};
3use serde::{Deserialize, Serialize};
4
5/// # GBFS Versions Schema V2.3, V2.2, V2.1, OR V2.0
6/// Lists all feed endpoints published according to versions of the GBFS documentation.
7///
8/// ## Links
9/// - [GBFS Specification V2.3](https://github.com/MobilityData/gbfs/blob/v2.3/gbfs.md#gbfs_versionsjson)
10/// - [GBFS Specification V2.2](https://github.com/MobilityData/gbfs/blob/v2.2/gbfs.md#gbfs_versionsjson-added-in-v11)
11/// - [GBFS Specification V2.1](https://github.com/MobilityData/gbfs/blob/v2.1/gbfs.md#gbfs_versionsjson-added-in-v11)
12/// - [GBFS Specification V2.0](https://github.com/MobilityData/gbfs/blob/v2.0/gbfs.md#gbfs_versionsjson-added-in-v11)
13pub type GBFSVersionsV2 = GBFSVersionsV23;
14
15/// Response data in the form of name:value pairs.
16#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
17pub struct GBFSVersionsData20 {
18    /// Contains one object for each of the available versions of a feed.
19    /// The array must be sorted by increasing MAJOR and MINOR version number.
20    pub versions: Vec<GBFSVersion>,
21}
22
23/// # GBFS Versions V2.3
24/// Lists all feed endpoints published according to versions of the GBFS documentation (added in v1.1).
25///
26/// ## Links
27/// - [GBFS Specification](https://github.com/MobilityData/gbfs/blob/v2.3/gbfs.md#gbfs_versionsjson)
28#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
29pub struct GBFSVersionsV23 {
30    /// Last time the data in the feed was updated in POSIX time.
31    /// **Minimum**: 1450155600
32    pub last_updated: u64,
33    /// Number of seconds before the data in the feed will be updated again (0 if the data should always be refreshed).
34    /// **Minimum**: 0
35    pub ttl: u64,
36    /// GBFS version number to which the feed conforms, according to the versioning framework.
37    /// **Const**: 2.3
38    pub version: String,
39    /// Response data in the form of name:value pairs.
40    pub data: GBFSVersionsData20,
41}
42
43/// # GBFS Versions V2.2
44/// Lists all feed endpoints published according to versions of the GBFS documentation (added in v1.1).
45///
46/// ## Links
47/// - [GBFS Specification](https://github.com/MobilityData/gbfs/blob/v2.2/gbfs.md#gbfs_versionsjson-added-in-v11)
48#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
49pub struct GBFSVersionsV22 {
50    /// Last time the data in the feed was updated in POSIX time.
51    /// **Minimum**: 1450155600
52    pub last_updated: u64,
53    /// Number of seconds before the data in the feed will be updated again (0 if the data should always be refreshed).
54    /// **Minimum**: 0
55    pub ttl: u64,
56    /// GBFS version number to which the feed conforms, according to the versioning framework.
57    /// **Const**: 2.2
58    pub version: String,
59    /// Response data in the form of name:value pairs.
60    pub data: GBFSVersionsData20,
61}
62
63/// # GBFS Versions V2.1
64/// Lists all feed endpoints published according to versions of the GBFS documentation (added in v1.1).
65///
66/// ## Links
67/// - [GBFS Specification](https://github.com/MobilityData/gbfs/blob/v2.1/gbfs.md#gbfs_versionsjson-added-in-v11)
68#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
69pub struct GBFSVersionsV21 {
70    /// Last time the data in the feed was updated in POSIX time.
71    /// **Minimum**: 1450155600
72    pub last_updated: u64,
73    /// Number of seconds before the data in the feed will be updated again (0 if the data should always be refreshed).
74    /// **Minimum**: 0
75    pub ttl: u64,
76    /// GBFS version number to which the feed conforms, according to the versioning framework.
77    /// **Const**: 2.1
78    pub version: String,
79    /// Response data in the form of name:value pairs.
80    pub data: GBFSVersionsData20,
81}
82
83/// # GBFS Versions V2.0
84/// Lists all feed endpoints published according to versions of the GBFS documentation (added in v1.1).
85///
86/// ## Links
87/// - [GBFS Specification](https://github.com/MobilityData/gbfs/blob/v2.0/gbfs.md#gbfs_versionsjson-added-in-v11)
88#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
89pub struct GBFSVersionsV20 {
90    /// Last time the data in the feed was updated in POSIX time.
91    /// **Minimum**: 1450155600
92    pub last_updated: u64,
93    /// Number of seconds before the data in the feed will be updated again (0 if the data should always be refreshed).
94    /// **Minimum**: 0
95    pub ttl: u64,
96    /// GBFS version number to which the feed conforms, according to the versioning framework.
97    /// **Const**: 2.0
98    pub version: String,
99    /// Response data in the form of name:value pairs.
100    pub data: GBFSVersionsData20,
101}