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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
use serde::{Deserialize, Serialize};
use serde_repr::{Deserialize_repr, Serialize_repr};
use std::collections::HashMap;

#[derive(Clone, Debug, Serialize_repr, Deserialize_repr, PartialEq)]
#[repr(u8)]
pub enum ConversionMethod {
    LastClick = 1,
}

impl Default for ConversionMethod {
    fn default() -> Self {
        ConversionMethod::LastClick
    }
}

#[derive(Copy, Clone, Debug, PartialEq, Serialize_repr, Deserialize_repr)]
#[repr(u8)]
pub enum CreativeType {
    Banner = 0,
    Video = 1,
    Native = 2,
}

impl Default for CreativeType {
    fn default() -> Self {
        CreativeType::Banner
    }
}

#[derive(Clone, Debug, Serialize_repr, Deserialize_repr, PartialEq)]
#[repr(u8)]
pub enum BudgetType {
    Spend = 0,
    Impressions = 1,
    SpendWithVendorFees = 2,
}

impl Default for BudgetType {
    fn default() -> Self {
        BudgetType::Spend
    }
}

#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
pub struct FrequencyCap {
    /// Duration of time in which to cap impressions, in seconds. 30-day (2592000) max.
    pub duration: Option<u64>,

    /// Number of impressions to allow within the duration set
    pub impressions: Option<u64>,
}

#[derive(Clone, Debug, Serialize_repr, Deserialize_repr, PartialEq)]
#[repr(u8)]
/// Beeswax supports flexible ways to use inbound auction data to frequency cap. Which method is
/// used depends on the frequency_cap_type field defined at the Campaign and Line Item level.
/// Important note: Not all types are supported by default and your account may need to be enabled
/// for some of the more advanced types. Please reach out to your account manager or support for
/// more details.
pub enum FrequencyCapType {
    /// Use the browser cookie OR the device ID to cap.
    Standard = 0,
    /// Use the IP address of the end-user as included in the bid request. Ignore values where the
    /// final octet is truncated or where due to GDPR or other privacy regulation we do not have
    /// consent to use the full IP address.
    IpAddress = 1,
    /// Use the browser cookie or device ID when present, then fall back to IP address when not
    /// present.
    StandardWithFallback = 2,
    /// Use an auction-provided customer ID when present, then fall back to the Standard option when
    /// customer ID is not present.
    CustomerIdWithFallback = 3,
}

impl Default for FrequencyCapType {
    fn default() -> Self {
        FrequencyCapType::Standard
    }
}

#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
pub enum RevenueType {
    CPM,
    CPC,
    CPCV,
    CPI,
    CPA,
}

#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
pub enum WeightingMethod {
    RANDOM,
    WEIGHTED,
}

#[derive(Clone, Debug, Default, Deserialize, Serialize, PartialEq)]
pub struct BiddingStratergy {
    /// The strategy to use, for example CPM.
    bidding_strategy: Option<String>,
    /// Set of keys and values specific to the bidding_strategy
    /// Each bidding_strategy supports a set of up to five keys, each of which should be passed
    /// with a value in the correct format. Values may be ints or strings. Example "cpm_bid":1.21
    values: Option<HashMap<String, f64>>,
    /// Whether the bidding_strategy is a custom strategy to your account. These are set up by the
    /// administrator.
    custom: Option<bool>,
    /// If a bidding strategy can be paced, the pacing value can be set to daily, flight, or
    /// lifetime. If it cannot be paced, then it should be set to none. The flight type may only be
    /// used if the Line Item has Line Item Flights enabled and every flight includes a budget.
    pacing: Option<String>,
}

