Tham chiếu API

Bảng nhớ tạm

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 {
  deleteClipboardItems(query: String!): ActionResult!
  setClipboard(text: String!, label: String! = "", sensitive: Boolean! = false): Boolean!
}

type Query {
  clipboardItemCount(query: String!): Int!
  clipboardItems(query: String!, offset: Int!, limit: Int!): [ClipboardItem!]!
}

type Subscription {
  clipboardChanged: ClipboardChange!
}

type ActionResult {
	affectedCount: Int!
}

type ClipboardChange {
	text: String!
	sensitive: Boolean!
	time: Instant!
}

type ClipboardItem {
	id: ID!
	text: String!
	
	source: String!
	label: String!
	sensitive: Boolean!
	createdAt: Instant!
}

scalar Instant

Thao tác

mutation

deleteClipboardItems

Xóa bản ghi lịch sử bảng nhớ tạm khớp; dùng truy vấn all:true rõ ràng để xóa tất cả.

graphql
# Delete clipboard history entries matching the query DSL (`ids:` /
# `text:`; a bare word is a text LIKE). A blank query is rejected —
# send `all:true` to target everything.
mutation deleteClipboardItems($query: String!) {
  deleteClipboardItems(query: $query) { affectedCount }
}
mutation

setClipboard

Ghi văn bản vào bảng nhớ tạm thiết bị và ghi lại thao tác trong lịch sử.

graphql
# Record caller-attributed history only after a successful system write; suppress watcher echoes.
mutation setClipboard($text: String!, $label: String!, $sensitive: Boolean!) {
  setClipboard(text: $text, label: $label, sensitive: $sensitive)
}
query

clipboardItemCount

Đếm mục lịch sử bảng nhớ tạm khớp truy vấn.

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

clipboardItems

Đọc mục lịch sử bảng nhớ tạm khớp có phân trang, mới nhất trước.

graphql
# Paged clipboard history, newest first.
query clipboardItems($query: String!, $offset: Int!, $limit: Int!) {
  clipboardItems(query: $query, offset: $offset, limit: $limit) { id text source label sensitive createdAt }
}
subscription

clipboardChanged

Nhận thông tin thay đổi bảng nhớ tạm.

graphql
subscription clipboardChanged {
  clipboardChanged { text sensitive time }
}