API 참조

Files

파일과 디렉터리를 탐색하고 관리합니다. 다중 마운트 저장공간(내부, SD 카드, USB)을 지원합니다.

타입 정의

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
}

작업

query

mounts

사용 가능한 모든 저장 볼륨(내부, SD 카드, USB)을 나열합니다.

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

recentFiles

모든 저장공간에서 최근 수정된 파일을 나열합니다. Files UI의 "최근" 보기의 데이터 소스입니다.

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

files

루트 경로 아래의 파일을 페이지 매김으로 나열하고 검색합니다. 빈 쿼리를 전달하면 모두 나열됩니다.

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

단일 파일의 stat + 미디어 메타데이터 + 태그를 가져옵니다. 서버가 이미지/비디오/오디오를 감지하고 너비, 높이, 길이 등을 로드할 수 있도록 fileName을 전달합니다.

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

파일시스템 경로 목록을 미디어 저장소 ID로 해석합니다 (인덱싱되지 않은 경우 빈 문자열).

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

uploadedChunks

재개 가능한 청크 업로드에서 이미 수신된 청크 인덱스를 나열합니다. 중단된 업로드를 재개하는 데 사용됩니다.

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

createDir

새 디렉터리를 만들고 File 객체로 반환합니다.

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

renameFile

파일 또는 디렉터리의 이름을 바꿉니다.

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

writeTextFile

텍스트 내용을 파일에 씁니다. overwrite=false를 설정하면 파일이 이미 존재할 때 "(1)" 접미사를 추가합니다.

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

deleteFiles

정확한 경로로 하나 이상의 파일 또는 디렉터리를 삭제합니다.

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

copyFile

파일 또는 디렉터리를 대상 경로에 복사합니다. overwrite를 설정하면 기존 파일이 대체됩니다.

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

moveFile

파일 또는 디렉터리를 대상 경로로 이동합니다. overwrite를 설정하면 기존 파일이 대체됩니다.

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

addFavoriteFolder

빠른 액세스를 위해 폴더를 북마크합니다. 북마크된 모든 폴더의 업데이트된 목록을 반환합니다.

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

removeFavoriteFolder

북마크된 폴더를 제거합니다. 남은 폴더의 업데이트된 목록을 반환합니다.

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

setFavoriteFolderAlias

북마크된 폴더에 표시되는 별칭을 설정하거나 업데이트합니다. 빈 문자열을 전달하면 별칭이 지워집니다.

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

deleteChunks

청크 업로드 fileId의 저장된 모든 청크를 삭제합니다. 취소되거나 실패한 업로드 후 디스크 공간을 확보하는 데 사용합니다.

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

mergeChunks

이전에 업로드된 청크를 최종 파일로 병합합니다. isAppFile=true를 전달하면 결과를 PlainApp의 콘텐츠 주소 지정 가능한 AppFile 저장소 (채팅 첨부 파일에서 사용)로 가져옵니다.

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