Chat
स्थानीय चैट संदेशों, चैनलों और पेयर किए गए peers को प्रबंधित करें। सभी GraphQL ऑपरेशन POST /graphql पर भेजे जाते हैं।
प्रकार परिभाषाएँ
type ChatItem {
id: ID!
fromId: String! # "me" | peerId
toId: String! # peerId (direct) | "" (channel)
channelId: String! # "" for direct messages
content: String! # JSON-encoded message payload
createdAt: String! # ISO 8601
updatedAt: String!
status: String! # "sent" | "pending" | "failed"
statusData: String! # extra info on failure
}
type ChatChannel {
id: String!
name: String!
owner: String! # "me" | peerId
members: [ChatChannelMember!]!
version: Int!
status: String! # "active" | "left"
createdAt: String!
updatedAt: String!
}
type ChatChannelMember {
id: String!
status: String! # "active" | "pending"
}
type Peer {
id: String!
name: String!
ip: String!
status: String! # "online" | "offline"
port: Int!
deviceType: String! # "phone" | "tablet" | "pc"
createdAt: String!
updatedAt: String!
}
type AppFile {
id: ID!
size: Int! # bytes
mimeType: String!
realPath: String!
fileName: String!
createdAt: String!
updatedAt: String!
}ऑपरेशन
chatItems
एक वार्तालाप के सभी संदेश प्राप्त करें। id के आगे "channel:" या "peer:" जोड़ें।
query GetChatItems($id: String!) {
chatItems(id: $id) {
id fromId toId channelId
content createdAt updatedAt status statusData
}
}latestChatItems
हर वार्तालाप (चैनल + peers) का नवीनतम संदेश प्राप्त करें। वार्तालाप सूची पूर्वावलोकन बनाने के लिए उपयोगी।
query GetLatestChatItems {
latestChatItems {
id fromId toId channelId content createdAt updatedAt status
}
}chatChannels
डिवाइस के स्वामित्व वाले या जुड़े सभी चैट चैनलों को सूचीबद्ध करें।
query GetChatChannels {
chatChannels {
id name owner version status createdAt updatedAt
members { id status }
}
}peers
इस डिवाइस के साथ पेयर किए गए सभी ज्ञात peers को सूचीबद्ध करें।
query GetPeers {
peers { id name ip status port deviceType createdAt updatedAt }
}deletePeer
इस डिवाइस से एक peer रिकॉर्ड हटाएँ। रिमोट पक्ष पर अनपेयर नहीं करता; स्वच्छ द्विपक्षीय अनपेयर के लिए unpairPeer का उपयोग करें।
mutation DeletePeer($id: ID!) {
deletePeer(id: $id)
}unpairPeer
एक peer डिवाइस अनपेयर करें। इस डिवाइस पर पेयरिंग स्थिति साफ़ करता है और पहुँच योग्य होने पर रिमोट peer को सिग्नल करता है।
mutation UnpairPeer($id: ID!) {
unpairPeer(id: $id)
}appFiles
चैट के माध्यम से साझा की गई फ़ाइलों की पेजिनेटेड सूची।
query GetAppFiles($offset: Int!, $limit: Int!) {
appFiles(offset: $offset, limit: $limit) {
id size mimeType realPath fileName createdAt updatedAt
}
}appFileCount
चैट के माध्यम से साझा की गई फ़ाइलों की कुल संख्या।
query GetAppFileCount {
appFileCount
}sendChatItem
किसी चैनल या peer को संदेश भेजें। toId प्रारूप: "channel:<id>" या "peer:<id>"।
mutation SendChatItem($toId: String!, $content: String!) {
sendChatItem(toId: $toId, content: $content) {
id fromId toId channelId content createdAt updatedAt status
}
}deleteChatItem
ID द्वारा एक चैट संदेश हटाएँ।
mutation DeleteChatItem($id: ID!) {
deleteChatItem(id: $id)
}deleteChatItems
किसी query से मेल खाने वाले चैट संदेशों को थोक में हटाएँ (उदा. "id:msg_x,id:msg_y")।
mutation DeleteChatItems($query: String!) {
deleteChatItems(query: $query)
}retryChatItem
विफल संदेश को पुनः भेजें।
mutation RetryChatItem($id: ID!) {
retryChatItem(id: $id) { id status }
}createChatChannel
इस डिवाइस के स्वामित्व वाला एक नया एन्क्रिप्टेड चैनल बनाएँ।
mutation CreateChatChannel($name: String!) {
createChatChannel(name: $name) {
id name owner version status createdAt
}
}updateChatChannel
एक चैट चैनल का नाम बदलें।
mutation UpdateChatChannel($id: ID!, $name: String!) {
updateChatChannel(id: $id, name: $name) { id name version updatedAt }
}deleteChatChannel
एक चैनल और उसके सभी संदेश हटाएँ।
mutation DeleteChatChannel($id: ID!) {
deleteChatChannel(id: $id)
}leaveChatChannel
ऐसा चैनल छोड़ें जिसके आप स्वामी नहीं हैं।
mutation LeaveChatChannel($id: ID!) {
leaveChatChannel(id: $id)
}addChatChannelMember
अपने स्वामित्व वाले चैनल में एक peer को आमंत्रित करें।
mutation AddMember($id: ID!, $peerId: String!) {
addChatChannelMember(id: $id, peerId: $peerId) {
id members { id status }
}
}removeChatChannelMember
अपने स्वामित्व वाले चैनल से एक सदस्य हटाएँ।
mutation RemoveMember($id: ID!, $peerId: String!) {
removeChatChannelMember(id: $id, peerId: $peerId) {
id members { id status }
}
}acceptChatChannelInvite
आपको आमंत्रित किए गए चैनल में शामिल होने के निमंत्रण को स्वीकार करें।
mutation AcceptChatChannelInvite($id: ID!) {
acceptChatChannelInvite(id: $id)
}declineChatChannelInvite
एक लंबित चैनल निमंत्रण को अस्वीकार करें।
mutation DeclineChatChannelInvite($id: ID!) {
declineChatChannelInvite(id: $id)
}