Skip to content

Commit

Permalink
#135 getFile (metadata)
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Oct 18, 2023
1 parent cafc089 commit a12fe11
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
18 changes: 18 additions & 0 deletions R/ZenodoManager.R
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,24 @@ ZenodoManager <- R6Class("ZenodoManager",
return(out)
},

#' @description Get a file record metadata.
#' @param recordId the ID of the record.
#' @param filename filename
#' @return the file metadata
getFile = function(recordId, filename){
zenReq <- ZenodoRequest$new(private$url, "GET", sprintf("records/%s/draft/files/%s", recordId, filename),
token = self$getToken(),
logger = self$loggerType)
zenReq$execute()
out <- zenReq$getResponse()
if(zenReq$getStatus() == 200){
self$INFO(sprintf("Successful fetched file metadata for record '%s' - filename '%s'", recordId, filename))
}else{
self$ERROR(sprintf("Error while fetching file(s) for record '%s': %s", recordId, out$message))
}
return(out)
},

#' @description Start a file upload. The method will create a key for the file to be uploaded
#' This method is essentially for internal purpose, and is called directly in \code{uploadFile}
#' for user convenience and for backward compatibility with the legacy Zenodo API.
Expand Down
23 changes: 23 additions & 0 deletions man/ZenodoManager.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a12fe11

Please sign in to comment.