@@ -7,41 +7,26 @@ Searches are based on a scope (issues, merge requests, and so on) and a search |
7 | 7 | string. The following constants are provided to represent the possible scopes: |
8 | 8 |
|
9 | 9 |
|
10 | | -* global scopes: |
| 10 | +* Shared scopes (global, group and project): |
11 | 11 |
|
12 | | - + ``gitlab.SEARCH_SCOPE_GLOBAL_PROJECTS``: ``projects`` |
13 | | - + ``gitlab.SEARCH_SCOPE_GLOBAL_ISSUES``: ``issues`` |
14 | | - + ``gitlab.SEARCH_SCOPE_GLOBAL_MERGE_REQUESTS``: ``merge_requests`` |
15 | | - + ``gitlab.SEARCH_SCOPE_GLOBAL_MILESTONES``: ``milestones`` |
16 | | - + ``gitlab.SEARCH_SCOPE_GLOBAL_SNIPPET_TITLES``: ``snippet_titles`` |
17 | | - + ``gitlab.SEARCH_SCOPE_GLOBAL_WIKI_BLOBS``: ``wiki_blobs`` |
18 | | - + ``gitlab.SEARCH_SCOPE_GLOBAL_COMMITS``: ``commits`` |
19 | | - + ``gitlab.SEARCH_SCOPE_GLOBAL_BLOBS``: ``blobs`` |
20 | | - + ``gitlab.SEARCH_SCOPE_GLOBAL_USERS``: ``users`` |
| 12 | + + ``gitlab.SEARCH_SCOPE_PROJECTS``: ``projects`` |
| 13 | + + ``gitlab.SEARCH_SCOPE_ISSUES``: ``issues`` |
| 14 | + + ``gitlab.SEARCH_SCOPE_MERGE_REQUESTS``: ``merge_requests`` |
| 15 | + + ``gitlab.SEARCH_SCOPE_MILESTONES``: ``milestones`` |
| 16 | + + ``gitlab.SEARCH_SCOPE_WIKI_BLOBS``: ``wiki_blobs`` |
| 17 | + + ``gitlab.SEARCH_SCOPE_COMMITS``: ``commits`` |
| 18 | + + ``gitlab.SEARCH_SCOPE_BLOBS``: ``blobs`` |
| 19 | + + ``gitlab.SEARCH_SCOPE_USERS``: ``users`` |
21 | 20 |
|
22 | 21 |
|
23 | | -* group scopes: |
| 22 | +* specific global scope: |
24 | 23 |
|
25 | | - + ``gitlab.SEARCH_SCOPE_GROUP_PROJECTS``: ``projects`` |
26 | | - + ``gitlab.SEARCH_SCOPE_GROUP_ISSUES``: ``issues`` |
27 | | - + ``gitlab.SEARCH_SCOPE_GROUP_MERGE_REQUESTS``: ``merge_requests`` |
28 | | - + ``gitlab.SEARCH_SCOPE_GROUP_MILESTONES``: ``milestones`` |
29 | | - + ``gitlab.SEARCH_SCOPE_GROUP_WIKI_BLOBS``: ``wiki_blobs`` |
30 | | - + ``gitlab.SEARCH_SCOPE_GROUP_COMMITS``: ``commits`` |
31 | | - + ``gitlab.SEARCH_SCOPE_GROUP_BLOBS``: ``blobs`` |
32 | | - + ``gitlab.SEARCH_SCOPE_GROUP_USERS``: ``users`` |
| 24 | + + ``gitlab.SEARCH_SCOPE_GLOBAL_SNIPPET_TITLES``: ``snippet_titles`` |
33 | 25 |
|
34 | 26 |
|
35 | | -* project scopes: |
| 27 | +* specific project scope: |
36 | 28 |
|
37 | | - + ``gitlab.SEARCH_SCOPE_PROJECT_ISSUES``: ``issues`` |
38 | | - + ``gitlab.SEARCH_SCOPE_PROJECT_MERGE_REQUESTS``: ``merge_requests`` |
39 | | - + ``gitlab.SEARCH_SCOPE_PROJECT_MILESTONES``: ``milestones`` |
40 | 29 | + ``gitlab.SEARCH_SCOPE_PROJECT_NOTES``: ``notes`` |
41 | | - + ``gitlab.SEARCH_SCOPE_PROJECT_WIKI_BLOBS``: ``wiki_blobs`` |
42 | | - + ``gitlab.SEARCH_SCOPE_PROJECT_COMMITS``: ``commits`` |
43 | | - + ``gitlab.SEARCH_SCOPE_PROJECT_BLOBS``: ``blobs`` |
44 | | - + ``gitlab.SEARCH_SCOPE_PROJECT_USERS``: ``users`` |
45 | 30 |
|
46 | 31 |
|
47 | 32 | Reference |
@@ -61,30 +46,30 @@ Examples |
61 | 46 | Search for issues matching a specific string:: |
62 | 47 |
|
63 | 48 | # global search |
64 | | - gl.search(gitlab.SEARCH_SCOPE_GLOBAL_ISSUES, 'regression') |
| 49 | + gl.search(gitlab.SEARCH_SCOPE_ISSUES, 'regression') |
65 | 50 |
|
66 | 51 | # group search |
67 | 52 | group = gl.groups.get('mygroup') |
68 | | - group.search(gitlab.SEARCH_SCOPE_GROUP_ISSUES, 'regression') |
| 53 | + group.search(gitlab.SEARCH_SCOPE_ISSUES, 'regression') |
69 | 54 |
|
70 | 55 | # project search |
71 | 56 | project = gl.projects.get('myproject') |
72 | | - project.search(gitlab.SEARCH_SCOPE_PROJECT_ISSUES, 'regression') |
| 57 | + project.search(gitlab.SEARCH_SCOPE_ISSUES, 'regression') |
73 | 58 |
|
74 | 59 | The ``search()`` methods implement the pagination support:: |
75 | 60 |
|
76 | 61 | # get lists of 10 items, and start at page 2 |
77 | | - gl.search(gitlab.SEARCH_SCOPE_GLOBAL_ISSUES, search_str, page=2, per_page=10) |
| 62 | + gl.search(gitlab.SEARCH_SCOPE_ISSUES, search_str, page=2, per_page=10) |
78 | 63 |
|
79 | 64 | # get a generator that will automatically make required API calls for |
80 | 65 | # pagination |
81 | | - for item in gl.search(gitlab.SEARCH_SCOPE_GLOBAL_ISSUES, search_str, as_list=False): |
| 66 | + for item in gl.search(gitlab.SEARCH_SCOPE_ISSUES, search_str, as_list=False): |
82 | 67 | do_something(item) |
83 | 68 |
|
84 | 69 | The search API doesn't return objects, but dicts. If you need to act on |
85 | 70 | objects, you need to create them explicitly:: |
86 | 71 |
|
87 | | - for item in gl.search(gitlab.SEARCH_SCOPE_GLOBAL_ISSUES, search_str, as_list=False): |
| 72 | + for item in gl.search(gitlab.SEARCH_SCOPE_ISSUES, search_str, as_list=False): |
88 | 73 | issue_project = gl.projects.get(item['project_id'], lazy=True) |
89 | 74 | issue = issue_project.issues.get(item['iid']) |
90 | 75 | issue.state = 'closed' |
|