PlainApp
API 参考

磁盘

存储卷、磁盘格式化和挂载别名。

类型定义

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!
}

操作

mutation

formatDisk

格式化指定磁盘;此操作会破坏数据,需要设备的存储权限。

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

setMountAlias

设置已注册存储挂载点的显示别名。

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

disks

列出磁盘及其分区、挂载信息。

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

mounts

列出所有可用存储卷,包括内部存储、SD 卡和 USB。

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