diff --git a/R/ZenodoManager.R b/R/ZenodoManager.R index 150c070..449f312 100644 --- a/R/ZenodoManager.R +++ b/R/ZenodoManager.R @@ -1174,6 +1174,35 @@ ZenodoManager <- R6Class("ZenodoManager", return(out) }, + #'@description Reserves a DOI for a deposition (draft record) + #' @param record the record for which DOI has to be deleted, object of class \code{ZenodoRecord} + #'@return object of class \code{ZenodoRecord} + deleteDOI = function(record){ + request <- sprintf("records/%s/draft/pids/doi", record$id) + zenReq <- ZenodoRequest$new(private$url, "DELETE", request, data = NULL, + token = self$getToken(), + logger = self$loggerType) + zenReq$execute() + out <- NULL + if(zenReq$getStatus() == 200){ + out <- ZenodoRecord$new(obj = zenReq$getResponse()) + infoMsg = sprintf("Successful deleted DOI for record %s", record$id) + cli::cli_alert_success(infoMsg) + self$INFO(infoMsg) + }else{ + out <- zenReq$getResponse() + errMsg = sprintf("Error while deleting DOI for record %s: %s", record$id, out$message) + cli::cli_alert_danger(errMsg) + self$ERROR(errMsg) + for(error in out$errors){ + errMsg = sprintf("Error: %s - %s", error$field, error$message) + cli::cli_alert_danger(errMsg) + self$ERROR(errMsg) + } + } + return(out) + }, + #' @description Deposits a record version on Zenodo. For details about the behavior of this function, #' see \href{https://developers.zenodo.org/#new-version}{https://developers.zenodo.org/#new-version} #' @param record the record version to deposit, object of class \code{ZenodoRecord} diff --git a/man/ZenodoManager.Rd b/man/ZenodoManager.Rd index f3e61e5..707a9d8 100644 --- a/man/ZenodoManager.Rd +++ b/man/ZenodoManager.Rd @@ -119,6 +119,7 @@ Emmanuel Blondel \item \href{#method-ZenodoManager-getDepositionByConceptId}{\code{ZenodoManager$getDepositionByConceptId()}} \item \href{#method-ZenodoManager-depositRecord}{\code{ZenodoManager$depositRecord()}} \item \href{#method-ZenodoManager-reserveDOI}{\code{ZenodoManager$reserveDOI()}} +\item \href{#method-ZenodoManager-deleteDOI}{\code{ZenodoManager$deleteDOI()}} \item \href{#method-ZenodoManager-depositRecordVersion}{\code{ZenodoManager$depositRecordVersion()}} \item \href{#method-ZenodoManager-deleteRecord}{\code{ZenodoManager$deleteRecord()}} \item \href{#method-ZenodoManager-deleteRecordByDOI}{\code{ZenodoManager$deleteRecordByDOI()}} @@ -829,6 +830,26 @@ object of class \code{ZenodoRecord} } } \if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-ZenodoManager-deleteDOI}{}}} +\subsection{Method \code{deleteDOI()}}{ +Reserves a DOI for a deposition (draft record) +\subsection{Usage}{ +\if{html}{\out{
}}\preformatted{ZenodoManager$deleteDOI(record)}\if{html}{\out{
}} +} + +\subsection{Arguments}{ +\if{html}{\out{
}} +\describe{ +\item{\code{record}}{the record for which DOI has to be deleted, object of class \code{ZenodoRecord}} +} +\if{html}{\out{
}} +} +\subsection{Returns}{ +object of class \code{ZenodoRecord} +} +} +\if{html}{\out{
}} \if{html}{\out{}} \if{latex}{\out{\hypertarget{method-ZenodoManager-depositRecordVersion}{}}} \subsection{Method \code{depositRecordVersion()}}{