ghl-models 0.5.2

Rust data models (DTOs) for the GoHighLevel (HighLevel) API v2 and v3, generated from the official OpenAPI specifications
Documentation
//! `custom-fields` data models for GoHighLevel API V3 (10 types).
//!
//! Generated from HighLevel's official OpenAPI spec for the
//! **Custom Fields** module. Every endpoint that uses these types, with its
//! parameters, required scopes and enum values, is documented in the
//! [`custom-fields` API reference](https://github.com/Shahroz/ghl-rs/blob/main/docs/api/custom-fields.md).
//!
//! Enable with `features = ["custom-fields"]`.
// @generated by xtask/generate_models.py — do not edit by hand.
// Source: https://github.com/GoHighLevel/highlevel-api-docs
// Doc comments are HighLevel's own field descriptions, reflowed verbatim, so
// they aren't held to rustdoc's markdown conventions.
#![allow(
    missing_docs,
    clippy::doc_lazy_continuation,
    clippy::doc_overindented_list_items
)]

use serde::{Deserialize, Serialize};

/// `CreateCustomFieldsDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct CreateCustomFieldsDTO {
    /// Location Id
    /// Required by the API.
    #[serde(rename = "locationId")]
    pub location_id: String,
    /// Field name
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    /// Description of the field
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// Placeholder text for the field
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub placeholder: Option<String>,
    /// Whether the field should be shown in forms
    /// Required by the API.
    #[serde(rename = "showInForms")]
    pub show_in_forms: bool,
    /// Options for the field (Optional, valid only for SINGLE_OPTIONS, MULTIPLE_OPTIONS, RADIO,
    /// CHECKBOX, TEXTBOX_LIST type)
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub options: Vec<OptionDTO>,
    /// Allowed file formats for uploads. Options include: .pdf, .docx, .doc, .jpg, .jpeg, .png,
    /// .gif, .csv, .xlsx, .xls, all
    /// Allowed values: `.pdf`, `.docx`, `.doc`, `.jpg`, `.jpeg`, `.png`, `.gif`, `.csv`,
    /// `.xlsx`, `.xls`, `all`.
    #[serde(
        rename = "acceptedFormats",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub accepted_formats: Option<String>,
    /// Type of field that you are trying to create
    /// Allowed values: `TEXT`, `LARGE_TEXT`, `NUMERICAL`, `PHONE`, `MONETORY`, `CHECKBOX`,
    /// `SINGLE_OPTIONS`, `MULTIPLE_OPTIONS`, `DATE`, `TEXTBOX_LIST`, `FILE_UPLOAD`, `RADIO`.
    /// Required by the API.
    #[serde(rename = "dataType")]
    pub data_type: String,
    /// Field key. For Custom Object it's formatted as "custom_object.{objectKey}.{fieldKey}".
    /// "custom_object" is a fixed prefix, "{objectKey}" is your custom object's identifier, and
    /// "{fieldKey}" is the unique field name within that object. Example:
    /// "custom_object.pet.name" for a "name" field in a "pet" custom object.
    /// Required by the API.
    #[serde(rename = "fieldKey")]
    pub field_key: String,
    /// The key for your custom object. This key uniquely identifies the custom object. Example:
    /// "custom_object.pet" for a custom object related to pets.
    /// Required by the API.
    #[serde(rename = "objectKey")]
    pub object_key: String,
    /// Maximum file limit for uploads. Applicable only for fields with a data type of
    /// FILE_UPLOAD.
    #[serde(
        rename = "maxFileLimit",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub max_file_limit: Option<f64>,
    /// Determines if users can add a custom option value different from the predefined options
    /// in records for RADIO type fields. A custom value added in one record does not
    /// automatically become an option and will not appear as an option for other records.
    #[serde(
        rename = "allowCustomOption",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub allow_custom_option: Option<bool>,
    /// ID of the parent folder
    /// Required by the API.
    #[serde(rename = "parentId")]
    pub parent_id: String,
}

/// `CreateFolder` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct CreateFolder {
    /// The key for your custom object. This key uniquely identifies the custom object. Example:
    /// "custom_object.pet" for a custom object related to pets.
    /// Required by the API.
    #[serde(rename = "objectKey")]
    pub object_key: String,
    /// Field name
    /// Required by the API.
    pub name: String,
    /// Location Id
    /// Required by the API.
    #[serde(rename = "locationId")]
    pub location_id: String,
}

/// `CustomFieldSuccessfulResponseDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct CustomFieldSuccessfulResponseDto {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub field: Option<ICustomField>,
}

/// `CustomFieldsResponseDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct CustomFieldsResponseDTO {
    /// Custom Fields for the object.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub fields: Vec<ICustomField>,
    /// Custom Fields folder for the object.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub folders: Vec<ICustomField>,
}

/// `CustomFolderDeleteResponseDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct CustomFolderDeleteResponseDto {
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub succeded: Option<bool>,
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub key: Option<String>,
}

