Skip to main content

late/models/
create_conversion_destination_request.rs

1/*
2 * Zernio API
3 *
4 * API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
5 *
6 * The version of the OpenAPI document: 1.0.4
7 * Contact: support@zernio.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct CreateConversionDestinationRequest {
16    /// Ad account ID. For LinkedIn: numeric (e.g. \"5123456\") or full `urn:li:sponsoredAccount:{id}` URN. For Google: numeric customer ID (e.g. \"1234567890\") or `customers/{id}` form.
17    #[serde(rename = "adAccountId")]
18    pub ad_account_id: String,
19    #[serde(rename = "name")]
20    pub name: String,
21    /// Conversion type. For LinkedIn: a unified standard event name (e.g. \"Purchase\", \"Lead\", \"AddToCart\") or a LinkedIn rule type enum (e.g. \"PURCHASE\", \"QUALIFIED_LEAD\"). For Google: a unified standard event name (Purchase, Subscribe, CompleteRegistration, Lead, Schedule) or a Google ConversionActionCategory enum value directly (e.g. \"PURCHASE\", \"SUBSCRIBE_PAID\", \"SIGNUP\", \"IMPORTED_LEAD\", \"BOOK_APPOINTMENT\"). Unknown values pass through to the platform.
22    #[serde(rename = "type")]
23    pub r#type: String,
24    /// LinkedIn only.
25    #[serde(rename = "attributionType", skip_serializing_if = "Option::is_none")]
26    pub attribution_type: Option<AttributionType>,
27    /// LinkedIn only. Default 30. 365 only allowed for LEAD, PURCHASE, ADD_TO_CART, QUALIFIED_LEAD, SUBMIT_APPLICATION rule types; the API rejects other combinations locally.
28    #[serde(
29        rename = "postClickAttributionWindowSize",
30        skip_serializing_if = "Option::is_none"
31    )]
32    pub post_click_attribution_window_size: Option<PostClickAttributionWindowSize>,
33    /// LinkedIn only. Default 7. Same 365-day-window type restriction applies as `postClickAttributionWindowSize`.
34    #[serde(
35        rename = "viewThroughAttributionWindowSize",
36        skip_serializing_if = "Option::is_none"
37    )]
38    pub view_through_attribution_window_size: Option<ViewThroughAttributionWindowSize>,
39    /// LinkedIn only. DYNAMIC (default) uses the per-event `value` from `sendConversions`. FIXED uses the rule's `value` field. NO_VALUE drops monetary value entirely.
40    #[serde(rename = "valueType", skip_serializing_if = "Option::is_none")]
41    pub value_type: Option<ValueType>,
42    #[serde(rename = "value", skip_serializing_if = "Option::is_none")]
43    pub value: Option<Box<models::CreateConversionDestinationRequestValue>>,
44    /// LinkedIn only. Controls campaign association at rule-creation time: - ALL_CAMPAIGNS: associate the rule with every active,   paused, and draft campaign in the ad account - OBJECTIVE_BASED: associate only campaigns whose   objective matches the rule's type - NONE: don't auto-associate. Manage associations via   the `/associations` endpoints below. Note: auto-association runs once at create time; new campaigns added after the rule still need explicit association.
45    #[serde(
46        rename = "autoAssociationType",
47        skip_serializing_if = "Option::is_none"
48    )]
49    pub auto_association_type: Option<AutoAssociationType>,
50    /// Google Ads only. Whether to count multiple conversions from the same click (MANY_PER_CLICK) or at most one (ONE_PER_CLICK). Defaults to MANY_PER_CLICK if omitted.
51    #[serde(rename = "countingType", skip_serializing_if = "Option::is_none")]
52    pub counting_type: Option<CountingType>,
53    /// Google Ads only. When true, the conversion action is marked as primary and immediately influences Smart Bidding. Defaults to false (secondary, record-only) to avoid unintentionally steering the customer's campaigns on creation.
54    #[serde(rename = "primaryForGoal", skip_serializing_if = "Option::is_none")]
55    pub primary_for_goal: Option<bool>,
56}
57
58impl CreateConversionDestinationRequest {
59    pub fn new(
60        ad_account_id: String,
61        name: String,
62        r#type: String,
63    ) -> CreateConversionDestinationRequest {
64        CreateConversionDestinationRequest {
65            ad_account_id,
66            name,
67            r#type,
68            attribution_type: None,
69            post_click_attribution_window_size: None,
70            view_through_attribution_window_size: None,
71            value_type: None,
72            value: None,
73            auto_association_type: None,
74            counting_type: None,
75            primary_for_goal: None,
76        }
77    }
78}
79/// LinkedIn only.
80#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
81pub enum AttributionType {
82    #[serde(rename = "LAST_TOUCH_BY_CAMPAIGN")]
83    LastTouchByCampaign,
84    #[serde(rename = "LAST_TOUCH_BY_CONVERSION")]
85    LastTouchByConversion,
86}
87
88impl Default for AttributionType {
89    fn default() -> AttributionType {
90        Self::LastTouchByCampaign
91    }
92}
93/// LinkedIn only. Default 30. 365 only allowed for LEAD, PURCHASE, ADD_TO_CART, QUALIFIED_LEAD, SUBMIT_APPLICATION rule types; the API rejects other combinations locally.
94#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
95pub enum PostClickAttributionWindowSize {
96    #[serde(rename = "1")]
97    Variant1,
98    #[serde(rename = "7")]
99    Variant7,
100    #[serde(rename = "30")]
101    Variant30,
102    #[serde(rename = "90")]
103    Variant90,
104    #[serde(rename = "365")]
105    Variant365,
106}
107
108impl Default for PostClickAttributionWindowSize {
109    fn default() -> PostClickAttributionWindowSize {
110        Self::Variant1
111    }
112}
113/// LinkedIn only. Default 7. Same 365-day-window type restriction applies as `postClickAttributionWindowSize`.
114#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
115pub enum ViewThroughAttributionWindowSize {
116    #[serde(rename = "1")]
117    Variant1,
118    #[serde(rename = "7")]
119    Variant7,
120    #[serde(rename = "30")]
121    Variant30,
122    #[serde(rename = "90")]
123    Variant90,
124    #[serde(rename = "365")]
125    Variant365,
126}
127
128impl Default for ViewThroughAttributionWindowSize {
129    fn default() -> ViewThroughAttributionWindowSize {
130        Self::Variant1
131    }
132}
133/// LinkedIn only. DYNAMIC (default) uses the per-event `value` from `sendConversions`. FIXED uses the rule's `value` field. NO_VALUE drops monetary value entirely.
134#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
135pub enum ValueType {
136    #[serde(rename = "DYNAMIC")]
137    Dynamic,
138    #[serde(rename = "FIXED")]
139    Fixed,
140    #[serde(rename = "NO_VALUE")]
141    NoValue,
142}
143
144impl Default for ValueType {
145    fn default() -> ValueType {
146        Self::Dynamic
147    }
148}
149/// LinkedIn only. Controls campaign association at rule-creation time: - ALL_CAMPAIGNS: associate the rule with every active,   paused, and draft campaign in the ad account - OBJECTIVE_BASED: associate only campaigns whose   objective matches the rule's type - NONE: don't auto-associate. Manage associations via   the `/associations` endpoints below. Note: auto-association runs once at create time; new campaigns added after the rule still need explicit association.
150#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
151pub enum AutoAssociationType {
152    #[serde(rename = "ALL_CAMPAIGNS")]
153    AllCampaigns,
154    #[serde(rename = "OBJECTIVE_BASED")]
155    ObjectiveBased,
156    #[serde(rename = "NONE")]
157    None,
158}
159
160impl Default for AutoAssociationType {
161    fn default() -> AutoAssociationType {
162        Self::AllCampaigns
163    }
164}
165/// Google Ads only. Whether to count multiple conversions from the same click (MANY_PER_CLICK) or at most one (ONE_PER_CLICK). Defaults to MANY_PER_CLICK if omitted.
166#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
167pub enum CountingType {
168    #[serde(rename = "MANY_PER_CLICK")]
169    ManyPerClick,
170    #[serde(rename = "ONE_PER_CLICK")]
171    OnePerClick,
172}
173
174impl Default for CountingType {
175    fn default() -> CountingType {
176        Self::ManyPerClick
177    }
178}