ghl_models/lib.rs
1// @generated by xtask/generate_models.py — do not edit by hand.
2//! Rust data models (DTOs) for the [GoHighLevel](https://www.gohighlevel.com)
3//! (HighLevel) CRM API — **2417 types** generated from
4//! [HighLevel's official OpenAPI specifications](https://github.com/GoHighLevel/highlevel-api-docs).
5//!
6//! Both API versions are covered side by side: [`v2`] (1081 types, the
7//! current stable API, `Version: 2021-07-28`) and [`v3`] (1336 types,
8//! `Version: v3`).
9//!
10//! ```toml
11//! [dependencies]
12//! ghl-models = { version = "0.3", features = ["invoices", "payments"] }
13//! ```
14//!
15//! ```ignore
16//! use ghl_models::v2::invoices::{CreateInvoiceDto, InvoiceItemDto};
17//!
18//! let invoice = CreateInvoiceDto {
19//! alt_id: location_id,
20//! alt_type: "location".into(), // the only legal value
21//! name: "August retainer".into(),
22//! currency: "USD".into(),
23//! ..Default::default()
24//! };
25//! ```
26//!
27//! # Every module is a cargo feature
28//!
29//! Nothing is enabled by default, because compiling everything means thousands
30//! of structs: **one module builds in ~1.3s, all 45 take ~30s.** Use
31//! `features = ["full"]` only for exploration.
32//!
33//! | Feature | API v2 module (structs) | API v3 module (structs) |
34//! |---|---|---|
35//! | `ad-manager` | [`v2::ad_manager`] (107) | — |
36//! | `ad-publishing` | — | [`v3::ad_publishing`] (108) |
37//! | `affiliate-manager` | [`v2::affiliate_manager`] (13) | [`v3::affiliate_manager`] (13) |
38//! | `agent-studio` | [`v2::agent_studio`] (14) | [`v3::agent_studio`] (14) |
39//! | `associations` | [`v2::associations`] (5) | [`v3::associations`] (5) |
40//! | `blogs` | [`v2::blogs`] (13) | [`v3::blogs`] (13) |
41//! | `brand-boards` | [`v2::brand_boards`] (11) | [`v3::brand_boards`] (24) |
42//! | `businesses` | [`v2::businesses`] (8) | [`v3::businesses`] (8) |
43//! | `calendars` | [`v2::calendars`] (62) | [`v3::calendars`] (94) |
44//! | `campaigns` | [`v2::campaigns`] (2) | [`v3::campaigns`] (2) |
45//! | `chat-widget` | — | [`v3::chat_widget`] (15) |
46//! | `companies` | [`v2::companies`] (3) | [`v3::companies`] (3) |
47//! | `contacts` | [`v2::contacts`] (61) | [`v3::contacts`] (60) |
48//! | `conversation-ai` | [`v2::conversation_ai`] (28) | [`v3::conversation_ai`] (28) |
49//! | `conversations` | [`v2::conversations`] (44) | [`v3::conversations`] (44) |
50//! | `courses` | [`v2::courses`] (10) | [`v3::courses`] (10) |
51//! | `custom-fields` | [`v2::custom_fields`] (10) | [`v3::custom_fields`] (10) |
52//! | `custom-menus` | [`v2::custom_menus`] (9) | [`v3::custom_menus`] (9) |
53//! | `email-isv` | [`v2::email_isv`] (4) | [`v3::email_isv`] (4) |
54//! | `emails` | [`v2::emails`] (12) | [`v3::emails`] (67) |
55//! | `forms` | [`v2::forms`] (9) | [`v3::forms`] (9) |
56//! | `funnels` | [`v2::funnels`] (10) | [`v3::funnels`] (10) |
57//! | `invoices` | [`v2::invoices`] (104) | [`v3::invoices`] (104) |
58//! | `knowledge-base` | [`v2::knowledge_base`] (38) | [`v3::knowledge_base`] (38) |
59//! | `links` | [`v2::links`] (6) | [`v3::links`] (6) |
60//! | `locations` | [`v2::locations`] (47) | [`v3::locations`] (53) |
61//! | `marketplace` | [`v2::marketplace`] (13) | [`v3::marketplace`] (13) |
62//! | `medias` | [`v2::medias`] (10) | [`v3::medias`] (10) |
63//! | `oauth` | [`v2::oauth`] (6) | [`v3::oauth`] (12) |
64//! | `objects` | [`v2::objects`] (20) | [`v3::objects`] (20) |
65//! | `opportunities` | [`v2::opportunities`] (25) | [`v3::opportunities`] (26) |
66//! | `payments` | [`v2::payments`] (55) | [`v3::payments`] (55) |
67//! | `phone-system` | [`v2::phone_system`] (6) | [`v3::phone_system`] (8) |
68//! | `products` | [`v2::products`] (64) | [`v3::products`] (64) |
69//! | `proposals` | [`v2::proposals`] (21) | [`v3::proposals`] (21) |
70//! | `saas` | — | [`v3::saas`] (25) |
71//! | `saas-api` | [`v2::saas_api`] (20) | — |
72//! | `snapshots` | [`v2::snapshots`] (8) | [`v3::snapshots`] (8) |
73//! | `social-media-posting` | [`v2::social_media_posting`] (107) | — |
74//! | `social-planner` | — | [`v3::social_planner`] (228) |
75//! | `store` | [`v2::store`] (40) | [`v3::store`] (40) |
76//! | `surveys` | [`v2::surveys`] (9) | [`v3::surveys`] (9) |
77//! | `users` | [`v2::users`] (10) | [`v3::users`] (9) |
78//! | `voice-ai` | [`v2::voice_ai`] (35) | [`v3::voice_ai`] (35) |
79//! | `workflows` | [`v2::workflows`] (2) | [`v3::workflows`] (2) |
80//!
81//! v3 renames three modules and adds one: `ad-manager`→`ad-publishing`,
82//! `social-media-posting`→`social-planner`, `saas-api`→`saas`, plus a new
83//! `chat-widget`.
84//!
85//! # Generation conventions
86//!
87//! | Convention | Why |
88//! |---|---|
89//! | Fields the spec marks `required` are non-`Option` | Matches the spec; you can't forget a mandatory field |
90//! | Everything else is `Option<T>` with `skip_serializing_if` | Partial updates serialize to only what you set |
91//! | Arrays are `Vec<T>` with `#[serde(default)]` | An absent list reads as empty rather than erroring |
92//! | **String enums stay `String`** — allowed values are in each field's doc comment | GoHighLevel adds enum values without notice; a closed Rust enum would turn that into a deserialization failure |
93//! | Anonymous nested objects and multi-branch compositions are `serde_json::Value` | The spec doesn't name them |
94//! | A single-`$ref` `allOf` wrapper resolves to the referenced type | Those are description wrappers, not real composition |
95//! | Unknown response fields are ignored, never rejected | Upstream additions can't break your build |
96//!
97//! # Related crates
98//!
99//! - [`ghl-sdk`](https://docs.rs/ghl-sdk) — the async API client (auth, retries,
100//! rate limits, pagination). Re-exports this crate under its `models` feature.
101//! - [`ghl-mcp`](https://crates.io/crates/ghl-mcp) — MCP server exposing
102//! GoHighLevel to AI agents.
103//!
104//! # Further reading
105//!
106//! - [Usage guide](https://github.com/Shahroz/ghl-rs/blob/main/docs/GUIDE.md)
107//! - [Full API reference](https://github.com/Shahroz/ghl-rs/blob/main/docs/api/README.md)
108//! — every endpoint, struct, and enum value, per module
109//!
110//! Regenerate with `xtask/generate_models.py` after HighLevel updates its specs.
111//!
112//! *Not affiliated with HighLevel Inc.*
113
114#![cfg_attr(docsrs, feature(doc_cfg))]
115
116pub mod v2;
117pub mod v3;