ghl-models 0.4.1

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
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
//! `marketplace` data models for GoHighLevel API V2 (13 types).
//!
//! Generated from HighLevel's official OpenAPI spec for the
//! **Marketplace** module. Every endpoint that uses these types, with its
//! parameters, required scopes and enum values, is documented in the
//! [`marketplace` API reference](https://github.com/Shahroz/ghl-rs/blob/main/docs/api/marketplace.md).
//!
//! Enable with `features = ["marketplace"]`.
// @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};

/// `DeleteIntegrationBodyDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct DeleteIntegrationBodyDto {
    /// The company id from which the application is to be uninstalled. If you pass agency
    /// token, then companyId is required. It will uninstall application from agency as well as
    /// all sub-accounts.
    #[serde(rename = "companyId", default, skip_serializing_if = "Option::is_none")]
    pub company_id: Option<String>,
    /// The location id from which the application is to be uninstalled. If you pass location
    /// token, then locationId is required. It will uninstall application from that location
    /// only.
    #[serde(
        rename = "locationId",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub location_id: Option<String>,
    /// The reason for uninstalling the application. Reason is required if you are uninstalling
    /// the application as a developer.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub reason: Option<String>,
}

/// `DeleteIntegrationResponse` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct DeleteIntegrationResponse {
    /// The status of the uninstallation of the application
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub success: Option<bool>,
}

/// `GetInstallerDetailsResponseDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct GetInstallerDetailsResponseDTO {
    /// Installation details
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "installationDetails",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub installation_details: Option<InstallerDetailsDTO>,
}

/// `GetRebillingConfigResponseDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct GetRebillingConfigResponseDTO {
    /// The rebilling plans configuration
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub plans: Option<PlansDTO>,
}

/// `InstallerDetailsDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct InstallerDetailsDTO {
    /// Company ID
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(rename = "companyId", default, skip_serializing_if = "Option::is_none")]
    pub company_id: Option<String>,
    /// Location ID (if applicable)
    #[serde(
        rename = "locationId",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub location_id: Option<String>,
    /// Company name
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "companyName",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub company_name: Option<String>,
    /// Company relationship number
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "relationshipNumber",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub relationship_number: Option<String>,
    /// Company email. Will be null for sub-account installations due to PII concerns.
    #[serde(
        rename = "companyEmail",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub company_email: Option<String>,
    /// Company owner full name. Will be null for sub-account installations due to PII concerns.
    #[serde(
        rename = "companyOwnerFullName",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub company_owner_full_name: Option<String>,
    /// User ID who installed the app
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(rename = "userId", default, skip_serializing_if = "Option::is_none")]
    pub user_id: Option<String>,
    /// Whether the company is a whitelabel company
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "isWhitelabelCompany",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub is_whitelabel_company: Option<bool>,
    /// Company plan. Will be null for sub-account installations due to business sensitivity.
    #[serde(
        rename = "companyPlan",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub company_plan: Option<String>,
    /// Company plan. Will be null for sub-account installations due to business sensitivity.
    #[serde(
        rename = "companyHighLevelPlan",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub company_high_level_plan: Option<String>,
    /// Marketplace app plan ID for paid apps
    #[serde(
        rename = "marketplaceAppPlanId",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub marketplace_app_plan_id: Option<String>,
    /// Whitelabel details (only present if isWhitelabelCompany is true)
    #[serde(
        rename = "whitelabelDetails",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub whitelabel_details: Option<WhitelabelDetailsDTO>,
}

/// `InternalServerErrorDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct InternalServerErrorDTO {
    /// HTTP status code
    #[serde(
        rename = "statusCode",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub status_code: Option<f64>,
    /// Error message describing the internal server error
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub message: Option<String>,
}

/// `MigrateConnectionDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct MigrateConnectionDto {
    /// Type of authentication - basic or oauth2
    /// Allowed values: `oauth2`, `basic`.
    /// Required by the API.
    #[serde(rename = "type")]
    pub type_: String,
    /// Location ID
    /// Required by the API.
    #[serde(rename = "locationId")]
    pub location_id: String,
    /// App ID
    /// Required by the API.
    #[serde(rename = "appId")]
    pub app_id: String,
    /// App Version ID
    /// Required by the API.
    #[serde(rename = "appVersionId")]
    pub app_version_id: String,
    /// Connection identifier
    /// Required by the API.
    #[serde(rename = "accountId")]
    pub account_id: String,
    /// API Key (supported when type is basic)
    #[serde(rename = "apiKey", default, skip_serializing_if = "Option::is_none")]
    pub api_key: Option<String>,
    /// Basic auth credentials as key/value pairs (supported when type is basic). Keys are
    /// validated against the app version externalAuthConfig.fields.
    #[serde(
        rename = "basicCredentials",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub basic_credentials: Option<serde_json::Value>,
    /// Access token (required when type is oauth2)
    #[serde(
        rename = "accessToken",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub access_token: Option<String>,
    /// Refresh token (required when type is oauth2)
    #[serde(
        rename = "refreshToken",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub refresh_token: Option<String>,
    /// Access token expiry time in milliseconds (optional for oauth2)
    #[serde(rename = "expiryIn", default, skip_serializing_if = "Option::is_none")]
    pub expiry_in: Option<f64>,
    /// Timestamp for access token expiry (optional for oauth2)
    #[serde(rename = "expiryAt", default, skip_serializing_if = "Option::is_none")]
    pub expiry_at: Option<f64>,
    /// OAuth2 scopes (optional for oauth2)
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub scopes: Vec<String>,
    /// Display name for the connection (optional, defaults to accountId)
    #[serde(
        rename = "displayName",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub display_name: Option<String>,
    /// Whether this is the default connection for the location (optional, defaults to false)
    #[serde(rename = "isDefault", default, skip_serializing_if = "Option::is_none")]
    pub is_default: Option<bool>,
}

