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
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
notificationCreated
Receber uma notificação do dispositivo acabada de observar.
subscription notificationCreated {
notificationCreated { id onlyOnce isClearable appId appName postedAt silent title }
}notificationUpdated
Receber uma notificação do dispositivo atualizada.
subscription notificationUpdated {
notificationUpdated { id onlyOnce isClearable appId appName postedAt silent title }
}notificationDeleted
Receber uma notificação do dispositivo removida.
subscription notificationDeleted {
notificationDeleted { id onlyOnce isClearable appId appName postedAt silent title }
}notificationRefreshed
Receber um sinal para atualizar a lista atual de notificações do dispositivo.
subscription notificationRefreshed {
notificationRefreshed
}deleteNotifications
Eliminar os registos de notificações indicados e indicar a contagem afetada.
mutation deleteNotifications($ids: [ID!]!) {
deleteNotifications(ids: $ids) { affectedCount }
}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.
# `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)
}notificationCount
Contar as notificações guardadas que correspondam à consulta.
query notificationCount($query: String!) {
notificationCount(query: $query)
}notifications
Consultar uma página de notificações do dispositivo guardadas que correspondam à consulta.
query notifications($query: String!, $offset: Int!, $limit: Int!) {
notifications(query: $query, offset: $offset, limit: $limit) { id onlyOnce isClearable appId appName postedAt silent title }
}