ghl-models 0.5.2

Rust data models (DTOs) for the GoHighLevel (HighLevel) API v2 and v3, generated from the official OpenAPI specifications
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
//! `phone-system` data models for GoHighLevel API V2 (6 types).
//!
//! Generated from HighLevel's official OpenAPI spec for the
//! **Phone System** module. Every endpoint that uses these types, with its
//! parameters, required scopes and enum values, is documented in the
//! [`phone-system` API reference](https://github.com/Shahroz/ghl-rs/blob/main/docs/api/phone-system.md).
//!
//! Enable with `features = ["phone-system"]`.
// @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};

/// `AvailableNumbersResponseDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct AvailableNumbersResponseDto {
    /// Unique fingerprint ID for this search result, required when purchasing one of the
    /// returned numbers
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "fingerprintId",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub fingerprint_id: Option<String>,
    /// List of available phone numbers matching the search criteria
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub numbers: Vec<AvailablePhoneNumberDto>,
}

/// `AvailablePhoneNumberDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct AvailablePhoneNumberDto {
    /// E.164 formatted phone number
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "phoneNumber",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub phone_number: Option<String>,
    /// Human-readable formatted phone number
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "friendlyName",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub friendly_name: Option<String>,
    /// ISO 3166-1 alpha-2 country code
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "isoCountry",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub iso_country: Option<String>,
    /// Local Access and Transport Area code
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub lata: Option<String>,
    /// City or locality of the number
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub locality: Option<String>,
    /// Rate center of the number
    #[serde(
        rename = "rateCenter",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub rate_center: Option<String>,
    /// Latitude coordinate of the number's location
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub latitude: Option<String>,
    /// Longitude coordinate of the number's location
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub longitude: Option<String>,
    /// State or region abbreviation
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub region: Option<String>,
    /// Postal code of the number
    #[serde(
        rename = "postalCode",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub postal_code: Option<String>,
    /// Address requirements for purchasing this number
    /// Allowed values: `none`, `any`, `local`, `foreign`.
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "addressRequirements",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub address_requirements: Option<String>,
    /// Whether this is a beta number
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub beta: Option<bool>,
    /// Communication capabilities supported by this number
    /// Nested object; raw JSON (see the API docs for its fields).
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub capabilities: Option<serde_json::Value>,
    /// Pricing information for this number
    /// Nested object; raw JSON (see the API docs for its fields).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub price: Option<serde_json::Value>,
}

/// `DetailedPhoneNumberDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct DetailedPhoneNumberDto {
    /// E.164 formatted phone number
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "phoneNumber",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub phone_number: Option<String>,
    /// Human-readable name assigned to the number
    #[serde(
        rename = "friendlyName",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub friendly_name: Option<String>,
    /// Phone number SID (unique identifier)
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub sid: Option<String>,
    /// ISO 3166-1 alpha-2 country code
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "countryCode",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub country_code: Option<String>,
    /// Communication capabilities supported by this number
    /// Nested object; raw JSON (see the API docs for its fields).
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub capabilities: Option<serde_json::Value>,
    /// Type of phone number (local, toll-free, mobile, etc.)
    /// Allowed values: `local`, `toll-free`, `mobile`, `national`.
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")]
    pub type_: Option<String>,
    /// Whether this is the default outbound number for the location
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "isDefaultNumber",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub is_default_number: Option<bool>,
    /// User ID of the user assigned to this number
    #[serde(
        rename = "linkedUser",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub linked_user: Option<String>,
    /// Array of user IDs that should ring when this number is called
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "linkedRingAllUsers",
        default,
        skip_serializing_if = "Vec::is_empty"
    )]
    pub linked_ring_all_users: Vec<String>,
    /// Configuration for inbound call handling service
    /// Nested object; raw JSON (see the API docs for its fields).
    #[serde(
        rename = "inboundCallService",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub inbound_call_service: Option<serde_json::Value>,
    /// Phone number to forward calls to
    #[serde(
        rename = "forwardingNumber",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub forwarding_number: Option<String>,
    /// Whether group conversations are enabled for this number (US/CA numbers with SMS/MMS
    /// only)
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "isGroupConversationEnabled",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub is_group_conversation_enabled: Option<bool>,
    /// Address SID for compliance purposes
    #[serde(
        rename = "addressSid",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub address_sid: Option<String>,
    /// Bundle SID for regulatory compliance
    #[serde(rename = "bundleSid", default, skip_serializing_if = "Option::is_none")]
    pub bundle_sid: Option<String>,
    /// When the number was originally purchased/added
    /// Format: date-time (ISO-8601 string).
    #[serde(rename = "dateAdded", default, skip_serializing_if = "Option::is_none")]
    pub date_added: Option<String>,
    /// When the number configuration was last updated
    /// Format: date-time (ISO-8601 string).
    #[serde(
        rename = "dateUpdated",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub date_updated: Option<String>,
    /// Source or origin of the phone number
    /// Allowed values: `twilio`, `hosted`, `ported`.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub origin: Option<String>,
}

