-
-
Notifications
You must be signed in to change notification settings - Fork 26
/
schema.graphql
165 lines (150 loc) · 3.16 KB
/
schema.graphql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
"""
The mutation object for authentication
"""
type AuthMutation {
"""
Login using a username and password. If via websocket this will authenticate the websocket connection.
"""
login(
captchaToken: String!
password: String!
updateContext: Boolean
username: String!
validity: Int
): Session!
"""
Login with a session token. If via websocket this will authenticate the websocket connection.
"""
loginWithToken(sessionToken: String!, updateContext: Boolean): Session!
"""
Logout the user with the given session token. This will invalidate the session token.
"""
logout(sessionToken: String): Boolean!
"""
If successful will return a new session for the account which just got created.
"""
register(
captchaToken: String!
email: String!
password: String!
updateContext: Boolean
username: String!
validity: Int
): Session!
}
type ChatMessage {
author: User
authorId: UUID!
channel: User!
channelId: UUID!
content: String!
createdAt: DateRFC3339!
id: UUID!
type: MessageType!
}
type ChatMutation {
sendMessage(channelId: UUID!, content: String!): ChatMessage!
}
scalar DateRFC3339
type DisplayNameStream {
displayName: String!
username: String!
}
type GlobalRole {
allowedPermissions: Int!
createdAt: DateRFC3339!
deniedPermissions: Int!
description: String!
id: UUID!
name: String!
rank: Int!
}
enum MessageType {
SYSTEM
USER
WELCOME
}
"""
The root mutation type which contains root level fields.
"""
type Mutation {
auth: AuthMutation!
chat: ChatMutation!
}
"""
The root query type which contains root level fields.
"""
type Query {
noop: Boolean!
userById(id: UUID!): User
userByUsername(username: String!): User
}
type Session {
"""
Created at
"""
createdAt: DateRFC3339!
"""
Expires at
"""
expiresAt: DateRFC3339!
"""
The session's id
"""
id: UUID!
"""
Last used at
"""
lastUsedAt: DateRFC3339!
"""
The session's token
"""
token: String!
user: User!
"""
The user who owns this session
"""
userId: UUID!
}
type Subscription {
chatMessages(channelId: UUID!): ChatMessage!
noop: Boolean!
userDisplayName(userId: UUID!): DisplayNameStream!
}
"""
A UUID is a unique 128-bit number, stored as 16 octets. UUIDs are parsed as
Strings within GraphQL. UUIDs are used to assign unique identifiers to
entities without requiring a central allocating authority.
# References
* [Wikipedia: Universally Unique Identifier](http://en.wikipedia.org/wiki/Universally_unique_identifier)
* [RFC4122: A Universally Unique IDentifier (UUID) URN Namespace](http://tools.ietf.org/html/rfc4122)
"""
scalar UUID @specifiedBy(url: "http://tools.ietf.org/html/rfc4122")
type User {
createdAt: DateRFC3339!
displayName: String!
email: String!
emailVerified: Boolean!
globalRoles: [GlobalRole!]!
id: UUID!
lastLoginAt: DateRFC3339!
permissions: Int!
streamKey: String!
username: String!
}
extend schema
@link(
url: "https://specs.apollo.dev/federation/v2.1"
import: [
"@key"
"@tag"
"@shareable"
"@inaccessible"
"@override"
"@external"
"@provides"
"@requires"
]
)
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT