ghl-models 0.5.2

Rust data models (DTOs) for the GoHighLevel (HighLevel) API v2 and v3, generated from the official OpenAPI specifications
Documentation
//! `associations` data models for GoHighLevel API V2 (5 types).
//!
//! Generated from HighLevel's official OpenAPI spec for the
//! **Associations** module. Every endpoint that uses these types, with its
//! parameters, required scopes and enum values, is documented in the
//! [`associations` API reference](https://github.com/Shahroz/ghl-rs/blob/main/docs/api/associations.md).
//!
//! Enable with `features = ["associations"]`.
// @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};

/// `DeleteAssociationsResponseDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct DeleteAssociationsResponseDTO {
    /// Deletion status
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub deleted: Option<bool>,
    /// Association Id
    /// 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 message: Option<String>,
}

/// `GetPostSuccessfulResponseDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct GetPostSuccessfulResponseDto {
    /// 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>,
    /// 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>,
    /// First Objects Association Label (custom_objects.children)
    /// 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>,
    /// First Objects Association Label (custom_objects.children)
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "firstObjectLabel",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub first_object_label: Option<serde_json::Value>,
    /// First Objects Key
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "firstObjectKey",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub first_object_key: Option<serde_json::Value>,
    /// Second Object Association Label (contact)
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "secondObjectLabel",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub second_object_label: Option<serde_json::Value>,
    /// Second Objects Key
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "secondObjectKey",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub second_object_key: Option<serde_json::Value>,
    /// Association Type can be USER_DEFINED or SYSTEM_DEFINED
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "associationType",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub association_type: Option<serde_json::Value>,
}

/// `UpdateAssociationReqDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct UpdateAssociationReqDto {
    /// Required by the API.
    #[serde(rename = "firstObjectLabel")]
    pub first_object_label: serde_json::Value,
    /// Required by the API.
    #[serde(rename = "secondObjectLabel")]
    pub second_object_label: serde_json::Value,
}

/// `createAssociationReqDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct CreateAssociationReqDto {
    /// Required by the API.
    #[serde(rename = "locationId")]
    pub location_id: String,
    /// Association's Unique key
    /// Required by the API.
    pub key: String,
    /// First Objects Association Label (custom_objects.children)
    /// Required by the API.
    #[serde(rename = "firstObjectLabel")]
    pub first_object_label: serde_json::Value,
    /// First Objects Key
    /// Required by the API.
    #[serde(rename = "firstObjectKey")]
    pub first_object_key: serde_json::Value,
    /// Second Object Association Label (contact)
    /// Required by the API.
    #[serde(rename = "secondObjectLabel")]
    pub second_object_label: serde_json::Value,
    /// Second Objects Key
    /// Required by the API.
    #[serde(rename = "secondObjectKey")]
    pub second_object_key: serde_json::Value,
}

/// `createRelationReqDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct CreateRelationReqDto {
    /// Your Sub Account's ID
    /// Required by the API.
    #[serde(rename = "locationId")]
    pub location_id: String,
    /// Association's Id
    /// Required by the API.
    #[serde(rename = "associationId")]
    pub association_id: String,
    /// First Record's Id. For instance, if you have an association between a contact and a
    /// custom object, and you specify the contact as the first object while creating the
    /// association, then your firstRecordId would be the contactId
    /// Required by the API.
    #[serde(rename = "firstRecordId")]
    pub first_record_id: String,
    /// Second Record's Id.For instance, if you have an association between a contact and a
    /// custom object, and you specify the custom object as the second entity while creating the
    /// association, then your secondRecordId would be the customObject record Id
    /// Required by the API.
    #[serde(rename = "secondRecordId")]
    pub second_record_id: String,
}