API リファレンス

アプリ

機能の対応状況は app.capabilities、認可は app.access とホストの権限で確認してください。例は合成値を使用しています。呼び出す前にパス、ID、入力、フィルターを置き換えてください。

型定義

graphql
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 Long

操作

mutation

clearAppCache

破棄可能なアプリキャッシュファイルを削除します。

graphql
mutation clearAppCache {
  clearAppCache
}
mutation

restartHttpServer

HTTP/HTTPS ポートを変更し、新しい待受処理の準備完了まで待ちます。HTTP_SERVER が必要です。実際のポートを返します。現在のアドレスが変わる場合は再接続してください。

graphql
mutation restartHttpServer($httpPort: Int, $httpsPort: Int) {
  restartHttpServer(httpPort: $httpPort, httpsPort: $httpsPort) { revision restarting httpPort httpsPort error }
}
query

appCacheSize

アプリキャッシュの使用量をバイト単位で返します。

graphql
query appCacheSize {
  appCacheSize
}
query

appUpdate

利用可能なアプリアップデート情報を読み取ります。

graphql
query appUpdate {
  appUpdate { currentVersion latestVersion releaseName publishedAt hasUpdate url }
}
query

httpServer

HTTP/HTTPS の待受状態、LAN アドレス、接続中のクライアント、リモートアクセス状態を取得します。認証済みの呼び出し元と HTTP_SERVER 機能が必要です。

graphql
query httpServer {
  httpServer { addresses onlineClients remoteAccess mdnsHostname }
}
subscription

httpServerChanged

購読開始時、およびリスナー、ネットワーク、オンラインクライアント、設定の変更後に、HTTP サーバーの現在の状態を受信します。認証済みの呼び出し元と HTTP_SERVER のサポートが必要です。ページを離れるときに購読を解除し、戻ったときに再購読します。

graphql
subscription httpServerChanged {
  httpServerChanged { addresses onlineClients remoteAccess mdnsHostname }
}
subscription

deviceNameUpdated

更新されたデバイス表示名を受信します。

graphql
subscription deviceNameUpdated {
  deviceNameUpdated
}
subscription

accessUpdated

デバイスの機能認可の変更時に変更シグナルを受信します。

graphql
subscription accessUpdated {
  accessUpdated
}
subscription

contentChanged

保存された内容の変更時に変更シグナルを受信します。

graphql
subscription contentChanged {
  contentChanged
}
mutation

relaunchApp

デバイス上の PlainApp プロセスを再起動します。

graphql
# The app restarts itself; the response only acknowledges that the
# request was accepted, since the connection dies with the process.
mutation relaunchApp {
  relaunchApp
}
mutation

requestAccess

対応する機能のデバイス認可を要求します。デバイス上でユーザー操作が必要になる場合があります。

graphql
mutation requestAccess($feature: AccessFeature!) {
  requestAccess(feature: $feature)
}
mutation

setTempValue

メモリ内の一時的なキーと値のペアを設定し、それを返します。永続的な Key Value データではありません。

graphql
mutation setTempValue($key: String!, $value: String!) {
  setTempValue(key: $key, value: $value) { key value }
}
mutation

updateDeviceName

Web UI に表示し、ペアリング済みピアに通知するデバイス表示名を変更します。

graphql
# 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)
}
query

app

アプリの ID、設定、機能対応状況、認可フィールドを読み取ります。app.urlToken は呼び出し元のセッションに属し、リソースリンクを暗号化するもので、GraphQL 認証トークンではありません。

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