Files
Duyệt và quản lý tệp và thư mục. Hỗ trợ lưu trữ đa gắn kết (internal, SD card, USB).
Định nghĩa kiểu
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
}Thao tác
mounts
Liệt kê tất cả các ổ lưu trữ khả dụng (internal, SD card, USB).
query GetMounts {
mounts {
id name path mountPoint fsType totalBytes usedBytes freeBytes remote alias
}
}recentFiles
Liệt kê các tệp đã sửa đổi gần đây trên toàn bộ lưu trữ. Nguồn của chế độ xem "Recent" trong UI Files.
query GetRecentFiles {
recentFiles {
name path permission createdAt updatedAt size isDir children mediaId
}
}files
Liệt kê và tìm kiếm tệp dưới một đường dẫn root với phân trang. Truyền một query trống để liệt kê tất cả.
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
}
}fileInfo
Lấy stat + siêu dữ liệu media + thẻ cho một tệp duy nhất. Truyền fileName để máy chủ có thể phát hiện image/video/audio và tải width, height, duration, v.v.
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 }
}
}fileIds
Giải quyết một danh sách đường dẫn hệ thống tệp thành media-store ID của chúng (chuỗi rỗng khi không được lập chỉ mục).
query GetFileIds($paths: [String!]!) {
fileIds(paths: $paths)
}uploadedChunks
Liệt kê các index chunk đã được nhận cho một tải lên theo chunk có thể tiếp tục. Được sử dụng để tiếp tục tải lên bị gián đoạn.
query GetUploadedChunks($fileId: String!) {
uploadedChunks(fileId: $fileId)
}createDir
Tạo một thư mục mới và trả về nó dưới dạng một đối tượng File.
mutation CreateDir($path: String!) {
createDir(path: $path) {
name path permission createdAt updatedAt size isDir children mediaId
}
}renameFile
Đổi tên một tệp hoặc thư mục.
mutation RenameFile($path: String!, $name: String!) {
renameFile(path: $path, name: $name)
}writeTextFile
Ghi nội dung văn bản vào một tệp. Đặt overwrite=false để thêm hậu tố "(1)" khi tệp đã tồn tại.
mutation WriteTextFile($path: String!, $content: String!, $overwrite: Boolean!) {
writeTextFile(path: $path, content: $content, overwrite: $overwrite) {
name path size updatedAt
}
}deleteFiles
Xóa một hoặc nhiều tệp hoặc thư mục theo đường dẫn chính xác.
mutation DeleteFiles($paths: [String!]!) {
deleteFiles(paths: $paths)
}copyFile
Sao chép một tệp hoặc thư mục đến một đường dẫn đích. Đặt overwrite để thay thế tệp hiện có.
mutation CopyFile($src: String!, $dst: String!, $overwrite: Boolean!) {
copyFile(src: $src, dst: $dst, overwrite: $overwrite)
}moveFile
Di chuyển một tệp hoặc thư mục đến một đường dẫn đích. Đặt overwrite để thay thế tệp hiện có.
mutation MoveFile($src: String!, $dst: String!, $overwrite: Boolean!) {
moveFile(src: $src, dst: $dst, overwrite: $overwrite)
}addFavoriteFolder
Đánh dấu một thư mục để truy cập nhanh. Trả về danh sách cập nhật của tất cả thư mục đã đánh dấu.
mutation AddFavoriteFolder($rootPath: String!, $fullPath: String!) {
addFavoriteFolder(rootPath: $rootPath, fullPath: $fullPath) {
rootPath fullPath alias
}
}removeFavoriteFolder
Xóa một thư mục đã đánh dấu. Trả về danh sách cập nhật của các thư mục còn lại.
mutation RemoveFavoriteFolder($fullPath: String!) {
removeFavoriteFolder(fullPath: $fullPath) {
rootPath fullPath alias
}
}setFavoriteFolderAlias
Đặt hoặc cập nhật biệt danh hiển thị cho một thư mục đã đánh dấu. Truyền chuỗi rỗng để xóa biệt danh.
mutation SetFavoriteFolderAlias($fullPath: String!, $alias: String!) {
setFavoriteFolderAlias(fullPath: $fullPath, alias: $alias) {
rootPath fullPath alias
}
}deleteChunks
Xóa tất cả chunk đã lưu cho fileId tải lên theo chunk. Sử dụng sau khi tải lên bị hủy hoặc thất bại để giải phóng dung lượng đĩa.
mutation DeleteChunks($fileId: String!) {
deleteChunks(fileId: $fileId)
}mergeChunks
Hợp nhất các chunk đã tải lên trước đó thành tệp cuối cùng. Truyền isAppFile=true để nhập kết quả vào kho AppFile content-addressable của PlainApp (được sử dụng bởi tệp đính kèm chat).
mutation MergeChunks($fileId: String!, $totalChunks: Int!, $path: String!, $replace: Boolean!, $isAppFile: Boolean!) {
mergeChunks(fileId: $fileId, totalChunks: $totalChunks, path: $path, replace: $replace, isAppFile: $isAppFile)
}