R/v1_api.R

# HCA Matrix Service
#
# Human Cell Atlas Matrix Service API
#
# The version of the OpenAPI document: 1.0.0
# 
# Generated by: https://openapi-generator.tech

#' @docType class
#' @title V1 operations
#' @description hcamatrixapi.V1
#' @format An \code{R6Class} generator object
#' @field apiClient Handles the client-server communication.
#'
#' @section Methods:
#' \describe{
#' \strong{ MatrixLambdasApiV1CoreGetFeatureDetail } \emph{ Get a information about a matrix feature type }
#' 
#'
#' \itemize{
#' \item \emph{ @param } feature.name character
#' \item \emph{ @returnType } \link[hcamatrixapi:v1_MatrixFeatureDetail]{ V1MatrixFeatureDetail }   \cr
#'
#'
#' \item status code : 200 | Feature found.
#'
#' \item return type : V1MatrixFeatureDetail 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 404 | Feature not found.
#'
#' \item return type : V1MatrixErrorResponse 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ MatrixLambdasApiV1CoreGetFeatures } \emph{ Get a list of available feature types }
#' Get a list of matrix feature types that a POST to /matrix will accept. 
#'
#' \itemize{
#'
#'
#' \item status code : 200 | Successfully return feature list.
#'
#' \item return type : array[character] 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ MatrixLambdasApiV1CoreGetFieldDetail } \emph{ Get a description of a metadata field }
#' Get detailed information about an available metadata field. 
#'
#' \itemize{
#' \item \emph{ @param } field.name character
#' \item \emph{ @returnType } \link[hcamatrixapi:oneOf<v1_NumericFieldDetail,v1_CategoricalFieldDetail>]{ OneOfv1NumericFieldDetailv1CategoricalFieldDetail }   \cr
#'
#'
#' \item status code : 200 | Field found.
#'
#' \item return type : OneOfv1NumericFieldDetailv1CategoricalFieldDetail 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 404 | Field not found.
#'
#' \item return type : V1MatrixErrorResponse 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ MatrixLambdasApiV1CoreGetFields } \emph{ Get a list of available metadata fields }
#' Get a list of metadata field names that a POST to /matrix will accept. 
#'
#' \itemize{
#'
#'
#' \item status code : 200 | Successfully return field list.
#'
#' \item return type : array[character] 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ MatrixLambdasApiV1CoreGetFilterDetail } \emph{ Get a description of a filter }
#' Get detailed information about a filter that can be applied to the HCA expression data. 
#'
#' \itemize{
#' \item \emph{ @param } filter.name character
#' \item \emph{ @returnType } \link[hcamatrixapi:oneOf<v1_NumericFieldDetail,v1_CategoricalFieldDetail>]{ OneOfv1NumericFieldDetailv1CategoricalFieldDetail }   \cr
#'
#'
#' \item status code : 200 | Filter found.
#'
#' \item return type : OneOfv1NumericFieldDetailv1CategoricalFieldDetail 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 404 | Filter not found.
#'
#' \item return type : V1MatrixErrorResponse 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ MatrixLambdasApiV1CoreGetFilters } \emph{ Get a list of permitted filters }
#' Get a list of filters that a POST to /matrix will accept. 
#'
#' \itemize{
#'
#'
#' \item status code : 200 | Successfully return filter list.
#'
#' \item return type : array[character] 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ MatrixLambdasApiV1CoreGetFormatDetail } \emph{ Get a description of a matrix format }
#' 
#'
#' \itemize{
#' \item \emph{ @param } format.name character
#'
#'
#' \item status code : 200 | Format found.
#'
#' \item return type : character 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 404 | Format not found.
#'
#' \item return type : V1MatrixErrorResponse 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ MatrixLambdasApiV1CoreGetFormats } \emph{ Get a list of available matrix formats }
#' Get a list of matrix formats that a POST to /matrix will accept. 
#'
#' \itemize{
#'
#'
#' \item status code : 200 | Successfully return format list.
#'
#' \item return type : array[character] 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ MatrixLambdasApiV1CoreGetMatrix } \emph{ Get status and result of a matrix request }
#' 
#'
#' \itemize{
#' \item \emph{ @param } request.id \link[hcamatrixapi:]{ character }
#' \item \emph{ @returnType } \link[hcamatrixapi:v1_MatrixGetResponse]{ V1MatrixGetResponse }   \cr
#'
#'
#' \item status code : 200 | Matrix request found.
#'
#' \item return type : V1MatrixGetResponse 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 404 | Matrix request id not found.
#'
#' \item return type : V1MatrixErrorResponse 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ MatrixLambdasApiV1CorePostMatrix } \emph{ Request an expression matrix }
#' Request an expression matrix using a set of filters to be ANDed and applied to the HCA expression data. 
#'
#' \itemize{
#' \item \emph{ @param } v1.matrix.request \link[hcamatrixapi:V1MatrixRequest]{ V1MatrixRequest }
#' \item \emph{ @returnType } \link[hcamatrixapi:v1_MatrixPostResponse]{ V1MatrixPostResponse }   \cr
#'
#'
#' \item status code : 202 | Matrix request accepted.
#'
#' \item return type : V1MatrixPostResponse 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad request.
#'
#' \item return type : V1MatrixErrorResponse 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 413 | Filter entity too large.
#'
#' \item return type : V1MatrixErrorResponse 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' }
#'
#'
#' @examples
#' \donttest{
#' ####################  MatrixLambdasApiV1CoreGetFeatureDetail  ####################
#'
#' library(hcamatrixapi)
#' var.feature.name <- 'gene' # character | Feature type to describe
#'
#' #Get a information about a matrix feature type
#' api.instance <- V1Api$new()
#'
#' result <- api.instance$MatrixLambdasApiV1CoreGetFeatureDetail(var.feature.name)
#'
#'
#' ####################  MatrixLambdasApiV1CoreGetFeatures  ####################
#'
#' library(hcamatrixapi)
#'
#' #Get a list of available feature types
#' api.instance <- V1Api$new()
#'
#' result <- api.instance$MatrixLambdasApiV1CoreGetFeatures()
#'
#'
#' ####################  MatrixLambdasApiV1CoreGetFieldDetail  ####################
#'
#' library(hcamatrixapi)
#' var.field.name <- 'field.name_example' # character | Field to describe.
#'
#' #Get a description of a metadata field
#' api.instance <- V1Api$new()
#'
#' result <- api.instance$MatrixLambdasApiV1CoreGetFieldDetail(var.field.name)
#'
#'
#' ####################  MatrixLambdasApiV1CoreGetFields  ####################
#'
#' library(hcamatrixapi)
#'
#' #Get a list of available metadata fields
#' api.instance <- V1Api$new()
#'
#' result <- api.instance$MatrixLambdasApiV1CoreGetFields()
#'
#'
#' ####################  MatrixLambdasApiV1CoreGetFilterDetail  ####################
#'
#' library(hcamatrixapi)
#' var.filter.name <- 'filter.name_example' # character | Filter to describe.
#'
#' #Get a description of a filter
#' api.instance <- V1Api$new()
#'
#' result <- api.instance$MatrixLambdasApiV1CoreGetFilterDetail(var.filter.name)
#'
#'
#' ####################  MatrixLambdasApiV1CoreGetFilters  ####################
#'
#' library(hcamatrixapi)
#'
#' #Get a list of permitted filters
#' api.instance <- V1Api$new()
#'
#' result <- api.instance$MatrixLambdasApiV1CoreGetFilters()
#'
#'
#' ####################  MatrixLambdasApiV1CoreGetFormatDetail  ####################
#'
#' library(hcamatrixapi)
#' var.format.name <- 'loom' # character | Format to describe
#'
#' #Get a description of a matrix format
#' api.instance <- V1Api$new()
#'
#' result <- api.instance$MatrixLambdasApiV1CoreGetFormatDetail(var.format.name)
#'
#'
#' ####################  MatrixLambdasApiV1CoreGetFormats  ####################
#'
#' library(hcamatrixapi)
#'
#' #Get a list of available matrix formats
#' api.instance <- V1Api$new()
#'
#' result <- api.instance$MatrixLambdasApiV1CoreGetFormats()
#'
#'
#' ####################  MatrixLambdasApiV1CoreGetMatrix  ####################
#'
#' library(hcamatrixapi)
#' var.request.id <- 'request.id_example' # character | ID returned by a previous matrix request.
#'
#' #Get status and result of a matrix request
#' api.instance <- V1Api$new()
#'
#' result <- api.instance$MatrixLambdasApiV1CoreGetMatrix(var.request.id)
#'
#'
#' ####################  MatrixLambdasApiV1CorePostMatrix  ####################
#'
#' library(hcamatrixapi)
#' var.v1.matrix.request <- {"filter":{"op":"and","value":[{"op":"=","field":"organ","value":"kidney"},{"op":">","field":"genes_detected","value":5000}]},"fields":["short_name","organ","genus_species","genes_detected"],"format":"mtx"} # V1MatrixRequest | 
#'
#' #Request an expression matrix
#' api.instance <- V1Api$new()
#'
#' result <- api.instance$MatrixLambdasApiV1CorePostMatrix(v1.matrix.request=var.v1.matrix.request)
#'
#'
#' }
#' @importFrom R6 R6Class
#' @importFrom caTools base64encode
#' @export
V1Api <- R6::R6Class(
  'V1Api',
  public = list(
    apiClient = NULL,
    initialize = function(apiClient){
      if (!missing(apiClient)) {
        self$apiClient <- apiClient
      }
      else {
        self$apiClient <- ApiClient$new()
      }
    },
    MatrixLambdasApiV1CoreGetFeatureDetail = function(feature.name, ...){
      apiResponse <- self$MatrixLambdasApiV1CoreGetFeatureDetailWithHttpInfo(feature.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
      }
    },

    MatrixLambdasApiV1CoreGetFeatureDetailWithHttpInfo = function(feature.name, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

      urlPath <- "/v1/features/{feature_name}"
      if (!missing(`feature.name`)) {
        urlPath <- gsub(paste0("\\{", "feature_name", "\\}"), URLencode(as.character(`feature.name`), reserved = TRUE), urlPath)
      }


      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, "V1MatrixFeatureDetail", "package:hcamatrixapi"),
          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)
      }
    },
    MatrixLambdasApiV1CoreGetFeatures = function(...){
      apiResponse <- self$MatrixLambdasApiV1CoreGetFeaturesWithHttpInfo(...)
      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
      }
    },

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

      urlPath <- "/v1/features"

      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]", "package:hcamatrixapi"),
          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)
      }
    },
    MatrixLambdasApiV1CoreGetFieldDetail = function(field.name, ...){
      apiResponse <- self$MatrixLambdasApiV1CoreGetFieldDetailWithHttpInfo(field.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
      }
    },

    MatrixLambdasApiV1CoreGetFieldDetailWithHttpInfo = function(field.name, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

      urlPath <- "/v1/fields/{field_name}"
      if (!missing(`field.name`)) {
        urlPath <- gsub(paste0("\\{", "field_name", "\\}"), URLencode(as.character(`field.name`), reserved = TRUE), urlPath)
      }


      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, "OneOfv1NumericFieldDetailv1CategoricalFieldDetail", "package:hcamatrixapi"),
          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)
      }
    },
    MatrixLambdasApiV1CoreGetFields = function(...){
      apiResponse <- self$MatrixLambdasApiV1CoreGetFieldsWithHttpInfo(...)
      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
      }
    },

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

      urlPath <- "/v1/fields"

      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]", "package:hcamatrixapi"),
          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)
      }
    },
    MatrixLambdasApiV1CoreGetFilterDetail = function(filter.name, ...){
      apiResponse <- self$MatrixLambdasApiV1CoreGetFilterDetailWithHttpInfo(filter.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
      }
    },

    MatrixLambdasApiV1CoreGetFilterDetailWithHttpInfo = function(filter.name, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

      urlPath <- "/v1/filters/{filter_name}"
      if (!missing(`filter.name`)) {
        urlPath <- gsub(paste0("\\{", "filter_name", "\\}"), URLencode(as.character(`filter.name`), reserved = TRUE), urlPath)
      }


      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, "OneOfv1NumericFieldDetailv1CategoricalFieldDetail", "package:hcamatrixapi"),
          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)
      }
    },
    MatrixLambdasApiV1CoreGetFilters = function(...){
      apiResponse <- self$MatrixLambdasApiV1CoreGetFiltersWithHttpInfo(...)
      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
      }
    },

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

      urlPath <- "/v1/filters"

      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]", "package:hcamatrixapi"),
          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)
      }
    },
    MatrixLambdasApiV1CoreGetFormatDetail = function(format.name, ...){
      apiResponse <- self$MatrixLambdasApiV1CoreGetFormatDetailWithHttpInfo(format.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
      }
    },

    MatrixLambdasApiV1CoreGetFormatDetailWithHttpInfo = function(format.name, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

      urlPath <- "/v1/formats/{format_name}"
      if (!missing(`format.name`)) {
        urlPath <- gsub(paste0("\\{", "format_name", "\\}"), URLencode(as.character(`format.name`), reserved = TRUE), urlPath)
      }


      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, "character", "package:hcamatrixapi"),
          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)
      }
    },
    MatrixLambdasApiV1CoreGetFormats = function(...){
      apiResponse <- self$MatrixLambdasApiV1CoreGetFormatsWithHttpInfo(...)
      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
      }
    },

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

      urlPath <- "/v1/formats"

      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]", "package:hcamatrixapi"),
          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)
      }
    },
    MatrixLambdasApiV1CoreGetMatrix = function(request.id, ...){
      apiResponse <- self$MatrixLambdasApiV1CoreGetMatrixWithHttpInfo(request.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
      }
    },

    MatrixLambdasApiV1CoreGetMatrixWithHttpInfo = function(request.id, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

      urlPath <- "/v1/matrix/{request_id}"
      if (!missing(`request.id`)) {
        urlPath <- gsub(paste0("\\{", "request_id", "\\}"), URLencode(as.character(`request.id`), reserved = TRUE), urlPath)
      }


      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, "V1MatrixGetResponse", "package:hcamatrixapi"),
          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)
      }
    },
    MatrixLambdasApiV1CorePostMatrix = function(v1.matrix.request=NULL, ...){
      apiResponse <- self$MatrixLambdasApiV1CorePostMatrixWithHttpInfo(v1.matrix.request, ...)
      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
      }
    },

    MatrixLambdasApiV1CorePostMatrixWithHttpInfo = function(v1.matrix.request=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (!missing(`v1.matrix.request`)) {
        body <- `v1.matrix.request`$toJSONString()
      } else {
        body <- NULL
      }

      urlPath <- "/v1/matrix"

      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, "V1MatrixPostResponse", "package:hcamatrixapi"),
          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)
      }
    }
  )
)
Bioconductor/hcamatrixapi documentation built on Nov. 6, 2019, 12:10 a.m.