Aplicação
Verificar app.capabilities para o suporte de funcionalidades e app.access juntamente com as permissões do anfitrião para autorização. Os exemplos usam valores sintéticos; substituir caminhos, ID, entradas e filtros antes da chamada.
Definições de Tipo
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 LongOperações
clearAppCache
Eliminar os ficheiros descartáveis da cache da aplicação.
mutation clearAppCache {
clearAppCache
}restartHttpServer
Alterar as portas HTTP/HTTPS e aguardar os novos listeners ficarem prontos. Requer HTTP_SERVER. Retorna as portas reais; reconecte-se se o endereço atual mudar.
mutation restartHttpServer($httpPort: Int, $httpsPort: Int) {
restartHttpServer(httpPort: $httpPort, httpsPort: $httpsPort) { revision restarting httpPort httpsPort error }
}appCacheSize
Devolver a utilização da cache da aplicação em bytes.
query appCacheSize {
appCacheSize
}appUpdate
Consultar as informações disponíveis sobre atualizações da aplicação.
query appUpdate {
appUpdate { currentVersion latestVersion releaseName publishedAt hasUpdate url }
}httpServer
Ler o estado HTTP/HTTPS, os endereços LAN, os clientes conectados e o acesso remoto. Requer um solicitante autenticado e HTTP_SERVER.
query httpServer {
httpServer { addresses onlineClients remoteAccess mdnsHostname }
}httpServerChanged
Receba o estado atual do servidor HTTP ao assinar e após alterações nos listeners, na rede, nos clientes conectados ou nas preferências. Requer um chamador autenticado e suporte a HTTP_SERVER. Cancele a assinatura ao sair da página e assine novamente ao retornar.
subscription httpServerChanged {
httpServerChanged { addresses onlineClients remoteAccess mdnsHostname }
}deviceNameUpdated
Receber o nome apresentado atualizado do dispositivo.
subscription deviceNameUpdated {
deviceNameUpdated
}accessUpdated
Receber um sinal quando a autorização das funcionalidades do dispositivo mudar.
subscription accessUpdated {
accessUpdated
}contentChanged
Receber um sinal quando o conteúdo guardado mudar.
subscription contentChanged {
contentChanged
}relaunchApp
Reiniciar o processo PlainApp no dispositivo.
# The app restarts itself; the response only acknowledges that the
# request was accepted, since the connection dies with the process.
mutation relaunchApp {
relaunchApp
}requestAccess
Solicitar autorização do dispositivo para uma funcionalidade suportada; pode ser necessária a intervenção do utilizador no dispositivo.
mutation requestAccess($feature: AccessFeature!) {
requestAccess(feature: $feature)
}setTempValue
Definir e devolver um par chave/valor transitório em memória; não são dados persistentes de Key Value.
mutation setTempValue($key: String!, $value: String!) {
setTempValue(key: $key, value: $value) { key value }
}updateDeviceName
Alterar o nome do dispositivo apresentado na interface Web e anunciado aos pares associados.
# 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
Consultar a identidade, configuração, capacidades e autorização da aplicação. app.urlToken pertence à sessão que efetua a chamada e cifra ligações a recursos; não é o token de autenticação 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 }
}