PlainApp
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

웹 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

앱 신원, 설정, 기능 지원, 인가 필드를 읽습니다. 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 }
}