Skip to content

Commit b377278

Browse files
author
Ivo Georgiev
authored
Merge pull request #41 from AdExNetwork/issue-28-AdUnit
Issue #28 AdUnit
2 parents 9028483 + 0df7ec5 commit b377278

File tree

1 file changed

+50
-1
lines changed

1 file changed

+50
-1
lines changed

sentry/src/domain/ad_unit.rs

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,53 @@
1+
use chrono::{DateTime, Utc};
2+
use chrono::serde::ts_milliseconds;
13
use serde::{Deserialize, Serialize};
24

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

0 commit comments

Comments
 (0)