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