Skip to main content

ghl_models/v2/
medias.rs

1//! `medias` data models for GoHighLevel API V2 (10 types).
2//!
3//! Generated from HighLevel's official OpenAPI spec for the
4//! **Medias** module. Every endpoint that uses these types, with its
5//! parameters, required scopes and enum values, is documented in the
6//! [`medias` API reference](https://github.com/Shahroz/ghl-rs/blob/main/docs/api/medias.md).
7//!
8//! Enable with `features = ["medias"]`.
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/// `CreateFolderParams` from the GoHighLevel OpenAPI spec.
22#[derive(Debug, Clone, Default, Serialize, Deserialize)]
23pub struct CreateFolderParams {
24    /// Location Id
25    /// Required by the API.
26    #[serde(rename = "altId")]
27    pub alt_id: String,
28    /// Type of entity (location only)
29    /// Allowed values: `location`.
30    /// Required by the API.
31    #[serde(rename = "altType")]
32    pub alt_type: String,
33    /// Name of the folder to be created
34    /// Required by the API.
35    pub name: String,
36    /// ID of the parent folder (optional)
37    #[serde(rename = "parentId", default, skip_serializing_if = "Option::is_none")]
38    pub parent_id: Option<String>,
39}
40
41/// `DeleteMediaObjectItem` from the GoHighLevel OpenAPI spec.
42#[derive(Debug, Clone, Default, Serialize, Deserialize)]
43pub struct DeleteMediaObjectItem {
44    /// Unique identifier of the file or folder to be deleted
45    /// Required by the API.
46    #[serde(rename = "_id")]
47    pub id: String,
48}
49
50/// `DeleteMediaObjectsBodyParams` from the GoHighLevel OpenAPI spec.
51#[derive(Debug, Clone, Default, Serialize, Deserialize)]
52pub struct DeleteMediaObjectsBodyParams {
53    /// Array of file objects to be deleted or trashed
54    /// Required by the API.
55    #[serde(
56        rename = "filesToBeDeleted",
57        default,
58        skip_serializing_if = "Vec::is_empty"
59    )]
60    pub files_to_be_deleted: Vec<DeleteMediaObjectItem>,
61    /// Type of entity that owns the files
62    /// Allowed values: `location`.
63    /// Required by the API.
64    #[serde(rename = "altType")]
65    pub alt_type: String,
66    /// Location identifier
67    /// Required by the API.
68    #[serde(rename = "altId")]
69    pub alt_id: String,
70    /// Status to set for the files (deleted or trashed)
71    /// Allowed values: `deleted`, `trashed`.
72    /// Required by the API.
73    pub status: String,
74}
75
76/// `FolderDTO` from the GoHighLevel OpenAPI spec.
77#[derive(Debug, Clone, Default, Serialize, Deserialize)]
78pub struct FolderDTO {
79    /// Location identifier that owns this folder
80    /// Required by the API.
81    /// (Optional here so responses that omit it still parse.)
82    #[serde(rename = "altId", default, skip_serializing_if = "Option::is_none")]
83    pub alt_id: Option<String>,
84    /// Type of entity that owns the folder
85    /// Allowed values: `location`.
86    /// Required by the API.
87    /// (Optional here so responses that omit it still parse.)
88    #[serde(rename = "altType", default, skip_serializing_if = "Option::is_none")]
89    pub alt_type: Option<String>,
90    /// Name of the folder
91    /// Required by the API.
92    /// (Optional here so responses that omit it still parse.)
93    #[serde(default, skip_serializing_if = "Option::is_none")]
94    pub name: Option<String>,
95    /// ID of the parent folder (null for root folders)
96    #[serde(rename = "parentId", default, skip_serializing_if = "Option::is_none")]
97    pub parent_id: Option<String>,
98    /// Type of the object (always 'folder' for folders)
99    /// Required by the API.
100    /// (Optional here so responses that omit it still parse.)
101    #[serde(rename = "type", default, skip_serializing_if = "Option::is_none")]
102    pub type_: Option<String>,
103    /// Whether the folder has been deleted
104    #[serde(default, skip_serializing_if = "Option::is_none")]
105    pub deleted: Option<bool>,
106    /// Whether there are pending uploads to this folder
107    #[serde(
108        rename = "pendingUpload",
109        default,
110        skip_serializing_if = "Option::is_none"
111    )]
112    pub pending_upload: Option<bool>,
113    /// Primary category of content stored in the folder
114    #[serde(default, skip_serializing_if = "Option::is_none")]
115    pub category: Option<String>,
116    /// Sub-category of content stored in the folder
117    #[serde(
118        rename = "subCategory",
119        default,
120        skip_serializing_if = "Option::is_none"
121    )]
122    pub sub_category: Option<String>,
123    /// Whether the folder is private and not publicly accessible
124    #[serde(rename = "isPrivate", default, skip_serializing_if = "Option::is_none")]
125    pub is_private: Option<bool>,
126    /// Whether the folder has been moved from its original location
127    #[serde(
128        rename = "relocatedFolder",
129        default,
130        skip_serializing_if = "Option::is_none"
131    )]
132    pub relocated_folder: Option<bool>,
133    /// Whether the data migration process has been completed for this folder
134    #[serde(
135        rename = "migrationCompleted",
136        default,
137        skip_serializing_if = "Option::is_none"
138    )]
139    pub migration_completed: Option<bool>,
140    /// Whether this is a system-generated application folder
141    #[serde(rename = "appFolder", default, skip_serializing_if = "Option::is_none")]
142    pub app_folder: Option<bool>,
143    /// Whether the folder is essential and should not be deleted
144    #[serde(
145        rename = "isEssential",
146        default,
147        skip_serializing_if = "Option::is_none"
148    )]
149    pub is_essential: Option<bool>,
150    /// Current status of the folder
151    #[serde(default, skip_serializing_if = "Option::is_none")]
152    pub status: Option<String>,
153    /// ID of the user who last updated the folder
154    #[serde(
155        rename = "lastUpdatedBy",
156        default,
157        skip_serializing_if = "Option::is_none"
158    )]
159    pub last_updated_by: Option<String>,
160}
161
162/// `GetFilesResponseDTO` from the GoHighLevel OpenAPI spec.
163#[derive(Debug, Clone, Default, Serialize, Deserialize)]
164pub struct GetFilesResponseDTO {
165    /// Array of File Objects
166    /// Required by the API.
167    /// (Optional here so responses that omit it still parse.)
168    #[serde(default, skip_serializing_if = "Vec::is_empty")]
169    pub files: Vec<String>,
170}
171
172/// `MoveOrDeleteObjectParams` from the GoHighLevel OpenAPI spec.
173#[derive(Debug, Clone, Default, Serialize, Deserialize)]
174pub struct MoveOrDeleteObjectParams {
175    /// Required by the API.
176    /// (Optional here so responses that omit it still parse.)
177    #[serde(rename = "altType", default, skip_serializing_if = "Option::is_none")]
178    pub alt_type: Option<String>,
179    /// Required by the API.
180    /// (Optional here so responses that omit it still parse.)
181    #[serde(rename = "altId", default, skip_serializing_if = "Option::is_none")]
182    pub alt_id: Option<String>,
183    /// Required by the API.
184    /// (Optional here so responses that omit it still parse.)
185    #[serde(rename = "_id", default, skip_serializing_if = "Option::is_none")]
186    pub id: Option<String>,
187}
188
189/// `UpdateMediaObject` from the GoHighLevel OpenAPI spec.
190#[derive(Debug, Clone, Default, Serialize, Deserialize)]
191pub struct UpdateMediaObject {
192    /// Unique identifier of the file or folder to be updated
193    /// Required by the API.
194    pub id: String,
195    /// New name for the file or folder
196    #[serde(default, skip_serializing_if = "Option::is_none")]
197    pub name: Option<String>,
198}
199
200/// `UpdateMediaObjects` from the GoHighLevel OpenAPI spec.
201#[derive(Debug, Clone, Default, Serialize, Deserialize)]
202pub struct UpdateMediaObjects {
203    /// Location identifier
204    /// Required by the API.
205    #[serde(rename = "altId")]
206    pub alt_id: String,
207    /// Type of entity that owns the files
208    /// Allowed values: `location`.
209    /// Required by the API.
210    #[serde(rename = "altType")]
211    pub alt_type: String,
212    /// Array of file objects to be updated
213    /// Required by the API.
214    #[serde(
215        rename = "filesToBeUpdated",
216        default,
217        skip_serializing_if = "Vec::is_empty"
218    )]
219    pub files_to_be_updated: Vec<UpdateMediaObject>,
220}
221
222/// `UpdateObject` from the GoHighLevel OpenAPI spec.
223#[derive(Debug, Clone, Default, Serialize, Deserialize)]
224pub struct UpdateObject {
225    /// New name for the file or folder
226    /// Required by the API.
227    pub name: String,
228    /// Type of entity that owns the file or folder
229    /// Allowed values: `location`.
230    /// Required by the API.
231    #[serde(rename = "altType")]
232    pub alt_type: String,
233    /// Location identifier that owns the file or folder
234    /// Required by the API.
235    #[serde(rename = "altId")]
236    pub alt_id: String,
237}
238
239/// `UploadFileResponseDTO` from the GoHighLevel OpenAPI spec.
240#[derive(Debug, Clone, Default, Serialize, Deserialize)]
241pub struct UploadFileResponseDTO {
242    /// ID of the uploaded file
243    /// Required by the API.
244    /// (Optional here so responses that omit it still parse.)
245    #[serde(rename = "fileId", default, skip_serializing_if = "Option::is_none")]
246    pub file_id: Option<String>,
247    /// Google Cloud Storage URL of the uploaded file
248    /// Required by the API.
249    /// (Optional here so responses that omit it still parse.)
250    #[serde(default, skip_serializing_if = "Option::is_none")]
251    pub url: Option<String>,
252}