pipedrive_rs/models/
add_product_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 AddProductRequest {
16    /// The name of the product
17    #[serde(rename = "name")]
18    pub name: String,
19    /// The product code
20    #[serde(rename = "code", skip_serializing_if = "Option::is_none")]
21    pub code: Option<String>,
22    /// The unit in which this product is sold
23    #[serde(rename = "unit", skip_serializing_if = "Option::is_none")]
24    pub unit: Option<String>,
25    /// The tax percentage
26    #[serde(rename = "tax", skip_serializing_if = "Option::is_none")]
27    pub tax: Option<f32>,
28    /// Whether this product will be made active or not
29    #[serde(rename = "active_flag", skip_serializing_if = "Option::is_none")]
30    pub active_flag: Option<bool>,
31    /// Whether this product can be selected in deals or not
32    #[serde(rename = "selectable", skip_serializing_if = "Option::is_none")]
33    pub selectable: Option<bool>,
34    #[serde(rename = "visible_to", skip_serializing_if = "Option::is_none")]
35    pub visible_to: Option<VisibleTo>,
36    /// The ID of the user who will be marked as the owner of this product. When omitted, the authorized user ID will be used.
37    #[serde(rename = "owner_id", skip_serializing_if = "Option::is_none")]
38    pub owner_id: Option<i32>,
39    /// An array of objects, each containing: `currency` (string), `price` (number), `cost` (number, optional), `overhead_cost` (number, optional). Note that there can only be one price per product per currency. When `prices` is omitted altogether, a default price of 0 and a default currency based on the company's currency will be assigned.
40    #[serde(rename = "prices", skip_serializing_if = "Option::is_none")]
41    pub prices: Option<Vec<serde_json::Value>>,
42}
43
44impl AddProductRequest {
45    pub fn new(name: String) -> AddProductRequest {
46        AddProductRequest {
47            name,
48            code: None,
49            unit: None,
50            tax: None,
51            active_flag: None,
52            selectable: None,
53            visible_to: None,
54            owner_id: None,
55            prices: None,
56        }
57    }
58}
59
60/// 
61#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
62pub enum VisibleTo {
63    #[serde(rename = "1")]
64    Variant1,
65    #[serde(rename = "3")]
66    Variant3,
67    #[serde(rename = "5")]
68    Variant5,
69    #[serde(rename = "7")]
70    Variant7,
71}
72
73impl Default for VisibleTo {
74    fn default() -> VisibleTo {
75        Self::Variant1
76    }
77}
78