Riferimento API

File

Sfoglia e gestisci file e directory. Supporta archiviazione multi-montaggio (interna, scheda SD, USB).

Definizioni di tipo

bash
type File {
  name: String!
  path: String!
  permission: String!        # "rw" | "r"
  createdAt: String          # ISO 8601, null on some filesystems
  updatedAt: String!         # ISO 8601
  size: Long!                # 0 for directories
  isDir: Boolean!
  children: Int!             # 0 for files; child count for directories
  mediaId: String!           # media store ID, empty when unavailable
}

type StorageMount {
  id: String!
  name: String!
  path: String!
  mountPoint: String!
  fsType: String!
  totalBytes: Long!
  usedBytes: Long!
  freeBytes: Long!
  remote: Boolean!
  alias: String!
}

type FileInfo {
  path: String!
  updatedAt: String!
  size: Long!
  tags: [Tag!]!
  data: MediaFileInfo          # image/video/audio metadata, null for other types
}

type MediaFileInfo {
  # Union-like structure; fields vary by media type (image / video / audio)
  width: Int
  height: Int
  duration: Int               # milliseconds (video / audio)
  artist: String
  album: String
  title: String
}

type FavoriteFolder {
  rootPath: String!
  fullPath: String!
  alias: String               # optional display alias, empty when not set
}

Operazioni

query

mounts

Elenca tutti i volumi di archiviazione disponibili (interno, scheda SD, USB).

bash
query GetMounts {
  mounts {
    id name path mountPoint fsType totalBytes usedBytes freeBytes remote alias
  }
}
query

recentFiles

Elenca i file modificati di recente in tutte le archiviazioni. Origine della vista "Recenti" nell'UI File.

bash
query GetRecentFiles {
  recentFiles {
    name path permission createdAt updatedAt size isDir children mediaId
  }
}
query

files

Elenca e cerca file sotto un percorso radice con paginazione. Passa una query vuota per elencarli tutti.

bash
query GetFiles($root: String!, $offset: Int!, $limit: Int!, $query: String!, $sortBy: FileSortBy!) {
  files(root: $root, offset: $offset, limit: $limit, query: $query, sortBy: $sortBy) {
    name path permission createdAt updatedAt size isDir children mediaId
  }
}
query

fileInfo

Recupera stat + metadati media + tag per un singolo file. Passa fileName in modo che il server possa rilevare immagine/video/audio e caricare larghezza, altezza, durata, ecc.

bash
query GetFileInfo($id: ID!, $path: String!, $fileName: String!) {
  fileInfo(id: $id, path: $path, fileName: $fileName) {
    path updatedAt size
    tags { id name }
    data { width height duration artist album title }
  }
}
query

fileIds

Risolve un elenco di percorsi filesystem nei loro ID del media store (stringa vuota quando non indicizzati).

bash
query GetFileIds($paths: [String!]!) {
  fileIds(paths: $paths)
}
query

uploadedChunks

Elenca gli indici dei chunk già ricevuti per un upload chunked ripristinabile. Usato per riprendere upload interrotti.

bash
query GetUploadedChunks($fileId: String!) {
  uploadedChunks(fileId: $fileId)
}
mutation

createDir

Crea una nuova directory e la restituisce come oggetto File.

bash
mutation CreateDir($path: String!) {
  createDir(path: $path) {
    name path permission createdAt updatedAt size isDir children mediaId
  }
}
mutation

renameFile

Rinomina un file o una directory.

bash
mutation RenameFile($path: String!, $name: String!) {
  renameFile(path: $path, name: $name)
}
mutation

writeTextFile

Scrive contenuto testuale in un file. Imposta overwrite=false per aggiungere un suffisso "(1)" quando il file esiste già.

bash
mutation WriteTextFile($path: String!, $content: String!, $overwrite: Boolean!) {
  writeTextFile(path: $path, content: $content, overwrite: $overwrite) {
    name path size updatedAt
  }
}
mutation

deleteFiles

Elimina uno o più file o directory per percorso esatto.

bash
mutation DeleteFiles($paths: [String!]!) {
  deleteFiles(paths: $paths)
}
mutation

copyFile

Copia un file o una directory in un percorso di destinazione. Imposta overwrite per sostituire un file esistente.

bash
mutation CopyFile($src: String!, $dst: String!, $overwrite: Boolean!) {
  copyFile(src: $src, dst: $dst, overwrite: $overwrite)
}
mutation

moveFile

Sposta un file o una directory in un percorso di destinazione. Imposta overwrite per sostituire un file esistente.

bash
mutation MoveFile($src: String!, $dst: String!, $overwrite: Boolean!) {
  moveFile(src: $src, dst: $dst, overwrite: $overwrite)
}
mutation

addFavoriteFolder

Aggiunge una cartella ai preferiti per un accesso rapido. Restituisce l'elenco aggiornato di tutte le cartelle preferite.

bash
mutation AddFavoriteFolder($rootPath: String!, $fullPath: String!) {
  addFavoriteFolder(rootPath: $rootPath, fullPath: $fullPath) {
    rootPath fullPath alias
  }
}
mutation

removeFavoriteFolder

Rimuove una cartella dai preferiti. Restituisce l'elenco aggiornato delle cartelle rimanenti.

bash
mutation RemoveFavoriteFolder($fullPath: String!) {
  removeFavoriteFolder(fullPath: $fullPath) {
    rootPath fullPath alias
  }
}
mutation

setFavoriteFolderAlias

Imposta o aggiorna l'alias mostrato per una cartella preferita. Passa una stringa vuota per cancellare l'alias.

bash
mutation SetFavoriteFolderAlias($fullPath: String!, $alias: String!) {
  setFavoriteFolderAlias(fullPath: $fullPath, alias: $alias) {
    rootPath fullPath alias
  }
}
mutation

deleteChunks

Elimina tutti i chunk memorizzati per un fileId di upload chunked. Usa dopo un upload annullato o non riuscito per liberare spazio su disco.

bash
mutation DeleteChunks($fileId: String!) {
  deleteChunks(fileId: $fileId)
}
mutation

mergeChunks

Unisce i chunk caricati in precedenza nel file finale. Passa isAppFile=true per importare il risultato nell'AppFileStore content-addressable di PlainApp (usato dagli allegati chat).

bash
mutation MergeChunks($fileId: String!, $totalChunks: Int!, $path: String!, $replace: Boolean!, $isAppFile: Boolean!) {
  mergeChunks(fileId: $fileId, totalChunks: $totalChunks, path: $path, replace: $replace, isAppFile: $isAppFile)
}