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