pipedrive_rs/models/
add_deal_request.rs

1/*
2 * Pipedrive API v1
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 1.0.0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12
13
14#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
15pub struct AddDealRequest {
16    /// The title of the deal
17    #[serde(rename = "title")]
18    pub title: String,
19    /// The value of the deal. If omitted, value will be set to 0.
20    #[serde(rename = "value", skip_serializing_if = "Option::is_none")]
21    pub value: Option<String>,
22    /// The currency of the deal. Accepts a 3-character currency code. If omitted, currency will be set to the default currency of the authorized user.
23    #[serde(rename = "currency", skip_serializing_if = "Option::is_none")]
24    pub currency: Option<String>,
25    /// The ID of the user which will be the owner of the created deal. If not provided, the user making the request will be used.
26    #[serde(rename = "user_id", skip_serializing_if = "Option::is_none")]
27    pub user_id: Option<i32>,
28    /// The ID of a person which this deal will be linked to. If the person does not exist yet, it needs to be created first. This property is required unless `org_id` is specified.
29    #[serde(rename = "person_id", skip_serializing_if = "Option::is_none")]
30    pub person_id: Option<i32>,
31    /// The ID of an organization which this deal will be linked to. If the organization does not exist yet, it needs to be created first. This property is required unless `person_id` is specified.
32    #[serde(rename = "org_id", skip_serializing_if = "Option::is_none")]
33    pub org_id: Option<i32>,
34    /// The ID of the pipeline this deal will be added to. By default, the deal will be added to the first stage of the specified pipeline. Please note that `pipeline_id` and `stage_id` should not be used together as `pipeline_id` will be ignored.
35    #[serde(rename = "pipeline_id", skip_serializing_if = "Option::is_none")]
36    pub pipeline_id: Option<i32>,
37    /// The ID of the stage this deal will be added to. Please note that a pipeline will be assigned automatically based on the `stage_id`. If omitted, the deal will be placed in the first stage of the default pipeline.
38    #[serde(rename = "stage_id", skip_serializing_if = "Option::is_none")]
39    pub stage_id: Option<i32>,
40    /// open = Open, won = Won, lost = Lost, deleted = Deleted. If omitted, status will be set to open.
41    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
42    pub status: Option<Status>,
43    /// The optional creation date & time of the deal in UTC. Requires admin user API token. Format: YYYY-MM-DD HH:MM:SS
44    #[serde(rename = "add_time", skip_serializing_if = "Option::is_none")]
45    pub add_time: Option<String>,
46    /// The expected close date of the deal. In ISO 8601 format: YYYY-MM-DD.
47    #[serde(rename = "expected_close_date", skip_serializing_if = "Option::is_none")]
48    pub expected_close_date: Option<String>,
49    /// The success probability percentage of the deal. Used/shown only when `deal_probability` for the pipeline of the deal is enabled.
50    #[serde(rename = "probability", skip_serializing_if = "Option::is_none")]
51    pub probability: Option<f32>,
52    /// The optional message about why the deal was lost (to be used when status = lost)
53    #[serde(rename = "lost_reason", skip_serializing_if = "Option::is_none")]
54    pub lost_reason: Option<String>,
55    #[serde(rename = "visible_to", skip_serializing_if = "Option::is_none")]
56    pub visible_to: Option<VisibleTo>,
57}
58
59impl AddDealRequest {
60    pub fn new(title: String) -> AddDealRequest {
61        AddDealRequest {
62            title,
63            value: None,
64            currency: None,
65            user_id: None,
66            person_id: None,
67            org_id: None,
68            pipeline_id: None,
69            stage_id: None,
70            status: None,
71            add_time: None,
72            expected_close_date: None,
73            probability: None,
74            lost_reason: None,
75            visible_to: None,
76        }
77    }
78}
79
80/// open = Open, won = Won, lost = Lost, deleted = Deleted. If omitted, status will be set to open.
81#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
82pub enum Status {
83    #[serde(rename = "open")]
84    Open,
85    #[serde(rename = "won")]
86    Won,
87    #[serde(rename = "lost")]
88    Lost,
89    #[serde(rename = "deleted")]
90    Deleted,
91}
92
93impl Default for Status {
94    fn default() -> Status {
95        Self::Open
96    }
97}
98/// 
99#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
100pub enum VisibleTo {
101    #[serde(rename = "1")]
102    Variant1,
103    #[serde(rename = "3")]
104    Variant3,
105    #[serde(rename = "5")]
106    Variant5,
107    #[serde(rename = "7")]
108    Variant7,
109}
110
111impl Default for VisibleTo {
112    fn default() -> VisibleTo {
113        Self::Variant1
114    }
115}
116