Skip to main content

pipedrive_rs/models/
add_call_log_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 AddCallLogRequest {
16    /// The ID of the owner of the call log. Please note that a user without account settings access cannot create call logs for other users.
17    #[serde(rename = "user_id", skip_serializing_if = "Option::is_none")]
18    pub user_id: Option<i32>,
19    /// If specified, this activity will be converted into a call log, with the information provided. When this field is used, you don't need to specify `deal_id`, `person_id` or `org_id`, as they will be ignored in favor of the values already available in the activity. The `activity_id` must refer to a `call` type activity.
20    #[serde(rename = "activity_id", skip_serializing_if = "Option::is_none")]
21    pub activity_id: Option<i32>,
22    /// The name of the activity this call is attached to
23    #[serde(rename = "subject", skip_serializing_if = "Option::is_none")]
24    pub subject: Option<String>,
25    /// The duration of the call in seconds
26    #[serde(rename = "duration", skip_serializing_if = "Option::is_none")]
27    pub duration: Option<String>,
28    /// Describes the outcome of the call
29    #[serde(rename = "outcome")]
30    pub outcome: Outcome,
31    /// The number that made the call
32    #[serde(rename = "from_phone_number", skip_serializing_if = "Option::is_none")]
33    pub from_phone_number: Option<String>,
34    /// The number called
35    #[serde(rename = "to_phone_number")]
36    pub to_phone_number: String,
37    /// The date and time of the start of the call in UTC. Format: YYYY-MM-DD HH:MM:SS.
38    #[serde(rename = "start_time")]
39    pub start_time: String,
40    /// The date and time of the end of the call in UTC. Format: YYYY-MM-DD HH:MM:SS.
41    #[serde(rename = "end_time")]
42    pub end_time: String,
43    /// The ID of the person this call is associated with
44    #[serde(rename = "person_id", skip_serializing_if = "Option::is_none")]
45    pub person_id: Option<i32>,
46    /// The ID of the organization this call is associated with
47    #[serde(rename = "org_id", skip_serializing_if = "Option::is_none")]
48    pub org_id: Option<i32>,
49    /// The ID of the deal this call is associated with
50    #[serde(rename = "deal_id", skip_serializing_if = "Option::is_none")]
51    pub deal_id: Option<i32>,
52    /// The note for the call log in HTML format
53    #[serde(rename = "note", skip_serializing_if = "Option::is_none")]
54    pub note: Option<String>,
55}
56
57impl AddCallLogRequest {
58    pub fn new(outcome: Outcome, to_phone_number: String, start_time: String, end_time: String) -> AddCallLogRequest {
59        AddCallLogRequest {
60            user_id: None,
61            activity_id: None,
62            subject: None,
63            duration: None,
64            outcome,
65            from_phone_number: None,
66            to_phone_number,
67            start_time,
68            end_time,
69            person_id: None,
70            org_id: None,
71            deal_id: None,
72            note: None,
73        }
74    }
75}
76
77/// Describes the outcome of the call
78#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
79pub enum Outcome {
80    #[serde(rename = "connected")]
81    Connected,
82    #[serde(rename = "no_answer")]
83    NoAnswer,
84    #[serde(rename = "left_message")]
85    LeftMessage,
86    #[serde(rename = "left_voicemail")]
87    LeftVoicemail,
88    #[serde(rename = "wrong_number")]
89    WrongNumber,
90    #[serde(rename = "busy")]
91    Busy,
92}
93
94impl Default for Outcome {
95    fn default() -> Outcome {
96        Self::Connected
97    }
98}
99