Ứng dụng
Kiểm tra app.capabilities để biết tính năng và app.access cùng quyền máy chủ để xác định quyền truy cập. Thay giá trị mẫu trước khi gọi.
Định nghĩa kiểu
type Mutation {
clearAppCache: Boolean!
restartHttpServer(httpPort: Int, httpsPort: Int): HttpServerState!
relaunchApp: Boolean!
requestAccess(feature: AccessFeature!): Boolean!
setTempValue(key: String!, value: String!): KeyValuePair!
updateDeviceName(name: String!): Boolean!
}
type Query {
appCacheSize: Long!
appUpdate: AppUpdate!
httpServer: HttpServer!
app: App!
}
type Subscription {
httpServerChanged: HttpServer!
deviceNameUpdated: String!
accessUpdated: Boolean!
contentChanged: Boolean!
}
enum AccessFeature {
IMAGES
VIDEOS
AUDIO
DOCS
FILES
CONTACTS
SMS
CALLS
CALL_PHONE
PHONE_NUMBER
APPS
NOTIFICATIONS
CLIPBOARD
ADB
}
type App {
clientId: ID!
httpPort: Int!
httpsPort: Int!
deviceName: String!
developerMode: Boolean!
urlToken: String!
tlsCertificateSha256: String
appDir: String!
deviceType: DeviceType!
capabilities: [Capability!]!
buildChannel: AppChannelType!
access: [AccessFeature!]!
downloadsDir: String!
debug: Boolean!
}
enum AppChannelType {
GITHUB
GOOGLE
FDROID
}
type AppUpdate {
currentVersion: String!
latestVersion: String
releaseName: String!
publishedAt: Instant
hasUpdate: Boolean!
url: String
}
enum Capability {
ADB
BLE
WIFI_AWARE
APP_RELAUNCH
MEDIA_TRASH
MEDIA_DELETE
MEDIA_MOVE
MEDIA_FAVORITE
APP_UPDATES
MIRROR_AUDIO
MEDIA_SCAN
TELEPHONY
PACKAGES
SCREEN_MIRROR
NOTIFICATIONS
CLIPBOARD
DISK_MANAGER
HTTP_SERVER
}
enum DeviceType {
COMPUTER
PHONE
TABLET
TV
NAS
OTHER
}
type HttpServer {
state: HttpServerState!
addresses: [String!]!
onlineClients: [ID!]!
remoteAccess: Boolean!
mdnsHostname: String!
}
type HttpServerState {
revision: Long!
restarting: Boolean!
httpPort: Int!
httpsPort: Int!
error: String!
}
scalar Instant
type KeyValuePair {
key: String!
value: String!
}
scalar LongThao tác
clearAppCache
Xóa các tệp bộ nhớ đệm ứng dụng có thể bỏ đi.
mutation clearAppCache {
clearAppCache
}restartHttpServer
Đổi cổng HTTP/HTTPS và chờ bộ lắng nghe mới sẵn sàng. Cần HTTP_SERVER. Trả về cổng thực tế; hãy kết nối lại nếu địa chỉ hiện tại thay đổi.
mutation restartHttpServer($httpPort: Int, $httpsPort: Int) {
restartHttpServer(httpPort: $httpPort, httpsPort: $httpsPort) { revision restarting httpPort httpsPort error }
}appCacheSize
Trả về dung lượng bộ nhớ đệm ứng dụng theo byte.
query appCacheSize {
appCacheSize
}appUpdate
Đọc thông tin cập nhật ứng dụng có sẵn.
query appUpdate {
appUpdate { currentVersion latestVersion releaseName publishedAt hasUpdate url }
}httpServer
Đọc trạng thái HTTP/HTTPS, địa chỉ LAN, máy khách đang kết nối và trạng thái truy cập từ xa. Cần bên gọi đã xác thực và HTTP_SERVER.
query httpServer {
httpServer { addresses onlineClients remoteAccess mdnsHostname }
}httpServerChanged
Nhận trạng thái hiện tại của máy chủ HTTP khi đăng ký và sau khi bộ lắng nghe, mạng, máy khách trực tuyến hoặc tùy chọn thay đổi. Yêu cầu bên gọi đã xác thực và hỗ trợ HTTP_SERVER. Hủy đăng ký khi rời trang và đăng ký lại khi quay lại.
subscription httpServerChanged {
httpServerChanged { addresses onlineClients remoteAccess mdnsHostname }
}deviceNameUpdated
Nhận tên hiển thị thiết bị đã cập nhật.
subscription deviceNameUpdated {
deviceNameUpdated
}accessUpdated
Nhận tín hiệu khi quyền tính năng thiết bị thay đổi.
subscription accessUpdated {
accessUpdated
}contentChanged
Nhận tín hiệu khi nội dung đã lưu thay đổi.
subscription contentChanged {
contentChanged
}relaunchApp
Khởi động lại tiến trình PlainApp trên thiết bị.
# The app restarts itself; the response only acknowledges that the
# request was accepted, since the connection dies with the process.
mutation relaunchApp {
relaunchApp
}requestAccess
Yêu cầu thiết bị cấp quyền cho tính năng được hỗ trợ; có thể cần người dùng thao tác trên thiết bị.
mutation requestAccess($feature: AccessFeature!) {
requestAccess(feature: $feature)
}setTempValue
Đặt và trả về cặp khóa/giá trị tạm thời trong bộ nhớ; đây không phải dữ liệu Key Value bền vững.
mutation setTempValue($key: String!, $value: String!) {
setTempValue(key: $key, value: $value) { key value }
}updateDeviceName
Đổi tên hiển thị thiết bị trong giao diện web và quảng bá đến thiết bị ngang hàng đã ghép đôi.
# Renaming the device also re-publishes the mDNS advertisement, so a
# client that waits for the new name to appear does see it.
mutation updateDeviceName($name: String!) {
updateDeviceName(name: $name)
}app
Đọc các trường danh tính, cấu hình, khả năng và quyền ứng dụng. app.urlToken thuộc phiên gọi và mã hóa liên kết tài nguyên; nó không phải token xác thực GraphQL.
# Everything a client needs to reach this device: its identity, the
# port it listens on and the token that authorises it.
query app {
app { clientId httpPort httpsPort deviceName developerMode urlToken tlsCertificateSha256 appDir }
}