Documentation
Overview ¶
Package files is the HTTP frontend of the vfs package. It exposes an HTTP api to manipulate the filesystem and offer all the possibilities given by the vfs.
Index ¶
- Constants
- Variables
- func AddBulkNotSynchronizedOn(c echo.Context) error
- func AddNotSynchronizedOn(c echo.Context) error
- func AddReferencedHandler(c echo.Context) error
- func AddReferencesHandler(c echo.Context) error
- func ArchiveDownloadCreateHandler(c echo.Context) error
- func ArchiveDownloadHandler(c echo.Context) error
- func CheckIfMatch(c echo.Context, rev string) error
- func ClearOldVersions(c echo.Context) error
- func ClearTrashHandler(c echo.Context) error
- func CopyVersionHandler(c echo.Context) error
- func CozyMetadataFromClaims(c echo.Context, setUploadFields bool) (*vfs.FilesCozyMetadata, string)
- func CreationHandler(c echo.Context) error
- func DeleteFileVersionMetadata(c echo.Context) error
- func DestroyFileHandler(c echo.Context) error
- func FileData(c echo.Context, statusCode int, doc *vfs.FileDoc, withVersions bool, ...) error
- func FileDocFromReq(c echo.Context, name, dirID string) (*vfs.FileDoc, error)
- func FileDownloadCreateHandler(c echo.Context) error
- func FileDownloadHandler(c echo.Context) error
- func FindFilesMango(c echo.Context) error
- func GetChildrenHandler(c echo.Context) error
- func HeadDirOrFile(c echo.Context) error
- func ListNotSynchronizedOn(c echo.Context) error
- func ListReferencesHandler(c echo.Context) error
- func ModifyFileVersionMetadata(c echo.Context) error
- func ModifyMetadataByIDHandler(c echo.Context) error
- func ModifyMetadataByIDInBatchHandler(c echo.Context) error
- func ModifyMetadataByPathHandler(c echo.Context) error
- func NewFile(doc *vfs.FileDoc, i *instance.Instance) *file
- func NotSynchronizedOnRoutes(router *echo.Group)
- func OverwriteFileContentHandler(c echo.Context) (err error)
- func PreviewHandler(c echo.Context) error
- func ReadFileContentFromIDHandler(c echo.Context) error
- func ReadFileContentFromPathHandler(c echo.Context) error
- func ReadFileContentFromVersion(c echo.Context) error
- func ReadMetadataFromIDHandler(c echo.Context) error
- func ReadMetadataFromPathHandler(c echo.Context) error
- func ReadTrashFilesHandler(c echo.Context) error
- func ReferencesRoutes(router *echo.Group)
- func RemoveBulkNotSynchronizedOn(c echo.Context) error
- func RemoveNotSynchronizedOn(c echo.Context) error
- func RemoveReferencedHandler(c echo.Context) error
- func RemoveReferencesHandler(c echo.Context) error
- func RestoreTrashFileHandler(c echo.Context) error
- func RevertFileVersion(c echo.Context) error
- func Routes(router *echo.Group)
- func ThumbnailHandler(c echo.Context) error
- func TrashHandler(c echo.Context) error
- func UploadMetadataHandler(c echo.Context) error
- func WrapVfsError(err error) error
Constants ¶
const TagSeparator = ","
TagSeparator is the character separating tags
Variables ¶
var ErrDocTypeInvalid = errors.New("Invalid document type")
ErrDocTypeInvalid is used when the document type sent is not recognized
Functions ¶
func AddBulkNotSynchronizedOn ¶
AddBulkNotSynchronizedOn add some not_synchronized_on for a device POST /data/:type/:id/relationships/not_synchronizing Beware, this is actually used in the web/data Routes
func AddNotSynchronizedOn ¶
AddNotSynchronizedOn is the echo.handler for adding not_synchronized_on to a directory POST /files/:file-id/relationships/not_synchronized_on
func AddReferencedHandler ¶
AddReferencedHandler is the echo.handler for adding referenced_by to a file POST /files/:file-id/relationships/referenced_by
func AddReferencesHandler ¶
AddReferencesHandler add some files references to a doc POST /data/:type/:id/relationships/references Beware, this is actually used in the web/data Routes
func ArchiveDownloadCreateHandler ¶
ArchiveDownloadCreateHandler handles requests to /files/archive and stores the paremeters with a secret to be used in download handler below.s
func ArchiveDownloadHandler ¶
ArchiveDownloadHandler handles requests to /files/archive/:secret/whatever.zip and creates on the fly zip archive from the parameters linked to secret.
func CheckIfMatch ¶
CheckIfMatch checks if the revision provided matches the revision number given in the request, in the header and/or the query.
func ClearOldVersions ¶
ClearOldVersions is the handler for DELETE /files/versions. It deletes all the old versions of all files to make space for new files.
func ClearTrashHandler ¶
ClearTrashHandler handles DELETE request to clear the trash
func CopyVersionHandler ¶
CopyVersionHandler handles POST requests on /files/:file-id/versions.
It can be used to create a new version of a file, with the same content but new metadata.
func CozyMetadataFromClaims ¶
CozyMetadataFromClaims returns a FilesCozyMetadata struct, with the app fields filled with information from the permission claims.
func CreationHandler ¶
CreationHandler handle all POST requests on /files/:file-id aiming at creating a new document in the FS. Given the Type parameter of the request, it will either upload a new file or create a new directory.
func DeleteFileVersionMetadata ¶
DeleteFileVersionMetadata handles DELETE requests on /files/:file-id/:version-id
It can be used to delete an old version of a file.
func DestroyFileHandler ¶
DestroyFileHandler handles DELETE request to clear one element from the trash
func FileData ¶
func FileData(c echo.Context, statusCode int, doc *vfs.FileDoc, withVersions bool, links *jsonapi.LinksList) error
FileData returns a jsonapi representation of the given file.
func FileDocFromReq ¶
FileDocFromReq creates a FileDoc from an incoming request.
func FileDownloadCreateHandler ¶
FileDownloadCreateHandler stores the required path into a secret usable for download handler below.
func FileDownloadHandler ¶
FileDownloadHandler send a file that have previously be defined through FileDownloadCreateHandler
func FindFilesMango ¶
FindFilesMango is the route POST /files/_find used to retrieve files and their metadata from a mango query.
func GetChildrenHandler ¶
GetChildrenHandler returns a list of children of a folder
func HeadDirOrFile ¶
HeadDirOrFile handles HEAD requests on directory or file to check their existence
func ListNotSynchronizedOn ¶
ListNotSynchronizedOn list all directories not synchronized on a device GET /data/:type/:id/relationships/not_synchronizing Beware, this is actually used in the web/data Routes
func ListReferencesHandler ¶
ListReferencesHandler list all files referenced by a doc GET /data/:type/:id/relationships/references Beware, this is actually used in the web/data Routes
func ModifyFileVersionMetadata ¶
ModifyFileVersionMetadata handles PATCH requests on /files/:file-id/:version-id
It can be used to modify tags on an old version of a file.
func ModifyMetadataByIDHandler ¶
ModifyMetadataByIDHandler handles PATCH requests on /files/:file-id
It can be used to modify the file or directory metadata, as well as moving and renaming it in the filesystem.
func ModifyMetadataByIDInBatchHandler ¶
ModifyMetadataByIDInBatchHandler handles PATCH requests on /files/.
It can be used to modify many files or directories metadata, as well as moving and renaming it in the filesystem, in batch.
func ModifyMetadataByPathHandler ¶
ModifyMetadataByPathHandler handles PATCH requests on /files/metadata
It can be used to modify the file or directory metadata, as well as moving and renaming it in the filesystem.
func NotSynchronizedOnRoutes ¶
NotSynchronizedOnRoutes adds the /data/:doctype/:docid/relationships/not_synchronizing routes.
func OverwriteFileContentHandler ¶
OverwriteFileContentHandler handles PUT requests on /files/:file-id to overwrite the content of a file given its identifier.
func PreviewHandler ¶
PreviewHandler serves preview images for the PDFs.
func ReadFileContentFromIDHandler ¶
ReadFileContentFromIDHandler handles all GET requests on /files/:file-id aiming at downloading a file given its ID. It serves the file in inline mode.
func ReadFileContentFromPathHandler ¶
ReadFileContentFromPathHandler handles all GET request on /files/download aiming at downloading a file given its path. It serves the file in in attachment mode.
func ReadFileContentFromVersion ¶
ReadFileContentFromVersion handles the download of an old version of the file content.
func ReadMetadataFromIDHandler ¶
ReadMetadataFromIDHandler handles all GET requests on /files/:file- id aiming at getting file metadata from its id.
func ReadMetadataFromPathHandler ¶
ReadMetadataFromPathHandler handles all GET requests on /files/metadata aiming at getting file metadata from its path.
func ReadTrashFilesHandler ¶
ReadTrashFilesHandler handle GET requests on /files/trash and return the list of trashed files and directories
func ReferencesRoutes ¶
ReferencesRoutes adds the /data/:doctype/:docid/relationships/references routes.
func RemoveBulkNotSynchronizedOn ¶
RemoveBulkNotSynchronizedOn removes some not_synchronized_on for several directories. DELETE /data/:type/:id/relationships/not_synchronizing Beware, this is actually used in the web/data Routes
func RemoveNotSynchronizedOn ¶
RemoveNotSynchronizedOn is the echo.handler for removing not_synchronized_on to a directory DELETE /files/:file-id/relationships/not_synchronized_on
func RemoveReferencedHandler ¶
RemoveReferencedHandler is the echo.handler for removing referenced_by to a file DELETE /files/:file-id/relationships/referenced_by
func RemoveReferencesHandler ¶
RemoveReferencesHandler remove some files references from a doc DELETE /data/:type/:id/relationships/references Beware, this is actually used in the web/data Routes
func RestoreTrashFileHandler ¶
RestoreTrashFileHandler handle POST requests on /files/trash/file-id and can be used to restore a file or directory from the trash.
func RevertFileVersion ¶
RevertFileVersion restores an old version of the file content.
func ThumbnailHandler ¶
ThumbnailHandler serves thumbnails of the images/photos
func TrashHandler ¶
TrashHandler handles all DELETE requests on /files/:file-id and moves the file or directory with the specified file-id to the trash.
func UploadMetadataHandler ¶
UploadMetadataHandler accepts a metadata objet and persist it, so that it can be used in a future file upload.
func WrapVfsError ¶
WrapVfsError returns a formatted error from a golang error emitted by the vfs