Skip to content

Commit

Permalink
fix #23
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Jun 28, 2022
1 parent df0b4a7 commit cb4bd27
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
30 changes: 30 additions & 0 deletions R/GNOpenAPIManager.R
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,36 @@ GNOpenAPIManager <- R6Class("GNOpenAPIManager",
self$ERROR(content(req))
}
return(out)
},

#'@description Publishes thumbnail based on URL
#'@param id metadata identifier
#'@param url thumbnail URL
#'@param desc thumbnail description
#'@return \code{TRUE} if published, \code{FALSE} otherwise
publishThumbnail = function(id, url, desc = ""){
out <- FALSE
self$INFO(sprintf("Publish thumbnail '%s' to record '%s'...", url, id))
path = sprintf("/api/records/%s/processes/thumbnail-add?thumbnail_url=%s&thumbnail_desc=%s&process=thumbnail-add&id=%s",
id, url, desc, id)
req <- GNUtils$POST(
url = self$getUrl(),
path = path,
token = private$getToken(), cookies = private$cookies,
user = private$user,
pwd = private$getPwd(),
content = NULL, contentType = "application/json",
verbose = self$verbose.debug
)
if(status_code(req) == 204){
self$INFO("Successfully published thumbnail!")
response <- content(req)
out <- response
}else{
self$ERROR(sprintf("Error while publishing thumbnail - %s", message_for_status(status_code(req))))
self$ERROR(content(req))
}
return(out)
}

)
Expand Down
27 changes: 26 additions & 1 deletion man/GNOpenAPIManager.Rd

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

0 comments on commit cb4bd27

Please sign in to comment.