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)
}