R/sra_api.R

# OmicIDX
#
#     The OmicIDX API documentation is available in three forms:  - [RapiDoc](/docs) - [OpenAPI/Swagger Interactive](/swaggerdoc) - [ReDoc (more readable in some ways)](/redoc)  
#
# The version of the OpenAPI document: 0.99.1
# 
# Generated by: https://openapi-generator.tech

#' @docType class
#' @title SRA operations
#' @description omicidxClientR.SRA
#' @format An \code{R6Class} generator object
#' @field apiClient Handles the client-server communication.
#'
#' @section Methods:
#' \describe{
#' \strong{ ExperimentByAccessionSraExperimentsAccessionGet } \emph{ Experiment By Accession }
#' 
#'
#' \itemize{
#' \item \emph{ @param } accession character
#' \item \emph{ @param } include.fields list( character )
#' \item \emph{ @param } exclude.fields list( character )
#' \item \emph{ @returnType } \link{AnyType} \cr
#'
#'
#' \item status code : 200 | Successful Response
#'
#' \item return type : AnyType 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 422 | Validation Error
#'
#' \item return type : HTTPValidationError 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ ExperimentsForSampleSraSamplesAccessionExperimentsGet } \emph{ Experiments For Sample }
#' 
#'
#' \itemize{
#' \item \emph{ @param } accession character
#' \item \emph{ @param } include.fields list( character )
#' \item \emph{ @param } exclude.fields list( character )
#' \item \emph{ @param } size integer
#' \item \emph{ @param } cursor character
#' \item \emph{ @returnType } \link{AnyType} \cr
#'
#'
#' \item status code : 200 | Successful Response
#'
#' \item return type : AnyType 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 422 | Validation Error
#'
#' \item return type : HTTPValidationError 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ ExperimentsForStudySraStudiesAccessionExperimentsGet } \emph{ Experiments For Study }
#' 
#'
#' \itemize{
#' \item \emph{ @param } accession character
#' \item \emph{ @param } include.fields list( character )
#' \item \emph{ @param } exclude.fields list( character )
#' \item \emph{ @param } size integer
#' \item \emph{ @param } cursor character
#' \item \emph{ @returnType } \link{AnyType} \cr
#'
#'
#' \item status code : 200 | Successful Response
#'
#' \item return type : AnyType 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 422 | Validation Error
#'
#' \item return type : HTTPValidationError 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ ExperimentsSraExperimentsGet } \emph{ Experiments }
#' 
#'
#' \itemize{
#' \item \emph{ @param } q character
#' \item \emph{ @param } size integer
#' \item \emph{ @param } cursor character
#' \item \emph{ @param } facet.size integer
#' \item \emph{ @param } include.fields list( character )
#' \item \emph{ @param } exclude.fields list( character )
#' \item \emph{ @param } facets list( character )
#' \item \emph{ @returnType } \link{ResponseModel} \cr
#'
#'
#' \item status code : 200 | Successful Response
#'
#' \item return type : ResponseModel 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 422 | Validation Error
#'
#' \item return type : HTTPValidationError 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ MappingSraFieldsEntityGet } \emph{ Mapping }
#' 
#'
#' \itemize{
#' \item \emph{ @param } entity Enum < [studies, runs, experiments, samples] > 
#' \item \emph{ @returnType } \link{AnyType} \cr
#'
#'
#' \item status code : 200 | Successful Response
#'
#' \item return type : AnyType 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 422 | Validation Error
#'
#' \item return type : HTTPValidationError 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ RunByAccessionSraRunsAccessionGet } \emph{ Run By Accession }
#' 
#'
#' \itemize{
#' \item \emph{ @param } accession character
#' \item \emph{ @param } include.fields list( character )
#' \item \emph{ @param } exclude.fields list( character )
#' \item \emph{ @returnType } \link{AnyType} \cr
#'
#'
#' \item status code : 200 | Successful Response
#'
#' \item return type : AnyType 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 422 | Validation Error
#'
#' \item return type : HTTPValidationError 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ RunsForExperimentSraExperimentsAccessionRunsGet } \emph{ Runs For Experiment }
#' 
#'
#' \itemize{
#' \item \emph{ @param } accession character
#' \item \emph{ @param } include.fields list( character )
#' \item \emph{ @param } exclude.fields list( character )
#' \item \emph{ @param } size integer
#' \item \emph{ @param } cursor character
#' \item \emph{ @returnType } \link{AnyType} \cr
#'
#'
#' \item status code : 200 | Successful Response
#'
#' \item return type : AnyType 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 422 | Validation Error
#'
#' \item return type : HTTPValidationError 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ RunsForSampleSraSamplesAccessionRunsGet } \emph{ Runs For Sample }
#' 
#'
#' \itemize{
#' \item \emph{ @param } accession character
#' \item \emph{ @param } include.fields list( character )
#' \item \emph{ @param } exclude.fields list( character )
#' \item \emph{ @param } size integer
#' \item \emph{ @param } cursor character
#' \item \emph{ @returnType } \link{AnyType} \cr
#'
#'
#' \item status code : 200 | Successful Response
#'
#' \item return type : AnyType 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 422 | Validation Error
#'
#' \item return type : HTTPValidationError 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ RunsForStudySraStudiesAccessionRunsGet } \emph{ Runs For Study }
#' 
#'
#' \itemize{
#' \item \emph{ @param } accession character
#' \item \emph{ @param } include.fields list( character )
#' \item \emph{ @param } exclude.fields list( character )
#' \item \emph{ @param } size integer
#' \item \emph{ @param } cursor character
#' \item \emph{ @returnType } \link{AnyType} \cr
#'
#'
#' \item status code : 200 | Successful Response
#'
#' \item return type : AnyType 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 422 | Validation Error
#'
#' \item return type : HTTPValidationError 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ RunsSraRunsGet } \emph{ Runs }
#' 
#'
#' \itemize{
#' \item \emph{ @param } q character
#' \item \emph{ @param } size integer
#' \item \emph{ @param } cursor character
#' \item \emph{ @param } facet.size integer
#' \item \emph{ @param } include.fields list( character )
#' \item \emph{ @param } exclude.fields list( character )
#' \item \emph{ @param } facets list( character )
#' \item \emph{ @returnType } \link{ResponseModel} \cr
#'
#'
#' \item status code : 200 | Successful Response
#'
#' \item return type : ResponseModel 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 422 | Validation Error
#'
#' \item return type : HTTPValidationError 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SampleByAccessionSraSamplesAccessionGet } \emph{ Sample By Accession }
#' 
#'
#' \itemize{
#' \item \emph{ @param } accession character
#' \item \emph{ @param } include.fields list( character )
#' \item \emph{ @param } exclude.fields list( character )
#' \item \emph{ @returnType } \link{AnyType} \cr
#'
#'
#' \item status code : 200 | Successful Response
#'
#' \item return type : AnyType 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 422 | Validation Error
#'
#' \item return type : HTTPValidationError 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SamplesForStudySraStudiesAccessionSamplesGet } \emph{ Samples For Study }
#' 
#'
#' \itemize{
#' \item \emph{ @param } accession character
#' \item \emph{ @param } include.fields list( character )
#' \item \emph{ @param } exclude.fields list( character )
#' \item \emph{ @param } size integer
#' \item \emph{ @param } cursor character
#' \item \emph{ @returnType } \link{AnyType} \cr
#'
#'
#' \item status code : 200 | Successful Response
#'
#' \item return type : AnyType 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 422 | Validation Error
#'
#' \item return type : HTTPValidationError 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SamplesSraSamplesGet } \emph{ Samples }
#' 
#'
#' \itemize{
#' \item \emph{ @param } q character
#' \item \emph{ @param } size integer
#' \item \emph{ @param } cursor character
#' \item \emph{ @param } facet.size integer
#' \item \emph{ @param } include.fields list( character )
#' \item \emph{ @param } exclude.fields list( character )
#' \item \emph{ @param } facets list( character )
#' \item \emph{ @returnType } \link{ResponseModel} \cr
#'
#'
#' \item status code : 200 | Successful Response
#'
#' \item return type : ResponseModel 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 422 | Validation Error
#'
#' \item return type : HTTPValidationError 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ StudiesSraStudiesGet } \emph{ Studies }
#' 
#'
#' \itemize{
#' \item \emph{ @param } q character
#' \item \emph{ @param } size integer
#' \item \emph{ @param } cursor character
#' \item \emph{ @param } facet.size integer
#' \item \emph{ @param } include.fields list( character )
#' \item \emph{ @param } exclude.fields list( character )
#' \item \emph{ @param } facets list( character )
#' \item \emph{ @returnType } \link{ResponseModel} \cr
#'
#'
#' \item status code : 200 | Successful Response
#'
#' \item return type : ResponseModel 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 422 | Validation Error
#'
#' \item return type : HTTPValidationError 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ StudyByAccessionSraStudiesAccessionGet } \emph{ Study By Accession }
#' 
#'
#' \itemize{
#' \item \emph{ @param } accession character
#' \item \emph{ @param } include.fields list( character )
#' \item \emph{ @param } exclude.fields list( character )
#' \item \emph{ @returnType } \link{AnyType} \cr
#'
#'
#' \item status code : 200 | Successful Response
#'
#' \item return type : AnyType 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 422 | Validation Error
#'
#' \item return type : HTTPValidationError 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' }
#'
#'
#' @examples
#' \dontrun{
#' ####################  ExperimentByAccessionSraExperimentsAccessionGet  ####################
#'
#' library(omicidxClientR)
#' var.accession <- 'accession_example' # character | An accession for lookup
#' var.include.fields <- {} # array[character] | Fields to include in results. The default is to all fields (*)
#' var.exclude.fields <- {} # array[character] | Fields to exclude from results. The default is to not exclude any fields. 
#'
#' #Experiment By Accession
#' api.instance <- SRAApi$new()
#'
#' result <- api.instance$ExperimentByAccessionSraExperimentsAccessionGet(var.accession, include.fields=var.include.fields, exclude.fields=var.exclude.fields)
#'
#'
#' ####################  ExperimentsForSampleSraSamplesAccessionExperimentsGet  ####################
#'
#' library(omicidxClientR)
#' var.accession <- 'accession_example' # character | An accession for lookup
#' var.include.fields <- {} # array[character] | Fields to include in results. The default is to all fields (*)
#' var.exclude.fields <- {} # array[character] | Fields to exclude from results. The default is to not exclude any fields. 
#' var.size <- 10 # integer | 
#' var.cursor <- 'cursor_example' # character | 
#'
#' #Experiments For Sample
#' api.instance <- SRAApi$new()
#'
#' result <- api.instance$ExperimentsForSampleSraSamplesAccessionExperimentsGet(var.accession, include.fields=var.include.fields, exclude.fields=var.exclude.fields, size=var.size, cursor=var.cursor)
#'
#'
#' ####################  ExperimentsForStudySraStudiesAccessionExperimentsGet  ####################
#'
#' library(omicidxClientR)
#' var.accession <- 'accession_example' # character | An accession for lookup
#' var.include.fields <- {} # array[character] | Fields to include in results. The default is to all fields (*)
#' var.exclude.fields <- {} # array[character] | Fields to exclude from results. The default is to not exclude any fields. 
#' var.size <- 10 # integer | 
#' var.cursor <- 'cursor_example' # character | 
#'
#' #Experiments For Study
#' api.instance <- SRAApi$new()
#'
#' result <- api.instance$ExperimentsForStudySraStudiesAccessionExperimentsGet(var.accession, include.fields=var.include.fields, exclude.fields=var.exclude.fields, size=var.size, cursor=var.cursor)
#'
#'
#' ####################  ExperimentsSraExperimentsGet  ####################
#'
#' library(omicidxClientR)
#' var.q <- 'cancer' # character | The query, using [lucene query syntax](https://lucene.apache.org/core/3_6_0/queryparsersyntax.html)
#' var.size <- 10 # integer | 
#' var.cursor <- 'cursor_example' # character | The cursor is used to scroll through results. For a query with more results than `size`, the result will include `cursor` in the result json. Use that value here and re-issue the query. The next set or results will be returned. When no more results are available, the `cursor` will again be empty in the result json.
#' var.facet.size <- 10 # integer | The maximum number of records returned for each facet. This has no effect unless one or more facets are specified.
#' var.include.fields <- {} # array[character] | Fields to include in results. The default is to all fields (*)
#' var.exclude.fields <- {} # array[character] | Fields to exclude from results. The default is to not exclude any fields. 
#' var.facets <- {} # array[character] | A list of strings identifying fields for faceted search results. Simple term faceting is used here, meaning that fields that are short text and repeated across records will be binned and counted.
#'
#' #Experiments
#' api.instance <- SRAApi$new()
#'
#' result <- api.instance$ExperimentsSraExperimentsGet(q=var.q, size=var.size, cursor=var.cursor, facet.size=var.facet.size, include.fields=var.include.fields, exclude.fields=var.exclude.fields, facets=var.facets)
#'
#'
#' ####################  MappingSraFieldsEntityGet  ####################
#'
#' library(omicidxClientR)
#' var.entity <- 'entity_example' # character | 
#'
#' #Mapping
#' api.instance <- SRAApi$new()
#'
#' result <- api.instance$MappingSraFieldsEntityGet(var.entity)
#'
#'
#' ####################  RunByAccessionSraRunsAccessionGet  ####################
#'
#' library(omicidxClientR)
#' var.accession <- 'accession_example' # character | An accession for lookup
#' var.include.fields <- {} # array[character] | Fields to include in results. The default is to all fields (*)
#' var.exclude.fields <- {} # array[character] | Fields to exclude from results. The default is to not exclude any fields. 
#'
#' #Run By Accession
#' api.instance <- SRAApi$new()
#'
#' result <- api.instance$RunByAccessionSraRunsAccessionGet(var.accession, include.fields=var.include.fields, exclude.fields=var.exclude.fields)
#'
#'
#' ####################  RunsForExperimentSraExperimentsAccessionRunsGet  ####################
#'
#' library(omicidxClientR)
#' var.accession <- 'accession_example' # character | An accession for lookup
#' var.include.fields <- {} # array[character] | Fields to include in results. The default is to all fields (*)
#' var.exclude.fields <- {} # array[character] | Fields to exclude from results. The default is to not exclude any fields. 
#' var.size <- 10 # integer | 
#' var.cursor <- 'cursor_example' # character | 
#'
#' #Runs For Experiment
#' api.instance <- SRAApi$new()
#'
#' result <- api.instance$RunsForExperimentSraExperimentsAccessionRunsGet(var.accession, include.fields=var.include.fields, exclude.fields=var.exclude.fields, size=var.size, cursor=var.cursor)
#'
#'
#' ####################  RunsForSampleSraSamplesAccessionRunsGet  ####################
#'
#' library(omicidxClientR)
#' var.accession <- 'accession_example' # character | An accession for lookup
#' var.include.fields <- {} # array[character] | Fields to include in results. The default is to all fields (*)
#' var.exclude.fields <- {} # array[character] | Fields to exclude from results. The default is to not exclude any fields. 
#' var.size <- 10 # integer | 
#' var.cursor <- 'cursor_example' # character | 
#'
#' #Runs For Sample
#' api.instance <- SRAApi$new()
#'
#' result <- api.instance$RunsForSampleSraSamplesAccessionRunsGet(var.accession, include.fields=var.include.fields, exclude.fields=var.exclude.fields, size=var.size, cursor=var.cursor)
#'
#'
#' ####################  RunsForStudySraStudiesAccessionRunsGet  ####################
#'
#' library(omicidxClientR)
#' var.accession <- 'accession_example' # character | An accession for lookup
#' var.include.fields <- {} # array[character] | Fields to include in results. The default is to all fields (*)
#' var.exclude.fields <- {} # array[character] | Fields to exclude from results. The default is to not exclude any fields. 
#' var.size <- 10 # integer | 
#' var.cursor <- 'cursor_example' # character | 
#'
#' #Runs For Study
#' api.instance <- SRAApi$new()
#'
#' result <- api.instance$RunsForStudySraStudiesAccessionRunsGet(var.accession, include.fields=var.include.fields, exclude.fields=var.exclude.fields, size=var.size, cursor=var.cursor)
#'
#'
#' ####################  RunsSraRunsGet  ####################
#'
#' library(omicidxClientR)
#' var.q <- 'cancer' # character | The query, using [lucene query syntax](https://lucene.apache.org/core/3_6_0/queryparsersyntax.html)
#' var.size <- 10 # integer | 
#' var.cursor <- 'cursor_example' # character | The cursor is used to scroll through results. For a query with more results than `size`, the result will include `cursor` in the result json. Use that value here and re-issue the query. The next set or results will be returned. When no more results are available, the `cursor` will again be empty in the result json.
#' var.facet.size <- 10 # integer | The maximum number of records returned for each facet. This has no effect unless one or more facets are specified.
#' var.include.fields <- {} # array[character] | Fields to include in results. The default is to all fields (*)
#' var.exclude.fields <- {} # array[character] | Fields to exclude from results. The default is to not exclude any fields. 
#' var.facets <- {} # array[character] | A list of strings identifying fields for faceted search results. Simple term faceting is used here, meaning that fields that are short text and repeated across records will be binned and counted.
#'
#' #Runs
#' api.instance <- SRAApi$new()
#'
#' result <- api.instance$RunsSraRunsGet(q=var.q, size=var.size, cursor=var.cursor, facet.size=var.facet.size, include.fields=var.include.fields, exclude.fields=var.exclude.fields, facets=var.facets)
#'
#'
#' ####################  SampleByAccessionSraSamplesAccessionGet  ####################
#'
#' library(omicidxClientR)
#' var.accession <- 'accession_example' # character | An accession for lookup
#' var.include.fields <- {} # array[character] | Fields to include in results. The default is to all fields (*)
#' var.exclude.fields <- {} # array[character] | Fields to exclude from results. The default is to not exclude any fields. 
#'
#' #Sample By Accession
#' api.instance <- SRAApi$new()
#'
#' result <- api.instance$SampleByAccessionSraSamplesAccessionGet(var.accession, include.fields=var.include.fields, exclude.fields=var.exclude.fields)
#'
#'
#' ####################  SamplesForStudySraStudiesAccessionSamplesGet  ####################
#'
#' library(omicidxClientR)
#' var.accession <- 'accession_example' # character | An accession for lookup
#' var.include.fields <- {} # array[character] | Fields to include in results. The default is to all fields (*)
#' var.exclude.fields <- {} # array[character] | Fields to exclude from results. The default is to not exclude any fields. 
#' var.size <- 10 # integer | 
#' var.cursor <- 'cursor_example' # character | 
#'
#' #Samples For Study
#' api.instance <- SRAApi$new()
#'
#' result <- api.instance$SamplesForStudySraStudiesAccessionSamplesGet(var.accession, include.fields=var.include.fields, exclude.fields=var.exclude.fields, size=var.size, cursor=var.cursor)
#'
#'
#' ####################  SamplesSraSamplesGet  ####################
#'
#' library(omicidxClientR)
#' var.q <- 'cancer' # character | The query, using [lucene query syntax](https://lucene.apache.org/core/3_6_0/queryparsersyntax.html)
#' var.size <- 10 # integer | 
#' var.cursor <- 'cursor_example' # character | The cursor is used to scroll through results. For a query with more results than `size`, the result will include `cursor` in the result json. Use that value here and re-issue the query. The next set or results will be returned. When no more results are available, the `cursor` will again be empty in the result json.
#' var.facet.size <- 10 # integer | The maximum number of records returned for each facet. This has no effect unless one or more facets are specified.
#' var.include.fields <- {} # array[character] | Fields to include in results. The default is to all fields (*)
#' var.exclude.fields <- {} # array[character] | Fields to exclude from results. The default is to not exclude any fields. 
#' var.facets <- {} # array[character] | A list of strings identifying fields for faceted search results. Simple term faceting is used here, meaning that fields that are short text and repeated across records will be binned and counted.
#'
#' #Samples
#' api.instance <- SRAApi$new()
#'
#' result <- api.instance$SamplesSraSamplesGet(q=var.q, size=var.size, cursor=var.cursor, facet.size=var.facet.size, include.fields=var.include.fields, exclude.fields=var.exclude.fields, facets=var.facets)
#'
#'
#' ####################  StudiesSraStudiesGet  ####################
#'
#' library(omicidxClientR)
#' var.q <- 'cancer' # character | The query, using [lucene query syntax](https://lucene.apache.org/core/3_6_0/queryparsersyntax.html)
#' var.size <- 10 # integer | 
#' var.cursor <- 'cursor_example' # character | The cursor is used to scroll through results. For a query with more results than `size`, the result will include `cursor` in the result json. Use that value here and re-issue the query. The next set or results will be returned. When no more results are available, the `cursor` will again be empty in the result json.
#' var.facet.size <- 10 # integer | The maximum number of records returned for each facet. This has no effect unless one or more facets are specified.
#' var.include.fields <- {} # array[character] | Fields to include in results. The default is to all fields (*)
#' var.exclude.fields <- {} # array[character] | Fields to exclude from results. The default is to not exclude any fields. 
#' var.facets <- {} # array[character] | A list of strings identifying fields for faceted search results. Simple term faceting is used here, meaning that fields that are short text and repeated across records will be binned and counted.
#'
#' #Studies
#' api.instance <- SRAApi$new()
#'
#' result <- api.instance$StudiesSraStudiesGet(q=var.q, size=var.size, cursor=var.cursor, facet.size=var.facet.size, include.fields=var.include.fields, exclude.fields=var.exclude.fields, facets=var.facets)
#'
#'
#' ####################  StudyByAccessionSraStudiesAccessionGet  ####################
#'
#' library(omicidxClientR)
#' var.accession <- 'accession_example' # character | An accession for lookup
#' var.include.fields <- {} # array[character] | Fields to include in results. The default is to all fields (*)
#' var.exclude.fields <- {} # array[character] | Fields to exclude from results. The default is to not exclude any fields. 
#'
#' #Study By Accession
#' api.instance <- SRAApi$new()
#'
#' result <- api.instance$StudyByAccessionSraStudiesAccessionGet(var.accession, include.fields=var.include.fields, exclude.fields=var.exclude.fields)
#'
#'
#' }
#' @importFrom R6 R6Class
#' @importFrom base64enc base64encode
#' @export
SRAApi <- R6::R6Class(
  'SRAApi',
  public = list(
    apiClient = NULL,
    initialize = function(apiClient){
      if (!missing(apiClient)) {
        self$apiClient <- apiClient
      }
      else {
        self$apiClient <- ApiClient$new()
      }
    },
    ExperimentByAccessionSraExperimentsAccessionGet = function(accession, include.fields={}, exclude.fields={}, ...){
      apiResponse <- self$ExperimentByAccessionSraExperimentsAccessionGetWithHttpInfo(accession, include.fields, exclude.fields, ...)
      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
      }
    },

    ExperimentByAccessionSraExperimentsAccessionGetWithHttpInfo = function(accession, include.fields={}, exclude.fields={}, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

      queryParams['include_fields'] <- include.fields

      queryParams['exclude_fields'] <- exclude.fields

      body <- NULL
      urlPath <- "/sra/experiments/{accession}"
      if (!missing(`accession`)) {
        urlPath <- gsub(paste0("\\{", "accession", "\\}"), URLencode(as.character(`accession`), 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, "AnyType", loadNamespace("omicidxClientR")),
          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)
      }
    },
    ExperimentsForSampleSraSamplesAccessionExperimentsGet = function(accession, include.fields={}, exclude.fields={}, size=10, cursor=NULL, ...){
      apiResponse <- self$ExperimentsForSampleSraSamplesAccessionExperimentsGetWithHttpInfo(accession, include.fields, exclude.fields, size, cursor, ...)
      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
      }
    },

    ExperimentsForSampleSraSamplesAccessionExperimentsGetWithHttpInfo = function(accession, include.fields={}, exclude.fields={}, size=10, cursor=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

      queryParams['include_fields'] <- include.fields

      queryParams['exclude_fields'] <- exclude.fields

      queryParams['size'] <- size

      queryParams['cursor'] <- cursor

      body <- NULL
      urlPath <- "/sra/samples/{accession}/experiments"
      if (!missing(`accession`)) {
        urlPath <- gsub(paste0("\\{", "accession", "\\}"), URLencode(as.character(`accession`), 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, "AnyType", loadNamespace("omicidxClientR")),
          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)
      }
    },
    ExperimentsForStudySraStudiesAccessionExperimentsGet = function(accession, include.fields={}, exclude.fields={}, size=10, cursor=NULL, ...){
      apiResponse <- self$ExperimentsForStudySraStudiesAccessionExperimentsGetWithHttpInfo(accession, include.fields, exclude.fields, size, cursor, ...)
      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
      }
    },

    ExperimentsForStudySraStudiesAccessionExperimentsGetWithHttpInfo = function(accession, include.fields={}, exclude.fields={}, size=10, cursor=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

      queryParams['include_fields'] <- include.fields

      queryParams['exclude_fields'] <- exclude.fields

      queryParams['size'] <- size

      queryParams['cursor'] <- cursor

      body <- NULL
      urlPath <- "/sra/studies/{accession}/experiments"
      if (!missing(`accession`)) {
        urlPath <- gsub(paste0("\\{", "accession", "\\}"), URLencode(as.character(`accession`), 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, "AnyType", loadNamespace("omicidxClientR")),
          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)
      }
    },
    ExperimentsSraExperimentsGet = function(q=NULL, size=10, cursor=NULL, facet.size=10, include.fields={}, exclude.fields={}, facets={}, ...){
      apiResponse <- self$ExperimentsSraExperimentsGetWithHttpInfo(q, size, cursor, facet.size, include.fields, exclude.fields, facets, ...)
      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
      }
    },

    ExperimentsSraExperimentsGetWithHttpInfo = function(q=NULL, size=10, cursor=NULL, facet.size=10, include.fields={}, exclude.fields={}, facets={}, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      queryParams['q'] <- q

      queryParams['size'] <- size

      queryParams['cursor'] <- cursor

      queryParams['facet_size'] <- facet.size

      queryParams['include_fields'] <- include.fields

      queryParams['exclude_fields'] <- exclude.fields

      queryParams['facets'] <- facets

      body <- NULL
      urlPath <- "/sra/experiments"

      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, "ResponseModel", loadNamespace("omicidxClientR")),
          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)
      }
    },
    MappingSraFieldsEntityGet = function(entity, ...){
      apiResponse <- self$MappingSraFieldsEntityGetWithHttpInfo(entity, ...)
      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
      }
    },

    MappingSraFieldsEntityGetWithHttpInfo = function(entity, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

      body <- NULL
      urlPath <- "/sra/fields/{entity}"
      if (!missing(`entity`)) {
        urlPath <- gsub(paste0("\\{", "entity", "\\}"), URLencode(as.character(`entity`), 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, "AnyType", loadNamespace("omicidxClientR")),
          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)
      }
    },
    RunByAccessionSraRunsAccessionGet = function(accession, include.fields={}, exclude.fields={}, ...){
      apiResponse <- self$RunByAccessionSraRunsAccessionGetWithHttpInfo(accession, include.fields, exclude.fields, ...)
      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
      }
    },

    RunByAccessionSraRunsAccessionGetWithHttpInfo = function(accession, include.fields={}, exclude.fields={}, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

      queryParams['include_fields'] <- include.fields

      queryParams['exclude_fields'] <- exclude.fields

      body <- NULL
      urlPath <- "/sra/runs/{accession}"
      if (!missing(`accession`)) {
        urlPath <- gsub(paste0("\\{", "accession", "\\}"), URLencode(as.character(`accession`), 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, "AnyType", loadNamespace("omicidxClientR")),
          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)
      }
    },
    RunsForExperimentSraExperimentsAccessionRunsGet = function(accession, include.fields={}, exclude.fields={}, size=10, cursor=NULL, ...){
      apiResponse <- self$RunsForExperimentSraExperimentsAccessionRunsGetWithHttpInfo(accession, include.fields, exclude.fields, size, cursor, ...)
      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
      }
    },

    RunsForExperimentSraExperimentsAccessionRunsGetWithHttpInfo = function(accession, include.fields={}, exclude.fields={}, size=10, cursor=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

      queryParams['include_fields'] <- include.fields

      queryParams['exclude_fields'] <- exclude.fields

      queryParams['size'] <- size

      queryParams['cursor'] <- cursor

      body <- NULL
      urlPath <- "/sra/experiments/{accession}/runs"
      if (!missing(`accession`)) {
        urlPath <- gsub(paste0("\\{", "accession", "\\}"), URLencode(as.character(`accession`), 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, "AnyType", loadNamespace("omicidxClientR")),
          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)
      }
    },
    RunsForSampleSraSamplesAccessionRunsGet = function(accession, include.fields={}, exclude.fields={}, size=10, cursor=NULL, ...){
      apiResponse <- self$RunsForSampleSraSamplesAccessionRunsGetWithHttpInfo(accession, include.fields, exclude.fields, size, cursor, ...)
      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
      }
    },

    RunsForSampleSraSamplesAccessionRunsGetWithHttpInfo = function(accession, include.fields={}, exclude.fields={}, size=10, cursor=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

      queryParams['include_fields'] <- include.fields

      queryParams['exclude_fields'] <- exclude.fields

      queryParams['size'] <- size

      queryParams['cursor'] <- cursor

      body <- NULL
      urlPath <- "/sra/samples/{accession}/runs"
      if (!missing(`accession`)) {
        urlPath <- gsub(paste0("\\{", "accession", "\\}"), URLencode(as.character(`accession`), 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, "AnyType", loadNamespace("omicidxClientR")),
          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)
      }
    },
    RunsForStudySraStudiesAccessionRunsGet = function(accession, include.fields={}, exclude.fields={}, size=10, cursor=NULL, ...){
      apiResponse <- self$RunsForStudySraStudiesAccessionRunsGetWithHttpInfo(accession, include.fields, exclude.fields, size, cursor, ...)
      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
      }
    },

    RunsForStudySraStudiesAccessionRunsGetWithHttpInfo = function(accession, include.fields={}, exclude.fields={}, size=10, cursor=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

      queryParams['include_fields'] <- include.fields

      queryParams['exclude_fields'] <- exclude.fields

      queryParams['size'] <- size

      queryParams['cursor'] <- cursor

      body <- NULL
      urlPath <- "/sra/studies/{accession}/runs"
      if (!missing(`accession`)) {
        urlPath <- gsub(paste0("\\{", "accession", "\\}"), URLencode(as.character(`accession`), 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, "AnyType", loadNamespace("omicidxClientR")),
          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)
      }
    },
    RunsSraRunsGet = function(q=NULL, size=10, cursor=NULL, facet.size=10, include.fields={}, exclude.fields={}, facets={}, ...){
      apiResponse <- self$RunsSraRunsGetWithHttpInfo(q, size, cursor, facet.size, include.fields, exclude.fields, facets, ...)
      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
      }
    },

    RunsSraRunsGetWithHttpInfo = function(q=NULL, size=10, cursor=NULL, facet.size=10, include.fields={}, exclude.fields={}, facets={}, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      queryParams['q'] <- q

      queryParams['size'] <- size

      queryParams['cursor'] <- cursor

      queryParams['facet_size'] <- facet.size

      queryParams['include_fields'] <- include.fields

      queryParams['exclude_fields'] <- exclude.fields

      queryParams['facets'] <- facets

      body <- NULL
      urlPath <- "/sra/runs"

      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, "ResponseModel", loadNamespace("omicidxClientR")),
          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)
      }
    },
    SampleByAccessionSraSamplesAccessionGet = function(accession, include.fields={}, exclude.fields={}, ...){
      apiResponse <- self$SampleByAccessionSraSamplesAccessionGetWithHttpInfo(accession, include.fields, exclude.fields, ...)
      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
      }
    },

    SampleByAccessionSraSamplesAccessionGetWithHttpInfo = function(accession, include.fields={}, exclude.fields={}, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

      queryParams['include_fields'] <- include.fields

      queryParams['exclude_fields'] <- exclude.fields

      body <- NULL
      urlPath <- "/sra/samples/{accession}"
      if (!missing(`accession`)) {
        urlPath <- gsub(paste0("\\{", "accession", "\\}"), URLencode(as.character(`accession`), 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, "AnyType", loadNamespace("omicidxClientR")),
          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)
      }
    },
    SamplesForStudySraStudiesAccessionSamplesGet = function(accession, include.fields={}, exclude.fields={}, size=10, cursor=NULL, ...){
      apiResponse <- self$SamplesForStudySraStudiesAccessionSamplesGetWithHttpInfo(accession, include.fields, exclude.fields, size, cursor, ...)
      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
      }
    },

    SamplesForStudySraStudiesAccessionSamplesGetWithHttpInfo = function(accession, include.fields={}, exclude.fields={}, size=10, cursor=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

      queryParams['include_fields'] <- include.fields

      queryParams['exclude_fields'] <- exclude.fields

      queryParams['size'] <- size

      queryParams['cursor'] <- cursor

      body <- NULL
      urlPath <- "/sra/studies/{accession}/samples"
      if (!missing(`accession`)) {
        urlPath <- gsub(paste0("\\{", "accession", "\\}"), URLencode(as.character(`accession`), 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, "AnyType", loadNamespace("omicidxClientR")),
          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)
      }
    },
    SamplesSraSamplesGet = function(q=NULL, size=10, cursor=NULL, facet.size=10, include.fields={}, exclude.fields={}, facets={}, ...){
      apiResponse <- self$SamplesSraSamplesGetWithHttpInfo(q, size, cursor, facet.size, include.fields, exclude.fields, facets, ...)
      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
      }
    },

    SamplesSraSamplesGetWithHttpInfo = function(q=NULL, size=10, cursor=NULL, facet.size=10, include.fields={}, exclude.fields={}, facets={}, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      queryParams['q'] <- q

      queryParams['size'] <- size

      queryParams['cursor'] <- cursor

      queryParams['facet_size'] <- facet.size

      queryParams['include_fields'] <- include.fields

      queryParams['exclude_fields'] <- exclude.fields

      queryParams['facets'] <- facets

      body <- NULL
      urlPath <- "/sra/samples"

      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, "ResponseModel", loadNamespace("omicidxClientR")),
          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)
      }
    },
    StudiesSraStudiesGet = function(q=NULL, size=10, cursor=NULL, facet.size=10, include.fields={}, exclude.fields={}, facets={}, ...){
      apiResponse <- self$StudiesSraStudiesGetWithHttpInfo(q, size, cursor, facet.size, include.fields, exclude.fields, facets, ...)
      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
      }
    },

    StudiesSraStudiesGetWithHttpInfo = function(q=NULL, size=10, cursor=NULL, facet.size=10, include.fields={}, exclude.fields={}, facets={}, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      queryParams['q'] <- q

      queryParams['size'] <- size

      queryParams['cursor'] <- cursor

      queryParams['facet_size'] <- facet.size

      queryParams['include_fields'] <- include.fields

      queryParams['exclude_fields'] <- exclude.fields

      queryParams['facets'] <- facets

      body <- NULL
      urlPath <- "/sra/studies"

      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, "ResponseModel", loadNamespace("omicidxClientR")),
          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)
      }
    },
    StudyByAccessionSraStudiesAccessionGet = function(accession, include.fields={}, exclude.fields={}, ...){
      apiResponse <- self$StudyByAccessionSraStudiesAccessionGetWithHttpInfo(accession, include.fields, exclude.fields, ...)
      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
      }
    },

    StudyByAccessionSraStudiesAccessionGetWithHttpInfo = function(accession, include.fields={}, exclude.fields={}, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

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

      queryParams['include_fields'] <- include.fields

      queryParams['exclude_fields'] <- exclude.fields

      body <- NULL
      urlPath <- "/sra/studies/{accession}"
      if (!missing(`accession`)) {
        urlPath <- gsub(paste0("\\{", "accession", "\\}"), URLencode(as.character(`accession`), 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, "AnyType", loadNamespace("omicidxClientR")),
          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)
      }
    }
  )
)
sdgamboa/omicidxClientR documentation built on Dec. 22, 2021, 11:12 p.m.