Skip to main content

ghl_models/v2/
oauth.rs

1// @generated by xtask/generate_models.py — do not edit by hand.
2// Source: https://github.com/GoHighLevel/highlevel-api-docs
3// Doc comments are HighLevel's own field descriptions, reflowed verbatim, so
4// they aren't held to rustdoc's markdown conventions.
5#![allow(
6    missing_docs,
7    clippy::doc_lazy_continuation,
8    clippy::doc_overindented_list_items
9)]
10
11use serde::{Deserialize, Serialize};
12
13/// `GetAccessCodeSuccessfulResponseDto` from the GoHighLevel OpenAPI spec.
14#[derive(Debug, Clone, Default, Serialize, Deserialize)]
15pub struct GetAccessCodeSuccessfulResponseDto {
16    #[serde(default, skip_serializing_if = "Option::is_none")]
17    pub access_token: Option<String>,
18    #[serde(default, skip_serializing_if = "Option::is_none")]
19    pub token_type: Option<String>,
20    #[serde(default, skip_serializing_if = "Option::is_none")]
21    pub expires_in: Option<f64>,
22    #[serde(default, skip_serializing_if = "Option::is_none")]
23    pub refresh_token: Option<String>,
24    #[serde(default, skip_serializing_if = "Option::is_none")]
25    pub scope: Option<String>,
26    #[serde(rename = "userType", default, skip_serializing_if = "Option::is_none")]
27    pub user_type: Option<String>,
28    /// Location ID - Present only for Sub-Account Access Token
29    #[serde(
30        rename = "locationId",
31        default,
32        skip_serializing_if = "Option::is_none"
33    )]
34    pub location_id: Option<String>,
35    /// Company ID
36    #[serde(rename = "companyId", default, skip_serializing_if = "Option::is_none")]
37    pub company_id: Option<String>,
38    /// Approved locations to generate location access token
39    #[serde(
40        rename = "approvedLocations",
41        default,
42        skip_serializing_if = "Vec::is_empty"
43    )]
44    pub approved_locations: Vec<String>,
45    /// USER ID - Represent user id of person who performed installation
46    /// Required by the API.
47    #[serde(rename = "userId")]
48    pub user_id: String,
49    /// Plan Id of the subscribed plan in paid apps.
50    #[serde(rename = "planId", default, skip_serializing_if = "Option::is_none")]
51    pub plan_id: Option<String>,
52    #[serde(
53        rename = "isBulkInstallation",
54        default,
55        skip_serializing_if = "Option::is_none"
56    )]
57    pub is_bulk_installation: Option<bool>,
58    /// Boolean to control if user wants app to be automatically installed to future locations
59    /// (only for company tokens)
60    #[serde(
61        rename = "installToFutureLocations",
62        default,
63        skip_serializing_if = "Option::is_none"
64    )]
65    pub install_to_future_locations: Option<bool>,
66    /// Boolean indicating if user approved all locations during bulk installation (only for
67    /// company tokens)
68    #[serde(
69        rename = "approveAllLocations",
70        default,
71        skip_serializing_if = "Option::is_none"
72    )]
73    pub approve_all_locations: Option<bool>,
74}
75
76/// `GetAccessCodebodyDto` from the GoHighLevel OpenAPI spec.
77#[derive(Debug, Clone, Default, Serialize, Deserialize)]
78pub struct GetAccessCodebodyDto {
79    /// The ID provided by GHL for your integration
80    /// Required by the API.
81    pub client_id: String,
82    /// Required by the API.
83    pub client_secret: String,
84    /// Allowed values: `authorization_code`, `refresh_token`, `client_credentials`.
85    /// Required by the API.
86    pub grant_type: String,
87    #[serde(default, skip_serializing_if = "Option::is_none")]
88    pub code: Option<String>,
89    #[serde(default, skip_serializing_if = "Option::is_none")]
90    pub refresh_token: Option<String>,
91    /// The type of token to be requested
92    /// Allowed values: `Company`, `Location`.
93    #[serde(default, skip_serializing_if = "Option::is_none")]
94    pub user_type: Option<String>,
95    /// The redirect URI for your application
96    #[serde(default, skip_serializing_if = "Option::is_none")]
97    pub redirect_uri: Option<String>,
98}
99
100/// `GetInstalledLocationsSuccessfulResponseDto` from the GoHighLevel OpenAPI spec.
101#[derive(Debug, Clone, Default, Serialize, Deserialize)]
102pub struct GetInstalledLocationsSuccessfulResponseDto {
103    #[serde(default, skip_serializing_if = "Vec::is_empty")]
104    pub locations: Vec<InstalledLocationSchema>,
105    /// Total location count under the company
106    #[serde(default, skip_serializing_if = "Option::is_none")]
107    pub count: Option<f64>,
108    /// Boolean to control if user wants app to be automatically installed to future locations
109    #[serde(
110        rename = "installToFutureLocations",
111        default,
112        skip_serializing_if = "Option::is_none"
113    )]
114    pub install_to_future_locations: Option<bool>,
115}
116
117/// `GetLocationAccessCodeBodyDto` from the GoHighLevel OpenAPI spec.
118#[derive(Debug, Clone, Default, Serialize, Deserialize)]
119pub struct GetLocationAccessCodeBodyDto {
120    /// Company Id of location you want to request token for
121    /// Required by the API.
122    #[serde(rename = "companyId")]
123    pub company_id: String,
124    /// The location ID for which you want to obtain accessToken
125    /// Required by the API.
126    #[serde(rename = "locationId")]
127    pub location_id: String,
128}
129
130/// `GetLocationAccessTokenSuccessfulResponseDto` from the GoHighLevel OpenAPI spec.
131#[derive(Debug, Clone, Default, Serialize, Deserialize)]
132pub struct GetLocationAccessTokenSuccessfulResponseDto {
133    /// Location access token which can be used to authenticate & authorize API under following
134    /// scope
135    #[serde(default, skip_serializing_if = "Option::is_none")]
136    pub access_token: Option<String>,
137    #[serde(default, skip_serializing_if = "Option::is_none")]
138    pub token_type: Option<String>,
139    /// Time in seconds remaining for token to expire
140    #[serde(default, skip_serializing_if = "Option::is_none")]
141    pub expires_in: Option<f64>,
142    /// Scopes the following accessToken have access to
143    #[serde(default, skip_serializing_if = "Option::is_none")]
144    pub scope: Option<String>,
145    /// Location ID - Present only for Sub-Account Access Token
146    #[serde(
147        rename = "locationId",
148        default,
149        skip_serializing_if = "Option::is_none"
150    )]
151    pub location_id: Option<String>,
152    /// Plan Id of the subscribed plan in paid apps.
153    #[serde(rename = "planId", default, skip_serializing_if = "Option::is_none")]
154    pub plan_id: Option<String>,
155    /// USER ID - Represent user id of person who performed installation
156    /// Required by the API.
157    #[serde(rename = "userId")]
158    pub user_id: String,
159    /// App ID of the installed application
160    #[serde(rename = "appId", default, skip_serializing_if = "Option::is_none")]
161    pub app_id: Option<String>,
162    /// Version ID of the installed app version
163    #[serde(rename = "versionId", default, skip_serializing_if = "Option::is_none")]
164    pub version_id: Option<String>,
165}
166
167/// `InstalledLocationSchema` from the GoHighLevel OpenAPI spec.
168#[derive(Debug, Clone, Default, Serialize, Deserialize)]
169pub struct InstalledLocationSchema {
170    /// Location ID
171    /// Required by the API.
172    #[serde(rename = "_id")]
173    pub id: String,
174    /// Name of the location
175    /// Required by the API.
176    pub name: String,
177    /// Address linked to location
178    /// Required by the API.
179    pub address: String,
180    /// Check if the requested app is installed for following location
181    #[serde(
182        rename = "isInstalled",
183        default,
184        skip_serializing_if = "Option::is_none"
185    )]
186    pub is_installed: Option<bool>,
187    /// Version ID of the installed app version for this location
188    #[serde(rename = "versionId", default, skip_serializing_if = "Option::is_none")]
189    pub version_id: Option<String>,
190    /// Timestamp when the app was installed on this location
191    /// Format: date-time (ISO-8601 string).
192    #[serde(
193        rename = "installedAt",
194        default,
195        skip_serializing_if = "Option::is_none"
196    )]
197    pub installed_at: Option<String>,
198}