openrtb2/source.rs
1/// 3.2.2 Object: Source
2///
3/// This object describes the nature and behavior of the entity that is the source of the bid
4/// request upstream from the exchange. The primary purpose of this object is to define post-auction
5/// or upstream decisioning when the exchange itself does not control the final decision. A common
6/// example of this is header bidding, but it can also apply to upstream server entities such as
7/// another RTB exchange, a mediation platform, or an ad server combines direct campaigns with 3rd
8/// party demand in decisioning.
9#[derive(serde::Serialize, serde::Deserialize, Default, Debug, PartialEq, Clone)]
10pub struct Source {
11 /// integer; recommended
12 /// Entity responsible for the final impression sale decision, where 0 = exchange, 1 = upstream
13 /// source.
14 #[serde(
15 default,
16 skip_serializing_if = "Option::is_none",
17 with = "crate::serde::i32_as_opt_bool"
18 )]
19 pub fd: Option<bool>,
20
21 /// string; recommended
22 /// Transaction ID that must be common across all participants in this bid request (e.g.,
23 /// potentially multiple exchanges).
24 #[serde(default, skip_serializing_if = "Option::is_none")]
25 pub tid: Option<String>,
26
27 /// string; recommended
28 /// Payment ID chain string containing embedded syntax described in the TAG Payment ID Protocol
29 /// v1.0.
30 #[serde(default, skip_serializing_if = "Option::is_none")]
31 pub pchain: Option<String>,
32
33 /// object
34 /// Placeholder for exchange-specific extensions to OpenRTB.
35 #[serde(default, skip_serializing_if = "Option::is_none")]
36 pub ext: Option<serde_json::Map<String, serde_json::Value>>,
37}
38
39#[cfg(test)]
40mod test {
41 use super::*;
42
43 #[test]
44 fn json() -> serde_json::Result<()> {
45 let json = "{}";
46 let o1 = Source::default();
47 assert_eq!(serde_json::to_string(&o1)?, json);
48 assert_eq!(o1, serde_json::from_str::<Source>(json)?);
49
50 Ok(())
51 }
52}