Skip to main content

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