# OpenSilex API
#
# No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
#
# OpenAPI spec version: 1.0.0-rc+2
#
# Generated by: https://github.com/swagger-api/swagger-codegen.git
#' @title Organizations operations
#' @description opensilexClientToolsR.Organizations
#'
#' @field path Stores url path of the request.
#' @field apiClient Handles the client-server communication.
#' @field userAgent Set the user agent of the request.
#'
#' @importFrom R6 R6Class
#'
#' @section Methods:
#' \describe{
#'
#' create_infrastructure Create an organisation
#'
#'
#' create_infrastructure_facility Create a facility
#'
#'
#' create_site Create a site
#'
#'
#' delete_infrastructure Delete an organisation
#'
#'
#' delete_infrastructure_facility Delete a facility
#'
#'
#' delete_site Delete a site
#'
#'
#' get_all_facilities Get all facilities
#'
#'
#' get_facilities_by_uri Get facilities by their URIs
#'
#'
#' get_infrastructure Get an organisation
#'
#'
#' get_infrastructure_facility Get a facility
#'
#'
#' get_site Get a site
#'
#'
#' get_sites_by_uri Get a list of sites
#'
#'
#' search_infrastructure_facilities Search facilities
#'
#'
#' search_infrastructures Search organisations
#'
#'
#' search_sites Search all sites
#'
#'
#' update_infrastructure Update an organisation
#'
#'
#' update_infrastructure_facility Update a facility
#'
#'
#' update_site Update a site
#'
#' }
#'
#' @export
OrganizationsApi <- R6::R6Class(
'OrganizationsApi',
public = list(
userAgent = "Swagger-Codegen/1.0.0/r",
apiClient = NULL,
initialize = function(apiClient){
if (!missing(apiClient)) {
self$apiClient <- apiClient
}
else {
self$apiClient <- ApiClient$new()
}
},
create_infrastructure = function(body,...){
args <- list(...)
queryParams <- list()
headerParams <- character()
self$apiClient$basePath = sub("/$", "",get("BASE_PATH",opensilexWSClientR:::configWS))
if(self$apiClient$basePath == ""){
stop("Wrong you must first connect with connectToOpenSILEX")
}
#if (!missing(`authorization`)) {
# headerParams['Authorization'] <- authorization
#}
#if (!missing(`accept_language`)) {
# headerParams['Accept-Language'] <- accept_language
#}
if (!missing(`body`)) {
if(is.list(`body`)){
bodyList <- lapply(`body`, function(x){x$toJSONString()})
bodyListPaste <- paste(bodyList, collapse=', ' )
body <- paste('[',bodyListPaste,']')
}else{
body <- paste(`body`$toJSONString())
}
} else {
body <- NULL
}
urlPath <- "/core/organisations"
resp <- self$apiClient$callApi(url = paste0(self$apiClient$basePath, urlPath),
method = "POST",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
method = "POST"
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
if(method == "GET"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
data <- json$result
returnedOjects = list()
for(i in 1:nrow(data)){
row <- data[i,]
returnObject <- ObjectUriResponse$new()
returnObject$fromJSONObject(row)
returnedOjects = c(returnedOjects,returnObject)
}
return(Response$new(json$metadata,returnedOjects, resp, TRUE))
}
if(method == "POST" || method == "PUT"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json$metadata$datafiles, resp, TRUE))
}
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
}
},
create_infrastructure_facility = function(body,...){
args <- list(...)
queryParams <- list()
headerParams <- character()
self$apiClient$basePath = sub("/$", "",get("BASE_PATH",opensilexWSClientR:::configWS))
if(self$apiClient$basePath == ""){
stop("Wrong you must first connect with connectToOpenSILEX")
}
#if (!missing(`authorization`)) {
# headerParams['Authorization'] <- authorization
#}
#if (!missing(`accept_language`)) {
# headerParams['Accept-Language'] <- accept_language
#}
if (!missing(`body`)) {
if(is.list(`body`)){
bodyList <- lapply(`body`, function(x){x$toJSONString()})
bodyListPaste <- paste(bodyList, collapse=', ' )
body <- paste('[',bodyListPaste,']')
}else{
body <- paste(`body`$toJSONString())
}
} else {
body <- NULL
}
urlPath <- "/core/facilities"
resp <- self$apiClient$callApi(url = paste0(self$apiClient$basePath, urlPath),
method = "POST",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
method = "POST"
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
if(method == "GET"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
data <- json$result
returnedOjects = list()
for(i in 1:nrow(data)){
row <- data[i,]
returnObject <- ObjectUriResponse$new()
returnObject$fromJSONObject(row)
returnedOjects = c(returnedOjects,returnObject)
}
return(Response$new(json$metadata,returnedOjects, resp, TRUE))
}
if(method == "POST" || method == "PUT"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json$metadata$datafiles, resp, TRUE))
}
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
}
},
create_site = function(body,...){
args <- list(...)
queryParams <- list()
headerParams <- character()
self$apiClient$basePath = sub("/$", "",get("BASE_PATH",opensilexWSClientR:::configWS))
if(self$apiClient$basePath == ""){
stop("Wrong you must first connect with connectToOpenSILEX")
}
#if (!missing(`authorization`)) {
# headerParams['Authorization'] <- authorization
#}
#if (!missing(`accept_language`)) {
# headerParams['Accept-Language'] <- accept_language
#}
if (!missing(`body`)) {
if(is.list(`body`)){
bodyList <- lapply(`body`, function(x){x$toJSONString()})
bodyListPaste <- paste(bodyList, collapse=', ' )
body <- paste('[',bodyListPaste,']')
}else{
body <- paste(`body`$toJSONString())
}
} else {
body <- NULL
}
urlPath <- "/core/sites"
resp <- self$apiClient$callApi(url = paste0(self$apiClient$basePath, urlPath),
method = "POST",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
method = "POST"
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
if(method == "GET"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
data <- json$result
returnedOjects = list()
for(i in 1:nrow(data)){
row <- data[i,]
returnObject <- ObjectUriResponse$new()
returnObject$fromJSONObject(row)
returnedOjects = c(returnedOjects,returnObject)
}
return(Response$new(json$metadata,returnedOjects, resp, TRUE))
}
if(method == "POST" || method == "PUT"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json$metadata$datafiles, resp, TRUE))
}
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
}
},
delete_infrastructure = function(uri,...){
args <- list(...)
queryParams <- list()
headerParams <- character()
self$apiClient$basePath = sub("/$", "",get("BASE_PATH",opensilexWSClientR:::configWS))
if(self$apiClient$basePath == ""){
stop("Wrong you must first connect with connectToOpenSILEX")
}
#if (!missing(`authorization`)) {
# headerParams['Authorization'] <- authorization
#}
#if (!missing(`accept_language`)) {
# headerParams['Accept-Language'] <- accept_language
#}
urlPath <- "/core/organisations/{uri}"
if (!missing(`uri`)) {
urlPath <- gsub(paste0("\\{", "uri", "\\}"), `uri`, urlPath)
}
resp <- self$apiClient$callApi(url = paste0(self$apiClient$basePath, urlPath),
method = "DELETE",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
method = "DELETE"
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
if(method == "GET"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
data <- json$result
returnedOjects = list()
for(i in 1:nrow(data)){
row <- data[i,]
returnObject <- ObjectUriResponse$new()
returnObject$fromJSONObject(row)
returnedOjects = c(returnedOjects,returnObject)
}
return(Response$new(json$metadata,returnedOjects, resp, TRUE))
}
if(method == "POST" || method == "PUT"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json$metadata$datafiles, resp, TRUE))
}
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
}
},
delete_infrastructure_facility = function(uri,...){
args <- list(...)
queryParams <- list()
headerParams <- character()
self$apiClient$basePath = sub("/$", "",get("BASE_PATH",opensilexWSClientR:::configWS))
if(self$apiClient$basePath == ""){
stop("Wrong you must first connect with connectToOpenSILEX")
}
#if (!missing(`authorization`)) {
# headerParams['Authorization'] <- authorization
#}
#if (!missing(`accept_language`)) {
# headerParams['Accept-Language'] <- accept_language
#}
urlPath <- "/core/facilities/{uri}"
if (!missing(`uri`)) {
urlPath <- gsub(paste0("\\{", "uri", "\\}"), `uri`, urlPath)
}
resp <- self$apiClient$callApi(url = paste0(self$apiClient$basePath, urlPath),
method = "DELETE",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
method = "DELETE"
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
if(method == "GET"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
data <- json$result
returnedOjects = list()
for(i in 1:nrow(data)){
row <- data[i,]
returnObject <- ObjectUriResponse$new()
returnObject$fromJSONObject(row)
returnedOjects = c(returnedOjects,returnObject)
}
return(Response$new(json$metadata,returnedOjects, resp, TRUE))
}
if(method == "POST" || method == "PUT"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json$metadata$datafiles, resp, TRUE))
}
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
}
},
delete_site = function(uri,...){
args <- list(...)
queryParams <- list()
headerParams <- character()
self$apiClient$basePath = sub("/$", "",get("BASE_PATH",opensilexWSClientR:::configWS))
if(self$apiClient$basePath == ""){
stop("Wrong you must first connect with connectToOpenSILEX")
}
#if (!missing(`authorization`)) {
# headerParams['Authorization'] <- authorization
#}
#if (!missing(`accept_language`)) {
# headerParams['Accept-Language'] <- accept_language
#}
urlPath <- "/core/sites/{uri}"
if (!missing(`uri`)) {
urlPath <- gsub(paste0("\\{", "uri", "\\}"), `uri`, urlPath)
}
resp <- self$apiClient$callApi(url = paste0(self$apiClient$basePath, urlPath),
method = "DELETE",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
method = "DELETE"
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
if(method == "GET"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
data <- json$result
returnedOjects = list()
for(i in 1:nrow(data)){
row <- data[i,]
returnObject <- ObjectUriResponse$new()
returnObject$fromJSONObject(row)
returnedOjects = c(returnedOjects,returnObject)
}
return(Response$new(json$metadata,returnedOjects, resp, TRUE))
}
if(method == "POST" || method == "PUT"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json$metadata$datafiles, resp, TRUE))
}
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
}
},
get_all_facilities = function(...){
args <- list(...)
queryParams <- list()
headerParams <- character()
self$apiClient$basePath = sub("/$", "",get("BASE_PATH",opensilexWSClientR:::configWS))
if(self$apiClient$basePath == ""){
stop("Wrong you must first connect with connectToOpenSILEX")
}
#if (!missing(`authorization`)) {
# headerParams['Authorization'] <- authorization
#}
#if (!missing(`accept_language`)) {
# headerParams['Accept-Language'] <- accept_language
#}
urlPath <- "/core/facilities/all_facilities"
resp <- self$apiClient$callApi(url = paste0(self$apiClient$basePath, urlPath),
method = "GET",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
method = "GET"
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
if(method == "GET"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
data <- json$result
returnedOjects = list()
for(i in 1:nrow(data)){
row <- data[i,]
returnObject <- NamedResourceDTO$new()
returnObject$fromJSONObject(row)
returnedOjects = c(returnedOjects,returnObject)
}
return(Response$new(json$metadata,returnedOjects, resp, TRUE))
}
if(method == "POST" || method == "PUT"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json$metadata$datafiles, resp, TRUE))
}
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
}
},
get_facilities_by_uri = function(uris,...){
args <- list(...)
queryParams <- list()
headerParams <- character()
self$apiClient$basePath = sub("/$", "",get("BASE_PATH",opensilexWSClientR:::configWS))
if(self$apiClient$basePath == ""){
stop("Wrong you must first connect with connectToOpenSILEX")
}
#if (!missing(`authorization`)) {
# headerParams['Authorization'] <- authorization
#}
#if (!missing(`accept_language`)) {
# headerParams['Accept-Language'] <- accept_language
#}
if (!missing(`uris`)) {
queryParams['uris'] <- uris
}
urlPath <- "/core/facilities/by_uris"
resp <- self$apiClient$callApi(url = paste0(self$apiClient$basePath, urlPath),
method = "GET",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
method = "GET"
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
if(method == "GET"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
data <- json$result
returnedOjects = list()
for(i in 1:nrow(data)){
row <- data[i,]
returnObject <- InfrastructureFacilityNamedDTO$new()
returnObject$fromJSONObject(row)
returnedOjects = c(returnedOjects,returnObject)
}
return(Response$new(json$metadata,returnedOjects, resp, TRUE))
}
if(method == "POST" || method == "PUT"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json$metadata$datafiles, resp, TRUE))
}
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
}
},
get_infrastructure = function(uri,...){
args <- list(...)
queryParams <- list()
headerParams <- character()
self$apiClient$basePath = sub("/$", "",get("BASE_PATH",opensilexWSClientR:::configWS))
if(self$apiClient$basePath == ""){
stop("Wrong you must first connect with connectToOpenSILEX")
}
#if (!missing(`authorization`)) {
# headerParams['Authorization'] <- authorization
#}
#if (!missing(`accept_language`)) {
# headerParams['Accept-Language'] <- accept_language
#}
urlPath <- "/core/organisations/{uri}"
if (!missing(`uri`)) {
urlPath <- gsub(paste0("\\{", "uri", "\\}"), `uri`, urlPath)
}
resp <- self$apiClient$callApi(url = paste0(self$apiClient$basePath, urlPath),
method = "GET",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
method = "GET"
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
if(method == "GET"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
data <- json$result
returnedOjects = list()
for(i in 1:nrow(data)){
row <- data[i,]
returnObject <- InfrastructureGetDTO$new()
returnObject$fromJSONObject(row)
returnedOjects = c(returnedOjects,returnObject)
}
return(Response$new(json$metadata,returnedOjects, resp, TRUE))
}
if(method == "POST" || method == "PUT"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json$metadata$datafiles, resp, TRUE))
}
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
}
},
get_infrastructure_facility = function(uri,...){
args <- list(...)
queryParams <- list()
headerParams <- character()
self$apiClient$basePath = sub("/$", "",get("BASE_PATH",opensilexWSClientR:::configWS))
if(self$apiClient$basePath == ""){
stop("Wrong you must first connect with connectToOpenSILEX")
}
#if (!missing(`authorization`)) {
# headerParams['Authorization'] <- authorization
#}
#if (!missing(`accept_language`)) {
# headerParams['Accept-Language'] <- accept_language
#}
urlPath <- "/core/facilities/{uri}"
if (!missing(`uri`)) {
urlPath <- gsub(paste0("\\{", "uri", "\\}"), `uri`, urlPath)
}
resp <- self$apiClient$callApi(url = paste0(self$apiClient$basePath, urlPath),
method = "GET",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
method = "GET"
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
if(method == "GET"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
data <- json$result
returnedOjects = list()
for(i in 1:nrow(data)){
row <- data[i,]
returnObject <- InfrastructureFacilityGetDTO$new()
returnObject$fromJSONObject(row)
returnedOjects = c(returnedOjects,returnObject)
}
return(Response$new(json$metadata,returnedOjects, resp, TRUE))
}
if(method == "POST" || method == "PUT"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json$metadata$datafiles, resp, TRUE))
}
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
}
},
get_site = function(uri,...){
args <- list(...)
queryParams <- list()
headerParams <- character()
self$apiClient$basePath = sub("/$", "",get("BASE_PATH",opensilexWSClientR:::configWS))
if(self$apiClient$basePath == ""){
stop("Wrong you must first connect with connectToOpenSILEX")
}
#if (!missing(`authorization`)) {
# headerParams['Authorization'] <- authorization
#}
#if (!missing(`accept_language`)) {
# headerParams['Accept-Language'] <- accept_language
#}
urlPath <- "/core/sites/{uri}"
if (!missing(`uri`)) {
urlPath <- gsub(paste0("\\{", "uri", "\\}"), `uri`, urlPath)
}
resp <- self$apiClient$callApi(url = paste0(self$apiClient$basePath, urlPath),
method = "GET",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
method = "GET"
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
if(method == "GET"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
data <- json$result
returnedOjects = list()
for(i in 1:nrow(data)){
row <- data[i,]
returnObject <- SiteGetDTO$new()
returnObject$fromJSONObject(row)
returnedOjects = c(returnedOjects,returnObject)
}
return(Response$new(json$metadata,returnedOjects, resp, TRUE))
}
if(method == "POST" || method == "PUT"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json$metadata$datafiles, resp, TRUE))
}
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
}
},
get_sites_by_uri = function(uris,...){
args <- list(...)
queryParams <- list()
headerParams <- character()
self$apiClient$basePath = sub("/$", "",get("BASE_PATH",opensilexWSClientR:::configWS))
if(self$apiClient$basePath == ""){
stop("Wrong you must first connect with connectToOpenSILEX")
}
#if (!missing(`authorization`)) {
# headerParams['Authorization'] <- authorization
#}
#if (!missing(`accept_language`)) {
# headerParams['Accept-Language'] <- accept_language
#}
if (!missing(`uris`)) {
queryParams['uris'] <- uris
}
urlPath <- "/core/sites/by_uris"
resp <- self$apiClient$callApi(url = paste0(self$apiClient$basePath, urlPath),
method = "GET",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
method = "GET"
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
if(method == "GET"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
data <- json$result
returnedOjects = list()
for(i in 1:nrow(data)){
row <- data[i,]
returnObject <- NamedResourceDTO$new()
returnObject$fromJSONObject(row)
returnedOjects = c(returnedOjects,returnObject)
}
return(Response$new(json$metadata,returnedOjects, resp, TRUE))
}
if(method == "POST" || method == "PUT"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json$metadata$datafiles, resp, TRUE))
}
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
}
},
search_infrastructure_facilities = function(pattern,organizations,order_by,page,page_size,...){
args <- list(...)
queryParams <- list()
headerParams <- character()
self$apiClient$basePath = sub("/$", "",get("BASE_PATH",opensilexWSClientR:::configWS))
if(self$apiClient$basePath == ""){
stop("Wrong you must first connect with connectToOpenSILEX")
}
#if (!missing(`authorization`)) {
# headerParams['Authorization'] <- authorization
#}
#if (!missing(`accept_language`)) {
# headerParams['Accept-Language'] <- accept_language
#}
if (!missing(`pattern`)) {
queryParams['pattern'] <- pattern
}
if (!missing(`organizations`)) {
queryParams['organizations'] <- organizations
}
if (!missing(`order_by`)) {
queryParams['order_by'] <- order_by
}
if (!missing(`page`)) {
queryParams['page'] <- page
}
if (!missing(`page_size`)) {
queryParams['page_size'] <- page_size
}
urlPath <- "/core/facilities"
resp <- self$apiClient$callApi(url = paste0(self$apiClient$basePath, urlPath),
method = "GET",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
method = "GET"
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
if(method == "GET"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
data <- json$result
returnedOjects = list()
for(i in 1:nrow(data)){
row <- data[i,]
returnObject <- InfrastructureFacilityNamedDTO$new()
returnObject$fromJSONObject(row)
returnedOjects = c(returnedOjects,returnObject)
}
return(Response$new(json$metadata,returnedOjects, resp, TRUE))
}
if(method == "POST" || method == "PUT"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json$metadata$datafiles, resp, TRUE))
}
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
}
},
search_infrastructures = function(pattern,organisation_uris,...){
args <- list(...)
queryParams <- list()
headerParams <- character()
self$apiClient$basePath = sub("/$", "",get("BASE_PATH",opensilexWSClientR:::configWS))
if(self$apiClient$basePath == ""){
stop("Wrong you must first connect with connectToOpenSILEX")
}
#if (!missing(`authorization`)) {
# headerParams['Authorization'] <- authorization
#}
#if (!missing(`accept_language`)) {
# headerParams['Accept-Language'] <- accept_language
#}
if (!missing(`pattern`)) {
queryParams['pattern'] <- pattern
}
if (!missing(`organisation_uris`)) {
queryParams['organisation_uris'] <- organisation_uris
}
urlPath <- "/core/organisations"
resp <- self$apiClient$callApi(url = paste0(self$apiClient$basePath, urlPath),
method = "GET",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
method = "GET"
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
if(method == "GET"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
data <- json$result
returnedOjects = list()
for(i in 1:nrow(data)){
row <- data[i,]
returnObject <- ResourceDagDTO$new()
returnObject$fromJSONObject(row)
returnedOjects = c(returnedOjects,returnObject)
}
return(Response$new(json$metadata,returnedOjects, resp, TRUE))
}
if(method == "POST" || method == "PUT"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json$metadata$datafiles, resp, TRUE))
}
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
}
},
search_sites = function(pattern,organizations,order_by,page,page_size,...){
args <- list(...)
queryParams <- list()
headerParams <- character()
self$apiClient$basePath = sub("/$", "",get("BASE_PATH",opensilexWSClientR:::configWS))
if(self$apiClient$basePath == ""){
stop("Wrong you must first connect with connectToOpenSILEX")
}
#if (!missing(`authorization`)) {
# headerParams['Authorization'] <- authorization
#}
#if (!missing(`accept_language`)) {
# headerParams['Accept-Language'] <- accept_language
#}
if (!missing(`pattern`)) {
queryParams['pattern'] <- pattern
}
if (!missing(`organizations`)) {
queryParams['organizations'] <- organizations
}
if (!missing(`order_by`)) {
queryParams['order_by'] <- order_by
}
if (!missing(`page`)) {
queryParams['page'] <- page
}
if (!missing(`page_size`)) {
queryParams['page_size'] <- page_size
}
urlPath <- "/core/sites"
resp <- self$apiClient$callApi(url = paste0(self$apiClient$basePath, urlPath),
method = "GET",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
method = "GET"
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
if(method == "GET"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
data <- json$result
returnedOjects = list()
for(i in 1:nrow(data)){
row <- data[i,]
returnObject <- SiteGetDTO$new()
returnObject$fromJSONObject(row)
returnedOjects = c(returnedOjects,returnObject)
}
return(Response$new(json$metadata,returnedOjects, resp, TRUE))
}
if(method == "POST" || method == "PUT"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json$metadata$datafiles, resp, TRUE))
}
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
}
},
update_infrastructure = function(body,...){
args <- list(...)
queryParams <- list()
headerParams <- character()
self$apiClient$basePath = sub("/$", "",get("BASE_PATH",opensilexWSClientR:::configWS))
if(self$apiClient$basePath == ""){
stop("Wrong you must first connect with connectToOpenSILEX")
}
#if (!missing(`authorization`)) {
# headerParams['Authorization'] <- authorization
#}
#if (!missing(`accept_language`)) {
# headerParams['Accept-Language'] <- accept_language
#}
if (!missing(`body`)) {
if(is.list(`body`)){
bodyList <- lapply(`body`, function(x){x$toJSONString()})
bodyListPaste <- paste(bodyList, collapse=', ' )
body <- paste('[',bodyListPaste,']')
}else{
body <- paste(`body`$toJSONString())
}
} else {
body <- NULL
}
urlPath <- "/core/organisations"
resp <- self$apiClient$callApi(url = paste0(self$apiClient$basePath, urlPath),
method = "PUT",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
method = "PUT"
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
if(method == "GET"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
data <- json$result
returnedOjects = list()
for(i in 1:nrow(data)){
row <- data[i,]
returnObject <- ObjectUriResponse$new()
returnObject$fromJSONObject(row)
returnedOjects = c(returnedOjects,returnObject)
}
return(Response$new(json$metadata,returnedOjects, resp, TRUE))
}
if(method == "POST" || method == "PUT"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json$metadata$datafiles, resp, TRUE))
}
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
}
},
update_infrastructure_facility = function(body,...){
args <- list(...)
queryParams <- list()
headerParams <- character()
self$apiClient$basePath = sub("/$", "",get("BASE_PATH",opensilexWSClientR:::configWS))
if(self$apiClient$basePath == ""){
stop("Wrong you must first connect with connectToOpenSILEX")
}
#if (!missing(`authorization`)) {
# headerParams['Authorization'] <- authorization
#}
#if (!missing(`accept_language`)) {
# headerParams['Accept-Language'] <- accept_language
#}
if (!missing(`body`)) {
if(is.list(`body`)){
bodyList <- lapply(`body`, function(x){x$toJSONString()})
bodyListPaste <- paste(bodyList, collapse=', ' )
body <- paste('[',bodyListPaste,']')
}else{
body <- paste(`body`$toJSONString())
}
} else {
body <- NULL
}
urlPath <- "/core/facilities"
resp <- self$apiClient$callApi(url = paste0(self$apiClient$basePath, urlPath),
method = "PUT",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
method = "PUT"
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
if(method == "GET"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
data <- json$result
returnedOjects = list()
for(i in 1:nrow(data)){
row <- data[i,]
returnObject <- ObjectUriResponse$new()
returnObject$fromJSONObject(row)
returnedOjects = c(returnedOjects,returnObject)
}
return(Response$new(json$metadata,returnedOjects, resp, TRUE))
}
if(method == "POST" || method == "PUT"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json$metadata$datafiles, resp, TRUE))
}
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
}
},
update_site = function(body,...){
args <- list(...)
queryParams <- list()
headerParams <- character()
self$apiClient$basePath = sub("/$", "",get("BASE_PATH",opensilexWSClientR:::configWS))
if(self$apiClient$basePath == ""){
stop("Wrong you must first connect with connectToOpenSILEX")
}
#if (!missing(`authorization`)) {
# headerParams['Authorization'] <- authorization
#}
#if (!missing(`accept_language`)) {
# headerParams['Accept-Language'] <- accept_language
#}
if (!missing(`body`)) {
if(is.list(`body`)){
bodyList <- lapply(`body`, function(x){x$toJSONString()})
bodyListPaste <- paste(bodyList, collapse=', ' )
body <- paste('[',bodyListPaste,']')
}else{
body <- paste(`body`$toJSONString())
}
} else {
body <- NULL
}
urlPath <- "/core/sites"
resp <- self$apiClient$callApi(url = paste0(self$apiClient$basePath, urlPath),
method = "PUT",
queryParams = queryParams,
headerParams = headerParams,
body = body,
...)
method = "PUT"
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
if(method == "GET"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
data <- json$result
returnedOjects = list()
for(i in 1:nrow(data)){
row <- data[i,]
returnObject <- ObjectUriResponse$new()
returnObject$fromJSONObject(row)
returnedOjects = c(returnedOjects,returnObject)
}
return(Response$new(json$metadata,returnedOjects, resp, TRUE))
}
if(method == "POST" || method == "PUT"){
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json$metadata$datafiles, resp, TRUE))
}
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
json <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
return(Response$new(json$metadata, json, resp, FALSE))
}
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.