openrtb_native1/request/video.rs
1/// 4.5 Video Request Object
2///
3/// The video object to be used for all video elements supported in the Native Ad. This corresponds
4/// to the Video object of OpenRTB. Exchange implementers can impose their own specific
5/// restrictions. Here are the required attributes of the Video Object. For optional attributes
6/// please refer to OpenRTB.
7#[derive(serde::Serialize, serde::Deserialize, Default, Debug, PartialEq, Clone)]
8pub struct Video {
9 /// required; array of string; -
10 /// Content MIME types supported. Popular MIME types include, but are not limited to
11 /// “video/x-ms- wmv” for Windows Media, and “video/x-flv” for Flash Video, or “video/mp4”.
12 /// Note that native frequently does not support flash.
13 pub mimes: Vec<String>,
14
15 /// required; integer; -
16 /// Minimum video ad duration in seconds.
17 pub minduration: i32,
18
19 /// required; integer; -
20 /// Maximum video ad duration in seconds.
21 pub maxduration: i32,
22
23 /// required; array of integer; -
24 /// An array of video protocols the publisher can accept in the bid response. See OpenRTB Table
25 /// ‘Video Bid Response Protocols’ for a list of possible values.
26 pub protocols: Vec<openrtb2::Protocol>,
27
28 /// optional; object; -
29 /// This object is a placeholder that may contain custom JSON agreed to by the parties to
30 /// support flexibility beyond the standard defined in this specification.
31 #[serde(default, skip_serializing_if = "Option::is_none")]
32 pub ext: Option<serde_json::Map<String, serde_json::Value>>,
33}
34
35#[cfg(test)]
36mod test {
37 use super::*;
38
39 #[test]
40 fn json() -> serde_json::Result<()> {
41 let json = r#"{"mimes":[],"minduration":0,"maxduration":0,"protocols":[]}"#;
42 let o1 = Video::default();
43 assert_eq!(serde_json::to_string(&o1)?, json);
44 assert_eq!(o1, serde_json::from_str::<Video>(json)?);
45
46 Ok(())
47 }
48}