mobilitydata_client/models/feed.rs
1/*
2 * Mobility Database Catalog
3 *
4 * API for the Mobility Database Catalog. See [https://mobilitydatabase.org/](https://mobilitydatabase.org/). The Mobility Database API uses OAuth2 authentication. To initiate a successful API request, an access token must be included as a bearer token in the HTTP header. Access tokens are valid for one hour. To obtain an access token, you'll first need a refresh token, which is long-lived and does not expire.
5 *
6 * The version of the OpenAPI document: 1.0.0
7 * Contact: api@mobilitydata.org
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct Feed {
16 /// Unique identifier used as a key for the feeds table.
17 #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
18 pub id: Option<String>,
19 #[serde(rename = "data_type", skip_serializing_if = "Option::is_none")]
20 pub data_type: Option<DataType>,
21 /// The date and time the feed was added to the database, in ISO 8601 date-time format.
22 #[serde(rename = "created_at", skip_serializing_if = "Option::is_none")]
23 pub created_at: Option<String>,
24 /// The ID that can be use to find the feed data in an external or legacy database. <ul> <li><b>JBDA</b>: Automatically imported from http://docs.gtfs-data.jp/api.v2.html. Pattern is jbda-<organisation_id>-<feed_id>.</li> <li><b>TDG</b>: Automatically imported from https://doc.transport.data.gouv.fr/outils/outils-disponibles-sur-le-pan/api. Pattern is tdg-<resource_id>.</li> <li><b>NTD</b>: Automatically imported from https://www.transit.dot.gov/ntd/data-product/2023-annual-database-general-transit-feed-specification-gtfs-weblinks. Pattern is ntd-<ntd_id>.</li> <li><b>TransitFeeds</b>: Automatically imported from old TransitFeeds website. Pattern is tfs-<feed_id>.</li> <li><b>Transit.land</b>: Imported from https://www.transit.land/documentation/rest-api/feeds. Pattern is tld-<feed_id>.</li> </ul>
25 #[serde(rename = "external_ids", skip_serializing_if = "Option::is_none")]
26 pub external_ids: Option<Vec<models::ExternalId>>,
27 /// A commonly used name for the transit provider included in the feed.
28 #[serde(rename = "provider", skip_serializing_if = "Option::is_none")]
29 pub provider: Option<String>,
30 /// Use to contact the feed producer.
31 #[serde(rename = "feed_contact_email", skip_serializing_if = "Option::is_none")]
32 pub feed_contact_email: Option<String>,
33 #[serde(rename = "source_info", skip_serializing_if = "Option::is_none")]
34 pub source_info: Option<Box<models::SourceInfo>>,
35 #[serde(rename = "redirects", skip_serializing_if = "Option::is_none")]
36 pub redirects: Option<Vec<models::Redirect>>,
37 /// Describes status of the Feed. Should be one of * `active` Feed should be used in public trip planners. * `deprecated` Feed is explicitly deprecated and should not be used in public trip planners. * `inactive` Feed hasn't been recently updated and should be used at risk of providing outdated information. * `development` Feed is being used for development purposes and should not be used in public trip planners. * `future` Feed is not yet active but will be in the future.
38 #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
39 pub status: Option<Status>,
40 /// A boolean value indicating if the feed is official or not. Official feeds are provided by the transit agency or a trusted source.
41 #[serde(rename = "official", skip_serializing_if = "Option::is_none")]
42 pub official: Option<bool>,
43 /// The date and time the official status was last updated, in ISO 8601 date-time format.
44 #[serde(rename = "official_updated_at", skip_serializing_if = "Option::is_none")]
45 pub official_updated_at: Option<String>,
46 /// An optional description of the data feed, e.g to specify if the data feed is an aggregate of multiple providers, or which network is represented by the feed.
47 #[serde(rename = "feed_name", skip_serializing_if = "Option::is_none")]
48 pub feed_name: Option<String>,
49 /// A note to clarify complex use cases for consumers.
50 #[serde(rename = "note", skip_serializing_if = "Option::is_none")]
51 pub note: Option<String>,
52 /// A list of related links for the feed.
53 #[serde(rename = "related_links", skip_serializing_if = "Option::is_none")]
54 pub related_links: Option<Vec<models::FeedRelatedLink>>,
55}
56
57impl Feed {
58 pub fn new() -> Feed {
59 Feed {
60 id: None,
61 data_type: None,
62 created_at: None,
63 external_ids: None,
64 provider: None,
65 feed_contact_email: None,
66 source_info: None,
67 redirects: None,
68 status: None,
69 official: None,
70 official_updated_at: None,
71 feed_name: None,
72 note: None,
73 related_links: None,
74 }
75 }
76}
77///
78#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
79pub enum DataType {
80 #[serde(rename = "gtfs")]
81 Gtfs,
82 #[serde(rename = "gtfs_rt")]
83 GtfsRt,
84 #[serde(rename = "gbfs")]
85 Gbfs,
86}
87
88impl Default for DataType {
89 fn default() -> DataType {
90 Self::Gtfs
91 }
92}
93/// Describes status of the Feed. Should be one of * `active` Feed should be used in public trip planners. * `deprecated` Feed is explicitly deprecated and should not be used in public trip planners. * `inactive` Feed hasn't been recently updated and should be used at risk of providing outdated information. * `development` Feed is being used for development purposes and should not be used in public trip planners. * `future` Feed is not yet active but will be in the future.
94#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
95pub enum Status {
96 #[serde(rename = "active")]
97 Active,
98 #[serde(rename = "deprecated")]
99 Deprecated,
100 #[serde(rename = "inactive")]
101 Inactive,
102 #[serde(rename = "development")]
103 Development,
104 #[serde(rename = "future")]
105 Future,
106}
107
108impl Default for Status {
109 fn default() -> Status {
110 Self::Active
111 }
112}
113