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
//! `oauth` data models for GoHighLevel API V3 (12 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};
/// `AipErrorBodyDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct AipErrorBodyDto {
/// Machine-readable error code (see AipErrorCode enum in @platform-core/aip-framework)
/// Required by the API.
/// (Optional here so responses that omit it still parse.)
#[serde(default, skip_serializing_if = "Option::is_none")]
pub code: Option<String>,
/// Human-readable error message
/// 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>,
/// Additional error context (field name, identifier, etc.)
#[serde(default, skip_serializing_if = "Option::is_none")]
pub details: Option<serde_json::Value>,
/// Suggested resolution for the caller
#[serde(default, skip_serializing_if = "Option::is_none")]
pub resolution: Option<String>,
}
/// `AipErrorResponseDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct AipErrorResponseDto {
/// AIP-compliant error envelope
/// Required by the API.
/// (Optional here so responses that omit it still parse.)
#[serde(default, skip_serializing_if = "Option::is_none")]
pub error: Option<AipErrorBodyDto>,
}
/// `GetAccessTokenBodyDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct GetAccessTokenBodyDto {
/// The ID provided by CRM for your integration
/// Required by the API.
#[serde(rename = "clientId")]
pub client_id: String,
/// The client secret provided by CRM for your integration
/// Required by the API.
#[serde(rename = "clientSecret")]
pub client_secret: String,
/// The OAuth2 grant type — authorization_code, refresh_token, or client_credentials
/// Allowed values: `authorization_code`, `refresh_token`, `client_credentials`.
/// Required by the API.
#[serde(rename = "grantType")]
pub grant_type: String,
/// The authorization code received from the authorization endpoint (required for
/// authorization_code grant)
#[serde(default, skip_serializing_if = "Option::is_none")]
pub code: Option<String>,
/// The refresh token used to obtain a new access token (required for refresh_token grant)
#[serde(
rename = "refreshToken",
default,
skip_serializing_if = "Option::is_none"
)]
pub refresh_token: Option<String>,
/// The type of token to be requested
/// Allowed values: `Company`, `Location`.
#[serde(rename = "userType", default, skip_serializing_if = "Option::is_none")]
pub user_type: Option<String>,
/// The redirect URI for your application
#[serde(
rename = "redirectUri",
default,
skip_serializing_if = "Option::is_none"
)]
pub redirect_uri: Option<String>,
}
/// `GetAccessTokenSuccessfulResponseDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct GetAccessTokenSuccessfulResponseDto {
/// The OAuth2 access token
#[serde(
rename = "accessToken",
default,
skip_serializing_if = "Option::is_none"
)]
pub access_token: Option<String>,
/// The token type (always Bearer)
#[serde(rename = "tokenType", default, skip_serializing_if = "Option::is_none")]
pub token_type: Option<String>,
/// Time in seconds until the access token expires
#[serde(rename = "expiresIn", default, skip_serializing_if = "Option::is_none")]
pub expires_in: Option<f64>,
/// The OAuth2 refresh token used to obtain a new access token
#[serde(
rename = "refreshToken",
default,
skip_serializing_if = "Option::is_none"
)]
pub refresh_token: Option<String>,
/// Space-separated list of scopes the access token has access to
#[serde(default, skip_serializing_if = "Option::is_none")]
pub scope: Option<String>,
/// The user type associated with the token (Location or Company)
#[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.
/// (Optional here so responses that omit it still parse.)
#[serde(rename = "userId", default, skip_serializing_if = "Option::is_none")]
pub user_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>,
/// Indicates whether the installation was performed as a bulk installation
#[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>,
}
/// `GetInstalledLocationsSuccessfulResponseDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct GetInstalledLocationsSuccessfulResponseDto {
/// List of locations with their installation status for the requested app
#[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>,
}
/// `GetInstalledLocationsV3SuccessfulResponseDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct GetInstalledLocationsV3SuccessfulResponseDto {
/// List of locations with their installation status for the requested app
/// Required by the API.
/// (Optional here so responses that omit it still parse.)
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub items: Vec<InstalledLocationSchema>,
/// Pagination metadata (AIP-158)
/// Required by the API.
/// (Optional here so responses that omit it still parse.)
#[serde(default, skip_serializing_if = "Option::is_none")]
pub pagination: Option<V3PaginationMetaDto>,
/// Query metadata (filters and sort applied)
#[serde(default, skip_serializing_if = "Option::is_none")]
pub metadata: Option<V3InstalledLocationsListMetadataDto>,
/// 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>,
/// The token type (always Bearer)
#[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.
/// (Optional here so responses that omit it still parse.)
#[serde(rename = "userId", default, skip_serializing_if = "Option::is_none")]
pub user_id: Option<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>,
/// The OAuth2 refresh token used to obtain a new access token for this specific location
#[serde(default, skip_serializing_if = "Option::is_none")]
pub refresh_token: Option<String>,
}
/// `GetLocationAccessTokenV3SuccessfulResponseDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct GetLocationAccessTokenV3SuccessfulResponseDto {
/// Location access token which can be used to authenticate & authorize API under following
/// scope
#[serde(
rename = "accessToken",
default,
skip_serializing_if = "Option::is_none"
)]
pub access_token: Option<String>,
/// The token type (always Bearer)
#[serde(rename = "tokenType", default, skip_serializing_if = "Option::is_none")]
pub token_type: Option<String>,
/// Time in seconds remaining for token to expire
#[serde(rename = "expiresIn", 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.
/// (Optional here so responses that omit it still parse.)
#[serde(rename = "userId", default, skip_serializing_if = "Option::is_none")]
pub user_id: Option<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>,
/// The OAuth2 refresh token used to obtain a new access token for this specific location.
#[serde(
rename = "refreshToken",
default,
skip_serializing_if = "Option::is_none"
)]
pub refresh_token: Option<String>,
}
/// `InstalledLocationSchema` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct InstalledLocationSchema {
/// Location ID
/// Required by the API.
/// (Optional here so responses that omit it still parse.)
#[serde(rename = "_id", default, skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
/// Name of the location
/// 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>,
/// Address linked to location
/// Required by the API.
/// (Optional here so responses that omit it still parse.)
#[serde(default, skip_serializing_if = "Option::is_none")]
pub address: Option<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>,
}
/// `V3InstalledLocationsListMetadataDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct V3InstalledLocationsListMetadataDto {
/// Filters that were applied to the query
#[serde(
rename = "filterApplied",
default,
skip_serializing_if = "Option::is_none"
)]
pub filter_applied: Option<serde_json::Value>,
/// Sort order that was applied to the query
#[serde(
rename = "sortApplied",
default,
skip_serializing_if = "Option::is_none"
)]
pub sort_applied: Option<serde_json::Value>,
}
/// `V3PaginationMetaDto` from the GoHighLevel OpenAPI spec.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct V3PaginationMetaDto {
/// Total number of records matching the query across all pages
#[serde(
rename = "totalRecords",
default,
skip_serializing_if = "Option::is_none"
)]
pub total_records: Option<f64>,
/// True when a next page is available
/// Required by the API.
/// (Optional here so responses that omit it still parse.)
#[serde(
rename = "hasNextPage",
default,
skip_serializing_if = "Option::is_none"
)]
pub has_next_page: Option<bool>,
/// True when a previous page is available
/// Required by the API.
/// (Optional here so responses that omit it still parse.)
#[serde(
rename = "hasPrevPage",
default,
skip_serializing_if = "Option::is_none"
)]
pub has_prev_page: Option<bool>,
/// Opaque token to fetch the next page
#[serde(
rename = "nextPageToken",
default,
skip_serializing_if = "Option::is_none"
)]
pub next_page_token: Option<String>,
/// Opaque token to fetch the previous page
#[serde(
rename = "prevPageToken",
default,
skip_serializing_if = "Option::is_none"
)]
pub prev_page_token: Option<String>,
/// Number of items returned in the current page
/// Required by the API.
/// (Optional here so responses that omit it still parse.)
#[serde(
rename = "currentPageSize",
default,
skip_serializing_if = "Option::is_none"
)]
pub current_page_size: Option<f64>,
/// Estimated total records; present when exact total is unknown
#[serde(
rename = "estimatedTotalRecords",
default,
skip_serializing_if = "Option::is_none"
)]
pub estimated_total_records: Option<f64>,
}