vast4_rs/non_linear.rs
1/// A container for the [`<NonLinear>`](NonLinear) creative files and tracking resources.
2///
3/// ```text
4/// <xs:element name="NonLinearAds">
5/// <xs:complexType>
6/// <xs:sequence>
7/// <xs:element name="TrackingEvents" minOccurs="0" maxOccurs="1" type="vast:TrackingEvents_type" />
8/// <xs:element name="NonLinear" minOccurs="0" maxOccurs="unbounded" type="vast:NonLinearAd_Inline_type">
9/// </xs:sequence>
10/// </xs:complexType>
11/// </xs:element>
12/// ```
13#[derive(hard_xml::XmlWrite, hard_xml::XmlRead, Default, PartialEq, Clone, Debug)]
14#[xml(tag = "NonLinearAds")]
15pub struct NonLinearAds<'a> {
16 /// The container for zero or one `<TrackingEvents>`(crate::TrackingEvents) element.
17 #[xml(child = "TrackingEvents", default)]
18 pub tracking_events: Option<crate::TrackingEvents<'a>>,
19 /// The container for zero or more [`<NonLinear>`](NonLinear) elements.
20 #[xml(child = "NonLinear", default)]
21 pub non_linears: Vec<NonLinear<'a>>,
22}
23
24/// Each `<NonLinear>` element may provide different versions of the same creative using the
25/// [`<StaticResource>`](crate::StaticResource), `<IFrameResource>`, and `<HTMLResource>` elements
26/// in the [`InLine`](crate::InLine) VAST response.
27///
28/// ## NonLinear in [`InLine`](crate::InLine):
29/// ```text
30/// <xs:complexType name="NonLinear">
31/// <!-- CreativeResource_type -->
32/// <xs:sequence>
33/// <xs:element name="HTMLResource" minOccurs="0" maxOccurs="unbounded" type="vast:HTMLResource_type">
34/// <xs:element name="IFrameResource" minOccurs="0" maxOccurs="unbounded" type="xs:anyURI">
35/// <xs:element name="StaticResource" minOccurs="0" maxOccurs="unbounded">
36/// </xs:sequence>
37///
38/// <xs:attribute name="id" type="xs:string" use="optional">
39/// <xs:attribute name="width" type="xs:integer" use="required">
40/// <xs:attribute name="height" type="xs:integer" use="required">
41/// <xs:attribute name="expandedWidth" type="xs:integer" use="optional">
42/// <xs:attribute name="expandedHeight" type="xs:integer" use="optional">
43/// <xs:attribute name="scalable" type="xs:boolean" use="optional">
44/// <xs:attribute name="maintainAspectRatio" type="xs:boolean" use="optional">
45/// <xs:attribute name="minSuggestedDuration" type="xs:time" use="optional">
46/// <xs:attribute name="apiFramework" type="xs:string" use="optional">
47/// <xs:sequence>
48/// <xs:element name="AdParameters" minOccurs="0" maxOccurs="1" type="vast:AdParameters_type">
49/// <xs:element name="NonLinearClickThrough" minOccurs="0" maxOccurs="1" type="xs:anyURI">
50/// <xs:element name="NonLinearClickTracking" minOccurs="0" maxOccurs="unbounded">
51/// </xs:sequence>
52/// </xs:complexType>
53/// ```
54///
55/// ## NonLinear in [`Wrapper`](crate::Wrapper):
56/// ```text
57/// <xs:complexType name="NonLinear">
58/// <xs:element name="NonLinearClickTracking" minOccurs="0" maxOccurs="1">
59/// </xs:complexType>
60/// ```
61#[derive(hard_xml::XmlWrite, hard_xml::XmlRead, Default, PartialEq, Clone, Debug)]
62#[xml(tag = "NonLinear")]
63pub struct NonLinear<'a> {
64 /// InLine: An optional identifier for the creative.
65 /// Wrapper: No use this field.
66 #[xml(attr = "id", default)]
67 pub id: Option<std::borrow::Cow<'a, str>>,
68 /// InLine: The pixel width of the placement slot for which the creative is intended.
69 /// **Required this field inside [`InLine`](crate::InLine) element.**
70 /// Wrapper: No use this field.
71 #[xml(attr = "width", default)]
72 pub width: Option<i32>,
73 /// InLine: The pixel height of the placement slot for which the creative is intended.
74 /// **Required this field inside [`InLine`](crate::InLine) element.**
75 /// Wrapper: No use this field.
76 #[xml(attr = "height", default)]
77 pub height: Option<i32>,
78 /// InLine: The maximum pixel width of the creative in its expanded state.
79 /// Wrapper: No use this field.
80 #[xml(attr = "expandedWidth", default)]
81 pub expanded_width: Option<i32>,
82 /// InLine: The maximum pixel height of the creative in its expanded state.
83 /// Wrapper: No use this field.
84 #[xml(attr = "expandedHeight", default)]
85 pub expanded_height: Option<i32>,
86 /// InLine: Identifies whether the creative can scale to new dimensions relative to the video
87 /// player when the video player is resized.
88 /// Wrapper: No use this field.
89 #[xml(attr = "scalable", default)]
90 pub scalable: Option<bool>,
91 /// InLine: Identifies whether the aspect ratio of the creative should be maintained when it is
92 /// scaled to new dimensions as the video player is resized.
93 /// Wrapper: No use this field.
94 #[xml(attr = "maintainAspectRatio", default)]
95 pub maintain_aspect_ratio: Option<bool>,
96 /// InLine: The minimum suggested duration that the creative should be displayed.
97 /// Wrapper: No use this field.
98 #[xml(attr = "minSuggestedDuration", default)]
99 pub min_suggested_duration: Option<crate::Duration>,
100 /// InLine: The API necessary to communicate with the creative if available.
101 /// Wrapper: No use this field.
102 #[xml(attr = "apiFramework", default)]
103 pub api_framework: Option<std::borrow::Cow<'a, str>>,
104
105 /// InLine: The container for zero or more `<HTMLResource>` elements.
106 /// Wrapper: No use this field.
107 #[xml(flatten_text = "HTMLResource", cdata, default)]
108 pub html_resources: Vec<std::borrow::Cow<'a, str>>,
109 /// InLine: The container for zero or more `<IFrameResource>` elements.
110 /// Wrapper: No use this field.
111 #[xml(flatten_text = "IFrameResource", cdata, default)]
112 pub iframe_resources: Vec<std::borrow::Cow<'a, str>>,
113 /// InLine: The container for zero or more [`<StaticResource>`](crate::StaticResource)
114 /// elements. Wrapper: No use this field.
115 #[xml(child = "StaticResource", default)]
116 pub static_resources: Vec<crate::StaticResource<'a>>,
117
118 /// InLine: The container for zero or one [`<AdParameters>`](crate::AdParameters) element.
119 /// Wrapper: No use this field.
120 #[xml(child = "AdParameters", default)]
121 pub ad_parameters: Option<crate::AdParameters<'a>>,
122 /// InLine: The container for zero or one `<NonLinearClickThrough>` element.
123 /// Wrapper: No use this field.
124 #[xml(flatten_text = "NonLinearClickThrough", cdata, default)]
125 pub non_linear_click_through: Option<std::borrow::Cow<'a, str>>,
126 /// InLine: The container for zero or one `<NonLinearClickTracking>` element.
127 /// Wrapper: The container for zero or more `<NonLinearClickTracking>` elements.
128 #[xml(child = "NonLinearClickTracking", default)]
129 pub non_linear_click_trackings: Vec<NonLinearClickTracking<'a>>,
130}
131
132/// The `<NonLinearClickTracking>` element is used to track the click for [NonLinear] ad creative.
133///
134/// ```text
135/// <xs:element name="NonLinearClickTracking">
136/// <xs:complexType>
137/// <xs:simpleContent>
138/// <xs:extension base="xs:anyURI">
139/// <xs:attribute name="id" type="xs:string" use="optional">
140/// </xs:attribute>
141/// </xs:extension>
142/// </xs:simpleContent>
143/// </xs:complexType>
144/// </xs:element>
145/// ```
146#[derive(hard_xml::XmlWrite, hard_xml::XmlRead, Default, PartialEq, Clone, Debug)]
147#[xml(tag = "NonLinearClickTracking")]
148pub struct NonLinearClickTracking<'a> {
149 /// An id provided by the ad server to track the click in reports.
150 #[xml(attr = "id", default)]
151 pub id: Option<std::borrow::Cow<'a, str>>,
152
153 /// A URI to a tracking resource file used to track a [NonLinear] clickthrough.
154 #[xml(text, cdata, default)]
155 pub uri: std::borrow::Cow<'a, str>,
156}