pipedrive_rs/models/
basic_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 BasicGoalRequest {
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", skip_serializing_if = "Option::is_none")]
21    pub assignee: Option<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", skip_serializing_if = "Option::is_none")]
24    pub r#type: Option<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", skip_serializing_if = "Option::is_none")]
27    pub expected_outcome: Option<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", skip_serializing_if = "Option::is_none")]
30    pub duration: Option<serde_json::Value>,
31    /// The interval of the goal
32    #[serde(rename = "interval", skip_serializing_if = "Option::is_none")]
33    pub interval: Option<Interval>,
34}
35
36impl BasicGoalRequest {
37    pub fn new() -> BasicGoalRequest {
38        BasicGoalRequest {
39            title: None,
40            assignee: None,
41            r#type: None,
42            expected_outcome: None,
43            duration: None,
44            interval: None,
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