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 AddDealRequest {
    /// The title of the deal
    #[serde(rename = "title")]
    pub title: String,
    /// The value of the deal. If omitted, value will be set to 0.
    #[serde(rename = "value", skip_serializing_if = "Option::is_none")]
    pub value: Option<String>,
    /// 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.
    #[serde(rename = "currency", skip_serializing_if = "Option::is_none")]
    pub currency: Option<String>,
    /// 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.
    #[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. This property is required unless `org_id` is specified.
    #[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. This property is required unless `person_id` is specified.
    #[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`. If omitted, the deal will be placed in the first stage of the default pipeline.
    #[serde(rename = "stage_id", skip_serializing_if = "Option::is_none")]
    pub stage_id: Option<i32>,
    /// open = Open, won = Won, lost = Lost, deleted = Deleted. If omitted, status will be set to open.
    #[serde(rename = "status", skip_serializing_if = "Option::is_none")]
    pub status: Option<Status>,
    /// The optional creation date & time of the deal in UTC. Requires admin user API token. Format: YYYY-MM-DD HH:MM:SS
    #[serde(rename = "add_time", skip_serializing_if = "Option::is_none")]
    pub add_time: Option<String>,
    /// 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 AddDealRequest {
    pub fn new(title: String) -> AddDealRequest {
        AddDealRequest {
            title,
            value: None,
            currency: None,
            user_id: None,
            person_id: None,
            org_id: None,
            pipeline_id: None,
            stage_id: None,
            status: None,
            add_time: None,
            expected_close_date: None,
            probability: None,
            lost_reason: None,
            visible_to: None,
        }
    }
}

/// open = Open, won = Won, lost = Lost, deleted = Deleted. If omitted, status will be set to open.
#[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
    }
}