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    #[serde(rename = "altId")]
82    pub alt_id: String,
83    /// Type of entity that owns the folder
84    /// Allowed values: `location`.
85    /// Required by the API.
86    #[serde(rename = "altType")]
87    pub alt_type: String,
88    /// Name of the folder
89    /// Required by the API.
90    pub name: String,
91    /// ID of the parent folder (null for root folders)
92    #[serde(rename = "parentId", default, skip_serializing_if = "Option::is_none")]
93    pub parent_id: Option<String>,
94    /// Type of the object (always 'folder' for folders)
95    /// Required by the API.
96    #[serde(rename = "type")]
97    pub type_: String,
98    /// Whether the folder has been deleted
99    #[serde(default, skip_serializing_if = "Option::is_none")]
100    pub deleted: Option<bool>,
101    /// Whether there are pending uploads to this folder
102    #[serde(
103        rename = "pendingUpload",
104        default,
105        skip_serializing_if = "Option::is_none"
106    )]
107    pub pending_upload: Option<bool>,
108    /// Primary category of content stored in the folder
109    #[serde(default, skip_serializing_if = "Option::is_none")]
110    pub category: Option<String>,
111    /// Sub-category of content stored in the folder
112    #[serde(
113        rename = "subCategory",
114        default,
115        skip_serializing_if = "Option::is_none"
116    )]
117    pub sub_category: Option<String>,
118    /// Whether the folder is private and not publicly accessible
119    #[serde(rename = "isPrivate", default, skip_serializing_if = "Option::is_none")]
120    pub is_private: Option<bool>,
121    /// Whether the folder has been moved from its original location
122    #[serde(
123        rename = "relocatedFolder",
124        default,
125        skip_serializing_if = "Option::is_none"
126    )]
127    pub relocated_folder: Option<bool>,
128    /// Whether the data migration process has been completed for this folder
129    #[serde(
130        rename = "migrationCompleted",
131        default,
132        skip_serializing_if = "Option::is_none"
133    )]
134    pub migration_completed: Option<bool>,
135    /// Whether this is a system-generated application folder
136    #[serde(rename = "appFolder", default, skip_serializing_if = "Option::is_none")]
137    pub app_folder: Option<bool>,
138    /// Whether the folder is essential and should not be deleted
139    #[serde(
140        rename = "isEssential",
141        default,
142        skip_serializing_if = "Option::is_none"
143    )]
144    pub is_essential: Option<bool>,
145    /// Current status of the folder
146    #[serde(default, skip_serializing_if = "Option::is_none")]
147    pub status: Option<String>,
148    /// ID of the user who last updated the folder
149    #[serde(
150        rename = "lastUpdatedBy",
151        default,
152        skip_serializing_if = "Option::is_none"
153    )]
154    pub last_updated_by: Option<String>,
155}
156
157/// `GetFilesResponseDTO` from the GoHighLevel OpenAPI spec.
158#[derive(Debug, Clone, Default, Serialize, Deserialize)]
159pub struct GetFilesResponseDTO {
160    /// Array of File Objects
161    /// Required by the API.
162    #[serde(default, skip_serializing_if = "Vec::is_empty")]
163    pub files: Vec<String>,
164}
165
166/// `MoveOrDeleteObjectParams` from the GoHighLevel OpenAPI spec.
167#[derive(Debug, Clone, Default, Serialize, Deserialize)]
168pub struct MoveOrDeleteObjectParams {
169    /// Required by the API.
170    #[serde(rename = "altType")]
171    pub alt_type: String,
172    /// Required by the API.
173    #[serde(rename = "altId")]
174    pub alt_id: String,
175    /// Required by the API.
176    #[serde(rename = "_id")]
177    pub id: String,
178}
179
180/// `UpdateMediaObject` from the GoHighLevel OpenAPI spec.
181#[derive(Debug, Clone, Default, Serialize, Deserialize)]
182pub struct UpdateMediaObject {
183    /// Unique identifier of the file or folder to be updated
184    /// Required by the API.
185    pub id: String,
186    /// New name for the file or folder
187    #[serde(default, skip_serializing_if = "Option::is_none")]
188    pub name: Option<String>,
189}
190
191/// `UpdateMediaObjects` from the GoHighLevel OpenAPI spec.
192#[derive(Debug, Clone, Default, Serialize, Deserialize)]
193pub struct UpdateMediaObjects {
194    /// Location identifier
195    /// Required by the API.
196    #[serde(rename = "altId")]
197    pub alt_id: String,
198    /// Type of entity that owns the files
199    /// Allowed values: `location`.
200    /// Required by the API.
201    #[serde(rename = "altType")]
202    pub alt_type: String,
203    /// Array of file objects to be updated
204    /// Required by the API.
205    #[serde(
206        rename = "filesToBeUpdated",
207        default,
208        skip_serializing_if = "Vec::is_empty"
209    )]
210    pub files_to_be_updated: Vec<UpdateMediaObject>,
211}
212
213/// `UpdateObject` from the GoHighLevel OpenAPI spec.
214#[derive(Debug, Clone, Default, Serialize, Deserialize)]
215pub struct UpdateObject {
216    /// New name for the file or folder
217    /// Required by the API.
218    pub name: String,
219    /// Type of entity that owns the file or folder
220    /// Allowed values: `location`.
221    /// Required by the API.
222    #[serde(rename = "altType")]
223    pub alt_type: String,
224    /// Location identifier that owns the file or folder
225    /// Required by the API.
226    #[serde(rename = "altId")]
227    pub alt_id: String,
228}
229
230/// `UploadFileResponseDTO` from the GoHighLevel OpenAPI spec.
231#[derive(Debug, Clone, Default, Serialize, Deserialize)]
232pub struct UploadFileResponseDTO {
233    /// ID of the uploaded file
234    /// Required by the API.
235    #[serde(rename = "fileId")]
236    pub file_id: String,
237    /// Google Cloud Storage URL of the uploaded file
238    /// Required by the API.
239    pub url: String,
240}