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