inbox/inbox.graphql

98 lines
1.9 KiB
GraphQL

scalar DateTime
type _Service {
sdl: String
}
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 ChatResult {
error: String
chat: Chat
chats: [Chat]
message: Message
messages: [Message]
members: [ChatMember]
}
type Mutation {
# inbox
createChat(title: String, members: [Int]!): ChatResult!
updateChat(chat: ChatInput!): ChatResult!
deleteChat(chatId: String!): ChatResult!
createMessage(chat: String!, body: String!, replyTo: Int): ChatResult!
updateMessage(chatId: String!, id: Int!, body: String!): ChatResult!
deleteMessage(chatId: String!, id: Int!): ChatResult!
markAsRead(chatId: String!, ids: [Int]!): ChatResult!
}
input MessagesBy {
author: String
body: String
chat: String
order: String
days: Int
stat: String
}
type Query {
# inbox
loadChats( limit: Int, offset: Int): ChatResult! # your chats
loadMessagesBy(by: MessagesBy!, limit: Int, offset: Int): ChatResult!
loadRecipients(limit: Int, offset: Int): ChatResult!
searchRecipients(query: String!, limit: Int, offset: Int): ChatResult!
searchMessages(by: MessagesBy!, limit: Int, offset: Int): ChatResult!
_service: _Service!
}
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
}