채팅
기능 지원은 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
}