Skip to main content

ghl_models/v2/
oauth.rs

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