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