API குறிப்பு

Chat

உள்ளக அரட்டை செய்திகள், சேனல்கள் மற்றும் இணைக்கப்பட்ட peers-ஐ நிர்வகிக்கவும். அனைத்து GraphQL செயல்பாடுகளும் POST /graphql-க்கு அனுப்பப்படுகின்றன.

வகை வரையறைகள்

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

செயல்பாடுகள்

query

chatItems

ஒரு உரையாடலில் உள்ள அனைத்து செய்திகளையும் பெறுங்கள். id-ன் முன் "channel:" அல்லது "peer:"-ஐ சேர்க்கவும்.

bash
query GetChatItems($id: String!) {
  chatItems(id: $id) {
    id fromId toId channelId
    content createdAt updatedAt status statusData
  }
}
query

latestChatItems

ஒவ்வொரு உரையாடலின் (சேனல்கள் + peers) சமீபத்திய செய்தியைப் பெறுங்கள். உரையாடல் பட்டியல் முன்னோட்டத்தை உருவாக்க பயனுள்ளதாக இருக்கும்.

bash
query GetLatestChatItems {
  latestChatItems {
    id fromId toId channelId content createdAt updatedAt status
  }
}
query

chatChannels

சாதனம் சொந்தமான அல்லது சேர்ந்த அனைத்து அரட்டை சேனல்களையும் பட்டியலிடுங்கள்.

bash
query GetChatChannels {
  chatChannels {
    id name owner version status createdAt updatedAt
    members { id status }
  }
}
query

peers

இந்த சாதனத்துடன் இணைக்கப்பட்ட அனைத்து அறியப்பட்ட peers-ஐ பட்டியலிடுங்கள்.

bash
query GetPeers {
  peers { id name ip status port deviceType createdAt updatedAt }
}
mutation

deletePeer

இந்த சாதனத்திலிருந்து ஒரு peer பதிவை நீக்கவும். தொலைநிலை பக்கத்தில் அன்பேர் செய்யாது; சுத்தமான இருதரப்பு அன்பேருக்கு unpairPeer-ஐப் பயன்படுத்தவும்.

bash
mutation DeletePeer($id: ID!) {
  deletePeer(id: $id)
}
mutation

unpairPeer

ஒரு peer சாதனத்தை அன்பேர் செய்யவும். இந்த சாதனத்தில் பேரிங் நிலையை அழிக்கிறது மற்றும் அணுகக்கூடிய போது தொலைநிலை peer-க்கு சமிக்ஞை அனுப்புகிறது.

bash
mutation UnpairPeer($id: ID!) {
  unpairPeer(id: $id)
}
query

appFiles

அரட்டை வழியாக பகிரப்பட்ட கோப்புகளின் பக்கமிடப்பட்ட பட்டியல்.

bash
query GetAppFiles($offset: Int!, $limit: Int!) {
  appFiles(offset: $offset, limit: $limit) {
    id size mimeType realPath fileName createdAt updatedAt
  }
}
query

appFileCount

அரட்டை வழியாக பகிரப்பட்ட கோப்புகளின் மொத்த எண்ணிக்கை.

bash
query GetAppFileCount {
  appFileCount
}
mutation

sendChatItem

ஒரு சேனல் அல்லது peer-க்கு செய்தி அனுப்பவும். toId வடிவம்: "channel:<id>" அல்லது "peer:<id>".

bash
mutation SendChatItem($toId: String!, $content: String!) {
  sendChatItem(toId: $toId, content: $content) {
    id fromId toId channelId content createdAt updatedAt status
  }
}
mutation

deleteChatItem

ID மூலம் ஒரு அரட்டை செய்தியை நீக்கவும்.

bash
mutation DeleteChatItem($id: ID!) {
  deleteChatItem(id: $id)
}
mutation

deleteChatItems

ஒரு query-யுடன் பொருந்தும் அரட்டை செய்திகளை மொத்தமாக நீக்கவும் (உதா. "id:msg_x,id:msg_y").

bash
mutation DeleteChatItems($query: String!) {
  deleteChatItems(query: $query)
}
mutation

retryChatItem

தோல்வியடைந்த செய்தியை மீண்டும் அனுப்பவும்.

bash
mutation RetryChatItem($id: ID!) {
  retryChatItem(id: $id) { id status }
}
mutation

createChatChannel

இந்த சாதனம் சொந்தமான புதிய குறியாக்கப்பட்ட சேனலை உருவாக்கவும்.

bash
mutation CreateChatChannel($name: String!) {
  createChatChannel(name: $name) {
    id name owner version status createdAt
  }
}
mutation

updateChatChannel

ஒரு அரட்டை சேனலின் பெயரை மாற்றவும்.

bash
mutation UpdateChatChannel($id: ID!, $name: String!) {
  updateChatChannel(id: $id, name: $name) { id name version updatedAt }
}
mutation

deleteChatChannel

ஒரு சேனல் மற்றும் அதன் அனைத்து செய்திகளையும் நீக்கவும்.

bash
mutation DeleteChatChannel($id: ID!) {
  deleteChatChannel(id: $id)
}
mutation

leaveChatChannel

உங்களுக்கு சொந்தமில்லாத ஒரு சேனலை விட்டு வெளியேறவும்.

bash
mutation LeaveChatChannel($id: ID!) {
  leaveChatChannel(id: $id)
}
mutation

addChatChannelMember

உங்களுக்கு சொந்தமான சேனலில் ஒரு peer-ஐ அழைக்கவும்.

bash
mutation AddMember($id: ID!, $peerId: String!) {
  addChatChannelMember(id: $id, peerId: $peerId) {
    id members { id status }
  }
}
mutation

removeChatChannelMember

உங்களுக்கு சொந்தமான சேனலில் இருந்து ஒரு உறுப்பினரை அகற்றவும்.

bash
mutation RemoveMember($id: ID!, $peerId: String!) {
  removeChatChannelMember(id: $id, peerId: $peerId) {
    id members { id status }
  }
}
mutation

acceptChatChannelInvite

நீங்கள் அழைக்கப்பட்ட சேனலில் சேர அழைப்பை ஏற்கவும்.

bash
mutation AcceptChatChannelInvite($id: ID!) {
  acceptChatChannelInvite(id: $id)
}
mutation

declineChatChannelInvite

நிலுவையில் உள்ள சேனல் அழைப்பை நிராகரிக்கவும்.

bash
mutation DeclineChatChannelInvite($id: ID!) {
  declineChatChannelInvite(id: $id)
}