From 89473c54a21756d5dc2957640000e5b9aeb0a716 Mon Sep 17 00:00:00 2001 From: Kory Becker Date: Tue, 5 Jun 2018 16:22:09 -0400 Subject: [PATCH] Added support for paging to get_issues. Allows for retrieval of results beyond 50. --- R/get_functions.R | 7 +++++-- man/get_issues.Rd | 8 +++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/R/get_functions.R b/R/get_functions.R index 62de187..b4920b1 100644 --- a/R/get_functions.R +++ b/R/get_functions.R @@ -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")') @@ -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 diff --git a/man/get_issues.Rd b/man/get_issues.Rd index 6ae0c9c..e76d4bd 100644 --- a/man/get_issues.Rd +++ b/man/get_issues.Rd @@ -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} @@ -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 @@ -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")