-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathremoveAsset.R
38 lines (38 loc) · 1.16 KB
/
removeAsset.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#' Remove an asset
#'
#' Remove an asset of a project from the gypsum backend.
#'
#' @param project String containing the project to remove.
#' @param asset String containing the asset to remove.
#' @param url String containing the URL of the gypsum REST API.
#' @param token String containing a GitHub access token to authenticate to the gypsum REST API.
#' The token must refer to a gypsum administrator account.
#'
#' @return \code{NULL} is invisibly returned if the asset was successfully removed.
#'
#' @author Aaron Lun
#'
#' @seealso
#' \code{\link{removeProject}}, to remove a project.
#'
#' \code{\link{removeVersion}}, to remove a specific version.
#'
#' @examples
#' if (interactive()) {
#' # Mocking up a versioned asset.
#' init <- startUpload(
#' project="test-R",
#' asset="removal",
#' version="v1",
#' files=character(0),
#' probation=TRUE
#' )
#' completeUpload(init)
#'
#' removeAsset("test-R", asset="removal")
#' }
#' @export
removeAsset <- function(project, asset, url=restUrl(), token=accessToken()) {
suffix <- paste0(uenc(project), "/", uenc(asset))
request_removal(suffix, url, token)
}