##// END OF EJS Templates
release: updated API docs
marcink -
r4174:f7b5cdab default
parent child Browse files
Show More
@@ -1,434 +1,442 b''
1 1 .. _pull-request-methods-ref:
2 2
3 3 pull_request methods
4 4 ====================
5 5
6 6 close_pull_request
7 7 ------------------
8 8
9 9 .. py:function:: close_pull_request(apiuser, pullrequestid, repoid=<Optional:None>, userid=<Optional:<OptionalAttr:apiuser>>, message=<Optional:''>)
10 10
11 11 Close the pull request specified by `pullrequestid`.
12 12
13 13 :param apiuser: This is filled automatically from the |authtoken|.
14 14 :type apiuser: AuthUser
15 15 :param repoid: Repository name or repository ID to which the pull
16 16 request belongs.
17 17 :type repoid: str or int
18 18 :param pullrequestid: ID of the pull request to be closed.
19 19 :type pullrequestid: int
20 20 :param userid: Close the pull request as this user.
21 21 :type userid: Optional(str or int)
22 22 :param message: Optional message to close the Pull Request with. If not
23 23 specified it will be generated automatically.
24 24 :type message: Optional(str)
25 25
26 26 Example output:
27 27
28 28 .. code-block:: bash
29 29
30 30 "id": <id_given_in_input>,
31 31 "result": {
32 32 "pull_request_id": "<int>",
33 33 "close_status": "<str:status_lbl>,
34 34 "closed": "<bool>"
35 35 },
36 36 "error": null
37 37
38 38
39 39 comment_pull_request
40 40 --------------------
41 41
42 .. py:function:: comment_pull_request(apiuser, pullrequestid, repoid=<Optional:None>, message=<Optional:None>, commit_id=<Optional:None>, status=<Optional:None>, comment_type=<Optional:u'note'>, resolves_comment_id=<Optional:None>, userid=<Optional:<OptionalAttr:apiuser>>)
42 .. py:function:: comment_pull_request(apiuser, pullrequestid, repoid=<Optional:None>, message=<Optional:None>, commit_id=<Optional:None>, status=<Optional:None>, comment_type=<Optional:u'note'>, resolves_comment_id=<Optional:None>, extra_recipients=<Optional:[]>, userid=<Optional:<OptionalAttr:apiuser>>)
43 43
44 44 Comment on the pull request specified with the `pullrequestid`,
45 45 in the |repo| specified by the `repoid`, and optionally change the
46 46 review status.
47 47
48 48 :param apiuser: This is filled automatically from the |authtoken|.
49 49 :type apiuser: AuthUser
50 50 :param repoid: Optional repository name or repository ID.
51 51 :type repoid: str or int
52 52 :param pullrequestid: The pull request ID.
53 53 :type pullrequestid: int
54 54 :param commit_id: Specify the commit_id for which to set a comment. If
55 55 given commit_id is different than latest in the PR status
56 56 change won't be performed.
57 57 :type commit_id: str
58 58 :param message: The text content of the comment.
59 59 :type message: str
60 60 :param status: (**Optional**) Set the approval status of the pull
61 61 request. One of: 'not_reviewed', 'approved', 'rejected',
62 62 'under_review'
63 63 :type status: str
64 64 :param comment_type: Comment type, one of: 'note', 'todo'
65 65 :type comment_type: Optional(str), default: 'note'
66 :param resolves_comment_id: id of comment which this one will resolve
67 :type resolves_comment_id: Optional(int)
68 :param extra_recipients: list of user ids or usernames to add
69 notifications for this comment. Acts like a CC for notification
70 :type extra_recipients: Optional(list)
66 71 :param userid: Comment on the pull request as this user
67 72 :type userid: Optional(str or int)
68 73
69 74 Example output:
70 75
71 76 .. code-block:: bash
72 77
73 78 id : <id_given_in_input>
74 79 result : {
75 80 "pull_request_id": "<Integer>",
76 81 "comment_id": "<Integer>",
77 82 "status": {"given": <given_status>,
78 83 "was_changed": <bool status_was_actually_changed> },
79 84 },
80 85 error : null
81 86
82 87
83 88 create_pull_request
84 89 -------------------
85 90
86 91 .. py:function:: create_pull_request(apiuser, source_repo, target_repo, source_ref, target_ref, owner=<Optional:<OptionalAttr:apiuser>>, title=<Optional:''>, description=<Optional:''>, description_renderer=<Optional:''>, reviewers=<Optional:None>)
87 92
88 93 Creates a new pull request.
89 94
90 95 Accepts refs in the following formats:
91 96
92 97 * branch:<branch_name>:<sha>
93 98 * branch:<branch_name>
94 99 * bookmark:<bookmark_name>:<sha> (Mercurial only)
95 100 * bookmark:<bookmark_name> (Mercurial only)
96 101
97 102 :param apiuser: This is filled automatically from the |authtoken|.
98 103 :type apiuser: AuthUser
99 104 :param source_repo: Set the source repository name.
100 105 :type source_repo: str
101 106 :param target_repo: Set the target repository name.
102 107 :type target_repo: str
103 108 :param source_ref: Set the source ref name.
104 109 :type source_ref: str
105 110 :param target_ref: Set the target ref name.
106 111 :type target_ref: str
107 112 :param owner: user_id or username
108 113 :type owner: Optional(str)
109 114 :param title: Optionally Set the pull request title, it's generated otherwise
110 115 :type title: str
111 116 :param description: Set the pull request description.
112 117 :type description: Optional(str)
113 118 :type description_renderer: Optional(str)
114 119 :param description_renderer: Set pull request renderer for the description.
115 120 It should be 'rst', 'markdown' or 'plain'. If not give default
116 121 system renderer will be used
117 122 :param reviewers: Set the new pull request reviewers list.
118 123 Reviewer defined by review rules will be added automatically to the
119 124 defined list.
120 125 :type reviewers: Optional(list)
121 126 Accepts username strings or objects of the format:
122 127
123 128 [{'username': 'nick', 'reasons': ['original author'], 'mandatory': <bool>}]
124 129
125 130
126 131 get_pull_request
127 132 ----------------
128 133
129 .. py:function:: get_pull_request(apiuser, pullrequestid, repoid=<Optional:None>)
134 .. py:function:: get_pull_request(apiuser, pullrequestid, repoid=<Optional:None>, merge_state=<Optional:False>)
130 135
131 136 Get a pull request based on the given ID.
132 137
133 138 :param apiuser: This is filled automatically from the |authtoken|.
134 139 :type apiuser: AuthUser
135 140 :param repoid: Optional, repository name or repository ID from where
136 141 the pull request was opened.
137 142 :type repoid: str or int
138 143 :param pullrequestid: ID of the requested pull request.
139 144 :type pullrequestid: int
145 :param merge_state: Optional calculate merge state for each repository.
146 This could result in longer time to fetch the data
147 :type merge_state: bool
140 148
141 149 Example output:
142 150
143 151 .. code-block:: bash
144 152
145 153 "id": <id_given_in_input>,
146 154 "result":
147 155 {
148 156 "pull_request_id": "<pull_request_id>",
149 157 "url": "<url>",
150 158 "title": "<title>",
151 159 "description": "<description>",
152 160 "status" : "<status>",
153 161 "created_on": "<date_time_created>",
154 162 "updated_on": "<date_time_updated>",
155 163 "commit_ids": [
156 164 ...
157 165 "<commit_id>",
158 166 "<commit_id>",
159 167 ...
160 168 ],
161 169 "review_status": "<review_status>",
162 170 "mergeable": {
163 171 "status": "<bool>",
164 172 "message": "<message>",
165 173 },
166 174 "source": {
167 175 "clone_url": "<clone_url>",
168 176 "repository": "<repository_name>",
169 177 "reference":
170 178 {
171 179 "name": "<name>",
172 180 "type": "<type>",
173 181 "commit_id": "<commit_id>",
174 182 }
175 183 },
176 184 "target": {
177 185 "clone_url": "<clone_url>",
178 186 "repository": "<repository_name>",
179 187 "reference":
180 188 {
181 189 "name": "<name>",
182 190 "type": "<type>",
183 191 "commit_id": "<commit_id>",
184 192 }
185 193 },
186 194 "merge": {
187 195 "clone_url": "<clone_url>",
188 196 "reference":
189 197 {
190 198 "name": "<name>",
191 199 "type": "<type>",
192 200 "commit_id": "<commit_id>",
193 201 }
194 202 },
195 203 "author": <user_obj>,
196 204 "reviewers": [
197 205 ...
198 206 {
199 207 "user": "<user_obj>",
200 208 "review_status": "<review_status>",
201 209 }
202 210 ...
203 211 ]
204 212 },
205 213 "error": null
206 214
207 215
208 216 get_pull_request_comments
209 217 -------------------------
210 218
211 219 .. py:function:: get_pull_request_comments(apiuser, pullrequestid, repoid=<Optional:None>)
212 220
213 221 Get all comments of pull request specified with the `pullrequestid`
214 222
215 223 :param apiuser: This is filled automatically from the |authtoken|.
216 224 :type apiuser: AuthUser
217 225 :param repoid: Optional repository name or repository ID.
218 226 :type repoid: str or int
219 227 :param pullrequestid: The pull request ID.
220 228 :type pullrequestid: int
221 229
222 230 Example output:
223 231
224 232 .. code-block:: bash
225 233
226 234 id : <id_given_in_input>
227 235 result : [
228 236 {
229 237 "comment_author": {
230 238 "active": true,
231 239 "full_name_or_username": "Tom Gore",
232 240 "username": "admin"
233 241 },
234 242 "comment_created_on": "2017-01-02T18:43:45.533",
235 243 "comment_f_path": null,
236 244 "comment_id": 25,
237 245 "comment_lineno": null,
238 246 "comment_status": {
239 247 "status": "under_review",
240 248 "status_lbl": "Under Review"
241 249 },
242 250 "comment_text": "Example text",
243 251 "comment_type": null,
244 252 "pull_request_version": null
245 253 }
246 254 ],
247 255 error : null
248 256
249 257
250 258 get_pull_requests
251 259 -----------------
252 260
253 .. py:function:: get_pull_requests(apiuser, repoid, status=<Optional:'new'>, merge_state=<Optional:True>)
261 .. py:function:: get_pull_requests(apiuser, repoid, status=<Optional:'new'>, merge_state=<Optional:False>)
254 262
255 263 Get all pull requests from the repository specified in `repoid`.
256 264
257 265 :param apiuser: This is filled automatically from the |authtoken|.
258 266 :type apiuser: AuthUser
259 267 :param repoid: Optional repository name or repository ID.
260 268 :type repoid: str or int
261 269 :param status: Only return pull requests with the specified status.
262 270 Valid options are.
263 271 * ``new`` (default)
264 272 * ``open``
265 273 * ``closed``
266 274 :type status: str
267 275 :param merge_state: Optional calculate merge state for each repository.
268 276 This could result in longer time to fetch the data
269 277 :type merge_state: bool
270 278
271 279 Example output:
272 280
273 281 .. code-block:: bash
274 282
275 283 "id": <id_given_in_input>,
276 284 "result":
277 285 [
278 286 ...
279 287 {
280 288 "pull_request_id": "<pull_request_id>",
281 289 "url": "<url>",
282 290 "title" : "<title>",
283 291 "description": "<description>",
284 292 "status": "<status>",
285 293 "created_on": "<date_time_created>",
286 294 "updated_on": "<date_time_updated>",
287 295 "commit_ids": [
288 296 ...
289 297 "<commit_id>",
290 298 "<commit_id>",
291 299 ...
292 300 ],
293 301 "review_status": "<review_status>",
294 302 "mergeable": {
295 303 "status": "<bool>",
296 304 "message: "<message>",
297 305 },
298 306 "source": {
299 307 "clone_url": "<clone_url>",
300 308 "reference":
301 309 {
302 310 "name": "<name>",
303 311 "type": "<type>",
304 312 "commit_id": "<commit_id>",
305 313 }
306 314 },
307 315 "target": {
308 316 "clone_url": "<clone_url>",
309 317 "reference":
310 318 {
311 319 "name": "<name>",
312 320 "type": "<type>",
313 321 "commit_id": "<commit_id>",
314 322 }
315 323 },
316 324 "merge": {
317 325 "clone_url": "<clone_url>",
318 326 "reference":
319 327 {
320 328 "name": "<name>",
321 329 "type": "<type>",
322 330 "commit_id": "<commit_id>",
323 331 }
324 332 },
325 333 "author": <user_obj>,
326 334 "reviewers": [
327 335 ...
328 336 {
329 337 "user": "<user_obj>",
330 338 "review_status": "<review_status>",
331 339 }
332 340 ...
333 341 ]
334 342 }
335 343 ...
336 344 ],
337 345 "error": null
338 346
339 347
340 348 merge_pull_request
341 349 ------------------
342 350
343 351 .. py:function:: merge_pull_request(apiuser, pullrequestid, repoid=<Optional:None>, userid=<Optional:<OptionalAttr:apiuser>>)
344 352
345 353 Merge the pull request specified by `pullrequestid` into its target
346 354 repository.
347 355
348 356 :param apiuser: This is filled automatically from the |authtoken|.
349 357 :type apiuser: AuthUser
350 358 :param repoid: Optional, repository name or repository ID of the
351 359 target repository to which the |pr| is to be merged.
352 360 :type repoid: str or int
353 361 :param pullrequestid: ID of the pull request which shall be merged.
354 362 :type pullrequestid: int
355 363 :param userid: Merge the pull request as this user.
356 364 :type userid: Optional(str or int)
357 365
358 366 Example output:
359 367
360 368 .. code-block:: bash
361 369
362 370 "id": <id_given_in_input>,
363 371 "result": {
364 372 "executed": "<bool>",
365 373 "failure_reason": "<int>",
366 374 "merge_status_message": "<str>",
367 375 "merge_commit_id": "<merge_commit_id>",
368 376 "possible": "<bool>",
369 377 "merge_ref": {
370 378 "commit_id": "<commit_id>",
371 379 "type": "<type>",
372 380 "name": "<name>"
373 381 }
374 382 },
375 383 "error": null
376 384
377 385
378 386 update_pull_request
379 387 -------------------
380 388
381 389 .. py:function:: update_pull_request(apiuser, pullrequestid, repoid=<Optional:None>, title=<Optional:''>, description=<Optional:''>, description_renderer=<Optional:''>, reviewers=<Optional:None>, update_commits=<Optional:None>)
382 390
383 391 Updates a pull request.
384 392
385 393 :param apiuser: This is filled automatically from the |authtoken|.
386 394 :type apiuser: AuthUser
387 395 :param repoid: Optional repository name or repository ID.
388 396 :type repoid: str or int
389 397 :param pullrequestid: The pull request ID.
390 398 :type pullrequestid: int
391 399 :param title: Set the pull request title.
392 400 :type title: str
393 401 :param description: Update pull request description.
394 402 :type description: Optional(str)
395 403 :type description_renderer: Optional(str)
396 404 :param description_renderer: Update pull request renderer for the description.
397 405 It should be 'rst', 'markdown' or 'plain'
398 406 :param reviewers: Update pull request reviewers list with new value.
399 407 :type reviewers: Optional(list)
400 408 Accepts username strings or objects of the format:
401 409
402 410 [{'username': 'nick', 'reasons': ['original author'], 'mandatory': <bool>}]
403 411
404 412 :param update_commits: Trigger update of commits for this pull request
405 413 :type: update_commits: Optional(bool)
406 414
407 415 Example output:
408 416
409 417 .. code-block:: bash
410 418
411 419 id : <id_given_in_input>
412 420 result : {
413 421 "msg": "Updated pull request `63`",
414 422 "pull_request": <pull_request_object>,
415 423 "updated_reviewers": {
416 424 "added": [
417 425 "username"
418 426 ],
419 427 "removed": []
420 428 },
421 429 "updated_commits": {
422 430 "added": [
423 431 "<sha1_hash>"
424 432 ],
425 433 "common": [
426 434 "<sha1_hash>",
427 435 "<sha1_hash>",
428 436 ],
429 437 "removed": []
430 438 }
431 439 }
432 440 error : null
433 441
434 442
@@ -1,1133 +1,1138 b''
1 1 .. _repo-methods-ref:
2 2
3 3 repo methods
4 4 ============
5 5
6 6 add_field_to_repo
7 7 -----------------
8 8
9 9 .. py:function:: add_field_to_repo(apiuser, repoid, key, label=<Optional:''>, description=<Optional:''>)
10 10
11 11 Adds an extra field to a repository.
12 12
13 13 This command can only be run using an |authtoken| with at least
14 14 write permissions to the |repo|.
15 15
16 16 :param apiuser: This is filled automatically from the |authtoken|.
17 17 :type apiuser: AuthUser
18 18 :param repoid: Set the repository name or repository id.
19 19 :type repoid: str or int
20 20 :param key: Create a unique field key for this repository.
21 21 :type key: str
22 22 :param label:
23 23 :type label: Optional(str)
24 24 :param description:
25 25 :type description: Optional(str)
26 26
27 27
28 28 comment_commit
29 29 --------------
30 30
31 .. py:function:: comment_commit(apiuser, repoid, commit_id, message, status=<Optional:None>, comment_type=<Optional:u'note'>, resolves_comment_id=<Optional:None>, userid=<Optional:<OptionalAttr:apiuser>>)
31 .. py:function:: comment_commit(apiuser, repoid, commit_id, message, status=<Optional:None>, comment_type=<Optional:u'note'>, resolves_comment_id=<Optional:None>, extra_recipients=<Optional:[]>, userid=<Optional:<OptionalAttr:apiuser>>)
32 32
33 33 Set a commit comment, and optionally change the status of the commit.
34 34
35 35 :param apiuser: This is filled automatically from the |authtoken|.
36 36 :type apiuser: AuthUser
37 37 :param repoid: Set the repository name or repository ID.
38 38 :type repoid: str or int
39 39 :param commit_id: Specify the commit_id for which to set a comment.
40 40 :type commit_id: str
41 41 :param message: The comment text.
42 42 :type message: str
43 43 :param status: (**Optional**) status of commit, one of: 'not_reviewed',
44 44 'approved', 'rejected', 'under_review'
45 45 :type status: str
46 46 :param comment_type: Comment type, one of: 'note', 'todo'
47 47 :type comment_type: Optional(str), default: 'note'
48 :param resolves_comment_id: id of comment which this one will resolve
49 :type resolves_comment_id: Optional(int)
50 :param extra_recipients: list of user ids or usernames to add
51 notifications for this comment. Acts like a CC for notification
52 :type extra_recipients: Optional(list)
48 53 :param userid: Set the user name of the comment creator.
49 54 :type userid: Optional(str or int)
50 55
51 56 Example error output:
52 57
53 58 .. code-block:: bash
54 59
55 60 {
56 61 "id" : <id_given_in_input>,
57 62 "result" : {
58 63 "msg": "Commented on commit `<commit_id>` for repository `<repoid>`",
59 64 "status_change": null or <status>,
60 65 "success": true
61 66 },
62 67 "error" : null
63 68 }
64 69
65 70
66 71 create_repo
67 72 -----------
68 73
69 .. py:function:: create_repo(apiuser, repo_name, repo_type, owner=<Optional:<OptionalAttr:apiuser>>, description=<Optional:''>, private=<Optional:False>, clone_uri=<Optional:None>, push_uri=<Optional:None>, landing_rev=<Optional:'rev:tip'>, enable_statistics=<Optional:False>, enable_locking=<Optional:False>, enable_downloads=<Optional:False>, copy_permissions=<Optional:False>)
74 .. py:function:: create_repo(apiuser, repo_name, repo_type, owner=<Optional:<OptionalAttr:apiuser>>, description=<Optional:''>, private=<Optional:False>, clone_uri=<Optional:None>, push_uri=<Optional:None>, landing_rev=<Optional:None>, enable_statistics=<Optional:False>, enable_locking=<Optional:False>, enable_downloads=<Optional:False>, copy_permissions=<Optional:False>)
70 75
71 76 Creates a repository.
72 77
73 78 * If the repository name contains "/", repository will be created inside
74 79 a repository group or nested repository groups
75 80
76 81 For example "foo/bar/repo1" will create |repo| called "repo1" inside
77 82 group "foo/bar". You have to have permissions to access and write to
78 83 the last repository group ("bar" in this example)
79 84
80 85 This command can only be run using an |authtoken| with at least
81 86 permissions to create repositories, or write permissions to
82 87 parent repository groups.
83 88
84 89 :param apiuser: This is filled automatically from the |authtoken|.
85 90 :type apiuser: AuthUser
86 91 :param repo_name: Set the repository name.
87 92 :type repo_name: str
88 93 :param repo_type: Set the repository type; 'hg','git', or 'svn'.
89 94 :type repo_type: str
90 95 :param owner: user_id or username
91 96 :type owner: Optional(str)
92 97 :param description: Set the repository description.
93 98 :type description: Optional(str)
94 99 :param private: set repository as private
95 100 :type private: bool
96 101 :param clone_uri: set clone_uri
97 102 :type clone_uri: str
98 103 :param push_uri: set push_uri
99 104 :type push_uri: str
100 :param landing_rev: <rev_type>:<rev>
105 :param landing_rev: <rev_type>:<rev>, e.g branch:default, book:dev, rev:abcd
101 106 :type landing_rev: str
102 107 :param enable_locking:
103 108 :type enable_locking: bool
104 109 :param enable_downloads:
105 110 :type enable_downloads: bool
106 111 :param enable_statistics:
107 112 :type enable_statistics: bool
108 113 :param copy_permissions: Copy permission from group in which the
109 114 repository is being created.
110 115 :type copy_permissions: bool
111 116
112 117
113 118 Example output:
114 119
115 120 .. code-block:: bash
116 121
117 122 id : <id_given_in_input>
118 123 result: {
119 124 "msg": "Created new repository `<reponame>`",
120 125 "success": true,
121 126 "task": "<celery task id or None if done sync>"
122 127 }
123 128 error: null
124 129
125 130
126 131 Example error output:
127 132
128 133 .. code-block:: bash
129 134
130 135 id : <id_given_in_input>
131 136 result : null
132 137 error : {
133 138 'failed to create repository `<repo_name>`'
134 139 }
135 140
136 141
137 142 delete_repo
138 143 -----------
139 144
140 145 .. py:function:: delete_repo(apiuser, repoid, forks=<Optional:''>)
141 146
142 147 Deletes a repository.
143 148
144 149 * When the `forks` parameter is set it's possible to detach or delete
145 150 forks of deleted repository.
146 151
147 152 This command can only be run using an |authtoken| with admin
148 153 permissions on the |repo|.
149 154
150 155 :param apiuser: This is filled automatically from the |authtoken|.
151 156 :type apiuser: AuthUser
152 157 :param repoid: Set the repository name or repository ID.
153 158 :type repoid: str or int
154 159 :param forks: Set to `detach` or `delete` forks from the |repo|.
155 160 :type forks: Optional(str)
156 161
157 162 Example error output:
158 163
159 164 .. code-block:: bash
160 165
161 166 id : <id_given_in_input>
162 167 result: {
163 168 "msg": "Deleted repository `<reponame>`",
164 169 "success": true
165 170 }
166 171 error: null
167 172
168 173
169 174 fork_repo
170 175 ---------
171 176
172 .. py:function:: fork_repo(apiuser, repoid, fork_name, owner=<Optional:<OptionalAttr:apiuser>>, description=<Optional:''>, private=<Optional:False>, clone_uri=<Optional:None>, landing_rev=<Optional:'rev:tip'>, copy_permissions=<Optional:False>)
177 .. py:function:: fork_repo(apiuser, repoid, fork_name, owner=<Optional:<OptionalAttr:apiuser>>, description=<Optional:''>, private=<Optional:False>, clone_uri=<Optional:None>, landing_rev=<Optional:None>, copy_permissions=<Optional:False>)
173 178
174 179 Creates a fork of the specified |repo|.
175 180
176 181 * If the fork_name contains "/", fork will be created inside
177 182 a repository group or nested repository groups
178 183
179 184 For example "foo/bar/fork-repo" will create fork called "fork-repo"
180 185 inside group "foo/bar". You have to have permissions to access and
181 186 write to the last repository group ("bar" in this example)
182 187
183 188 This command can only be run using an |authtoken| with minimum
184 189 read permissions of the forked repo, create fork permissions for an user.
185 190
186 191 :param apiuser: This is filled automatically from the |authtoken|.
187 192 :type apiuser: AuthUser
188 193 :param repoid: Set repository name or repository ID.
189 194 :type repoid: str or int
190 195 :param fork_name: Set the fork name, including it's repository group membership.
191 196 :type fork_name: str
192 197 :param owner: Set the fork owner.
193 198 :type owner: str
194 199 :param description: Set the fork description.
195 200 :type description: str
196 201 :param copy_permissions: Copy permissions from parent |repo|. The
197 202 default is False.
198 203 :type copy_permissions: bool
199 204 :param private: Make the fork private. The default is False.
200 205 :type private: bool
201 :param landing_rev: Set the landing revision. The default is tip.
206 :param landing_rev: Set the landing revision. E.g branch:default, book:dev, rev:abcd
202 207
203 208 Example output:
204 209
205 210 .. code-block:: bash
206 211
207 212 id : <id_for_response>
208 213 api_key : "<api_key>"
209 214 args: {
210 215 "repoid" : "<reponame or repo_id>",
211 216 "fork_name": "<forkname>",
212 217 "owner": "<username or user_id = Optional(=apiuser)>",
213 218 "description": "<description>",
214 219 "copy_permissions": "<bool>",
215 220 "private": "<bool>",
216 221 "landing_rev": "<landing_rev>"
217 222 }
218 223
219 224 Example error output:
220 225
221 226 .. code-block:: bash
222 227
223 228 id : <id_given_in_input>
224 229 result: {
225 230 "msg": "Created fork of `<reponame>` as `<forkname>`",
226 231 "success": true,
227 232 "task": "<celery task id or None if done sync>"
228 233 }
229 234 error: null
230 235
231 236
232 237 get_repo
233 238 --------
234 239
235 240 .. py:function:: get_repo(apiuser, repoid, cache=<Optional:True>)
236 241
237 242 Gets an existing repository by its name or repository_id.
238 243
239 244 The members section so the output returns users groups or users
240 245 associated with that repository.
241 246
242 247 This command can only be run using an |authtoken| with admin rights,
243 248 or users with at least read rights to the |repo|.
244 249
245 250 :param apiuser: This is filled automatically from the |authtoken|.
246 251 :type apiuser: AuthUser
247 252 :param repoid: The repository name or repository id.
248 253 :type repoid: str or int
249 254 :param cache: use the cached value for last changeset
250 255 :type: cache: Optional(bool)
251 256
252 257 Example output:
253 258
254 259 .. code-block:: bash
255 260
256 261 {
257 262 "error": null,
258 263 "id": <repo_id>,
259 264 "result": {
260 265 "clone_uri": null,
261 266 "created_on": "timestamp",
262 267 "description": "repo description",
263 268 "enable_downloads": false,
264 269 "enable_locking": false,
265 270 "enable_statistics": false,
266 271 "followers": [
267 272 {
268 273 "active": true,
269 274 "admin": false,
270 275 "api_key": "****************************************",
271 276 "api_keys": [
272 277 "****************************************"
273 278 ],
274 279 "email": "user@example.com",
275 280 "emails": [
276 281 "user@example.com"
277 282 ],
278 283 "extern_name": "rhodecode",
279 284 "extern_type": "rhodecode",
280 285 "firstname": "username",
281 286 "ip_addresses": [],
282 287 "language": null,
283 288 "last_login": "2015-09-16T17:16:35.854",
284 289 "lastname": "surname",
285 290 "user_id": <user_id>,
286 291 "username": "name"
287 292 }
288 293 ],
289 294 "fork_of": "parent-repo",
290 295 "landing_rev": [
291 296 "rev",
292 297 "tip"
293 298 ],
294 299 "last_changeset": {
295 300 "author": "User <user@example.com>",
296 301 "branch": "default",
297 302 "date": "timestamp",
298 303 "message": "last commit message",
299 304 "parents": [
300 305 {
301 306 "raw_id": "commit-id"
302 307 }
303 308 ],
304 309 "raw_id": "commit-id",
305 310 "revision": <revision number>,
306 311 "short_id": "short id"
307 312 },
308 313 "lock_reason": null,
309 314 "locked_by": null,
310 315 "locked_date": null,
311 316 "owner": "owner-name",
312 317 "permissions": [
313 318 {
314 319 "name": "super-admin-name",
315 320 "origin": "super-admin",
316 321 "permission": "repository.admin",
317 322 "type": "user"
318 323 },
319 324 {
320 325 "name": "owner-name",
321 326 "origin": "owner",
322 327 "permission": "repository.admin",
323 328 "type": "user"
324 329 },
325 330 {
326 331 "name": "user-group-name",
327 332 "origin": "permission",
328 333 "permission": "repository.write",
329 334 "type": "user_group"
330 335 }
331 336 ],
332 337 "private": true,
333 338 "repo_id": 676,
334 339 "repo_name": "user-group/repo-name",
335 340 "repo_type": "hg"
336 341 }
337 342 }
338 343
339 344
340 345 get_repo_changeset
341 346 ------------------
342 347
343 348 .. py:function:: get_repo_changeset(apiuser, repoid, revision, details=<Optional:'basic'>)
344 349
345 350 Returns information about a changeset.
346 351
347 352 Additionally parameters define the amount of details returned by
348 353 this function.
349 354
350 355 This command can only be run using an |authtoken| with admin rights,
351 356 or users with at least read rights to the |repo|.
352 357
353 358 :param apiuser: This is filled automatically from the |authtoken|.
354 359 :type apiuser: AuthUser
355 360 :param repoid: The repository name or repository id
356 361 :type repoid: str or int
357 362 :param revision: revision for which listing should be done
358 363 :type revision: str
359 364 :param details: details can be 'basic|extended|full' full gives diff
360 365 info details like the diff itself, and number of changed files etc.
361 366 :type details: Optional(str)
362 367
363 368
364 369 get_repo_changesets
365 370 -------------------
366 371
367 372 .. py:function:: get_repo_changesets(apiuser, repoid, start_rev, limit, details=<Optional:'basic'>)
368 373
369 374 Returns a set of commits limited by the number starting
370 375 from the `start_rev` option.
371 376
372 377 Additional parameters define the amount of details returned by this
373 378 function.
374 379
375 380 This command can only be run using an |authtoken| with admin rights,
376 381 or users with at least read rights to |repos|.
377 382
378 383 :param apiuser: This is filled automatically from the |authtoken|.
379 384 :type apiuser: AuthUser
380 385 :param repoid: The repository name or repository ID.
381 386 :type repoid: str or int
382 387 :param start_rev: The starting revision from where to get changesets.
383 388 :type start_rev: str
384 389 :param limit: Limit the number of commits to this amount
385 390 :type limit: str or int
386 391 :param details: Set the level of detail returned. Valid option are:
387 392 ``basic``, ``extended`` and ``full``.
388 393 :type details: Optional(str)
389 394
390 395 .. note::
391 396
392 397 Setting the parameter `details` to the value ``full`` is extensive
393 398 and returns details like the diff itself, and the number
394 399 of changed files.
395 400
396 401
397 402 get_repo_comments
398 403 -----------------
399 404
400 405 .. py:function:: get_repo_comments(apiuser, repoid, commit_id=<Optional:None>, comment_type=<Optional:None>, userid=<Optional:None>)
401 406
402 407 Get all comments for a repository
403 408
404 409 :param apiuser: This is filled automatically from the |authtoken|.
405 410 :type apiuser: AuthUser
406 411 :param repoid: Set the repository name or repository ID.
407 412 :type repoid: str or int
408 413 :param commit_id: Optionally filter the comments by the commit_id
409 414 :type commit_id: Optional(str), default: None
410 415 :param comment_type: Optionally filter the comments by the comment_type
411 416 one of: 'note', 'todo'
412 417 :type comment_type: Optional(str), default: None
413 418 :param userid: Optionally filter the comments by the author of comment
414 419 :type userid: Optional(str or int), Default: None
415 420
416 421 Example error output:
417 422
418 423 .. code-block:: bash
419 424
420 425 {
421 426 "id" : <id_given_in_input>,
422 427 "result" : [
423 428 {
424 429 "comment_author": <USER_DETAILS>,
425 430 "comment_created_on": "2017-02-01T14:38:16.309",
426 431 "comment_f_path": "file.txt",
427 432 "comment_id": 282,
428 433 "comment_lineno": "n1",
429 434 "comment_resolved_by": null,
430 435 "comment_status": [],
431 436 "comment_text": "This file needs a header",
432 437 "comment_type": "todo"
433 438 }
434 439 ],
435 440 "error" : null
436 441 }
437 442
438 443
439 444 get_repo_file
440 445 -------------
441 446
442 447 .. py:function:: get_repo_file(apiuser, repoid, commit_id, file_path, max_file_bytes=<Optional:None>, details=<Optional:'basic'>, cache=<Optional:True>)
443 448
444 449 Returns a single file from repository at given revision.
445 450
446 451 This command can only be run using an |authtoken| with admin rights,
447 452 or users with at least read rights to |repos|.
448 453
449 454 :param apiuser: This is filled automatically from the |authtoken|.
450 455 :type apiuser: AuthUser
451 456 :param repoid: The repository name or repository ID.
452 457 :type repoid: str or int
453 458 :param commit_id: The revision for which listing should be done.
454 459 :type commit_id: str
455 460 :param file_path: The path from which to start displaying.
456 461 :type file_path: str
457 462 :param details: Returns different set of information about nodes.
458 463 The valid options are ``minimal`` ``basic`` and ``full``.
459 464 :type details: Optional(str)
460 465 :param max_file_bytes: Only return file content under this file size bytes
461 466 :type max_file_bytes: Optional(int)
462 467 :param cache: Use internal caches for fetching files. If disabled fetching
463 468 files is slower but more memory efficient
464 469 :type cache: Optional(bool)
465 470
466 471 Example output:
467 472
468 473 .. code-block:: bash
469 474
470 475 id : <id_given_in_input>
471 476 result: {
472 477 "binary": false,
473 478 "extension": "py",
474 479 "lines": 35,
475 480 "content": "....",
476 481 "md5": "76318336366b0f17ee249e11b0c99c41",
477 482 "mimetype": "text/x-python",
478 483 "name": "python.py",
479 484 "size": 817,
480 485 "type": "file",
481 486 }
482 487 error: null
483 488
484 489
485 490 get_repo_fts_tree
486 491 -----------------
487 492
488 493 .. py:function:: get_repo_fts_tree(apiuser, repoid, commit_id, root_path)
489 494
490 495 Returns a list of tree nodes for path at given revision. This api is built
491 496 strictly for usage in full text search building, and shouldn't be consumed
492 497
493 498 This command can only be run using an |authtoken| with admin rights,
494 499 or users with at least read rights to |repos|.
495 500
496 501
497 502 get_repo_nodes
498 503 --------------
499 504
500 505 .. py:function:: get_repo_nodes(apiuser, repoid, revision, root_path, ret_type=<Optional:'all'>, details=<Optional:'basic'>, max_file_bytes=<Optional:None>)
501 506
502 507 Returns a list of nodes and children in a flat list for a given
503 508 path at given revision.
504 509
505 510 It's possible to specify ret_type to show only `files` or `dirs`.
506 511
507 512 This command can only be run using an |authtoken| with admin rights,
508 513 or users with at least read rights to |repos|.
509 514
510 515 :param apiuser: This is filled automatically from the |authtoken|.
511 516 :type apiuser: AuthUser
512 517 :param repoid: The repository name or repository ID.
513 518 :type repoid: str or int
514 519 :param revision: The revision for which listing should be done.
515 520 :type revision: str
516 521 :param root_path: The path from which to start displaying.
517 522 :type root_path: str
518 523 :param ret_type: Set the return type. Valid options are
519 524 ``all`` (default), ``files`` and ``dirs``.
520 525 :type ret_type: Optional(str)
521 526 :param details: Returns extended information about nodes, such as
522 527 md5, binary, and or content.
523 528 The valid options are ``basic`` and ``full``.
524 529 :type details: Optional(str)
525 530 :param max_file_bytes: Only return file content under this file size bytes
526 531 :type details: Optional(int)
527 532
528 533 Example output:
529 534
530 535 .. code-block:: bash
531 536
532 537 id : <id_given_in_input>
533 538 result: [
534 539 {
535 540 "binary": false,
536 541 "content": "File line",
537 542 "extension": "md",
538 543 "lines": 2,
539 544 "md5": "059fa5d29b19c0657e384749480f6422",
540 545 "mimetype": "text/x-minidsrc",
541 546 "name": "file.md",
542 547 "size": 580,
543 548 "type": "file"
544 549 },
545 550 ...
546 551 ]
547 552 error: null
548 553
549 554
550 555 get_repo_refs
551 556 -------------
552 557
553 558 .. py:function:: get_repo_refs(apiuser, repoid)
554 559
555 560 Returns a dictionary of current references. It returns
556 561 bookmarks, branches, closed_branches, and tags for given repository
557 562
558 563 It's possible to specify ret_type to show only `files` or `dirs`.
559 564
560 565 This command can only be run using an |authtoken| with admin rights,
561 566 or users with at least read rights to |repos|.
562 567
563 568 :param apiuser: This is filled automatically from the |authtoken|.
564 569 :type apiuser: AuthUser
565 570 :param repoid: The repository name or repository ID.
566 571 :type repoid: str or int
567 572
568 573 Example output:
569 574
570 575 .. code-block:: bash
571 576
572 577 id : <id_given_in_input>
573 578 "result": {
574 579 "bookmarks": {
575 580 "dev": "5611d30200f4040ba2ab4f3d64e5b06408a02188",
576 581 "master": "367f590445081d8ec8c2ea0456e73ae1f1c3d6cf"
577 582 },
578 583 "branches": {
579 584 "default": "5611d30200f4040ba2ab4f3d64e5b06408a02188",
580 585 "stable": "367f590445081d8ec8c2ea0456e73ae1f1c3d6cf"
581 586 },
582 587 "branches_closed": {},
583 588 "tags": {
584 589 "tip": "5611d30200f4040ba2ab4f3d64e5b06408a02188",
585 590 "v4.4.0": "1232313f9e6adac5ce5399c2a891dc1e72b79022",
586 591 "v4.4.1": "cbb9f1d329ae5768379cdec55a62ebdd546c4e27",
587 592 "v4.4.2": "24ffe44a27fcd1c5b6936144e176b9f6dd2f3a17",
588 593 }
589 594 }
590 595 error: null
591 596
592 597
593 598 get_repo_settings
594 599 -----------------
595 600
596 601 .. py:function:: get_repo_settings(apiuser, repoid, key=<Optional:None>)
597 602
598 603 Returns all settings for a repository. If key is given it only returns the
599 604 setting identified by the key or null.
600 605
601 606 :param apiuser: This is filled automatically from the |authtoken|.
602 607 :type apiuser: AuthUser
603 608 :param repoid: The repository name or repository id.
604 609 :type repoid: str or int
605 610 :param key: Key of the setting to return.
606 611 :type: key: Optional(str)
607 612
608 613 Example output:
609 614
610 615 .. code-block:: bash
611 616
612 617 {
613 618 "error": null,
614 619 "id": 237,
615 620 "result": {
616 621 "extensions_largefiles": true,
617 622 "extensions_evolve": true,
618 623 "hooks_changegroup_push_logger": true,
619 624 "hooks_changegroup_repo_size": false,
620 625 "hooks_outgoing_pull_logger": true,
621 626 "phases_publish": "True",
622 627 "rhodecode_hg_use_rebase_for_merging": true,
623 628 "rhodecode_pr_merge_enabled": true,
624 629 "rhodecode_use_outdated_comments": true
625 630 }
626 631 }
627 632
628 633
629 634 get_repos
630 635 ---------
631 636
632 637 .. py:function:: get_repos(apiuser, root=<Optional:None>, traverse=<Optional:True>)
633 638
634 639 Lists all existing repositories.
635 640
636 641 This command can only be run using an |authtoken| with admin rights,
637 642 or users with at least read rights to |repos|.
638 643
639 644 :param apiuser: This is filled automatically from the |authtoken|.
640 645 :type apiuser: AuthUser
641 646 :param root: specify root repository group to fetch repositories.
642 647 filters the returned repositories to be members of given root group.
643 648 :type root: Optional(None)
644 649 :param traverse: traverse given root into subrepositories. With this flag
645 650 set to False, it will only return top-level repositories from `root`.
646 651 if root is empty it will return just top-level repositories.
647 652 :type traverse: Optional(True)
648 653
649 654
650 655 Example output:
651 656
652 657 .. code-block:: bash
653 658
654 659 id : <id_given_in_input>
655 660 result: [
656 661 {
657 662 "repo_id" : "<repo_id>",
658 663 "repo_name" : "<reponame>"
659 664 "repo_type" : "<repo_type>",
660 665 "clone_uri" : "<clone_uri>",
661 666 "private": : "<bool>",
662 667 "created_on" : "<datetimecreated>",
663 668 "description" : "<description>",
664 669 "landing_rev": "<landing_rev>",
665 670 "owner": "<repo_owner>",
666 671 "fork_of": "<name_of_fork_parent>",
667 672 "enable_downloads": "<bool>",
668 673 "enable_locking": "<bool>",
669 674 "enable_statistics": "<bool>",
670 675 },
671 676 ...
672 677 ]
673 678 error: null
674 679
675 680
676 681 grant_user_group_permission
677 682 ---------------------------
678 683
679 684 .. py:function:: grant_user_group_permission(apiuser, repoid, usergroupid, perm)
680 685
681 686 Grant permission for a user group on the specified repository,
682 687 or update existing permissions.
683 688
684 689 This command can only be run using an |authtoken| with admin
685 690 permissions on the |repo|.
686 691
687 692 :param apiuser: This is filled automatically from the |authtoken|.
688 693 :type apiuser: AuthUser
689 694 :param repoid: Set the repository name or repository ID.
690 695 :type repoid: str or int
691 696 :param usergroupid: Specify the ID of the user group.
692 697 :type usergroupid: str or int
693 698 :param perm: Set the user group permissions using the following
694 699 format: (repository.(none|read|write|admin))
695 700 :type perm: str
696 701
697 702 Example output:
698 703
699 704 .. code-block:: bash
700 705
701 706 id : <id_given_in_input>
702 707 result : {
703 708 "msg" : "Granted perm: `<perm>` for group: `<usersgroupname>` in repo: `<reponame>`",
704 709 "success": true
705 710
706 711 }
707 712 error : null
708 713
709 714 Example error output:
710 715
711 716 .. code-block:: bash
712 717
713 718 id : <id_given_in_input>
714 719 result : null
715 720 error : {
716 721 "failed to edit permission for user group: `<usergroup>` in repo `<repo>`'
717 722 }
718 723
719 724
720 725 grant_user_permission
721 726 ---------------------
722 727
723 728 .. py:function:: grant_user_permission(apiuser, repoid, userid, perm)
724 729
725 730 Grant permissions for the specified user on the given repository,
726 731 or update existing permissions if found.
727 732
728 733 This command can only be run using an |authtoken| with admin
729 734 permissions on the |repo|.
730 735
731 736 :param apiuser: This is filled automatically from the |authtoken|.
732 737 :type apiuser: AuthUser
733 738 :param repoid: Set the repository name or repository ID.
734 739 :type repoid: str or int
735 740 :param userid: Set the user name.
736 741 :type userid: str
737 742 :param perm: Set the user permissions, using the following format
738 743 ``(repository.(none|read|write|admin))``
739 744 :type perm: str
740 745
741 746 Example output:
742 747
743 748 .. code-block:: bash
744 749
745 750 id : <id_given_in_input>
746 751 result: {
747 752 "msg" : "Granted perm: `<perm>` for user: `<username>` in repo: `<reponame>`",
748 753 "success": true
749 754 }
750 755 error: null
751 756
752 757
753 758 invalidate_cache
754 759 ----------------
755 760
756 761 .. py:function:: invalidate_cache(apiuser, repoid, delete_keys=<Optional:False>)
757 762
758 763 Invalidates the cache for the specified repository.
759 764
760 765 This command can only be run using an |authtoken| with admin rights to
761 766 the specified repository.
762 767
763 768 This command takes the following options:
764 769
765 770 :param apiuser: This is filled automatically from |authtoken|.
766 771 :type apiuser: AuthUser
767 772 :param repoid: Sets the repository name or repository ID.
768 773 :type repoid: str or int
769 774 :param delete_keys: This deletes the invalidated keys instead of
770 775 just flagging them.
771 776 :type delete_keys: Optional(``True`` | ``False``)
772 777
773 778 Example output:
774 779
775 780 .. code-block:: bash
776 781
777 782 id : <id_given_in_input>
778 783 result : {
779 784 'msg': Cache for repository `<repository name>` was invalidated,
780 785 'repository': <repository name>
781 786 }
782 787 error : null
783 788
784 789 Example error output:
785 790
786 791 .. code-block:: bash
787 792
788 793 id : <id_given_in_input>
789 794 result : null
790 795 error : {
791 796 'Error occurred during cache invalidation action'
792 797 }
793 798
794 799
795 800 lock
796 801 ----
797 802
798 803 .. py:function:: lock(apiuser, repoid, locked=<Optional:None>, userid=<Optional:<OptionalAttr:apiuser>>)
799 804
800 805 Sets the lock state of the specified |repo| by the given user.
801 806 From more information, see :ref:`repo-locking`.
802 807
803 808 * If the ``userid`` option is not set, the repository is locked to the
804 809 user who called the method.
805 810 * If the ``locked`` parameter is not set, the current lock state of the
806 811 repository is displayed.
807 812
808 813 This command can only be run using an |authtoken| with admin rights to
809 814 the specified repository.
810 815
811 816 This command takes the following options:
812 817
813 818 :param apiuser: This is filled automatically from the |authtoken|.
814 819 :type apiuser: AuthUser
815 820 :param repoid: Sets the repository name or repository ID.
816 821 :type repoid: str or int
817 822 :param locked: Sets the lock state.
818 823 :type locked: Optional(``True`` | ``False``)
819 824 :param userid: Set the repository lock to this user.
820 825 :type userid: Optional(str or int)
821 826
822 827 Example error output:
823 828
824 829 .. code-block:: bash
825 830
826 831 id : <id_given_in_input>
827 832 result : {
828 833 'repo': '<reponame>',
829 834 'locked': <bool: lock state>,
830 835 'locked_since': <int: lock timestamp>,
831 836 'locked_by': <username of person who made the lock>,
832 837 'lock_reason': <str: reason for locking>,
833 838 'lock_state_changed': <bool: True if lock state has been changed in this request>,
834 839 'msg': 'Repo `<reponame>` locked by `<username>` on <timestamp>.'
835 840 or
836 841 'msg': 'Repo `<repository name>` not locked.'
837 842 or
838 843 'msg': 'User `<user name>` set lock state for repo `<repository name>` to `<new lock state>`'
839 844 }
840 845 error : null
841 846
842 847 Example error output:
843 848
844 849 .. code-block:: bash
845 850
846 851 id : <id_given_in_input>
847 852 result : null
848 853 error : {
849 854 'Error occurred locking repository `<reponame>`'
850 855 }
851 856
852 857
853 858 maintenance
854 859 -----------
855 860
856 861 .. py:function:: maintenance(apiuser, repoid)
857 862
858 863 Triggers a maintenance on the given repository.
859 864
860 865 This command can only be run using an |authtoken| with admin
861 866 rights to the specified repository. For more information,
862 867 see :ref:`config-token-ref`.
863 868
864 869 This command takes the following options:
865 870
866 871 :param apiuser: This is filled automatically from the |authtoken|.
867 872 :type apiuser: AuthUser
868 873 :param repoid: The repository name or repository ID.
869 874 :type repoid: str or int
870 875
871 876 Example output:
872 877
873 878 .. code-block:: bash
874 879
875 880 id : <id_given_in_input>
876 881 result : {
877 882 "msg": "executed maintenance command",
878 883 "executed_actions": [
879 884 <action_message>, <action_message2>...
880 885 ],
881 886 "repository": "<repository name>"
882 887 }
883 888 error : null
884 889
885 890 Example error output:
886 891
887 892 .. code-block:: bash
888 893
889 894 id : <id_given_in_input>
890 895 result : null
891 896 error : {
892 897 "Unable to execute maintenance on `<reponame>`"
893 898 }
894 899
895 900
896 901 pull
897 902 ----
898 903
899 904 .. py:function:: pull(apiuser, repoid, remote_uri=<Optional:None>)
900 905
901 906 Triggers a pull on the given repository from a remote location. You
902 907 can use this to keep remote repositories up-to-date.
903 908
904 909 This command can only be run using an |authtoken| with admin
905 910 rights to the specified repository. For more information,
906 911 see :ref:`config-token-ref`.
907 912
908 913 This command takes the following options:
909 914
910 915 :param apiuser: This is filled automatically from the |authtoken|.
911 916 :type apiuser: AuthUser
912 917 :param repoid: The repository name or repository ID.
913 918 :type repoid: str or int
914 919 :param remote_uri: Optional remote URI to pass in for pull
915 920 :type remote_uri: str
916 921
917 922 Example output:
918 923
919 924 .. code-block:: bash
920 925
921 926 id : <id_given_in_input>
922 927 result : {
923 928 "msg": "Pulled from url `<remote_url>` on repo `<repository name>`"
924 929 "repository": "<repository name>"
925 930 }
926 931 error : null
927 932
928 933 Example error output:
929 934
930 935 .. code-block:: bash
931 936
932 937 id : <id_given_in_input>
933 938 result : null
934 939 error : {
935 940 "Unable to push changes from `<remote_url>`"
936 941 }
937 942
938 943
939 944 remove_field_from_repo
940 945 ----------------------
941 946
942 947 .. py:function:: remove_field_from_repo(apiuser, repoid, key)
943 948
944 949 Removes an extra field from a repository.
945 950
946 951 This command can only be run using an |authtoken| with at least
947 952 write permissions to the |repo|.
948 953
949 954 :param apiuser: This is filled automatically from the |authtoken|.
950 955 :type apiuser: AuthUser
951 956 :param repoid: Set the repository name or repository ID.
952 957 :type repoid: str or int
953 958 :param key: Set the unique field key for this repository.
954 959 :type key: str
955 960
956 961
957 962 revoke_user_group_permission
958 963 ----------------------------
959 964
960 965 .. py:function:: revoke_user_group_permission(apiuser, repoid, usergroupid)
961 966
962 967 Revoke the permissions of a user group on a given repository.
963 968
964 969 This command can only be run using an |authtoken| with admin
965 970 permissions on the |repo|.
966 971
967 972 :param apiuser: This is filled automatically from the |authtoken|.
968 973 :type apiuser: AuthUser
969 974 :param repoid: Set the repository name or repository ID.
970 975 :type repoid: str or int
971 976 :param usergroupid: Specify the user group ID.
972 977 :type usergroupid: str or int
973 978
974 979 Example output:
975 980
976 981 .. code-block:: bash
977 982
978 983 id : <id_given_in_input>
979 984 result: {
980 985 "msg" : "Revoked perm for group: `<usersgroupname>` in repo: `<reponame>`",
981 986 "success": true
982 987 }
983 988 error: null
984 989
985 990
986 991 revoke_user_permission
987 992 ----------------------
988 993
989 994 .. py:function:: revoke_user_permission(apiuser, repoid, userid)
990 995
991 996 Revoke permission for a user on the specified repository.
992 997
993 998 This command can only be run using an |authtoken| with admin
994 999 permissions on the |repo|.
995 1000
996 1001 :param apiuser: This is filled automatically from the |authtoken|.
997 1002 :type apiuser: AuthUser
998 1003 :param repoid: Set the repository name or repository ID.
999 1004 :type repoid: str or int
1000 1005 :param userid: Set the user name of revoked user.
1001 1006 :type userid: str or int
1002 1007
1003 1008 Example error output:
1004 1009
1005 1010 .. code-block:: bash
1006 1011
1007 1012 id : <id_given_in_input>
1008 1013 result: {
1009 1014 "msg" : "Revoked perm for user: `<username>` in repo: `<reponame>`",
1010 1015 "success": true
1011 1016 }
1012 1017 error: null
1013 1018
1014 1019
1015 1020 set_repo_settings
1016 1021 -----------------
1017 1022
1018 1023 .. py:function:: set_repo_settings(apiuser, repoid, settings)
1019 1024
1020 1025 Update repository settings. Returns true on success.
1021 1026
1022 1027 :param apiuser: This is filled automatically from the |authtoken|.
1023 1028 :type apiuser: AuthUser
1024 1029 :param repoid: The repository name or repository id.
1025 1030 :type repoid: str or int
1026 1031 :param settings: The new settings for the repository.
1027 1032 :type: settings: dict
1028 1033
1029 1034 Example output:
1030 1035
1031 1036 .. code-block:: bash
1032 1037
1033 1038 {
1034 1039 "error": null,
1035 1040 "id": 237,
1036 1041 "result": true
1037 1042 }
1038 1043
1039 1044
1040 1045 strip
1041 1046 -----
1042 1047
1043 1048 .. py:function:: strip(apiuser, repoid, revision, branch)
1044 1049
1045 1050 Strips the given revision from the specified repository.
1046 1051
1047 1052 * This will remove the revision and all of its decendants.
1048 1053
1049 1054 This command can only be run using an |authtoken| with admin rights to
1050 1055 the specified repository.
1051 1056
1052 1057 This command takes the following options:
1053 1058
1054 1059 :param apiuser: This is filled automatically from the |authtoken|.
1055 1060 :type apiuser: AuthUser
1056 1061 :param repoid: The repository name or repository ID.
1057 1062 :type repoid: str or int
1058 1063 :param revision: The revision you wish to strip.
1059 1064 :type revision: str
1060 1065 :param branch: The branch from which to strip the revision.
1061 1066 :type branch: str
1062 1067
1063 1068 Example output:
1064 1069
1065 1070 .. code-block:: bash
1066 1071
1067 1072 id : <id_given_in_input>
1068 1073 result : {
1069 1074 "msg": "'Stripped commit <commit_hash> from repo `<repository name>`'"
1070 1075 "repository": "<repository name>"
1071 1076 }
1072 1077 error : null
1073 1078
1074 1079 Example error output:
1075 1080
1076 1081 .. code-block:: bash
1077 1082
1078 1083 id : <id_given_in_input>
1079 1084 result : null
1080 1085 error : {
1081 1086 "Unable to strip commit <commit_hash> from repo `<repository name>`"
1082 1087 }
1083 1088
1084 1089
1085 1090 update_repo
1086 1091 -----------
1087 1092
1088 .. py:function:: update_repo(apiuser, repoid, repo_name=<Optional:None>, owner=<Optional:<OptionalAttr:apiuser>>, description=<Optional:''>, private=<Optional:False>, clone_uri=<Optional:None>, push_uri=<Optional:None>, landing_rev=<Optional:'rev:tip'>, fork_of=<Optional:None>, enable_statistics=<Optional:False>, enable_locking=<Optional:False>, enable_downloads=<Optional:False>, fields=<Optional:''>)
1093 .. py:function:: update_repo(apiuser, repoid, repo_name=<Optional:None>, owner=<Optional:<OptionalAttr:apiuser>>, description=<Optional:''>, private=<Optional:False>, clone_uri=<Optional:None>, push_uri=<Optional:None>, landing_rev=<Optional:None>, fork_of=<Optional:None>, enable_statistics=<Optional:False>, enable_locking=<Optional:False>, enable_downloads=<Optional:False>, fields=<Optional:''>)
1089 1094
1090 1095 Updates a repository with the given information.
1091 1096
1092 1097 This command can only be run using an |authtoken| with at least
1093 1098 admin permissions to the |repo|.
1094 1099
1095 1100 * If the repository name contains "/", repository will be updated
1096 1101 accordingly with a repository group or nested repository groups
1097 1102
1098 1103 For example repoid=repo-test name="foo/bar/repo-test" will update |repo|
1099 1104 called "repo-test" and place it inside group "foo/bar".
1100 1105 You have to have permissions to access and write to the last repository
1101 1106 group ("bar" in this example)
1102 1107
1103 1108 :param apiuser: This is filled automatically from the |authtoken|.
1104 1109 :type apiuser: AuthUser
1105 1110 :param repoid: repository name or repository ID.
1106 1111 :type repoid: str or int
1107 1112 :param repo_name: Update the |repo| name, including the
1108 1113 repository group it's in.
1109 1114 :type repo_name: str
1110 1115 :param owner: Set the |repo| owner.
1111 1116 :type owner: str
1112 1117 :param fork_of: Set the |repo| as fork of another |repo|.
1113 1118 :type fork_of: str
1114 1119 :param description: Update the |repo| description.
1115 1120 :type description: str
1116 1121 :param private: Set the |repo| as private. (True | False)
1117 1122 :type private: bool
1118 1123 :param clone_uri: Update the |repo| clone URI.
1119 1124 :type clone_uri: str
1120 :param landing_rev: Set the |repo| landing revision. Default is ``rev:tip``.
1125 :param landing_rev: Set the |repo| landing revision. e.g branch:default, book:dev, rev:abcd
1121 1126 :type landing_rev: str
1122 1127 :param enable_statistics: Enable statistics on the |repo|, (True | False).
1123 1128 :type enable_statistics: bool
1124 1129 :param enable_locking: Enable |repo| locking.
1125 1130 :type enable_locking: bool
1126 1131 :param enable_downloads: Enable downloads from the |repo|, (True | False).
1127 1132 :type enable_downloads: bool
1128 1133 :param fields: Add extra fields to the |repo|. Use the following
1129 1134 example format: ``field_key=field_val,field_key2=fieldval2``.
1130 1135 Escape ', ' with \,
1131 1136 :type fields: str
1132 1137
1133 1138
@@ -1,35 +1,41 b''
1 1 .. _search-methods-ref:
2 2
3 3 search methods
4 4 ==============
5 5
6 6 search
7 7 ------
8 8
9 .. py:function:: search(apiuser, search_query, search_type, page_limit=<Optional:10>, page=<Optional:1>, search_sort=<Optional:'newfirst'>, repo_name=<Optional:None>, repo_group_name=<Optional:None>)
9 .. py:function:: search(apiuser, search_query, search_type, page_limit=<Optional:10>, page=<Optional:1>, search_sort=<Optional:'desc:date'>, repo_name=<Optional:None>, repo_group_name=<Optional:None>)
10 10
11 11 Fetch Full Text Search results using API.
12 12
13 13 :param apiuser: This is filled automatically from the |authtoken|.
14 14 :type apiuser: AuthUser
15 15 :param search_query: Search query.
16 16 :type search_query: str
17 17 :param search_type: Search type. The following are valid options:
18 18 * commit
19 19 * content
20 20 * path
21 21 :type search_type: str
22 22 :param page_limit: Page item limit, from 1 to 500. Default 10 items.
23 23 :type page_limit: Optional(int)
24 24 :param page: Page number. Default first page.
25 25 :type page: Optional(int)
26 :param search_sort: Search sort order. Default newfirst. The following are valid options:
27 * newfirst
28 * oldfirst
26 :param search_sort: Search sort order.Must start with asc: or desc: Default desc:date.
27 The following are valid options:
28 * asc|desc:message.raw
29 * asc|desc:date
30 * asc|desc:author.email.raw
31 * asc|desc:message.raw
32 * newfirst (old legacy equal to desc:date)
33 * oldfirst (old legacy equal to asc:date)
34
29 35 :type search_sort: Optional(str)
30 36 :param repo_name: Filter by one repo. Default is all.
31 37 :type repo_name: Optional(str)
32 38 :param repo_group_name: Filter by one repo group. Default is all.
33 39 :type repo_group_name: Optional(str)
34 40
35 41
@@ -1,37 +1,184 b''
1 1 .. _store-methods-ref:
2 2
3 3 store methods
4 4 =============
5 5
6 6 file_store_add (EE only)
7 7 ------------------------
8 8
9 .. py:function:: file_store_add(apiuser, filename, content)
9 .. py:function:: file_store_add(apiuser, filename, content, description=<Optional:''>)
10 10
11 11 Upload API for the file_store
12 12
13 13 Example usage from CLI::
14 14 rhodecode-api --instance-name=enterprise-1 upload_file "{"content": "$(cat image.jpg | base64)", "filename":"image.jpg"}"
15 15
16 16 This command takes the following options:
17 17
18 18 :param apiuser: This is filled automatically from the |authtoken|.
19 19 :type apiuser: AuthUser
20 20 :param filename: name of the file uploaded
21 21 :type filename: str
22 :param description: Optional description for added file
23 :type description: str
22 24 :param content: base64 encoded content of the uploaded file
23 25 :type content: str
24 26
25 27 Example output:
26 28
27 29 .. code-block:: bash
28 30
29 31 id : <id_given_in_input>
30 32 result: {
31 33 "access_path": "/_file_store/download/84d156f7-8323-4ad3-9fce-4a8e88e1deaf-0.jpg",
32 34 "access_path_fqn": "http://server.domain.com/_file_store/download/84d156f7-8323-4ad3-9fce-4a8e88e1deaf-0.jpg",
33 35 "store_fid": "84d156f7-8323-4ad3-9fce-4a8e88e1deaf-0.jpg"
34 36 }
35 37 error : null
36 38
37 39
40 file_store_add_with_acl (EE only)
41 ---------------------------------
42
43 .. py:function:: file_store_add_with_acl(apiuser, filename, content, description=<Optional:''>, scope_user_id=<Optional:None>, scope_repo_id=<Optional:None>, scope_repo_group_id=<Optional:None>)
44
45 Upload API for the file_store
46
47 Example usage from CLI::
48 rhodecode-api --instance-name=enterprise-1 upload_file "{"content": "$(cat image.jpg | base64)", "filename":"image.jpg", "scope_repo_id":101}"
49
50 This command takes the following options:
51
52 :param apiuser: This is filled automatically from the |authtoken|.
53 :type apiuser: AuthUser
54 :param filename: name of the file uploaded
55 :type filename: str
56 :param description: Optional description for added file
57 :type description: str
58 :param content: base64 encoded content of the uploaded file
59 :type content: str
60
61 :param scope_user_id: Optionally bind this file to user.
62 This will check ACL in such way only this user can access the file.
63 :type scope_user_id: int
64 :param scope_repo_id: Optionally bind this file to repository.
65 This will check ACL in such way only user with proper access to such
66 repository can access the file.
67 :type scope_repo_id: int
68 :param scope_repo_group_id: Optionally bind this file to repository group.
69 This will check ACL in such way only user with proper access to such
70 repository group can access the file.
71 :type scope_repo_group_id: int
72
73 Example output:
74
75 .. code-block:: bash
76
77 id : <id_given_in_input>
78 result: {
79 "access_path": "/_file_store/download/84d156f7-8323-4ad3-9fce-4a8e88e1deaf-0.jpg",
80 "access_path_fqn": "http://server.domain.com/_file_store/download/84d156f7-8323-4ad3-9fce-4a8e88e1deaf-0.jpg",
81 "store_fid": "84d156f7-8323-4ad3-9fce-4a8e88e1deaf-0.jpg"
82 }
83 error : null
84
85
86 file_store_get_info (EE only)
87 -----------------------------
88
89 .. py:function:: file_store_get_info(apiuser, store_fid)
90
91 Get artifact data.
92
93 Example output:
94
95 .. code-block:: bash
96
97 id : <id_given_in_input>
98 result: {
99 "artifact": {
100 "access_path_fqn": "https://rhodecode.example.com/_file_store/download/0-031c2aa0-0d56-49a7-9ba3-b570bdd342ab.jpg",
101 "created_on": "2019-10-15T16:25:35.491",
102 "description": "my upload",
103 "downloaded_times": 1,
104 "file_uid": "0-031c2aa0-0d56-49a7-9ba3-b570bdd342ab.jpg",
105 "filename": "example.jpg",
106 "filename_org": "0-031c2aa0-0d56-49a7-9ba3-b570bdd342ab.jpg",
107 "hidden": false,
108 "metadata": [
109 {
110 "artifact": "0-031c2aa0-0d56-49a7-9ba3-b570bdd342ab.jpg",
111 "key": "yellow",
112 "section": "tags",
113 "value": "bar"
114 }
115 ],
116 "sha256": "818dff0f44574dfb6814d38e6bf3c60c5943d1d13653398ecddaedf2f6a5b04d",
117 "size": 18599,
118 "uploaded_by": {
119 "email": "admin@rhodecode.com",
120 "emails": [
121 "admin@rhodecode.com"
122 ],
123 "firstname": "Admin",
124 "lastname": "LastName",
125 "user_id": 2,
126 "username": "admin"
127 }
128 }
129 }
130 error : null
131
132
133 file_store_add_metadata (EE only)
134 ---------------------------------
135
136 .. py:function:: file_store_add_metadata(apiuser, store_fid, section, key, value, value_type=<Optional:'unicode'>)
137
138 Add metadata into artifact. The metadata consist of section, key, value. eg.
139 section='tags', 'key'='tag_name', value='1'
140
141 :param apiuser: This is filled automatically from the |authtoken|.
142 :type apiuser: AuthUser
143
144 :param store_fid: file uid, e.g 0-d054cb71-91ab-44e2-9e4b-23fe14b4d74a.mp4
145 :type store_fid: str
146
147 :param section: Section name to add metadata
148 :type section: str
149
150 :param key: Key to add as metadata
151 :type key: str
152
153 :param value: Value to add as metadata
154 :type value: str
155
156 :param value_type: Optional type, default is 'unicode' other types are:
157 int, list, bool, unicode, str
158
159 :type value_type: str
160
161 Example output:
162
163 .. code-block:: bash
164
165 id : <id_given_in_input>
166 result: {
167 "metadata": [
168 {
169 "artifact": "0-d054cb71-91ab-44e2-9e4b-23fe14b4d74a.mp4",
170 "key": "secret",
171 "section": "tags",
172 "value": "1"
173 },
174 {
175 "artifact": "0-d054cb71-91ab-44e2-9e4b-23fe14b4d74a.mp4",
176 "key": "video",
177 "section": "tags",
178 "value": "1"
179 }
180 ]
181 }
182 error : null
183
184
@@ -1,418 +1,422 b''
1 1 .. _user-group-methods-ref:
2 2
3 3 user_group methods
4 4 ==================
5 5
6 6 add_user_to_user_group
7 7 ----------------------
8 8
9 9 .. py:function:: add_user_to_user_group(apiuser, usergroupid, userid)
10 10
11 11 Adds a user to a `user group`. If the user already exists in the group
12 12 this command will return false.
13 13
14 14 This command can only be run using an |authtoken| with admin rights to
15 15 the specified user group.
16 16
17 17 This command takes the following options:
18 18
19 19 :param apiuser: This is filled automatically from the |authtoken|.
20 20 :type apiuser: AuthUser
21 21 :param usergroupid: Set the name of the `user group` to which a
22 22 user will be added.
23 23 :type usergroupid: int
24 24 :param userid: Set the `user_id` of the user to add to the group.
25 25 :type userid: int
26 26
27 27 Example output:
28 28
29 29 .. code-block:: bash
30 30
31 31 id : <id_given_in_input>
32 32 result : {
33 33 "success": True|False # depends on if member is in group
34 34 "msg": "added member `<username>` to user group `<groupname>` |
35 35 User is already in that group"
36 36
37 37 }
38 38 error : null
39 39
40 40 Example error output:
41 41
42 42 .. code-block:: bash
43 43
44 44 id : <id_given_in_input>
45 45 result : null
46 46 error : {
47 47 "failed to add member to user group `<user_group_name>`"
48 48 }
49 49
50 50
51 51 create_user_group
52 52 -----------------
53 53
54 54 .. py:function:: create_user_group(apiuser, group_name, description=<Optional:''>, owner=<Optional:<OptionalAttr:apiuser>>, active=<Optional:True>, sync=<Optional:None>)
55 55
56 56 Creates a new user group.
57 57
58 58 This command can only be run using an |authtoken| with admin rights to
59 59 the specified repository.
60 60
61 61 This command takes the following options:
62 62
63 63 :param apiuser: This is filled automatically from the |authtoken|.
64 64 :type apiuser: AuthUser
65 65 :param group_name: Set the name of the new user group.
66 66 :type group_name: str
67 67 :param description: Give a description of the new user group.
68 68 :type description: str
69 69 :param owner: Set the owner of the new user group.
70 70 If not set, the owner is the |authtoken| user.
71 71 :type owner: Optional(str or int)
72 72 :param active: Set this group as active.
73 73 :type active: Optional(``True`` | ``False``)
74 74 :param sync: Set enabled or disabled the automatically sync from
75 external authentication types like ldap.
75 external authentication types like ldap. If User Group will be named like
76 one from e.g ldap and sync flag is enabled members will be synced automatically.
77 Sync type when enabled via API is set to `manual_api`
76 78 :type sync: Optional(``True`` | ``False``)
77 79
78 80 Example output:
79 81
80 82 .. code-block:: bash
81 83
82 84 id : <id_given_in_input>
83 85 result: {
84 86 "msg": "created new user group `<groupname>`",
85 87 "user_group": <user_group_object>
86 88 }
87 89 error: null
88 90
89 91 Example error output:
90 92
91 93 .. code-block:: bash
92 94
93 95 id : <id_given_in_input>
94 96 result : null
95 97 error : {
96 98 "user group `<group name>` already exist"
97 99 or
98 100 "failed to create group `<group name>`"
99 101 }
100 102
101 103
102 104 delete_user_group
103 105 -----------------
104 106
105 107 .. py:function:: delete_user_group(apiuser, usergroupid)
106 108
107 109 Deletes the specified `user group`.
108 110
109 111 This command can only be run using an |authtoken| with admin rights to
110 112 the specified repository.
111 113
112 114 This command takes the following options:
113 115
114 116 :param apiuser: filled automatically from apikey
115 117 :type apiuser: AuthUser
116 118 :param usergroupid:
117 119 :type usergroupid: int
118 120
119 121 Example output:
120 122
121 123 .. code-block:: bash
122 124
123 125 id : <id_given_in_input>
124 126 result : {
125 127 "msg": "deleted user group ID:<user_group_id> <user_group_name>"
126 128 }
127 129 error : null
128 130
129 131 Example error output:
130 132
131 133 .. code-block:: bash
132 134
133 135 id : <id_given_in_input>
134 136 result : null
135 137 error : {
136 138 "failed to delete user group ID:<user_group_id> <user_group_name>"
137 139 or
138 140 "RepoGroup assigned to <repo_groups_list>"
139 141 }
140 142
141 143
142 144 get_user_group
143 145 --------------
144 146
145 147 .. py:function:: get_user_group(apiuser, usergroupid)
146 148
147 149 Returns the data of an existing user group.
148 150
149 151 This command can only be run using an |authtoken| with admin rights to
150 152 the specified repository.
151 153
152 154 :param apiuser: This is filled automatically from the |authtoken|.
153 155 :type apiuser: AuthUser
154 156 :param usergroupid: Set the user group from which to return data.
155 157 :type usergroupid: str or int
156 158
157 159 Example error output:
158 160
159 161 .. code-block:: bash
160 162
161 163 {
162 164 "error": null,
163 165 "id": <id>,
164 166 "result": {
165 167 "active": true,
166 168 "group_description": "group description",
167 169 "group_name": "group name",
168 170 "permissions": [
169 171 {
170 172 "name": "owner-name",
171 173 "origin": "owner",
172 174 "permission": "usergroup.admin",
173 175 "type": "user"
174 176 },
175 177 {
176 178 {
177 179 "name": "user name",
178 180 "origin": "permission",
179 181 "permission": "usergroup.admin",
180 182 "type": "user"
181 183 },
182 184 {
183 185 "name": "user group name",
184 186 "origin": "permission",
185 187 "permission": "usergroup.write",
186 188 "type": "user_group"
187 189 }
188 190 ],
189 191 "permissions_summary": {
190 192 "repositories": {
191 193 "aa-root-level-repo-1": "repository.admin"
192 194 },
193 195 "repositories_groups": {}
194 196 },
195 197 "owner": "owner name",
196 198 "users": [],
197 199 "users_group_id": 2
198 200 }
199 201 }
200 202
201 203
202 204 get_user_groups
203 205 ---------------
204 206
205 207 .. py:function:: get_user_groups(apiuser)
206 208
207 209 Lists all the existing user groups within RhodeCode.
208 210
209 211 This command can only be run using an |authtoken| with admin rights to
210 212 the specified repository.
211 213
212 214 This command takes the following options:
213 215
214 216 :param apiuser: This is filled automatically from the |authtoken|.
215 217 :type apiuser: AuthUser
216 218
217 219 Example error output:
218 220
219 221 .. code-block:: bash
220 222
221 223 id : <id_given_in_input>
222 224 result : [<user_group_obj>,...]
223 225 error : null
224 226
225 227
226 228 grant_user_group_permission_to_user_group
227 229 -----------------------------------------
228 230
229 231 .. py:function:: grant_user_group_permission_to_user_group(apiuser, usergroupid, sourceusergroupid, perm)
230 232
231 233 Give one user group permissions to another user group.
232 234
233 235 :param apiuser: This is filled automatically from the |authtoken|.
234 236 :type apiuser: AuthUser
235 237 :param usergroupid: Set the user group on which to edit permissions.
236 238 :type usergroupid: str or int
237 239 :param sourceusergroupid: Set the source user group to which
238 240 access/permissions will be granted.
239 241 :type sourceusergroupid: str or int
240 242 :param perm: (usergroup.(none|read|write|admin))
241 243 :type perm: str
242 244
243 245 Example output:
244 246
245 247 .. code-block:: bash
246 248
247 249 id : <id_given_in_input>
248 250 result : {
249 251 "msg": "Granted perm: `<perm_name>` for user group: `<source_user_group_name>` in user group: `<user_group_name>`",
250 252 "success": true
251 253 }
252 254 error : null
253 255
254 256
255 257 grant_user_permission_to_user_group
256 258 -----------------------------------
257 259
258 260 .. py:function:: grant_user_permission_to_user_group(apiuser, usergroupid, userid, perm)
259 261
260 262 Set permissions for a user in a user group.
261 263
262 264 :param apiuser: This is filled automatically from the |authtoken|.
263 265 :type apiuser: AuthUser
264 266 :param usergroupid: Set the user group to edit permissions on.
265 267 :type usergroupid: str or int
266 268 :param userid: Set the user from whom you wish to set permissions.
267 269 :type userid: str
268 270 :param perm: (usergroup.(none|read|write|admin))
269 271 :type perm: str
270 272
271 273 Example output:
272 274
273 275 .. code-block:: bash
274 276
275 277 id : <id_given_in_input>
276 278 result : {
277 279 "msg": "Granted perm: `<perm_name>` for user: `<username>` in user group: `<user_group_name>`",
278 280 "success": true
279 281 }
280 282 error : null
281 283
282 284
283 285 remove_user_from_user_group
284 286 ---------------------------
285 287
286 288 .. py:function:: remove_user_from_user_group(apiuser, usergroupid, userid)
287 289
288 290 Removes a user from a user group.
289 291
290 292 * If the specified user is not in the group, this command will return
291 293 `false`.
292 294
293 295 This command can only be run using an |authtoken| with admin rights to
294 296 the specified user group.
295 297
296 298 :param apiuser: This is filled automatically from the |authtoken|.
297 299 :type apiuser: AuthUser
298 300 :param usergroupid: Sets the user group name.
299 301 :type usergroupid: str or int
300 302 :param userid: The user you wish to remove from |RCE|.
301 303 :type userid: str or int
302 304
303 305 Example output:
304 306
305 307 .. code-block:: bash
306 308
307 309 id : <id_given_in_input>
308 310 result: {
309 311 "success": True|False, # depends on if member is in group
310 312 "msg": "removed member <username> from user group <groupname> |
311 313 User wasn't in group"
312 314 }
313 315 error: null
314 316
315 317
316 318 revoke_user_group_permission_from_user_group
317 319 --------------------------------------------
318 320
319 321 .. py:function:: revoke_user_group_permission_from_user_group(apiuser, usergroupid, sourceusergroupid)
320 322
321 323 Revoke the permissions that one user group has to another.
322 324
323 325 :param apiuser: This is filled automatically from the |authtoken|.
324 326 :type apiuser: AuthUser
325 327 :param usergroupid: Set the user group on which to edit permissions.
326 328 :type usergroupid: str or int
327 329 :param sourceusergroupid: Set the user group from which permissions
328 330 are revoked.
329 331 :type sourceusergroupid: str or int
330 332
331 333 Example output:
332 334
333 335 .. code-block:: bash
334 336
335 337 id : <id_given_in_input>
336 338 result : {
337 339 "msg": "Revoked perm for user group: `<user_group_name>` in user group: `<target_user_group_name>`",
338 340 "success": true
339 341 }
340 342 error : null
341 343
342 344
343 345 revoke_user_permission_from_user_group
344 346 --------------------------------------
345 347
346 348 .. py:function:: revoke_user_permission_from_user_group(apiuser, usergroupid, userid)
347 349
348 350 Revoke a users permissions in a user group.
349 351
350 352 :param apiuser: This is filled automatically from the |authtoken|.
351 353 :type apiuser: AuthUser
352 354 :param usergroupid: Set the user group from which to revoke the user
353 355 permissions.
354 356 :type: usergroupid: str or int
355 357 :param userid: Set the userid of the user whose permissions will be
356 358 revoked.
357 359 :type userid: str
358 360
359 361 Example output:
360 362
361 363 .. code-block:: bash
362 364
363 365 id : <id_given_in_input>
364 366 result : {
365 367 "msg": "Revoked perm for user: `<username>` in user group: `<user_group_name>`",
366 368 "success": true
367 369 }
368 370 error : null
369 371
370 372
371 373 update_user_group
372 374 -----------------
373 375
374 376 .. py:function:: update_user_group(apiuser, usergroupid, group_name=<Optional:''>, description=<Optional:''>, owner=<Optional:None>, active=<Optional:True>, sync=<Optional:None>)
375 377
376 378 Updates the specified `user group` with the details provided.
377 379
378 380 This command can only be run using an |authtoken| with admin rights to
379 381 the specified repository.
380 382
381 383 :param apiuser: This is filled automatically from the |authtoken|.
382 384 :type apiuser: AuthUser
383 385 :param usergroupid: Set the id of the `user group` to update.
384 386 :type usergroupid: str or int
385 387 :param group_name: Set the new name the `user group`
386 388 :type group_name: str
387 389 :param description: Give a description for the `user group`
388 390 :type description: str
389 391 :param owner: Set the owner of the `user group`.
390 392 :type owner: Optional(str or int)
391 393 :param active: Set the group as active.
392 394 :type active: Optional(``True`` | ``False``)
393 395 :param sync: Set enabled or disabled the automatically sync from
394 external authentication types like ldap.
396 external authentication types like ldap. If User Group will be named like
397 one from e.g ldap and sync flag is enabled members will be synced automatically.
398 Sync type when enabled via API is set to `manual_api`
395 399 :type sync: Optional(``True`` | ``False``)
396 400
397 401 Example output:
398 402
399 403 .. code-block:: bash
400 404
401 405 id : <id_given_in_input>
402 406 result : {
403 407 "msg": 'updated user group ID:<user group id> <user group name>',
404 408 "user_group": <user_group_object>
405 409 }
406 410 error : null
407 411
408 412 Example error output:
409 413
410 414 .. code-block:: bash
411 415
412 416 id : <id_given_in_input>
413 417 result : null
414 418 error : {
415 419 "failed to update user group `<user group name>`"
416 420 }
417 421
418 422
@@ -1,326 +1,331 b''
1 1 .. _user-methods-ref:
2 2
3 3 user methods
4 4 ============
5 5
6 6 create_user
7 7 -----------
8 8
9 .. py:function:: create_user(apiuser, username, email, password=<Optional:''>, firstname=<Optional:''>, lastname=<Optional:''>, active=<Optional:True>, admin=<Optional:False>, extern_name=<Optional:'rhodecode'>, extern_type=<Optional:'rhodecode'>, force_password_change=<Optional:False>, create_personal_repo_group=<Optional:None>)
9 .. py:function:: create_user(apiuser, username, email, password=<Optional:''>, firstname=<Optional:''>, lastname=<Optional:''>, description=<Optional:''>, active=<Optional:True>, admin=<Optional:False>, extern_name=<Optional:'rhodecode'>, extern_type=<Optional:'rhodecode'>, force_password_change=<Optional:False>, create_personal_repo_group=<Optional:None>)
10 10
11 11 Creates a new user and returns the new user object.
12 12
13 13 This command can only be run using an |authtoken| with admin rights to
14 14 the specified repository.
15 15
16 16 This command takes the following options:
17 17
18 18 :param apiuser: This is filled automatically from the |authtoken|.
19 19 :type apiuser: AuthUser
20 20 :param username: Set the new username.
21 21 :type username: str or int
22 22 :param email: Set the user email address.
23 23 :type email: str
24 24 :param password: Set the new user password.
25 25 :type password: Optional(str)
26 26 :param firstname: Set the new user firstname.
27 27 :type firstname: Optional(str)
28 28 :param lastname: Set the new user surname.
29 29 :type lastname: Optional(str)
30 :param description: Set user description, or short bio. Metatags are allowed.
31 :type description: Optional(str)
30 32 :param active: Set the user as active.
31 33 :type active: Optional(``True`` | ``False``)
32 34 :param admin: Give the new user admin rights.
33 35 :type admin: Optional(``True`` | ``False``)
34 36 :param extern_name: Set the authentication plugin name.
35 37 Using LDAP this is filled with LDAP UID.
36 38 :type extern_name: Optional(str)
37 39 :param extern_type: Set the new user authentication plugin.
38 40 :type extern_type: Optional(str)
39 41 :param force_password_change: Force the new user to change password
40 42 on next login.
41 43 :type force_password_change: Optional(``True`` | ``False``)
42 44 :param create_personal_repo_group: Create personal repo group for this user
43 45 :type create_personal_repo_group: Optional(``True`` | ``False``)
44 46
45 47 Example output:
46 48
47 49 .. code-block:: bash
48 50
49 51 id : <id_given_in_input>
50 52 result: {
51 53 "msg" : "created new user `<username>`",
52 54 "user": <user_obj>
53 55 }
54 56 error: null
55 57
56 58 Example error output:
57 59
58 60 .. code-block:: bash
59 61
60 62 id : <id_given_in_input>
61 63 result : null
62 64 error : {
63 65 "user `<username>` already exist"
64 66 or
65 67 "email `<email>` already exist"
66 68 or
67 69 "failed to create user `<username>`"
68 70 }
69 71
70 72
71 73 delete_user
72 74 -----------
73 75
74 76 .. py:function:: delete_user(apiuser, userid)
75 77
76 78 Deletes the specified user from the |RCE| user database.
77 79
78 80 This command can only be run using an |authtoken| with admin rights to
79 81 the specified repository.
80 82
81 83 .. important::
82 84
83 85 Ensure all open pull requests and open code review
84 86 requests to this user are close.
85 87
86 88 Also ensure all repositories, or repository groups owned by this
87 89 user are reassigned before deletion.
88 90
89 91 This command takes the following options:
90 92
91 93 :param apiuser: This is filled automatically from the |authtoken|.
92 94 :type apiuser: AuthUser
93 95 :param userid: Set the user to delete.
94 96 :type userid: str or int
95 97
96 98 Example output:
97 99
98 100 .. code-block:: bash
99 101
100 102 id : <id_given_in_input>
101 103 result: {
102 104 "msg" : "deleted user ID:<userid> <username>",
103 105 "user": null
104 106 }
105 107 error: null
106 108
107 109 Example error output:
108 110
109 111 .. code-block:: bash
110 112
111 113 id : <id_given_in_input>
112 114 result : null
113 115 error : {
114 116 "failed to delete user ID:<userid> <username>"
115 117 }
116 118
117 119
118 120 get_user
119 121 --------
120 122
121 123 .. py:function:: get_user(apiuser, userid=<Optional:<OptionalAttr:apiuser>>)
122 124
123 125 Returns the information associated with a username or userid.
124 126
125 127 * If the ``userid`` is not set, this command returns the information
126 128 for the ``userid`` calling the method.
127 129
128 130 .. note::
129 131
130 132 Normal users may only run this command against their ``userid``. For
131 133 full privileges you must run this command using an |authtoken| with
132 134 admin rights.
133 135
134 136 :param apiuser: This is filled automatically from the |authtoken|.
135 137 :type apiuser: AuthUser
136 138 :param userid: Sets the userid for which data will be returned.
137 139 :type userid: Optional(str or int)
138 140
139 141 Example output:
140 142
141 143 .. code-block:: bash
142 144
143 145 {
144 146 "error": null,
145 147 "id": <id>,
146 148 "result": {
147 149 "active": true,
148 150 "admin": false,
149 151 "api_keys": [ list of keys ],
150 152 "auth_tokens": [ list of tokens with details ],
151 153 "email": "user@example.com",
152 154 "emails": [
153 155 "user@example.com"
154 156 ],
155 157 "extern_name": "rhodecode",
156 158 "extern_type": "rhodecode",
157 159 "firstname": "username",
160 "description": "user description",
158 161 "ip_addresses": [],
159 162 "language": null,
160 163 "last_login": "Timestamp",
161 164 "last_activity": "Timestamp",
162 165 "lastname": "surnae",
163 166 "permissions": <deprecated>,
164 167 "permissions_summary": {
165 168 "global": [
166 169 "hg.inherit_default_perms.true",
167 170 "usergroup.read",
168 171 "hg.repogroup.create.false",
169 172 "hg.create.none",
170 173 "hg.password_reset.enabled",
171 174 "hg.extern_activate.manual",
172 175 "hg.create.write_on_repogroup.false",
173 176 "hg.usergroup.create.false",
174 177 "group.none",
175 178 "repository.none",
176 179 "hg.register.none",
177 180 "hg.fork.repository"
178 181 ],
179 182 "repositories": { "username/example": "repository.write"},
180 183 "repositories_groups": { "user-group/repo": "group.none" },
181 184 "user_groups": { "user_group_name": "usergroup.read" }
182 185 }
183 186 "user_id": 32,
184 187 "username": "username"
185 188 }
186 189 }
187 190
188 191
189 192 get_user_audit_logs
190 193 -------------------
191 194
192 195 .. py:function:: get_user_audit_logs(apiuser, userid=<Optional:<OptionalAttr:apiuser>>)
193 196
194 197 Fetches all action logs made by the specified user.
195 198
196 199 This command takes the following options:
197 200
198 201 :param apiuser: This is filled automatically from the |authtoken|.
199 202 :type apiuser: AuthUser
200 203 :param userid: Sets the userid whose list of locked |repos| will be
201 204 displayed.
202 205 :type userid: Optional(str or int)
203 206
204 207 Example output:
205 208
206 209 .. code-block:: bash
207 210
208 211 id : <id_given_in_input>
209 212 result : {
210 213 [action, action,...]
211 214 }
212 215 error : null
213 216
214 217
215 218 get_user_locks
216 219 --------------
217 220
218 221 .. py:function:: get_user_locks(apiuser, userid=<Optional:<OptionalAttr:apiuser>>)
219 222
220 223 Displays all repositories locked by the specified user.
221 224
222 225 * If this command is run by a non-admin user, it returns
223 226 a list of |repos| locked by that user.
224 227
225 228 This command takes the following options:
226 229
227 230 :param apiuser: This is filled automatically from the |authtoken|.
228 231 :type apiuser: AuthUser
229 232 :param userid: Sets the userid whose list of locked |repos| will be
230 233 displayed.
231 234 :type userid: Optional(str or int)
232 235
233 236 Example output:
234 237
235 238 .. code-block:: bash
236 239
237 240 id : <id_given_in_input>
238 241 result : {
239 242 [repo_object, repo_object,...]
240 243 }
241 244 error : null
242 245
243 246
244 247 get_users
245 248 ---------
246 249
247 250 .. py:function:: get_users(apiuser)
248 251
249 252 Lists all users in the |RCE| user database.
250 253
251 254 This command can only be run using an |authtoken| with admin rights to
252 255 the specified repository.
253 256
254 257 This command takes the following options:
255 258
256 259 :param apiuser: This is filled automatically from the |authtoken|.
257 260 :type apiuser: AuthUser
258 261
259 262 Example output:
260 263
261 264 .. code-block:: bash
262 265
263 266 id : <id_given_in_input>
264 267 result: [<user_object>, ...]
265 268 error: null
266 269
267 270
268 271 update_user
269 272 -----------
270 273
271 .. py:function:: update_user(apiuser, userid, username=<Optional:None>, email=<Optional:None>, password=<Optional:None>, firstname=<Optional:None>, lastname=<Optional:None>, active=<Optional:None>, admin=<Optional:None>, extern_type=<Optional:None>, extern_name=<Optional:None>)
274 .. py:function:: update_user(apiuser, userid, username=<Optional:None>, email=<Optional:None>, password=<Optional:None>, firstname=<Optional:None>, lastname=<Optional:None>, description=<Optional:None>, active=<Optional:None>, admin=<Optional:None>, extern_type=<Optional:None>, extern_name=<Optional:None>)
272 275
273 276 Updates the details for the specified user, if that user exists.
274 277
275 278 This command can only be run using an |authtoken| with admin rights to
276 279 the specified repository.
277 280
278 281 This command takes the following options:
279 282
280 283 :param apiuser: This is filled automatically from |authtoken|.
281 284 :type apiuser: AuthUser
282 285 :param userid: Set the ``userid`` to update.
283 286 :type userid: str or int
284 287 :param username: Set the new username.
285 288 :type username: str or int
286 289 :param email: Set the new email.
287 290 :type email: str
288 291 :param password: Set the new password.
289 292 :type password: Optional(str)
290 293 :param firstname: Set the new first name.
291 294 :type firstname: Optional(str)
292 295 :param lastname: Set the new surname.
293 296 :type lastname: Optional(str)
297 :param description: Set user description, or short bio. Metatags are allowed.
298 :type description: Optional(str)
294 299 :param active: Set the new user as active.
295 300 :type active: Optional(``True`` | ``False``)
296 301 :param admin: Give the user admin rights.
297 302 :type admin: Optional(``True`` | ``False``)
298 303 :param extern_name: Set the authentication plugin user name.
299 304 Using LDAP this is filled with LDAP UID.
300 305 :type extern_name: Optional(str)
301 306 :param extern_type: Set the authentication plugin type.
302 307 :type extern_type: Optional(str)
303 308
304 309
305 310 Example output:
306 311
307 312 .. code-block:: bash
308 313
309 314 id : <id_given_in_input>
310 315 result: {
311 316 "msg" : "updated user ID:<userid> <username>",
312 317 "user": <user_object>,
313 318 }
314 319 error: null
315 320
316 321 Example error output:
317 322
318 323 .. code-block:: bash
319 324
320 325 id : <id_given_in_input>
321 326 result : null
322 327 error : {
323 328 "failed to update user `<username>`"
324 329 }
325 330
326 331
General Comments 0
You need to be logged in to leave comments. Login now