Tham chiếu API

Thông báo

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 Subscription {
  notificationCreated: Notification!
  notificationUpdated: Notification!
  notificationDeleted: Notification!
  notificationRefreshed: Boolean!
}

type Mutation {
  deleteNotifications(ids: [ID!]!): ActionResult!
  replyNotification(id: ID!, actionIndex: Int!, text: String!): Boolean!
}

type Query {
  notificationCount(query: String!): Int!
  notifications(query: String!, offset: Int!, limit: Int!): [Notification!]!
}

type ActionResult {
	affectedCount: Int!
}

scalar Instant

type Notification {
	id: ID!
	
	onlyOnce: Boolean!
	isClearable: Boolean!
	appId: ID!
	appName: String!
	postedAt: Instant!
	silent: Boolean!
	title: String!
	body: String!
	actions: [String!]!
	
	replyActions: [String!]!
}

Thao tác

subscription

notificationCreated

Nhận thông báo thiết bị mới được quan sát.

graphql
subscription notificationCreated {
  notificationCreated { id onlyOnce isClearable appId appName postedAt silent title }
}
subscription

notificationUpdated

Nhận thông báo thiết bị đã cập nhật.

graphql
subscription notificationUpdated {
  notificationUpdated { id onlyOnce isClearable appId appName postedAt silent title }
}
subscription

notificationDeleted

Nhận thông báo thiết bị bị xóa.

graphql
subscription notificationDeleted {
  notificationDeleted { id onlyOnce isClearable appId appName postedAt silent title }
}
subscription

notificationRefreshed

Nhận tín hiệu để làm mới danh sách thông báo thiết bị hiện tại.

graphql
subscription notificationRefreshed {
  notificationRefreshed
}
mutation

deleteNotifications

Xóa các bản ghi thông báo đã chỉ định và báo số bị tác động.

graphql
mutation deleteNotifications($ids: [ID!]!) {
  deleteNotifications(ids: $ids) { affectedCount }
}
mutation

replyNotification

Gửi trả lời thông báo qua hành động trả lời nội tuyến. actionIndex bắt đầu từ 0 trong các hành động có thể trả lời.

graphql
# `actionIndex` indexes [`Notification::reply_actions`], the
# reply-capable subset — not the plain action list.
mutation replyNotification($id: ID!, $actionIndex: Int!, $text: String!) {
  replyNotification(id: $id, actionIndex: $actionIndex, text: $text)
}
query

notificationCount

Đếm thông báo đã lưu khớp truy vấn.

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

notifications

Đọc một trang thông báo thiết bị đã lưu khớp truy vấn.

graphql
query notifications($query: String!, $offset: Int!, $limit: Int!) {
  notifications(query: $query, offset: $offset, limit: $limit) { id onlyOnce isClearable appId appName postedAt silent title }
}