Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patch for search issues by key using JIRA issuePicker rest API. #3

Merged
merged 1 commit into from Oct 6, 2016
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

patch for search issues by key using JIRA issuePicker rest API.

Added search_for_issue_by_key method in forked JIRA class
  • Loading branch information
Ankush M
Ankush M committed Oct 6, 2016
commit 806799380a4033d5c65e0088f2b46933d55196d3
@@ -1737,6 +1737,25 @@ def search_issues(self, jql_str, startAt=0, maxResults=50, validate_query=True,

return issues

def search_for_issues_by_key(self, search_key):
'''
Get a List of issue matching on search string.
Use issuePicker rest API to fetch Issues.
:param search_key: input from user for the issue to be found
:return: JSON response will be returned if issues found; otherwise returns, msg:No match found.
In constatn JIRA_API_ISSUE_SEARCH, showSubTasks=true and showSubTaskParent=true will get sub & parent
tasks of searched result currentJQL=' (leaving it blank) will search in the whole corpus, not just
Recently-viewed issues. which is the default. Doc is at
https://docs.atlassian.com/jira/REST/cloud/#api/2/issue-getIssuePickerResource
'''
JIRA_API_ISSUE_SEARCH = "/rest/api/2/issue/picker" \
"?showSubTasks=true&showSubTaskParent=true&currentJQL=&query="

This comment has been minimized.

@tgrrtt

tgrrtt Oct 6, 2016

All of these querystrings should be parameterized.

This comment has been minimized.

@duttly

duttly Oct 6, 2016

@tgrrtt There is no current plan to tweak the parameters, or expose them in some form. Keeping it simple for now.

search_url = "{}{}{}".format(self._options["server"], JIRA_API_ISSUE_SEARCH, search_key)
search_result = self._session.get(search_url)

This comment has been minimized.

@sirsgriffin

sirsgriffin Oct 6, 2016

Shouldn't this attempt adhere to the current convention in this module of using self._fetch_pages()?

This comment has been minimized.

@tgrrtt

tgrrtt Oct 6, 2016

I think the other search functions take pagination params.

https://docs.atlassian.com/jira/REST/cloud/#api/2/issue-getIssuePickerResource
Doesn't seem to be paginated

This comment has been minimized.

@tgrrtt

tgrrtt Oct 6, 2016

As it's not an actual "search"

This comment has been minimized.

@duttly

duttly Oct 6, 2016

Correct, no pagination. It returns N results (divided in 2 sections), we have no control of N or the split.

return search_result.json()

# Security levels
def security_level(self, id):
"""
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.