tutanota/ipc-schema/facades/FileFacade.json

200 lines
4 KiB
JSON
Raw Normal View History

{
2022-12-27 15:37:40 +01:00
"name": "FileFacade",
"doc": "filesystem-related operations. none of the methods writing files to disk guarantee a fixed file name or location, except for putFileIntoDownloadsFolder.",
2022-12-27 15:37:40 +01:00
"type": "facade",
"receivers": ["ios", "desktop", "android"],
"senders": ["web"],
"methods": {
"open": {
"doc": "Opens the file with the built-in viewer or external program.",
"arg": [
{
"location": "string"
},
{
"mimeType": "string"
}
],
2022-12-27 15:37:40 +01:00
"ret": "void"
},
"openFileChooser": {
"doc": "Opens OS file picker. Returns the list of URIs for the selected files. add a list of extensions (without dot) to filter the options.",
"arg": [
{
"boundingRect": "IpcClientRect"
},
{
"filter": "List<string>?"
},
{
"isFileOnly": "boolean?"
}
],
2022-12-27 15:37:40 +01:00
"ret": "List<string>"
},
"openFolderChooser": {
"doc": "Opens OS file picker for selecting a folder. Only on desktop.",
"arg": [],
"ret": "string?"
},
"openMacImportFileChooser": {
"doc": "Opens OS file picker for selecting either a file or folder for Email Import. Works only on macOS",
"arg": [],
"ret": "List<string>"
},
2022-12-27 15:37:40 +01:00
"deleteFile": {
"arg": [
{
"file": "string"
}
],
2022-12-27 15:37:40 +01:00
"ret": "void"
},
"getName": {
"arg": [
{
"file": "string"
}
],
2022-12-27 15:37:40 +01:00
"ret": "string"
},
"getMimeType": {
"arg": [
{
"file": "string"
}
],
2022-12-27 15:37:40 +01:00
"ret": "string"
},
"getSize": {
"doc": "get the absolute size in bytes of the file at the given location",
"arg": [
{
"file": "string"
}
],
2022-12-27 15:37:40 +01:00
"ret": "number"
},
"putFileIntoDownloadsFolder": {
"doc": "move and rename a decrypted file from the decryption location to the download location preferred by the user and return the absolute path to the moved file",
"arg": [
{
"localFileUri": "string"
},
{
"fileNameToUse": "string"
}
],
2022-12-27 15:37:40 +01:00
"ret": "string"
},
"upload": {
"arg": [
{
"fileUrl": "string"
},
{
"targetUrl": "string"
},
{
"method": "string"
},
{
"headers": "Map<string, string>"
}
2022-12-27 15:37:40 +01:00
],
"ret": "UploadTaskResponse"
},
"download": {
"doc": "download an encrypted file to the file system and return the location of the data",
"arg": [
{
"sourceUrl": "string"
},
{
"filename": "string"
},
{
"headers": "Map<string, string>"
}
],
2022-12-27 15:37:40 +01:00
"ret": "DownloadTaskResponse"
},
"hashFile": {
"doc": "Calculates specified file hash (with SHA-256). Returns first 6 bytes of it as Base64.",
"arg": [
{
"fileUri": "string"
}
],
2022-12-27 15:37:40 +01:00
"ret": "string"
},
"clearFileData": {
"arg": [],
"ret": "void"
},
"joinFiles": {
"doc": "given a list of chunk file locations, will re-join them in order to reconstruct a single file and returns the location of that file on disk.",
"arg": [
{
"filename": "string"
},
{
"files": "List<string>"
}
],
2022-12-27 15:37:40 +01:00
"ret": "string"
},
"splitFile": {
"doc": "split a given file on disk into as many chunks as necessary to limit their size to the max byte size. returns the list of chunk file locations.",
"arg": [
{
"fileUri": "string"
},
{
"maxChunkSizeBytes": "number"
}
],
2022-12-27 15:37:40 +01:00
"ret": "List<string>"
},
"writeTempDataFile": {
"doc": "Save the unencrypted data file to the disk into a fixed temporary location, not the user's preferred download dir.",
"arg": [
{
"file": "DataFile"
}
],
2022-12-27 15:37:40 +01:00
"ret": "string"
},
"writeToAppDir": {
"doc": "Save given file in given path relative to app data folder",
"arg": [
{
"content": "bytes"
},
{
"path": "string"
}
],
"ret": "void"
},
"readFromAppDir": {
"doc": "Read file from given path relative to app data folder",
"arg": [
{
"path": "string"
}
],
"ret": "bytes"
},
2022-12-27 15:37:40 +01:00
"readDataFile": {
"doc": "read the file at the given location into a DataFile. Returns null if reading fails for any reason.",
"arg": [
{
"filePath": "string"
}
],
2022-12-27 15:37:40 +01:00
"ret": "DataFile?"
}
}
}