PlainApp
API குறிப்பு

அரட்டை

அம்ச ஆதரவிற்கு app.capabilities-ஐயும் அனுமதிக்கு app.access மற்றும் host அனுமதிகளையும் சரிபார்க்கவும். எடுத்துக்காட்டுகள் செயற்கை மதிப்புகளைப் பயன்படுத்துகின்றன; அழைப்பதற்கு முன் பாதைகள், ID-கள், உள்ளீடுகள் மற்றும் வடிப்பான்களை மாற்றவும்.

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

graphql
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

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

mutation

deleteChatItem

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

graphql
# 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)
}
mutation

deleteChatItems

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

graphql
mutation deleteChatItems($query: String!) {
  deleteChatItems(query: $query) { affectedCount }
}
mutation

editChatText

ஏற்கெனவே உள்ள அரட்டைச் செய்தியின் உரையைத் திருத்தி, திருத்த முடிவைத் தரவும்.

graphql
mutation editChatText($id: ID!, $text: String!) {
  editChatText(id: $id, text: $text) { changed }
}
mutation

forwardChatItems

அசல் உள்ளடக்கத்தை மாற்றமின்றி அனுப்பி, பிறகு ஒவ்வொரு இலக்குக்கும் விருப்பக் குறிப்பைத் தனி எளிய உரைச் செய்தியாக அனுப்புகிறது. திருப்பப்படும் ஒவ்வொரு உருப்படிக்கும் தனித்தனி விநியோக நிலை உள்ளது.

graphql
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 } } }
}
mutation

retryChatItem

செய்தியை மீண்டும் அனுப்ப முயலும். சேனல் செய்திகளுக்கு மட்டும் பெறுநர்களைக் குறிப்பிடலாம்.

graphql
mutation retryChatItem($id: ID!, $recipientIds: [ID!]) {
  retryChatItem(id: $id, recipientIds: $recipientIds) { fromId toId channelId id createdAt updatedAt status }
}
mutation

sendChatItems

peer:example-id அல்லது channel:example-id மூலம் ஒன்று அல்லது அதற்கு மேற்பட்ட இலக்குகளுக்குச் செய்தி அனுப்பவும்.

graphql
mutation sendChatItems($targets: [String!]!, $content: ChatContentInput!) {
  sendChatItems(targets: $targets, content: $content) { fromId toId channelId id createdAt updatedAt status }
}
mutation

sendFolderShare

கோப்புறைப் பகிர்வை உருவாக்கி அதன் பகிர்வு அட்டையைத் தேர்ந்தெடுத்த அரட்டை இலக்குகளுக்கு அனுப்பவும்.

graphql
mutation sendFolderShare($targets: [String!]!, $path: String!, $name: String!, $expiresAt: Instant) {
  sendFolderShare(targets: $targets, path: $path, name: $name, expiresAt: $expiresAt) { fromId toId channelId id createdAt updatedAt status }
}
mutation

sendShare

ஏற்கெனவே உள்ள பகிர்வின் அட்டையைத் தேர்ந்தெடுத்த அரட்டை இலக்குகளுக்கு அனுப்பவும்.

graphql
mutation sendShare($targets: [String!]!, $shareId: ID!) {
  sendShare(targets: $targets, shareId: $shareId) { fromId toId channelId id createdAt updatedAt status }
}
query

chatConversations

சமீபத்திய செய்திச் சுருக்கங்களுடன் அரட்டை உரையாடல்களைப் பட்டியலிடவும்.

graphql
query chatConversations {
  chatConversations { id }
}
query

chatCount

வினவலுக்குப் பொருந்தும் சேமிக்கப்பட்ட அரட்டைச் செய்திகளை எண்ணவும்.

graphql
query chatCount($query: String!) {
  chatCount(query: $query)
}
query

chatItem

ID மூலம் சேமிக்கப்பட்ட ஓர் அரட்டைச் செய்தியைப் படிக்கவும்; இல்லாவிட்டால் null தரவும்.

graphql
query chatItem($id: ID!) {
  chatItem(id: $id) { fromId toId channelId id createdAt updatedAt status }
}
query

chatItems

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

graphql
# 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 }
}
query

chatRecords

சேமிக்கப்பட்ட அரட்டைச் செய்திகளைப் பக்கங்களாகத் தேடவும்.

graphql
query chatRecords($query: String!, $offset: Int!, $limit: Int!) {
  chatRecords(query: $query, offset: $offset, limit: $limit) { fromId toId channelId id createdAt updatedAt status }
}
subscription

messagesCreated

புதிதாகச் சேமிக்கப்பட்ட அரட்டைச் செய்திகளைப் பெறவும்.

graphql
subscription messagesCreated {
  messagesCreated { fromId toId channelId id createdAt updatedAt status }
}
subscription

messagesUpdated

சேமிக்கப்பட்ட அரட்டைச் செய்திகளின் புதுப்பிப்புகளைப் பெறவும்.

graphql
subscription messagesUpdated {
  messagesUpdated { fromId toId channelId id createdAt updatedAt status }
}
subscription

messagesDeleted

அரட்டைச் செய்தி நீக்க அறிவிப்பைப் பெறவும்.

graphql
subscription messagesDeleted {
  messagesDeleted
}