/// `ICustomField` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct ICustomField {
    /// Location Id
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "locationId",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub location_id: Option<String>,
    /// Field name
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    /// Description of the field
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// Placeholder text for the field
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub placeholder: Option<String>,
    /// Whether the field should be shown in forms
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "showInForms",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub show_in_forms: Option<bool>,
    /// Options for the field (Optional, valid only for SINGLE_OPTIONS, MULTIPLE_OPTIONS, RADIO,
    /// CHECKBOX, TEXTBOX_LIST type)
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub options: Vec<OptionDTO>,
    /// Allowed file formats for uploads. Options include: .pdf, .docx, .doc, .jpg, .jpeg, .png,
    /// .gif, .csv, .xlsx, .xls, all
    /// Allowed values: `.pdf`, `.docx`, `.doc`, `.jpg`, `.jpeg`, `.png`, `.gif`, `.csv`,
    /// `.xlsx`, `.xls`, `all`.
    #[serde(
        rename = "acceptedFormats",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub accepted_formats: Option<String>,
    /// Unique identifier of the object
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    /// The key for your custom / standard object. This key uniquely identifies the custom
    /// object. Example: "custom_object.pet" for a custom object related to pets.
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(rename = "objectKey", default, skip_serializing_if = "Option::is_none")]
    pub object_key: Option<String>,
    /// Type of field that you are trying to create
    /// Allowed values: `TEXT`, `LARGE_TEXT`, `NUMERICAL`, `PHONE`, `MONETORY`, `CHECKBOX`,
    /// `SINGLE_OPTIONS`, `MULTIPLE_OPTIONS`, `DATE`, `TEXTBOX_LIST`, `FILE_UPLOAD`, `RADIO`.
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(rename = "dataType", default, skip_serializing_if = "Option::is_none")]
    pub data_type: Option<String>,
    /// ID of the parent folder
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(rename = "parentId", default, skip_serializing_if = "Option::is_none")]
    pub parent_id: Option<String>,
    /// Field key. For Custom Object it's formatted as "custom_object.{objectKey}.{fieldKey}".
    /// "custom_object" is a fixed prefix, "{objectKey}" is your custom object's identifier, and
    /// "{fieldName}" is the unique field name within that object. Example:
    /// "custom_object.pet.name" for a "name" field in a "pet" custom object.
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(rename = "fieldKey", default, skip_serializing_if = "Option::is_none")]
    pub field_key: Option<String>,
    /// Determines if users can add a custom option value different from the predefined options
    /// in records for RADIO type fields. A custom value added in one record does not
    /// automatically become an option and will not appear as an option for other records.
    #[serde(
        rename = "allowCustomOption",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub allow_custom_option: Option<bool>,
    /// Maximum file limit for uploads
    #[serde(
        rename = "maxFileLimit",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub max_file_limit: Option<f64>,
    /// Date and time when the object was added
    /// Format: date-time (ISO-8601 string).
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(rename = "dateAdded", default, skip_serializing_if = "Option::is_none")]
    pub date_added: Option<String>,
    /// Date and time when the object was last updated
    /// Format: date-time (ISO-8601 string).
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "dateUpdated",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub date_updated: Option<String>,
}

/// `ICustomFieldFolder` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct ICustomFieldFolder {
    /// Unique identifier of the object
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    /// The key for your custom object. This key uniquely identifies the custom object. Example:
    /// "custom_object.pet" for a custom object related to pets.
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(rename = "objectKey", default, skip_serializing_if = "Option::is_none")]
    pub object_key: Option<String>,
    /// Location Id
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "locationId",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub location_id: Option<String>,
    /// Field name
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
}

/// `OptionDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct OptionDTO {
    /// Key of the option (Included in Create and Response, excluded in Update)
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub key: Option<String>,
    /// Value of the option
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub label: Option<String>,
    /// URL associated with the option (Optional, valid only for RADIO type)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub url: Option<String>,
}

/// `UpdateCustomFieldsDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct UpdateCustomFieldsDTO {
    /// Location Id
    /// Required by the API.
    #[serde(rename = "locationId")]
    pub location_id: String,
    /// Field name
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    /// Description of the field
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// Placeholder text for the field
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub placeholder: Option<String>,
    /// Whether the field should be shown in forms
    /// Required by the API.
    #[serde(rename = "showInForms")]
    pub show_in_forms: bool,
    /// Options for the field. Important: Providing options will completely replace the existing
    /// options array. You must include all existing options alongside any new options you wish
    /// to add. Removal of options is not supported through this update. Applicable only for
    /// SINGLE_OPTIONS, MULTIPLE_OPTIONS, RADIO, CHECKBOX, TEXTBOX_LIST types.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub options: Vec<OptionDTO>,
    /// Allowed file formats for uploads. Options include: .pdf, .docx, .doc, .jpg, .jpeg, .png,
    /// .gif, .csv, .xlsx, .xls, all
    /// Allowed values: `.pdf`, `.docx`, `.doc`, `.jpg`, `.jpeg`, `.png`, `.gif`, `.csv`,
    /// `.xlsx`, `.xls`, `all`.
    #[serde(
        rename = "acceptedFormats",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub accepted_formats: Option<String>,
    /// Maximum file limit for uploads. Applicable only for fields with a data type of
    /// FILE_UPLOAD.
    #[serde(
        rename = "maxFileLimit",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub max_file_limit: Option<f64>,
}

/// `UpdateFolder` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct UpdateFolder {
    /// Field name
    /// Required by the API.
    pub name: String,
    /// Location Id
    /// Required by the API.
    #[serde(rename = "locationId")]
    pub location_id: String,
}