wikijs-fork/server/graph/schemas/common.graphql

352 lines
5.1 KiB
GraphQL
Raw Normal View History

2017-08-07 01:05:10 +00:00
# ENUMS
enum UserRole {
guest
user
admin
}
enum FileType {
binary
image
}
enum RightRole {
read
write
manage
}
# INTERFACES
interface Base {
id: Int!
2017-08-13 18:39:07 +00:00
createdAt: Date
updatedAt: Date
2017-08-07 01:05:10 +00:00
}
# TYPES
type KeyValuePair {
key: String!
value: String!
}
input KeyValuePairInput {
key: String!
value: String!
}
type DefaultResponse {
operation: ResponseStatus
}
type ResponseStatus {
succeeded: Boolean!
code: Int!
slug: String!
message: String
}
2017-08-07 01:05:10 +00:00
type Comment implements Base {
id: Int!
2017-08-13 18:39:07 +00:00
createdAt: Date
updatedAt: Date
2017-08-07 01:05:10 +00:00
content: String
document: Document!
author: User!
}
type Document implements Base {
id: Int!
2017-08-13 18:39:07 +00:00
createdAt: Date
updatedAt: Date
2017-08-07 01:05:10 +00:00
path: String!
title: String!
subtitle: String
parentPath: String
parentTitle: String
isDirectory: Boolean!
isEntry: Boolean!
searchContent: String
comments: [Comment]
2017-08-07 01:05:10 +00:00
tags: [Tag]
}
type File implements Base {
id: Int!
2017-08-13 18:39:07 +00:00
createdAt: Date
updatedAt: Date
2017-08-07 01:05:10 +00:00
category: FileType!
mime: String!
extra: String
filename: String!
basename: String!
filesize: Int!
folder: Folder
}
type Folder implements Base {
id: Int!
2017-08-13 18:39:07 +00:00
createdAt: Date
updatedAt: Date
2017-08-07 01:05:10 +00:00
name: String!
files: [File]
2017-08-07 01:05:10 +00:00
}
type Group implements Base {
id: Int!
2017-08-13 18:39:07 +00:00
createdAt: Date
updatedAt: Date
2017-08-07 01:05:10 +00:00
name: String!
users: [User]
rights: [Right]
}
type Right implements Base {
id: Int!
2017-08-13 18:39:07 +00:00
createdAt: Date
updatedAt: Date
2017-08-07 01:05:10 +00:00
path: String!
role: RightRole!
exact: Boolean!
allow: Boolean!
group: Group!
2017-08-07 01:05:10 +00:00
}
2017-09-30 02:32:43 +00:00
type SearchResult {
path: String
title: String
tags: [String]
}
2017-08-07 01:05:10 +00:00
type Setting implements Base {
id: Int!
2017-08-13 18:39:07 +00:00
createdAt: Date
updatedAt: Date
2017-08-07 01:05:10 +00:00
key: String!
config: String!
}
# Tags are attached to one or more documents
2017-08-07 01:05:10 +00:00
type Tag implements Base {
id: Int!
2017-08-13 18:39:07 +00:00
createdAt: Date
updatedAt: Date
2017-08-19 01:21:29 +00:00
key: String!
documents: [Document]
2017-08-07 01:05:10 +00:00
}
type Translation {
key: String!
value: String!
}
# A User
2017-08-07 01:05:10 +00:00
type User implements Base {
id: Int!
2017-08-13 18:39:07 +00:00
createdAt: Date
updatedAt: Date
2017-08-07 01:05:10 +00:00
email: String!
provider: String!
2017-08-07 01:05:10 +00:00
providerId: String
name: String
role: UserRole!
groups: [Group]
}
2017-08-19 01:21:29 +00:00
type OperationResult {
2018-01-10 01:41:53 +00:00
succeeded: Boolean!
2017-08-19 01:21:29 +00:00
message: String
2018-01-10 01:41:53 +00:00
data: String
}
# Query (Read)
2017-08-07 01:05:10 +00:00
type Query {
comments(id: Int): [Comment]
documents(id: Int, path: String): [Document]
files(id: Int): [File]
folders(id: Int, name: String): [Folder]
groups(id: Int, name: String): [Group]
rights(id: Int): [Right]
2017-09-30 02:32:43 +00:00
search(q: String, tags: [String]): [SearchResult]
2017-08-07 01:05:10 +00:00
settings(key: String): [Setting]
tags(key: String): [Tag]
translations(locale: String!, namespace: String!): [Translation]
2017-08-07 01:05:10 +00:00
users(id: Int, email: String, provider: String, providerId: String, role: UserRole): [User]
}
# Mutations (Create, Update, Delete)
type Mutation {
addRightToGroup(
groupId: Int!
path: String!
role: RightRole!
exact: Boolean!
allow: Boolean!
): Right
assignTagToDocument(
tagId: Int!
documentId: Int!
2017-08-19 01:21:29 +00:00
): OperationResult
assignUserToGroup(
userId: Int!
groupId: Int!
2017-08-19 01:21:29 +00:00
): OperationResult
createComment(
userId: Int!
documentId: Int!
content: String!
): Comment
2017-08-19 01:21:29 +00:00
createDocument(
path: String!
title: String!
subtitle: String
): Document
createFolder(
name: String!
): Folder
2017-08-19 01:21:29 +00:00
createGroup(
name: String!
): Group
2017-08-19 01:21:29 +00:00
createTag(
name: String!
): Tag
2017-08-19 01:21:29 +00:00
createUser(
email: String!
name: String
2017-08-19 01:21:29 +00:00
passwordRaw: String
provider: String!
providerId: String
role: UserRole!
): User
2017-08-19 01:21:29 +00:00
deleteComment(
id: Int!
): OperationResult
2017-08-19 01:21:29 +00:00
deleteDocument(
id: Int!
): OperationResult
deleteFile(
id: Int!
): OperationResult
deleteFolder(
id: Int!
2017-08-19 01:21:29 +00:00
): OperationResult
deleteGroup(
id: Int!
2017-08-19 01:21:29 +00:00
): OperationResult
deleteTag(
id: Int!
2017-08-19 01:21:29 +00:00
): OperationResult
deleteUser(
id: Int!
2017-08-19 01:21:29 +00:00
): OperationResult
modifyComment(
id: Int!
content: String!
): Document
2017-08-19 01:21:29 +00:00
modifyDocument(
id: Int!
title: String
subtitle: String
): Document
modifyUser(
id: Int!
email: String
name: String
provider: String
providerId: String
role: UserRole
): User
modifyRight(
id: Int!
path: String
role: RightRole
exact: Boolean
allow: Boolean
): Right
2017-08-19 01:21:29 +00:00
moveDocument(
id: Int!
path: String!
): OperationResult
moveFile(
id: Int!
folderId: Int!
): OperationResult
renameFile(
id: Int!
name: String!
): OperationResult
2017-08-19 01:21:29 +00:00
renameFolder(
id: Int!
name: String!
): OperationResult
renameGroup(
id: Int!
name: String!
): OperationResult
renameTag(
id: Int!
key: String!
2017-08-19 01:21:29 +00:00
): OperationResult
removeTagFromDocument(
tagId: Int!
documentId: Int!
2017-08-19 01:21:29 +00:00
): OperationResult
removeRightFromGroup(
rightId: Int!
): OperationResult
removeUserFromGroup(
userId: Int!
groupId: Int!
2017-08-19 01:21:29 +00:00
): OperationResult
resetUserPassword(
id: Int!
): OperationResult
setConfigEntry(
key: String!
value: String!
): OperationResult
2017-08-19 01:21:29 +00:00
setUserPassword(
id: Int!
passwordRaw: String!
): OperationResult
uploadFile(
category: FileType!
filename: String!
): File
}