| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 7565bf0 commit 650b65c
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -61,31 +61,32 @@ Examples | |||
| 61 | 61 | Search for issues matching a specific string:: | |
| 62 | 62 | ||
| 63 | 63 | # global search | |
| 64 | - gl.search('issues', 'regression') | ||
| 64 | + gl.search(gitlab.SEARCH_SCOPE_GLOBAL_ISSUES, 'regression') | ||
| 65 | 65 | ||
| 66 | 66 | # group search | |
| 67 | 67 | group = gl.groups.get('mygroup') | |
| 68 | - group.search('issues', 'regression') | ||
| 68 | + group.search(gitlab.SEARCH_SCOPE_GROUP_ISSUES, 'regression') | ||
| 69 | 69 | ||
| 70 | 70 | # project search | |
| 71 | 71 | project = gl.projects.get('myproject') | |
| 72 | - project.search('issues', 'regression') | ||
| 72 | + project.search(gitlab.SEARCH_SCOPE_PROJECT_ISSUES, 'regression') | ||
| 73 | 73 | ||
| 74 | 74 | The ``search()`` methods implement the pagination support:: | |
| 75 | 75 | ||
| 76 | 76 | # get lists of 10 items, and start at page 2 | |
| 77 | - gl.search('issues', search_str, page=2, per_page=10) | ||
| 77 | + gl.search(gitlab.SEARCH_SCOPE_GLOBAL_ISSUES, search_str, page=2, per_page=10) | ||
| 78 | 78 | ||
| 79 | 79 | # get a generator that will automatically make required API calls for | |
| 80 | 80 | # pagination | |
| 81 | - for item in gl.search('issues', search_str, as_list=False): | ||
| 81 | + for item in gl.search(gitlab.SEARCH_SCOPE_GLOBAL_ISSUES, search_str, as_list=False): | ||
| 82 | 82 | do_something(item) | |
| 83 | 83 | ||
| 84 | 84 | The search API doesn't return objects, but dicts. If you need to act on | |
| 85 | 85 | objects, you need to create them explicitly:: | |
| 86 | 86 | ||
| 87 | - for item in gl.search('issues', search_str, as_list=False): | ||
| 87 | + for item in gl.search(gitlab.SEARCH_SCOPE_GLOBAL_ISSUES, search_str, as_list=False): | ||
| 88 | 88 | issue_project = gl.projects.get(item['project_id'], lazy=True) | |
| 89 | 89 | issue = issue_project.issues.get(item['iid']) | |
| 90 | 90 | issue.state = 'closed' | |
| 91 | 91 | issue.save() | |
| 92 | + | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments