Commit fee26c58e22f9150e802b86202e5e5e9a6b2c233
1 parent
d5fcf0f6
Exists in
master
and in
4 other branches
Move snippets api doc to separate file
Showing
4 changed files
with
113 additions
and
102 deletions
Show diff stats
app/views/help/api.html.haml
... | ... | @@ -10,6 +10,8 @@ |
10 | 10 | %li |
11 | 11 | %a{href: "#projects"} Projects |
12 | 12 | %li |
13 | + %a{href: "#snippets"} Snippets | |
14 | + %li | |
13 | 15 | %a{href: "#users"} Users |
14 | 16 | %li |
15 | 17 | %a{href: "#issues"} Issues |
... | ... | @@ -34,6 +36,16 @@ |
34 | 36 | |
35 | 37 | %br |
36 | 38 | |
39 | +.file_holder#snippets | |
40 | + .file_title | |
41 | + %i.icon-file | |
42 | + Projects Snippets | |
43 | + .file_content.wiki | |
44 | + = preserve do | |
45 | + = markdown File.read(Rails.root.join("doc", "api", "snippets.md")) | |
46 | + | |
47 | +%br | |
48 | + | |
37 | 49 | .file_holder#users |
38 | 50 | .file_title |
39 | 51 | %i.icon-file | ... | ... |
doc/api/README.md
... | ... | @@ -27,4 +27,5 @@ The API uses JSON to serialize data. You don't need to specify `.json` at the en |
27 | 27 | |
28 | 28 | + [Users](https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/users.md) |
29 | 29 | + [Projects](https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/projects.md) |
30 | ++ [Snippets](https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/snippets.md) | |
30 | 31 | + [Issues](https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/issues.md) | ... | ... |
doc/api/projects.md
... | ... | @@ -204,108 +204,6 @@ Parameters: |
204 | 204 | ] |
205 | 205 | ``` |
206 | 206 | |
207 | -# Project Snippets | |
208 | - | |
209 | -## List snippets | |
210 | - | |
211 | -Not implemented. | |
212 | - | |
213 | -## Single snippet | |
214 | - | |
215 | -Get a project snippet. | |
216 | - | |
217 | -``` | |
218 | -GET /projects/:id/snippets/:snippet_id | |
219 | -``` | |
220 | - | |
221 | -Parameters: | |
222 | - | |
223 | -+ `id` (required) - The ID or code name of a project | |
224 | -+ `snippet_id` (required) - The ID of a project's snippet | |
225 | - | |
226 | -```json | |
227 | -{ | |
228 | - "id": 1, | |
229 | - "title": "test", | |
230 | - "file_name": "add.rb", | |
231 | - "author": { | |
232 | - "id": 1, | |
233 | - "email": "john@example.com", | |
234 | - "name": "John Smith", | |
235 | - "blocked": false, | |
236 | - "created_at": "2012-05-23T08:00:58Z" | |
237 | - }, | |
238 | - "expires_at": null, | |
239 | - "updated_at": "2012-06-28T10:52:04Z", | |
240 | - "created_at": "2012-06-28T10:52:04Z" | |
241 | -} | |
242 | -``` | |
243 | - | |
244 | -## Snippet content | |
245 | - | |
246 | -Get a raw project snippet. | |
247 | - | |
248 | -``` | |
249 | -GET /projects/:id/snippets/:snippet_id/raw | |
250 | -``` | |
251 | - | |
252 | -Parameters: | |
253 | - | |
254 | -+ `id` (required) - The ID or code name of a project | |
255 | -+ `snippet_id` (required) - The ID of a project's snippet | |
256 | - | |
257 | -## New snippet | |
258 | - | |
259 | -Create a new project snippet. | |
260 | - | |
261 | -``` | |
262 | -POST /projects/:id/snippets | |
263 | -``` | |
264 | - | |
265 | -Parameters: | |
266 | - | |
267 | -+ `id` (required) - The ID or code name of a project | |
268 | -+ `title` (required) - The title of a snippet | |
269 | -+ `file_name` (required) - The name of a snippet file | |
270 | -+ `lifetime` (optional) - The expiration date of a snippet | |
271 | -+ `code` (required) - The content of a snippet | |
272 | - | |
273 | -Will return created snippet with status `201 Created` on success, or `404 Not found` on fail. | |
274 | - | |
275 | -## Edit snippet | |
276 | - | |
277 | -Update an existing project snippet. | |
278 | - | |
279 | -``` | |
280 | -PUT /projects/:id/snippets/:snippet_id | |
281 | -``` | |
282 | - | |
283 | -Parameters: | |
284 | - | |
285 | -+ `id` (required) - The ID or code name of a project | |
286 | -+ `snippet_id` (required) - The ID of a project's snippet | |
287 | -+ `title` (optional) - The title of a snippet | |
288 | -+ `file_name` (optional) - The name of a snippet file | |
289 | -+ `lifetime` (optional) - The expiration date of a snippet | |
290 | -+ `code` (optional) - The content of a snippet | |
291 | - | |
292 | -Will return updated snippet with status `200 OK` on success, or `404 Not found` on fail. | |
293 | - | |
294 | -## Delete snippet | |
295 | - | |
296 | -Delete existing project snippet. | |
297 | - | |
298 | -``` | |
299 | -DELETE /projects/:id/snippets/:snippet_id | |
300 | -``` | |
301 | - | |
302 | -Parameters: | |
303 | - | |
304 | -+ `id` (required) - The ID or code name of a project | |
305 | -+ `snippet_id` (required) - The ID of a project's snippet | |
306 | - | |
307 | -Status code `200` will be returned on success. | |
308 | - | |
309 | 207 | ## Raw blob content |
310 | 208 | |
311 | 209 | Get the raw file contents for a file. | ... | ... |
... | ... | @@ -0,0 +1,100 @@ |
1 | +## List snippets | |
2 | + | |
3 | +Not implemented. | |
4 | + | |
5 | +## Single snippet | |
6 | + | |
7 | +Get a project snippet. | |
8 | + | |
9 | +``` | |
10 | +GET /projects/:id/snippets/:snippet_id | |
11 | +``` | |
12 | + | |
13 | +Parameters: | |
14 | + | |
15 | ++ `id` (required) - The ID or code name of a project | |
16 | ++ `snippet_id` (required) - The ID of a project's snippet | |
17 | + | |
18 | +```json | |
19 | +{ | |
20 | + "id": 1, | |
21 | + "title": "test", | |
22 | + "file_name": "add.rb", | |
23 | + "author": { | |
24 | + "id": 1, | |
25 | + "email": "john@example.com", | |
26 | + "name": "John Smith", | |
27 | + "blocked": false, | |
28 | + "created_at": "2012-05-23T08:00:58Z" | |
29 | + }, | |
30 | + "expires_at": null, | |
31 | + "updated_at": "2012-06-28T10:52:04Z", | |
32 | + "created_at": "2012-06-28T10:52:04Z" | |
33 | +} | |
34 | +``` | |
35 | + | |
36 | +## Snippet content | |
37 | + | |
38 | +Get a raw project snippet. | |
39 | + | |
40 | +``` | |
41 | +GET /projects/:id/snippets/:snippet_id/raw | |
42 | +``` | |
43 | + | |
44 | +Parameters: | |
45 | + | |
46 | ++ `id` (required) - The ID or code name of a project | |
47 | ++ `snippet_id` (required) - The ID of a project's snippet | |
48 | + | |
49 | +## New snippet | |
50 | + | |
51 | +Create a new project snippet. | |
52 | + | |
53 | +``` | |
54 | +POST /projects/:id/snippets | |
55 | +``` | |
56 | + | |
57 | +Parameters: | |
58 | + | |
59 | ++ `id` (required) - The ID or code name of a project | |
60 | ++ `title` (required) - The title of a snippet | |
61 | ++ `file_name` (required) - The name of a snippet file | |
62 | ++ `lifetime` (optional) - The expiration date of a snippet | |
63 | ++ `code` (required) - The content of a snippet | |
64 | + | |
65 | +Will return created snippet with status `201 Created` on success, or `404 Not found` on fail. | |
66 | + | |
67 | +## Edit snippet | |
68 | + | |
69 | +Update an existing project snippet. | |
70 | + | |
71 | +``` | |
72 | +PUT /projects/:id/snippets/:snippet_id | |
73 | +``` | |
74 | + | |
75 | +Parameters: | |
76 | + | |
77 | ++ `id` (required) - The ID or code name of a project | |
78 | ++ `snippet_id` (required) - The ID of a project's snippet | |
79 | ++ `title` (optional) - The title of a snippet | |
80 | ++ `file_name` (optional) - The name of a snippet file | |
81 | ++ `lifetime` (optional) - The expiration date of a snippet | |
82 | ++ `code` (optional) - The content of a snippet | |
83 | + | |
84 | +Will return updated snippet with status `200 OK` on success, or `404 Not found` on fail. | |
85 | + | |
86 | +## Delete snippet | |
87 | + | |
88 | +Delete existing project snippet. | |
89 | + | |
90 | +``` | |
91 | +DELETE /projects/:id/snippets/:snippet_id | |
92 | +``` | |
93 | + | |
94 | +Parameters: | |
95 | + | |
96 | ++ `id` (required) - The ID or code name of a project | |
97 | ++ `snippet_id` (required) - The ID of a project's snippet | |
98 | + | |
99 | +Status code `200` will be returned on success. | |
100 | + | ... | ... |