Commit 8f3701eff005aeedcebff8ce02074f5056a369b3
1 parent
9b276f00
Exists in
spb-stable
and in
3 other branches
Move branches API docs to separate file
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
3 changed files
with
168 additions
and
167 deletions
Show diff stats
doc/api/README.md
| ... | ... | @@ -0,0 +1,167 @@ |
| 1 | +# Branches | |
| 2 | + | |
| 3 | +## List repository branches | |
| 4 | + | |
| 5 | +Get a list of repository branches from a project, sorted by name alphabetically. | |
| 6 | + | |
| 7 | +``` | |
| 8 | +GET /projects/:id/repository/branches | |
| 9 | +``` | |
| 10 | + | |
| 11 | +Parameters: | |
| 12 | + | |
| 13 | ++ `id` (required) - The ID of a project | |
| 14 | + | |
| 15 | +```json | |
| 16 | +[ | |
| 17 | + { | |
| 18 | + "name": "master", | |
| 19 | + "commit": { | |
| 20 | + "id": "7b5c3cc8be40ee161ae89a06bba6229da1032a0c", | |
| 21 | + "parents": [ | |
| 22 | + { | |
| 23 | + "id": "4ad91d3c1144c406e50c7b33bae684bd6837faf8" | |
| 24 | + } | |
| 25 | + ], | |
| 26 | + "tree": "46e82de44b1061621357f24c05515327f2795a95", | |
| 27 | + "message": "add projects API", | |
| 28 | + "author": { | |
| 29 | + "name": "John Smith", | |
| 30 | + "email": "john@example.com" | |
| 31 | + }, | |
| 32 | + "committer": { | |
| 33 | + "name": "John Smith", | |
| 34 | + "email": "john@example.com" | |
| 35 | + }, | |
| 36 | + "authored_date": "2012-06-27T05:51:39-07:00", | |
| 37 | + "committed_date": "2012-06-28T03:44:20-07:00" | |
| 38 | + }, | |
| 39 | + "protected": true | |
| 40 | + } | |
| 41 | +] | |
| 42 | +``` | |
| 43 | + | |
| 44 | + | |
| 45 | +## Get single repository branch | |
| 46 | + | |
| 47 | +Get a single project repository branch. | |
| 48 | + | |
| 49 | +``` | |
| 50 | +GET /projects/:id/repository/branches/:branch | |
| 51 | +``` | |
| 52 | + | |
| 53 | +Parameters: | |
| 54 | + | |
| 55 | ++ `id` (required) - The ID of a project | |
| 56 | ++ `branch` (required) - The name of the branch | |
| 57 | + | |
| 58 | +```json | |
| 59 | +{ | |
| 60 | + "name": "master", | |
| 61 | + "commit": { | |
| 62 | + "id": "7b5c3cc8be40ee161ae89a06bba6229da1032a0c", | |
| 63 | + "parents": [ | |
| 64 | + { | |
| 65 | + "id": "4ad91d3c1144c406e50c7b33bae684bd6837faf8" | |
| 66 | + } | |
| 67 | + ], | |
| 68 | + "tree": "46e82de44b1061621357f24c05515327f2795a95", | |
| 69 | + "message": "add projects API", | |
| 70 | + "author": { | |
| 71 | + "name": "John Smith", | |
| 72 | + "email": "john@example.com" | |
| 73 | + }, | |
| 74 | + "committer": { | |
| 75 | + "name": "John Smith", | |
| 76 | + "email": "john@example.com" | |
| 77 | + }, | |
| 78 | + "authored_date": "2012-06-27T05:51:39-07:00", | |
| 79 | + "committed_date": "2012-06-28T03:44:20-07:00" | |
| 80 | + }, | |
| 81 | + "protected": true | |
| 82 | +} | |
| 83 | +``` | |
| 84 | + | |
| 85 | + | |
| 86 | +## Protect repository branch | |
| 87 | + | |
| 88 | +Protects a single project repository branch. This is an idempotent function, protecting an already | |
| 89 | +protected repository branch still returns a `200 Ok` status code. | |
| 90 | + | |
| 91 | +``` | |
| 92 | +PUT /projects/:id/repository/branches/:branch/protect | |
| 93 | +``` | |
| 94 | + | |
| 95 | +Parameters: | |
| 96 | + | |
| 97 | ++ `id` (required) - The ID of a project | |
| 98 | ++ `branch` (required) - The name of the branch | |
| 99 | + | |
| 100 | +```json | |
| 101 | +{ | |
| 102 | + "name": "master", | |
| 103 | + "commit": { | |
| 104 | + "id": "7b5c3cc8be40ee161ae89a06bba6229da1032a0c", | |
| 105 | + "parents": [ | |
| 106 | + { | |
| 107 | + "id": "4ad91d3c1144c406e50c7b33bae684bd6837faf8" | |
| 108 | + } | |
| 109 | + ], | |
| 110 | + "tree": "46e82de44b1061621357f24c05515327f2795a95", | |
| 111 | + "message": "add projects API", | |
| 112 | + "author": { | |
| 113 | + "name": "John Smith", | |
| 114 | + "email": "john@example.com" | |
| 115 | + }, | |
| 116 | + "committer": { | |
| 117 | + "name": "John Smith", | |
| 118 | + "email": "john@example.com" | |
| 119 | + }, | |
| 120 | + "authored_date": "2012-06-27T05:51:39-07:00", | |
| 121 | + "committed_date": "2012-06-28T03:44:20-07:00" | |
| 122 | + }, | |
| 123 | + "protected": true | |
| 124 | +} | |
| 125 | +``` | |
| 126 | + | |
| 127 | + | |
| 128 | +## Unprotect repository branch | |
| 129 | + | |
| 130 | +Unprotects a single project repository branch. This is an idempotent function, unprotecting an already | |
| 131 | +unprotected repository branch still returns a `200 Ok` status code. | |
| 132 | + | |
| 133 | +``` | |
| 134 | +PUT /projects/:id/repository/branches/:branch/unprotect | |
| 135 | +``` | |
| 136 | + | |
| 137 | +Parameters: | |
| 138 | + | |
| 139 | ++ `id` (required) - The ID of a project | |
| 140 | ++ `branch` (required) - The name of the branch | |
| 141 | + | |
| 142 | +```json | |
| 143 | +{ | |
| 144 | + "name": "master", | |
| 145 | + "commit": { | |
| 146 | + "id": "7b5c3cc8be40ee161ae89a06bba6229da1032a0c", | |
| 147 | + "parents": [ | |
| 148 | + { | |
| 149 | + "id": "4ad91d3c1144c406e50c7b33bae684bd6837faf8" | |
| 150 | + } | |
| 151 | + ], | |
| 152 | + "tree": "46e82de44b1061621357f24c05515327f2795a95", | |
| 153 | + "message": "add projects API", | |
| 154 | + "author": { | |
| 155 | + "name": "John Smith", | |
| 156 | + "email": "john@example.com" | |
| 157 | + }, | |
| 158 | + "committer": { | |
| 159 | + "name": "John Smith", | |
| 160 | + "email": "john@example.com" | |
| 161 | + }, | |
| 162 | + "authored_date": "2012-06-27T05:51:39-07:00", | |
| 163 | + "committed_date": "2012-06-28T03:44:20-07:00" | |
| 164 | + }, | |
| 165 | + "protected": false | |
| 166 | +} | |
| 167 | +``` | ... | ... |
doc/api/repositories.md
| 1 | -## List repository branches | |
| 2 | - | |
| 3 | -Get a list of repository branches from a project, sorted by name alphabetically. | |
| 4 | - | |
| 5 | -``` | |
| 6 | -GET /projects/:id/repository/branches | |
| 7 | -``` | |
| 8 | - | |
| 9 | -Parameters: | |
| 10 | - | |
| 11 | -+ `id` (required) - The ID of a project | |
| 12 | - | |
| 13 | -```json | |
| 14 | -[ | |
| 15 | - { | |
| 16 | - "name": "master", | |
| 17 | - "commit": { | |
| 18 | - "id": "7b5c3cc8be40ee161ae89a06bba6229da1032a0c", | |
| 19 | - "parents": [ | |
| 20 | - { | |
| 21 | - "id": "4ad91d3c1144c406e50c7b33bae684bd6837faf8" | |
| 22 | - } | |
| 23 | - ], | |
| 24 | - "tree": "46e82de44b1061621357f24c05515327f2795a95", | |
| 25 | - "message": "add projects API", | |
| 26 | - "author": { | |
| 27 | - "name": "John Smith", | |
| 28 | - "email": "john@example.com" | |
| 29 | - }, | |
| 30 | - "committer": { | |
| 31 | - "name": "John Smith", | |
| 32 | - "email": "john@example.com" | |
| 33 | - }, | |
| 34 | - "authored_date": "2012-06-27T05:51:39-07:00", | |
| 35 | - "committed_date": "2012-06-28T03:44:20-07:00" | |
| 36 | - }, | |
| 37 | - "protected": true | |
| 38 | - } | |
| 39 | -] | |
| 40 | -``` | |
| 41 | - | |
| 42 | - | |
| 43 | -## Get single repository branch | |
| 44 | - | |
| 45 | -Get a single project repository branch. | |
| 46 | - | |
| 47 | -``` | |
| 48 | -GET /projects/:id/repository/branches/:branch | |
| 49 | -``` | |
| 50 | - | |
| 51 | -Parameters: | |
| 52 | - | |
| 53 | -+ `id` (required) - The ID of a project | |
| 54 | -+ `branch` (required) - The name of the branch | |
| 55 | - | |
| 56 | -```json | |
| 57 | -{ | |
| 58 | - "name": "master", | |
| 59 | - "commit": { | |
| 60 | - "id": "7b5c3cc8be40ee161ae89a06bba6229da1032a0c", | |
| 61 | - "parents": [ | |
| 62 | - { | |
| 63 | - "id": "4ad91d3c1144c406e50c7b33bae684bd6837faf8" | |
| 64 | - } | |
| 65 | - ], | |
| 66 | - "tree": "46e82de44b1061621357f24c05515327f2795a95", | |
| 67 | - "message": "add projects API", | |
| 68 | - "author": { | |
| 69 | - "name": "John Smith", | |
| 70 | - "email": "john@example.com" | |
| 71 | - }, | |
| 72 | - "committer": { | |
| 73 | - "name": "John Smith", | |
| 74 | - "email": "john@example.com" | |
| 75 | - }, | |
| 76 | - "authored_date": "2012-06-27T05:51:39-07:00", | |
| 77 | - "committed_date": "2012-06-28T03:44:20-07:00" | |
| 78 | - }, | |
| 79 | - "protected": true | |
| 80 | -} | |
| 81 | -``` | |
| 82 | - | |
| 83 | - | |
| 84 | -## Protect repository branch | |
| 85 | - | |
| 86 | -Protects a single project repository branch. This is an idempotent function, protecting an already | |
| 87 | -protected repository branch still returns a `200 Ok` status code. | |
| 88 | - | |
| 89 | -``` | |
| 90 | -PUT /projects/:id/repository/branches/:branch/protect | |
| 91 | -``` | |
| 92 | - | |
| 93 | -Parameters: | |
| 94 | - | |
| 95 | -+ `id` (required) - The ID of a project | |
| 96 | -+ `branch` (required) - The name of the branch | |
| 97 | - | |
| 98 | -```json | |
| 99 | -{ | |
| 100 | - "name": "master", | |
| 101 | - "commit": { | |
| 102 | - "id": "7b5c3cc8be40ee161ae89a06bba6229da1032a0c", | |
| 103 | - "parents": [ | |
| 104 | - { | |
| 105 | - "id": "4ad91d3c1144c406e50c7b33bae684bd6837faf8" | |
| 106 | - } | |
| 107 | - ], | |
| 108 | - "tree": "46e82de44b1061621357f24c05515327f2795a95", | |
| 109 | - "message": "add projects API", | |
| 110 | - "author": { | |
| 111 | - "name": "John Smith", | |
| 112 | - "email": "john@example.com" | |
| 113 | - }, | |
| 114 | - "committer": { | |
| 115 | - "name": "John Smith", | |
| 116 | - "email": "john@example.com" | |
| 117 | - }, | |
| 118 | - "authored_date": "2012-06-27T05:51:39-07:00", | |
| 119 | - "committed_date": "2012-06-28T03:44:20-07:00" | |
| 120 | - }, | |
| 121 | - "protected": true | |
| 122 | -} | |
| 123 | -``` | |
| 124 | - | |
| 125 | - | |
| 126 | -## Unprotect repository branch | |
| 127 | - | |
| 128 | -Unprotects a single project repository branch. This is an idempotent function, unprotecting an already | |
| 129 | -unprotected repository branch still returns a `200 Ok` status code. | |
| 130 | - | |
| 131 | -``` | |
| 132 | -PUT /projects/:id/repository/branches/:branch/unprotect | |
| 133 | -``` | |
| 134 | - | |
| 135 | -Parameters: | |
| 136 | - | |
| 137 | -+ `id` (required) - The ID of a project | |
| 138 | -+ `branch` (required) - The name of the branch | |
| 139 | - | |
| 140 | -```json | |
| 141 | -{ | |
| 142 | - "name": "master", | |
| 143 | - "commit": { | |
| 144 | - "id": "7b5c3cc8be40ee161ae89a06bba6229da1032a0c", | |
| 145 | - "parents": [ | |
| 146 | - { | |
| 147 | - "id": "4ad91d3c1144c406e50c7b33bae684bd6837faf8" | |
| 148 | - } | |
| 149 | - ], | |
| 150 | - "tree": "46e82de44b1061621357f24c05515327f2795a95", | |
| 151 | - "message": "add projects API", | |
| 152 | - "author": { | |
| 153 | - "name": "John Smith", | |
| 154 | - "email": "john@example.com" | |
| 155 | - }, | |
| 156 | - "committer": { | |
| 157 | - "name": "John Smith", | |
| 158 | - "email": "john@example.com" | |
| 159 | - }, | |
| 160 | - "authored_date": "2012-06-27T05:51:39-07:00", | |
| 161 | - "committed_date": "2012-06-28T03:44:20-07:00" | |
| 162 | - }, | |
| 163 | - "protected": false | |
| 164 | -} | |
| 165 | -``` | |
| 166 | - | |
| 167 | - | |
| 168 | 1 | ## List project repository tags |
| 169 | 2 | |
| 170 | 3 | Get a list of repository tags from a project, sorted by name in reverse alphabetical order. | ... | ... |