pipedrive-rs 0.1.0

Rust PipedriveClient
Documentation
/*
 * Pipedrive API v1
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 1.0.0
 * 
 * Generated by: https://openapi-generator.tech
 */




#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct UpdateDealRequest {
    /// The title of the deal
    #[serde(rename = "title", skip_serializing_if = "Option::is_none")]
    pub title: Option<String>,
    /// The value of the deal.
    #[serde(rename = "value", skip_serializing_if = "Option::is_none")]
    pub value: Option<String>,
    /// The currency of the deal. Accepts a 3-character currency code.
    #[serde(rename = "currency", skip_serializing_if = "Option::is_none")]
    pub currency: Option<String>,
    /// The ID of the user which will be the new owner of the deal.
    #[serde(rename = "user_id", skip_serializing_if = "Option::is_none")]
    pub user_id: Option<i32>,
    /// 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.
    #[serde(rename = "person_id", skip_serializing_if = "Option::is_none")]
    pub person_id: Option<i32>,
    /// 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.
    #[serde(rename = "org_id", skip_serializing_if = "Option::is_none")]
    pub org_id: Option<i32>,
    /// 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.
    #[serde(rename = "pipeline_id", skip_serializing_if = "Option::is_none")]
    pub pipeline_id: Option<i32>,
    /// 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`.
    #[serde(rename = "stage_id", skip_serializing_if = "Option::is_none")]
    pub stage_id: Option<i32>,
    /// open = Open, won = Won, lost = Lost, deleted = Deleted.
    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
    pub status: Option<Status>,
    /// The expected close date of the deal. In ISO 8601 format: YYYY-MM-DD.
    #[serde(rename = "expected_close_date", skip_serializing_if = "Option::is_none")]
    pub expected_close_date: Option<String>,
    /// The success probability percentage of the deal. Used/shown only when `deal_probability` for the pipeline of the deal is enabled.
    #[serde(rename = "probability", skip_serializing_if = "Option::is_none")]
    pub probability: Option<f32>,
    /// The optional message about why the deal was lost (to be used when status = lost)
    #[serde(rename = "lost_reason", skip_serializing_if = "Option::is_none")]
    pub lost_reason: Option<String>,
    #[serde(rename = "visible_to", skip_serializing_if = "Option::is_none")]
    pub visible_to: Option<VisibleTo>,
}

impl UpdateDealRequest {
    pub fn new() -> UpdateDealRequest {
        UpdateDealRequest {
            title: None,
            value: None,
            currency: None,
            user_id: None,
            person_id: None,
            org_id: None,
            pipeline_id: None,
            stage_id: None,
            status: None,
            expected_close_date: None,
            probability: None,
            lost_reason: None,
            visible_to: None,
        }
    }
}

/// open = Open, won = Won, lost = Lost, deleted = Deleted.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
    #[serde(rename = "open")]
    Open,
    #[serde(rename = "won")]
    Won,
    #[serde(rename = "lost")]
    Lost,
    #[serde(rename = "deleted")]
    Deleted,
}

impl Default for Status {
    fn default() -> Status {
        Self::Open
    }
}
/// 
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum VisibleTo {
    #[serde(rename = "1")]
    Variant1,
    #[serde(rename = "3")]
    Variant3,
    #[serde(rename = "5")]
    Variant5,
    #[serde(rename = "7")]
    Variant7,
}

impl Default for VisibleTo {
    fn default() -> VisibleTo {
        Self::Variant1
    }
}