diff --git a/frontend/util/federalistApi.js b/frontend/util/federalistApi.js index b3a13c40d..7ae88dbf4 100644 --- a/frontend/util/federalistApi.js +++ b/frontend/util/federalistApi.js @@ -365,4 +365,55 @@ export default { fetchReportData(id, subPage) { return request(`tasks/${id}/report/${subPage || ''}`); }, + + fetchPublicFiles(fileStorageId, path = '') { + return request(`file-storage/${fileStorageId}${path}`, { + method: 'GET', + }); + }, + + createPublicDirectory(fileStorageId, parent = '', name) { + return request(`file-storage/${fileStorageId}/directory`, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ parent: parent, name: name }), + }); + }, + + uploadPublicFile(fileStorageId, parent = '', fileName) { + return request(`file-storage/${fileStorageId}/directory`, { + method: 'POST', + body: JSON.stringify({ parent: parent, name: fileName }), + // Do not set content type header + }); + }, + + deletePublicFile(fileStorageId, fileId) { + return request(`file-storage/${fileStorageId}/file/${fileId}`, { + method: 'DELETE', + // not sure if we need the content type here, could be copypasta + headers: { 'Content-Type': 'application/json' }, + }); + }, + + deletePublicDirectory(fileStorageId, fileId) { + return request(`file-storage/${fileStorageId}/file/${fileId}`, { + method: 'DELETE', + headers: { 'Content-Type': 'application/json' }, + }); + }, + + fetchPublicFileHistory(fileStorageId, fileId) { + return request(`file-storage/${fileStorageId}/user-actions/${fileId}`, { + method: 'GET', + headers: { 'Content-Type': 'application/json' }, + }); + }, + + fetchAllPublicFilesHistory(fileStorageId) { + return request(`file-storage/${fileStorageId}/user-actions/}`, { + method: 'GET', + headers: { 'Content-Type': 'application/json' }, + }); + } };