/// `MigrateConnectionResponseDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct MigrateConnectionResponseDto {
    /// Indicates if the migration was successful
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub success: Option<bool>,
    /// Unique identifier for the migrated connection
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub identifier: Option<String>,
    /// Message describing the result
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub message: Option<String>,
}

/// `PlansDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct PlansDTO {
    /// Subscription plans
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub subscription: Vec<SubscriptionPlanDTO>,
    /// Usage-based plans
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub usage: Vec<UsagePlanDTO>,
}

/// `RaiseChargeBodyDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct RaiseChargeBodyDTO {
    /// App ID of the App
    /// Required by the API.
    #[serde(rename = "appId")]
    pub app_id: String,
    /// Billing Meter ID (you can find this on your app's pricing page)
    /// Required by the API.
    #[serde(rename = "meterId")]
    pub meter_id: String,
    /// Event ID / Transaction ID on your server's side. This will help you maintain the
    /// reference of the event/transaction on your end that you charged the customer for.
    /// Required by the API.
    #[serde(rename = "eventId")]
    pub event_id: String,
    /// User ID
    #[serde(rename = "userId", default, skip_serializing_if = "Option::is_none")]
    pub user_id: Option<String>,
    /// ID of the Sub-Account to be charged
    /// Required by the API.
    #[serde(rename = "locationId")]
    pub location_id: String,
    /// ID of the Agency the Sub-account belongs to
    /// Required by the API.
    #[serde(rename = "companyId")]
    pub company_id: String,
    /// Description of the charge
    /// Required by the API.
    pub description: String,
    /// Price per unit to charge
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub price: Option<f64>,
    /// Number of units to charge
    /// Required by the API.
    pub units: f64,
    /// The timestamp when the event/transaction was performed. If blank, the billing timestamp
    /// will be set as the event time. ISO8601 Format.
    #[serde(rename = "eventTime", default, skip_serializing_if = "Option::is_none")]
    pub event_time: Option<String>,
}

/// `SubscriptionPlanDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct SubscriptionPlanDTO {
    /// The reselling amount
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "resellingAmount",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub reselling_amount: Option<f64>,
    /// The base amount
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "baseAmount",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub base_amount: Option<f64>,
    /// The plan id
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(rename = "planId", default, skip_serializing_if = "Option::is_none")]
    pub plan_id: Option<String>,
    /// The features
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub features: Vec<String>,
    /// The payment time
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "paymentType",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub payment_type: Option<String>,
    /// The plan 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>,
    /// The payment time
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "paymentTime",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub payment_time: Option<String>,
}

/// `UsagePlanDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct UsagePlanDTO {
    /// The product type
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "productType",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub product_type: Option<String>,
    /// The product name
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "productName",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub product_name: Option<String>,
    /// The usage unit for the meter
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(rename = "usageUnit", default, skip_serializing_if = "Option::is_none")]
    pub usage_unit: Option<String>,
    /// The meter id
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(rename = "meterId", default, skip_serializing_if = "Option::is_none")]
    pub meter_id: Option<String>,
    /// The meter name
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(rename = "meterName", default, skip_serializing_if = "Option::is_none")]
    pub meter_name: Option<String>,
    /// The fixed price per unit, applicable for fixed price type
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "fixedPricePerUnit",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub fixed_price_per_unit: Option<f64>,
    /// The price type
    /// Allowed values: `fixed`, `dynamic`.
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(rename = "priceType", default, skip_serializing_if = "Option::is_none")]
    pub price_type: Option<String>,
    /// The min price per unit, applicable for dynamic price type
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "minPricePerUnit",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub min_price_per_unit: Option<String>,
    /// The max price per unit, applicable for dynamic price type
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "maxPricePerUnit",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub max_price_per_unit: Option<String>,
    /// The execution limit per cycle
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(
        rename = "executionLimitPerCycle",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub execution_limit_per_cycle: Option<f64>,
}

/// `WhitelabelDetailsDTO` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct WhitelabelDetailsDTO {
    /// Domain of the whitelabel company
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub domain: Option<String>,
    /// Logo URL of the whitelabel company
    /// Required by the API.
    /// (Optional here so responses that omit it still parse.)
    #[serde(rename = "logoUrl", default, skip_serializing_if = "Option::is_none")]
    pub logo_url: Option<String>,
}