-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.go
More file actions
388 lines (337 loc) · 12.5 KB
/
models.go
File metadata and controls
388 lines (337 loc) · 12.5 KB
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
// Package sirv provides a Go SDK for the Sirv REST API.
package sirv
// TokenResponse represents the authentication token response.
type TokenResponse struct {
Token string `json:"token"`
ExpiresIn int `json:"expiresIn"`
Scope []string `json:"scope"`
}
// AliasConfig represents alias configuration.
type AliasConfig struct {
Prefix string `json:"prefix,omitempty"`
Cdn *bool `json:"cdn,omitempty"`
CustomDomain string `json:"customDomain,omitempty"`
}
// AccountInfo represents account information.
type AccountInfo struct {
Alias string `json:"alias"`
CdnURL string `json:"cdnURL"`
DateCreated string `json:"dateCreated,omitempty"`
Fetching *FetchingOptions `json:"fetching,omitempty"`
Minify *MinifyOptions `json:"minify,omitempty"`
Aliases map[string]*AliasConfig `json:"aliases,omitempty"`
FileSizeLimit int64 `json:"fileSizeLimit,omitempty"`
}
// FetchingOptions represents HTTP fetching configuration.
type FetchingOptions struct {
Enabled *bool `json:"enabled,omitempty"`
Type string `json:"type,omitempty"`
HTTP *HTTPFetchingConfig `json:"http,omitempty"`
}
// HTTPFetchingConfig represents HTTP fetching configuration details.
type HTTPFetchingConfig struct {
Auth *HTTPFetchingAuth `json:"auth,omitempty"`
URL string `json:"url,omitempty"`
}
// HTTPFetchingAuth represents HTTP fetching authentication settings.
type HTTPFetchingAuth struct {
Enabled bool `json:"enabled"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
}
// MinifyOptions represents minification settings.
type MinifyOptions struct {
Enabled *bool `json:"enabled,omitempty"`
}
// AccountUpdateOptions represents options for updating account settings.
type AccountUpdateOptions struct {
Fetching *FetchingOptions `json:"fetching,omitempty"`
Minify *MinifyOptions `json:"minify,omitempty"`
Aliases []string `json:"aliases,omitempty"`
}
// RateLimitInfo represents rate limit information for a specific endpoint type.
type RateLimitInfo struct {
Limit int `json:"limit"`
Remaining int `json:"remaining"`
Reset string `json:"reset,omitempty"`
Count int `json:"count"`
}
// AccountLimits represents API rate limits for different endpoint types.
type AccountLimits struct {
S3 *RateLimitInfo `json:"s3,omitempty"`
Rest *RateLimitInfo `json:"rest,omitempty"`
FTP *RateLimitInfo `json:"ftp,omitempty"`
}
// StorageInfo represents storage usage information.
type StorageInfo struct {
Allowance int64 `json:"allowance"`
Used int64 `json:"used"`
Files int64 `json:"files"`
Burstable *int64 `json:"burstable,omitempty"`
}
// AccountUser represents account user information.
type AccountUser struct {
UserID string `json:"userId"`
Email string `json:"email"`
FirstName string `json:"firstName,omitempty"`
LastName string `json:"lastName,omitempty"`
Role string `json:"role"`
DateCreated string `json:"dateCreated,omitempty"`
}
// PlanPrice represents plan price information.
type PlanPrice struct {
Month *float64 `json:"month,omitempty"`
Year *float64 `json:"year,omitempty"`
Quarter *float64 `json:"quarter,omitempty"`
}
// BillingPlan represents billing plan information.
type BillingPlan struct {
ID string `json:"id,omitempty"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Period string `json:"period,omitempty"`
Storage int64 `json:"storage"`
DataTransferLimit *int64 `json:"dataTransferLimit,omitempty"`
Price *PlanPrice `json:"price,omitempty"`
DateActive string `json:"dateActive,omitempty"`
}
// AccountEvent represents an account event log entry.
type AccountEvent struct {
ID string `json:"id"`
Module string `json:"module"`
Type string `json:"type"`
Level string `json:"level"`
Message string `json:"message"`
Filename string `json:"filename,omitempty"`
Timestamp string `json:"timestamp"`
Seen *bool `json:"seen,omitempty"`
}
// EventSearchParams represents parameters for searching account events.
type EventSearchParams struct {
Module string `json:"module,omitempty"`
Type string `json:"type,omitempty"`
Level string `json:"level,omitempty"`
Filename string `json:"filename,omitempty"`
From string `json:"from,omitempty"`
To string `json:"to,omitempty"`
}
// UserInfo represents user information.
type UserInfo struct {
UserID string `json:"userId"`
Email string `json:"email"`
FirstName string `json:"firstName,omitempty"`
LastName string `json:"lastName,omitempty"`
DateCreated string `json:"dateCreated,omitempty"`
S3Key string `json:"s3Key,omitempty"`
S3Secret string `json:"s3Secret,omitempty"`
}
// FileMeta represents file metadata.
type FileMeta struct {
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Tags []string `json:"tags,omitempty"`
Approved *bool `json:"approved,omitempty"`
}
// FileInfo represents file or folder information.
type FileInfo struct {
Filename string `json:"filename"`
Dirname string `json:"dirname,omitempty"`
Basename string `json:"basename,omitempty"`
IsDirectory bool `json:"isDirectory"`
Size *int64 `json:"size,omitempty"`
Ctime string `json:"ctime,omitempty"`
Mtime string `json:"mtime,omitempty"`
ContentType string `json:"contentType,omitempty"`
Meta *FileMeta `json:"meta,omitempty"`
}
// ProductMeta represents product-specific metadata.
type ProductMeta struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Brand string `json:"brand,omitempty"`
Category string `json:"category,omitempty"`
SKU string `json:"sku,omitempty"`
}
// FolderContents represents folder contents response.
type FolderContents struct {
Contents []FileInfo `json:"contents"`
Continuation string `json:"continuation,omitempty"`
}
// FolderOptions represents folder options/settings.
type FolderOptions struct {
ScanSpins *bool `json:"scanSpins,omitempty"`
AllowListing *bool `json:"allowListing,omitempty"`
}
// SortOptions represents sort options for search.
type SortOptions struct {
Field string `json:"field"`
Order string `json:"order"` // "asc" or "desc"
}
// SearchFilters represents search filters.
type SearchFilters struct {
Dirname string `json:"dirname,omitempty"`
Filename string `json:"filename,omitempty"`
Basename string `json:"basename,omitempty"`
Extension interface{} `json:"extension,omitempty"` // string or []string
ContentType interface{} `json:"contentType,omitempty"` // string or []string
MinSize *int64 `json:"minSize,omitempty"`
MaxSize *int64 `json:"maxSize,omitempty"`
MinDate string `json:"minDate,omitempty"`
MaxDate string `json:"maxDate,omitempty"`
}
// SearchParams represents parameters for file search.
type SearchParams struct {
Query string `json:"query,omitempty"`
From *int `json:"from,omitempty"`
Size *int `json:"size,omitempty"`
Sort *SortOptions `json:"sort,omitempty"`
Filters *SearchFilters `json:"filters,omitempty"`
}
// SearchResult represents search results.
type SearchResult struct {
Hits []FileInfo `json:"hits"`
Total int64 `json:"total"`
ScrollID string `json:"scrollId,omitempty"`
}
// UploadOptions represents upload options.
type UploadOptions struct {
Filename string `json:"filename,omitempty"`
ContentType string `json:"contentType,omitempty"`
}
// FetchURLParams represents parameters for fetching file from URL.
type FetchURLParams struct {
URL string `json:"url"`
Filename string `json:"filename"`
Wait *bool `json:"wait,omitempty"`
}
// CopyParams represents copy operation parameters.
type CopyParams struct {
From string `json:"from"`
To string `json:"to"`
}
// RenameParams represents rename/move operation parameters.
type RenameParams struct {
From string `json:"from"`
To string `json:"to"`
}
// BatchDeleteResult represents batch delete operation result.
type BatchDeleteResult struct {
JobID string `json:"jobId,omitempty"`
Status string `json:"status,omitempty"`
Results []BatchDeleteItemResult `json:"results,omitempty"`
}
// BatchDeleteItemResult represents result for a single file in batch delete.
type BatchDeleteItemResult struct {
Filename string `json:"filename"`
Success bool `json:"success"`
Error string `json:"error,omitempty"`
}
// BatchZipParams represents batch ZIP operation parameters.
type BatchZipParams struct {
Filenames []string `json:"filenames"`
Filename string `json:"filename"`
}
// BatchZipResult represents batch ZIP operation result.
type BatchZipResult struct {
JobID string `json:"jobId,omitempty"`
Status string `json:"status,omitempty"`
Filename string `json:"filename,omitempty"`
}
// JWTParams represents JWT generation parameters.
type JWTParams struct {
Filename string `json:"filename"`
ExpiresIn *int `json:"expiresIn,omitempty"`
SecureParams map[string]string `json:"secureParams,omitempty"`
}
// JWTResponse represents JWT generation response.
type JWTResponse struct {
URL string `json:"url"`
Token string `json:"token"`
}
// SpinConvertOptions represents spin conversion options.
type SpinConvertOptions struct {
Width *int `json:"width,omitempty"`
Height *int `json:"height,omitempty"`
Loops *int `json:"loops,omitempty"`
Format string `json:"format,omitempty"`
}
// SpinConvertParams represents spin to video conversion parameters.
type SpinConvertParams struct {
Filename string `json:"filename"`
Options *SpinConvertOptions `json:"options,omitempty"`
}
// Video2SpinOptions represents video to spin conversion options.
type Video2SpinOptions struct {
Frames *int `json:"frames,omitempty"`
Start *float64 `json:"start,omitempty"`
Duration *float64 `json:"duration,omitempty"`
}
// Video2SpinParams represents video to spin conversion parameters.
type Video2SpinParams struct {
Filename string `json:"filename"`
TargetFilename string `json:"targetFilename,omitempty"`
Options *Video2SpinOptions `json:"options,omitempty"`
}
// ExportSpinParams represents spin export parameters.
type ExportSpinParams struct {
Filename string `json:"filename"`
ASIN string `json:"asin,omitempty"`
ProductID string `json:"productId,omitempty"`
}
// PointOfInterest represents a point of interest on a spin.
type PointOfInterest struct {
Name string `json:"name"`
X float64 `json:"x"`
Y float64 `json:"y"`
Frame *int `json:"frame,omitempty"`
}
// StatsParams represents date range parameters for statistics.
type StatsParams struct {
From string `json:"from"`
To string `json:"to"`
}
// HTTPStats represents HTTP transfer statistics entry.
type HTTPStats struct {
Date string `json:"date"`
Transfer int64 `json:"transfer"`
Requests *int64 `json:"requests,omitempty"`
}
// SpinViewStats represents spin view statistics entry.
type SpinViewStats struct {
Date string `json:"date"`
Views int64 `json:"views"`
Spins *int64 `json:"spins,omitempty"`
Zooms *int64 `json:"zooms,omitempty"`
Fullscreens *int64 `json:"fullscreens,omitempty"`
UserAgent string `json:"userAgent,omitempty"`
Country string `json:"country,omitempty"`
}
// StorageStats represents storage statistics entry.
type StorageStats struct {
Date string `json:"date"`
Storage int64 `json:"storage"`
Files *int64 `json:"files,omitempty"`
}
// Internal models for raw Elasticsearch responses.
type rawSearchHit struct {
Source *rawFileSource `json:"_source,omitempty"`
}
type rawFileSource struct {
Filename string `json:"filename"`
Dirname string `json:"dirname,omitempty"`
Basename string `json:"basename,omitempty"`
IsDirectory bool `json:"isDirectory"`
Size *int64 `json:"size,omitempty"`
Ctime string `json:"ctime,omitempty"`
Mtime string `json:"mtime,omitempty"`
ContentType string `json:"contentType,omitempty"`
Meta *FileMeta `json:"meta,omitempty"`
}
type rawSearchResult struct {
Hits []rawSearchHit `json:"hits,omitempty"`
Total interface{} `json:"total,omitempty"`
ScrollID string `json:"scrollId,omitempty"`
}
type totalCount struct {
Value int64 `json:"value"`
}