#[derive(Clone, Serialize)]
pub enum ViewName {
    /// Categorization for advertisers (e.g. automotive)
    #[serde(rename = "advertiser_category")]
    AdvertiserCategory,
    /// A master list of all advertisers
    #[serde(rename = "advertiser_index")]
    AdvertiserIndex,
    /// List of sensitive categories to describe the advertiser (e.g. alcohol)
    #[serde(rename = "advertiser_sensitive_category")]
    AdvertiserSensitiveCategory,
    /// Advertiser objects including many fields showing updated performance results
    #[serde(rename = "advertiser_stats")]
    AdvertiserStats,
    /// Codes for user bandwidth targeting
    #[serde(rename = "bandwidth")]
    Bandwidth,
    /// List of supported bidding strategies
    #[serde(rename = "bidding_strategies")]
    BiddingStrategies,
    /// Campaign objects including many fields showing updated performance results
    #[serde(rename = "campaign_stats")]
    CampaignStats,
    /// Global list of cities and regions. Use cities_active_view view for targeting.
    #[serde(rename = "cities")]
    Cities,
    /// List of cities and regions that are enabled for targeting (subset based on countries_active
    /// view, below)
    #[serde(rename = "cities_active_view")]
    CitiesActiveView,
    /// A list of continents in which data centers exist. Used to determine where a Campaign may be
    /// eligible to serve or where a Segment Upload is uploaded.
    #[serde(rename = "continents")]
    Continents,
    /// List of all country codes. Use countries_active_view view for targeting.
    #[serde(rename = "countries")]
    Countries,
    /// List of country codes that are enabled for targeting
    #[serde(rename = "countries_active_view")]
    CountriesActiveView,
    /// Creative approval vendors
    #[serde(rename = "creative_approval_vendors")]
    CreativeApprovalVendors,
    /// Acceptable creative sizes (width and height)
    #[serde(rename = "creative_sizes")]
    CreativeSizes,
    /// Acceptable currency codes
    #[serde(rename = "currency")]
    Currency,
    /// Google Metro codes (similar to DMAs)
    #[serde(rename = "DMA")]
    Dma,
    /// Environments in which the ad may be served. 0=web, 1=in-app
    #[serde(rename = "environment_types")]
    EnvironmentTypes,
    /// Event types
    #[serde(rename = "event_types")]
    EventTypes,
    /// Types of tags supported for events (event_tag API) and segments (segment_tag API)
    #[serde(rename = "event_tag_types")]
    EventTagTypes,
    /// Inventory sources (e.g. Google)
    #[serde(rename = "inventory_source")]
    InventorySource,
    /// Line item objects including many fields showing updated performance results
    #[serde(rename = "line_item_stats")]
    LineItemStats,
    /// Line Item types (e.g. banner, mobile, video)
    #[serde(rename = "line_item_types")]
    LineItemTypes,
    /// Useful lookup data about the 100,000 most commonly seen mobile apps
    #[serde(rename = "lookup_apps")]
    LookupApps,
    /// The 100,000 most commonly seen domains
    #[serde(rename = "lookup_domains")]
    LookupDomains,
    /// The 100,000 most commonly seen combinations of site_id and placement_id
    #[serde(rename = "lookup_inventory")]
    LookupInventory,
    /// Ad server macros allowable in Creatives and Creative Templates
    #[serde(rename = "macros")]
    Macros,
    /// Acceptable mime types for Creative Asset upload
    #[serde(rename = "mime_types")]
    MimeTypes,
    /// Object types (e.g. user, creative, targeting_templates)
    #[serde(rename = "object_types")]
    ObjectTypes,
    /// Global list of regions, including US States. Use regions_active_view for targeting.
    #[serde(rename = "regions")]
    Regions,
    /// List of regions enabled for targeting.
    #[serde(rename = "regions_active_view")]
    RegionsActiveView,
    /// Fields in reporting that are calculated when a reporting request is submitted
    #[serde(rename = "report_calculated_fields")]
    ReportCalculatedFields,
    /// List of special reporting date parameters supported such as today
    #[serde(rename = "report_date_filters")]
    ReportDateFilters,
    /// List of fields per report (see reports below)
    #[serde(rename = "report_fields")]
    ReportFields,
    /// List of supported reports
    #[serde(rename = "reports")]
    Reports,
    /// Acceptable formats for uploading segment files
    #[serde(rename = "segment_file_format")]
    SegmentFileFormat,
    /// List of segments with estimated number of users in each segment per continent
    #[serde(rename = "segment_stats")]
    SegmentStats,
    /// List of possible statuses for a segment file upload
    #[serde(rename = "segment_upload_status")]
    SegmentUploadStatus,
    /// List of Banner Ad Types from OpenRTB 5.2
    #[serde(rename = "tag_types")]
    TagTypes,
    /// Types of video APIs supported
    #[serde(rename = "video_apis")]
    VideoApis,
    /// Types of video companions (static, HTML, etc)
    #[serde(rename = "video_companion_types")]
    VideoCompanionTypes,
    /// List of videos waiting to be transcoded
    #[serde(rename = "video_creative_transcoding_queue")]
    VideoCreativeTranscodingQueue,
    /// List of transcoding profiles supported
    #[serde(rename = "video_encoding_profiles")]
    VideoEncodingProfiles,
    /// Types of video protocols supported
    #[serde(rename = "video_protocols")]
    VideoProtocols,
}

#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
pub enum Continent {
    #[serde(rename = "APAC")]
    AsiaPacific,
    #[serde(rename = "EMEA")]
    Europe,
    #[serde(rename = "NAM")]
    NorthAmerica,
}

#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
pub enum Currency {
    #[serde(rename = "AUD")]
    AustralianDollar,
    #[serde(rename = "BRL")]
    BrazilianReal,
    #[serde(rename = "CAD")]
    CanadianDollar,
    #[serde(rename = "CHF")]
    SwissFranc,
    #[serde(rename = "EUR")]
    Euro,
    #[serde(rename = "GBP")]
    GreatBritishPound,
    #[serde(rename = "HKD")]
    HongKongDollar,
    #[serde(rename = "JPY")]
    JapaneseYen,
    #[serde(rename = "KRW")]
    SouthKoreanWon,
    #[serde(rename = "MXN")]
    MexicanPeso,
    #[serde(rename = "NZD")]
    NewZealandDollar,
    #[serde(rename = "SEK")]
    SwedishKrona,
    #[serde(rename = "SGD")]
    SingaporeDollar,
    #[serde(rename = "UAH")]
    UkrainianHryvnia,
    #[serde(rename = "USD")]
    UnitedStatesDollar,
}