pipedrive_rs/models/create_field_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 CreateFieldRequest {
16 /// The name of the field
17 #[serde(rename = "name")]
18 pub name: String,
19 /// When `field_type` is either set or enum, possible options must be supplied as a JSON-encoded sequential array of objects. Example: `[{\"label\":\"New Item\"}]`
20 #[serde(rename = "options", skip_serializing_if = "Option::is_none")]
21 pub options: Option<String>,
22 /// Whether the field is available in the 'add new' modal or not (both in the web and mobile app)
23 #[serde(rename = "add_visible_flag", skip_serializing_if = "Option::is_none")]
24 pub add_visible_flag: Option<bool>,
25 /// The type of the field<table><tr><th>Value</th><th>Description</th></tr><tr><td>`address`</td><td>Address field (has multiple subfields, autocompleted by Google Maps)</td></tr><tr><td>`date`</td><td>Date (format YYYY-MM-DD)</td></tr><tr><td>`daterange`</td><td>Date-range field (has a start date and end date value, both YYYY-MM-DD)</td></tr><tr><td>`double`</td><td>Numeric value</td></tr><tr><td>`enum`</td><td>Options field with a single possible chosen option</td></tr><tr></tr><tr><td>`monetary`</td><td>Monetary field (has a numeric value and a currency value)</td></tr><tr><td>`org`</td><td>Organization field (contains an organization ID which is stored on the same account)</td></tr><tr><td>`people`</td><td>Person field (contains a person ID which is stored on the same account)</td></tr><tr><td>`phone`</td><td>Phone field (up to 255 numbers and/or characters)</td></tr><tr><td>`set`</td><td>Options field with a possibility of having multiple chosen options</td></tr><tr><td>`text`</td><td>Long text (up to 65k characters)</td></tr><tr><td>`time`</td><td>Time field (format HH:MM:SS)</td></tr><tr><td>`timerange`</td><td>Time-range field (has a start time and end time value, both HH:MM:SS)</td></tr><tr><td>`user`</td><td>User field (contains a user ID of another Pipedrive user)</td></tr><tr><td>`varchar`</td><td>Text (up to 255 characters)</td></tr><tr><td>`varchar_auto`</td><td>Autocomplete text (up to 255 characters)</td></tr><tr><td>`visible_to`</td><td>System field that keeps item's visibility setting</td></tr></table>
26 #[serde(rename = "field_type")]
27 pub field_type: FieldType,
28}
29
30impl CreateFieldRequest {
31 pub fn new(name: String, field_type: FieldType) -> CreateFieldRequest {
32 CreateFieldRequest {
33 name,
34 options: None,
35 add_visible_flag: None,
36 field_type,
37 }
38 }
39}
40
41/// The type of the field<table><tr><th>Value</th><th>Description</th></tr><tr><td>`address`</td><td>Address field (has multiple subfields, autocompleted by Google Maps)</td></tr><tr><td>`date`</td><td>Date (format YYYY-MM-DD)</td></tr><tr><td>`daterange`</td><td>Date-range field (has a start date and end date value, both YYYY-MM-DD)</td></tr><tr><td>`double`</td><td>Numeric value</td></tr><tr><td>`enum`</td><td>Options field with a single possible chosen option</td></tr><tr></tr><tr><td>`monetary`</td><td>Monetary field (has a numeric value and a currency value)</td></tr><tr><td>`org`</td><td>Organization field (contains an organization ID which is stored on the same account)</td></tr><tr><td>`people`</td><td>Person field (contains a person ID which is stored on the same account)</td></tr><tr><td>`phone`</td><td>Phone field (up to 255 numbers and/or characters)</td></tr><tr><td>`set`</td><td>Options field with a possibility of having multiple chosen options</td></tr><tr><td>`text`</td><td>Long text (up to 65k characters)</td></tr><tr><td>`time`</td><td>Time field (format HH:MM:SS)</td></tr><tr><td>`timerange`</td><td>Time-range field (has a start time and end time value, both HH:MM:SS)</td></tr><tr><td>`user`</td><td>User field (contains a user ID of another Pipedrive user)</td></tr><tr><td>`varchar`</td><td>Text (up to 255 characters)</td></tr><tr><td>`varchar_auto`</td><td>Autocomplete text (up to 255 characters)</td></tr><tr><td>`visible_to`</td><td>System field that keeps item's visibility setting</td></tr></table>
42#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
43pub enum FieldType {
44 #[serde(rename = "address")]
45 Address,
46 #[serde(rename = "date")]
47 Date,
48 #[serde(rename = "daterange")]
49 Daterange,
50 #[serde(rename = "double")]
51 Double,
52 #[serde(rename = "enum")]
53 Enum,
54 #[serde(rename = "monetary")]
55 Monetary,
56 #[serde(rename = "org")]
57 Org,
58 #[serde(rename = "people")]
59 People,
60 #[serde(rename = "phone")]
61 Phone,
62 #[serde(rename = "set")]
63 Set,
64 #[serde(rename = "text")]
65 Text,
66 #[serde(rename = "time")]
67 Time,
68 #[serde(rename = "timerange")]
69 Timerange,
70 #[serde(rename = "user")]
71 User,
72 #[serde(rename = "varchar")]
73 Varchar,
74 #[serde(rename = "varchar_auto")]
75 VarcharAuto,
76 #[serde(rename = "visible_to")]
77 VisibleTo,
78}
79
80impl Default for FieldType {
81 fn default() -> FieldType {
82 Self::Address
83 }
84}
85