R/library_api.R

# FireCloud
#
# FireCloud API 
#
# The version of the OpenAPI document: 0.1
# 
# Generated by: https://openapi-generator.tech

#' @docType class
#' @title Library operations
#' @description openapi.Library
#' @format An \code{R6Class} generator object
#' @field apiClient Handles the client-server communication.
#'
#' @section Methods:
#' \describe{
#' \strong{ DataIngest } \emph{ Data Use Search ingest }
#' The ingest API will take the answers to consent questions and return the elasticsearch structure to persist with the data reference.
#'
#' \itemize{
#' \item \emph{ @param } body \link{StructuredDataRequest}
#'
#'
#' \item status code : 500 | Internal Server Error
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ DuosAutocomplete } \emph{ Passes through to DUOS' autocomplete method to select ontology terms of disease type that match the query term.  }
#' 
#'
#' \itemize{
#' \item \emph{ @param } query.term character
#'
#'
#' \item status code : 200 | Array of results.
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 500 | Internal Server Error
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ DuosConsentOrspId } \emph{ Find Consent by ORSP ID }
#' 
#'
#' \itemize{
#' \item \emph{ @param } orsp.id character
#' \item \emph{ @returnType } \link{Consent} \cr
#'
#'
#' \item status code : 200 | Consent
#'
#' \item return type : Consent 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | The consent associated with the provided name has not been approved.
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Invalid authorization, must be a FireCloud user.
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 404 | The consent associated with the provided name could not be found.
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 500 | Internal Server Error
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ DuosResearchPurposeQuery } \emph{ Generates an ElasticSearch clause for filtering by research purpose }
#' 
#'
#' \itemize{
#' \item \emph{ @param } body \link{ResearchPurposeRequest}
#'
#'
#' \item status code : 200 | JSON of ES filter clause
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ FindDocuments } \emph{ searches published library datasets  }
#' 
#'
#' \itemize{
#' \item \emph{ @param } search.params \link{SearchTermRef}
#'
#'
#' \item status code : 200 | Matching datasets
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ GetDiscoverableGroups } \emph{ get the groups that can discover this library dataset  }
#' 
#'
#' \itemize{
#' \item \emph{ @param } workspace.namespace character
#' \item \emph{ @param } workspace.name character
#'
#'
#' \item status code : 200 | The groups that can discover the dataset
#'
#' \item return type : array[character] 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 403 | Insufficient permissions
#'
#' \item return type : ErrorReport 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 404 | Workspace not found
#'
#' \item return type : ErrorReport 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 500 | Error
#'
#' \item return type : ErrorReport 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ GetLibraryMetadata } \emph{ get the entire metadata for a library dataset  }
#' 
#'
#' \itemize{
#' \item \emph{ @param } workspace.namespace character
#' \item \emph{ @param } workspace.name character
#'
#'
#' \item status code : 200 | Success
#'
#' \item return type : object 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 404 | Workspace not found
#'
#' \item return type : ErrorReport 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 500 | Rawls Internal Error
#'
#' \item return type : ErrorReport 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ Groups } \emph{ returns groups that can be used for discoverable datasets  }
#' 
#'
#' \itemize{
#'
#'
#' \item status code : 200 | Names of the allowed groups
#'
#' \item return type : array[character] 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ PopulateSuggest } \emph{ suggestions for populating a field  }
#' 
#'
#' \itemize{
#' \item \emph{ @param } field character
#' \item \emph{ @param } q character
#'
#'
#' \item status code : 200 | Field specific suggestions
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request, specified field that was not configured for suggestions
#'
#' \item return type : ErrorReport 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ PublishLibraryWorkspace } \emph{ publish the workspace in the Library  }
#' 
#'
#' \itemize{
#' \item \emph{ @param } workspace.namespace character
#' \item \emph{ @param } workspace.name character
#' \item \emph{ @returnType } \link{Workspace} \cr
#'
#'
#' \item status code : 200 | Success
#'
#' \item return type : Workspace 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 204 | Dataset already in requested published state
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 403 | You must be the workspace owner and library curator to publish a workspace to the library
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 500 | Rawls Internal Error
#'
#' \item return type : ErrorReport 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ PutLibraryMetadata } \emph{ put the entire metadata for a library dataset  }
#' 
#'
#' \itemize{
#' \item \emph{ @param } workspace.namespace character
#' \item \emph{ @param } workspace.name character
#' \item \emph{ @param } library.metadata.json object
#' \item \emph{ @param } validate character
#' \item \emph{ @returnType } \link{Workspace} \cr
#'
#'
#' \item status code : 200 | Success
#'
#' \item return type : Workspace 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 404 | Workspace not found
#'
#' \item return type : ErrorReport 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 500 | Rawls Internal Error
#'
#' \item return type : ErrorReport 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ ReindexAll } \emph{ deletes and rebuilds the entire index of published library datasets  }
#' 
#'
#' \itemize{
#' \item \emph{ @returnType } \link{LibraryBulkIndexResponse} \cr
#'
#'
#' \item status code : 200 | Indexing Success
#'
#' \item return type : LibraryBulkIndexResponse 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 204 | No published datasets exist to index
#'
#' \item return type : character 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 500 | Indexing Error
#'
#' \item return type : LibraryBulkIndexResponse 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SearchSuggest } \emph{ search suggestions  }
#' 
#'
#' \itemize{
#' \item \emph{ @param } search.params \link{SearchTermRef}
#'
#'
#' \item status code : 200 | Search suggestions, with highlighting
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ UnpublishLibraryWorkspace } \emph{ unpublish the workspace in the Library  }
#' 
#'
#' \itemize{
#' \item \emph{ @param } workspace.namespace character
#' \item \emph{ @param } workspace.name character
#' \item \emph{ @returnType } \link{Workspace} \cr
#'
#'
#' \item status code : 200 | Success
#'
#' \item return type : Workspace 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 403 | You must be the workspace owner and library curator to unpublish a workspace from the library
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 500 | Rawls Internal Error
#'
#' \item return type : ErrorReport 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ UpdateDiscoverableGroups } \emph{ set the groups that can discover this library dataset  }
#' 
#'
#' \itemize{
#' \item \emph{ @param } workspace.namespace character
#' \item \emph{ @param } workspace.name character
#' \item \emph{ @param } discoverable.groups list( character )
#' \item \emph{ @returnType } \link{Workspace} \cr
#'
#'
#' \item status code : 200 | The workspace, after assigning groups to be able to discover the dataset
#'
#' \item return type : Workspace 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Invalid input
#'
#' \item return type : ErrorReport 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 403 | Insufficient permissions to change catalog permissions (must be owner or have grant or catalog with access to the workspace)
#'
#' \item return type : ErrorReport 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 404 | Workspace, user or group not found
#'
#' \item return type : ErrorReport 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 500 | Error
#'
#' \item return type : ErrorReport 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' }
#'
#'
#' @examples
#' \dontrun{
#' ####################  DataIngest  ####################
#'
#' library(openapi)
#' var.body <- StructuredDataRequest$new() # StructuredDataRequest | Structured Data Request
#'
#' #Data Use Search ingest
#' api.instance <- LibraryApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$DataIngest(var.body)
#'
#'
#' ####################  DuosAutocomplete  ####################
#'
#' library(openapi)
#' var.query.term <- 'query.term_example' # character | The query term (word fragment) which the service should try and complete.
#'
#' #Passes through to DUOS' autocomplete method to select ontology terms of disease type that match the query term. 
#' api.instance <- LibraryApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$DuosAutocomplete(var.query.term)
#'
#'
#' ####################  DuosConsentOrspId  ####################
#'
#' library(openapi)
#' var.orsp.id <- 'orsp.id_example' # character | Finds the consent for the provided ORSP ID.
#'
#' #Find Consent by ORSP ID
#' api.instance <- LibraryApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$DuosConsentOrspId(var.orsp.id)
#'
#'
#' ####################  DuosResearchPurposeQuery  ####################
#'
#' library(openapi)
#' var.body <- ResearchPurposeRequest$new() # ResearchPurposeRequest | Research Purpose Request
#'
#' #Generates an ElasticSearch clause for filtering by research purpose
#' api.instance <- LibraryApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$DuosResearchPurposeQuery(var.body)
#'
#'
#' ####################  FindDocuments  ####################
#'
#' library(openapi)
#' var.search.params <- SearchTermRef$new() # SearchTermRef | Search terms and pagination parameters
#'
#' #searches published library datasets 
#' api.instance <- LibraryApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$FindDocuments(search.params=var.search.params)
#'
#'
#' ####################  GetDiscoverableGroups  ####################
#'
#' library(openapi)
#' var.workspace.namespace <- 'workspace.namespace_example' # character | Workspace Namespace
#' var.workspace.name <- 'workspace.name_example' # character | Workspace Name
#'
#' #get the groups that can discover this library dataset 
#' api.instance <- LibraryApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$GetDiscoverableGroups(var.workspace.namespace, var.workspace.name)
#'
#'
#' ####################  GetLibraryMetadata  ####################
#'
#' library(openapi)
#' var.workspace.namespace <- 'workspace.namespace_example' # character | Workspace Namespace
#' var.workspace.name <- 'workspace.name_example' # character | Workspace Name
#'
#' #get the entire metadata for a library dataset 
#' api.instance <- LibraryApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$GetLibraryMetadata(var.workspace.namespace, var.workspace.name)
#'
#'
#' ####################  Groups  ####################
#'
#' library(openapi)
#'
#' #returns groups that can be used for discoverable datasets 
#' api.instance <- LibraryApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$Groups()
#'
#'
#' ####################  PopulateSuggest  ####################
#'
#' library(openapi)
#' var.field <- 'field_example' # character | the property to get suggestions for
#' var.q <- 'q_example' # character | the initial text to complete
#'
#' #suggestions for populating a field 
#' api.instance <- LibraryApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$PopulateSuggest(var.field, var.q)
#'
#'
#' ####################  PublishLibraryWorkspace  ####################
#'
#' library(openapi)
#' var.workspace.namespace <- 'workspace.namespace_example' # character | Workspace Namespace
#' var.workspace.name <- 'workspace.name_example' # character | Workspace Name
#'
#' #publish the workspace in the Library 
#' api.instance <- LibraryApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$PublishLibraryWorkspace(var.workspace.namespace, var.workspace.name)
#'
#'
#' ####################  PutLibraryMetadata  ####################
#'
#' library(openapi)
#' var.workspace.namespace <- 'workspace.namespace_example' # character | Workspace Namespace
#' var.workspace.name <- 'workspace.name_example' # character | Workspace Name
#' var.library.metadata.json <- NULL # object | Library metadata
#' var.validate <- 'validate_example' # character | Should the payload be validated? Validation is always enabled for published datasets and defaults to false for unpublished datasets. 
#'
#' #put the entire metadata for a library dataset 
#' api.instance <- LibraryApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$PutLibraryMetadata(var.workspace.namespace, var.workspace.name, var.library.metadata.json, validate=var.validate)
#'
#'
#' ####################  ReindexAll  ####################
#'
#' library(openapi)
#'
#' #deletes and rebuilds the entire index of published library datasets 
#' api.instance <- LibraryApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$ReindexAll()
#'
#'
#' ####################  SearchSuggest  ####################
#'
#' library(openapi)
#' var.search.params <- SearchTermRef$new() # SearchTermRef | Search terms and pagination parameters
#'
#' #search suggestions 
#' api.instance <- LibraryApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$SearchSuggest(search.params=var.search.params)
#'
#'
#' ####################  UnpublishLibraryWorkspace  ####################
#'
#' library(openapi)
#' var.workspace.namespace <- 'workspace.namespace_example' # character | Workspace Namespace
#' var.workspace.name <- 'workspace.name_example' # character | Workspace Name
#'
#' #unpublish the workspace in the Library 
#' api.instance <- LibraryApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$UnpublishLibraryWorkspace(var.workspace.namespace, var.workspace.name)
#'
#'
#' ####################  UpdateDiscoverableGroups  ####################
#'
#' library(openapi)
#' var.workspace.namespace <- 'workspace.namespace_example' # character | Workspace Namespace
#' var.workspace.name <- 'workspace.name_example' # character | Workspace Name
#' var.discoverable.groups <- ['discoverable.groups_example'] # array[character] | Json array of group names, or empty array for no restrictions
#'
#' #set the groups that can discover this library dataset 
#' api.instance <- LibraryApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$UpdateDiscoverableGroups(var.workspace.namespace, var.workspace.name, var.discoverable.groups)
#'
#'
#' }
#' @importFrom R6 R6Class
#' @importFrom base64enc base64encode
#' @export
LibraryApi <- R6::R6Class(
  'LibraryApi',
  public = list(
    apiClient = NULL,
    initialize = function(apiClient){
      if (!missing(apiClient)) {
        self$apiClient <- apiClient
      }
      else {
        self$apiClient <- ApiClient$new()
      }
    },
    DataIngest = function(body, ...){
      apiResponse <- self$DataIngestWithHttpInfo(body, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    DataIngestWithHttpInfo = function(body, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`body`)) {
        stop("Missing required parameter `body`.")
      }

      if (!missing(`body`)) {
        body <- `body`$toJSONString()
      } else {
        body <- NULL
      }

      urlPath <- "/duos/structuredData"
      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "POST",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        ApiResponse$new(NULL, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    DuosAutocomplete = function(query.term, ...){
      apiResponse <- self$DuosAutocompleteWithHttpInfo(query.term, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    DuosAutocompleteWithHttpInfo = function(query.term, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`query.term`)) {
        stop("Missing required parameter `query.term`.")
      }

      body <- NULL
      urlPath <- "/duos/autocomplete/{queryTerm}"
      if (!missing(`query.term`)) {
        urlPath <- gsub(paste0("\\{", "queryTerm", "\\}"), URLencode(as.character(`query.term`), reserved = TRUE), urlPath)
      }

      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        ApiResponse$new(NULL, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    DuosConsentOrspId = function(orsp.id, ...){
      apiResponse <- self$DuosConsentOrspIdWithHttpInfo(orsp.id, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    DuosConsentOrspIdWithHttpInfo = function(orsp.id, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`orsp.id`)) {
        stop("Missing required parameter `orsp.id`.")
      }

      body <- NULL
      urlPath <- "/api/duos/consent/orsp/{orspId}"
      if (!missing(`orsp.id`)) {
        urlPath <- gsub(paste0("\\{", "orspId", "\\}"), URLencode(as.character(`orsp.id`), reserved = TRUE), urlPath)
      }

      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "Consent", loadNamespace("openapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    DuosResearchPurposeQuery = function(body, ...){
      apiResponse <- self$DuosResearchPurposeQueryWithHttpInfo(body, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    DuosResearchPurposeQueryWithHttpInfo = function(body, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`body`)) {
        stop("Missing required parameter `body`.")
      }

      if (!missing(`body`)) {
        body <- `body`$toJSONString()
      } else {
        body <- NULL
      }

      urlPath <- "/duos/researchPurposeQuery"
      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "POST",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        ApiResponse$new(NULL, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    FindDocuments = function(search.params=NULL, ...){
      apiResponse <- self$FindDocumentsWithHttpInfo(search.params, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    FindDocumentsWithHttpInfo = function(search.params=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (!missing(`search.params`)) {
        body <- `search.params`$toJSONString()
      } else {
        body <- NULL
      }

      urlPath <- "/api/library/search"
      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "POST",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        ApiResponse$new(NULL, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    GetDiscoverableGroups = function(workspace.namespace, workspace.name, ...){
      apiResponse <- self$GetDiscoverableGroupsWithHttpInfo(workspace.namespace, workspace.name, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    GetDiscoverableGroupsWithHttpInfo = function(workspace.namespace, workspace.name, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`workspace.namespace`)) {
        stop("Missing required parameter `workspace.namespace`.")
      }

      if (missing(`workspace.name`)) {
        stop("Missing required parameter `workspace.name`.")
      }

      body <- NULL
      urlPath <- "/api/library/{workspaceNamespace}/{workspaceName}/discoverableGroups"
      if (!missing(`workspace.namespace`)) {
        urlPath <- gsub(paste0("\\{", "workspaceNamespace", "\\}"), URLencode(as.character(`workspace.namespace`), reserved = TRUE), urlPath)
      }

      if (!missing(`workspace.name`)) {
        urlPath <- gsub(paste0("\\{", "workspaceName", "\\}"), URLencode(as.character(`workspace.name`), reserved = TRUE), urlPath)
      }

      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "array[character]", loadNamespace("openapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    GetLibraryMetadata = function(workspace.namespace, workspace.name, ...){
      apiResponse <- self$GetLibraryMetadataWithHttpInfo(workspace.namespace, workspace.name, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    GetLibraryMetadataWithHttpInfo = function(workspace.namespace, workspace.name, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`workspace.namespace`)) {
        stop("Missing required parameter `workspace.namespace`.")
      }

      if (missing(`workspace.name`)) {
        stop("Missing required parameter `workspace.name`.")
      }

      body <- NULL
      urlPath <- "/api/library/{workspaceNamespace}/{workspaceName}/metadata"
      if (!missing(`workspace.namespace`)) {
        urlPath <- gsub(paste0("\\{", "workspaceNamespace", "\\}"), URLencode(as.character(`workspace.namespace`), reserved = TRUE), urlPath)
      }

      if (!missing(`workspace.name`)) {
        urlPath <- gsub(paste0("\\{", "workspaceName", "\\}"), URLencode(as.character(`workspace.name`), reserved = TRUE), urlPath)
      }

      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "object", loadNamespace("openapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    Groups = function(...){
      apiResponse <- self$GroupsWithHttpInfo(...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    GroupsWithHttpInfo = function(...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      body <- NULL
      urlPath <- "/api/library/groups"
      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "array[character]", loadNamespace("openapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    PopulateSuggest = function(field, q, ...){
      apiResponse <- self$PopulateSuggestWithHttpInfo(field, q, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    PopulateSuggestWithHttpInfo = function(field, q, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`field`)) {
        stop("Missing required parameter `field`.")
      }

      if (missing(`q`)) {
        stop("Missing required parameter `q`.")
      }

      queryParams['q'] <- q

      body <- NULL
      urlPath <- "/api/library/populate/suggest/{field}"
      if (!missing(`field`)) {
        urlPath <- gsub(paste0("\\{", "field", "\\}"), URLencode(as.character(`field`), reserved = TRUE), urlPath)
      }

      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        ApiResponse$new(NULL, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    PublishLibraryWorkspace = function(workspace.namespace, workspace.name, ...){
      apiResponse <- self$PublishLibraryWorkspaceWithHttpInfo(workspace.namespace, workspace.name, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    PublishLibraryWorkspaceWithHttpInfo = function(workspace.namespace, workspace.name, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`workspace.namespace`)) {
        stop("Missing required parameter `workspace.namespace`.")
      }

      if (missing(`workspace.name`)) {
        stop("Missing required parameter `workspace.name`.")
      }

      body <- NULL
      urlPath <- "/api/library/{workspaceNamespace}/{workspaceName}/published"
      if (!missing(`workspace.namespace`)) {
        urlPath <- gsub(paste0("\\{", "workspaceNamespace", "\\}"), URLencode(as.character(`workspace.namespace`), reserved = TRUE), urlPath)
      }

      if (!missing(`workspace.name`)) {
        urlPath <- gsub(paste0("\\{", "workspaceName", "\\}"), URLencode(as.character(`workspace.name`), reserved = TRUE), urlPath)
      }

      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "POST",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "Workspace", loadNamespace("openapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    PutLibraryMetadata = function(workspace.namespace, workspace.name, library.metadata.json, validate=NULL, ...){
      apiResponse <- self$PutLibraryMetadataWithHttpInfo(workspace.namespace, workspace.name, library.metadata.json, validate, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    PutLibraryMetadataWithHttpInfo = function(workspace.namespace, workspace.name, library.metadata.json, validate=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`workspace.namespace`)) {
        stop("Missing required parameter `workspace.namespace`.")
      }

      if (missing(`workspace.name`)) {
        stop("Missing required parameter `workspace.name`.")
      }

      if (missing(`library.metadata.json`)) {
        stop("Missing required parameter `library.metadata.json`.")
      }

      queryParams['validate'] <- validate

      if (!missing(`library.metadata.json`)) {
        body <- `library.metadata.json`$toJSONString()
      } else {
        body <- NULL
      }

      urlPath <- "/api/library/{workspaceNamespace}/{workspaceName}/metadata"
      if (!missing(`workspace.namespace`)) {
        urlPath <- gsub(paste0("\\{", "workspaceNamespace", "\\}"), URLencode(as.character(`workspace.namespace`), reserved = TRUE), urlPath)
      }

      if (!missing(`workspace.name`)) {
        urlPath <- gsub(paste0("\\{", "workspaceName", "\\}"), URLencode(as.character(`workspace.name`), reserved = TRUE), urlPath)
      }

      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "PUT",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "Workspace", loadNamespace("openapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    ReindexAll = function(...){
      apiResponse <- self$ReindexAllWithHttpInfo(...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    ReindexAllWithHttpInfo = function(...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      body <- NULL
      urlPath <- "/api/library/admin/reindex"
      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "POST",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "LibraryBulkIndexResponse", loadNamespace("openapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SearchSuggest = function(search.params=NULL, ...){
      apiResponse <- self$SearchSuggestWithHttpInfo(search.params, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SearchSuggestWithHttpInfo = function(search.params=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (!missing(`search.params`)) {
        body <- `search.params`$toJSONString()
      } else {
        body <- NULL
      }

      urlPath <- "/api/library/suggest"
      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "POST",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        ApiResponse$new(NULL, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    UnpublishLibraryWorkspace = function(workspace.namespace, workspace.name, ...){
      apiResponse <- self$UnpublishLibraryWorkspaceWithHttpInfo(workspace.namespace, workspace.name, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    UnpublishLibraryWorkspaceWithHttpInfo = function(workspace.namespace, workspace.name, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`workspace.namespace`)) {
        stop("Missing required parameter `workspace.namespace`.")
      }

      if (missing(`workspace.name`)) {
        stop("Missing required parameter `workspace.name`.")
      }

      body <- NULL
      urlPath <- "/api/library/{workspaceNamespace}/{workspaceName}/published"
      if (!missing(`workspace.namespace`)) {
        urlPath <- gsub(paste0("\\{", "workspaceNamespace", "\\}"), URLencode(as.character(`workspace.namespace`), reserved = TRUE), urlPath)
      }

      if (!missing(`workspace.name`)) {
        urlPath <- gsub(paste0("\\{", "workspaceName", "\\}"), URLencode(as.character(`workspace.name`), reserved = TRUE), urlPath)
      }

      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "DELETE",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "Workspace", loadNamespace("openapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    UpdateDiscoverableGroups = function(workspace.namespace, workspace.name, discoverable.groups, ...){
      apiResponse <- self$UpdateDiscoverableGroupsWithHttpInfo(workspace.namespace, workspace.name, discoverable.groups, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    UpdateDiscoverableGroupsWithHttpInfo = function(workspace.namespace, workspace.name, discoverable.groups, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`workspace.namespace`)) {
        stop("Missing required parameter `workspace.namespace`.")
      }

      if (missing(`workspace.name`)) {
        stop("Missing required parameter `workspace.name`.")
      }

      if (missing(`discoverable.groups`)) {
        stop("Missing required parameter `discoverable.groups`.")
      }

      if (!missing(`discoverable.groups`)) {
        body.items = paste(unlist(lapply(discoverable.groups, function(param){param$toJSONString()})), collapse = ",")
        body <- paste0('[', body.items, ']')
      } else {
        body <- NULL
      }

      urlPath <- "/api/library/{workspaceNamespace}/{workspaceName}/discoverableGroups"
      if (!missing(`workspace.namespace`)) {
        urlPath <- gsub(paste0("\\{", "workspaceNamespace", "\\}"), URLencode(as.character(`workspace.namespace`), reserved = TRUE), urlPath)
      }

      if (!missing(`workspace.name`)) {
        urlPath <- gsub(paste0("\\{", "workspaceName", "\\}"), URLencode(as.character(`workspace.name`), reserved = TRUE), urlPath)
      }

      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "PUT",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "Workspace", loadNamespace("openapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    }
  )
)
vjcitn/terraClientR documentation built on Dec. 23, 2021, 4:07 p.m.