R/MetaApi.r

# Agave Platform Science API
#
# Power your digital lab and reduce the time from theory to discovery using the Agave Science-as-a-Service API Platform. Agave provides hosted services that allow researchers to manage data, conduct experiments, and publish and share results from anywhere at any time.
#
# Agave Platform version: 2.2.14
# 
# Generated by: https://github.com/swagger-api/swagger-codegen.git


#' The Agave Metadata service allows you to manage metadata and associate it with Agave entities via associated UUIDs. It supports JSON schema for structured JSON metadata; it also accepts any valid JSON-formatted metadata or plain text String when no schema is specified. As with other Agave services, a full access control layer is available, enabling you to keep your metadata private or share it with your colleagues.
#'
#' Read more about the Meta API in the [Agave Developer's Guide](http://docs.agaveplatform.org/#/meta)
#'
#' @title Agave Meta API operations
#' @description
#' MetaApi Class
#'
#' @section Arguments:
#' \describe{
#'
#' `apiClient` a [rAgave::ApiClient] instance preconfigured to speak to the Agave Platform.
#'
#' `cache` an [rAgave::AgaveCache] instance pointing to the persistent auth cache file on disk.
#'
#' `responseType` the default object type methods of this class should return. Valid values are:
#' * **raw**: the raw JSON string response from the API. You may optionally include
#'   `pretty=TRUE` in the method call to receive pretty printed JSON.
#' * **list**: a standard R list object. This is the default value.
#' * **dt**: a data table
#'
#' }
#'
#' @usage
#' meta <- MetaApi$new( apiClient = ApiClient$new(), cache = AgaveCache$new() )
#'
#' @importFrom R6 R6Class
#'
#' @section Methods:
#' \describe{
#'
#' `$addMetadata()` Update or Add new Metadata.
#'
#' **Usage**
#'
#' ```
#' meta$addMetadata$listMeta(body, naked, )
#' ```
#'
#'
#' `$addMetadataPermission()` Add a user permission for the given metadata.
#'
#' **Usage**
#'
#' ```
#' meta$addMetadataPermission$listMeta(uuid, body, naked, )
#' ```
#'
#'
#' `$addMetadataSchema()` Add a new Metadata Schema.
#'
#' **Usage**
#'
#' ```
#' meta$addMetadataSchema$listMeta(body, naked, )
#' ```
#'
#'
#' `$addMetadataSchemaPermission()` Add a user permission for the given schema.
#'
#' **Usage**
#'
#' ```
#' meta$addMetadataSchemaPermission$listMeta(uuid, body, naked, )
#' ```
#'
#'
#' `$clearMetadataPermissions()` Deletes all permissions on the given metadata.
#'
#' **Usage**
#'
#' ```
#' meta$clearMetadataPermissions$listMeta(uuid, naked, )
#' ```
#'
#'
#' `$clearMetadataSchemaPermissions()` Deletes all permissions on the given schema.
#'
#' **Usage**
#'
#' ```
#' meta$clearMetadataSchemaPermissions$listMeta(uuid, naked, )
#' ```
#'
#'
#' `$deleteMetadata()` Remove Metadata from the system.
#'
#' **Usage**
#'
#' ```
#' meta$deleteMetadata$listMeta(uuid, naked, )
#' ```
#'
#'
#' `$deleteMetadataPermission()` Removes user permissions for a user on a given metadata resource.
#'
#' **Usage**
#'
#' ```
#' meta$deleteMetadataPermission$listMeta(uuid, username, naked, )
#' ```
#'
#'
#' `$deleteMetadataSchema()` Remove Metadata Schema from the system.
#'
#' **Usage**
#'
#' ```
#' meta$deleteMetadataSchema$listMeta(uuid, naked, )
#' ```
#'
#'
#' `$deleteSchemaPermission()` Deletes all metadata schema permissions on the given metadata.
#'
#' **Usage**
#'
#' ```
#' meta$deleteSchemaPermission$listMeta(uuid, username, naked, )
#' ```
#'
#'
#' `$getMetadata()` Retrieve Metadata.
#'
#' **Usage**
#'
#' ```
#' meta$getMetadata$listMeta(uuid, naked, )
#' ```
#'
#'
#' `$getMetadataPermission()` Get the user permission for this metadata.
#'
#' **Usage**
#'
#' ```
#' meta$getMetadataPermission$listMeta(uuid, username, naked, )
#' ```
#'
#'
#' `$getMetadataSchema()` Retrieve Metadata Schemata.
#'
#' **Usage**
#'
#' ```
#' meta$getMetadataSchema$listMeta(uuid, naked, )
#' ```
#'
#'
#' `$getMetadataSchemaPermission()` Get the user permission for this schema.
#'
#' **Usage**
#'
#' ```
#' meta$getMetadataSchemaPermission$listMeta(uuid, username, naked, )
#' ```
#'
#'
#' `$listMetadata()` List and/or search metadata.
#'
#' **Usage**
#'
#' ```
#' meta$listMetadata$listMeta(q, naked, limit, offset, search, )
#' meta$listMetadata$listMeta(search=list("foo"="bar"))
#' ```
#'
#'
#' `$listMetadataPermissions()` Get the permission ACL for this metadata.
#'
#' **Usage**
#'
#' ```
#' meta$listMetadataPermissions$listMeta(uuid, naked, limit, offset, search, )
#' meta$listMetadataPermissions$listMeta(search=list("foo"="bar"))
#' ```
#'
#'
#' `$listMetadataSchema()` List and query Metadata Schemata.
#'
#' **Usage**
#'
#' ```
#' meta$listMetadataSchema$listMeta(q, naked, limit, offset, search, )
#' meta$listMetadataSchema$listMeta(search=list("foo"="bar"))
#' ```
#'
#'
#' `$listMetadataSchemaPermissions()` Get the permission for this schema.
#'
#' **Usage**
#'
#' ```
#' meta$listMetadataSchemaPermissions$listMeta(uuid, naked, limit, offset, search, )
#' meta$listMetadataSchemaPermissions$listMeta(search=list("foo"="bar"))
#' ```
#'
#'
#' `$updateMetadata()` Update or Add new Metadata.
#'
#' **Usage**
#'
#' ```
#' meta$updateMetadata$listMeta(uuid, body, naked, )
#' ```
#'
#'
#' `$updateMetadataPermission()` Update a user permission for the given metadata.
#'
#' **Usage**
#'
#' ```
#' meta$updateMetadataPermission$listMeta(uuid, username, body, naked, )
#' ```
#'
#'
#' `$updateMetadataSchema()` Update an existing Metadata Schema.
#'
#' **Usage**
#'
#' ```
#' meta$updateMetadataSchema$listMeta(uuid, body, naked, )
#' ```
#'
#'
#' `$updateMetadataSchemaPermission()` Add or update a user permission for the given metadata schema.
#'
#' **Usage**
#'
#' ```
#' meta$updateMetadataSchemaPermission$listMeta(uuid, username, body, naked, )
#' ```
#'
#' }
#'
#' @name MetaApi
#' @seealso  [rAgave::ApiClient] [rAgave::Agave] [rAgave::Metadata][rAgave::MetadataSchema][rAgave::Permission]
#' @export
MetaApi <- R6::R6Class(
  'MetaApi',
  private = list(
    userAgent = "Agave-SDK/0.2.0/r",
    apiClient = NULL,
    responseType = "list",
    formatResponse = function(resp, args=list()) {

      # read the args from the unnamed request args
      if ("responseType" %in% names(args)) {
        responseType = args$responseType
      }
      else {
        responseType = NULL
      }

      if (is.null(responseType) || nchar(responseType) == 0) {
        responseType = private$responseType
      }

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        logger.debug(jsonlite::toJSON(httr::content(resp,stringsAsFactors = FALSE), auto_unbox=TRUE, null="null", na="null"))

        if (responseType == "raw") {
          # check for the undeclared pretty attibute to pretty-print the json response
          prettyPrint <- ("pretty" %in% names(args) && isTRUE(args$pretty))
          jsonlite::toJSON(httr::content(resp, stringsAsFactors = FALSE), auto_unbox=TRUE, null="null", na="null", pretty=prettyPrint)
        }
        else {
          jsonResp <- httr::content(resp)
          if ("result" %in% names(jsonResp)) {
            jsonResp <- jsonResp$result
          }

          if ((responseType == "df" || responseType == "dataframe") && length(jsonResp) > 0) {
            # lookup properties of object. if null, it's a list. if not null, it's an object
            colNames <- names(jsonResp)
            if (is.null(colNames)) {
              # convert to a list of dataframes
              do.call("rbind", lapply(jsonResp, as.data.frame, col.names=factor(names(jsonResp[[1]]))))
            }
            else {
              # convert object to single data frame
              as.data.frame(jsonResp)
            }
          }
          else {
            jsonResp
          }
        }
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        logger.warn(jsonlite::toJSON(httr::content(resp, "text", encoding="UTF-8"), auto_unbox=TRUE, null="null", na="null"))
        httr::content(resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        logger.warn(jsonlite::toJSON(httr::content(resp, "text", encoding="UTF-8"), auto_unbox=TRUE, null="null", na="null"))
        httr::content(resp)
      }
    }
  ),
  public = list(
    initialize = function(apiClient, responseType){
      if (!missing(apiClient)) {
        private$apiClient <- apiClient
      }
      else {
        private$apiClient <- ApiClient$new()
      }

      # user can override the global representation in which resources
      # responses from this API are returned in when calling methods of
      # this class. The same responseType attribute may be passed to any
      # public method to override individual calls as well.
      if (missing(responseType) || is.null(responseType) || nchar(responseType) == 0) {
        # we ignore and use the default
      }
      else if (responseType != "raw" && responseType != "list" && responseType != "df") {
        stop("Invalid responseType. Please specify one of: raw, list, df")
      }
      else {
        # set the response type to the class default to be used
        # whenever it is not explicitly set on a request
        private$responseType = responseType
      }
    },
    addMetadata = function(body, naked,  ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- character()

      if (!missing(`naked`)) {
        queryParams['naked'] <- naked
      }

      if (!missing(`body`)) {
        if (!is.list(`body`)) {
          body <- `body`$toJSON()
        }
      } else {
        body <- NULL
      }

      urlPath <- "/meta/v2/data"
      resp <- private$apiClient$callApi(url = paste0(private$apiClient$basePath, urlPath),
                                 method = "POST",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      # Send the response to the common filtering method to marshal the
      # response into the format requested by the user in the Agave global
      # configuration, API class instance, or individual method invocation.
      private$formatResponse(resp, args);

    },
    addMetadataPermission = function(uuid, body, naked,  ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- character()

      if (!missing(`naked`)) {
        queryParams['naked'] <- naked
      }

      if (!missing(`body`)) {
        if (!is.list(`body`)) {
          body <- `body`$toJSON()
        }
      } else {
        body <- NULL
      }

      urlPath <- "/meta/v2/data/{uuid}/pems"
      if (!missing(`uuid`)) {
        urlPath <- gsub(paste0("\\{", "uuid", "\\}"), `uuid`, urlPath)
      }

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

      # Send the response to the common filtering method to marshal the
      # response into the format requested by the user in the Agave global
      # configuration, API class instance, or individual method invocation.
      private$formatResponse(resp, args);

    },
    addMetadataSchema = function(body, naked,  ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- character()

      if (!missing(`naked`)) {
        queryParams['naked'] <- naked
      }

      if (!missing(`body`)) {
        if (!is.list(`body`)) {
          body <- `body`$toJSON()
        }
      } else {
        body <- NULL
      }

      urlPath <- "/meta/v2/schemas"
      resp <- private$apiClient$callApi(url = paste0(private$apiClient$basePath, urlPath),
                                 method = "POST",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      # Send the response to the common filtering method to marshal the
      # response into the format requested by the user in the Agave global
      # configuration, API class instance, or individual method invocation.
      private$formatResponse(resp, args);

    },
    addMetadataSchemaPermission = function(uuid, body, naked,  ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- character()

      if (!missing(`naked`)) {
        queryParams['naked'] <- naked
      }

      if (!missing(`body`)) {
        if (!is.list(`body`)) {
          body <- `body`$toJSON()
        }
      } else {
        body <- NULL
      }

      urlPath <- "/meta/v2/schemas/{uuid}/pems"
      if (!missing(`uuid`)) {
        urlPath <- gsub(paste0("\\{", "uuid", "\\}"), `uuid`, urlPath)
      }

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

      # Send the response to the common filtering method to marshal the
      # response into the format requested by the user in the Agave global
      # configuration, API class instance, or individual method invocation.
      private$formatResponse(resp, args);

    },
    clearMetadataPermissions = function(uuid, naked,  ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- character()

      if (!missing(`naked`)) {
        queryParams['naked'] <- naked
      }

      urlPath <- "/meta/v2/data/{uuid}/pems"
      if (!missing(`uuid`)) {
        urlPath <- gsub(paste0("\\{", "uuid", "\\}"), `uuid`, urlPath)
      }

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

      # Send the response to the common filtering method to marshal the
      # response into the format requested by the user in the Agave global
      # configuration, API class instance, or individual method invocation.
      private$formatResponse(resp, args);

    },
    clearMetadataSchemaPermissions = function(uuid, naked,  ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- character()

      if (!missing(`naked`)) {
        queryParams['naked'] <- naked
      }

      urlPath <- "/meta/v2/schemas/{uuid}/pems"
      if (!missing(`uuid`)) {
        urlPath <- gsub(paste0("\\{", "uuid", "\\}"), `uuid`, urlPath)
      }

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

      # Send the response to the common filtering method to marshal the
      # response into the format requested by the user in the Agave global
      # configuration, API class instance, or individual method invocation.
      private$formatResponse(resp, args);

    },
    deleteMetadata = function(uuid, naked,  ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- character()

      if (!missing(`naked`)) {
        queryParams['naked'] <- naked
      }

      urlPath <- "/meta/v2/data/{uuid}"
      if (!missing(`uuid`)) {
        urlPath <- gsub(paste0("\\{", "uuid", "\\}"), `uuid`, urlPath)
      }

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

      # Send the response to the common filtering method to marshal the
      # response into the format requested by the user in the Agave global
      # configuration, API class instance, or individual method invocation.
      private$formatResponse(resp, args);

    },
    deleteMetadataPermission = function(uuid, username, naked,  ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- character()

      if (!missing(`naked`)) {
        queryParams['naked'] <- naked
      }

      urlPath <- "/meta/v2/data/{uuid}/pems/{username}"
      if (!missing(`uuid`)) {
        urlPath <- gsub(paste0("\\{", "uuid", "\\}"), `uuid`, urlPath)
      }

      if (!missing(`username`)) {
        urlPath <- gsub(paste0("\\{", "username", "\\}"), `username`, urlPath)
      }

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

      # Send the response to the common filtering method to marshal the
      # response into the format requested by the user in the Agave global
      # configuration, API class instance, or individual method invocation.
      private$formatResponse(resp, args);

    },
    deleteMetadataSchema = function(uuid, naked,  ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- character()

      if (!missing(`naked`)) {
        queryParams['naked'] <- naked
      }

      urlPath <- "/meta/v2/schemas/{uuid}"
      if (!missing(`uuid`)) {
        urlPath <- gsub(paste0("\\{", "uuid", "\\}"), `uuid`, urlPath)
      }

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

      # Send the response to the common filtering method to marshal the
      # response into the format requested by the user in the Agave global
      # configuration, API class instance, or individual method invocation.
      private$formatResponse(resp, args);

    },
    deleteSchemaPermission = function(uuid, username, naked,  ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- character()

      if (!missing(`naked`)) {
        queryParams['naked'] <- naked
      }

      urlPath <- "/meta/v2/schemas/{uuid}/pems/{username}"
      if (!missing(`uuid`)) {
        urlPath <- gsub(paste0("\\{", "uuid", "\\}"), `uuid`, urlPath)
      }

      if (!missing(`username`)) {
        urlPath <- gsub(paste0("\\{", "username", "\\}"), `username`, urlPath)
      }

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

      # Send the response to the common filtering method to marshal the
      # response into the format requested by the user in the Agave global
      # configuration, API class instance, or individual method invocation.
      private$formatResponse(resp, args);

    },
    getMetadata = function(uuid, naked,  ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- character()

      if (!missing(`naked`)) {
        queryParams['naked'] <- naked
      }

      urlPath <- "/meta/v2/data/{uuid}"
      if (!missing(`uuid`)) {
        urlPath <- gsub(paste0("\\{", "uuid", "\\}"), `uuid`, urlPath)
      }

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

      # Send the response to the common filtering method to marshal the
      # response into the format requested by the user in the Agave global
      # configuration, API class instance, or individual method invocation.
      private$formatResponse(resp, args);

    },
    getMetadataPermission = function(uuid, username, naked,  ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- character()

      if (!missing(`naked`)) {
        queryParams['naked'] <- naked
      }

      urlPath <- "/meta/v2/data/{uuid}/pems/{username}"
      if (!missing(`uuid`)) {
        urlPath <- gsub(paste0("\\{", "uuid", "\\}"), `uuid`, urlPath)
      }

      if (!missing(`username`)) {
        urlPath <- gsub(paste0("\\{", "username", "\\}"), `username`, urlPath)
      }

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

      # Send the response to the common filtering method to marshal the
      # response into the format requested by the user in the Agave global
      # configuration, API class instance, or individual method invocation.
      private$formatResponse(resp, args);

    },
    getMetadataSchema = function(uuid, naked,  ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- character()

      if (!missing(`naked`)) {
        queryParams['naked'] <- naked
      }

      urlPath <- "/meta/v2/schemas/{uuid}"
      if (!missing(`uuid`)) {
        urlPath <- gsub(paste0("\\{", "uuid", "\\}"), `uuid`, urlPath)
      }

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

      # Send the response to the common filtering method to marshal the
      # response into the format requested by the user in the Agave global
      # configuration, API class instance, or individual method invocation.
      private$formatResponse(resp, args);

    },
    getMetadataSchemaPermission = function(uuid, username, naked,  ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- character()

      if (!missing(`naked`)) {
        queryParams['naked'] <- naked
      }

      urlPath <- "/meta/v2/schemas/{uuid}/pems/{username}"
      if (!missing(`uuid`)) {
        urlPath <- gsub(paste0("\\{", "uuid", "\\}"), `uuid`, urlPath)
      }

      if (!missing(`username`)) {
        urlPath <- gsub(paste0("\\{", "username", "\\}"), `username`, urlPath)
      }

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

      # Send the response to the common filtering method to marshal the
      # response into the format requested by the user in the Agave global
      # configuration, API class instance, or individual method invocation.
      private$formatResponse(resp, args);

    },
    listMetadata = function(q, naked, limit, offset, search,  ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- character()

      if (!missing(search)) {
        queryParams <- search
      }

      if (!missing(`q`)) {
        queryParams['q'] <- q
      }

      if (!missing(`naked`)) {
        queryParams['naked'] <- naked
      }

      if (!missing(`limit`)) {
        queryParams['limit'] <- limit
      }

      if (!missing(`offset`)) {
        queryParams['offset'] <- offset
      }

      urlPath <- "/meta/v2/data"
      resp <- private$apiClient$callApi(url = paste0(private$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      # Send the response to the common filtering method to marshal the
      # response into the format requested by the user in the Agave global
      # configuration, API class instance, or individual method invocation.
      private$formatResponse(resp, args);

    },
    listMetadataPermissions = function(uuid, naked, limit, offset, search,  ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- character()

      if (!missing(search)) {
        queryParams <- search
      }

      if (!missing(`naked`)) {
        queryParams['naked'] <- naked
      }

      if (!missing(`limit`)) {
        queryParams['limit'] <- limit
      }

      if (!missing(`offset`)) {
        queryParams['offset'] <- offset
      }

      urlPath <- "/meta/v2/data/{uuid}/pems"
      if (!missing(`uuid`)) {
        urlPath <- gsub(paste0("\\{", "uuid", "\\}"), `uuid`, urlPath)
      }

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

      # Send the response to the common filtering method to marshal the
      # response into the format requested by the user in the Agave global
      # configuration, API class instance, or individual method invocation.
      private$formatResponse(resp, args);

    },
    listMetadataSchema = function(q, naked, limit, offset, search,  ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- character()

      if (!missing(search)) {
        queryParams <- search
      }

      if (!missing(`q`)) {
        queryParams['q'] <- q
      }

      if (!missing(`limit`)) {
        queryParams['limit'] <- limit
      }

      if (!missing(`offset`)) {
        queryParams['offset'] <- offset
      }

      if (!missing(`naked`)) {
        queryParams['naked'] <- naked
      }

      urlPath <- "/meta/v2/schemas"
      resp <- private$apiClient$callApi(url = paste0(private$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      # Send the response to the common filtering method to marshal the
      # response into the format requested by the user in the Agave global
      # configuration, API class instance, or individual method invocation.
      private$formatResponse(resp, args);

    },
    listMetadataSchemaPermissions = function(uuid, naked, limit, offset, search,  ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- character()

      if (!missing(search)) {
        queryParams <- search
      }

      if (!missing(`limit`)) {
        queryParams['limit'] <- limit
      }

      if (!missing(`offset`)) {
        queryParams['offset'] <- offset
      }

      if (!missing(`naked`)) {
        queryParams['naked'] <- naked
      }

      urlPath <- "/meta/v2/schemas/{uuid}/pems"
      if (!missing(`uuid`)) {
        urlPath <- gsub(paste0("\\{", "uuid", "\\}"), `uuid`, urlPath)
      }

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

      # Send the response to the common filtering method to marshal the
      # response into the format requested by the user in the Agave global
      # configuration, API class instance, or individual method invocation.
      private$formatResponse(resp, args);

    },
    updateMetadata = function(uuid, body, naked,  ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- character()

      if (!missing(`naked`)) {
        queryParams['naked'] <- naked
      }

      if (!missing(`body`)) {
        if (!is.list(`body`)) {
          body <- `body`$toJSON()
        }
      } else {
        body <- NULL
      }

      urlPath <- "/meta/v2/data/{uuid}"
      if (!missing(`uuid`)) {
        urlPath <- gsub(paste0("\\{", "uuid", "\\}"), `uuid`, urlPath)
      }

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

      # Send the response to the common filtering method to marshal the
      # response into the format requested by the user in the Agave global
      # configuration, API class instance, or individual method invocation.
      private$formatResponse(resp, args);

    },
    updateMetadataPermission = function(uuid, username, body, naked,  ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- character()

      if (!missing(`naked`)) {
        queryParams['naked'] <- naked
      }

      if (!missing(`body`)) {
        if (!is.list(`body`)) {
          body <- `body`$toJSON()
        }
      } else {
        body <- NULL
      }

      urlPath <- "/meta/v2/data/{uuid}/pems/{username}"
      if (!missing(`uuid`)) {
        urlPath <- gsub(paste0("\\{", "uuid", "\\}"), `uuid`, urlPath)
      }

      if (!missing(`username`)) {
        urlPath <- gsub(paste0("\\{", "username", "\\}"), `username`, urlPath)
      }

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

      # Send the response to the common filtering method to marshal the
      # response into the format requested by the user in the Agave global
      # configuration, API class instance, or individual method invocation.
      private$formatResponse(resp, args);

    },
    updateMetadataSchema = function(uuid, body, naked,  ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- character()

      if (!missing(`naked`)) {
        queryParams['naked'] <- naked
      }

      if (!missing(`body`)) {
        if (!is.list(`body`)) {
          body <- `body`$toJSON()
        }
      } else {
        body <- NULL
      }

      urlPath <- "/meta/v2/schemas/{uuid}"
      if (!missing(`uuid`)) {
        urlPath <- gsub(paste0("\\{", "uuid", "\\}"), `uuid`, urlPath)
      }

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

      # Send the response to the common filtering method to marshal the
      # response into the format requested by the user in the Agave global
      # configuration, API class instance, or individual method invocation.
      private$formatResponse(resp, args);

    },
    updateMetadataSchemaPermission = function(uuid, username, body, naked,  ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- character()

      if (!missing(`naked`)) {
        queryParams['naked'] <- naked
      }

      if (!missing(`body`)) {
        if (!is.list(`body`)) {
          body <- `body`$toJSON()
        }
      } else {
        body <- NULL
      }

      urlPath <- "/meta/v2/schemas/{uuid}/pems/{username}"
      if (!missing(`uuid`)) {
        urlPath <- gsub(paste0("\\{", "uuid", "\\}"), `uuid`, urlPath)
      }

      if (!missing(`username`)) {
        urlPath <- gsub(paste0("\\{", "username", "\\}"), `username`, urlPath)
      }

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

      # Send the response to the common filtering method to marshal the
      # response into the format requested by the user in the Agave global
      # configuration, API class instance, or individual method invocation.
      private$formatResponse(resp, args);

    }
  )
)
agaveplatform/r-sdk documentation built on May 13, 2019, 8:20 a.m.