PlainApp
Referência da API

Notificações

Verificar app.capabilities para o suporte de funcionalidades e app.access juntamente com as permissões do anfitrião para autorização. Os exemplos usam valores sintéticos; substituir caminhos, ID, entradas e filtros antes da chamada.

Definições de Tipo

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

Operações

subscription

notificationCreated

Receber uma notificação do dispositivo acabada de observar.

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

notificationUpdated

Receber uma notificação do dispositivo atualizada.

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

notificationDeleted

Receber uma notificação do dispositivo removida.

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

notificationRefreshed

Receber um sinal para atualizar a lista atual de notificações do dispositivo.

graphql
subscription notificationRefreshed {
  notificationRefreshed
}
mutation

deleteNotifications

Eliminar os registos de notificações indicados e indicar a contagem afetada.

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

replyNotification

Responder a uma notificação através de uma ação de resposta direta. actionIndex começa em 0 entre as ações que permitem responder.

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

Contar as notificações guardadas que correspondam à consulta.

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

notifications

Consultar uma página de notificações do dispositivo guardadas que correspondam à consulta.

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