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 Details

    • addFile

      FileInfo addFile(AddFileRequest addFileRequest)
      Add a new file to the temporary upload folder.
      Parameters:
      addFileRequest - the properties of the file to be added
      Returns:
      the FileInfo of the file if it was added without error
    • addFile

      FileInfo addFile(String fileName, File file, boolean skipSecurity)
      Add a new file to the temporary upload folder.
      Parameters:
      fileName - the name of the file in UUID format to add
      file - the file to add
      skipSecurity - If true, no security check will be done.
      Returns:
      the file identifier if it was added without error
    • getFileAsStream

      InputStream getFileAsStream(UUID fileId)
      Returns the content of given file from temporary upload folder or attachments folder as an input stream. Keep in mind to use AttachmentApi.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 - the id of the file
      Returns:
      the content as InputStream
    • getFileDirectory

      File getFileDirectory()
      Returns the directory File where all files are placed in.
      Returns:
      the directory
    • getFileInfo

      FileInfo getFileInfo(UUID fileId)
      Returns the information about a file with its ID.
      Parameters:
      fileId - The ID of the file represented as a UUID
      Returns:
      The information about the file
    • getFileContent

      byte[] getFileContent(UUID fileId)
      Returns contents of a file
      Parameters:
      fileId - The ID of the file represented as a UUID
      Returns:
      a
      invalid reference
      byte[]
    • getFileInfoFromUrl

      FileInfo getFileInfoFromUrl(String fileUrl)
      Returns the information about the file for the given url.
      Parameters:
      fileUrl - the url of the file to get
      Returns:
      the FileInfo
    • getFileName

      String getFileName(UUID fileId)
      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

      boolean exists(UUID fileId)
      Returns true if a file with given id exists.
      Parameters:
      fileId - the id of the issue
      Returns:
      true if a file with given id exists, false otherwise
    • touchFile

      void touchFile(UUID fileId)
      Update the lastModified timestamp of the file
      Parameters:
      fileId - the Id of the file
    • deleteFile

      void deleteFile(UUID fileId)
      Delete file with ID
      Parameters:
      fileId - the Id of the file