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