API 參考
App
取得裝置和應用程式資訊、設定剪貼簿、重新啟動應用程式以及管理裝置層級設定。收藏資料夾的變更記錄在 Files 章節中。
型別定義
bash
type App {
usbConnected: Boolean!
urlToken: String! # current session token
httpPort: Int!
httpsPort: Int!
appDir: String!
deviceName: String!
battery: Int! # battery level 0–100
appVersion: Int! # versionCode
osVersion: Int! # Android SDK level e.g. 35
channel: String! # "github" | "google"
permissions: [String!]! # granted API permissions
audios: [PlaylistAudio!]! # current playlist
audioMode: MediaPlayMode! # REPEAT | REPEAT_ONE | SHUFFLE
audioCurrent: String! # path of the playing track
sdcardPath: String!
usbDiskPaths: [String!]!
internalStoragePath: String!
downloadsDir: String!
developerMode: Boolean!
favoriteFolders: [FavoriteFolder!]!
}
type FavoriteFolder {
rootPath: String!
fullPath: String!
alias: String # optional display alias, nullable
}
type TempValue {
key: String!
value: String!
}
type DeviceInfo {
# Hardware + OS info: manufacturer, model, sdkInt, buildChannel, etc.
# Fields are platform-dependent; see PlainApp source for the full list.
}
type Battery {
level: Int! # 0–100
status: BatteryStatus! # CHARGING | DISCHARGING | FULL | NOT_CHARGING
health: BatteryHealth!
plugged: BatteryPlugged!
temperature: Int! # tenths of a degree Celsius
voltage: Int! # millivolts
}
enum BatteryStatus { CHARGING DISCHARGING FULL NOT_CHARGING UNKNOWN }
enum BatteryHealth { GOOD OVERHEAT DEAD OVER_VOLTAGE UNSPECIFIED_FAILURE UNKNOWN COLD }
enum BatteryPlugged { AC USB WIRELESS NONE }操作
query
app
在單次查詢中取得所有裝置與應用程式狀態。
bash
query GetApp {
app {
usbConnected urlToken httpPort httpsPort appDir deviceName
battery appVersion osVersion channel permissions
audios { title path duration } audioMode audioCurrent
sdcardPath usbDiskPaths internalStoragePath downloadsDir developerMode
favoriteFolders { rootPath fullPath alias }
}
}query
deviceInfo
取得硬體和 OS 資訊(製造商、型號、SDK 級別等)。
bash
query GetDeviceInfo {
deviceInfo { manufacturer model sdkInt buildChannel }
}query
battery
取得目前電池電量、充電狀態、健康狀態和電壓。
bash
query GetBattery {
battery { level status health plugged temperature voltage }
}mutation
setTempValue
在伺服器記憶體中設定臨時鍵值對。HTTP 伺服器重啟時清除。
bash
mutation SetTempValue($key: String!, $value: String!) {
setTempValue(key: $key, value: $value) { key value }
}mutation
relaunchApp
在裝置上重新啟動 PlainApp 程序。
bash
mutation RelaunchApp {
relaunchApp
}mutation
openAccessibilitySettings
在裝置上開啟 Android 無障礙設定畫面。在 sendScreenMirrorControl 可以分發手勢之前必須先呼叫。
bash
mutation OpenAccessibilitySettings {
openAccessibilitySettings
}mutation
openWebSettings
在裝置上開啟 PlainApp web-UI 設定畫面(密碼、2FA 等)。
bash
mutation OpenWebSettings {
openWebSettings
}mutation
setClip
將裝置剪貼簿設定為給定文字。
bash
mutation SetClip($text: String!) {
setClip(text: $text)
}mutation
updateDeviceName
變更在 web UI 中顯示並廣播給已配對 peers 的裝置顯示名稱。
bash
mutation UpdateDeviceName($name: String!) {
updateDeviceName(name: $name)
}