inbox/inbox.graphql

96 lines
1.9 KiB
GraphQL
Raw Normal View History

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
2023-11-16 14:58:14 +00:00
last_seen: Int!
2023-10-03 14:15:17 +00:00
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!
2023-11-16 15:16:51 +00:00
updateChat(chat_id: ChatInput!): ChatResult!
deleteChat(chat_id: String!): ChatResult!
2023-10-03 14:15:17 +00:00
2023-11-16 15:16:51 +00:00
createMessage(chat_id: String!, body: String!, reply_to: Int): ChatResult!
updateMessage(chat_id: String!, message_id: Int!, body: String!): ChatResult!
deleteMessage(chat_id: String!, message_id: Int!): ChatResult!
markAsRead(chat_id: String!, message_id: 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!
2023-11-16 14:58:14 +00:00
created_at: Int!
2023-10-06 10:01:47 +00:00
id: Int!
2023-11-16 15:16:51 +00:00
reply_to: Int
2023-11-16 14:58:14 +00:00
updated_at: Int
2023-10-06 10:01:47 +00:00
seen: Boolean
2023-10-03 14:15:17 +00:00
}
type Chat {
2023-10-06 10:01:47 +00:00
id: String!
2023-11-16 14:58:14 +00:00
created_at: Int!
created_by: Int!
updated_at: Int!
2023-10-06 10:01:47 +00:00
title: String
description: String
users: [Int]
members: [ChatMember]
admins: [Int]
messages: [Message]
unread: Int
private: Boolean
2023-10-03 14:15:17 +00:00
}