pipedrive_rs/models/
add_goal_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 AddGoalRequest {
16    /// The title of the goal
17    #[serde(rename = "title", skip_serializing_if = "Option::is_none")]
18    pub title: Option<String>,
19    /// Who this goal is assigned to. It requires the following JSON structure: `{ \"id\": \"1\", \"type\": \"person\" }`. `type` can be either `person`, `company` or `team`. ID of the assignee person, company or team.
20    #[serde(rename = "assignee")]
21    pub assignee: serde_json::Value,
22    /// The type of the goal. It requires the following JSON structure: `{ \"name\": \"deals_started\", \"params\": { \"pipeline_id\": [1, 2], \"activity_type_id\": [9] } }`. Type can be one of: `deals_won`, `deals_progressed`, `activities_completed`, `activities_added`, `deals_started` or `revenue_forecast`. `params` can include `pipeline_id`, `stage_id` or `activity_type_id`. `stage_id` is related to only `deals_progressed` type of goals and `activity_type_id` to `activities_completed` or `activities_added` types of goals. The `pipeline_id` and `activity_type_id` need to be given as an array of integers. To track the goal in all pipelines, set `pipeline_id` as `null` and similarly, to track the goal for all activities, set `activity_type_id` as `null`.”
23    #[serde(rename = "type")]
24    pub r#type: serde_json::Value,
25    /// The expected outcome of the goal. Expected outcome can be tracked either by `quantity` or by `sum`. It requires the following JSON structure: `{ \"target\": \"50\", \"tracking_metric\": \"quantity\" }` or `{ \"target\": \"50\", \"tracking_metric\": \"sum\", \"currency_id\": 1 }`. `currency_id` should only be added to `sum` type of goals.
26    #[serde(rename = "expected_outcome")]
27    pub expected_outcome: serde_json::Value,
28    /// The date when the goal starts and ends. It requires the following JSON structure: `{ \"start\": \"2019-01-01\", \"end\": \"2022-12-31\" }`. Date in format of YYYY-MM-DD. \"end\" can be set to `null` for an infinite, open-ended goal.
29    #[serde(rename = "duration")]
30    pub duration: serde_json::Value,
31    /// The interval of the goal
32    #[serde(rename = "interval")]
33    pub interval: Interval,
34}
35
36impl AddGoalRequest {
37    pub fn new(assignee: serde_json::Value, r#type: serde_json::Value, expected_outcome: serde_json::Value, duration: serde_json::Value, interval: Interval) -> AddGoalRequest {
38        AddGoalRequest {
39            title: None,
40            assignee,
41            r#type,
42            expected_outcome,
43            duration,
44            interval,
45        }
46    }
47}
48
49/// The interval of the goal
50#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
51pub enum Interval {
52    #[serde(rename = "weekly")]
53    Weekly,
54    #[serde(rename = "monthly")]
55    Monthly,
56    #[serde(rename = "quarterly")]
57    Quarterly,
58    #[serde(rename = "yearly")]
59    Yearly,
60}
61
62impl Default for Interval {
63    fn default() -> Interval {
64        Self::Weekly
65    }
66}
67