Notifications
Vérifier app.capabilities pour la prise en charge des fonctionnalités et app.access ainsi que les permissions de l’hôte pour les autorisations. Les exemples utilisent des valeurs synthétiques ; remplacer les chemins, ID, entrées et filtres avant tout appel.
Définitions de types
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!]!
}Opérations
notificationCreated
Recevoir une notification de l’appareil nouvellement observée.
subscription notificationCreated {
notificationCreated { id onlyOnce isClearable appId appName postedAt silent title }
}notificationUpdated
Recevoir une notification de l’appareil mise à jour.
subscription notificationUpdated {
notificationUpdated { id onlyOnce isClearable appId appName postedAt silent title }
}notificationDeleted
Recevoir une notification de l’appareil supprimée.
subscription notificationDeleted {
notificationDeleted { id onlyOnce isClearable appId appName postedAt silent title }
}notificationRefreshed
Recevoir un signal pour actualiser la liste actuelle des notifications de l’appareil.
subscription notificationRefreshed {
notificationRefreshed
}deleteNotifications
Supprimer les enregistrements de notifications indiqués et indiquer le nombre d’éléments concernés.
mutation deleteNotifications($ids: [ID!]!) {
deleteNotifications(ids: $ids) { affectedCount }
}replyNotification
Répondre à une notification via une action de réponse intégrée. actionIndex commence à 0 parmi les actions permettant une réponse.
# `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
Compter les notifications enregistrées correspondant à la requête.
query notificationCount($query: String!) {
notificationCount(query: $query)
}notifications
Lire une page de notifications enregistrées de l’appareil correspondant à la requête.
query notifications($query: String!, $offset: Int!, $limit: Int!) {
notifications(query: $query, offset: $offset, limit: $limit) { id onlyOnce isClearable appId appName postedAt silent title }
}