Fichiers
Vérifier app.capabilities pour la prise en charge des fonctionnalités et app.access ainsi que les permissions de l’hôte pour les autorisations. Les exemples utilisent des valeurs synthétiques ; remplacer les chemins, ID, entrées et filtres avant tout appel.
Définitions de types
type Subscription {
fileSearchResults(root: String!, query: String!, offset: Int!, limit: Int!, sortBy: FileSortBy!): FileSearchResults!
}
type Mutation {
cacheZipEntry(path: String!): String!
copyFileToDirectory(src: String!, directory: String!, name: String!): String!
createDir(path: String!): File!
createFile(path: String!): File!
createFileTask(type: FileTaskType!, title: String!, ops: [FileTaskOpInput!]!, waitForCompletion: Boolean! = false): FileTask!
createZipArchive(paths: [String!]!, target: String!): String!
deleteFiles(paths: [String!]!): ActionResult!
deleteTrashedFile(path: String!): Boolean!
extractZipArchive(path: String!, target: String!): String!
renameFile(path: String!, name: String!): String
restoreFiles(paths: [String!]!): ActionResult!
trashFiles(paths: [String!]!): ActionResult!
writeTextFile(path: String!, content: String!, overwrite: Boolean!): File!
}
type Query {
fileCount(root: String!, query: String!): Int!
fileInfo(path: String!): FileInfo
fileTasks(query: String!, offset: Int!, limit: Int!): [FileTask!]!
files(root: String!, query: String!, offset: Int!, limit: Int!, sortBy: FileSortBy!): [File!]!
recentFiles: [File!]!
trashedFileCount(query: String!): Int!
trashedFiles(query: String!, offset: Int!, limit: Int!, sortBy: TrashedFileSortBy!): [TrashedFile!]!
}
type ActionResult {
affectedCount: Int!
}
type AudioFileInfo {
durationMs: Long!
location: Location
}
type File {
permission: String!
mediaId: ID
name: String!
path: String!
createdAt: Instant
updatedAt: Instant!
size: Long!
isDir: Boolean!
childCount: Int!
url: String!
isSystem: Boolean!
}
type FileInfo {
path: String!
updatedAt: Instant!
size: Long!
data: MediaFileInfo
}
type FileSearchResults {
items: [File!]!
offset: Long!
count: Long!
complete: Boolean!
}
enum FileSortBy {
UPDATED_AT_ASC
UPDATED_AT_DESC
SIZE_ASC
SIZE_DESC
NAME_ASC
NAME_DESC
}
type FileTask {
id: ID!
clientId: ID!
type: FileTaskType!
title: String!
status: FileTaskStatus!
error: String!
totalBytes: Long!
doneBytes: Long!
totalItems: Long!
doneItems: Long!
createdAt: Instant!
updatedAt: Instant!
completedOps: [FileTaskCompletedOp!]!
}
type FileTaskCompletedOp {
src: String!
dst: String!
}
input FileTaskOpInput {
src: String!
dst: String!
overwrite: Boolean!
}
enum FileTaskStatus {
QUEUED
RUNNING
DONE
ERROR
}
enum FileTaskType {
COPY
MOVE
}
type ImageFileInfo {
make: String!
model: String!
rotation: Int!
colorSpace: String!
apertureValue: Float!
exposureTime: String!
focalLength: String!
isoSpeed: Int!
takenAt: Instant
flash: Int!
fNumber: Float!
exposureProgram: Int!
meteringMode: Int!
whiteBalance: Int!
creator: String!
resolutionX: Int!
resolutionY: Int!
description: String!
width: Int!
height: Int!
location: Location
}
scalar Instant
type Location {
latitude: Float!
longitude: Float!
}
scalar Long
union MediaFileInfo = ImageFileInfo | AudioFileInfo | VideoFileInfo
type TrashedFile {
id: ID!
type: TrashedFileType!
originalPath: String!
disk: String!
trashRelPath: String!
deletedAt: Instant!
uid: Int!
gid: Int!
mode: Int!
sizeBytes: Long
entryCount: Int
displayName: String!
trashedPath: String!
}
enum TrashedFileSortBy {
DATE_ASC
DATE_DESC
SIZE_ASC
SIZE_DESC
NAME_ASC
NAME_DESC
}
enum TrashedFileType {
FILE
DIR
}
type VideoFileInfo {
width: Int!
height: Int!
durationMs: Long!
rotation: Int!
displayWidth: Int!
displayHeight: Int!
bitrate: Long!
frameRate: Float!
title: String!
artist: String!
album: String!
genre: String!
takenAt: Instant
writer: String!
composer: String!
location: Location
}Opérations
fileSearchResults
Recevoir les instantanés de résultats de recherche de fichiers selon la racine, le filtre, la page et l’ordre de tri fournis.
subscription fileSearchResults($root: String!, $query: String!, $offset: Int!, $limit: Int!, $sortBy: FileSortBy!) {
fileSearchResults(root: $root, query: $query, offset: $offset, limit: $limit, sortBy: $sortBy) { offset count complete }
}cacheZipEntry
Extraire l’entrée ZIP indiquée dans le cache et renvoyer son chemin.
mutation cacheZipEntry($path: String!) {
cacheZipEntry(path: $path)
}copyFileToDirectory
Copier un fichier dans un répertoire avec le nom de destination fourni et renvoyer son chemin s’il est disponible.
mutation copyFileToDirectory($src: String!, $directory: String!, $name: String!) {
copyFileToDirectory(src: $src, directory: $directory, name: $name)
}createDir
Créer un répertoire et le renvoyer sous forme d’objet File.
mutation createDir($path: String!) {
createDir(path: $path) { permission mediaId name path createdAt updatedAt size isDir }
}createFile
Créer un fichier vide au chemin fourni et renvoyer ses métadonnées.
mutation createFile($path: String!) {
createFile(path: $path) { permission mediaId name path createdAt updatedAt size isDir }
}createFileTask
Créer une tâche de copie ou de déplacement par lot ; attendre éventuellement sa fin avant de renvoyer son état.
mutation createFileTask($type: FileTaskType!, $title: String!, $ops: [FileTaskOpInput!]!, $waitForCompletion: Boolean!) {
createFileTask(type: $type, title: $title, ops: $ops, waitForCompletion: $waitForCompletion) { id clientId type title status error totalBytes doneBytes }
}createZipArchive
Créer une archive ZIP à partir des chemins sélectionnés au chemin cible.
mutation createZipArchive($paths: [String!]!, $target: String!) {
createZipArchive(paths: $paths, target: $target)
}deleteFiles
Supprimer un ou plusieurs fichiers ou répertoires par leur chemin exact.
mutation deleteFiles($paths: [String!]!) {
deleteFiles(paths: $paths) { affectedCount }
}deleteTrashedFile
Supprimer définitivement un élément de la corbeille de fichiers.
mutation deleteTrashedFile($path: String!) {
deleteTrashedFile(path: $path)
}extractZipArchive
Extraire une archive ZIP dans le répertoire cible.
mutation extractZipArchive($path: String!, $target: String!) {
extractZipArchive(path: $path, target: $target)
}renameFile
Renommer un fichier ou un répertoire.
mutation renameFile($path: String!, $name: String!) {
renameFile(path: $path, name: $name)
}restoreFiles
Restaurer les fichiers de la corbeille aux chemins indiqués et indiquer le nombre d’éléments concernés.
mutation restoreFiles($paths: [String!]!) {
restoreFiles(paths: $paths) { affectedCount }
}trashFiles
Déplacer les fichiers aux chemins indiqués dans la corbeille et indiquer le nombre d’éléments concernés.
mutation trashFiles($paths: [String!]!) {
trashFiles(paths: $paths) { affectedCount }
}writeTextFile
Écrire du texte au chemin fourni en appliquant la politique d’écrasement demandée.
mutation writeTextFile($path: String!, $content: String!, $overwrite: Boolean!) {
writeTextFile(path: $path, content: $content, overwrite: $overwrite) { permission mediaId name path createdAt updatedAt size isDir }
}fileCount
Compter les résultats de recherche de fichiers sous la racine indiquée, sans tenir compte de la pagination.
# Total matches for the same query, ignoring paging.
query fileCount($root: String!, $query: String!) {
fileCount(root: $root, query: $query)
}fileInfo
Lire les attributs du fichier, les métadonnées multimédias prises en charge et les étiquettes d’un chemin.
query fileInfo($path: String!) {
fileInfo(path: $path) { path updatedAt size }
}fileTasks
Lire une page de tâches d’opérations sur les fichiers correspondant à la requête.
query fileTasks($query: String!, $offset: Int!, $limit: Int!) {
fileTasks(query: $query, offset: $offset, limit: $limit) { id clientId type title status error totalBytes doneBytes }
}files
Lister et rechercher les fichiers sous un chemin racine avec pagination. Fournir une valeur query vide pour tous les lister.
# One page of a directory listing, filtered and sorted by the search
# DSL. `query` may carry a `parent` field to redirect the root, which
# is what the file manager's breadcrumb links send.
query files($root: String!, $query: String!, $offset: Int!, $limit: Int!, $sortBy: FileSortBy!) {
files(root: $root, query: $query, offset: $offset, limit: $limit, sortBy: $sortBy) { permission mediaId name path createdAt updatedAt size isDir }
}recentFiles
Lister les fichiers récemment ouverts.
# Recently-opened files. Reading them is a storage read, so this one
# gates — plain-app's `recentFiles` calls `checkEnabledAsync`.
query recentFiles {
recentFiles { permission mediaId name path createdAt updatedAt size isDir }
}trashedFileCount
Compter les éléments de la corbeille de fichiers.
query trashedFileCount($query: String!) {
trashedFileCount(query: $query)
}trashedFiles
Rechercher les fichiers de la corbeille avec pagination et tri.
query trashedFiles($query: String!, $offset: Int!, $limit: Int!, $sortBy: TrashedFileSortBy!) {
trashedFiles(query: $query, offset: $offset, limit: $limit, sortBy: $sortBy) { id type originalPath disk trashRelPath deletedAt uid gid }
}