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

Added support for paging in get_issues. #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions R/get_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ get_issues <- function(user = NULL
, jira_url = getOption("jira_url")
, jira_user = getOption("jira_user")
, jira_password = getOption("jira_password")
, verbose = getOption("jira_verbose")){
, verbose = getOption("jira_verbose")
, start = NULL){

if(is.null(jira_url))
stop('jira_url is NULL. See getOption("jira_url")')
Expand All @@ -87,7 +88,9 @@ get_issues <- function(user = NULL
url <- paste0(url, sprintf('jql=assignee="%s"', project_key))
}


if(!is.null(start))
url <- paste0(url, sprintf('&startAt=%s', start))

res <- jira_get(url = url, user = jira_user, password = jira_password, verbose = verbose)
res <- content(res, as = "parsed")
res <- res$issues
Expand Down
8 changes: 7 additions & 1 deletion man/get_issues.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
get_issues(user = NULL, project_key = getOption("jira_project"),
jira_url = getOption("jira_url"), jira_user = getOption("jira_user"),
jira_password = getOption("jira_password"),
verbose = getOption("jira_verbose"))
verbose = getOption("jira_verbose"),
start = NULL)
}
\arguments{
\item{user}{user to search for}
Expand All @@ -17,6 +18,8 @@ get_issues(user = NULL, project_key = getOption("jira_project"),
\item{jira_user}{username for authentication}

\item{jira_password}{password for authentication}

\item{start}{starting count to retrieve results at (50 per page)}
}
\value{
character vector of issues
Expand All @@ -31,6 +34,9 @@ get_issues(user = "admin")

issues <- get_issues(project = "ADM", issue = "ADM-6", verbose = T)

## Get list of issues starting at page 2.
issues <- get_issues(project = "ADM", issue = "ADM-6", verbose = T, start = 50)

## Get list of issues assigned to user
res <- get_issues(user = "admin" , project_key = getOption("jira_project"))
sapply(res, "[[", "id")
Expand Down