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