@epilot/file-client 1.5.2 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/openapi.json CHANGED
@@ -1,616 +1,743 @@
1
1
  {
2
- "openapi": "3.0.3",
3
- "info": {
4
- "title": "File API",
5
- "version": "0.1.0",
6
- "description": "Upload and manage all files stored in epilot"
7
- },
8
- "tags": [
9
- {
10
- "name": "files",
11
- "description": "Files"
12
- }
13
- ],
14
- "security": [
15
- {
16
- "EpilotAuth": []
17
- }
18
- ],
19
- "paths": {
20
- "/v1/files/public/upload": {
21
- "post": {
22
- "operationId": "uploadFilePublic",
23
- "summary": "uploadFilePublic",
24
- "security": [],
25
- "description": "Create pre-signed S3 URL to upload a file to keep temporarily (one week).\n\nUse the createFile operation to store file file permanently.\n",
26
- "tags": [
27
- "files"
28
- ],
29
- "requestBody": {
30
- "content": {
31
- "application/json": {
32
- "schema": {
33
- "$ref": "#/components/schemas/UploadFilePayload"
34
- }
35
- }
36
- }
37
- },
38
- "responses": {
39
- "201": {
40
- "description": "Pre-signed URL for POST / PUT upload",
41
- "content": {
42
- "application/json": {
43
- "schema": {
44
- "type": "object",
45
- "properties": {
46
- "s3ref": {
47
- "allOf": [
48
- {
49
- "$ref": "#/components/schemas/S3Reference"
50
- },
51
- {
52
- "example": {
53
- "bucket": "epilot-files-prod",
54
- "key": "123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf"
55
- }
56
- }
57
- ]
58
- },
59
- "upload_url": {
60
- "type": "string",
61
- "format": "url",
62
- "example": "https://epilot-files-prod.s3.eu-central-1.amazonaws.com/123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf?AWSParams=123"
63
- }
64
- }
65
- }
66
- }
67
- }
68
- }
69
- }
2
+ "openapi": "3.0.3",
3
+ "info": {
4
+ "title": "File API",
5
+ "version": "0.1.0",
6
+ "description": "Upload and manage all files stored in epilot"
7
+ },
8
+ "tags": [
9
+ {
10
+ "name": "files",
11
+ "description": "Files"
12
+ }
13
+ ],
14
+ "security": [
15
+ {
16
+ "EpilotAuth": []
17
+ }
18
+ ],
19
+ "paths": {
20
+ "/v1/files/public/upload": {
21
+ "post": {
22
+ "operationId": "uploadFilePublic",
23
+ "summary": "uploadFilePublic",
24
+ "security": [],
25
+ "description": "Create pre-signed S3 URL to upload a file to keep temporarily (one week).\n\nUse the createFile operation to store file file permanently.\n",
26
+ "tags": [
27
+ "files"
28
+ ],
29
+ "requestBody": {
30
+ "content": {
31
+ "application/json": {
32
+ "schema": {
33
+ "$ref": "#/components/schemas/UploadFilePayload"
34
+ }
70
35
  }
36
+ }
71
37
  },
72
- "/v1/files/upload": {
73
- "post": {
74
- "operationId": "uploadFile",
75
- "summary": "uploadFile",
76
- "description": "Create pre-signed S3 URL to upload a file to keep temporarily (one week).\n\nUse the createFile operation to store file file permanently.\n",
77
- "tags": [
78
- "files"
79
- ],
80
- "parameters": [
81
- {
82
- "name": "file_entity_id",
83
- "in": "query",
84
- "description": "file entity id",
85
- "schema": {
86
- "$ref": "#/components/schemas/FileEntityId"
87
- }
88
- }
89
- ],
90
- "requestBody": {
91
- "content": {
92
- "application/json": {
93
- "schema": {
94
- "$ref": "#/components/schemas/UploadFilePayload",
95
- "type": "object"
96
- }
97
- }
98
- }
99
- },
100
- "responses": {
101
- "201": {
102
- "description": "Pre-signed URL for POST / PUT upload",
103
- "content": {
104
- "application/json": {
105
- "schema": {
106
- "type": "object",
107
- "properties": {
108
- "s3ref": {
109
- "allOf": [
110
- {
111
- "$ref": "#/components/schemas/S3Reference"
112
- },
113
- {
114
- "example": {
115
- "bucket": "epilot-files-prod",
116
- "key": "123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf"
117
- }
118
- }
119
- ]
120
- },
121
- "upload_url": {
122
- "type": "string",
123
- "format": "url",
124
- "example": "https://epilot-files-prod.s3.eu-central-1.amazonaws.com/123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf?AWSParams=123"
125
- },
126
- "public_url": {
127
- "description": "Returned only if file is permanent i.e. file_entity_id is passed",
128
- "type": "string",
129
- "format": "url",
130
- "example": "https://epilot-files-prod.s3.eu-central-1.amazonaws.com/123/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf"
131
- }
132
- }
133
- }
134
- }
38
+ "responses": {
39
+ "201": {
40
+ "description": "Pre-signed URL for POST / PUT upload",
41
+ "content": {
42
+ "application/json": {
43
+ "schema": {
44
+ "type": "object",
45
+ "properties": {
46
+ "s3ref": {
47
+ "allOf": [
48
+ {
49
+ "$ref": "#/components/schemas/S3Reference"
50
+ },
51
+ {
52
+ "example": {
53
+ "bucket": "epilot-files-prod",
54
+ "key": "123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf"
55
+ }
135
56
  }
57
+ ]
58
+ },
59
+ "upload_url": {
60
+ "type": "string",
61
+ "format": "url",
62
+ "example": "https://epilot-files-prod.s3.eu-central-1.amazonaws.com/123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf?AWSParams=123"
136
63
  }
64
+ }
137
65
  }
66
+ }
138
67
  }
139
- },
140
- "/v1/files": {
141
- "post": {
142
- "operationId": "saveFile",
143
- "summary": "saveFile",
144
- "description": "Create / Update a permanent File entity\n\nMakes file object permanent\n\nSaves metadata to file entity\n",
145
- "tags": [
146
- "files"
147
- ],
148
- "requestBody": {
149
- "content": {
150
- "application/json": {
151
- "schema": {
152
- "$ref": "#/components/schemas/SaveFilePayload"
153
- }
154
- }
155
- }
156
- },
157
- "responses": {
158
- "201": {
159
- "description": "Created File Entity",
160
- "content": {
161
- "application/json": {
162
- "schema": {
163
- "$ref": "#/components/schemas/FileEntity"
164
- }
165
- }
166
- }
167
- }
168
- }
68
+ }
69
+ }
70
+ }
71
+ },
72
+ "/v1/files/upload": {
73
+ "post": {
74
+ "operationId": "uploadFile",
75
+ "summary": "uploadFile",
76
+ "description": "Create pre-signed S3 URL to upload a file to keep temporarily (one week).\n\nUse the createFile operation to store file file permanently.\n",
77
+ "tags": [
78
+ "files"
79
+ ],
80
+ "parameters": [
81
+ {
82
+ "name": "file_entity_id",
83
+ "in": "query",
84
+ "description": "file entity id",
85
+ "schema": {
86
+ "$ref": "#/components/schemas/FileEntityId"
169
87
  }
170
- },
171
- "/v1/files/{id}/download": {
172
- "get": {
173
- "operationId": "downloadFile",
174
- "summary": "downloadFile",
175
- "description": "Generate pre-signed download S3 url for a file",
176
- "tags": [
177
- "files"
178
- ],
179
- "parameters": [
180
- {
181
- "name": "id",
182
- "in": "path",
183
- "required": true,
184
- "schema": {
185
- "$ref": "#/components/schemas/FileEntityId"
186
- }
187
- },
188
- {
189
- "name": "version",
190
- "in": "query",
191
- "description": "index of file version",
192
- "schema": {
193
- "type": "integer",
194
- "default": 0
195
- }
196
- },
197
- {
198
- "name": "attachment",
199
- "in": "query",
200
- "description": "Controls the Content-Disposition header to control browser behaviour. Set to true to trigger download.",
201
- "schema": {
202
- "type": "boolean",
203
- "default": true
204
- }
205
- }
206
- ],
207
- "responses": {
208
- "200": {
209
- "description": "Generated thumbnail image",
210
- "content": {
211
- "application/json": {
212
- "schema": {
213
- "type": "object",
214
- "properties": {
215
- "download_url": {
216
- "type": "string",
217
- "format": "uri",
218
- "example": "https://epilot-files-prod.s3.eu-central-1.amazonaws.com/123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf?AWSParams=123"
219
- }
220
- }
221
- }
222
- }
223
- }
224
- }
225
- }
88
+ }
89
+ ],
90
+ "requestBody": {
91
+ "content": {
92
+ "application/json": {
93
+ "schema": {
94
+ "$ref": "#/components/schemas/UploadFilePayload",
95
+ "type": "object"
96
+ }
226
97
  }
98
+ }
227
99
  },
228
- "/v1/files:downloadS3": {
229
- "post": {
230
- "operationId": "downloadS3File",
231
- "summary": "downloadS3File",
232
- "description": "Generate pre-signed download S3 url for a file",
233
- "tags": [
234
- "files"
235
- ],
236
- "parameters": [
237
- {
238
- "name": "s3_key",
239
- "in": "query",
240
- "required": true,
241
- "schema": {
242
- "type": "string"
100
+ "responses": {
101
+ "201": {
102
+ "description": "Pre-signed URL for POST / PUT upload",
103
+ "content": {
104
+ "application/json": {
105
+ "schema": {
106
+ "type": "object",
107
+ "properties": {
108
+ "s3ref": {
109
+ "allOf": [
110
+ {
111
+ "$ref": "#/components/schemas/S3Reference"
112
+ },
113
+ {
114
+ "example": {
115
+ "bucket": "epilot-files-prod",
116
+ "key": "123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf"
117
+ }
243
118
  }
119
+ ]
244
120
  },
245
- {
246
- "name": "s3_bucket",
247
- "in": "query",
248
- "required": true,
249
- "schema": {
250
- "type": "string"
251
- }
121
+ "upload_url": {
122
+ "type": "string",
123
+ "format": "url",
124
+ "example": "https://epilot-files-prod.s3.eu-central-1.amazonaws.com/123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf?AWSParams=123"
252
125
  },
253
- {
254
- "name": "attachment",
255
- "in": "query",
256
- "description": "Controls the Content-Disposition header to control browser behaviour. Set to true to trigger download.",
257
- "schema": {
258
- "type": "boolean",
259
- "default": true
260
- }
261
- }
262
- ],
263
- "responses": {
264
- "200": {
265
- "description": "Generated thumbnail image",
266
- "content": {
267
- "application/json": {
268
- "schema": {
269
- "type": "object",
270
- "properties": {
271
- "download_url": {
272
- "type": "string",
273
- "format": "uri",
274
- "example": "https://epilot-files-prod.s3.eu-central-1.amazonaws.com/123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf?AWSParams=123"
275
- }
276
- }
277
- }
278
- }
279
- }
126
+ "public_url": {
127
+ "description": "Returned only if file is permanent i.e. file_entity_id is passed",
128
+ "type": "string",
129
+ "format": "url",
130
+ "example": "https://epilot-files-prod.s3.eu-central-1.amazonaws.com/123/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf"
280
131
  }
132
+ }
281
133
  }
134
+ }
282
135
  }
283
- },
284
- "/v1/files/{id}/preview": {
285
- "get": {
286
- "operationId": "previewFile",
287
- "summary": "previewFile",
288
- "description": "Generate thumbnail preview for a file entity",
289
- "tags": [
290
- "files"
291
- ],
292
- "parameters": [
293
- {
294
- "name": "id",
295
- "in": "path",
296
- "required": true,
297
- "schema": {
298
- "$ref": "#/components/schemas/FileEntityId"
299
- }
300
- },
301
- {
302
- "name": "version",
303
- "in": "query",
304
- "description": "index of file version",
305
- "schema": {
306
- "type": "integer",
307
- "default": 0
308
- }
309
- },
310
- {
311
- "name": "w",
312
- "in": "query",
313
- "description": "width",
314
- "schema": {
315
- "type": "integer"
316
- }
317
- },
318
- {
319
- "name": "h",
320
- "in": "query",
321
- "description": "height",
322
- "schema": {
323
- "type": "integer"
324
- }
325
- }
326
- ],
327
- "responses": {
328
- "200": {
329
- "description": "Generated thumbnail image",
330
- "content": {
331
- "image/png": {},
332
- "image/jpeg": {}
333
- }
334
- }
335
- }
136
+ }
137
+ }
138
+ }
139
+ },
140
+ "/v1/files": {
141
+ "post": {
142
+ "operationId": "saveFile",
143
+ "summary": "saveFile",
144
+ "description": "Create / Update a permanent File entity\n\nMakes file object permanent\n\nSaves metadata to file entity\n",
145
+ "tags": [
146
+ "files"
147
+ ],
148
+ "requestBody": {
149
+ "content": {
150
+ "application/json": {
151
+ "schema": {
152
+ "$ref": "#/components/schemas/SaveFilePayload"
153
+ }
336
154
  }
155
+ }
337
156
  },
338
- "/v1/files:previewS3": {
339
- "post": {
340
- "operationId": "previewS3File",
341
- "summary": "previewS3File",
342
- "description": "Generate thumbnail preview from an s3 reference for a file entity",
343
- "tags": [
344
- "files"
345
- ],
346
- "parameters": [
347
- {
348
- "name": "w",
349
- "in": "query",
350
- "description": "width",
351
- "schema": {
352
- "type": "integer"
353
- }
354
- },
355
- {
356
- "name": "h",
357
- "in": "query",
358
- "description": "height",
359
- "schema": {
360
- "type": "integer"
361
- }
362
- }
363
- ],
364
- "requestBody": {
365
- "content": {
366
- "application/json": {
367
- "schema": {
368
- "$ref": "#/components/schemas/S3Reference"
369
- }
370
- }
371
- }
372
- },
373
- "responses": {
374
- "200": {
375
- "description": "Generated thumbnail image",
376
- "content": {
377
- "image/png": {},
378
- "image/jpeg": {}
379
- }
380
- }
157
+ "responses": {
158
+ "201": {
159
+ "description": "Created File Entity",
160
+ "content": {
161
+ "application/json": {
162
+ "schema": {
163
+ "$ref": "#/components/schemas/FileEntity"
381
164
  }
165
+ }
382
166
  }
383
- },
384
- "/v1/files/delete": {
385
- "delete": {
386
- "operationId": "deleteFile",
387
- "summary": "deleteFile",
388
- "description": "Delete file entity",
389
- "tags": [
390
- "files"
391
- ],
392
- "requestBody": {
393
- "content": {
394
- "application/json": {
395
- "schema": {
396
- "$ref": "#/components/schemas/DeleteFilePayload"
397
- }
398
- }
399
- }
400
- },
401
- "responses": {
402
- "200": {
403
- "description": "File delete response"
167
+ }
168
+ }
169
+ }
170
+ },
171
+ "/v1/files/{id}/download": {
172
+ "get": {
173
+ "operationId": "downloadFile",
174
+ "summary": "downloadFile",
175
+ "description": "Generate pre-signed download S3 url for a file",
176
+ "tags": [
177
+ "files"
178
+ ],
179
+ "parameters": [
180
+ {
181
+ "name": "id",
182
+ "in": "path",
183
+ "required": true,
184
+ "schema": {
185
+ "$ref": "#/components/schemas/FileEntityId"
186
+ }
187
+ },
188
+ {
189
+ "name": "version",
190
+ "in": "query",
191
+ "description": "index of file version",
192
+ "schema": {
193
+ "type": "integer",
194
+ "default": 0
195
+ }
196
+ },
197
+ {
198
+ "name": "attachment",
199
+ "in": "query",
200
+ "description": "Controls the Content-Disposition header to control browser behaviour. Set to true to trigger download.",
201
+ "schema": {
202
+ "type": "boolean",
203
+ "default": true
204
+ }
205
+ }
206
+ ],
207
+ "responses": {
208
+ "200": {
209
+ "description": "Generated thumbnail image",
210
+ "content": {
211
+ "application/json": {
212
+ "schema": {
213
+ "type": "object",
214
+ "properties": {
215
+ "download_url": {
216
+ "type": "string",
217
+ "format": "uri",
218
+ "example": "https://epilot-files-prod.s3.eu-central-1.amazonaws.com/123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf?AWSParams=123"
404
219
  }
220
+ }
405
221
  }
222
+ }
406
223
  }
224
+ }
407
225
  }
226
+ }
408
227
  },
409
- "components": {
410
- "securitySchemes": {
411
- "EpilotAuth": {
412
- "type": "http",
413
- "scheme": "bearer",
414
- "description": "Authorization header with epilot OAuth2 bearer token",
415
- "bearerFormat": "JWT"
228
+ "/v1/files/download": {
229
+ "post": {
230
+ "operationId": "downloadFiles",
231
+ "summary": "downloadFiles",
232
+ "description": "Generate pre-signed download S3 urls for multiple files",
233
+ "tags": [
234
+ "files"
235
+ ],
236
+ "requestBody": {
237
+ "content": {
238
+ "application/json": {
239
+ "schema": {
240
+ "$ref": "#/components/schemas/DownloadFilesPayload"
241
+ }
416
242
  }
243
+ }
417
244
  },
418
- "schemas": {
419
- "FileEntityId": {
420
- "type": "string",
421
- "example": "ef7d985c-2385-44f4-9c71-ae06a52264f8"
422
- },
423
- "FileEntity": {
424
- "type": "object",
425
- "properties": {
426
- "_id": {
427
- "$ref": "#/components/schemas/FileEntityId"
428
- },
429
- "filename": {
430
- "type": "string",
431
- "example": "document.pdf"
432
- },
433
- "access_control": {
245
+ "responses": {
246
+ "200": {
247
+ "description": "Generated download urls",
248
+ "content": {
249
+ "application/json": {
250
+ "schema": {
251
+ "type": "array",
252
+ "items": {
253
+ "type": "object",
254
+ "properties": {
255
+ "download_url": {
434
256
  "type": "string",
435
- "default": "private",
436
- "enum": [
437
- "private",
438
- "public-read"
439
- ]
440
- },
441
- "public_url": {
442
- "description": "Direct URL for file (public only if file access control is public-read)",
443
- "type": "string",
444
- "format": "url",
445
- "example": "https://epilot-files-prod.s3.eu-central-1.amazonaws.com/123/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf"
446
- },
447
- "type": {
448
- "description": "Human readable type for file",
449
- "type": "string",
450
- "enum": [
451
- "document",
452
- "document_template",
453
- "text",
454
- "image",
455
- "video",
456
- "audio",
457
- "spreadsheet",
458
- "presentation",
459
- "font",
460
- "archive",
461
- "application",
462
- "unknown"
463
- ]
464
- },
465
- "mime_type": {
257
+ "format": "uri",
258
+ "example": "https://epilot-files-prod.s3.eu-central-1.amazonaws.com/123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf?AWSParams=123"
259
+ },
260
+ "file_entity_id": {
466
261
  "type": "string",
467
- "description": "MIME type of the file",
468
- "example": "application/pdf"
469
- },
470
- "size_bytes": {
471
- "type": "integer",
472
- "minimum": 0,
473
- "description": "File size in bytes"
474
- },
475
- "versions": {
476
- "type": "array",
477
- "items": {
478
- "type": "object",
479
- "properties": {
480
- "s3ref": {
481
- "$ref": "#/components/schemas/S3Reference"
482
- }
483
- }
484
- }
262
+ "format": "uuid"
263
+ }
485
264
  }
265
+ }
486
266
  }
487
- },
488
- "UploadFilePayload": {
489
- "type": "object",
490
- "properties": {
491
- "filename": {
492
- "type": "string",
493
- "example": "document.pdf"
494
- },
495
- "mime_type": {
496
- "description": "MIME type of file",
497
- "type": "string",
498
- "example": "application/pdf",
499
- "default": "application/octet-stream"
500
- }
501
- },
502
- "required": [
503
- "filename"
504
- ]
505
- },
506
- "SaveFilePayload": {
507
- "type": "object",
508
- "properties": {
509
- "s3ref": {
510
- "$ref": "#/components/schemas/S3Reference"
511
- },
512
- "file_entity_id": {
513
- "type": "string",
514
- "description": "if passed, adds a new version to existing file entity"
515
- },
516
- "document_type": {
517
- "type": "string",
518
- "enum": [
519
- "document",
520
- "document_template",
521
- "text",
522
- "image",
523
- "video",
524
- "audio",
525
- "spreadsheet",
526
- "presentation",
527
- "font",
528
- "archive",
529
- "application",
530
- "unknown"
531
- ]
532
- },
533
- "filename": {
534
- "type": "string",
535
- "example": "document.pdf"
536
- },
537
- "_tags": {
538
- "type": "array",
539
- "items": {
540
- "type": "string"
541
- }
542
- },
543
- "access_control": {
544
- "type": "string",
545
- "default": "private",
546
- "enum": [
547
- "private",
548
- "public-read"
549
- ]
550
- }
551
- },
552
- "additionalProperties": true,
553
- "required": [
554
- "s3ref"
555
- ]
556
- },
557
- "DeleteFilePayload": {
558
- "type": "object",
559
- "properties": {
560
- "s3ref": {
561
- "$ref": "#/components/schemas/S3Reference"
562
- }
563
- },
564
- "required": [
565
- "s3ref"
566
- ]
567
- },
568
- "S3Reference": {
569
- "type": "object",
570
- "properties": {
571
- "bucket": {
572
- "type": "string",
573
- "example": "epilot-files-prod"
574
- },
575
- "key": {
576
- "type": "string",
577
- "example": "123/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf"
578
- }
579
- },
580
- "required": [
581
- "bucket",
582
- "key"
583
- ]
584
- },
585
- "FileItem": {
586
- "allOf": [
587
- {
588
- "$ref": "#/components/schemas/S3Reference"
589
- },
590
- {
591
- "type": "object",
592
- "properties": {
593
- "filename": {
594
- "type": "string",
595
- "example": "document.pdf"
596
- },
597
- "size_bytes": {
598
- "type": "integer",
599
- "example": 1234
600
- },
601
- "mime_type": {
602
- "type": "string",
603
- "example": "image/jpeg"
604
- }
605
- }
267
+ }
268
+ }
269
+ }
270
+ }
271
+ }
272
+ },
273
+ "/v1/files:downloadS3": {
274
+ "post": {
275
+ "operationId": "downloadS3File",
276
+ "summary": "downloadS3File",
277
+ "description": "Generate pre-signed download S3 url for a file",
278
+ "tags": [
279
+ "files"
280
+ ],
281
+ "parameters": [
282
+ {
283
+ "name": "s3_key",
284
+ "in": "query",
285
+ "required": true,
286
+ "schema": {
287
+ "type": "string"
288
+ }
289
+ },
290
+ {
291
+ "name": "s3_bucket",
292
+ "in": "query",
293
+ "required": true,
294
+ "schema": {
295
+ "type": "string"
296
+ }
297
+ },
298
+ {
299
+ "name": "attachment",
300
+ "in": "query",
301
+ "description": "Controls the Content-Disposition header to control browser behaviour. Set to true to trigger download.",
302
+ "schema": {
303
+ "type": "boolean",
304
+ "default": true
305
+ }
306
+ }
307
+ ],
308
+ "responses": {
309
+ "200": {
310
+ "description": "Generated thumbnail image",
311
+ "content": {
312
+ "application/json": {
313
+ "schema": {
314
+ "type": "object",
315
+ "properties": {
316
+ "download_url": {
317
+ "type": "string",
318
+ "format": "uri",
319
+ "example": "https://epilot-files-prod.s3.eu-central-1.amazonaws.com/123/temp/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf?AWSParams=123"
606
320
  }
607
- ]
321
+ }
322
+ }
323
+ }
608
324
  }
325
+ }
609
326
  }
327
+ }
610
328
  },
611
- "servers": [
612
- {
613
- "url": "https://file.sls.epilot.io"
329
+ "/v1/files/{id}/preview": {
330
+ "get": {
331
+ "operationId": "previewFile",
332
+ "summary": "previewFile",
333
+ "description": "Generate thumbnail preview for a file entity",
334
+ "tags": [
335
+ "files"
336
+ ],
337
+ "parameters": [
338
+ {
339
+ "name": "id",
340
+ "in": "path",
341
+ "required": true,
342
+ "schema": {
343
+ "$ref": "#/components/schemas/FileEntityId"
344
+ }
345
+ },
346
+ {
347
+ "name": "version",
348
+ "in": "query",
349
+ "description": "index of file version",
350
+ "schema": {
351
+ "type": "integer",
352
+ "default": 0
353
+ }
354
+ },
355
+ {
356
+ "name": "w",
357
+ "in": "query",
358
+ "description": "width",
359
+ "schema": {
360
+ "type": "integer"
361
+ }
362
+ },
363
+ {
364
+ "name": "h",
365
+ "in": "query",
366
+ "description": "height",
367
+ "schema": {
368
+ "type": "integer"
369
+ }
370
+ }
371
+ ],
372
+ "responses": {
373
+ "200": {
374
+ "description": "Generated thumbnail image",
375
+ "content": {
376
+ "image/png": {},
377
+ "image/jpeg": {}
378
+ }
379
+ }
380
+ }
381
+ }
382
+ },
383
+ "/v1/files/public/{id}/preview": {
384
+ "get": {
385
+ "operationId": "previewPublicFile",
386
+ "summary": "previewPublicFile",
387
+ "description": "Generate thumbnail preview for a public file entity",
388
+ "security": [],
389
+ "tags": [
390
+ "files"
391
+ ],
392
+ "parameters": [
393
+ {
394
+ "name": "id",
395
+ "in": "path",
396
+ "required": true,
397
+ "schema": {
398
+ "$ref": "#/components/schemas/FileEntityId"
399
+ }
400
+ },
401
+ {
402
+ "name": "version",
403
+ "in": "query",
404
+ "description": "index of file version",
405
+ "schema": {
406
+ "type": "integer",
407
+ "default": 0
408
+ }
409
+ },
410
+ {
411
+ "name": "w",
412
+ "in": "query",
413
+ "description": "width",
414
+ "schema": {
415
+ "type": "integer"
416
+ }
417
+ },
418
+ {
419
+ "name": "h",
420
+ "in": "query",
421
+ "description": "height",
422
+ "schema": {
423
+ "type": "integer"
424
+ }
425
+ },
426
+ {
427
+ "name": "org_id",
428
+ "in": "query",
429
+ "description": "Org id",
430
+ "schema": {
431
+ "type": "string"
432
+ }
433
+ }
434
+ ],
435
+ "responses": {
436
+ "200": {
437
+ "description": "Generated thumbnail image for a public file",
438
+ "content": {
439
+ "image/png": {},
440
+ "image/jpeg": {}
441
+ }
442
+ }
443
+ }
444
+ }
445
+ },
446
+ "/v1/files:previewS3": {
447
+ "post": {
448
+ "operationId": "previewS3File",
449
+ "summary": "previewS3File",
450
+ "description": "Generate thumbnail preview from an s3 reference for a file entity",
451
+ "tags": [
452
+ "files"
453
+ ],
454
+ "parameters": [
455
+ {
456
+ "name": "w",
457
+ "in": "query",
458
+ "description": "width",
459
+ "schema": {
460
+ "type": "integer"
461
+ }
462
+ },
463
+ {
464
+ "name": "h",
465
+ "in": "query",
466
+ "description": "height",
467
+ "schema": {
468
+ "type": "integer"
469
+ }
470
+ }
471
+ ],
472
+ "requestBody": {
473
+ "content": {
474
+ "application/json": {
475
+ "schema": {
476
+ "$ref": "#/components/schemas/S3Reference"
477
+ }
478
+ }
479
+ }
480
+ },
481
+ "responses": {
482
+ "200": {
483
+ "description": "Generated thumbnail image",
484
+ "content": {
485
+ "image/png": {},
486
+ "image/jpeg": {}
487
+ }
488
+ }
614
489
  }
615
- ]
490
+ }
491
+ },
492
+ "/v1/files/delete": {
493
+ "delete": {
494
+ "operationId": "deleteFile",
495
+ "summary": "deleteFile",
496
+ "description": "Delete file entity",
497
+ "tags": [
498
+ "files"
499
+ ],
500
+ "requestBody": {
501
+ "content": {
502
+ "application/json": {
503
+ "schema": {
504
+ "$ref": "#/components/schemas/DeleteFilePayload"
505
+ }
506
+ }
507
+ }
508
+ },
509
+ "responses": {
510
+ "200": {
511
+ "description": "File delete response"
512
+ }
513
+ }
514
+ }
515
+ }
516
+ },
517
+ "components": {
518
+ "securitySchemes": {
519
+ "EpilotAuth": {
520
+ "type": "http",
521
+ "scheme": "bearer",
522
+ "description": "Authorization header with epilot OAuth2 bearer token",
523
+ "bearerFormat": "JWT"
524
+ }
525
+ },
526
+ "schemas": {
527
+ "FileEntityId": {
528
+ "type": "string",
529
+ "example": "ef7d985c-2385-44f4-9c71-ae06a52264f8"
530
+ },
531
+ "FileEntity": {
532
+ "type": "object",
533
+ "properties": {
534
+ "_id": {
535
+ "$ref": "#/components/schemas/FileEntityId"
536
+ },
537
+ "filename": {
538
+ "type": "string",
539
+ "example": "document.pdf"
540
+ },
541
+ "access_control": {
542
+ "type": "string",
543
+ "default": "private",
544
+ "enum": [
545
+ "private",
546
+ "public-read"
547
+ ]
548
+ },
549
+ "public_url": {
550
+ "description": "Direct URL for file (public only if file access control is public-read)",
551
+ "type": "string",
552
+ "format": "url",
553
+ "example": "https://epilot-files-prod.s3.eu-central-1.amazonaws.com/123/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf"
554
+ },
555
+ "type": {
556
+ "description": "Human readable type for file",
557
+ "type": "string",
558
+ "enum": [
559
+ "document",
560
+ "document_template",
561
+ "text",
562
+ "image",
563
+ "video",
564
+ "audio",
565
+ "spreadsheet",
566
+ "presentation",
567
+ "font",
568
+ "archive",
569
+ "application",
570
+ "unknown"
571
+ ]
572
+ },
573
+ "mime_type": {
574
+ "type": "string",
575
+ "description": "MIME type of the file",
576
+ "example": "application/pdf"
577
+ },
578
+ "size_bytes": {
579
+ "type": "integer",
580
+ "minimum": 0,
581
+ "description": "File size in bytes"
582
+ },
583
+ "versions": {
584
+ "type": "array",
585
+ "items": {
586
+ "type": "object",
587
+ "properties": {
588
+ "s3ref": {
589
+ "$ref": "#/components/schemas/S3Reference"
590
+ }
591
+ }
592
+ }
593
+ }
594
+ }
595
+ },
596
+ "UploadFilePayload": {
597
+ "type": "object",
598
+ "properties": {
599
+ "filename": {
600
+ "type": "string",
601
+ "example": "document.pdf"
602
+ },
603
+ "mime_type": {
604
+ "description": "MIME type of file",
605
+ "type": "string",
606
+ "example": "application/pdf",
607
+ "default": "application/octet-stream"
608
+ }
609
+ },
610
+ "required": [
611
+ "filename"
612
+ ]
613
+ },
614
+ "DownloadFilesPayload": {
615
+ "type": "array",
616
+ "items": {
617
+ "type": "object",
618
+ "properties": {
619
+ "id": {
620
+ "$ref": "#/components/schemas/FileEntityId"
621
+ },
622
+ "version": {
623
+ "type": "integer",
624
+ "description": "File version",
625
+ "example": 0
626
+ }
627
+ },
628
+ "required": [
629
+ "id"
630
+ ]
631
+ }
632
+ },
633
+ "SaveFilePayload": {
634
+ "type": "object",
635
+ "properties": {
636
+ "s3ref": {
637
+ "$ref": "#/components/schemas/S3Reference"
638
+ },
639
+ "file_entity_id": {
640
+ "type": "string",
641
+ "description": "if passed, adds a new version to existing file entity"
642
+ },
643
+ "document_type": {
644
+ "type": "string",
645
+ "enum": [
646
+ "document",
647
+ "document_template",
648
+ "text",
649
+ "image",
650
+ "video",
651
+ "audio",
652
+ "spreadsheet",
653
+ "presentation",
654
+ "font",
655
+ "archive",
656
+ "application",
657
+ "unknown"
658
+ ]
659
+ },
660
+ "filename": {
661
+ "type": "string",
662
+ "example": "document.pdf"
663
+ },
664
+ "_tags": {
665
+ "type": "array",
666
+ "items": {
667
+ "type": "string"
668
+ }
669
+ },
670
+ "access_control": {
671
+ "type": "string",
672
+ "default": "private",
673
+ "enum": [
674
+ "private",
675
+ "public-read"
676
+ ]
677
+ }
678
+ },
679
+ "additionalProperties": true,
680
+ "required": [
681
+ "s3ref"
682
+ ]
683
+ },
684
+ "DeleteFilePayload": {
685
+ "type": "object",
686
+ "properties": {
687
+ "s3ref": {
688
+ "$ref": "#/components/schemas/S3Reference"
689
+ }
690
+ },
691
+ "required": [
692
+ "s3ref"
693
+ ]
694
+ },
695
+ "S3Reference": {
696
+ "type": "object",
697
+ "properties": {
698
+ "bucket": {
699
+ "type": "string",
700
+ "example": "epilot-files-prod"
701
+ },
702
+ "key": {
703
+ "type": "string",
704
+ "example": "123/4d689aeb-1497-4410-a9fe-b36ca9ac4389/document.pdf"
705
+ }
706
+ },
707
+ "required": [
708
+ "bucket",
709
+ "key"
710
+ ]
711
+ },
712
+ "FileItem": {
713
+ "allOf": [
714
+ {
715
+ "$ref": "#/components/schemas/S3Reference"
716
+ },
717
+ {
718
+ "type": "object",
719
+ "properties": {
720
+ "filename": {
721
+ "type": "string",
722
+ "example": "document.pdf"
723
+ },
724
+ "size_bytes": {
725
+ "type": "integer",
726
+ "example": 1234
727
+ },
728
+ "mime_type": {
729
+ "type": "string",
730
+ "example": "image/jpeg"
731
+ }
732
+ }
733
+ }
734
+ ]
735
+ }
736
+ }
737
+ },
738
+ "servers": [
739
+ {
740
+ "url": "https://file.sls.epilot.io"
741
+ }
742
+ ]
616
743
  }