Skip to main content

ghl_models/v2/
custom_fields.rs

1// @generated by xtask/generate_models.py — do not edit by hand.
2// Source: https://github.com/GoHighLevel/highlevel-api-docs
3// Doc comments are HighLevel's own field descriptions, reflowed verbatim, so
4// they aren't held to rustdoc's markdown conventions.
5#![allow(
6    missing_docs,
7    clippy::doc_lazy_continuation,
8    clippy::doc_overindented_list_items
9)]
10
11use serde::{Deserialize, Serialize};
12
13/// `CreateCustomFieldsDTO` from the GoHighLevel OpenAPI spec.
14#[derive(Debug, Clone, Default, Serialize, Deserialize)]
15pub struct CreateCustomFieldsDTO {
16    /// Location Id
17    /// Required by the API.
18    #[serde(rename = "locationId")]
19    pub location_id: String,
20    /// Field name
21    #[serde(default, skip_serializing_if = "Option::is_none")]
22    pub name: Option<String>,
23    /// Description of the field
24    #[serde(default, skip_serializing_if = "Option::is_none")]
25    pub description: Option<String>,
26    /// Placeholder text for the field
27    #[serde(default, skip_serializing_if = "Option::is_none")]
28    pub placeholder: Option<String>,
29    /// Whether the field should be shown in forms
30    /// Required by the API.
31    #[serde(rename = "showInForms")]
32    pub show_in_forms: bool,
33    /// Options for the field (Optional, valid only for SINGLE_OPTIONS, MULTIPLE_OPTIONS, RADIO,
34    /// CHECKBOX, TEXTBOX_LIST type)
35    #[serde(default, skip_serializing_if = "Vec::is_empty")]
36    pub options: Vec<OptionDTO>,
37    /// Allowed file formats for uploads. Options include: .pdf, .docx, .doc, .jpg, .jpeg, .png,
38    /// .gif, .csv, .xlsx, .xls, all
39    /// Allowed values: `.pdf`, `.docx`, `.doc`, `.jpg`, `.jpeg`, `.png`, `.gif`, `.csv`,
40    /// `.xlsx`, `.xls`, `all`.
41    #[serde(
42        rename = "acceptedFormats",
43        default,
44        skip_serializing_if = "Option::is_none"
45    )]
46    pub accepted_formats: Option<String>,
47    /// Type of field that you are trying to create
48    /// Allowed values: `TEXT`, `LARGE_TEXT`, `NUMERICAL`, `PHONE`, `MONETORY`, `CHECKBOX`,
49    /// `SINGLE_OPTIONS`, `MULTIPLE_OPTIONS`, `DATE`, `TEXTBOX_LIST`, `FILE_UPLOAD`, `RADIO`.
50    /// Required by the API.
51    #[serde(rename = "dataType")]
52    pub data_type: String,
53    /// Field key. For Custom Object it's formatted as "custom_object.{objectKey}.{fieldKey}".
54    /// "custom_object" is a fixed prefix, "{objectKey}" is your custom object's identifier, and
55    /// "{fieldKey}" is the unique field name within that object. Example:
56    /// "custom_object.pet.name" for a "name" field in a "pet" custom object.
57    /// Required by the API.
58    #[serde(rename = "fieldKey")]
59    pub field_key: String,
60    /// The key for your custom object. This key uniquely identifies the custom object. Example:
61    /// "custom_object.pet" for a custom object related to pets.
62    /// Required by the API.
63    #[serde(rename = "objectKey")]
64    pub object_key: String,
65    /// Maximum file limit for uploads. Applicable only for fields with a data type of
66    /// FILE_UPLOAD.
67    #[serde(
68        rename = "maxFileLimit",
69        default,
70        skip_serializing_if = "Option::is_none"
71    )]
72    pub max_file_limit: Option<f64>,
73    /// Determines if users can add a custom option value different from the predefined options
74    /// in records for RADIO type fields. A custom value added in one record does not
75    /// automatically become an option and will not appear as an option for other records.
76    #[serde(
77        rename = "allowCustomOption",
78        default,
79        skip_serializing_if = "Option::is_none"
80    )]
81    pub allow_custom_option: Option<bool>,
82    /// ID of the parent folder
83    /// Required by the API.
84    #[serde(rename = "parentId")]
85    pub parent_id: String,
86}
87
88/// `CreateFolder` from the GoHighLevel OpenAPI spec.
89#[derive(Debug, Clone, Default, Serialize, Deserialize)]
90pub struct CreateFolder {
91    /// The key for your custom object. This key uniquely identifies the custom object. Example:
92    /// "custom_object.pet" for a custom object related to pets.
93    /// Required by the API.
94    #[serde(rename = "objectKey")]
95    pub object_key: String,
96    /// Field name
97    /// Required by the API.
98    pub name: String,
99    /// Location Id
100    /// Required by the API.
101    #[serde(rename = "locationId")]
102    pub location_id: String,
103}
104
105/// `CustomFieldSuccessfulResponseDto` from the GoHighLevel OpenAPI spec.
106#[derive(Debug, Clone, Default, Serialize, Deserialize)]
107pub struct CustomFieldSuccessfulResponseDto {
108    #[serde(default, skip_serializing_if = "Option::is_none")]
109    pub field: Option<ICustomField>,
110}
111
112/// `CustomFieldsResponseDTO` from the GoHighLevel OpenAPI spec.
113#[derive(Debug, Clone, Default, Serialize, Deserialize)]
114pub struct CustomFieldsResponseDTO {
115    /// Custom Fields for the object.
116    #[serde(default, skip_serializing_if = "Vec::is_empty")]
117    pub fields: Vec<ICustomField>,
118    /// Custom Fields folder for the object.
119    #[serde(default, skip_serializing_if = "Vec::is_empty")]
120    pub folders: Vec<ICustomField>,
121}
122
123/// `CustomFolderDeleteResponseDto` from the GoHighLevel OpenAPI spec.
124#[derive(Debug, Clone, Default, Serialize, Deserialize)]
125pub struct CustomFolderDeleteResponseDto {
126    /// Required by the API.
127    pub succeded: bool,
128    /// Required by the API.
129    pub id: String,
130    /// Required by the API.
131    pub key: String,
132}
133
134/// `ICustomField` from the GoHighLevel OpenAPI spec.
135#[derive(Debug, Clone, Default, Serialize, Deserialize)]
136pub struct ICustomField {
137    /// Location Id
138    /// Required by the API.
139    #[serde(rename = "locationId")]
140    pub location_id: String,
141    /// Field name
142    #[serde(default, skip_serializing_if = "Option::is_none")]
143    pub name: Option<String>,
144    /// Description of the field
145    #[serde(default, skip_serializing_if = "Option::is_none")]
146    pub description: Option<String>,
147    /// Placeholder text for the field
148    #[serde(default, skip_serializing_if = "Option::is_none")]
149    pub placeholder: Option<String>,
150    /// Whether the field should be shown in forms
151    /// Required by the API.
152    #[serde(rename = "showInForms")]
153    pub show_in_forms: bool,
154    /// Options for the field (Optional, valid only for SINGLE_OPTIONS, MULTIPLE_OPTIONS, RADIO,
155    /// CHECKBOX, TEXTBOX_LIST type)
156    #[serde(default, skip_serializing_if = "Vec::is_empty")]
157    pub options: Vec<OptionDTO>,
158    /// Allowed file formats for uploads. Options include: .pdf, .docx, .doc, .jpg, .jpeg, .png,
159    /// .gif, .csv, .xlsx, .xls, all
160    /// Allowed values: `.pdf`, `.docx`, `.doc`, `.jpg`, `.jpeg`, `.png`, `.gif`, `.csv`,
161    /// `.xlsx`, `.xls`, `all`.
162    #[serde(
163        rename = "acceptedFormats",
164        default,
165        skip_serializing_if = "Option::is_none"
166    )]
167    pub accepted_formats: Option<String>,
168    /// Unique identifier of the object
169    /// Required by the API.
170    pub id: String,
171    /// The key for your custom / standard object. This key uniquely identifies the custom
172    /// object. Example: "custom_object.pet" for a custom object related to pets.
173    /// Required by the API.
174    #[serde(rename = "objectKey")]
175    pub object_key: String,
176    /// Type of field that you are trying to create
177    /// Allowed values: `TEXT`, `LARGE_TEXT`, `NUMERICAL`, `PHONE`, `MONETORY`, `CHECKBOX`,
178    /// `SINGLE_OPTIONS`, `MULTIPLE_OPTIONS`, `DATE`, `TEXTBOX_LIST`, `FILE_UPLOAD`, `RADIO`.
179    /// Required by the API.
180    #[serde(rename = "dataType")]
181    pub data_type: String,
182    /// ID of the parent folder
183    /// Required by the API.
184    #[serde(rename = "parentId")]
185    pub parent_id: String,
186    /// Field key. For Custom Object it's formatted as "custom_object.{objectKey}.{fieldKey}".
187    /// "custom_object" is a fixed prefix, "{objectKey}" is your custom object's identifier, and
188    /// "{fieldName}" is the unique field name within that object. Example:
189    /// "custom_object.pet.name" for a "name" field in a "pet" custom object.
190    /// Required by the API.
191    #[serde(rename = "fieldKey")]
192    pub field_key: String,
193    /// Determines if users can add a custom option value different from the predefined options
194    /// in records for RADIO type fields. A custom value added in one record does not
195    /// automatically become an option and will not appear as an option for other records.
196    #[serde(
197        rename = "allowCustomOption",
198        default,
199        skip_serializing_if = "Option::is_none"
200    )]
201    pub allow_custom_option: Option<bool>,
202    /// Maximum file limit for uploads
203    #[serde(
204        rename = "maxFileLimit",
205        default,
206        skip_serializing_if = "Option::is_none"
207    )]
208    pub max_file_limit: Option<f64>,
209    /// Date and time when the object was added
210    /// Format: date-time (ISO-8601 string).
211    /// Required by the API.
212    #[serde(rename = "dateAdded")]
213    pub date_added: String,
214    /// Date and time when the object was last updated
215    /// Format: date-time (ISO-8601 string).
216    /// Required by the API.
217    #[serde(rename = "dateUpdated")]
218    pub date_updated: String,
219}
220
221/// `ICustomFieldFolder` from the GoHighLevel OpenAPI spec.
222#[derive(Debug, Clone, Default, Serialize, Deserialize)]
223pub struct ICustomFieldFolder {
224    /// Unique identifier of the object
225    /// Required by the API.
226    pub id: String,
227    /// The key for your custom object. This key uniquely identifies the custom object. Example:
228    /// "custom_object.pet" for a custom object related to pets.
229    /// Required by the API.
230    #[serde(rename = "objectKey")]
231    pub object_key: String,
232    /// Location Id
233    /// Required by the API.
234    #[serde(rename = "locationId")]
235    pub location_id: String,
236    /// Field name
237    /// Required by the API.
238    pub name: String,
239}
240
241/// `OptionDTO` from the GoHighLevel OpenAPI spec.
242#[derive(Debug, Clone, Default, Serialize, Deserialize)]
243pub struct OptionDTO {
244    /// Key of the option (Included in Create and Response, excluded in Update)
245    /// Required by the API.
246    pub key: String,
247    /// Value of the option
248    /// Required by the API.
249    pub label: String,
250    /// URL associated with the option (Optional, valid only for RADIO type)
251    #[serde(default, skip_serializing_if = "Option::is_none")]
252    pub url: Option<String>,
253}
254
255/// `UpdateCustomFieldsDTO` from the GoHighLevel OpenAPI spec.
256#[derive(Debug, Clone, Default, Serialize, Deserialize)]
257pub struct UpdateCustomFieldsDTO {
258    /// Location Id
259    /// Required by the API.
260    #[serde(rename = "locationId")]
261    pub location_id: String,
262    /// Field name
263    #[serde(default, skip_serializing_if = "Option::is_none")]
264    pub name: Option<String>,
265    /// Description of the field
266    #[serde(default, skip_serializing_if = "Option::is_none")]
267    pub description: Option<String>,
268    /// Placeholder text for the field
269    #[serde(default, skip_serializing_if = "Option::is_none")]
270    pub placeholder: Option<String>,
271    /// Whether the field should be shown in forms
272    /// Required by the API.
273    #[serde(rename = "showInForms")]
274    pub show_in_forms: bool,
275    /// Options for the field. Important: Providing options will completely replace the existing
276    /// options array. You must include all existing options alongside any new options you wish
277    /// to add. Removal of options is not supported through this update. Applicable only for
278    /// SINGLE_OPTIONS, MULTIPLE_OPTIONS, RADIO, CHECKBOX, TEXTBOX_LIST types.
279    #[serde(default, skip_serializing_if = "Vec::is_empty")]
280    pub options: Vec<OptionDTO>,
281    /// Allowed file formats for uploads. Options include: .pdf, .docx, .doc, .jpg, .jpeg, .png,
282    /// .gif, .csv, .xlsx, .xls, all
283    /// Allowed values: `.pdf`, `.docx`, `.doc`, `.jpg`, `.jpeg`, `.png`, `.gif`, `.csv`,
284    /// `.xlsx`, `.xls`, `all`.
285    #[serde(
286        rename = "acceptedFormats",
287        default,
288        skip_serializing_if = "Option::is_none"
289    )]
290    pub accepted_formats: Option<String>,
291    /// Maximum file limit for uploads. Applicable only for fields with a data type of
292    /// FILE_UPLOAD.
293    #[serde(
294        rename = "maxFileLimit",
295        default,
296        skip_serializing_if = "Option::is_none"
297    )]
298    pub max_file_limit: Option<f64>,
299}
300
301/// `UpdateFolder` from the GoHighLevel OpenAPI spec.
302#[derive(Debug, Clone, Default, Serialize, Deserialize)]
303pub struct UpdateFolder {
304    /// Field name
305    /// Required by the API.
306    pub name: String,
307    /// Location Id
308    /// Required by the API.
309    #[serde(rename = "locationId")]
310    pub location_id: String,
311}