-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbase-schema.graphql
More file actions
213 lines (177 loc) · 3.43 KB
/
base-schema.graphql
File metadata and controls
213 lines (177 loc) · 3.43 KB
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
type Query {
"""
The APIs for inspecting the server state.
This is the core of the Server State ecosystem and what most plugins will interact with.
"""
serverState: ServerState!
"""
The currently authenticated user, if any
"""
me: User
"""
List of all users.
**Accessible for admins only.**
"""
users: [User!]!
"""
Get user details based on their user id.
**Accessible for admins only.**
"""
userById("The user's ID" id: ID!): User
"""
Get user details based on their email address.
**Accessible for admins only.**
"""
userByEmail("The user's email address" email: String!): User
}
type Mutation {
"""
A mutation to login using email and password and get a JWT token for authentication.
"""
login(email: String!, password: String!): LoginResponse!
"""
Adds a new user.
**Accessible for admins only.**
"""
addUser(user: AddUserInput!): AddUserResponse!
"""
Removes a user.
**Accessible for admins only.**
"""
removeUser("The user's user id" id: ID!): RemoveUserResponse!
"""
Edits an existing user.
Specify the user you want to edit in the `userEdits` input's `id` field.
**Accessible for admins only.**
"""
editUser(user: EditUserInput!): EditUserResponse!
}
"""
The data returned by the `login` mutation.
"""
type LoginResponse {
"""
A JWT token for authentication.
Use the header `Authorization: Bearer [token]` in later API interactions.
"""
token: String!
"""
Details about the authenticated user.
"""
me: User!
}
"""
The data returned by the `addUser` mutation.
"""
type AddUserResponse {
"""
The newly created user.
"""
user: User!
}
"""
The data returned by the `removeUser` mutation.
"""
type RemoveUserResponse {
"""
`true` if deletion was successful, `false` otherwise.
"""
success: Boolean!
}
"""
The data returned by the `editUser` mutation.
"""
type EditUserResponse {
"""
The newly saved user details.
"""
user: User!
}
"""
A `JSONSerializable` value represented as its serialized JSON string.
"""
scalar JSON
"""
The ServerState type that represents every query about the server state.
Extensions may extend this type with a property identical to their own ID to add additional "query-able" parameters.
For example (with a plugin id of `ABCDEF`):
```graphql
extend type ServerState {
ABCDEF: ABCDEF_State
}
type ABCDEF_State {
randomNumber: Int
}
```
"""
type ServerState {
"""
The timestamp of the query's execution
"""
timestamp: String
}
"""
An object representing a single user
"""
type User {
"""
The user's unique ID
"""
id: ID!
"""
The user's email address
"""
email: String!
"""
The user's role within the system
"""
role: UserRole
}
"""
A user's role. This defines the user's privileges within the system.
"""
enum UserRole {
"""
An admin user with additional privileges (like managing other user accounts and installing extensions)
"""
admin
"""
A "normal" user without any special privileges
"""
user
}
"""
Input for the `addUser` mutation
"""
input AddUserInput {
"""
The user's email address.
"""
email: String!
"""
The new user's password.
If not specified, the new user won't be able to login until the password gets reset.
"""
password: String
"""
The new user's role. Defaults to `user`.
"""
role: UserRole
}
"""
Input for the `editUser` mutation
"""
input EditUserInput {
"""
The (existing !) user id.
"""
id: ID!
"""
A new email address, if applicable.
"""
email: String
"""
A new user role, if applicable.
"""
role: UserRole
}