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

Get resources events #71

Open
statnmap opened this issue Jun 9, 2022 · 0 comments
Open

Get resources events #71

statnmap opened this issue Jun 9, 2022 · 0 comments

Comments

@statnmap
Copy link
Member

statnmap commented Jun 9, 2022

#' @param project_id Project id
#' @param resource_id id of the resource chosen
#' @param resource Character among "issues", "merge_requests", "epics"
#' @param event Character among "iteration", "label", "milestone", "state", "weight"
gl_resource_events <- function(project_id,
                           resource_id,
                           resource = c("issues", "merge_requests", "epics"),
                           event = c("label", "iteration", "milestone", "state", "weight"),
                           ...) {
  
  resource <- match.arg(resource)
  event <- match.arg(event)
  
  if (resource == "merge_requests" & event %in% c("iteration", "weight")) {
    stop('merge_requests can not be associated with "iteration", "weight"')
  }
  if (resource == "epics" & event %in% c("iteration", "milestone", "state", "weight")) {
    stop('epics can not be associated with "iteration", "milestone", "state", "weight"')
  }
  
    gitlab(req = paste0("projects/", project_id, "/", resource,"/", resource_id, "/resource_", event,"_events"),
           verb = httr::GET, ...)

}

Exemple

gl_resource_events(project_id = project_id, 
                               resource = "issues", 
                               resource_id = resource_id, 
                               event = "label")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant