1
+ use chrono:: { DateTime , Utc } ;
2
+ use chrono:: serde:: ts_milliseconds;
1
3
use serde:: { Deserialize , Serialize } ;
2
4
5
+ use crate :: domain:: TargetingTag ;
6
+
3
7
#[ derive( Serialize , Deserialize , Debug , Clone ) ]
4
- pub struct AdUnit { }
8
+ #[ serde( rename_all = "camelCase" ) ]
9
+ pub struct AdUnit {
10
+ /// valid ipfs hash of spec props below
11
+ ipfs : String ,
12
+ /// the type of the ad unit
13
+ /// currently, possible values are:
14
+ /// legacy_300x250, legacy_250x250, legacy_240x400, legacy_336x280,
15
+ /// legacy_180x150, legacy_300x100, legacy_720x300, legacy_468x60,
16
+ /// legacy_234x60, legacy_88x31, legacy_120x90, legacy_120x60,
17
+ /// legacy_120x240, legacy_125x125, legacy_728x90, legacy_160x600,
18
+ /// legacy_120x600, legacy_300x600
19
+ /// see IAB ad unit guidelines and iab_flex_{adUnitName} (see IAB's new ad portfolio and PDF)
20
+ #[ serde( rename = "type" ) ]
21
+ ad_type : String ,
22
+ /// a URL to the resource (usually PNG); must use the ipfs:// protocol, to guarantee data immutability
23
+ media_url : String ,
24
+ /// MIME type of the media, possible values at the moment are: image/jpeg, image/png
25
+ media_mime : String ,
26
+ /// the advertised URL
27
+ target_url : String ,
28
+ /// an array of TargetingTag, optional
29
+ targeting : Vec < TargetingTag > ,
30
+ /// optional, Number; minimum targeting score
31
+ min_targeting_score : Option < u8 > ,
32
+ /// an array of TargetingTag, meant for discovery between publishers/advertisers
33
+ tags : Vec < TargetingTag > ,
34
+ /// user address from the session
35
+ owner : String ,
36
+ /// number, UTC timestamp in milliseconds, used as nonce for escaping duplicated spec ipfs hashes
37
+ #[ serde( with = "ts_milliseconds" ) ]
38
+ created : DateTime < Utc > ,
39
+ /// the name of the unit used in platform UI
40
+ title : String ,
41
+ /// arbitrary text used in platform UI
42
+ description : String ,
43
+ /// user can change it - used for filtering in platform UI
44
+ archived : bool ,
45
+ /// UTC timestamp in milliseconds, changed every time modifiable property is changed
46
+ #[ serde( with = "ts_milliseconds" ) ]
47
+ modified : DateTime < Utc > ,
48
+
49
+ }
0 commit comments