85 lines
1.6 KiB
GraphQL
85 lines
1.6 KiB
GraphQL
|
scalar DateTime
|
||
|
|
||
|
enum MessageStatus {
|
||
|
NEW
|
||
|
UPDATED
|
||
|
DELETED
|
||
|
}
|
||
|
|
||
|
type ChatMember {
|
||
|
id: Int!
|
||
|
slug: String!
|
||
|
name: String!
|
||
|
userpic: String
|
||
|
lastSeen: DateTime
|
||
|
online: Boolean
|
||
|
# invitedAt: DateTime
|
||
|
# invitedBy: String # user slug
|
||
|
# TODO: keep invite databit
|
||
|
}
|
||
|
|
||
|
input ChatInput {
|
||
|
id: String!
|
||
|
title: String
|
||
|
description: String
|
||
|
}
|
||
|
|
||
|
|
||
|
type Mutation {
|
||
|
# inbox
|
||
|
createChat(title: String, members: [Int]!): Result!
|
||
|
updateChat(chat: ChatInput!): Result!
|
||
|
deleteChat(chatId: String!): Result!
|
||
|
|
||
|
createMessage(chat: String!, body: String!, replyTo: Int): Result!
|
||
|
updateMessage(chatId: String!, id: Int!, body: String!): Result!
|
||
|
deleteMessage(chatId: String!, id: Int!): Result!
|
||
|
markAsRead(chatId: String!, ids: [Int]!): Result!
|
||
|
|
||
|
}
|
||
|
|
||
|
input MessagesBy {
|
||
|
author: String
|
||
|
body: String
|
||
|
chat: String
|
||
|
order: String
|
||
|
days: Int
|
||
|
stat: String
|
||
|
}
|
||
|
|
||
|
type Query {
|
||
|
# inbox
|
||
|
loadChats( limit: Int, offset: Int): Result! # your chats
|
||
|
loadMessagesBy(by: MessagesBy!, limit: Int, offset: Int): Result!
|
||
|
loadRecipients(limit: Int, offset: Int): Result!
|
||
|
searchRecipients(query: String!, limit: Int, offset: Int): Result!
|
||
|
searchMessages(by: MessagesBy!, limit: Int, offset: Int): Result!
|
||
|
|
||
|
}
|
||
|
|
||
|
type Message {
|
||
|
author: Int!
|
||
|
chatId: String!
|
||
|
body: String!
|
||
|
createdAt: Int!
|
||
|
id: Int!
|
||
|
replyTo: Int
|
||
|
updatedAt: Int
|
||
|
seen: Boolean
|
||
|
}
|
||
|
|
||
|
type Chat {
|
||
|
id: String!
|
||
|
createdAt: Int!
|
||
|
createdBy: Int!
|
||
|
updatedAt: Int!
|
||
|
title: String
|
||
|
description: String
|
||
|
users: [Int]
|
||
|
members: [ChatMember]
|
||
|
admins: [Int]
|
||
|
messages: [Message]
|
||
|
unread: Int
|
||
|
private: Boolean
|
||
|
}
|