/// `NumberPoolDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct NumberPoolDto {
    /// Unique identifier for the number pool
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    /// Human-readable name of the number pool
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    /// Location ID this pool belongs to
    #[serde(
        rename = "locationId",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub location_id: Option<String>,
    /// Phone numbers in this pool
    /// Nested object; raw JSON (see the API docs for its fields).
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub numbers: Vec<serde_json::Value>,
    /// Number to forward calls to
    #[serde(
        rename = "forwardingNumber",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub forwarding_number: Option<String>,
    /// Whether whisper is enabled
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub whisper: Option<bool>,
    /// Message played during whisper
    #[serde(
        rename = "whisperMessage",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub whisper_message: Option<String>,
    /// Whether call recording is enabled
    #[serde(
        rename = "callRecording",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub call_recording: Option<bool>,
    /// Whether the number pool is active
    #[serde(rename = "isActive", default, skip_serializing_if = "Option::is_none")]
    pub is_active: Option<bool>,
    /// Inbound call service configuration
    /// Nested object; raw JSON (see the API docs for its fields).
    #[serde(
        rename = "inboundCallService",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub inbound_call_service: Option<serde_json::Value>,
}

/// `PurchasePhoneNumberBodyDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PurchasePhoneNumberBodyDto {
    /// The phone number to purchase
    /// Required by the API.
    #[serde(rename = "phoneNumber")]
    pub phone_number: String,
    /// ISO 3166-1 alpha-2 country code of the number
    #[serde(
        rename = "countryCode",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub country_code: Option<String>,
    /// Type of phone number
    /// Allowed values: `local`, `tollFree`, `mobile`.
    #[serde(
        rename = "numberType",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub number_type: Option<String>,
    /// Twilio address SID for compliance
    #[serde(
        rename = "addressSid",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub address_sid: Option<String>,
    /// Twilio bundle SID for regulatory compliance
    #[serde(rename = "bundleSid", default, skip_serializing_if = "Option::is_none")]
    pub bundle_sid: Option<String>,
    /// Locality where the number is being purchased
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub locality: Option<String>,
    /// Region where the number is being purchased
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub region: Option<String>,
    /// Unique request ID for idempotency (fingerprint of the purchase request)
    #[serde(
        rename = "fingerprintId",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub fingerprint_id: Option<String>,
    /// Skip location-level KYC verification if agency-level compliance has already been
    /// verified
    #[serde(
        rename = "skipLocationKYC",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub skip_location_kyc: Option<bool>,
}

/// `TwilioAccountResponseDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct TwilioAccountResponseDto {
    /// Unique identifier of the Twilio account record
    /// 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>,
    /// Twilio Account SID
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub account_sid: Option<String>,
    /// Whether this location is under a GHL-managed Twilio account
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub under_ghl_account: Option<bool>,
    /// Whether SMS validation is enabled
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub validate_sms: Option<bool>,
    /// The location ID this Twilio account belongs to
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub location_id: Option<String>,
    /// Current migration status of the account
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub migration_status: Option<String>,
    /// List of numbers being migrated
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub migration_numbers: Vec<String>,
    /// Map of phone numbers to assigned user IDs
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub assigned_to_numbers: Option<serde_json::Value>,
    /// Map of phone numbers to their service type (e.g. 'conversation')
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub numbers: Option<serde_json::Value>,
    /// Map of phone numbers to their friendly names
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub number_name: Option<serde_json::Value>,
    /// New account SID if the account has been migrated to new credentials
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub new_account_sid: Option<String>,
}