Discussion
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 Mutation {
deleteChatItem(id: ID!): Boolean!
deleteChatItems(query: String!): ActionResult!
editChatText(id: ID!, text: String!): ChatTextEdit!
forwardChatItems(id: ID!, targets: [String!]!, note: String): [ChatItem!]!
retryChatItem(id: ID!, recipientIds: [ID!]): ChatItem!
sendChatItems(targets: [String!]!, content: ChatContentInput!): [ChatItem!]!
sendFolderShare(targets: [String!]!, path: String!, name: String!, expiresAt: Instant): [ChatItem!]!
sendShare(targets: [String!]!, shareId: ID!): [ChatItem!]!
}
type Query {
chatConversations: [ChatConversation!]!
chatCount(query: String!): Int!
chatItem(id: ID!): ChatItem
chatItems(target: String!, query: String!, offset: Int!, limit: Int!): [ChatItem!]!
chatRecords(query: String!, offset: Int!, limit: Int!): [ChatItem!]!
}
type Subscription {
messagesCreated: [ChatItem!]!
messagesUpdated: [ChatItem!]!
messagesDeleted: String!
}
type ActionResult {
affectedCount: Int!
}
type ChatAttachment {
id: ID!
uri: String!
size: Long!
durationMs: Long!
width: Int!
height: Int!
summary: String!
fileName: String!
}
input ChatAttachmentInput {
id: ID!
uri: String!
size: Long!
durationMs: Long! = 0
width: Int! = 0
height: Int! = 0
summary: String! = ""
fileName: String! = ""
}
enum ChatAttachmentType {
IMAGE
FILE
}
union ChatContent = ChatMessageContent | ChatShareContent
input ChatContentInput @oneOf {
message: ChatMessageInput
share: ChatShareInput
}
type ChatConversation {
id: ID!
chat: ChatItem!
}
type ChatDeliveryResult {
peerId: ID!
peerName: String!
error: String
}
type ChatItem {
fromId: ID!
toId: ID!
channelId: ID
id: ID!
content: ChatContent!
createdAt: Instant!
updatedAt: Instant!
status: ChatStatus!
deliveryResults: [ChatDeliveryResult!]!
}
type ChatLinkPreview {
url: String!
title: String
description: String
image: String
imageWidth: Int!
imageHeight: Int!
siteName: String
domain: String
createdAt: Instant!
}
type ChatMessageAttachment {
type: ChatAttachmentType!
attachment: ChatAttachment!
}
input ChatMessageAttachmentInput {
type: ChatAttachmentType!
attachment: ChatAttachmentInput!
}
type ChatMessageContent {
text: String
format: ChatTextFormat!
items: [ChatMessageAttachment!]!
linkPreviews: [ChatLinkPreview!]!
}
input ChatMessageInput {
text: String
format: ChatTextFormat! = PLAIN
items: [ChatMessageAttachmentInput!]! = []
}
type ChatShareContent {
shareId: ID!
urlToken: String!
peerInfo: ChatSharePeer!
name: String!
itemCount: Long!
totalSize: Long!
expiresAt: Instant
}
input ChatShareInput {
shareId: ID!
urlToken: String!
peerInfo: ChatSharePeerInput!
name: String!
itemCount: Long! = 0
totalSize: Long! = 0
expiresAt: Instant
}
type ChatSharePeer {
id: ID!
ip: String!
port: Int!
}
input ChatSharePeerInput {
id: ID!
ip: String!
port: Int!
}
enum ChatStatus {
SENT
FAILED
PARTIAL
PENDING
}
type ChatTextEdit {
changed: Boolean!
chat: ChatItem!
}
enum ChatTextFormat {
PLAIN
MARKDOWN
}
scalar Instant
scalar LongOpérations
deleteChatItem
Supprimer un message de discussion par son ID.
# Always true: an id that is already gone is the state the caller asked
# for, and the contract has no way to say "nothing was there".
mutation deleteChatItem($id: ID!) {
deleteChatItem(id: $id)
}deleteChatItems
Supprimer en lot les messages correspondant à une requête (par ex. "id:msg_x,id:msg_y").
mutation deleteChatItems($query: String!) {
deleteChatItems(query: $query) { affectedCount }
}editChatText
Modifier le texte d’un message existant et renvoyer le résultat de la modification.
mutation editChatText($id: ID!, $text: String!) {
editChatText(id: $id, text: $text) { changed }
}forwardChatItems
Transfère le contenu original sans le modifier, puis envoie la note facultative comme message en texte brut séparé à chaque destinataire. Chaque élément renvoyé a son propre statut de livraison.
mutation forwardChatItems($id: ID!, $targets: [String!]!, $note: String) {
forwardChatItems(id: $id, targets: $targets, note: $note) { id status deliveryResults { peerId peerName error } content { __typename ... on ChatMessageContent { text format } } }
}retryChatItem
Réessaie l’envoi. Les destinataires ne peuvent être précisés que pour les messages de canal.
mutation retryChatItem($id: ID!, $recipientIds: [ID!]) {
retryChatItem(id: $id, recipientIds: $recipientIds) { fromId toId channelId id createdAt updatedAt status }
}sendChatItems
Envoie un message à une ou plusieurs destinations avec peer:example-id ou channel:example-id.
mutation sendChatItems($targets: [String!]!, $content: ChatContentInput!) {
sendChatItems(targets: $targets, content: $content) { fromId toId channelId id createdAt updatedAt status }
}chatConversations
Lister les conversations avec un résumé de leur dernier message.
query chatConversations {
chatConversations { id }
}chatCount
Compter les messages enregistrés correspondant à la requête.
query chatCount($query: String!) {
chatCount(query: $query)
}chatItem
Lire un message enregistré par ID ; renvoyer null s’il est absent.
query chatItem($id: ID!) {
chatItem(id: $id) { fromId toId channelId id createdAt updatedAt status }
}chatItems
Obtenir tous les messages d’une conversation. Préfixer id par "channel:" ou "peer:".
# Messages in chronological order; `target`: `peer:<id>` or `channel:<id>`.
query chatItems($target: String!, $query: String!, $offset: Int!, $limit: Int!) {
chatItems(target: $target, query: $query, offset: $offset, limit: $limit) { fromId toId channelId id createdAt updatedAt status }
}chatRecords
Rechercher les messages enregistrés avec pagination.
query chatRecords($query: String!, $offset: Int!, $limit: Int!) {
chatRecords(query: $query, offset: $offset, limit: $limit) { fromId toId channelId id createdAt updatedAt status }
}messagesCreated
Recevoir les messages de discussion nouvellement enregistrés.
subscription messagesCreated {
messagesCreated { fromId toId channelId id createdAt updatedAt status }
}messagesUpdated
Recevoir les mises à jour des messages de discussion enregistrés.
subscription messagesUpdated {
messagesUpdated { fromId toId channelId id createdAt updatedAt status }
}messagesDeleted
Recevoir une notification de suppression d’un message de discussion.
subscription messagesDeleted {
messagesDeleted
}