Interface FileApi
public interface FileApi
Public API for the management of file upload/download.
Note: Resources are always referenced by their id, represented as a UUID. A resource id is
a UUID which uniquely identifies the resource.
When the resource is referenced differently (not with the id) it will be specified in the parameter name and
its documentation.
-
Method Summary
Modifier and TypeMethodDescriptionaddFile(AddFileRequest addFileRequest) Add a new file to the temporary upload folder.Add a new file to the temporary upload folder.voidcleanTemporaryDirectory(long timeToLive) Removes files that are older than the given time to live.voiddeleteFile(UUID fileId) Delete file with IDbooleanReturns true if a file with givenidexists.getFileAsStream(UUID fileId) Returns the content of given file from temporary upload folder or attachments folder as an input stream.byte[]getFileContent(UUID fileId) Returns contents of a fileReturns the directoryFilewhere all files are placed in.getFileInfo(UUID fileId) Returns the information about a file with its ID.getFileInfoFromUrl(String fileUrl) Returns the information about the file for the given url.getFileName(UUID fileId) Returns the name of the file.voidUpdate the lastModified timestamp of the file
-
Method Details
-
addFile
Add a new file to the temporary upload folder.- Parameters:
addFileRequest- the properties of the file to be added- Returns:
- the
FileInfoof the file if it was added without error
-
addFile
Add a new file to the temporary upload folder.- Parameters:
fileName- the name of the file in UUID format to addfile- the file to addskipSecurity- If true, no security check will be done.- Returns:
- the file identifier if it was added without error
-
getFileAsStream
Returns the content of given file from temporary upload folder or attachments folder as an input stream. Keep in mind to useAttachmentApi.getAttachmentContent(java.util.UUID)instead of this endpoint when you want to get the file of an attachment. A File and its id can be temporary so it's possible this endpoint will not get you the desired file.- Parameters:
fileId- theidof the file- Returns:
- the content as
InputStream
-
getFileDirectory
File getFileDirectory()Returns the directoryFilewhere all files are placed in.- Returns:
- the directory
-
getFileInfo
Returns the information about a file with its ID.- Parameters:
fileId- The ID of the file represented as aUUID- Returns:
- The information about the file
-
getFileContent
Returns contents of a file- Parameters:
fileId- The ID of the file represented as aUUID- Returns:
- a
invalid reference
byte[]
-
getFileInfoFromUrl
Returns the information about the file for the given url.- Parameters:
fileUrl- the url of the file to get- Returns:
- the
FileInfo
-
getFileName
Returns the name of the file.- Parameters:
fileId- The ID of the file for which to get name- Returns:
- a file name
-
cleanTemporaryDirectory
void cleanTemporaryDirectory(long timeToLive) Removes files that are older than the given time to live.- Parameters:
timeToLive- Duration that a file can exist in milliseconds before it is removed
-
exists
Returns true if a file with givenidexists.- Parameters:
fileId- theidof the issue- Returns:
- true if a file with given
idexists,falseotherwise
-
touchFile
Update the lastModified timestamp of the file- Parameters:
fileId- the Id of the file
-
deleteFile
Delete file with ID- Parameters:
fileId- the Id of the file
-