From df0b4a75ed2e4dca412241ea770423e91f7ac9ab Mon Sep 17 00:00:00 2001 From: eblondel Date: Mon, 27 Jun 2022 09:32:09 +0200 Subject: [PATCH] #15 support attachment upload --- DESCRIPTION | 6 +- R/GNOpenAPIManager.R | 39 ++++++++++- README.md | 2 +- man/GNAbstractManager.Rd | 60 ++++++++--------- man/GNLegacyAPIManager.Rd | 120 +++++++++++++++++----------------- man/GNManager.Rd | 44 ++++++------- man/GNOpenAPIManager.Rd | 128 +++++++++++++++++++++++-------------- man/GNPrivConfiguration.Rd | 32 +++++----- man/GNRESTRequest.Rd | 24 +++---- man/GNUtils.Rd | 6 +- man/GNVersion.Rd | 30 ++++----- 11 files changed, 279 insertions(+), 212 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index b73e227..b848598 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: geonapi Type: Package Title: 'GeoNetwork' API R Interface -Version: 0.5-3 -Date: 2022-02-21 +Version: 0.6 +Date: 2022-06-27 Authors@R: c(person("Emmanuel", "Blondel", role = c("aut", "cre"), email = "emmanuel.blondel1@gmail.com", comment = c(ORCID = "0000-0002-5870-5762"))) Maintainer: Emmanuel Blondel Description: Provides an R interface to the 'GeoNetwork' API () allowing to upload and publish metadata in a 'GeoNetwork' web-application and expose it to OGC CSW. @@ -13,4 +13,4 @@ License: MIT + file LICENSE URL: https://github.com/eblondel/geonapi/wiki, https://geonetwork-opensource.org BugReports: https://github.com/eblondel/geonapi/issues LazyLoad: yes -RoxygenNote: 7.1.0 +RoxygenNote: 7.2.0 diff --git a/R/GNOpenAPIManager.R b/R/GNOpenAPIManager.R index 65a1dda..6f3c341 100644 --- a/R/GNOpenAPIManager.R +++ b/R/GNOpenAPIManager.R @@ -423,8 +423,45 @@ GNOpenAPIManager <- R6Class("GNOpenAPIManager", self$ERROR(content(req)) } return(out) + }, + + #'@description Uploads attachment + #'@param id metadata identifier + #'@param file file to upload + #'@param visibility public or private + #'@param approved object of class \code{logical} + #'@return a named list of the uploaded attachment, including the url, size, id and type, \code{NULL} otherwise + uploadAttachment = function(id, file, visibility = "public", approved = TRUE){ + out <- NULL + self$INFO(sprintf("Attach file '%s' to record '%s'...", file, id)) + path = sprintf("/api/records/%s/attachments?visibility=%s&approved=%s", id, visibility, approved) + req <- GNUtils$POST( + url = self$getUrl(), + path = path, + token = private$getToken(), cookies = private$cookies, + user = private$user, + pwd = private$getPwd(), + content = list( + file = httr::upload_file(file) + ), + contentType = "multipart/form-data", + encode = "multipart", + verbose = self$verbose.debug + ) + if(status_code(req) == 201){ + self$INFO("Successfully uploaded attachment!") + response <- content(req, "parsed") + out <- response + if(startsWith(out$url, "http://localhost:8080")){ + out$url <- gsub("http://localhost:8080", paste0(unlist(strsplit(GN$getUrl(), "/"))[1:3],collapse="/"), out$url) + } + }else{ + self$ERROR(sprintf("Error while uploading attachment - %s", message_for_status(status_code(req)))) + self$ERROR(content(req)) + } + return(out) } - + ) ) diff --git a/README.md b/README.md index e627a73..111f93f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ =========== [![Build Status](https://github.com/eblondel/geonapi/actions/workflows/r-cmd-check.yml/badge.svg?branch=master)](https://github.com/eblondel/geonapi/actions/workflows/r-cmd-check.yml) -[![Github_Status_Badge](https://img.shields.io/badge/Github-0.5--3-blue.svg)](https://github.com/eblondel/geonapi) +[![Github_Status_Badge](https://img.shields.io/badge/Github-0.6-blue.svg)](https://github.com/eblondel/geonapi) [![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/geonapi)](https://cran.r-project.org/package=geonapi) [![CRAN checks](https://cranchecks.info/badges/worst/geonapi)](https://cran.r-project.org/web/checks/check_results_geonapi.html) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1345012.svg)](https://doi.org/10.5281/zenodo.1345012) diff --git a/man/GNAbstractManager.Rd b/man/GNAbstractManager.Rd index f0030e2..e2c529b 100644 --- a/man/GNAbstractManager.Rd +++ b/man/GNAbstractManager.Rd @@ -44,21 +44,21 @@ Emmanuel Blondel \section{Methods}{ \subsection{Public methods}{ \itemize{ -\item \href{#method-logger}{\code{GNAbstractManager$logger()}} -\item \href{#method-INFO}{\code{GNAbstractManager$INFO()}} -\item \href{#method-WARN}{\code{GNAbstractManager$WARN()}} -\item \href{#method-ERROR}{\code{GNAbstractManager$ERROR()}} -\item \href{#method-new}{\code{GNAbstractManager$new()}} -\item \href{#method-getUrl}{\code{GNAbstractManager$getUrl()}} -\item \href{#method-getLang}{\code{GNAbstractManager$getLang()}} -\item \href{#method-login}{\code{GNAbstractManager$login()}} -\item \href{#method-getClassName}{\code{GNAbstractManager$getClassName()}} -\item \href{#method-clone}{\code{GNAbstractManager$clone()}} +\item \href{#method-GNAbstractManager-logger}{\code{GNAbstractManager$logger()}} +\item \href{#method-GNAbstractManager-INFO}{\code{GNAbstractManager$INFO()}} +\item \href{#method-GNAbstractManager-WARN}{\code{GNAbstractManager$WARN()}} +\item \href{#method-GNAbstractManager-ERROR}{\code{GNAbstractManager$ERROR()}} +\item \href{#method-GNAbstractManager-new}{\code{GNAbstractManager$new()}} +\item \href{#method-GNAbstractManager-getUrl}{\code{GNAbstractManager$getUrl()}} +\item \href{#method-GNAbstractManager-getLang}{\code{GNAbstractManager$getLang()}} +\item \href{#method-GNAbstractManager-login}{\code{GNAbstractManager$login()}} +\item \href{#method-GNAbstractManager-getClassName}{\code{GNAbstractManager$getClassName()}} +\item \href{#method-GNAbstractManager-clone}{\code{GNAbstractManager$clone()}} } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-logger}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNAbstractManager-logger}{}}} \subsection{Method \code{logger()}}{ Provides log messages \subsection{Usage}{ @@ -76,8 +76,8 @@ Provides log messages } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-INFO}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNAbstractManager-INFO}{}}} \subsection{Method \code{INFO()}}{ Provides INFO log messages \subsection{Usage}{ @@ -93,8 +93,8 @@ Provides INFO log messages } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-WARN}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNAbstractManager-WARN}{}}} \subsection{Method \code{WARN()}}{ Provides WARN log messages \subsection{Usage}{ @@ -110,8 +110,8 @@ Provides WARN log messages } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-ERROR}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNAbstractManager-ERROR}{}}} \subsection{Method \code{ERROR()}}{ Provides ERROR log messages \subsection{Usage}{ @@ -127,8 +127,8 @@ Provides ERROR log messages } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-new}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNAbstractManager-new}{}}} \subsection{Method \code{new()}}{ This method is used to instantiate a \link{GNAbstractManager} with the \code{url} of the GeoNetwork and credentials to authenticate (\code{user}/\code{pwd}). By default, @@ -169,8 +169,8 @@ This method is used to instantiate a \link{GNAbstractManager} with the \code{url } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-getUrl}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNAbstractManager-getUrl}{}}} \subsection{Method \code{getUrl()}}{ Get URL \subsection{Usage}{ @@ -182,8 +182,8 @@ an object of class \code{character} } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-getLang}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNAbstractManager-getLang}{}}} \subsection{Method \code{getLang()}}{ Get service language \subsection{Usage}{ @@ -195,8 +195,8 @@ an object of class \code{character} } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-login}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNAbstractManager-login}{}}} \subsection{Method \code{login()}}{ Log-ins. This methods (here abstract) attempts a connection to GeoNetwork API. Used internally by subclasses of \link{GNAbstractManager} to login Geonetwork. @@ -215,8 +215,8 @@ Log-ins. This methods (here abstract) attempts a connection to GeoNetwork API. U } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-getClassName}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNAbstractManager-getClassName}{}}} \subsection{Method \code{getClassName()}}{ Get class name \subsection{Usage}{ @@ -228,8 +228,8 @@ an object of class \code{character} } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-clone}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNAbstractManager-clone}{}}} \subsection{Method \code{clone()}}{ The objects of this class are cloneable with this method. \subsection{Usage}{ diff --git a/man/GNLegacyAPIManager.Rd b/man/GNLegacyAPIManager.Rd index 23df660..23f2dac 100644 --- a/man/GNLegacyAPIManager.Rd +++ b/man/GNLegacyAPIManager.Rd @@ -34,39 +34,39 @@ Emmanuel Blondel \section{Methods}{ \subsection{Public methods}{ \itemize{ -\item \href{#method-new}{\code{GNLegacyAPIManager$new()}} -\item \href{#method-login}{\code{GNLegacyAPIManager$login()}} -\item \href{#method-getGroups}{\code{GNLegacyAPIManager$getGroups()}} -\item \href{#method-getCategories}{\code{GNLegacyAPIManager$getCategories()}} -\item \href{#method-insertMetadata}{\code{GNLegacyAPIManager$insertMetadata()}} -\item \href{#method-setPrivConfiguration}{\code{GNLegacyAPIManager$setPrivConfiguration()}} -\item \href{#method-get}{\code{GNLegacyAPIManager$get()}} -\item \href{#method-getMetadataByID}{\code{GNLegacyAPIManager$getMetadataByID()}} -\item \href{#method-getMetadataByUUID}{\code{GNLegacyAPIManager$getMetadataByUUID()}} -\item \href{#method-getInfoByID}{\code{GNLegacyAPIManager$getInfoByID()}} -\item \href{#method-getInfoByUUID}{\code{GNLegacyAPIManager$getInfoByUUID()}} -\item \href{#method-updateMetadata}{\code{GNLegacyAPIManager$updateMetadata()}} -\item \href{#method-deleteMetadata}{\code{GNLegacyAPIManager$deleteMetadata()}} -\item \href{#method-deleteMetadataAll}{\code{GNLegacyAPIManager$deleteMetadataAll()}} -\item \href{#method-clone}{\code{GNLegacyAPIManager$clone()}} -} -} -\if{html}{ -\out{
Inherited methods} -\itemize{ -\item \out{}\href{../../geonapi/html/GNAbstractManager.html#method-ERROR}{\code{geonapi::GNAbstractManager$ERROR()}}\out{} -\item \out{}\href{../../geonapi/html/GNAbstractManager.html#method-getClassName}{\code{geonapi::GNAbstractManager$getClassName()}}\out{} -\item \out{}\href{../../geonapi/html/GNAbstractManager.html#method-getLang}{\code{geonapi::GNAbstractManager$getLang()}}\out{} -\item \out{}\href{../../geonapi/html/GNAbstractManager.html#method-getUrl}{\code{geonapi::GNAbstractManager$getUrl()}}\out{} -\item \out{}\href{../../geonapi/html/GNAbstractManager.html#method-INFO}{\code{geonapi::GNAbstractManager$INFO()}}\out{} -\item \out{}\href{../../geonapi/html/GNAbstractManager.html#method-logger}{\code{geonapi::GNAbstractManager$logger()}}\out{} -\item \out{}\href{../../geonapi/html/GNAbstractManager.html#method-WARN}{\code{geonapi::GNAbstractManager$WARN()}}\out{} -} -\out{
} -} +\item \href{#method-GNLegacyAPIManager-new}{\code{GNLegacyAPIManager$new()}} +\item \href{#method-GNLegacyAPIManager-login}{\code{GNLegacyAPIManager$login()}} +\item \href{#method-GNLegacyAPIManager-getGroups}{\code{GNLegacyAPIManager$getGroups()}} +\item \href{#method-GNLegacyAPIManager-getCategories}{\code{GNLegacyAPIManager$getCategories()}} +\item \href{#method-GNLegacyAPIManager-insertMetadata}{\code{GNLegacyAPIManager$insertMetadata()}} +\item \href{#method-GNLegacyAPIManager-setPrivConfiguration}{\code{GNLegacyAPIManager$setPrivConfiguration()}} +\item \href{#method-GNLegacyAPIManager-get}{\code{GNLegacyAPIManager$get()}} +\item \href{#method-GNLegacyAPIManager-getMetadataByID}{\code{GNLegacyAPIManager$getMetadataByID()}} +\item \href{#method-GNLegacyAPIManager-getMetadataByUUID}{\code{GNLegacyAPIManager$getMetadataByUUID()}} +\item \href{#method-GNLegacyAPIManager-getInfoByID}{\code{GNLegacyAPIManager$getInfoByID()}} +\item \href{#method-GNLegacyAPIManager-getInfoByUUID}{\code{GNLegacyAPIManager$getInfoByUUID()}} +\item \href{#method-GNLegacyAPIManager-updateMetadata}{\code{GNLegacyAPIManager$updateMetadata()}} +\item \href{#method-GNLegacyAPIManager-deleteMetadata}{\code{GNLegacyAPIManager$deleteMetadata()}} +\item \href{#method-GNLegacyAPIManager-deleteMetadataAll}{\code{GNLegacyAPIManager$deleteMetadataAll()}} +\item \href{#method-GNLegacyAPIManager-clone}{\code{GNLegacyAPIManager$clone()}} +} +} +\if{html}{\out{ +
Inherited methods + +
+}} \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-new}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNLegacyAPIManager-new}{}}} \subsection{Method \code{new()}}{ This method is used to instantiate a GNLegacyAPIManager with the \code{url} of the GeoNetwork and credentials to authenticate (\code{user}/\code{pwd}). @@ -106,8 +106,8 @@ This method is used to instantiate a GNLegacyAPIManager with the \code{url} of t } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-login}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNLegacyAPIManager-login}{}}} \subsection{Method \code{login()}}{ #' This methods attempts a connection to GeoNetwork REST API. User internally during initialization of \code{GNLegacyAPIManager}. @@ -126,8 +126,8 @@ This method is used to instantiate a GNLegacyAPIManager with the \code{url} of t } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-getGroups}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNLegacyAPIManager-getGroups}{}}} \subsection{Method \code{getGroups()}}{ Retrieves the list of user groups available in Geonetwork \subsection{Usage}{ @@ -139,8 +139,8 @@ an object of class \code{data.frame} } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-getCategories}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNLegacyAPIManager-getCategories}{}}} \subsection{Method \code{getCategories()}}{ Retrieves the list of categories available in Geonetwork \subsection{Usage}{ @@ -152,8 +152,8 @@ an object of class \code{data.frame} } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-insertMetadata}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNLegacyAPIManager-insertMetadata}{}}} \subsection{Method \code{insertMetadata()}}{ Inserts a metadata by file, XML object or \pkg{geometa} object of class \code{ISOMetadata} or \code{ISOFeatureCatalogue}. If successful, returns the Geonetwork @@ -204,8 +204,8 @@ Inserts a metadata by file, XML object or \pkg{geometa} object of class } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-setPrivConfiguration}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNLegacyAPIManager-setPrivConfiguration}{}}} \subsection{Method \code{setPrivConfiguration()}}{ Set the privilege configuration for a metadata. 'id' is the metadata integer id. 'config' is an object of class "GNPrivConfiguration". @@ -224,8 +224,8 @@ Set the privilege configuration for a metadata. 'id' is the metadata integer id. } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-get}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNLegacyAPIManager-get}{}}} \subsection{Method \code{get()}}{ Generic getter for metadata. Possible values for by are 'id', 'uuid'. Used internally only. The 'output' argument gives the type of output to return, @@ -247,8 +247,8 @@ Generic getter for metadata. Possible values for by are 'id', 'uuid'. Used } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-getMetadataByID}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNLegacyAPIManager-getMetadataByID}{}}} \subsection{Method \code{getMetadataByID()}}{ Get a metadata by Id \subsection{Usage}{ @@ -268,8 +268,8 @@ an object of class \code{ISOMetadata} (ISO 19115) or \code{ISOFeatureCatalogue} } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-getMetadataByUUID}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNLegacyAPIManager-getMetadataByUUID}{}}} \subsection{Method \code{getMetadataByUUID()}}{ Get a metadata by UUID \subsection{Usage}{ @@ -289,8 +289,8 @@ an object of class \code{ISOMetadata} (ISO 19115) or \code{ISOFeatureCatalogue} } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-getInfoByID}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNLegacyAPIManager-getInfoByID}{}}} \subsection{Method \code{getInfoByID()}}{ Get a metadata Info by Id. \subsection{Usage}{ @@ -309,8 +309,8 @@ an XML document object } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-getInfoByUUID}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNLegacyAPIManager-getInfoByUUID}{}}} \subsection{Method \code{getInfoByUUID()}}{ Get a metadata Info by UUID \subsection{Usage}{ @@ -329,8 +329,8 @@ an XML document object } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-updateMetadata}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNLegacyAPIManager-updateMetadata}{}}} \subsection{Method \code{updateMetadata()}}{ Updates a metadata by file, XML object or \pkg{geometa} object of class 'ISOMetadata' or 'ISOFeatureCatalogue'. Extra parameters \code{geometa_validate} (TRUE @@ -371,8 +371,8 @@ Updates a metadata by file, XML object or \pkg{geometa} object of class } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-deleteMetadata}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNLegacyAPIManager-deleteMetadata}{}}} \subsection{Method \code{deleteMetadata()}}{ Deletes metadata by Id. \subsection{Usage}{ @@ -391,8 +391,8 @@ the id of the record deleted, \code{NULL} otherwise } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-deleteMetadataAll}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNLegacyAPIManager-deleteMetadataAll}{}}} \subsection{Method \code{deleteMetadataAll()}}{ Deletes all metadata \subsection{Usage}{ @@ -401,8 +401,8 @@ Deletes all metadata } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-clone}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNLegacyAPIManager-clone}{}}} \subsection{Method \code{clone()}}{ The objects of this class are cloneable with this method. \subsection{Usage}{ diff --git a/man/GNManager.Rd b/man/GNManager.Rd index 9352fc1..717c7b9 100644 --- a/man/GNManager.Rd +++ b/man/GNManager.Rd @@ -37,27 +37,27 @@ Emmanuel Blondel \section{Methods}{ \subsection{Public methods}{ \itemize{ -\item \href{#method-new}{\code{GNManager$new()}} -\item \href{#method-clone}{\code{GNManager$clone()}} -} -} -\if{html}{ -\out{
Inherited methods} -\itemize{ -\item \out{}\href{../../geonapi/html/GNAbstractManager.html#method-ERROR}{\code{geonapi::GNAbstractManager$ERROR()}}\out{} -\item \out{}\href{../../geonapi/html/GNAbstractManager.html#method-getClassName}{\code{geonapi::GNAbstractManager$getClassName()}}\out{} -\item \out{}\href{../../geonapi/html/GNAbstractManager.html#method-getLang}{\code{geonapi::GNAbstractManager$getLang()}}\out{} -\item \out{}\href{../../geonapi/html/GNAbstractManager.html#method-getUrl}{\code{geonapi::GNAbstractManager$getUrl()}}\out{} -\item \out{}\href{../../geonapi/html/GNAbstractManager.html#method-INFO}{\code{geonapi::GNAbstractManager$INFO()}}\out{} -\item \out{}\href{../../geonapi/html/GNAbstractManager.html#method-logger}{\code{geonapi::GNAbstractManager$logger()}}\out{} -\item \out{}\href{../../geonapi/html/GNAbstractManager.html#method-login}{\code{geonapi::GNAbstractManager$login()}}\out{} -\item \out{}\href{../../geonapi/html/GNAbstractManager.html#method-WARN}{\code{geonapi::GNAbstractManager$WARN()}}\out{} -} -\out{
} -} +\item \href{#method-GNManager-new}{\code{GNManager$new()}} +\item \href{#method-GNManager-clone}{\code{GNManager$clone()}} +} +} +\if{html}{\out{ +
Inherited methods + +
+}} \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-new}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNManager-new}{}}} \subsection{Method \code{new()}}{ Initializes a \link{GNManager} \subsection{Usage}{ @@ -81,8 +81,8 @@ Initializes a \link{GNManager} } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-clone}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNManager-clone}{}}} \subsection{Method \code{clone()}}{ The objects of this class are cloneable with this method. \subsection{Usage}{ diff --git a/man/GNOpenAPIManager.Rd b/man/GNOpenAPIManager.Rd index 9b564e3..fea53e4 100644 --- a/man/GNOpenAPIManager.Rd +++ b/man/GNOpenAPIManager.Rd @@ -34,35 +34,36 @@ Emmanuel Blondel \section{Methods}{ \subsection{Public methods}{ \itemize{ -\item \href{#method-new}{\code{GNOpenAPIManager$new()}} -\item \href{#method-login}{\code{GNOpenAPIManager$login()}} -\item \href{#method-getGroups}{\code{GNOpenAPIManager$getGroups()}} -\item \href{#method-getTags}{\code{GNOpenAPIManager$getTags()}} -\item \href{#method-getCategories}{\code{GNOpenAPIManager$getCategories()}} -\item \href{#method-getMetadataByUUID}{\code{GNOpenAPIManager$getMetadataByUUID()}} -\item \href{#method-insertRecord}{\code{GNOpenAPIManager$insertRecord()}} -\item \href{#method-insertMetadata}{\code{GNOpenAPIManager$insertMetadata()}} -\item \href{#method-updateMetadata}{\code{GNOpenAPIManager$updateMetadata()}} -\item \href{#method-deleteMetadata}{\code{GNOpenAPIManager$deleteMetadata()}} -\item \href{#method-clone}{\code{GNOpenAPIManager$clone()}} -} -} -\if{html}{ -\out{
Inherited methods} -\itemize{ -\item \out{}\href{../../geonapi/html/GNAbstractManager.html#method-ERROR}{\code{geonapi::GNAbstractManager$ERROR()}}\out{} -\item \out{}\href{../../geonapi/html/GNAbstractManager.html#method-getClassName}{\code{geonapi::GNAbstractManager$getClassName()}}\out{} -\item \out{}\href{../../geonapi/html/GNAbstractManager.html#method-getLang}{\code{geonapi::GNAbstractManager$getLang()}}\out{} -\item \out{}\href{../../geonapi/html/GNAbstractManager.html#method-getUrl}{\code{geonapi::GNAbstractManager$getUrl()}}\out{} -\item \out{}\href{../../geonapi/html/GNAbstractManager.html#method-INFO}{\code{geonapi::GNAbstractManager$INFO()}}\out{} -\item \out{}\href{../../geonapi/html/GNAbstractManager.html#method-logger}{\code{geonapi::GNAbstractManager$logger()}}\out{} -\item \out{}\href{../../geonapi/html/GNAbstractManager.html#method-WARN}{\code{geonapi::GNAbstractManager$WARN()}}\out{} -} -\out{
} -} +\item \href{#method-GNOpenAPIManager-new}{\code{GNOpenAPIManager$new()}} +\item \href{#method-GNOpenAPIManager-login}{\code{GNOpenAPIManager$login()}} +\item \href{#method-GNOpenAPIManager-getGroups}{\code{GNOpenAPIManager$getGroups()}} +\item \href{#method-GNOpenAPIManager-getTags}{\code{GNOpenAPIManager$getTags()}} +\item \href{#method-GNOpenAPIManager-getCategories}{\code{GNOpenAPIManager$getCategories()}} +\item \href{#method-GNOpenAPIManager-getMetadataByUUID}{\code{GNOpenAPIManager$getMetadataByUUID()}} +\item \href{#method-GNOpenAPIManager-insertRecord}{\code{GNOpenAPIManager$insertRecord()}} +\item \href{#method-GNOpenAPIManager-insertMetadata}{\code{GNOpenAPIManager$insertMetadata()}} +\item \href{#method-GNOpenAPIManager-updateMetadata}{\code{GNOpenAPIManager$updateMetadata()}} +\item \href{#method-GNOpenAPIManager-deleteMetadata}{\code{GNOpenAPIManager$deleteMetadata()}} +\item \href{#method-GNOpenAPIManager-uploadAttachment}{\code{GNOpenAPIManager$uploadAttachment()}} +\item \href{#method-GNOpenAPIManager-clone}{\code{GNOpenAPIManager$clone()}} +} +} +\if{html}{\out{ +
Inherited methods + +
+}} \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-new}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNOpenAPIManager-new}{}}} \subsection{Method \code{new()}}{ This method is used to instantiate a \code{GNOpenAPIManager} with the \code{url} of the GeoNetwork and credentials to authenticate (\code{user}/\code{pwd}). @@ -102,8 +103,8 @@ This method is used to instantiate a \code{GNOpenAPIManager} with the \code{url} } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-login}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNOpenAPIManager-login}{}}} \subsection{Method \code{login()}}{ This methods attempts a connection to GeoNetwork REST API. User internally during initialization of \code{GNLegacyAPIManager}. @@ -122,8 +123,8 @@ This methods attempts a connection to GeoNetwork REST API. User internally } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-getGroups}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNOpenAPIManager-getGroups}{}}} \subsection{Method \code{getGroups()}}{ Retrieves the list of user groups available in Geonetwork \subsection{Usage}{ @@ -135,8 +136,8 @@ an object of class \code{data.frame} } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-getTags}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNOpenAPIManager-getTags}{}}} \subsection{Method \code{getTags()}}{ Retrieves the list of tags (categories) available in Geonetwork \subsection{Usage}{ @@ -148,8 +149,8 @@ an object of class \code{data.frame} } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-getCategories}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNOpenAPIManager-getCategories}{}}} \subsection{Method \code{getCategories()}}{ Retrieves the list of categories (same as tags) available in Geonetwork \subsection{Usage}{ @@ -161,8 +162,8 @@ an object of class \code{data.frame} } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-getMetadataByUUID}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNOpenAPIManager-getMetadataByUUID}{}}} \subsection{Method \code{getMetadataByUUID()}}{ Get a metadata by UUID. \subsection{Usage}{ @@ -193,8 +194,8 @@ or \code{ISOFeatureCatalogue} (ISO 19110) (from \pkg{geometa} package) } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-insertRecord}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNOpenAPIManager-insertRecord}{}}} \subsection{Method \code{insertRecord()}}{ Inserts a record by file, XML object or \pkg{geometa} object of class \code{ISOMetadata} or \code{ISOFeatureCatalogue}. Extra parameters related to \pkg{geometa} objects: \code{geometa_validate} (TRUE by default) and \code{geometa_inspire} @@ -258,8 +259,8 @@ Inserts a record by file, XML object or \pkg{geometa} object of class \code{ISOM } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-insertMetadata}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNOpenAPIManager-insertMetadata}{}}} \subsection{Method \code{insertMetadata()}}{ Inserts a metadata by file, XML object or \pkg{geometa} object of class \code{ISOMetadata} or \code{ISOFeatureCatalogue}. Extra parameters related to \pkg{geometa} objects: \code{geometa_validate} (TRUE by default) and \code{geometa_inspire} @@ -323,8 +324,8 @@ Inserts a metadata by file, XML object or \pkg{geometa} object of class \code{IS } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-updateMetadata}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNOpenAPIManager-updateMetadata}{}}} \subsection{Method \code{updateMetadata()}}{ Inserts a metadata by file, XML object or \pkg{geometa} object of class \code{ISOMetadata} or \code{ISOFeatureCatalogue}. Extra parameters related to \pkg{geometa} objects: \code{geometa_validate} (TRUE by default) and \code{geometa_inspire} @@ -385,8 +386,8 @@ Inserts a metadata by file, XML object or \pkg{geometa} object of class \code{IS } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-deleteMetadata}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNOpenAPIManager-deleteMetadata}{}}} \subsection{Method \code{deleteMetadata()}}{ Deletes a metadata by ID \subsection{Usage}{ @@ -404,8 +405,39 @@ Deletes a metadata by ID } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-clone}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNOpenAPIManager-uploadAttachment}{}}} +\subsection{Method \code{uploadAttachment()}}{ +Uploads attachment +\subsection{Usage}{ +\if{html}{\out{
}}\preformatted{GNOpenAPIManager$uploadAttachment( + id, + file, + visibility = "public", + approved = TRUE +)}\if{html}{\out{
}} +} + +\subsection{Arguments}{ +\if{html}{\out{
}} +\describe{ +\item{\code{id}}{metadata identifier} + +\item{\code{file}}{file to upload} + +\item{\code{visibility}}{public or private} + +\item{\code{approved}}{object of class \code{logical}} +} +\if{html}{\out{
}} +} +\subsection{Returns}{ +the URL of the uploaded attachment, \code{NULL} otherwise +} +} +\if{html}{\out{
}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNOpenAPIManager-clone}{}}} \subsection{Method \code{clone()}}{ The objects of this class are cloneable with this method. \subsection{Usage}{ diff --git a/man/GNPrivConfiguration.Rd b/man/GNPrivConfiguration.Rd index 7a81116..54b8c71 100644 --- a/man/GNPrivConfiguration.Rd +++ b/man/GNPrivConfiguration.Rd @@ -37,8 +37,6 @@ GeoNetwork REST API - GeoNetwork privilege configuration } \author{ -Emmanuel Blondel - Emmanuel Blondel } \keyword{GeoNetwork} @@ -56,13 +54,13 @@ Emmanuel Blondel \section{Methods}{ \subsection{Public methods}{ \itemize{ -\item \href{#method-new}{\code{GNPriv$new()}} -\item \href{#method-clone}{\code{GNPriv$clone()}} +\item \href{#method-GNPriv-new}{\code{GNPriv$new()}} +\item \href{#method-GNPriv-clone}{\code{GNPriv$clone()}} } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-new}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNPriv-new}{}}} \subsection{Method \code{new()}}{ Initializes a \link{GNPriv} object \subsection{Usage}{ @@ -80,8 +78,8 @@ Initializes a \link{GNPriv} object } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-clone}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNPriv-clone}{}}} \subsection{Method \code{clone()}}{ The objects of this class are cloneable with this method. \subsection{Usage}{ @@ -107,14 +105,14 @@ The objects of this class are cloneable with this method. \section{Methods}{ \subsection{Public methods}{ \itemize{ -\item \href{#method-new}{\code{GNPrivConfiguration$new()}} -\item \href{#method-setPrivileges}{\code{GNPrivConfiguration$setPrivileges()}} -\item \href{#method-clone}{\code{GNPrivConfiguration$clone()}} +\item \href{#method-GNPrivConfiguration-new}{\code{GNPrivConfiguration$new()}} +\item \href{#method-GNPrivConfiguration-setPrivileges}{\code{GNPrivConfiguration$setPrivileges()}} +\item \href{#method-GNPrivConfiguration-clone}{\code{GNPrivConfiguration$clone()}} } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-new}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNPrivConfiguration-new}{}}} \subsection{Method \code{new()}}{ Initializes an object of class \link{GNPrivConfiguration} \subsection{Usage}{ @@ -123,8 +121,8 @@ Initializes an object of class \link{GNPrivConfiguration} } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-setPrivileges}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNPrivConfiguration-setPrivileges}{}}} \subsection{Method \code{setPrivileges()}}{ Sets the operation privileges for a particular group. Allowed group values are "guest","intranet" and "all". Allowed values for operation privileges @@ -144,8 +142,8 @@ Sets the operation privileges for a particular group. Allowed group values } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-clone}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNPrivConfiguration-clone}{}}} \subsection{Method \code{clone()}}{ The objects of this class are cloneable with this method. \subsection{Usage}{ diff --git a/man/GNRESTRequest.Rd b/man/GNRESTRequest.Rd index d5270e8..1af9ba6 100644 --- a/man/GNRESTRequest.Rd +++ b/man/GNRESTRequest.Rd @@ -33,15 +33,15 @@ Emmanuel Blondel \section{Methods}{ \subsection{Public methods}{ \itemize{ -\item \href{#method-new}{\code{GNRESTRequest$new()}} -\item \href{#method-setChild}{\code{GNRESTRequest$setChild()}} -\item \href{#method-encode}{\code{GNRESTRequest$encode()}} -\item \href{#method-clone}{\code{GNRESTRequest$clone()}} +\item \href{#method-GNRESTRequest-new}{\code{GNRESTRequest$new()}} +\item \href{#method-GNRESTRequest-setChild}{\code{GNRESTRequest$setChild()}} +\item \href{#method-GNRESTRequest-encode}{\code{GNRESTRequest$encode()}} +\item \href{#method-GNRESTRequest-clone}{\code{GNRESTRequest$clone()}} } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-new}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNRESTRequest-new}{}}} \subsection{Method \code{new()}}{ Initializes a \link{GNRESTRequest} \subsection{Usage}{ @@ -57,8 +57,8 @@ Initializes a \link{GNRESTRequest} } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-setChild}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNRESTRequest-setChild}{}}} \subsection{Method \code{setChild()}}{ Set child \subsection{Usage}{ @@ -76,8 +76,8 @@ Set child } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-encode}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNRESTRequest-encode}{}}} \subsection{Method \code{encode()}}{ Encodes request as XML \subsection{Usage}{ @@ -89,8 +89,8 @@ an object of class \code{character} representing the XML } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-clone}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNRESTRequest-clone}{}}} \subsection{Method \code{clone()}}{ The objects of this class are cloneable with this method. \subsection{Usage}{ diff --git a/man/GNUtils.Rd b/man/GNUtils.Rd index 638e7d4..7543d99 100644 --- a/man/GNUtils.Rd +++ b/man/GNUtils.Rd @@ -63,12 +63,12 @@ Emmanuel Blondel \section{Methods}{ \subsection{Public methods}{ \itemize{ -\item \href{#method-clone}{\code{GNUtils$clone()}} +\item \href{#method-GNUtils-clone}{\code{GNUtils$clone()}} } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-clone}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNUtils-clone}{}}} \subsection{Method \code{clone()}}{ The objects of this class are cloneable with this method. \subsection{Usage}{ diff --git a/man/GNVersion.Rd b/man/GNVersion.Rd index 7384ba3..e41baee 100644 --- a/man/GNVersion.Rd +++ b/man/GNVersion.Rd @@ -39,16 +39,16 @@ Emmanuel Blondel \section{Methods}{ \subsection{Public methods}{ \itemize{ -\item \href{#method-new}{\code{GNVersion$new()}} -\item \href{#method-lowerThan}{\code{GNVersion$lowerThan()}} -\item \href{#method-greaterThan}{\code{GNVersion$greaterThan()}} -\item \href{#method-equalTo}{\code{GNVersion$equalTo()}} -\item \href{#method-clone}{\code{GNVersion$clone()}} +\item \href{#method-GNVersion-new}{\code{GNVersion$new()}} +\item \href{#method-GNVersion-lowerThan}{\code{GNVersion$lowerThan()}} +\item \href{#method-GNVersion-greaterThan}{\code{GNVersion$greaterThan()}} +\item \href{#method-GNVersion-equalTo}{\code{GNVersion$equalTo()}} +\item \href{#method-GNVersion-clone}{\code{GNVersion$clone()}} } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-new}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNVersion-new}{}}} \subsection{Method \code{new()}}{ Initializes an object of class \link{GNVersion} \subsection{Usage}{ @@ -64,8 +64,8 @@ Initializes an object of class \link{GNVersion} } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-lowerThan}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNVersion-lowerThan}{}}} \subsection{Method \code{lowerThan()}}{ Compares to a version and returns TRUE if it is lower, FALSE otherwise \subsection{Usage}{ @@ -84,8 +84,8 @@ Compares to a version and returns TRUE if it is lower, FALSE otherwise } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-greaterThan}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNVersion-greaterThan}{}}} \subsection{Method \code{greaterThan()}}{ Compares to a version and returns TRUE if it is greater, FALSE otherwise \subsection{Usage}{ @@ -104,8 +104,8 @@ Compares to a version and returns TRUE if it is greater, FALSE otherwise } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-equalTo}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNVersion-equalTo}{}}} \subsection{Method \code{equalTo()}}{ Compares to a version and returns TRUE if it is equal, FALSE otherwise \subsection{Usage}{ @@ -124,8 +124,8 @@ Compares to a version and returns TRUE if it is equal, FALSE otherwise } } \if{html}{\out{
}} -\if{html}{\out{}} -\if{latex}{\out{\hypertarget{method-clone}{}}} +\if{html}{\out{}} +\if{latex}{\out{\hypertarget{method-GNVersion-clone}{}}} \subsection{Method \code{clone()}}{ The objects of this class are cloneable with this method. \subsection{Usage}{