Skip to main content

ghl_models/v3/
objects.rs

1//! `objects` data models for GoHighLevel API V3 (20 types).
2//!
3//! Generated from HighLevel's official OpenAPI spec for the
4//! **Objects** module. Every endpoint that uses these types, with its
5//! parameters, required scopes and enum values, is documented in the
6//! [`objects` API reference](https://github.com/Shahroz/ghl-rs/blob/main/docs/api/objects.md).
7//!
8//! Enable with `features = ["objects"]`.
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/// `CreateCustomObjectRecordDto` from the GoHighLevel OpenAPI spec.
22#[derive(Debug, Clone, Default, Serialize, Deserialize)]
23pub struct CreateCustomObjectRecordDto {
24    /// The spec defines no fields for this schema.
25    #[serde(flatten)]
26    pub extra: serde_json::Map<String, serde_json::Value>,
27}
28
29/// `CreateCustomObjectSchemaDTO` from the GoHighLevel OpenAPI spec.
30#[derive(Debug, Clone, Default, Serialize, Deserialize)]
31pub struct CreateCustomObjectSchemaDTO {
32    /// This is what your custom object will be called. These labels will be used to display
33    /// your custom object on the UI
34    /// Required by the API.
35    pub labels: CustomObjectLabelDto,
36    /// key that would be used to refer the Custom Object internally (lowercase +
37    /// underscore_separated). 'custom_objects.' would be added as prefix by default
38    /// Required by the API.
39    pub key: String,
40    /// Pet Object`s description
41    #[serde(default, skip_serializing_if = "Option::is_none")]
42    pub description: Option<String>,
43    /// Location Id
44    /// Required by the API.
45    #[serde(rename = "locationId")]
46    pub location_id: String,
47    /// Primary property which will be displayed on the record page
48    /// Required by the API.
49    #[serde(rename = "primaryDisplayPropertyDetails")]
50    pub primary_display_property_details: CustomObjectDisplayPropertyDetails,
51}
52
53/// `CreatedByResponseDTO` from the GoHighLevel OpenAPI spec.
54#[derive(Debug, Clone, Default, Serialize, Deserialize)]
55pub struct CreatedByResponseDTO {
56    /// Creation Channel
57    /// Required by the API.
58    /// (Optional here so responses that omit it still parse.)
59    #[serde(default, skip_serializing_if = "Option::is_none")]
60    pub channel: Option<String>,
61    /// Created At
62    /// Required by the API.
63    /// (Optional here so responses that omit it still parse.)
64    #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")]
65    pub created_at: Option<String>,
66    /// From where the record was created
67    /// Required by the API.
68    /// (Optional here so responses that omit it still parse.)
69    #[serde(default, skip_serializing_if = "Option::is_none")]
70    pub source: Option<String>,
71    /// User/Resource Id
72    /// Required by the API.
73    /// (Optional here so responses that omit it still parse.)
74    #[serde(rename = "sourceId", default, skip_serializing_if = "Option::is_none")]
75    pub source_id: Option<String>,
76}
77
78/// `CustomObjectByIdResponseDTO` from the GoHighLevel OpenAPI spec.
79#[derive(Debug, Clone, Default, Serialize, Deserialize)]
80pub struct CustomObjectByIdResponseDTO {
81    #[serde(default, skip_serializing_if = "Option::is_none")]
82    pub object: Option<ICustomObjectSchema>,
83    /// Is the response served from cache
84    /// Required by the API.
85    /// (Optional here so responses that omit it still parse.)
86    #[serde(default, skip_serializing_if = "Option::is_none")]
87    pub cache: Option<bool>,
88    #[serde(default, skip_serializing_if = "Vec::is_empty")]
89    pub fields: Vec<ICustomField>,
90}
91
92/// `CustomObjectDisplayPropertyDetails` from the GoHighLevel OpenAPI spec.
93#[derive(Debug, Clone, Default, Serialize, Deserialize)]
94pub struct CustomObjectDisplayPropertyDetails {
95    /// key that would be used to refer the custom field internally (lowercase +
96    /// underscore_separated). 'custom_objects.{{objectKey}}' would be added as prefix by
97    /// default is not passed
98    /// Required by the API.
99    pub key: String,
100    /// Name of the Primary property name which will be displayed on the record page
101    /// Required by the API.
102    pub name: String,
103    /// Primary property data Type (it can either be TEXT or NUMERICAL type)
104    /// Required by the API.
105    #[serde(rename = "dataType")]
106    pub data_type: String,
107}
108
109/// `CustomObjectLabelDto` from the GoHighLevel OpenAPI spec.
110#[derive(Debug, Clone, Default, Serialize, Deserialize)]
111pub struct CustomObjectLabelDto {
112    /// Singular name of the custom object
113    /// Required by the API.
114    /// (Optional here so responses that omit it still parse.)
115    #[serde(default, skip_serializing_if = "Option::is_none")]
116    pub singular: Option<String>,
117    /// Plural name of the custom object
118    /// Required by the API.
119    /// (Optional here so responses that omit it still parse.)
120    #[serde(default, skip_serializing_if = "Option::is_none")]
121    pub plural: Option<String>,
122}
123
124/// `CustomObjectLabelUpdateDto` from the GoHighLevel OpenAPI spec.
125#[derive(Debug, Clone, Default, Serialize, Deserialize)]
126pub struct CustomObjectLabelUpdateDto {
127    /// Singular name of the custom object
128    #[serde(default, skip_serializing_if = "Option::is_none")]
129    pub singular: Option<String>,
130    /// Plural name of the custom object
131    #[serde(default, skip_serializing_if = "Option::is_none")]
132    pub plural: Option<String>,
133}
134
135/// `CustomObjectListResponseDTO` from the GoHighLevel OpenAPI spec.
136#[derive(Debug, Clone, Default, Serialize, Deserialize)]
137pub struct CustomObjectListResponseDTO {
138    #[serde(default, skip_serializing_if = "Vec::is_empty")]
139    pub objects: Vec<ICustomObjectSchema>,
140}
141
142/// `CustomObjectResponseDTO` from the GoHighLevel OpenAPI spec.
143#[derive(Debug, Clone, Default, Serialize, Deserialize)]
144pub struct CustomObjectResponseDTO {
145    #[serde(default, skip_serializing_if = "Option::is_none")]
146    pub object: Option<ICustomObjectSchema>,
147}
148
149/// `ICustomField` from the GoHighLevel OpenAPI spec.
150#[derive(Debug, Clone, Default, Serialize, Deserialize)]
151pub struct ICustomField {
152    /// Location Id
153    /// Required by the API.
154    /// (Optional here so responses that omit it still parse.)
155    #[serde(
156        rename = "locationId",
157        default,
158        skip_serializing_if = "Option::is_none"
159    )]
160    pub location_id: Option<String>,
161    /// Field name
162    #[serde(default, skip_serializing_if = "Option::is_none")]
163    pub name: Option<String>,
164    /// Description of the field
165    #[serde(default, skip_serializing_if = "Option::is_none")]
166    pub description: Option<String>,
167    /// Placeholder text for the field
168    #[serde(default, skip_serializing_if = "Option::is_none")]
169    pub placeholder: Option<String>,
170    /// Whether the field should be shown in forms
171    /// Required by the API.
172    /// (Optional here so responses that omit it still parse.)
173    #[serde(
174        rename = "showInForms",
175        default,
176        skip_serializing_if = "Option::is_none"
177    )]
178    pub show_in_forms: Option<bool>,
179    /// Options for the field (Optional, valid only for SINGLE_OPTIONS, MULTIPLE_OPTIONS, RADIO,
180    /// CHECKBOX, TEXTBOX_LIST type)
181    #[serde(default, skip_serializing_if = "Vec::is_empty")]
182    pub options: Vec<OptionDTO>,
183    /// Allowed file formats for uploads. Options include: .pdf, .docx, .doc, .jpg, .jpeg, .png,
184    /// .gif, .csv, .xlsx, .xls, all
185    /// Allowed values: `.pdf`, `.docx`, `.doc`, `.jpg`, `.jpeg`, `.png`, `.gif`, `.csv`,
186    /// `.xlsx`, `.xls`, `all`.
187    #[serde(
188        rename = "acceptedFormats",
189        default,
190        skip_serializing_if = "Option::is_none"
191    )]
192    pub accepted_formats: Option<String>,
193    /// Unique identifier of the object
194    /// Required by the API.
195    /// (Optional here so responses that omit it still parse.)
196    #[serde(default, skip_serializing_if = "Option::is_none")]
197    pub id: Option<String>,
198    /// The key for your custom / standard object. This key uniquely identifies the custom
199    /// object. Example: "custom_object.pet" for a custom object related to pets.
200    /// Required by the API.
201    /// (Optional here so responses that omit it still parse.)
202    #[serde(rename = "objectKey", default, skip_serializing_if = "Option::is_none")]
203    pub object_key: Option<String>,
204    /// Type of field that you are trying to create
205    /// Allowed values: `TEXT`, `LARGE_TEXT`, `NUMERICAL`, `PHONE`, `MONETORY`, `CHECKBOX`,
206    /// `SINGLE_OPTIONS`, `MULTIPLE_OPTIONS`, `DATE`, `TEXTBOX_LIST`, `FILE_UPLOAD`, `RADIO`.
207    /// Required by the API.
208    /// (Optional here so responses that omit it still parse.)
209    #[serde(rename = "dataType", default, skip_serializing_if = "Option::is_none")]
210    pub data_type: Option<String>,
211    /// ID of the parent folder
212    /// Required by the API.
213    /// (Optional here so responses that omit it still parse.)
214    #[serde(rename = "parentId", default, skip_serializing_if = "Option::is_none")]
215    pub parent_id: Option<String>,
216    /// Field key. For Custom Object it's formatted as "custom_object.{objectKey}.{fieldKey}".
217    /// "custom_object" is a fixed prefix, "{objectKey}" is your custom object's identifier, and
218    /// "{fieldName}" is the unique field name within that object. Example:
219    /// "custom_object.pet.name" for a "name" field in a "pet" custom object.
220    /// Required by the API.
221    /// (Optional here so responses that omit it still parse.)
222    #[serde(rename = "fieldKey", default, skip_serializing_if = "Option::is_none")]
223    pub field_key: Option<String>,
224    /// Determines if users can add a custom option value different from the predefined options
225    /// in records for RADIO type fields. A custom value added in one record does not
226    /// automatically become an option and will not appear as an option for other records.
227    #[serde(
228        rename = "allowCustomOption",
229        default,
230        skip_serializing_if = "Option::is_none"
231    )]
232    pub allow_custom_option: Option<bool>,
233    /// Maximum file limit for uploads
234    #[serde(
235        rename = "maxFileLimit",
236        default,
237        skip_serializing_if = "Option::is_none"
238    )]
239    pub max_file_limit: Option<f64>,
240    /// Date and time when the object was added
241    /// Format: date-time (ISO-8601 string).
242    /// Required by the API.
243    /// (Optional here so responses that omit it still parse.)
244    #[serde(rename = "dateAdded", default, skip_serializing_if = "Option::is_none")]
245    pub date_added: Option<String>,
246    /// Date and time when the object was last updated
247    /// Format: date-time (ISO-8601 string).
248    /// Required by the API.
249    /// (Optional here so responses that omit it still parse.)
250    #[serde(
251        rename = "dateUpdated",
252        default,
253        skip_serializing_if = "Option::is_none"
254    )]
255    pub date_updated: Option<String>,
256}
257
258/// `ICustomObjectSchema` from the GoHighLevel OpenAPI spec.
259#[derive(Debug, Clone, Default, Serialize, Deserialize)]
260pub struct ICustomObjectSchema {
261    /// id of the custom / standard object schema
262    /// Required by the API.
263    /// (Optional here so responses that omit it still parse.)
264    #[serde(default, skip_serializing_if = "Option::is_none")]
265    pub id: Option<String>,
266    /// false in case of custom objects and true in case of standard objects like contacts and
267    /// opportunities
268    /// Required by the API.
269    /// (Optional here so responses that omit it still parse.)
270    #[serde(default, skip_serializing_if = "Option::is_none")]
271    pub standard: Option<bool>,
272    /// key that would be used to refer the custom / standard Object internally (lowercase +
273    /// underscore_separated). For custom objects, 'custom_objects.' would be added as prefix by
274    /// default
275    /// Required by the API.
276    /// (Optional here so responses that omit it still parse.)
277    #[serde(default, skip_serializing_if = "Option::is_none")]
278    pub key: Option<String>,
279    /// This is what your custom / standard object will be called. These labels will be used to
280    /// display your custom object on the UI
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 labels: Option<CustomObjectLabelDto>,
285    /// Custom / Standard Object Descriptions for example , Pet Object`s description
286    #[serde(default, skip_serializing_if = "Option::is_none")]
287    pub description: Option<String>,
288    /// location's id
289    /// Required by the API.
290    /// (Optional here so responses that omit it still parse.)
291    #[serde(
292        rename = "locationId",
293        default,
294        skip_serializing_if = "Option::is_none"
295    )]
296    pub location_id: Option<String>,
297    /// Primary property for the custom / standard Object. This would be used as primary data
298    /// when rendering the UI. 'custom_objects.{{object_key}} or business.{{object_key}} (for
299    /// company)' would be added as prefix by default for all the custom / standard objects
300    /// Required by the API.
301    /// (Optional here so responses that omit it still parse.)
302    #[serde(
303        rename = "primaryDisplayProperty",
304        default,
305        skip_serializing_if = "Option::is_none"
306    )]
307    pub primary_display_property: Option<String>,
308    /// Date and time when the object was added
309    /// Format: date-time (ISO-8601 string).
310    /// Required by the API.
311    /// (Optional here so responses that omit it still parse.)
312    #[serde(rename = "dateAdded", default, skip_serializing_if = "Option::is_none")]
313    pub date_added: Option<String>,
314    /// Date and time when the object was last updated
315    /// Format: date-time (ISO-8601 string).
316    /// Required by the API.
317    /// (Optional here so responses that omit it still parse.)
318    #[serde(
319        rename = "dateUpdated",
320        default,
321        skip_serializing_if = "Option::is_none"
322    )]
323    pub date_updated: Option<String>,
324    /// Object`s Type
325    #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")]
326    pub type_: Option<serde_json::Value>,
327}
328
329/// `IRecordSchema` from the GoHighLevel OpenAPI spec.
330#[derive(Debug, Clone, Default, Serialize, Deserialize)]
331pub struct IRecordSchema {
332    /// id of the record
333    /// Required by the API.
334    /// (Optional here so responses that omit it still parse.)
335    #[serde(default, skip_serializing_if = "Option::is_none")]
336    pub id: Option<String>,
337    /// Owner (User's id). Limited to 1 for now. Only Supported with custom objects
338    /// Required by the API.
339    /// (Optional here so responses that omit it still parse.)
340    #[serde(default, skip_serializing_if = "Vec::is_empty")]
341    pub owner: Vec<String>,
342    /// Follower (User's ids). Limited to 10 for now
343    /// Required by the API.
344    /// (Optional here so responses that omit it still parse.)
345    #[serde(default, skip_serializing_if = "Vec::is_empty")]
346    pub followers: Vec<String>,
347    /// Properties of the record
348    /// Required by the API.
349    /// (Optional here so responses that omit it still parse.)
350    #[serde(default, skip_serializing_if = "Option::is_none")]
351    pub properties: Option<String>,
352    /// Date and time when the object was added
353    /// Format: date-time (ISO-8601 string).
354    /// Required by the API.
355    /// (Optional here so responses that omit it still parse.)
356    #[serde(rename = "dateAdded", default, skip_serializing_if = "Option::is_none")]
357    pub date_added: Option<String>,
358    /// Date and time when the object was last updated
359    /// Format: date-time (ISO-8601 string).
360    /// Required by the API.
361    /// (Optional here so responses that omit it still parse.)
362    #[serde(
363        rename = "dateUpdated",
364        default,
365        skip_serializing_if = "Option::is_none"
366    )]
367    pub date_updated: Option<String>,
368}
369
370/// `ObjectRecordDeleteResponseDTO` from the GoHighLevel OpenAPI spec.
371#[derive(Debug, Clone, Default, Serialize, Deserialize)]
372pub struct ObjectRecordDeleteResponseDTO {
373    /// id of the deleted object
374    #[serde(default, skip_serializing_if = "Option::is_none")]
375    pub id: Option<String>,
376    /// boolean that defines if the operation was a success or not
377    #[serde(default, skip_serializing_if = "Option::is_none")]
378    pub success: Option<bool>,
379}
380
381/// `OptionDTO` from the GoHighLevel OpenAPI spec.
382#[derive(Debug, Clone, Default, Serialize, Deserialize)]
383pub struct OptionDTO {
384    /// Key of the option (Included in Create and Response, excluded in Update)
385    /// Required by the API.
386    /// (Optional here so responses that omit it still parse.)
387    #[serde(default, skip_serializing_if = "Option::is_none")]
388    pub key: Option<String>,
389    /// Value of the option
390    /// Required by the API.
391    /// (Optional here so responses that omit it still parse.)
392    #[serde(default, skip_serializing_if = "Option::is_none")]
393    pub label: Option<String>,
394    /// URL associated with the option (Optional, valid only for RADIO type)
395    #[serde(default, skip_serializing_if = "Option::is_none")]
396    pub url: Option<String>,
397}
398
399/// `RecordByIdResponseDTO` from the GoHighLevel OpenAPI spec.
400#[derive(Debug, Clone, Default, Serialize, Deserialize)]
401pub struct RecordByIdResponseDTO {
402    #[serde(default, skip_serializing_if = "Option::is_none")]
403    pub record: Option<IRecordSchema>,
404}
405
406/// `RecordResponseDTO` from the GoHighLevel OpenAPI spec.
407#[derive(Debug, Clone, Default, Serialize, Deserialize)]
408pub struct RecordResponseDTO {
409    /// id of the record
410    /// Required by the API.
411    /// (Optional here so responses that omit it still parse.)
412    #[serde(default, skip_serializing_if = "Option::is_none")]
413    pub id: Option<String>,
414    /// Owner (User's id). Limited to 1 for now . Only supported for custom objects for now
415    /// Required by the API.
416    /// (Optional here so responses that omit it still parse.)
417    #[serde(default, skip_serializing_if = "Vec::is_empty")]
418    pub owner: Vec<String>,
419    /// Follower (User's ids). Limited to 10 and supported for custom objects for now
420    /// Required by the API.
421    /// (Optional here so responses that omit it still parse.)
422    #[serde(default, skip_serializing_if = "Vec::is_empty")]
423    pub followers: Vec<String>,
424    /// Properties of the record
425    /// Required by the API.
426    /// (Optional here so responses that omit it still parse.)
427    #[serde(default, skip_serializing_if = "Option::is_none")]
428    pub properties: Option<String>,
429    /// Date and time when the object was added
430    /// Format: date-time (ISO-8601 string).
431    /// Required by the API.
432    /// (Optional here so responses that omit it still parse.)
433    #[serde(rename = "createdAt", default, skip_serializing_if = "Option::is_none")]
434    pub created_at: Option<String>,
435    /// Date and time when the object was last updated
436    /// Format: date-time (ISO-8601 string).
437    /// Required by the API.
438    /// (Optional here so responses that omit it still parse.)
439    #[serde(rename = "updatedAt", default, skip_serializing_if = "Option::is_none")]
440    pub updated_at: Option<String>,
441    /// Location Id
442    /// Required by the API.
443    /// (Optional here so responses that omit it still parse.)
444    #[serde(
445        rename = "locationId",
446        default,
447        skip_serializing_if = "Option::is_none"
448    )]
449    pub location_id: Option<String>,
450    /// ObjectId Id
451    /// Required by the API.
452    /// (Optional here so responses that omit it still parse.)
453    #[serde(rename = "objectId", default, skip_serializing_if = "Option::is_none")]
454    pub object_id: Option<String>,
455    /// ObjectId key
456    /// Required by the API.
457    /// (Optional here so responses that omit it still parse.)
458    #[serde(rename = "objectKey", default, skip_serializing_if = "Option::is_none")]
459    pub object_key: Option<String>,
460    /// Created By Meta
461    /// Required by the API.
462    /// (Optional here so responses that omit it still parse.)
463    #[serde(rename = "createdBy", default, skip_serializing_if = "Option::is_none")]
464    pub created_by: Option<CreatedByResponseDTO>,
465    /// Last Updated By Meta
466    /// Required by the API.
467    /// (Optional here so responses that omit it still parse.)
468    #[serde(
469        rename = "lastUpdatedBy",
470        default,
471        skip_serializing_if = "Option::is_none"
472    )]
473    pub last_updated_by: Option<CreatedByResponseDTO>,
474    /// Required by the API.
475    /// (Optional here so responses that omit it still parse.)
476    #[serde(rename = "searchAfter", default, skip_serializing_if = "Vec::is_empty")]
477    pub search_after: Vec<f64>,
478}
479
480/// `SearchRecordResponseDTO` from the GoHighLevel OpenAPI spec.
481#[derive(Debug, Clone, Default, Serialize, Deserialize)]
482pub struct SearchRecordResponseDTO {
483    /// Records
484    #[serde(default, skip_serializing_if = "Vec::is_empty")]
485    pub records: Vec<RecordResponseDTO>,
486    /// Total Number of records
487    /// Required by the API.
488    /// (Optional here so responses that omit it still parse.)
489    #[serde(default, skip_serializing_if = "Option::is_none")]
490    pub total: Option<f64>,
491}
492
493/// `SearchRecordsBody` from the GoHighLevel OpenAPI spec.
494#[derive(Debug, Clone, Default, Serialize, Deserialize)]
495pub struct SearchRecordsBody {
496    /// Location Id
497    /// Required by the API.
498    #[serde(rename = "locationId")]
499    pub location_id: String,
500    /// Page
501    /// Required by the API.
502    pub page: f64,
503    /// Page Limit
504    /// Required by the API.
505    #[serde(rename = "pageLimit")]
506    pub page_limit: f64,
507    /// Pass this query parameter to search using your searchable properties. For example, if
508    /// you have a custom object called “Pets” and have configured “name” as a searchable
509    /// property, you can pass name:Buddy to search for pets with the name “Buddy.”
510    /// Required by the API.
511    pub query: String,
512    /// Required by the API.
513    #[serde(rename = "searchAfter", default, skip_serializing_if = "Vec::is_empty")]
514    pub search_after: Vec<String>,
515}
516
517/// `UpdateCustomObjectRecordDto` from the GoHighLevel OpenAPI spec.
518#[derive(Debug, Clone, Default, Serialize, Deserialize)]
519pub struct UpdateCustomObjectRecordDto {
520    /// The spec defines no fields for this schema.
521    #[serde(flatten)]
522    pub extra: serde_json::Map<String, serde_json::Value>,
523}
524
525/// `UpdateCustomObjectSchemaDTO` from the GoHighLevel OpenAPI spec.
526#[derive(Debug, Clone, Default, Serialize, Deserialize)]
527pub struct UpdateCustomObjectSchemaDTO {
528    /// This is how your custom object will be displayed
529    #[serde(default, skip_serializing_if = "Option::is_none")]
530    pub labels: Option<CustomObjectLabelUpdateDto>,
531    /// Pet Object`s description
532    #[serde(default, skip_serializing_if = "Option::is_none")]
533    pub description: Option<String>,
534    /// location id
535    /// Required by the API.
536    #[serde(rename = "locationId")]
537    pub location_id: String,
538    /// Searchable Fields: Provide the field key of your object that you want to search on,
539    /// using the format (custom_object. . ).
540    /// Required by the API.
541    #[serde(
542        rename = "searchableProperties",
543        default,
544        skip_serializing_if = "Vec::is_empty"
545    )]
546    pub searchable_properties: Vec<String>,
547}