1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/// 3.2.14 Object: App
///
/// This object should be included if the ad supported content is a non-browser application
/// (typically in mobile) as opposed to a website. A bid request must not contain both an App and a
/// Site object. At a minimum, it is useful to provide an App ID or bundle, but this is not strictly
/// required.
#[derive(serde::Serialize, serde::Deserialize, Default, Debug, PartialEq, Clone)]
pub struct App {
/// string; recommended
/// Exchange-specific app ID.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
/// string
/// App name (may be aliased at the publisher’s request).
#[serde(default, skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
/// string
/// A platform-specific application identifier intended to be unique to the app and independent
/// of the exchange. On Android, this should be a bundle or package name (e.g.,
/// com.foo.mygame). On iOS, it is typically a numeric ID.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub bundle: Option<String>,
/// string
/// Domain of the app (e.g., “mygame.foo.com”).
#[serde(default, skip_serializing_if = "Option::is_none")]
pub domain: Option<String>,
/// string
/// App store URL for an installed app; for IQG 2.1 compliance.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub storeurl: Option<String>,
/// string array
/// Array of IAB content categories of the app. Refer to List 5.1.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub cat: Option<Vec<crate::ContentCategory>>,
/// string array
/// Array of IAB content categories that describe the current section of the app. Refer to List
/// 5.1.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub sectioncat: Option<Vec<crate::ContentCategory>>,
/// string array
/// Array of IAB content categories that describe the current page or view of the app. Refer to
/// List 5.1.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub pagecat: Option<Vec<crate::ContentCategory>>,
/// string
/// Application version.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub ver: Option<String>,
/// integer
/// Indicates if the app has a privacy policy, where 0 = no, 1 = yes.
#[serde(
default,
skip_serializing_if = "Option::is_none",
with = "crate::serde::i32_as_opt_bool"
)]
pub privacypolicy: Option<bool>,
/// integer
/// 0 = app is free, 1 = the app is a paid version.
#[serde(
default,
skip_serializing_if = "Option::is_none",
with = "crate::serde::i32_as_opt_bool"
)]
pub paid: Option<bool>,
/// object
/// Details about the Publisher (Section 3.2.15) of the app.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub publisher: Option<crate::Publisher>,
/// object
/// Details about the Content (Section 3.2.16) within the app.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub content: Option<crate::Content>,
/// string
/// Comma separated list of keywords about the app.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub keywords: Option<String>,
/// object
/// Placeholder for exchange-specific extensions to OpenRTB.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub ext: Option<serde_json::Map<String, serde_json::Value>>,
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn json() -> serde_json::Result<()> {
let json = "{}";
let o1 = App::default();
assert_eq!(serde_json::to_string(&o1)?, json);
assert_eq!(o1, serde_json::from_str::<App>(json)?);
Ok(())
}
}