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