inbox/inbox.graphql

98 lines
1.9 KiB
GraphQL
Raw Normal View History

2023-10-03 14:15:17 +00:00
scalar DateTime
2023-10-06 03:28:52 +00:00
type _Service {
sdl: String
}
2023-10-03 14:15:17 +00:00
enum MessageStatus {
2023-10-06 10:01:47 +00:00
NEW
UPDATED
DELETED
2023-10-03 14:15:17 +00:00
}
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
}
2023-10-06 10:01:47 +00:00
type ChatResult {
2023-10-04 21:32:50 +00:00
error: String
chat: Chat
chats: [Chat]
message: Message
messages: [Message]
members: [ChatMember]
}
2023-10-03 14:15:17 +00:00
type Mutation {
2023-10-06 10:01:47 +00:00
# inbox
createChat(title: String, members: [Int]!): ChatResult!
updateChat(chat: ChatInput!): ChatResult!
deleteChat(chatId: String!): ChatResult!
2023-10-03 14:15:17 +00:00
2023-10-13 18:11:17 +00:00
createMessage(chat: String!, body: String!, replyTo: Int): ChatResult!
2023-10-06 10:01:47 +00:00
updateMessage(chatId: String!, id: Int!, body: String!): ChatResult!
deleteMessage(chatId: String!, id: Int!): ChatResult!
markAsRead(chatId: String!, ids: [Int]!): ChatResult!
2023-10-03 14:15:17 +00:00
}
input MessagesBy {
author: String
body: String
chat: String
order: String
days: Int
stat: String
}
type Query {
2023-10-06 03:38:04 +00:00
# inbox
2023-10-12 12:15:06 +00:00
loadChats(limit: Int, offset: Int): ChatResult! # your chats
2023-10-06 10:01:47 +00:00
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!
2023-10-06 03:38:04 +00:00
_service: _Service!
2023-10-03 14:15:17 +00:00
}
type Message {
2023-10-06 10:01:47 +00:00
author: Int!
chatId: String!
body: String!
createdAt: Int!
id: Int!
replyTo: Int
updatedAt: Int
seen: Boolean
2023-10-03 14:15:17 +00:00
}
type Chat {
2023-10-06 10:01:47 +00:00
id: String!
createdAt: Int!
createdBy: Int!
updatedAt: Int!
title: String
description: String
users: [Int]
members: [ChatMember]
admins: [Int]
messages: [Message]
unread: Int
private: Boolean
2023-10-03 14:15:17 +00:00
}