ghl-models 0.3.1

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

/// `GetAccessCodeSuccessfulResponseDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct GetAccessCodeSuccessfulResponseDto {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub access_token: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub token_type: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub expires_in: Option<f64>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub refresh_token: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub scope: Option<String>,
    #[serde(rename = "userType", default, skip_serializing_if = "Option::is_none")]
    pub user_type: Option<String>,
    /// Location ID - Present only for Sub-Account Access Token
    #[serde(
        rename = "locationId",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub location_id: Option<String>,
    /// Company ID
    #[serde(rename = "companyId", default, skip_serializing_if = "Option::is_none")]
    pub company_id: Option<String>,
    /// Approved locations to generate location access token
    #[serde(
        rename = "approvedLocations",
        default,
        skip_serializing_if = "Vec::is_empty"
    )]
    pub approved_locations: Vec<String>,
    /// USER ID - Represent user id of person who performed installation
    /// Required by the API.
    #[serde(rename = "userId")]
    pub user_id: String,
    /// Plan Id of the subscribed plan in paid apps.
    #[serde(rename = "planId", default, skip_serializing_if = "Option::is_none")]
    pub plan_id: Option<String>,
    #[serde(
        rename = "isBulkInstallation",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub is_bulk_installation: Option<bool>,
    /// Boolean to control if user wants app to be automatically installed to future locations
    /// (only for company tokens)
    #[serde(
        rename = "installToFutureLocations",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub install_to_future_locations: Option<bool>,
    /// Boolean indicating if user approved all locations during bulk installation (only for
    /// company tokens)
    #[serde(
        rename = "approveAllLocations",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub approve_all_locations: Option<bool>,
}

/// `GetAccessCodebodyDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct GetAccessCodebodyDto {
    /// The ID provided by GHL for your integration
    /// Required by the API.
    pub client_id: String,
    /// Required by the API.
    pub client_secret: String,
    /// Allowed values: `authorization_code`, `refresh_token`, `client_credentials`.
    /// Required by the API.
    pub grant_type: String,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub code: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub refresh_token: Option<String>,
    /// The type of token to be requested
    /// Allowed values: `Company`, `Location`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub user_type: Option<String>,
    /// The redirect URI for your application
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub redirect_uri: Option<String>,
}

/// `GetInstalledLocationsSuccessfulResponseDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct GetInstalledLocationsSuccessfulResponseDto {
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub locations: Vec<InstalledLocationSchema>,
    /// Total location count under the company
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub count: Option<f64>,
    /// Boolean to control if user wants app to be automatically installed to future locations
    #[serde(
        rename = "installToFutureLocations",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub install_to_future_locations: Option<bool>,
}

/// `GetLocationAccessCodeBodyDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct GetLocationAccessCodeBodyDto {
    /// Company Id of location you want to request token for
    /// Required by the API.
    #[serde(rename = "companyId")]
    pub company_id: String,
    /// The location ID for which you want to obtain accessToken
    /// Required by the API.
    #[serde(rename = "locationId")]
    pub location_id: String,
}

/// `GetLocationAccessTokenSuccessfulResponseDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct GetLocationAccessTokenSuccessfulResponseDto {
    /// Location access token which can be used to authenticate & authorize API under following
    /// scope
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub access_token: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub token_type: Option<String>,
    /// Time in seconds remaining for token to expire
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub expires_in: Option<f64>,
    /// Scopes the following accessToken have access to
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub scope: Option<String>,
    /// Location ID - Present only for Sub-Account Access Token
    #[serde(
        rename = "locationId",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub location_id: Option<String>,
    /// Plan Id of the subscribed plan in paid apps.
    #[serde(rename = "planId", default, skip_serializing_if = "Option::is_none")]
    pub plan_id: Option<String>,
    /// USER ID - Represent user id of person who performed installation
    /// Required by the API.
    #[serde(rename = "userId")]
    pub user_id: String,
    /// App ID of the installed application
    #[serde(rename = "appId", default, skip_serializing_if = "Option::is_none")]
    pub app_id: Option<String>,
    /// Version ID of the installed app version
    #[serde(rename = "versionId", default, skip_serializing_if = "Option::is_none")]
    pub version_id: Option<String>,
}

/// `InstalledLocationSchema` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct InstalledLocationSchema {
    /// Location ID
    /// Required by the API.
    #[serde(rename = "_id")]
    pub id: String,
    /// Name of the location
    /// Required by the API.
    pub name: String,
    /// Address linked to location
    /// Required by the API.
    pub address: String,
    /// Check if the requested app is installed for following location
    #[serde(
        rename = "isInstalled",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub is_installed: Option<bool>,
    /// Version ID of the installed app version for this location
    #[serde(rename = "versionId", default, skip_serializing_if = "Option::is_none")]
    pub version_id: Option<String>,
    /// Timestamp when the app was installed on this location
    /// Format: date-time (ISO-8601 string).
    #[serde(
        rename = "installedAt",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub installed_at: Option<String>,
}