Tham chiếu API

Gói ứ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

graphql
type Mutation {
  installPackage(path: String!): PackageInstallPending!
  uninstallPackages(ids: [ID!]!): Boolean!
}

type Query {
  packageCount(query: String!): Int!
  packageManifest(id: ID!): String!
  packageStatuses(ids: [ID!]!): [PackageStatus!]!
  packages(query: String!, offset: Int!, limit: Int!, sortBy: FileSortBy!): [Package!]!
}

type Certificate {
	issuer: String!
	subject: String!
	serialNumber: String!
	validFrom: Instant!
	validTo: Instant!
}

enum FileSortBy {
	UPDATED_AT_ASC
	UPDATED_AT_DESC
	SIZE_ASC
	SIZE_DESC
	NAME_ASC
	NAME_DESC
}

scalar Instant

scalar Long

type Package {
	id: ID!
	name: String!
	type: PackageType!
	version: String!
	path: String!
	size: Long!
	certs: [Certificate!]!
	installedAt: Instant!
	updatedAt: Instant!
}

type PackageInstallPending {
	id: ID!
	updatedAt: Instant
	isNew: Boolean!
}

type PackageStatus {
	id: ID!
	exists: Boolean!
	updatedAt: Instant
}

enum PackageType {
	SYSTEM
	
	USER
}

Thao tác

mutation

installPackage

Cài đặt (hoặc cập nhật) APK bằng đường dẫn tệp tuyệt đối. Trả về tên gói, thời điểm cập nhật cuối và gói có mới cài hay không.

graphql
mutation installPackage($path: String!) {
  installPackage(path: $path) { id updatedAt isNew }
}
mutation

uninstallPackages

Mở lời nhắc gỡ cài đặt hệ thống cho từng ID gói. Người dùng phải xác nhận trên thiết bị.

graphql
# Launch system uninstall requests; true means initiated, not uninstalled. Confirm removal with packageStatuses.
mutation uninstallPackages($ids: [ID!]!) {
  uninstallPackages(ids: $ids)
}
query

packageCount

Đếm gói khớp truy vấn.

graphql
query packageCount($query: String!) {
  packageCount(query: $query)
}
query

packageManifest

Đọc manifest của gói đã cài được chỉ định.

graphql
query packageManifest($id: ID!) {
  packageManifest(id: $id)
}
query

packageStatuses

Tra trạng thái cài đặt và dấu thời gian updatedAt cho danh sách tên gói.

graphql
query packageStatuses($ids: [ID!]!) {
  packageStatuses(ids: $ids) { id exists updatedAt }
}
query

packages

Tìm gói đã cài. Để query rỗng để liệt kê tất cả.

graphql
query packages($query: String!, $offset: Int!, $limit: Int!, $sortBy: FileSortBy!) {
  packages(query: $query, offset: $offset, limit: $limit, sortBy: $sortBy) { id name type version path size installedAt updatedAt }
}