@Generated public interface FilesService
The Files API is designed like a standard HTTP API, rather than as a JSON RPC API. This is intended to make it easier and more efficient to work with file contents as raw bytes.
Because the Files API is a standard HTTP API, the URI path is used to specify the file or directory to operate on. The path is always absolute.
The Files API has separate endpoints for working with files, `/fs/files`, and working with directories, `/fs/directories`. The standard HTTP methods `GET`, `HEAD`, `PUT`, and `DELETE` work as expected on these endpoints.
This is the high-level interface, that contains generated methods.
Evolving: this interface is under development. Method signatures may change.
| Modifier and Type | Method and Description |
|---|---|
void |
createDirectory(CreateDirectoryRequest createDirectoryRequest)
Create a directory.
|
void |
delete(DeleteFileRequest deleteFileRequest)
Delete a file.
|
void |
deleteDirectory(DeleteDirectoryRequest deleteDirectoryRequest)
Delete a directory.
|
DownloadResponse |
download(DownloadRequest downloadRequest)
Download a file.
|
void |
getDirectoryMetadata(GetDirectoryMetadataRequest getDirectoryMetadataRequest)
Get directory metadata.
|
GetMetadataResponse |
getMetadata(GetMetadataRequest getMetadataRequest)
Get file metadata.
|
ListDirectoryResponse |
listDirectoryContents(ListDirectoryContentsRequest listDirectoryContentsRequest)
List directory contents.
|
void |
upload(UploadRequest uploadRequest)
Upload a file.
|
void createDirectory(CreateDirectoryRequest createDirectoryRequest)
Creates an empty directory. If necessary, also creates any parent directories of the new, empty directory (like the shell command `mkdir -p`). If called on an existing directory, returns a success response; this method is idempotent.
void delete(DeleteFileRequest deleteFileRequest)
Deletes a file. If the request is successful, there is no response body.
void deleteDirectory(DeleteDirectoryRequest deleteDirectoryRequest)
Deletes an empty directory.
To delete a non-empty directory, first delete all of its contents. This can be done by listing the directory contents and deleting each file and subdirectory recursively.
DownloadResponse download(DownloadRequest downloadRequest)
Downloads a file of up to 5 GiB. The file contents are the response body. This is a standard HTTP file download, not a JSON RPC.
void getDirectoryMetadata(GetDirectoryMetadataRequest getDirectoryMetadataRequest)
Get the metadata of a directory. The response HTTP headers contain the metadata. There is no response body.
This method is useful to check if a directory exists and the caller has access to it.
If you wish to ensure the directory exists, you can instead use `PUT`, which will create the directory if it does not exist, and is idempotent (it will succeed if the directory already exists).
GetMetadataResponse getMetadata(GetMetadataRequest getMetadataRequest)
Get the metadata of a file. The response HTTP headers contain the metadata. There is no response body.
ListDirectoryResponse listDirectoryContents(ListDirectoryContentsRequest listDirectoryContentsRequest)
Returns the contents of a directory. If there is no directory at the specified path, the API returns a HTTP 404 error.
void upload(UploadRequest uploadRequest)
Uploads a file of up to 5 GiB. The file contents should be sent as the request body as raw bytes (an octet stream); do not encode or otherwise modify the bytes before sending. The contents of the resulting file will be exactly the bytes sent in the request body. If the request is successful, there is no response body.
Copyright © 2024. All rights reserved.