|
@@ -5,25 +5,25 @@ class Docs_1 extends Widget
|
5
|
5
|
task_list = ->
|
6
|
6
|
ul ->
|
7
|
7
|
li ->
|
8
|
|
- a href: "#new", "/new"
|
|
8
|
+ a href: "#new", "/v1/new"
|
9
|
9
|
text " { content: string }"
|
10
|
10
|
li ->
|
11
|
|
- a href: "#get", "/get"
|
|
11
|
+ a href: "#get", "/v1/get"
|
12
|
12
|
text " { id: integer, content: string }"
|
13
|
13
|
li ->
|
14
|
|
- a href: "#do", "/do"
|
|
14
|
+ a href: "#do", "/v1/do"
|
15
|
15
|
text " { id: integer, content: string }"
|
16
|
16
|
li ->
|
17
|
|
- a href: "#undo", "/undo"
|
|
17
|
+ a href: "#undo", "/v1/undo"
|
18
|
18
|
text " { id: integer, content: string }"
|
19
|
19
|
li ->
|
20
|
|
- a href: "#delete", "/delete"
|
|
20
|
+ a href: "#delete", "/v1/delete"
|
21
|
21
|
text " { id: integer, content: string }"
|
22
|
22
|
li ->
|
23
|
|
- a href: "#list", "/list"
|
|
23
|
+ a href: "#list", "/v1/list"
|
24
|
24
|
text " { count: integer, done: boolean, page: integer, order: 'asc'/'desc' }"
|
25
|
25
|
li ->
|
26
|
|
- a href: "#random", "/random"
|
|
26
|
+ a href: "#random", "/v1/random"
|
27
|
27
|
text " { count: integer, done: boolean }"
|
28
|
28
|
|
29
|
29
|
style -> raw "h3 { font-family: monospace; }"
|
|
@@ -38,9 +38,9 @@ class Docs_1 extends Widget
|
38
|
38
|
a href: "#keys", "API Keys"
|
39
|
39
|
ul ->
|
40
|
40
|
li ->
|
41
|
|
- a href: "#new-key", "/key/new"
|
|
41
|
+ a href: "#new-key", "/v1/key/new"
|
42
|
42
|
li ->
|
43
|
|
- a href: "#delete-key", "/key/delete"
|
|
43
|
+ a href: "#delete-key", "/v1/key/delete"
|
44
|
44
|
text " { id: integer, key: string }"
|
45
|
45
|
|
46
|
46
|
a name: "auth"
|
|
@@ -70,15 +70,15 @@ class Docs_1 extends Widget
|
70
|
70
|
text "Version 1 of this API is extremely simple. POST "
|
71
|
71
|
code '{ "content": "this is a todo item" }'
|
72
|
72
|
text " with valid authorization to "
|
73
|
|
- code "/new"
|
|
73
|
+ code "/v1/new"
|
74
|
74
|
text " to add tasks. The next four endpoints ("
|
75
|
|
- code "/get"
|
|
75
|
+ code "/v1/get"
|
76
|
76
|
text ","
|
77
|
|
- code "/do"
|
|
77
|
+ code "/v1/do"
|
78
|
78
|
text ","
|
79
|
|
- code "/undo"
|
|
79
|
+ code "/v1/undo"
|
80
|
80
|
text ","
|
81
|
|
- code "/delete"
|
|
81
|
+ code "/v1/delete"
|
82
|
82
|
text ") all use the same input to complete their operations (an "
|
83
|
83
|
code "id"
|
84
|
84
|
text " integer or "
|
|
@@ -86,35 +86,61 @@ class Docs_1 extends Widget
|
86
|
86
|
text " boolean)."
|
87
|
87
|
|
88
|
88
|
p ->
|
89
|
|
- code "/list"
|
|
89
|
+ code "/v1/list"
|
90
|
90
|
text " and "
|
91
|
|
- code "/random"
|
|
91
|
+ code "/v1/random"
|
92
|
92
|
text " are a little more complex, and explained further below."
|
93
|
93
|
|
94
|
94
|
task_list!
|
95
|
95
|
|
96
|
96
|
a name: "new"
|
97
|
|
- h3 "/new"
|
|
97
|
+ h3 "/v1/new"
|
|
98
|
+
|
|
99
|
+ p ->
|
|
100
|
+ text "As stated above, just POST a "
|
|
101
|
+ code "content"
|
|
102
|
+ text " string with valid authorization and a task item will be returned. Here's an example item:"
|
|
103
|
+
|
|
104
|
+ blockquote ->
|
|
105
|
+ code '{ "id": 4, "user_id": 2, "content": "Get a new API key.", "done": false, "created_at": "", "updated_at": "" }'
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+ -- "id", types.serial primary_key: true}
|
|
109
|
+ -- {"user_id", types.foreign_key}
|
|
110
|
+ -- {"content", types.text}
|
|
111
|
+ -- {"done", types.boolean default: false}
|
|
112
|
+ --
|
|
113
|
+ -- {"created_at", types.time}
|
|
114
|
+ -- {"updated_at", types.time}
|
98
|
115
|
|
99
|
116
|
a name: "get"
|
|
117
|
+ h3 "/v1/get"
|
100
|
118
|
|
101
|
119
|
a name: "do"
|
|
120
|
+ h3 "/v1/do"
|
102
|
121
|
|
103
|
122
|
a name: "undo"
|
|
123
|
+ h3 "/v1/undo"
|
104
|
124
|
|
105
|
125
|
a name: "delete"
|
|
126
|
+ h3 "/v1/delete"
|
106
|
127
|
|
107
|
128
|
a name: "list"
|
|
129
|
+ h3 "/v1/list"
|
108
|
130
|
|
109
|
131
|
a name: "random"
|
|
132
|
+ h3 "/v1/random"
|
110
|
133
|
|
111
|
134
|
a name: "keys"
|
112
|
135
|
h2 "API Keys"
|
113
|
136
|
|
114
|
137
|
a name: "new-key"
|
|
138
|
+ h3 "/v1/key/new"
|
115
|
139
|
|
116
|
140
|
a name: "delete-key"
|
|
141
|
+ h3 "/v1/key/delete"
|
117
|
142
|
|
118
|
143
|
-- /list { count: #, done: bool, page: #, order: asc/desc } (if done not specified, returns all,
|
119
|
144
|
-- default count is 50, default page is 1, default order is latest first
|
|
145
|
+-- also returns page: #, pages: #, tasks: []
|
120
|
146
|
-- /random { count: #, done: bool } (both args optional, defaults count 1, done false)
|