motis_openapi_sdk/models/alert.rs
1/*
2 * MOTIS API
3 *
4 * This is the MOTIS routing API. Overview of MOTIS API versions: MOTIS 0.x - deprecated/discontinued MOTIS 2.x - current, providing: * /api/v5/{plan,trip,stoptimes,map/trips} renamed METRO mode to SUBURBAN, AREAL_LIFT to AERIAL_LIFT; since MOTIS 2.5.0 * /api/v4/{plan,trip,stoptimes,map/trips} new displayName property, routeShortName only contains actual route short name from source; since MOTIS 2.2.0 * /api/v3/plan with correct maxTransfers API parameter (transfers actually corresponding to number of changes between transit legs (and not to number of transit legs), i.e. maxTransfers=0 returns direct public transit connections, as expected); since MOTIS 2.0.84 * /api/v2/{plan,trip} returns Google polylines with precision=6; since MOTIS 2.0.60 * /api/v1/{plan,trip} returns Google polylines with precision=7 (not defined for |longitude|>107) * /api/v1/_* all other endpoints If you use the JS client lib https://www.npmjs.com/package/@motis-project/motis-client, endpoint versions will be taken into account automatically (i.e. the newest one available will be used).
5 *
6 * The version of the OpenAPI document: v5
7 * Contact: felix@triptix.tech
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// Alert : An alert, indicating some sort of incident in the public transit network.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Alert {
17 /// Time when the alert should be shown to the user. If missing, the alert will be shown as long as it appears in the feed. If multiple ranges are given, the alert will be shown during all of them.
18 #[serde(rename = "communicationPeriod", skip_serializing_if = "Option::is_none")]
19 pub communication_period: Option<Vec<models::TimeRange>>,
20 /// Time when the services are affected by the disruption mentioned in the alert.
21 #[serde(rename = "impactPeriod", skip_serializing_if = "Option::is_none")]
22 pub impact_period: Option<Vec<models::TimeRange>>,
23 #[serde(rename = "cause", skip_serializing_if = "Option::is_none")]
24 pub cause: Option<models::AlertCause>,
25 /// Description of the cause of the alert that allows for agency-specific language; more specific than the Cause.
26 #[serde(rename = "causeDetail", skip_serializing_if = "Option::is_none")]
27 pub cause_detail: Option<String>,
28 #[serde(rename = "effect", skip_serializing_if = "Option::is_none")]
29 pub effect: Option<models::AlertEffect>,
30 /// Description of the effect of the alert that allows for agency-specific language; more specific than the Effect.
31 #[serde(rename = "effectDetail", skip_serializing_if = "Option::is_none")]
32 pub effect_detail: Option<String>,
33 /// The URL which provides additional information about the alert.
34 #[serde(rename = "url", skip_serializing_if = "Option::is_none")]
35 pub url: Option<String>,
36 /// Header for the alert. This plain-text string will be highlighted, for example in boldface.
37 #[serde(rename = "headerText")]
38 pub header_text: String,
39 /// Description for the alert. This plain-text string will be formatted as the body of the alert (or shown on an explicit \"expand\" request by the user). The information in the description should add to the information of the header.
40 #[serde(rename = "descriptionText")]
41 pub description_text: String,
42 /// Text containing the alert's header to be used for text-to-speech implementations. This field is the text-to-speech version of header_text. It should contain the same information as headerText but formatted such that it can read as text-to-speech (for example, abbreviations removed, numbers spelled out, etc.)
43 #[serde(rename = "ttsHeaderText", skip_serializing_if = "Option::is_none")]
44 pub tts_header_text: Option<String>,
45 /// Text containing a description for the alert to be used for text-to-speech implementations. This field is the text-to-speech version of description_text. It should contain the same information as description_text but formatted such that it can be read as text-to-speech (for example, abbreviations removed, numbers spelled out, etc.)
46 #[serde(rename = "ttsDescriptionText", skip_serializing_if = "Option::is_none")]
47 pub tts_description_text: Option<String>,
48 /// Severity of the alert.
49 #[serde(rename = "severityLevel", skip_serializing_if = "Option::is_none")]
50 pub severity_level: Option<models::AlertSeverityLevel>,
51 /// String containing an URL linking to an image.
52 #[serde(rename = "imageUrl", skip_serializing_if = "Option::is_none")]
53 pub image_url: Option<String>,
54 /// IANA media type as to specify the type of image to be displayed. The type must start with \"image/\"
55 #[serde(rename = "imageMediaType", skip_serializing_if = "Option::is_none")]
56 pub image_media_type: Option<String>,
57 /// Text describing the appearance of the linked image in the image field (e.g., in case the image can't be displayed or the user can't see the image for accessibility reasons). See the HTML spec for alt image text.
58 #[serde(rename = "imageAlternativeText", skip_serializing_if = "Option::is_none")]
59 pub image_alternative_text: Option<String>,
60}
61
62impl Alert {
63 /// An alert, indicating some sort of incident in the public transit network.
64 pub fn new(header_text: String, description_text: String) -> Alert {
65 Alert {
66 communication_period: None,
67 impact_period: None,
68 cause: None,
69 cause_detail: None,
70 effect: None,
71 effect_detail: None,
72 url: None,
73 header_text,
74 description_text,
75 tts_header_text: None,
76 tts_description_text: None,
77 severity_level: None,
78 image_url: None,
79 image_media_type: None,
80 image_alternative_text: None,
81 }
82 }
83}
84