ghl_models/v3/custom_fields.rs
1//! `custom-fields` data models for GoHighLevel API V3 (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 /// (Optional here so responses that omit it still parse.)
136 #[serde(default, skip_serializing_if = "Option::is_none")]
137 pub succeded: Option<bool>,
138 /// Required by the API.
139 /// (Optional here so responses that omit it still parse.)
140 #[serde(default, skip_serializing_if = "Option::is_none")]
141 pub id: Option<String>,
142 /// Required by the API.
143 /// (Optional here so responses that omit it still parse.)
144 #[serde(default, skip_serializing_if = "Option::is_none")]
145 pub key: Option<String>,
146}
147
148/// `ICustomField` from the GoHighLevel OpenAPI spec.
149#[derive(Debug, Clone, Default, Serialize, Deserialize)]
150pub struct ICustomField {
151 /// Location Id
152 /// Required by the API.
153 /// (Optional here so responses that omit it still parse.)
154 #[serde(
155 rename = "locationId",
156 default,
157 skip_serializing_if = "Option::is_none"
158 )]
159 pub location_id: Option<String>,
160 /// Field name
161 #[serde(default, skip_serializing_if = "Option::is_none")]
162 pub name: Option<String>,
163 /// Description of the field
164 #[serde(default, skip_serializing_if = "Option::is_none")]
165 pub description: Option<String>,
166 /// Placeholder text for the field
167 #[serde(default, skip_serializing_if = "Option::is_none")]
168 pub placeholder: Option<String>,
169 /// Whether the field should be shown in forms
170 /// Required by the API.
171 /// (Optional here so responses that omit it still parse.)
172 #[serde(
173 rename = "showInForms",
174 default,
175 skip_serializing_if = "Option::is_none"
176 )]
177 pub show_in_forms: Option<bool>,
178 /// Options for the field (Optional, valid only for SINGLE_OPTIONS, MULTIPLE_OPTIONS, RADIO,
179 /// CHECKBOX, TEXTBOX_LIST type)
180 #[serde(default, skip_serializing_if = "Vec::is_empty")]
181 pub options: Vec<OptionDTO>,
182 /// Allowed file formats for uploads. Options include: .pdf, .docx, .doc, .jpg, .jpeg, .png,
183 /// .gif, .csv, .xlsx, .xls, all
184 /// Allowed values: `.pdf`, `.docx`, `.doc`, `.jpg`, `.jpeg`, `.png`, `.gif`, `.csv`,
185 /// `.xlsx`, `.xls`, `all`.
186 #[serde(
187 rename = "acceptedFormats",
188 default,
189 skip_serializing_if = "Option::is_none"
190 )]
191 pub accepted_formats: Option<String>,
192 /// Unique identifier of the object
193 /// Required by the API.
194 /// (Optional here so responses that omit it still parse.)
195 #[serde(default, skip_serializing_if = "Option::is_none")]
196 pub id: Option<String>,
197 /// The key for your custom / standard object. This key uniquely identifies the custom
198 /// object. Example: "custom_object.pet" for a custom object related to pets.
199 /// Required by the API.
200 /// (Optional here so responses that omit it still parse.)
201 #[serde(rename = "objectKey", default, skip_serializing_if = "Option::is_none")]
202 pub object_key: Option<String>,
203 /// Type of field that you are trying to create
204 /// Allowed values: `TEXT`, `LARGE_TEXT`, `NUMERICAL`, `PHONE`, `MONETORY`, `CHECKBOX`,
205 /// `SINGLE_OPTIONS`, `MULTIPLE_OPTIONS`, `DATE`, `TEXTBOX_LIST`, `FILE_UPLOAD`, `RADIO`.
206 /// Required by the API.
207 /// (Optional here so responses that omit it still parse.)
208 #[serde(rename = "dataType", default, skip_serializing_if = "Option::is_none")]
209 pub data_type: Option<String>,
210 /// ID of the parent folder
211 /// Required by the API.
212 /// (Optional here so responses that omit it still parse.)
213 #[serde(rename = "parentId", default, skip_serializing_if = "Option::is_none")]
214 pub parent_id: Option<String>,
215 /// Field key. For Custom Object it's formatted as "custom_object.{objectKey}.{fieldKey}".
216 /// "custom_object" is a fixed prefix, "{objectKey}" is your custom object's identifier, and
217 /// "{fieldName}" is the unique field name within that object. Example:
218 /// "custom_object.pet.name" for a "name" field in a "pet" custom object.
219 /// Required by the API.
220 /// (Optional here so responses that omit it still parse.)
221 #[serde(rename = "fieldKey", default, skip_serializing_if = "Option::is_none")]
222 pub field_key: Option<String>,
223 /// Determines if users can add a custom option value different from the predefined options
224 /// in records for RADIO type fields. A custom value added in one record does not
225 /// automatically become an option and will not appear as an option for other records.
226 #[serde(
227 rename = "allowCustomOption",
228 default,
229 skip_serializing_if = "Option::is_none"
230 )]
231 pub allow_custom_option: Option<bool>,
232 /// Maximum file limit for uploads
233 #[serde(
234 rename = "maxFileLimit",
235 default,
236 skip_serializing_if = "Option::is_none"
237 )]
238 pub max_file_limit: Option<f64>,
239 /// Date and time when the object was added
240 /// Format: date-time (ISO-8601 string).
241 /// Required by the API.
242 /// (Optional here so responses that omit it still parse.)
243 #[serde(rename = "dateAdded", default, skip_serializing_if = "Option::is_none")]
244 pub date_added: Option<String>,
245 /// Date and time when the object was last updated
246 /// Format: date-time (ISO-8601 string).
247 /// Required by the API.
248 /// (Optional here so responses that omit it still parse.)
249 #[serde(
250 rename = "dateUpdated",
251 default,
252 skip_serializing_if = "Option::is_none"
253 )]
254 pub date_updated: Option<String>,
255}
256
257/// `ICustomFieldFolder` from the GoHighLevel OpenAPI spec.
258#[derive(Debug, Clone, Default, Serialize, Deserialize)]
259pub struct ICustomFieldFolder {
260 /// Unique identifier of the object
261 /// Required by the API.
262 /// (Optional here so responses that omit it still parse.)
263 #[serde(default, skip_serializing_if = "Option::is_none")]
264 pub id: Option<String>,
265 /// The key for your custom object. This key uniquely identifies the custom object. Example:
266 /// "custom_object.pet" for a custom object related to pets.
267 /// Required by the API.
268 /// (Optional here so responses that omit it still parse.)
269 #[serde(rename = "objectKey", default, skip_serializing_if = "Option::is_none")]
270 pub object_key: Option<String>,
271 /// Location Id
272 /// Required by the API.
273 /// (Optional here so responses that omit it still parse.)
274 #[serde(
275 rename = "locationId",
276 default,
277 skip_serializing_if = "Option::is_none"
278 )]
279 pub location_id: Option<String>,
280 /// Field name
281 /// Required by the API.
282 /// (Optional here so responses that omit it still parse.)
283 #[serde(default, skip_serializing_if = "Option::is_none")]
284 pub name: Option<String>,
285}
286
287/// `OptionDTO` from the GoHighLevel OpenAPI spec.
288#[derive(Debug, Clone, Default, Serialize, Deserialize)]
289pub struct OptionDTO {
290 /// Key of the option (Included in Create and Response, excluded in Update)
291 /// Required by the API.
292 /// (Optional here so responses that omit it still parse.)
293 #[serde(default, skip_serializing_if = "Option::is_none")]
294 pub key: Option<String>,
295 /// Value of the option
296 /// Required by the API.
297 /// (Optional here so responses that omit it still parse.)
298 #[serde(default, skip_serializing_if = "Option::is_none")]
299 pub label: Option<String>,
300 /// URL associated with the option (Optional, valid only for RADIO type)
301 #[serde(default, skip_serializing_if = "Option::is_none")]
302 pub url: Option<String>,
303}
304
305/// `UpdateCustomFieldsDTO` from the GoHighLevel OpenAPI spec.
306#[derive(Debug, Clone, Default, Serialize, Deserialize)]
307pub struct UpdateCustomFieldsDTO {
308 /// Location Id
309 /// Required by the API.
310 #[serde(rename = "locationId")]
311 pub location_id: String,
312 /// Field name
313 #[serde(default, skip_serializing_if = "Option::is_none")]
314 pub name: Option<String>,
315 /// Description of the field
316 #[serde(default, skip_serializing_if = "Option::is_none")]
317 pub description: Option<String>,
318 /// Placeholder text for the field
319 #[serde(default, skip_serializing_if = "Option::is_none")]
320 pub placeholder: Option<String>,
321 /// Whether the field should be shown in forms
322 /// Required by the API.
323 #[serde(rename = "showInForms")]
324 pub show_in_forms: bool,
325 /// Options for the field. Important: Providing options will completely replace the existing
326 /// options array. You must include all existing options alongside any new options you wish
327 /// to add. Removal of options is not supported through this update. Applicable only for
328 /// SINGLE_OPTIONS, MULTIPLE_OPTIONS, RADIO, CHECKBOX, TEXTBOX_LIST types.
329 #[serde(default, skip_serializing_if = "Vec::is_empty")]
330 pub options: Vec<OptionDTO>,
331 /// Allowed file formats for uploads. Options include: .pdf, .docx, .doc, .jpg, .jpeg, .png,
332 /// .gif, .csv, .xlsx, .xls, all
333 /// Allowed values: `.pdf`, `.docx`, `.doc`, `.jpg`, `.jpeg`, `.png`, `.gif`, `.csv`,
334 /// `.xlsx`, `.xls`, `all`.
335 #[serde(
336 rename = "acceptedFormats",
337 default,
338 skip_serializing_if = "Option::is_none"
339 )]
340 pub accepted_formats: Option<String>,
341 /// Maximum file limit for uploads. Applicable only for fields with a data type of
342 /// FILE_UPLOAD.
343 #[serde(
344 rename = "maxFileLimit",
345 default,
346 skip_serializing_if = "Option::is_none"
347 )]
348 pub max_file_limit: Option<f64>,
349}
350
351/// `UpdateFolder` from the GoHighLevel OpenAPI spec.
352#[derive(Debug, Clone, Default, Serialize, Deserialize)]
353pub struct UpdateFolder {
354 /// Field name
355 /// Required by the API.
356 pub name: String,
357 /// Location Id
358 /// Required by the API.
359 #[serde(rename = "locationId")]
360 pub location_id: String,
361}