R/JobsApi.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 Jobs service is a basic execution service that allows you to run applications registered with the Apps service across multiple, distributed, heterogeneous systems through a common REST interface. The service manages all aspects of execution and job management from data staging, job submission, monitoring, output archiving, event logging, sharing, and notifications. The Jobs service also provides a persistent reference to your job’s output data and a mechanism for sharing all aspects of your job with others. Each feature will be described in more detail below.
#'
#' Read more about the Jobs API in the [Agave Developer's Guide](http://docs.agaveplatform.org/#/jobs)
#'
#' @title Agave Jobs API operations
#' @description
#' JobsApi 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
#' jobs <- JobsApi$new( apiClient = ApiClient$new(), cache = AgaveCache$new() )
#'
#' @importFrom R6 R6Class
#'
#' @section Methods:
#' \describe{
#'
#' `$addJobPermission()` Add a user permission for the given job.
#'
#' **Usage**
#'
#' ```
#' jobs$addJobPermission$listJobs(jobId, body, naked, )
#' ```
#'
#'
#' `$clearJobPermissions()` Deletes all permissions on an job.
#'
#' **Usage**
#'
#' ```
#' jobs$clearJobPermissions$listJobs(jobId, naked, )
#' ```
#'
#'
#' `$deleteJob()` Deletes a job from history of the user
#'
#' **Usage**
#'
#' ```
#' jobs$deleteJob$listJobs(jobId, naked, )
#' ```
#'
#'
#' `$deleteJobPermission()` Deletes all permissions for the given user on an job.
#'
#' **Usage**
#'
#' ```
#' jobs$deleteJobPermission$listJobs(jobId, username, naked, )
#' ```
#'
#'
#' `$downloadJobOutput()` Download an output file from a specific job.
#'
#' **Usage**
#'
#' ```
#' jobs$downloadJobOutput$listJobs(jobId, filePath, force, search, )
#' jobs$downloadJobOutput$listJobs(search=list("foo"="bar"))
#' ```
#'
#'
#' `$getJobDetails()` Get details of the job with the specific job id.
#'
#' **Usage**
#'
#' ```
#' jobs$getJobDetails$listJobs(jobId, naked, search, )
#' jobs$getJobDetails$listJobs(search=list("foo"="bar"))
#' ```
#'
#'
#' `$getJobHistory()` Get the history of this job.
#'
#' **Usage**
#'
#' ```
#' jobs$getJobHistory$listJobs(jobId, naked, limit, offset, search, )
#' jobs$getJobHistory$listJobs(search=list("foo"="bar"))
#' ```
#'
#'
#' `$getJobPermission()` Get a specific user permission for a job.
#'
#' **Usage**
#'
#' ```
#' jobs$getJobPermission$listJobs(jobId, username, naked, )
#' ```
#'
#'
#' `$getJobStatus()` Get the status of the job.
#'
#' **Usage**
#'
#' ```
#' jobs$getJobStatus$listJobs(jobId, naked, search, )
#' jobs$getJobStatus$listJobs(search=list("foo"="bar"))
#' ```
#'
#'
#' `$listJobOutputs()` List the output folder for a job.
#'
#' **Usage**
#'
#' ```
#' jobs$listJobOutputs$listJobs(jobId, filePath, naked, limit, offset, search, )
#' jobs$listJobOutputs$listJobs(search=list("foo"="bar"))
#' ```
#'
#'
#' `$listJobPermissions()` Get the permissions granted for this job.
#'
#' **Usage**
#'
#' ```
#' jobs$listJobPermissions$listJobs(jobId, naked, limit, offset, search, )
#' jobs$listJobPermissions$listJobs(search=list("foo"="bar"))
#' ```
#'
#'
#' `$listJobs()` Get a list of jobs the authenticated user had submitted.
#'
#' **Usage**
#'
#' ```
#' jobs$listJobs$listJobs(naked, appId, archive, archivePath, archiveSystem, batchQueue, executionSystem, id, inputs, localId, maxRuntime, memoryPerNode, name, nodeCount, outputPath, parameters, processorsPerNode, retries, startTime, status, submitTime, visible, limit, offset, search, )
#' jobs$listJobs$listJobs(search=list("foo"="bar"))
#' ```
#'
#'
#' `$resubmitJob()` Resubmits the job with the given job id as a new job with a unique id.
#'
#' **Usage**
#'
#' ```
#' jobs$resubmitJob$listJobs(jobId, body, naked, )
#' ```
#'
#'
#' `$submitJob()` Submit a new job request.
#'
#' **Usage**
#'
#' ```
#' jobs$submitJob$listJobs(body, naked, )
#' ```
#'
#'
#' `$updateJobPermission()` Update a user permission for the given job and username
#'
#' **Usage**
#'
#' ```
#' jobs$updateJobPermission$listJobs(jobId, username, body, naked, )
#' ```
#'
#' }
#'
#' @name JobsApi
#' @seealso  [rAgave::ApiClient] [rAgave::Agave] [rAgave::FileInfo][rAgave::Job][rAgave::JobHistory][rAgave::JobRequest][rAgave::JobResubmitAction][rAgave::JobStatusSummary][rAgave::Permission]
#' @export
JobsApi <- R6::R6Class(
  'JobsApi',
  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
      }
    },
    addJobPermission = function(jobId, 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 <- "/jobs/v2/{jobId}/pems"
      if (!missing(`jobId`)) {
        urlPath <- gsub(paste0("\\{", "jobId", "\\}"), `jobId`, 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);

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

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

      urlPath <- "/jobs/v2/{jobId}/pems"
      if (!missing(`jobId`)) {
        urlPath <- gsub(paste0("\\{", "jobId", "\\}"), `jobId`, 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);

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

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

      urlPath <- "/jobs/v2/{jobId}"
      if (!missing(`jobId`)) {
        urlPath <- gsub(paste0("\\{", "jobId", "\\}"), `jobId`, 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);

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

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

      urlPath <- "/jobs/v2/{jobId}/pems/{username}"
      if (!missing(`jobId`)) {
        urlPath <- gsub(paste0("\\{", "jobId", "\\}"), `jobId`, 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);

    },
    downloadJobOutput = function(jobId, filePath, force, search,  ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- character()

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

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

      urlPath <- "/jobs/v2/{jobId}/outputs/media/{filePath}"
      if (!missing(`jobId`)) {
        urlPath <- gsub(paste0("\\{", "jobId", "\\}"), `jobId`, urlPath)
      }

      if (!missing(`filePath`)) {
        urlPath <- gsub(paste0("\\{", "filePath", "\\}"), `filePath`, 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);

    },
    getJobDetails = function(jobId, naked, search,  ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- character()

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

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

      urlPath <- "/jobs/v2/{jobId}"
      if (!missing(`jobId`)) {
        urlPath <- gsub(paste0("\\{", "jobId", "\\}"), `jobId`, 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);

    },
    getJobHistory = function(jobId, 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 <- "/jobs/v2/{jobId}/history"
      if (!missing(`jobId`)) {
        urlPath <- gsub(paste0("\\{", "jobId", "\\}"), `jobId`, 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);

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

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

      urlPath <- "/jobs/v2/{jobId}/pems/{username}"
      if (!missing(`jobId`)) {
        urlPath <- gsub(paste0("\\{", "jobId", "\\}"), `jobId`, 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);

    },
    getJobStatus = function(jobId, naked, search,  ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- character()

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

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

      urlPath <- "/jobs/v2/{jobId}/status"
      if (!missing(`jobId`)) {
        urlPath <- gsub(paste0("\\{", "jobId", "\\}"), `jobId`, 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);

    },
    listJobOutputs = function(jobId, filePath, 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 <- "/jobs/v2/{jobId}/outputs/listings/{filePath}"
      if (!missing(`jobId`)) {
        urlPath <- gsub(paste0("\\{", "jobId", "\\}"), `jobId`, urlPath)
      }

      if (!missing(`filePath`)) {
        urlPath <- gsub(paste0("\\{", "filePath", "\\}"), `filePath`, 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);

    },
    listJobPermissions = function(jobId, 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 <- "/jobs/v2/{jobId}/pems"
      if (!missing(`jobId`)) {
        urlPath <- gsub(paste0("\\{", "jobId", "\\}"), `jobId`, 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);

    },
    listJobs = function(naked, appId, archive, archivePath, archiveSystem, batchQueue, executionSystem, id, inputs, localId, maxRuntime, memoryPerNode, name, nodeCount, outputPath, parameters, processorsPerNode, retries, startTime, status, submitTime, visible, limit, offset, search,  ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- character()

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      urlPath <- "/jobs/v2/"
      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);

    },
    resubmitJob = function(jobId, 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 <- "/jobs/v2/{jobId}"
      if (!missing(`jobId`)) {
        urlPath <- gsub(paste0("\\{", "jobId", "\\}"), `jobId`, 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);

    },
    submitJob = 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 <- "/jobs/v2/"
      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);

    },
    updateJobPermission = function(jobId, 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 <- "/jobs/v2/{jobId}/pems/{username}"
      if (!missing(`jobId`)) {
        urlPath <- gsub(paste0("\\{", "jobId", "\\}"), `jobId`, 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.