tba_openapi_rust/models/
media.rs

1/*
2 * The Blue Alliance API v3
3 *
4 * # Overview    Information and statistics about FIRST Robotics Competition teams and events.   # Authentication   All endpoints require an Auth Key to be passed in the header `X-TBA-Auth-Key`. If you do not have an auth key yet, you can obtain one from your [Account Page](/account).
5 *
6 * The version of the OpenAPI document: 3.8.2
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// Media : The `Media` object contains a reference for most any media associated with a team or event on TBA.
12
13
14
15#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
16pub struct Media {
17    /// String type of the media element.
18    #[serde(rename = "type")]
19    pub r#type: RHashType,
20    /// The key used to identify this media on the media site.
21    #[serde(rename = "foreign_key")]
22    pub foreign_key: String,
23    /// If required, a JSON dict of additional media information.
24    #[serde(rename = "details", skip_serializing_if = "Option::is_none")]
25    pub details: Option<serde_json::Value>,
26    /// True if the media is of high quality.
27    #[serde(rename = "preferred", skip_serializing_if = "Option::is_none")]
28    pub preferred: Option<bool>,
29    /// Direct URL to the media.
30    #[serde(rename = "direct_url", skip_serializing_if = "Option::is_none")]
31    pub direct_url: Option<String>,
32    /// The URL that leads to the full web page for the media, if one exists.
33    #[serde(rename = "view_url", skip_serializing_if = "Option::is_none")]
34    pub view_url: Option<String>,
35}
36
37impl Media {
38    /// The `Media` object contains a reference for most any media associated with a team or event on TBA.
39    pub fn new(r#type: RHashType, foreign_key: String) -> Media {
40        Media {
41            r#type,
42            foreign_key,
43            details: None,
44            preferred: None,
45            direct_url: None,
46            view_url: None,
47        }
48    }
49}
50
51/// String type of the media element.
52#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
53pub enum RHashType {
54    #[serde(rename = "youtube")]
55    Youtube,
56    #[serde(rename = "cdphotothread")]
57    Cdphotothread,
58    #[serde(rename = "imgur")]
59    Imgur,
60    #[serde(rename = "facebook-profile")]
61    FacebookProfile,
62    #[serde(rename = "youtube-channel")]
63    YoutubeChannel,
64    #[serde(rename = "twitter-profile")]
65    TwitterProfile,
66    #[serde(rename = "github-profile")]
67    GithubProfile,
68    #[serde(rename = "instagram-profile")]
69    InstagramProfile,
70    #[serde(rename = "periscope-profile")]
71    PeriscopeProfile,
72    #[serde(rename = "grabcad")]
73    Grabcad,
74    #[serde(rename = "instagram-image")]
75    InstagramImage,
76    #[serde(rename = "external-link")]
77    ExternalLink,
78    #[serde(rename = "avatar")]
79    Avatar,
80}
81
82impl Default for RHashType {
83    fn default() -> RHashType {
84        Self::Youtube
85    }
86}
87