Référence de l'API

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

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

Opérations

subscription

notificationCreated

Recevoir une notification de l’appareil nouvellement observée.

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

notificationUpdated

Recevoir une notification de l’appareil mise à jour.

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

notificationDeleted

Recevoir une notification de l’appareil supprimée.

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

notificationRefreshed

Recevoir un signal pour actualiser la liste actuelle des notifications de l’appareil.

graphql
subscription notificationRefreshed {
  notificationRefreshed
}
mutation

deleteNotifications

Supprimer les enregistrements de notifications indiqués et indiquer le nombre d’éléments concernés.

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

replyNotification

Répondre à une notification via une action de réponse intégrée. actionIndex commence à 0 parmi les actions permettant une réponse.

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

Compter les notifications enregistrées correspondant à la requête.

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

notifications

Lire une page de notifications enregistrées de l’appareil correspondant à la requête.

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