##// END OF EJS Templates
docs: update API documentation
marcink -
r3000:d3d62463 default
parent child Browse files
Show More
@@ -1,421 +1,428 b''
1 .. _pull-request-methods-ref:
1 .. _pull-request-methods-ref:
2
2
3 pull_request methods
3 pull_request methods
4 ====================
4 ====================
5
5
6 close_pull_request
6 close_pull_request
7 ------------------
7 ------------------
8
8
9 .. py:function:: close_pull_request(apiuser, pullrequestid, repoid=<Optional:None>, userid=<Optional:<OptionalAttr:apiuser>>, message=<Optional:''>)
9 .. py:function:: close_pull_request(apiuser, pullrequestid, repoid=<Optional:None>, userid=<Optional:<OptionalAttr:apiuser>>, message=<Optional:''>)
10
10
11 Close the pull request specified by `pullrequestid`.
11 Close the pull request specified by `pullrequestid`.
12
12
13 :param apiuser: This is filled automatically from the |authtoken|.
13 :param apiuser: This is filled automatically from the |authtoken|.
14 :type apiuser: AuthUser
14 :type apiuser: AuthUser
15 :param repoid: Repository name or repository ID to which the pull
15 :param repoid: Repository name or repository ID to which the pull
16 request belongs.
16 request belongs.
17 :type repoid: str or int
17 :type repoid: str or int
18 :param pullrequestid: ID of the pull request to be closed.
18 :param pullrequestid: ID of the pull request to be closed.
19 :type pullrequestid: int
19 :type pullrequestid: int
20 :param userid: Close the pull request as this user.
20 :param userid: Close the pull request as this user.
21 :type userid: Optional(str or int)
21 :type userid: Optional(str or int)
22 :param message: Optional message to close the Pull Request with. If not
22 :param message: Optional message to close the Pull Request with. If not
23 specified it will be generated automatically.
23 specified it will be generated automatically.
24 :type message: Optional(str)
24 :type message: Optional(str)
25
25
26 Example output:
26 Example output:
27
27
28 .. code-block:: bash
28 .. code-block:: bash
29
29
30 "id": <id_given_in_input>,
30 "id": <id_given_in_input>,
31 "result": {
31 "result": {
32 "pull_request_id": "<int>",
32 "pull_request_id": "<int>",
33 "close_status": "<str:status_lbl>,
33 "close_status": "<str:status_lbl>,
34 "closed": "<bool>"
34 "closed": "<bool>"
35 },
35 },
36 "error": null
36 "error": null
37
37
38
38
39 comment_pull_request
39 comment_pull_request
40 --------------------
40 --------------------
41
41
42 .. py:function:: comment_pull_request(apiuser, pullrequestid, repoid=<Optional:None>, message=<Optional:None>, commit_id=<Optional:None>, status=<Optional:None>, comment_type=<Optional:u'note'>, resolves_comment_id=<Optional:None>, userid=<Optional:<OptionalAttr:apiuser>>)
42 .. py:function:: comment_pull_request(apiuser, pullrequestid, repoid=<Optional:None>, message=<Optional:None>, commit_id=<Optional:None>, status=<Optional:None>, comment_type=<Optional:u'note'>, resolves_comment_id=<Optional:None>, userid=<Optional:<OptionalAttr:apiuser>>)
43
43
44 Comment on the pull request specified with the `pullrequestid`,
44 Comment on the pull request specified with the `pullrequestid`,
45 in the |repo| specified by the `repoid`, and optionally change the
45 in the |repo| specified by the `repoid`, and optionally change the
46 review status.
46 review status.
47
47
48 :param apiuser: This is filled automatically from the |authtoken|.
48 :param apiuser: This is filled automatically from the |authtoken|.
49 :type apiuser: AuthUser
49 :type apiuser: AuthUser
50 :param repoid: Optional repository name or repository ID.
50 :param repoid: Optional repository name or repository ID.
51 :type repoid: str or int
51 :type repoid: str or int
52 :param pullrequestid: The pull request ID.
52 :param pullrequestid: The pull request ID.
53 :type pullrequestid: int
53 :type pullrequestid: int
54 :param commit_id: Specify the commit_id for which to set a comment. If
54 :param commit_id: Specify the commit_id for which to set a comment. If
55 given commit_id is different than latest in the PR status
55 given commit_id is different than latest in the PR status
56 change won't be performed.
56 change won't be performed.
57 :type commit_id: str
57 :type commit_id: str
58 :param message: The text content of the comment.
58 :param message: The text content of the comment.
59 :type message: str
59 :type message: str
60 :param status: (**Optional**) Set the approval status of the pull
60 :param status: (**Optional**) Set the approval status of the pull
61 request. One of: 'not_reviewed', 'approved', 'rejected',
61 request. One of: 'not_reviewed', 'approved', 'rejected',
62 'under_review'
62 'under_review'
63 :type status: str
63 :type status: str
64 :param comment_type: Comment type, one of: 'note', 'todo'
64 :param comment_type: Comment type, one of: 'note', 'todo'
65 :type comment_type: Optional(str), default: 'note'
65 :type comment_type: Optional(str), default: 'note'
66 :param userid: Comment on the pull request as this user
66 :param userid: Comment on the pull request as this user
67 :type userid: Optional(str or int)
67 :type userid: Optional(str or int)
68
68
69 Example output:
69 Example output:
70
70
71 .. code-block:: bash
71 .. code-block:: bash
72
72
73 id : <id_given_in_input>
73 id : <id_given_in_input>
74 result : {
74 result : {
75 "pull_request_id": "<Integer>",
75 "pull_request_id": "<Integer>",
76 "comment_id": "<Integer>",
76 "comment_id": "<Integer>",
77 "status": {"given": <given_status>,
77 "status": {"given": <given_status>,
78 "was_changed": <bool status_was_actually_changed> },
78 "was_changed": <bool status_was_actually_changed> },
79 },
79 },
80 error : null
80 error : null
81
81
82
82
83 create_pull_request
83 create_pull_request
84 -------------------
84 -------------------
85
85
86 .. py:function:: create_pull_request(apiuser, source_repo, target_repo, source_ref, target_ref, title, description=<Optional:''>, reviewers=<Optional:None>)
86 .. py:function:: create_pull_request(apiuser, source_repo, target_repo, source_ref, target_ref, title=<Optional:''>, description=<Optional:''>, description_renderer=<Optional:''>, reviewers=<Optional:None>)
87
87
88 Creates a new pull request.
88 Creates a new pull request.
89
89
90 Accepts refs in the following formats:
90 Accepts refs in the following formats:
91
91
92 * branch:<branch_name>:<sha>
92 * branch:<branch_name>:<sha>
93 * branch:<branch_name>
93 * branch:<branch_name>
94 * bookmark:<bookmark_name>:<sha> (Mercurial only)
94 * bookmark:<bookmark_name>:<sha> (Mercurial only)
95 * bookmark:<bookmark_name> (Mercurial only)
95 * bookmark:<bookmark_name> (Mercurial only)
96
96
97 :param apiuser: This is filled automatically from the |authtoken|.
97 :param apiuser: This is filled automatically from the |authtoken|.
98 :type apiuser: AuthUser
98 :type apiuser: AuthUser
99 :param source_repo: Set the source repository name.
99 :param source_repo: Set the source repository name.
100 :type source_repo: str
100 :type source_repo: str
101 :param target_repo: Set the target repository name.
101 :param target_repo: Set the target repository name.
102 :type target_repo: str
102 :type target_repo: str
103 :param source_ref: Set the source ref name.
103 :param source_ref: Set the source ref name.
104 :type source_ref: str
104 :type source_ref: str
105 :param target_ref: Set the target ref name.
105 :param target_ref: Set the target ref name.
106 :type target_ref: str
106 :type target_ref: str
107 :param title: Set the pull request title.
107 :param title: Optionally Set the pull request title, it's generated otherwise
108 :type title: str
108 :type title: str
109 :param description: Set the pull request description.
109 :param description: Set the pull request description.
110 :type description: Optional(str)
110 :type description: Optional(str)
111 :type description_renderer: Optional(str)
112 :param description_renderer: Set pull request renderer for the description.
113 It should be 'rst', 'markdown' or 'plain'. If not give default
114 system renderer will be used
111 :param reviewers: Set the new pull request reviewers list.
115 :param reviewers: Set the new pull request reviewers list.
112 Reviewer defined by review rules will be added automatically to the
116 Reviewer defined by review rules will be added automatically to the
113 defined list.
117 defined list.
114 :type reviewers: Optional(list)
118 :type reviewers: Optional(list)
115 Accepts username strings or objects of the format:
119 Accepts username strings or objects of the format:
116
120
117 [{'username': 'nick', 'reasons': ['original author'], 'mandatory': <bool>}]
121 [{'username': 'nick', 'reasons': ['original author'], 'mandatory': <bool>}]
118
122
119
123
120 get_pull_request
124 get_pull_request
121 ----------------
125 ----------------
122
126
123 .. py:function:: get_pull_request(apiuser, pullrequestid, repoid=<Optional:None>)
127 .. py:function:: get_pull_request(apiuser, pullrequestid, repoid=<Optional:None>)
124
128
125 Get a pull request based on the given ID.
129 Get a pull request based on the given ID.
126
130
127 :param apiuser: This is filled automatically from the |authtoken|.
131 :param apiuser: This is filled automatically from the |authtoken|.
128 :type apiuser: AuthUser
132 :type apiuser: AuthUser
129 :param repoid: Optional, repository name or repository ID from where
133 :param repoid: Optional, repository name or repository ID from where
130 the pull request was opened.
134 the pull request was opened.
131 :type repoid: str or int
135 :type repoid: str or int
132 :param pullrequestid: ID of the requested pull request.
136 :param pullrequestid: ID of the requested pull request.
133 :type pullrequestid: int
137 :type pullrequestid: int
134
138
135 Example output:
139 Example output:
136
140
137 .. code-block:: bash
141 .. code-block:: bash
138
142
139 "id": <id_given_in_input>,
143 "id": <id_given_in_input>,
140 "result":
144 "result":
141 {
145 {
142 "pull_request_id": "<pull_request_id>",
146 "pull_request_id": "<pull_request_id>",
143 "url": "<url>",
147 "url": "<url>",
144 "title": "<title>",
148 "title": "<title>",
145 "description": "<description>",
149 "description": "<description>",
146 "status" : "<status>",
150 "status" : "<status>",
147 "created_on": "<date_time_created>",
151 "created_on": "<date_time_created>",
148 "updated_on": "<date_time_updated>",
152 "updated_on": "<date_time_updated>",
149 "commit_ids": [
153 "commit_ids": [
150 ...
154 ...
151 "<commit_id>",
155 "<commit_id>",
152 "<commit_id>",
156 "<commit_id>",
153 ...
157 ...
154 ],
158 ],
155 "review_status": "<review_status>",
159 "review_status": "<review_status>",
156 "mergeable": {
160 "mergeable": {
157 "status": "<bool>",
161 "status": "<bool>",
158 "message": "<message>",
162 "message": "<message>",
159 },
163 },
160 "source": {
164 "source": {
161 "clone_url": "<clone_url>",
165 "clone_url": "<clone_url>",
162 "repository": "<repository_name>",
166 "repository": "<repository_name>",
163 "reference":
167 "reference":
164 {
168 {
165 "name": "<name>",
169 "name": "<name>",
166 "type": "<type>",
170 "type": "<type>",
167 "commit_id": "<commit_id>",
171 "commit_id": "<commit_id>",
168 }
172 }
169 },
173 },
170 "target": {
174 "target": {
171 "clone_url": "<clone_url>",
175 "clone_url": "<clone_url>",
172 "repository": "<repository_name>",
176 "repository": "<repository_name>",
173 "reference":
177 "reference":
174 {
178 {
175 "name": "<name>",
179 "name": "<name>",
176 "type": "<type>",
180 "type": "<type>",
177 "commit_id": "<commit_id>",
181 "commit_id": "<commit_id>",
178 }
182 }
179 },
183 },
180 "merge": {
184 "merge": {
181 "clone_url": "<clone_url>",
185 "clone_url": "<clone_url>",
182 "reference":
186 "reference":
183 {
187 {
184 "name": "<name>",
188 "name": "<name>",
185 "type": "<type>",
189 "type": "<type>",
186 "commit_id": "<commit_id>",
190 "commit_id": "<commit_id>",
187 }
191 }
188 },
192 },
189 "author": <user_obj>,
193 "author": <user_obj>,
190 "reviewers": [
194 "reviewers": [
191 ...
195 ...
192 {
196 {
193 "user": "<user_obj>",
197 "user": "<user_obj>",
194 "review_status": "<review_status>",
198 "review_status": "<review_status>",
195 }
199 }
196 ...
200 ...
197 ]
201 ]
198 },
202 },
199 "error": null
203 "error": null
200
204
201
205
202 get_pull_request_comments
206 get_pull_request_comments
203 -------------------------
207 -------------------------
204
208
205 .. py:function:: get_pull_request_comments(apiuser, pullrequestid, repoid=<Optional:None>)
209 .. py:function:: get_pull_request_comments(apiuser, pullrequestid, repoid=<Optional:None>)
206
210
207 Get all comments of pull request specified with the `pullrequestid`
211 Get all comments of pull request specified with the `pullrequestid`
208
212
209 :param apiuser: This is filled automatically from the |authtoken|.
213 :param apiuser: This is filled automatically from the |authtoken|.
210 :type apiuser: AuthUser
214 :type apiuser: AuthUser
211 :param repoid: Optional repository name or repository ID.
215 :param repoid: Optional repository name or repository ID.
212 :type repoid: str or int
216 :type repoid: str or int
213 :param pullrequestid: The pull request ID.
217 :param pullrequestid: The pull request ID.
214 :type pullrequestid: int
218 :type pullrequestid: int
215
219
216 Example output:
220 Example output:
217
221
218 .. code-block:: bash
222 .. code-block:: bash
219
223
220 id : <id_given_in_input>
224 id : <id_given_in_input>
221 result : [
225 result : [
222 {
226 {
223 "comment_author": {
227 "comment_author": {
224 "active": true,
228 "active": true,
225 "full_name_or_username": "Tom Gore",
229 "full_name_or_username": "Tom Gore",
226 "username": "admin"
230 "username": "admin"
227 },
231 },
228 "comment_created_on": "2017-01-02T18:43:45.533",
232 "comment_created_on": "2017-01-02T18:43:45.533",
229 "comment_f_path": null,
233 "comment_f_path": null,
230 "comment_id": 25,
234 "comment_id": 25,
231 "comment_lineno": null,
235 "comment_lineno": null,
232 "comment_status": {
236 "comment_status": {
233 "status": "under_review",
237 "status": "under_review",
234 "status_lbl": "Under Review"
238 "status_lbl": "Under Review"
235 },
239 },
236 "comment_text": "Example text",
240 "comment_text": "Example text",
237 "comment_type": null,
241 "comment_type": null,
238 "pull_request_version": null
242 "pull_request_version": null
239 }
243 }
240 ],
244 ],
241 error : null
245 error : null
242
246
243
247
244 get_pull_requests
248 get_pull_requests
245 -----------------
249 -----------------
246
250
247 .. py:function:: get_pull_requests(apiuser, repoid, status=<Optional:'new'>)
251 .. py:function:: get_pull_requests(apiuser, repoid, status=<Optional:'new'>)
248
252
249 Get all pull requests from the repository specified in `repoid`.
253 Get all pull requests from the repository specified in `repoid`.
250
254
251 :param apiuser: This is filled automatically from the |authtoken|.
255 :param apiuser: This is filled automatically from the |authtoken|.
252 :type apiuser: AuthUser
256 :type apiuser: AuthUser
253 :param repoid: Optional repository name or repository ID.
257 :param repoid: Optional repository name or repository ID.
254 :type repoid: str or int
258 :type repoid: str or int
255 :param status: Only return pull requests with the specified status.
259 :param status: Only return pull requests with the specified status.
256 Valid options are.
260 Valid options are.
257 * ``new`` (default)
261 * ``new`` (default)
258 * ``open``
262 * ``open``
259 * ``closed``
263 * ``closed``
260 :type status: str
264 :type status: str
261
265
262 Example output:
266 Example output:
263
267
264 .. code-block:: bash
268 .. code-block:: bash
265
269
266 "id": <id_given_in_input>,
270 "id": <id_given_in_input>,
267 "result":
271 "result":
268 [
272 [
269 ...
273 ...
270 {
274 {
271 "pull_request_id": "<pull_request_id>",
275 "pull_request_id": "<pull_request_id>",
272 "url": "<url>",
276 "url": "<url>",
273 "title" : "<title>",
277 "title" : "<title>",
274 "description": "<description>",
278 "description": "<description>",
275 "status": "<status>",
279 "status": "<status>",
276 "created_on": "<date_time_created>",
280 "created_on": "<date_time_created>",
277 "updated_on": "<date_time_updated>",
281 "updated_on": "<date_time_updated>",
278 "commit_ids": [
282 "commit_ids": [
279 ...
283 ...
280 "<commit_id>",
284 "<commit_id>",
281 "<commit_id>",
285 "<commit_id>",
282 ...
286 ...
283 ],
287 ],
284 "review_status": "<review_status>",
288 "review_status": "<review_status>",
285 "mergeable": {
289 "mergeable": {
286 "status": "<bool>",
290 "status": "<bool>",
287 "message: "<message>",
291 "message: "<message>",
288 },
292 },
289 "source": {
293 "source": {
290 "clone_url": "<clone_url>",
294 "clone_url": "<clone_url>",
291 "reference":
295 "reference":
292 {
296 {
293 "name": "<name>",
297 "name": "<name>",
294 "type": "<type>",
298 "type": "<type>",
295 "commit_id": "<commit_id>",
299 "commit_id": "<commit_id>",
296 }
300 }
297 },
301 },
298 "target": {
302 "target": {
299 "clone_url": "<clone_url>",
303 "clone_url": "<clone_url>",
300 "reference":
304 "reference":
301 {
305 {
302 "name": "<name>",
306 "name": "<name>",
303 "type": "<type>",
307 "type": "<type>",
304 "commit_id": "<commit_id>",
308 "commit_id": "<commit_id>",
305 }
309 }
306 },
310 },
307 "merge": {
311 "merge": {
308 "clone_url": "<clone_url>",
312 "clone_url": "<clone_url>",
309 "reference":
313 "reference":
310 {
314 {
311 "name": "<name>",
315 "name": "<name>",
312 "type": "<type>",
316 "type": "<type>",
313 "commit_id": "<commit_id>",
317 "commit_id": "<commit_id>",
314 }
318 }
315 },
319 },
316 "author": <user_obj>,
320 "author": <user_obj>,
317 "reviewers": [
321 "reviewers": [
318 ...
322 ...
319 {
323 {
320 "user": "<user_obj>",
324 "user": "<user_obj>",
321 "review_status": "<review_status>",
325 "review_status": "<review_status>",
322 }
326 }
323 ...
327 ...
324 ]
328 ]
325 }
329 }
326 ...
330 ...
327 ],
331 ],
328 "error": null
332 "error": null
329
333
330
334
331 merge_pull_request
335 merge_pull_request
332 ------------------
336 ------------------
333
337
334 .. py:function:: merge_pull_request(apiuser, pullrequestid, repoid=<Optional:None>, userid=<Optional:<OptionalAttr:apiuser>>)
338 .. py:function:: merge_pull_request(apiuser, pullrequestid, repoid=<Optional:None>, userid=<Optional:<OptionalAttr:apiuser>>)
335
339
336 Merge the pull request specified by `pullrequestid` into its target
340 Merge the pull request specified by `pullrequestid` into its target
337 repository.
341 repository.
338
342
339 :param apiuser: This is filled automatically from the |authtoken|.
343 :param apiuser: This is filled automatically from the |authtoken|.
340 :type apiuser: AuthUser
344 :type apiuser: AuthUser
341 :param repoid: Optional, repository name or repository ID of the
345 :param repoid: Optional, repository name or repository ID of the
342 target repository to which the |pr| is to be merged.
346 target repository to which the |pr| is to be merged.
343 :type repoid: str or int
347 :type repoid: str or int
344 :param pullrequestid: ID of the pull request which shall be merged.
348 :param pullrequestid: ID of the pull request which shall be merged.
345 :type pullrequestid: int
349 :type pullrequestid: int
346 :param userid: Merge the pull request as this user.
350 :param userid: Merge the pull request as this user.
347 :type userid: Optional(str or int)
351 :type userid: Optional(str or int)
348
352
349 Example output:
353 Example output:
350
354
351 .. code-block:: bash
355 .. code-block:: bash
352
356
353 "id": <id_given_in_input>,
357 "id": <id_given_in_input>,
354 "result": {
358 "result": {
355 "executed": "<bool>",
359 "executed": "<bool>",
356 "failure_reason": "<int>",
360 "failure_reason": "<int>",
357 "merge_commit_id": "<merge_commit_id>",
361 "merge_commit_id": "<merge_commit_id>",
358 "possible": "<bool>",
362 "possible": "<bool>",
359 "merge_ref": {
363 "merge_ref": {
360 "commit_id": "<commit_id>",
364 "commit_id": "<commit_id>",
361 "type": "<type>",
365 "type": "<type>",
362 "name": "<name>"
366 "name": "<name>"
363 }
367 }
364 },
368 },
365 "error": null
369 "error": null
366
370
367
371
368 update_pull_request
372 update_pull_request
369 -------------------
373 -------------------
370
374
371 .. py:function:: update_pull_request(apiuser, pullrequestid, repoid=<Optional:None>, title=<Optional:''>, description=<Optional:''>, reviewers=<Optional:None>, update_commits=<Optional:None>)
375 .. py:function:: update_pull_request(apiuser, pullrequestid, repoid=<Optional:None>, title=<Optional:''>, description=<Optional:''>, description_renderer=<Optional:''>, reviewers=<Optional:None>, update_commits=<Optional:None>)
372
376
373 Updates a pull request.
377 Updates a pull request.
374
378
375 :param apiuser: This is filled automatically from the |authtoken|.
379 :param apiuser: This is filled automatically from the |authtoken|.
376 :type apiuser: AuthUser
380 :type apiuser: AuthUser
377 :param repoid: Optional repository name or repository ID.
381 :param repoid: Optional repository name or repository ID.
378 :type repoid: str or int
382 :type repoid: str or int
379 :param pullrequestid: The pull request ID.
383 :param pullrequestid: The pull request ID.
380 :type pullrequestid: int
384 :type pullrequestid: int
381 :param title: Set the pull request title.
385 :param title: Set the pull request title.
382 :type title: str
386 :type title: str
383 :param description: Update pull request description.
387 :param description: Update pull request description.
384 :type description: Optional(str)
388 :type description: Optional(str)
389 :type description_renderer: Optional(str)
390 :param description_renderer: Update pull request renderer for the description.
391 It should be 'rst', 'markdown' or 'plain'
385 :param reviewers: Update pull request reviewers list with new value.
392 :param reviewers: Update pull request reviewers list with new value.
386 :type reviewers: Optional(list)
393 :type reviewers: Optional(list)
387 Accepts username strings or objects of the format:
394 Accepts username strings or objects of the format:
388
395
389 [{'username': 'nick', 'reasons': ['original author'], 'mandatory': <bool>}]
396 [{'username': 'nick', 'reasons': ['original author'], 'mandatory': <bool>}]
390
397
391 :param update_commits: Trigger update of commits for this pull request
398 :param update_commits: Trigger update of commits for this pull request
392 :type: update_commits: Optional(bool)
399 :type: update_commits: Optional(bool)
393
400
394 Example output:
401 Example output:
395
402
396 .. code-block:: bash
403 .. code-block:: bash
397
404
398 id : <id_given_in_input>
405 id : <id_given_in_input>
399 result : {
406 result : {
400 "msg": "Updated pull request `63`",
407 "msg": "Updated pull request `63`",
401 "pull_request": <pull_request_object>,
408 "pull_request": <pull_request_object>,
402 "updated_reviewers": {
409 "updated_reviewers": {
403 "added": [
410 "added": [
404 "username"
411 "username"
405 ],
412 ],
406 "removed": []
413 "removed": []
407 },
414 },
408 "updated_commits": {
415 "updated_commits": {
409 "added": [
416 "added": [
410 "<sha1_hash>"
417 "<sha1_hash>"
411 ],
418 ],
412 "common": [
419 "common": [
413 "<sha1_hash>",
420 "<sha1_hash>",
414 "<sha1_hash>",
421 "<sha1_hash>",
415 ],
422 ],
416 "removed": []
423 "removed": []
417 }
424 }
418 }
425 }
419 error : null
426 error : null
420
427
421
428
General Comments 0
You need to be logged in to leave comments. Login now