चैट
सुविधा समर्थन के लिए app.capabilities और प्राधिकरण के लिए app.access तथा होस्ट अनुमतियाँ जाँचें। उदाहरण कृत्रिम मान उपयोग करते हैं; कॉल करने से पहले पथ, ID, इनपुट और फ़िल्टर बदलें।
प्रकार परिभाषाएँ
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 Longऑपरेशन
deleteChatItem
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
क्वेरी (जैसे "id:msg_x,id:msg_y") से मेल खाने वाले चैट संदेश सामूहिक रूप से मिटाएँ।
mutation deleteChatItems($query: String!) {
deleteChatItems(query: $query) { affectedCount }
}editChatText
मौजूदा चैट संदेश का टेक्स्ट संपादित करें और संपादन परिणाम लौटाएँ।
mutation editChatText($id: ID!, $text: String!) {
editChatText(id: $id, text: $text) { changed }
}forwardChatItems
मूल सामग्री को बिना बदले फ़ॉरवर्ड करता है, फिर हर लक्ष्य को वैकल्पिक नोट अलग सादे टेक्स्ट संदेश के रूप में भेजता है। लौटाए गए हर आइटम की अपनी डिलीवरी स्थिति होती है।
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
संदेश फिर भेजने की कोशिश करें। प्राप्तकर्ता केवल चैनल संदेशों के लिए तय करें।
mutation retryChatItem($id: ID!, $recipientIds: [ID!]) {
retryChatItem(id: $id, recipientIds: $recipientIds) { fromId toId channelId id createdAt updatedAt status }
}sendChatItems
peer:example-id या channel:example-id से एक या अधिक लक्ष्यों को संदेश भेजें।
mutation sendChatItems($targets: [String!]!, $content: ChatContentInput!) {
sendChatItems(targets: $targets, content: $content) { fromId toId channelId id createdAt updatedAt status }
}chatConversations
नवीनतम संदेश सारांश सहित चैट वार्तालाप सूचीबद्ध करें।
query chatConversations {
chatConversations { id }
}chatCount
क्वेरी से मेल खाने वाले सहेजे गए चैट संदेश गिनें।
query chatCount($query: String!) {
chatCount(query: $query)
}chatItem
ID से एक सहेजा चैट संदेश पढ़ें; न होने पर null लौटाएँ।
query chatItem($id: ID!) {
chatItem(id: $id) { fromId toId channelId id createdAt updatedAt status }
}chatItems
वार्तालाप के सभी संदेश लें। id से पहले "channel:" या "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
सहेजे चैट संदेश पृष्ठों में खोजें।
query chatRecords($query: String!, $offset: Int!, $limit: Int!) {
chatRecords(query: $query, offset: $offset, limit: $limit) { fromId toId channelId id createdAt updatedAt status }
}messagesCreated
नए सहेजे चैट संदेश लें।
subscription messagesCreated {
messagesCreated { fromId toId channelId id createdAt updatedAt status }
}messagesUpdated
सहेजे चैट संदेशों के अपडेट लें।
subscription messagesUpdated {
messagesUpdated { fromId toId channelId id createdAt updatedAt status }
}messagesDeleted
चैट संदेश मिटाने की सूचना लें।
subscription messagesDeleted {
messagesDeleted
}