Tham chiếu API

Ổ đĩa

Các ổ lưu trữ, định dạng ổ đĩa và bí danh điểm gắn.

Định nghĩa kiểu

graphql
type Mutation {
  formatDisk(path: String!): Boolean!
  setMountAlias(id: ID!, alias: String!): Boolean!
}

type Query {
  disks: [Disk!]!
  mounts: [Mount!]!
}

type Disk {
	id: ID!
	name: String!
	path: String!
	sizeBytes: Long!
	removable: Boolean!
	model: String
}

enum DriveType {
	INTERNAL_STORAGE
	SDCARD
	USB_STORAGE
	APP
}

scalar Long

type Mount {
	id: ID!
	name: String!
	path: String!
	mountPoint: String!
	fsType: String!
	totalBytes: Long!
	usedBytes: Long!
	freeBytes: Long!
	remote: Boolean!
	alias: String!
	driveType: DriveType!
	diskId: String!
	label: String!
	diskModel: String!
}

Thao tác

mutation

formatDisk

Định dạng đĩa đã chỉ định; đây là thao tác phá hủy dữ liệu, yêu cầu quyền lưu trữ của thiết bị.

graphql
mutation formatDisk($path: String!) {
  formatDisk(path: $path)
}
mutation

setMountAlias

Đặt bí danh hiển thị cho điểm gắn lưu trữ đã đăng ký.

graphql
mutation setMountAlias($id: ID!, $alias: String!) {
  setMountAlias(id: $id, alias: $alias)
}
query

disks

Liệt kê đĩa cùng thông tin phân vùng và điểm gắn.

graphql
query disks {
  disks { id name path sizeBytes removable model }
}
query

mounts

Liệt kê mọi ổ lưu trữ có sẵn (nội bộ, thẻ SD, USB).

graphql
query mounts {
  mounts { id name path mountPoint fsType totalBytes usedBytes freeBytes }
}