-
Notifications
You must be signed in to change notification settings - Fork 0
/
api-todo
85 lines (66 loc) · 2.56 KB
/
api-todo
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
POST /api/accounts/login
input: { username: string, password: string }
output: { status: number, response: string, token: string | null }
"Set-Cookie" -- token cookie { iat: number, exp: number, sub: string, roles: string[] }
POST /api/accounts/create
requires: admin
input: { username: string, password: string, roles?: { [key]: string } }
output: { status: number, response: string }
GET /api/accounts/roles
requires: admin
output: { status: number, response: string, roles: string[] }
GET /api/accounts/roles/:role
requires: admin
output: { status: number, response: string, users: string[] }
GET /api/accounts/users/roles/:username
requires: admin or current user
output: { status: number, response: number, roles: string[] }
PUT /api/accounts/users/roles/:username
requires: admin
input: { roles: string[] }
output: { status: number, response: string }
PATCH /api/accounts/users/roles/:username
requires: admin
input: { remove?: string[], add?: string[] }
output: { status: number, response: string }
PUT /api/accounts/users/password/:username
requires: admin or current user
input: { password: string }
output: { status: number, response: string }
DELETE /api/accounts/users/:username
requires: admin
input: none
output: { status: number, response: string }
GET /api/books/cover/:id
output: image
GET /api/books/metadata/:id
output: { status: number, response: string, id: string, title: string, size: number, metadata: { [key: string]: string } }
GET /api/books/thumbnail/:id
output: image
GET /api/books/download/:id
output: file
GET /api/books/view/:id
output: file
POST /api/books
requires: librarian
input: multipart-formdata:
title: string
book:
Content-Type: application/pdf
[[ binary pdf content ]]
output: { status: number, response: string, id: string | null }
PUT /api/books/metadata/:id
requires: librarian
input: { title?: string, metadata?: { key: string, value: string }[] | { [string]: string } }
output: { status: number, response: string }
PATCH /api/books/metadata/:id
requires: librarian
input: { title?: string, add?: { key: string, value: string }[] | { [string]: string }, remove?: string[] }
output: { status: number, response: string }
DELETE /api/books/:id
requires: librarian
output: { status: number, response: string }
GET /api/search/query/:query?count=num&page=num
output: { status: number, response: string, results: { id: string, title: string, size: number, metadata: { [key: string]: string } }[] }
GET /api/search/count/:query
output: { status: number, response: string, count: number }