GraphQL Base Schema
Server State makes heavy use of an extensible GraphQL API.
While the complete schema depends on the extensions installed by the user, the following schema provides the base for every such schema. It can, thus, be trusted to exist during plugin/extension development.
Generated using
graphql-markdown
Query​
Field | Argument | Type | Description |
---|---|---|---|
serverState | ServerState! | The APIs for inspecting the server state. This is the core of the Server State ecosystem and what most plugins will interact with. | |
me | User | The currently authenticated user, if any | |
users | [User!]! | List of all users. Accessible for admins only. | |
userById | User | Get user details based on their user id. Accessible for admins only. | |
id | ID! | The user's ID | |
userByEmail | User | Get user details based on their email address. Accessible for admins only. | |
String! | The user's email address |
Mutation​
Field | Argument | Type | Description |
---|---|---|---|
login | LoginResponse! | A mutation to login using email and password and get a JWT token for authentication. | |
String! | |||
password | String! | ||
addUser | AddUserResponse! | Adds a new user. Accessible for admins only. | |
user | AddUserInput! | ||
removeUser | RemoveUserResponse! | Removes a user. Accessible for admins only. | |
id | ID! | The user's user id | |
editUser | EditUserResponse! | Edits an existing user. Specify the user you want to edit in the Accessible for admins only. | |
user | EditUserInput! |
Objects​
AddUserResponse​
The data returned by the addUser
mutation.
Field | Argument | Type | Description |
---|---|---|---|
user | User! | The newly created user. |
EditUserResponse​
The data returned by the editUser
mutation.
Field | Argument | Type | Description |
---|---|---|---|
user | User! | The newly saved user details. |
LoginResponse​
The data returned by the login
mutation.
Field | Argument | Type | Description |
---|---|---|---|
token | String! | A JWT token for authentication. Use the header | |
me | User! | Details about the authenticated user. |
RemoveUserResponse​
The data returned by the removeUser
mutation.
Field | Argument | Type | Description |
---|---|---|---|
success | Boolean! |
|
ServerState​
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
):
extend type ServerState {
ABCDEF: ABCDEF_State
}
type ABCDEF_State {
randomNumber: Int
}
Field | Argument | Type | Description |
---|---|---|---|
timestamp | String | The timestamp of the query's execution |
User​
An object representing a single user
Field | Argument | Type | Description |
---|---|---|---|
id | ID! | The user's unique ID | |
String! | The user's email address | ||
role | UserRole | The user's role within the system |
Inputs​
AddUserInput​
Input for the addUser
mutation
Field | Type | Description | |
---|---|---|---|
String! | The user's email address. | ||
password | String | The new user's password. If not specified, the new user won't be able to login until the password gets reset. | |
role | UserRole | The new user's role. Defaults to |
EditUserInput​
Input for the editUser
mutation
Field | Type | Description | |
---|---|---|---|
id | ID! | The (existing !) user id. | |
String | A new email address, if applicable. | ||
role | UserRole | A new user role, if applicable. |
Enums​
UserRole​
A user's role. This defines the user's privileges within the system.
Value | Description |
---|---|
admin | An admin user with additional privileges (like managing other user accounts and installing extensions) |
user | A "normal" user without any special privileges |
Scalars​
Boolean​
The Boolean
scalar type represents true
or false
.
ID​
The ID
scalar type represents a unique identifier, often used to refetch an
object or as key for a cache. The ID type appears in a JSON response as a
String; however, it is not intended to be human-readable. When expected as an
input type, any string (such as "4"
) or integer (such as 4
) input value will
be accepted as an ID.
JSON​
A JSONSerializable
value represented as its serialized JSON string.
String​
The String
scalar type represents textual data, represented as UTF-8 character
sequences. The String type is most often used by GraphQL to represent free-form
human-readable text.