R/download_list_services_api.R

#' Synapse REST API
#'
#' No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
#'
#' The version of the OpenAPI document: v1
#' Generated by: https://openapi-generator.tech
#'
#' @docType class
#' @title DownloadListServices operations
#' @description DownloadListServicesApi
#' @format An \code{R6Class} generator object
#' @field api_client Handles the client-server communication.
#'
#' @section Methods:
#' \describe{
#' \strong{ DeleteRepoV1DownloadList } \emph{  }
#'
#' \itemize{
#'
#'
#' \item status code : 200 | Void
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ GetRepoV1DownloadListAddAsyncGetAsyncToken } \emph{  }
#'
#' \itemize{
#' \item \emph{ @param } async_token character
#' \item \emph{ @returnType } \link{OrgSagebionetworksRepoModelDownloadAddToDownloadListResponse} \cr
#'
#'
#' \item status code : 201 | Auto-generated description
#'
#' \item return type : OrgSagebionetworksRepoModelDownloadAddToDownloadListResponse
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ GetRepoV1DownloadListManifestAsyncGetAsyncToken } \emph{  }
#'
#' \itemize{
#' \item \emph{ @param } async_token character
#' \item \emph{ @returnType } \link{OrgSagebionetworksRepoModelDownloadDownloadListManifestResponse} \cr
#'
#'
#' \item status code : 201 | Auto-generated description
#'
#' \item return type : OrgSagebionetworksRepoModelDownloadDownloadListManifestResponse
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ GetRepoV1DownloadListPackageAsyncGetAsyncToken } \emph{  }
#'
#' \itemize{
#' \item \emph{ @param } async_token character
#' \item \emph{ @returnType } \link{OrgSagebionetworksRepoModelDownloadDownloadListPackageResponse} \cr
#'
#'
#' \item status code : 201 | Auto-generated description
#'
#' \item return type : OrgSagebionetworksRepoModelDownloadDownloadListPackageResponse
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ GetRepoV1DownloadListQueryAsyncGetAsyncToken } \emph{  }
#'
#' \itemize{
#' \item \emph{ @param } async_token character
#' \item \emph{ @returnType } \link{OrgSagebionetworksRepoModelDownloadDownloadListQueryResponse} \cr
#'
#'
#' \item status code : 201 | Auto-generated description
#'
#' \item return type : OrgSagebionetworksRepoModelDownloadDownloadListQueryResponse
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ PostRepoV1DownloadListAdd } \emph{  }
#'
#' \itemize{
#' \item \emph{ @param } org_sagebionetworks_repo_model_download_add_batch_of_files_to_download_list_request \link{OrgSagebionetworksRepoModelDownloadAddBatchOfFilesToDownloadListRequest}
#' \item \emph{ @returnType } \link{OrgSagebionetworksRepoModelDownloadAddBatchOfFilesToDownloadListResponse} \cr
#'
#'
#' \item status code : 200 | Auto-generated description
#'
#' \item return type : OrgSagebionetworksRepoModelDownloadAddBatchOfFilesToDownloadListResponse
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ PostRepoV1DownloadListAddAsyncStart } \emph{  }
#'
#' \itemize{
#' \item \emph{ @param } org_sagebionetworks_repo_model_download_add_to_download_list_request \link{OrgSagebionetworksRepoModelDownloadAddToDownloadListRequest}
#' \item \emph{ @returnType } \link{OrgSagebionetworksRepoModelAsynchAsyncJobId} \cr
#'
#'
#' \item status code : 201 | Auto-generated description
#'
#' \item return type : OrgSagebionetworksRepoModelAsynchAsyncJobId
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ PostRepoV1DownloadListManifestAsyncStart } \emph{  }
#'
#' \itemize{
#' \item \emph{ @param } org_sagebionetworks_repo_model_download_download_list_manifest_request \link{OrgSagebionetworksRepoModelDownloadDownloadListManifestRequest}
#' \item \emph{ @returnType } \link{OrgSagebionetworksRepoModelAsynchAsyncJobId} \cr
#'
#'
#' \item status code : 201 | Auto-generated description
#'
#' \item return type : OrgSagebionetworksRepoModelAsynchAsyncJobId
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ PostRepoV1DownloadListPackageAsyncStart } \emph{  }
#'
#' \itemize{
#' \item \emph{ @param } org_sagebionetworks_repo_model_download_download_list_package_request \link{OrgSagebionetworksRepoModelDownloadDownloadListPackageRequest}
#' \item \emph{ @returnType } \link{OrgSagebionetworksRepoModelAsynchAsyncJobId} \cr
#'
#'
#' \item status code : 201 | Auto-generated description
#'
#' \item return type : OrgSagebionetworksRepoModelAsynchAsyncJobId
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ PostRepoV1DownloadListQueryAsyncStart } \emph{  }
#'
#' \itemize{
#' \item \emph{ @param } org_sagebionetworks_repo_model_download_download_list_query_request \link{OrgSagebionetworksRepoModelDownloadDownloadListQueryRequest}
#' \item \emph{ @returnType } \link{OrgSagebionetworksRepoModelAsynchAsyncJobId} \cr
#'
#'
#' \item status code : 201 | Auto-generated description
#'
#' \item return type : OrgSagebionetworksRepoModelAsynchAsyncJobId
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ PostRepoV1DownloadListRemove } \emph{  }
#'
#' \itemize{
#' \item \emph{ @param } org_sagebionetworks_repo_model_download_remove_batch_of_files_from_download_list_request \link{OrgSagebionetworksRepoModelDownloadRemoveBatchOfFilesFromDownloadListRequest}
#' \item \emph{ @returnType } \link{OrgSagebionetworksRepoModelDownloadRemoveBatchOfFilesFromDownloadListResponse} \cr
#'
#'
#' \item status code : 200 | Auto-generated description
#'
#' \item return type : OrgSagebionetworksRepoModelDownloadRemoveBatchOfFilesFromDownloadListResponse
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' }
#'
#'
#' @examples
#' \dontrun{
#' ####################  DeleteRepoV1DownloadList  ####################
#'
#' library(synclient)
#'
#' api_instance <- DownloadListServicesApi$new()
#'
#' # Configure HTTP bearer authorization: bearerAuth
#' api_instance$api_client$bearer_token <- Sys.getenv("BEARER_TOKEN")
#'
#' api_instance$DeleteRepoV1DownloadList()
#'
#'
#' ####################  GetRepoV1DownloadListAddAsyncGetAsyncToken  ####################
#'
#' library(synclient)
#' var_async_token <- "async_token_example" # character | 
#'
#' api_instance <- DownloadListServicesApi$new()
#'
#' # Configure HTTP bearer authorization: bearerAuth
#' api_instance$api_client$bearer_token <- Sys.getenv("BEARER_TOKEN")
#'
#' # to save the result into a file, simply add the optional `data_file` parameter, e.g.
#' # result <- api_instance$GetRepoV1DownloadListAddAsyncGetAsyncToken(var_async_tokendata_file = "result.txt")
#' result <- api_instance$GetRepoV1DownloadListAddAsyncGetAsyncToken(var_async_token)
#' dput(result)
#'
#'
#' ####################  GetRepoV1DownloadListManifestAsyncGetAsyncToken  ####################
#'
#' library(synclient)
#' var_async_token <- "async_token_example" # character | 
#'
#' api_instance <- DownloadListServicesApi$new()
#'
#' # Configure HTTP bearer authorization: bearerAuth
#' api_instance$api_client$bearer_token <- Sys.getenv("BEARER_TOKEN")
#'
#' # to save the result into a file, simply add the optional `data_file` parameter, e.g.
#' # result <- api_instance$GetRepoV1DownloadListManifestAsyncGetAsyncToken(var_async_tokendata_file = "result.txt")
#' result <- api_instance$GetRepoV1DownloadListManifestAsyncGetAsyncToken(var_async_token)
#' dput(result)
#'
#'
#' ####################  GetRepoV1DownloadListPackageAsyncGetAsyncToken  ####################
#'
#' library(synclient)
#' var_async_token <- "async_token_example" # character | 
#'
#' api_instance <- DownloadListServicesApi$new()
#'
#' # Configure HTTP bearer authorization: bearerAuth
#' api_instance$api_client$bearer_token <- Sys.getenv("BEARER_TOKEN")
#'
#' # to save the result into a file, simply add the optional `data_file` parameter, e.g.
#' # result <- api_instance$GetRepoV1DownloadListPackageAsyncGetAsyncToken(var_async_tokendata_file = "result.txt")
#' result <- api_instance$GetRepoV1DownloadListPackageAsyncGetAsyncToken(var_async_token)
#' dput(result)
#'
#'
#' ####################  GetRepoV1DownloadListQueryAsyncGetAsyncToken  ####################
#'
#' library(synclient)
#' var_async_token <- "async_token_example" # character | 
#'
#' api_instance <- DownloadListServicesApi$new()
#'
#' # Configure HTTP bearer authorization: bearerAuth
#' api_instance$api_client$bearer_token <- Sys.getenv("BEARER_TOKEN")
#'
#' # to save the result into a file, simply add the optional `data_file` parameter, e.g.
#' # result <- api_instance$GetRepoV1DownloadListQueryAsyncGetAsyncToken(var_async_tokendata_file = "result.txt")
#' result <- api_instance$GetRepoV1DownloadListQueryAsyncGetAsyncToken(var_async_token)
#' dput(result)
#'
#'
#' ####################  PostRepoV1DownloadListAdd  ####################
#'
#' library(synclient)
#' var_org_sagebionetworks_repo_model_download_add_batch_of_files_to_download_list_request <- org.sagebionetworks.repo.model.download.AddBatchOfFilesToDownloadListRequest$new(c(org.sagebionetworks.repo.model.download.DownloadListItem$new("fileEntityId_example", 123))) # OrgSagebionetworksRepoModelDownloadAddBatchOfFilesToDownloadListRequest | 
#'
#' api_instance <- DownloadListServicesApi$new()
#'
#' # Configure HTTP bearer authorization: bearerAuth
#' api_instance$api_client$bearer_token <- Sys.getenv("BEARER_TOKEN")
#'
#' # to save the result into a file, simply add the optional `data_file` parameter, e.g.
#' # result <- api_instance$PostRepoV1DownloadListAdd(var_org_sagebionetworks_repo_model_download_add_batch_of_files_to_download_list_requestdata_file = "result.txt")
#' result <- api_instance$PostRepoV1DownloadListAdd(var_org_sagebionetworks_repo_model_download_add_batch_of_files_to_download_list_request)
#' dput(result)
#'
#'
#' ####################  PostRepoV1DownloadListAddAsyncStart  ####################
#'
#' library(synclient)
#' var_org_sagebionetworks_repo_model_download_add_to_download_list_request <- org.sagebionetworks.repo.model.download.AddToDownloadListRequest$new("concreteType_example", org.sagebionetworks.repo.model.table.Query$new("sql_example", c(org.sagebionetworks.repo.model.table.QueryFilter$new("concreteType_example", "isDefiningCondition_example", "columnName_example", "function_example", c("values_example"), "operator_example", "searchExpression_example")), c(org.sagebionetworks.repo.model.table.FacetColumnRequest$new("concreteType_example", "columnName_example", "jsonPath_example", c("facetValues_example"), "min_example", "max_example")), "includeEntityEtag_example", 123, 123, 123, c(org.sagebionetworks.repo.model.table.SortItem$new("column_example", "direction_example"))), "parentId_example", "useVersionNumber_example") # OrgSagebionetworksRepoModelDownloadAddToDownloadListRequest | 
#'
#' api_instance <- DownloadListServicesApi$new()
#'
#' # Configure HTTP bearer authorization: bearerAuth
#' api_instance$api_client$bearer_token <- Sys.getenv("BEARER_TOKEN")
#'
#' # to save the result into a file, simply add the optional `data_file` parameter, e.g.
#' # result <- api_instance$PostRepoV1DownloadListAddAsyncStart(var_org_sagebionetworks_repo_model_download_add_to_download_list_requestdata_file = "result.txt")
#' result <- api_instance$PostRepoV1DownloadListAddAsyncStart(var_org_sagebionetworks_repo_model_download_add_to_download_list_request)
#' dput(result)
#'
#'
#' ####################  PostRepoV1DownloadListManifestAsyncStart  ####################
#'
#' library(synclient)
#' var_org_sagebionetworks_repo_model_download_download_list_manifest_request <- org.sagebionetworks.repo.model.download.DownloadListManifestRequest$new("concreteType_example", org.sagebionetworks.repo.model.table.CsvTableDescriptor$new("separator_example", "quoteCharacter_example", "escapeCharacter_example", "lineEnd_example", "isFirstLineHeader_example")) # OrgSagebionetworksRepoModelDownloadDownloadListManifestRequest | 
#'
#' api_instance <- DownloadListServicesApi$new()
#'
#' # Configure HTTP bearer authorization: bearerAuth
#' api_instance$api_client$bearer_token <- Sys.getenv("BEARER_TOKEN")
#'
#' # to save the result into a file, simply add the optional `data_file` parameter, e.g.
#' # result <- api_instance$PostRepoV1DownloadListManifestAsyncStart(var_org_sagebionetworks_repo_model_download_download_list_manifest_requestdata_file = "result.txt")
#' result <- api_instance$PostRepoV1DownloadListManifestAsyncStart(var_org_sagebionetworks_repo_model_download_download_list_manifest_request)
#' dput(result)
#'
#'
#' ####################  PostRepoV1DownloadListPackageAsyncStart  ####################
#'
#' library(synclient)
#' var_org_sagebionetworks_repo_model_download_download_list_package_request <- org.sagebionetworks.repo.model.download.DownloadListPackageRequest$new("concreteType_example", "zipFileName_example", "includeManifest_example", org.sagebionetworks.repo.model.table.CsvTableDescriptor$new("separator_example", "quoteCharacter_example", "escapeCharacter_example", "lineEnd_example", "isFirstLineHeader_example")) # OrgSagebionetworksRepoModelDownloadDownloadListPackageRequest | 
#'
#' api_instance <- DownloadListServicesApi$new()
#'
#' # Configure HTTP bearer authorization: bearerAuth
#' api_instance$api_client$bearer_token <- Sys.getenv("BEARER_TOKEN")
#'
#' # to save the result into a file, simply add the optional `data_file` parameter, e.g.
#' # result <- api_instance$PostRepoV1DownloadListPackageAsyncStart(var_org_sagebionetworks_repo_model_download_download_list_package_requestdata_file = "result.txt")
#' result <- api_instance$PostRepoV1DownloadListPackageAsyncStart(var_org_sagebionetworks_repo_model_download_download_list_package_request)
#' dput(result)
#'
#'
#' ####################  PostRepoV1DownloadListQueryAsyncStart  ####################
#'
#' library(synclient)
#' var_org_sagebionetworks_repo_model_download_download_list_query_request <- org.sagebionetworks.repo.model.download.DownloadListQueryRequest$new("concreteType_example", org.sagebionetworks.repo.model.download.QueryRequestDetails$new("concreteType_example", "nextPageToken_example", c(org.sagebionetworks.repo.model.download.Sort$new("field_example", "direction_example")), "filter_example")) # OrgSagebionetworksRepoModelDownloadDownloadListQueryRequest | 
#'
#' api_instance <- DownloadListServicesApi$new()
#'
#' # Configure HTTP bearer authorization: bearerAuth
#' api_instance$api_client$bearer_token <- Sys.getenv("BEARER_TOKEN")
#'
#' # to save the result into a file, simply add the optional `data_file` parameter, e.g.
#' # result <- api_instance$PostRepoV1DownloadListQueryAsyncStart(var_org_sagebionetworks_repo_model_download_download_list_query_requestdata_file = "result.txt")
#' result <- api_instance$PostRepoV1DownloadListQueryAsyncStart(var_org_sagebionetworks_repo_model_download_download_list_query_request)
#' dput(result)
#'
#'
#' ####################  PostRepoV1DownloadListRemove  ####################
#'
#' library(synclient)
#' var_org_sagebionetworks_repo_model_download_remove_batch_of_files_from_download_list_request <- org.sagebionetworks.repo.model.download.RemoveBatchOfFilesFromDownloadListRequest$new(c(org.sagebionetworks.repo.model.download.DownloadListItem$new("fileEntityId_example", 123))) # OrgSagebionetworksRepoModelDownloadRemoveBatchOfFilesFromDownloadListRequest | 
#'
#' api_instance <- DownloadListServicesApi$new()
#'
#' # Configure HTTP bearer authorization: bearerAuth
#' api_instance$api_client$bearer_token <- Sys.getenv("BEARER_TOKEN")
#'
#' # to save the result into a file, simply add the optional `data_file` parameter, e.g.
#' # result <- api_instance$PostRepoV1DownloadListRemove(var_org_sagebionetworks_repo_model_download_remove_batch_of_files_from_download_list_requestdata_file = "result.txt")
#' result <- api_instance$PostRepoV1DownloadListRemove(var_org_sagebionetworks_repo_model_download_remove_batch_of_files_from_download_list_request)
#' dput(result)
#'
#'
#' }
#' @importFrom R6 R6Class
#' @importFrom base64enc base64encode
#' @export
DownloadListServicesApi <- R6::R6Class(
  "DownloadListServicesApi",
  public = list(
    api_client = NULL,
    #' Initialize a new DownloadListServicesApi.
    #'
    #' @description
    #' Initialize a new DownloadListServicesApi.
    #'
    #' @param api_client An instance of API client.
    #' @export
    initialize = function(api_client) {
      if (!missing(api_client)) {
        self$api_client <- api_client
      } else {
        self$api_client <- ApiClient$new()
      }
    },
    #' 
    #'
    #' @description
    #' 
    #'
    #' @param ... Other optional arguments
    #' @return void
    #' @export
    DeleteRepoV1DownloadList = function(...) {
      local_var_response <- self$DeleteRepoV1DownloadListWithHttpInfo(...)
      if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) {
        local_var_response$content
      } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) {
        local_var_response
      } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) {
        local_var_response
      } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) {
        local_var_response
      }
    },
    #' 
    #'
    #' @description
    #' 
    #'
    #' @param ... Other optional arguments
    #' @return API response (void) with additional information such as HTTP status code, headers
    #' @export
    DeleteRepoV1DownloadListWithHttpInfo = function(...) {
      args <- list(...)
      query_params <- list()
      header_params <- c()
      form_params <- list()
      file_params <- list()
      local_var_body <- NULL
      oauth_scopes <- NULL
      is_oauth <- FALSE

      local_var_url_path <- "/repo/v1/download/list"
      # Bearer token
      if (!is.null(self$api_client$bearer_token)) {
        header_params["Authorization"] <- paste("Bearer", self$api_client$bearer_token, sep = " ")
      }

      # The Accept request HTTP header
      local_var_accepts <- list()

      # The Content-Type representation header
      local_var_content_types <- list()

      local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
                                 method = "DELETE",
                                 query_params = query_params,
                                 header_params = header_params,
                                 form_params = form_params,
                                 file_params = file_params,
                                 accepts = local_var_accepts,
                                 content_types = local_var_content_types,
                                 body = local_var_body,
                                 is_oauth = is_oauth,
                                 oauth_scopes = oauth_scopes,
                                 ...)

      if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
        local_var_resp$content <- NULL
        local_var_resp
      } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) {
        ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp)
      } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) {
        ApiResponse$new("API client error", local_var_resp)
      } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) {
        if (is.null(local_var_resp$response) || local_var_resp$response == "") {
          local_var_resp$response <- "API server error"
        }
        local_var_resp
      }
    },
    #' 
    #'
    #' @description
    #' 
    #'
    #' @param async_token 
    #' @param data_file (optional) name of the data file to save the result
    #' @param ... Other optional arguments
    #' @return OrgSagebionetworksRepoModelDownloadAddToDownloadListResponse
    #' @export
    GetRepoV1DownloadListAddAsyncGetAsyncToken = function(async_token, data_file = NULL, ...) {
      local_var_response <- self$GetRepoV1DownloadListAddAsyncGetAsyncTokenWithHttpInfo(async_token, data_file = data_file, ...)
      if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) {
        local_var_response$content
      } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) {
        local_var_response
      } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) {
        local_var_response
      } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) {
        local_var_response
      }
    },
    #' 
    #'
    #' @description
    #' 
    #'
    #' @param async_token 
    #' @param data_file (optional) name of the data file to save the result
    #' @param ... Other optional arguments
    #' @return API response (OrgSagebionetworksRepoModelDownloadAddToDownloadListResponse) with additional information such as HTTP status code, headers
    #' @export
    GetRepoV1DownloadListAddAsyncGetAsyncTokenWithHttpInfo = function(async_token, data_file = NULL, ...) {
      args <- list(...)
      query_params <- list()
      header_params <- c()
      form_params <- list()
      file_params <- list()
      local_var_body <- NULL
      oauth_scopes <- NULL
      is_oauth <- FALSE

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


      local_var_url_path <- "/repo/v1/download/list/add/async/get/{asyncToken}"
      if (!missing(`async_token`)) {
        local_var_url_path <- gsub("\\{asyncToken\\}", URLencode(as.character(`async_token`), reserved = TRUE), local_var_url_path)
      }

      # Bearer token
      if (!is.null(self$api_client$bearer_token)) {
        header_params["Authorization"] <- paste("Bearer", self$api_client$bearer_token, sep = " ")
      }

      # The Accept request HTTP header
      local_var_accepts <- list("application/json")

      # The Content-Type representation header
      local_var_content_types <- list()

      local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
                                 method = "GET",
                                 query_params = query_params,
                                 header_params = header_params,
                                 form_params = form_params,
                                 file_params = file_params,
                                 accepts = local_var_accepts,
                                 content_types = local_var_content_types,
                                 body = local_var_body,
                                 is_oauth = is_oauth,
                                 oauth_scopes = oauth_scopes,
                                 ...)

      if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
        # save response in a file
        if (!is.null(data_file)) {
          write(local_var_resp$response, data_file)
        }

        deserialized_resp_obj <- tryCatch(
          self$api_client$deserialize(local_var_resp$response_as_text(), "OrgSagebionetworksRepoModelDownloadAddToDownloadListResponse", loadNamespace("synclient")),
          error = function(e) {
            stop("Failed to deserialize response")
          }
        )
        local_var_resp$content <- deserialized_resp_obj
        local_var_resp
      } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) {
        ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp)
      } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) {
        ApiResponse$new("API client error", local_var_resp)
      } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) {
        if (is.null(local_var_resp$response) || local_var_resp$response == "") {
          local_var_resp$response <- "API server error"
        }
        local_var_resp
      }
    },
    #' 
    #'
    #' @description
    #' 
    #'
    #' @param async_token 
    #' @param data_file (optional) name of the data file to save the result
    #' @param ... Other optional arguments
    #' @return OrgSagebionetworksRepoModelDownloadDownloadListManifestResponse
    #' @export
    GetRepoV1DownloadListManifestAsyncGetAsyncToken = function(async_token, data_file = NULL, ...) {
      local_var_response <- self$GetRepoV1DownloadListManifestAsyncGetAsyncTokenWithHttpInfo(async_token, data_file = data_file, ...)
      if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) {
        local_var_response$content
      } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) {
        local_var_response
      } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) {
        local_var_response
      } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) {
        local_var_response
      }
    },
    #' 
    #'
    #' @description
    #' 
    #'
    #' @param async_token 
    #' @param data_file (optional) name of the data file to save the result
    #' @param ... Other optional arguments
    #' @return API response (OrgSagebionetworksRepoModelDownloadDownloadListManifestResponse) with additional information such as HTTP status code, headers
    #' @export
    GetRepoV1DownloadListManifestAsyncGetAsyncTokenWithHttpInfo = function(async_token, data_file = NULL, ...) {
      args <- list(...)
      query_params <- list()
      header_params <- c()
      form_params <- list()
      file_params <- list()
      local_var_body <- NULL
      oauth_scopes <- NULL
      is_oauth <- FALSE

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


      local_var_url_path <- "/repo/v1/download/list/manifest/async/get/{asyncToken}"
      if (!missing(`async_token`)) {
        local_var_url_path <- gsub("\\{asyncToken\\}", URLencode(as.character(`async_token`), reserved = TRUE), local_var_url_path)
      }

      # Bearer token
      if (!is.null(self$api_client$bearer_token)) {
        header_params["Authorization"] <- paste("Bearer", self$api_client$bearer_token, sep = " ")
      }

      # The Accept request HTTP header
      local_var_accepts <- list("application/json")

      # The Content-Type representation header
      local_var_content_types <- list()

      local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
                                 method = "GET",
                                 query_params = query_params,
                                 header_params = header_params,
                                 form_params = form_params,
                                 file_params = file_params,
                                 accepts = local_var_accepts,
                                 content_types = local_var_content_types,
                                 body = local_var_body,
                                 is_oauth = is_oauth,
                                 oauth_scopes = oauth_scopes,
                                 ...)

      if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
        # save response in a file
        if (!is.null(data_file)) {
          write(local_var_resp$response, data_file)
        }

        deserialized_resp_obj <- tryCatch(
          self$api_client$deserialize(local_var_resp$response_as_text(), "OrgSagebionetworksRepoModelDownloadDownloadListManifestResponse", loadNamespace("synclient")),
          error = function(e) {
            stop("Failed to deserialize response")
          }
        )
        local_var_resp$content <- deserialized_resp_obj
        local_var_resp
      } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) {
        ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp)
      } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) {
        ApiResponse$new("API client error", local_var_resp)
      } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) {
        if (is.null(local_var_resp$response) || local_var_resp$response == "") {
          local_var_resp$response <- "API server error"
        }
        local_var_resp
      }
    },
    #' 
    #'
    #' @description
    #' 
    #'
    #' @param async_token 
    #' @param data_file (optional) name of the data file to save the result
    #' @param ... Other optional arguments
    #' @return OrgSagebionetworksRepoModelDownloadDownloadListPackageResponse
    #' @export
    GetRepoV1DownloadListPackageAsyncGetAsyncToken = function(async_token, data_file = NULL, ...) {
      local_var_response <- self$GetRepoV1DownloadListPackageAsyncGetAsyncTokenWithHttpInfo(async_token, data_file = data_file, ...)
      if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) {
        local_var_response$content
      } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) {
        local_var_response
      } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) {
        local_var_response
      } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) {
        local_var_response
      }
    },
    #' 
    #'
    #' @description
    #' 
    #'
    #' @param async_token 
    #' @param data_file (optional) name of the data file to save the result
    #' @param ... Other optional arguments
    #' @return API response (OrgSagebionetworksRepoModelDownloadDownloadListPackageResponse) with additional information such as HTTP status code, headers
    #' @export
    GetRepoV1DownloadListPackageAsyncGetAsyncTokenWithHttpInfo = function(async_token, data_file = NULL, ...) {
      args <- list(...)
      query_params <- list()
      header_params <- c()
      form_params <- list()
      file_params <- list()
      local_var_body <- NULL
      oauth_scopes <- NULL
      is_oauth <- FALSE

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


      local_var_url_path <- "/repo/v1/download/list/package/async/get/{asyncToken}"
      if (!missing(`async_token`)) {
        local_var_url_path <- gsub("\\{asyncToken\\}", URLencode(as.character(`async_token`), reserved = TRUE), local_var_url_path)
      }

      # Bearer token
      if (!is.null(self$api_client$bearer_token)) {
        header_params["Authorization"] <- paste("Bearer", self$api_client$bearer_token, sep = " ")
      }

      # The Accept request HTTP header
      local_var_accepts <- list("application/json")

      # The Content-Type representation header
      local_var_content_types <- list()

      local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
                                 method = "GET",
                                 query_params = query_params,
                                 header_params = header_params,
                                 form_params = form_params,
                                 file_params = file_params,
                                 accepts = local_var_accepts,
                                 content_types = local_var_content_types,
                                 body = local_var_body,
                                 is_oauth = is_oauth,
                                 oauth_scopes = oauth_scopes,
                                 ...)

      if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
        # save response in a file
        if (!is.null(data_file)) {
          write(local_var_resp$response, data_file)
        }

        deserialized_resp_obj <- tryCatch(
          self$api_client$deserialize(local_var_resp$response_as_text(), "OrgSagebionetworksRepoModelDownloadDownloadListPackageResponse", loadNamespace("synclient")),
          error = function(e) {
            stop("Failed to deserialize response")
          }
        )
        local_var_resp$content <- deserialized_resp_obj
        local_var_resp
      } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) {
        ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp)
      } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) {
        ApiResponse$new("API client error", local_var_resp)
      } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) {
        if (is.null(local_var_resp$response) || local_var_resp$response == "") {
          local_var_resp$response <- "API server error"
        }
        local_var_resp
      }
    },
    #' 
    #'
    #' @description
    #' 
    #'
    #' @param async_token 
    #' @param data_file (optional) name of the data file to save the result
    #' @param ... Other optional arguments
    #' @return OrgSagebionetworksRepoModelDownloadDownloadListQueryResponse
    #' @export
    GetRepoV1DownloadListQueryAsyncGetAsyncToken = function(async_token, data_file = NULL, ...) {
      local_var_response <- self$GetRepoV1DownloadListQueryAsyncGetAsyncTokenWithHttpInfo(async_token, data_file = data_file, ...)
      if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) {
        local_var_response$content
      } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) {
        local_var_response
      } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) {
        local_var_response
      } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) {
        local_var_response
      }
    },
    #' 
    #'
    #' @description
    #' 
    #'
    #' @param async_token 
    #' @param data_file (optional) name of the data file to save the result
    #' @param ... Other optional arguments
    #' @return API response (OrgSagebionetworksRepoModelDownloadDownloadListQueryResponse) with additional information such as HTTP status code, headers
    #' @export
    GetRepoV1DownloadListQueryAsyncGetAsyncTokenWithHttpInfo = function(async_token, data_file = NULL, ...) {
      args <- list(...)
      query_params <- list()
      header_params <- c()
      form_params <- list()
      file_params <- list()
      local_var_body <- NULL
      oauth_scopes <- NULL
      is_oauth <- FALSE

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


      local_var_url_path <- "/repo/v1/download/list/query/async/get/{asyncToken}"
      if (!missing(`async_token`)) {
        local_var_url_path <- gsub("\\{asyncToken\\}", URLencode(as.character(`async_token`), reserved = TRUE), local_var_url_path)
      }

      # Bearer token
      if (!is.null(self$api_client$bearer_token)) {
        header_params["Authorization"] <- paste("Bearer", self$api_client$bearer_token, sep = " ")
      }

      # The Accept request HTTP header
      local_var_accepts <- list("application/json")

      # The Content-Type representation header
      local_var_content_types <- list()

      local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
                                 method = "GET",
                                 query_params = query_params,
                                 header_params = header_params,
                                 form_params = form_params,
                                 file_params = file_params,
                                 accepts = local_var_accepts,
                                 content_types = local_var_content_types,
                                 body = local_var_body,
                                 is_oauth = is_oauth,
                                 oauth_scopes = oauth_scopes,
                                 ...)

      if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
        # save response in a file
        if (!is.null(data_file)) {
          write(local_var_resp$response, data_file)
        }

        deserialized_resp_obj <- tryCatch(
          self$api_client$deserialize(local_var_resp$response_as_text(), "OrgSagebionetworksRepoModelDownloadDownloadListQueryResponse", loadNamespace("synclient")),
          error = function(e) {
            stop("Failed to deserialize response")
          }
        )
        local_var_resp$content <- deserialized_resp_obj
        local_var_resp
      } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) {
        ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp)
      } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) {
        ApiResponse$new("API client error", local_var_resp)
      } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) {
        if (is.null(local_var_resp$response) || local_var_resp$response == "") {
          local_var_resp$response <- "API server error"
        }
        local_var_resp
      }
    },
    #' 
    #'
    #' @description
    #' 
    #'
    #' @param org_sagebionetworks_repo_model_download_add_batch_of_files_to_download_list_request 
    #' @param data_file (optional) name of the data file to save the result
    #' @param ... Other optional arguments
    #' @return OrgSagebionetworksRepoModelDownloadAddBatchOfFilesToDownloadListResponse
    #' @export
    PostRepoV1DownloadListAdd = function(org_sagebionetworks_repo_model_download_add_batch_of_files_to_download_list_request, data_file = NULL, ...) {
      local_var_response <- self$PostRepoV1DownloadListAddWithHttpInfo(org_sagebionetworks_repo_model_download_add_batch_of_files_to_download_list_request, data_file = data_file, ...)
      if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) {
        local_var_response$content
      } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) {
        local_var_response
      } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) {
        local_var_response
      } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) {
        local_var_response
      }
    },
    #' 
    #'
    #' @description
    #' 
    #'
    #' @param org_sagebionetworks_repo_model_download_add_batch_of_files_to_download_list_request 
    #' @param data_file (optional) name of the data file to save the result
    #' @param ... Other optional arguments
    #' @return API response (OrgSagebionetworksRepoModelDownloadAddBatchOfFilesToDownloadListResponse) with additional information such as HTTP status code, headers
    #' @export
    PostRepoV1DownloadListAddWithHttpInfo = function(org_sagebionetworks_repo_model_download_add_batch_of_files_to_download_list_request, data_file = NULL, ...) {
      args <- list(...)
      query_params <- list()
      header_params <- c()
      form_params <- list()
      file_params <- list()
      local_var_body <- NULL
      oauth_scopes <- NULL
      is_oauth <- FALSE

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


      if (!is.null(`org_sagebionetworks_repo_model_download_add_batch_of_files_to_download_list_request`)) {
        local_var_body <- `org_sagebionetworks_repo_model_download_add_batch_of_files_to_download_list_request`$toJSONString()
      } else {
        body <- NULL
      }

      local_var_url_path <- "/repo/v1/download/list/add"
      # Bearer token
      if (!is.null(self$api_client$bearer_token)) {
        header_params["Authorization"] <- paste("Bearer", self$api_client$bearer_token, sep = " ")
      }

      # The Accept request HTTP header
      local_var_accepts <- list("application/json")

      # The Content-Type representation header
      local_var_content_types <- list("application/json")

      local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
                                 method = "POST",
                                 query_params = query_params,
                                 header_params = header_params,
                                 form_params = form_params,
                                 file_params = file_params,
                                 accepts = local_var_accepts,
                                 content_types = local_var_content_types,
                                 body = local_var_body,
                                 is_oauth = is_oauth,
                                 oauth_scopes = oauth_scopes,
                                 ...)

      if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
        # save response in a file
        if (!is.null(data_file)) {
          write(local_var_resp$response, data_file)
        }

        deserialized_resp_obj <- tryCatch(
          self$api_client$deserialize(local_var_resp$response_as_text(), "OrgSagebionetworksRepoModelDownloadAddBatchOfFilesToDownloadListResponse", loadNamespace("synclient")),
          error = function(e) {
            stop("Failed to deserialize response")
          }
        )
        local_var_resp$content <- deserialized_resp_obj
        local_var_resp
      } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) {
        ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp)
      } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) {
        ApiResponse$new("API client error", local_var_resp)
      } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) {
        if (is.null(local_var_resp$response) || local_var_resp$response == "") {
          local_var_resp$response <- "API server error"
        }
        local_var_resp
      }
    },
    #' 
    #'
    #' @description
    #' 
    #'
    #' @param org_sagebionetworks_repo_model_download_add_to_download_list_request 
    #' @param data_file (optional) name of the data file to save the result
    #' @param ... Other optional arguments
    #' @return OrgSagebionetworksRepoModelAsynchAsyncJobId
    #' @export
    PostRepoV1DownloadListAddAsyncStart = function(org_sagebionetworks_repo_model_download_add_to_download_list_request, data_file = NULL, ...) {
      local_var_response <- self$PostRepoV1DownloadListAddAsyncStartWithHttpInfo(org_sagebionetworks_repo_model_download_add_to_download_list_request, data_file = data_file, ...)
      if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) {
        local_var_response$content
      } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) {
        local_var_response
      } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) {
        local_var_response
      } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) {
        local_var_response
      }
    },
    #' 
    #'
    #' @description
    #' 
    #'
    #' @param org_sagebionetworks_repo_model_download_add_to_download_list_request 
    #' @param data_file (optional) name of the data file to save the result
    #' @param ... Other optional arguments
    #' @return API response (OrgSagebionetworksRepoModelAsynchAsyncJobId) with additional information such as HTTP status code, headers
    #' @export
    PostRepoV1DownloadListAddAsyncStartWithHttpInfo = function(org_sagebionetworks_repo_model_download_add_to_download_list_request, data_file = NULL, ...) {
      args <- list(...)
      query_params <- list()
      header_params <- c()
      form_params <- list()
      file_params <- list()
      local_var_body <- NULL
      oauth_scopes <- NULL
      is_oauth <- FALSE

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


      if (!is.null(`org_sagebionetworks_repo_model_download_add_to_download_list_request`)) {
        local_var_body <- `org_sagebionetworks_repo_model_download_add_to_download_list_request`$toJSONString()
      } else {
        body <- NULL
      }

      local_var_url_path <- "/repo/v1/download/list/add/async/start"
      # Bearer token
      if (!is.null(self$api_client$bearer_token)) {
        header_params["Authorization"] <- paste("Bearer", self$api_client$bearer_token, sep = " ")
      }

      # The Accept request HTTP header
      local_var_accepts <- list("application/json")

      # The Content-Type representation header
      local_var_content_types <- list("application/json")

      local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
                                 method = "POST",
                                 query_params = query_params,
                                 header_params = header_params,
                                 form_params = form_params,
                                 file_params = file_params,
                                 accepts = local_var_accepts,
                                 content_types = local_var_content_types,
                                 body = local_var_body,
                                 is_oauth = is_oauth,
                                 oauth_scopes = oauth_scopes,
                                 ...)

      if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
        # save response in a file
        if (!is.null(data_file)) {
          write(local_var_resp$response, data_file)
        }

        deserialized_resp_obj <- tryCatch(
          self$api_client$deserialize(local_var_resp$response_as_text(), "OrgSagebionetworksRepoModelAsynchAsyncJobId", loadNamespace("synclient")),
          error = function(e) {
            stop("Failed to deserialize response")
          }
        )
        local_var_resp$content <- deserialized_resp_obj
        local_var_resp
      } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) {
        ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp)
      } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) {
        ApiResponse$new("API client error", local_var_resp)
      } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) {
        if (is.null(local_var_resp$response) || local_var_resp$response == "") {
          local_var_resp$response <- "API server error"
        }
        local_var_resp
      }
    },
    #' 
    #'
    #' @description
    #' 
    #'
    #' @param org_sagebionetworks_repo_model_download_download_list_manifest_request 
    #' @param data_file (optional) name of the data file to save the result
    #' @param ... Other optional arguments
    #' @return OrgSagebionetworksRepoModelAsynchAsyncJobId
    #' @export
    PostRepoV1DownloadListManifestAsyncStart = function(org_sagebionetworks_repo_model_download_download_list_manifest_request, data_file = NULL, ...) {
      local_var_response <- self$PostRepoV1DownloadListManifestAsyncStartWithHttpInfo(org_sagebionetworks_repo_model_download_download_list_manifest_request, data_file = data_file, ...)
      if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) {
        local_var_response$content
      } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) {
        local_var_response
      } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) {
        local_var_response
      } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) {
        local_var_response
      }
    },
    #' 
    #'
    #' @description
    #' 
    #'
    #' @param org_sagebionetworks_repo_model_download_download_list_manifest_request 
    #' @param data_file (optional) name of the data file to save the result
    #' @param ... Other optional arguments
    #' @return API response (OrgSagebionetworksRepoModelAsynchAsyncJobId) with additional information such as HTTP status code, headers
    #' @export
    PostRepoV1DownloadListManifestAsyncStartWithHttpInfo = function(org_sagebionetworks_repo_model_download_download_list_manifest_request, data_file = NULL, ...) {
      args <- list(...)
      query_params <- list()
      header_params <- c()
      form_params <- list()
      file_params <- list()
      local_var_body <- NULL
      oauth_scopes <- NULL
      is_oauth <- FALSE

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


      if (!is.null(`org_sagebionetworks_repo_model_download_download_list_manifest_request`)) {
        local_var_body <- `org_sagebionetworks_repo_model_download_download_list_manifest_request`$toJSONString()
      } else {
        body <- NULL
      }

      local_var_url_path <- "/repo/v1/download/list/manifest/async/start"
      # Bearer token
      if (!is.null(self$api_client$bearer_token)) {
        header_params["Authorization"] <- paste("Bearer", self$api_client$bearer_token, sep = " ")
      }

      # The Accept request HTTP header
      local_var_accepts <- list("application/json")

      # The Content-Type representation header
      local_var_content_types <- list("application/json")

      local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
                                 method = "POST",
                                 query_params = query_params,
                                 header_params = header_params,
                                 form_params = form_params,
                                 file_params = file_params,
                                 accepts = local_var_accepts,
                                 content_types = local_var_content_types,
                                 body = local_var_body,
                                 is_oauth = is_oauth,
                                 oauth_scopes = oauth_scopes,
                                 ...)

      if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
        # save response in a file
        if (!is.null(data_file)) {
          write(local_var_resp$response, data_file)
        }

        deserialized_resp_obj <- tryCatch(
          self$api_client$deserialize(local_var_resp$response_as_text(), "OrgSagebionetworksRepoModelAsynchAsyncJobId", loadNamespace("synclient")),
          error = function(e) {
            stop("Failed to deserialize response")
          }
        )
        local_var_resp$content <- deserialized_resp_obj
        local_var_resp
      } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) {
        ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp)
      } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) {
        ApiResponse$new("API client error", local_var_resp)
      } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) {
        if (is.null(local_var_resp$response) || local_var_resp$response == "") {
          local_var_resp$response <- "API server error"
        }
        local_var_resp
      }
    },
    #' 
    #'
    #' @description
    #' 
    #'
    #' @param org_sagebionetworks_repo_model_download_download_list_package_request 
    #' @param data_file (optional) name of the data file to save the result
    #' @param ... Other optional arguments
    #' @return OrgSagebionetworksRepoModelAsynchAsyncJobId
    #' @export
    PostRepoV1DownloadListPackageAsyncStart = function(org_sagebionetworks_repo_model_download_download_list_package_request, data_file = NULL, ...) {
      local_var_response <- self$PostRepoV1DownloadListPackageAsyncStartWithHttpInfo(org_sagebionetworks_repo_model_download_download_list_package_request, data_file = data_file, ...)
      if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) {
        local_var_response$content
      } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) {
        local_var_response
      } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) {
        local_var_response
      } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) {
        local_var_response
      }
    },
    #' 
    #'
    #' @description
    #' 
    #'
    #' @param org_sagebionetworks_repo_model_download_download_list_package_request 
    #' @param data_file (optional) name of the data file to save the result
    #' @param ... Other optional arguments
    #' @return API response (OrgSagebionetworksRepoModelAsynchAsyncJobId) with additional information such as HTTP status code, headers
    #' @export
    PostRepoV1DownloadListPackageAsyncStartWithHttpInfo = function(org_sagebionetworks_repo_model_download_download_list_package_request, data_file = NULL, ...) {
      args <- list(...)
      query_params <- list()
      header_params <- c()
      form_params <- list()
      file_params <- list()
      local_var_body <- NULL
      oauth_scopes <- NULL
      is_oauth <- FALSE

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


      if (!is.null(`org_sagebionetworks_repo_model_download_download_list_package_request`)) {
        local_var_body <- `org_sagebionetworks_repo_model_download_download_list_package_request`$toJSONString()
      } else {
        body <- NULL
      }

      local_var_url_path <- "/repo/v1/download/list/package/async/start"
      # Bearer token
      if (!is.null(self$api_client$bearer_token)) {
        header_params["Authorization"] <- paste("Bearer", self$api_client$bearer_token, sep = " ")
      }

      # The Accept request HTTP header
      local_var_accepts <- list("application/json")

      # The Content-Type representation header
      local_var_content_types <- list("application/json")

      local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
                                 method = "POST",
                                 query_params = query_params,
                                 header_params = header_params,
                                 form_params = form_params,
                                 file_params = file_params,
                                 accepts = local_var_accepts,
                                 content_types = local_var_content_types,
                                 body = local_var_body,
                                 is_oauth = is_oauth,
                                 oauth_scopes = oauth_scopes,
                                 ...)

      if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
        # save response in a file
        if (!is.null(data_file)) {
          write(local_var_resp$response, data_file)
        }

        deserialized_resp_obj <- tryCatch(
          self$api_client$deserialize(local_var_resp$response_as_text(), "OrgSagebionetworksRepoModelAsynchAsyncJobId", loadNamespace("synclient")),
          error = function(e) {
            stop("Failed to deserialize response")
          }
        )
        local_var_resp$content <- deserialized_resp_obj
        local_var_resp
      } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) {
        ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp)
      } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) {
        ApiResponse$new("API client error", local_var_resp)
      } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) {
        if (is.null(local_var_resp$response) || local_var_resp$response == "") {
          local_var_resp$response <- "API server error"
        }
        local_var_resp
      }
    },
    #' 
    #'
    #' @description
    #' 
    #'
    #' @param org_sagebionetworks_repo_model_download_download_list_query_request 
    #' @param data_file (optional) name of the data file to save the result
    #' @param ... Other optional arguments
    #' @return OrgSagebionetworksRepoModelAsynchAsyncJobId
    #' @export
    PostRepoV1DownloadListQueryAsyncStart = function(org_sagebionetworks_repo_model_download_download_list_query_request, data_file = NULL, ...) {
      local_var_response <- self$PostRepoV1DownloadListQueryAsyncStartWithHttpInfo(org_sagebionetworks_repo_model_download_download_list_query_request, data_file = data_file, ...)
      if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) {
        local_var_response$content
      } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) {
        local_var_response
      } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) {
        local_var_response
      } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) {
        local_var_response
      }
    },
    #' 
    #'
    #' @description
    #' 
    #'
    #' @param org_sagebionetworks_repo_model_download_download_list_query_request 
    #' @param data_file (optional) name of the data file to save the result
    #' @param ... Other optional arguments
    #' @return API response (OrgSagebionetworksRepoModelAsynchAsyncJobId) with additional information such as HTTP status code, headers
    #' @export
    PostRepoV1DownloadListQueryAsyncStartWithHttpInfo = function(org_sagebionetworks_repo_model_download_download_list_query_request, data_file = NULL, ...) {
      args <- list(...)
      query_params <- list()
      header_params <- c()
      form_params <- list()
      file_params <- list()
      local_var_body <- NULL
      oauth_scopes <- NULL
      is_oauth <- FALSE

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


      if (!is.null(`org_sagebionetworks_repo_model_download_download_list_query_request`)) {
        local_var_body <- `org_sagebionetworks_repo_model_download_download_list_query_request`$toJSONString()
      } else {
        body <- NULL
      }

      local_var_url_path <- "/repo/v1/download/list/query/async/start"
      # Bearer token
      if (!is.null(self$api_client$bearer_token)) {
        header_params["Authorization"] <- paste("Bearer", self$api_client$bearer_token, sep = " ")
      }

      # The Accept request HTTP header
      local_var_accepts <- list("application/json")

      # The Content-Type representation header
      local_var_content_types <- list("application/json")

      local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
                                 method = "POST",
                                 query_params = query_params,
                                 header_params = header_params,
                                 form_params = form_params,
                                 file_params = file_params,
                                 accepts = local_var_accepts,
                                 content_types = local_var_content_types,
                                 body = local_var_body,
                                 is_oauth = is_oauth,
                                 oauth_scopes = oauth_scopes,
                                 ...)

      if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
        # save response in a file
        if (!is.null(data_file)) {
          write(local_var_resp$response, data_file)
        }

        deserialized_resp_obj <- tryCatch(
          self$api_client$deserialize(local_var_resp$response_as_text(), "OrgSagebionetworksRepoModelAsynchAsyncJobId", loadNamespace("synclient")),
          error = function(e) {
            stop("Failed to deserialize response")
          }
        )
        local_var_resp$content <- deserialized_resp_obj
        local_var_resp
      } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) {
        ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp)
      } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) {
        ApiResponse$new("API client error", local_var_resp)
      } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) {
        if (is.null(local_var_resp$response) || local_var_resp$response == "") {
          local_var_resp$response <- "API server error"
        }
        local_var_resp
      }
    },
    #' 
    #'
    #' @description
    #' 
    #'
    #' @param org_sagebionetworks_repo_model_download_remove_batch_of_files_from_download_list_request 
    #' @param data_file (optional) name of the data file to save the result
    #' @param ... Other optional arguments
    #' @return OrgSagebionetworksRepoModelDownloadRemoveBatchOfFilesFromDownloadListResponse
    #' @export
    PostRepoV1DownloadListRemove = function(org_sagebionetworks_repo_model_download_remove_batch_of_files_from_download_list_request, data_file = NULL, ...) {
      local_var_response <- self$PostRepoV1DownloadListRemoveWithHttpInfo(org_sagebionetworks_repo_model_download_remove_batch_of_files_from_download_list_request, data_file = data_file, ...)
      if (local_var_response$status_code >= 200 && local_var_response$status_code <= 299) {
        local_var_response$content
      } else if (local_var_response$status_code >= 300 && local_var_response$status_code <= 399) {
        local_var_response
      } else if (local_var_response$status_code >= 400 && local_var_response$status_code <= 499) {
        local_var_response
      } else if (local_var_response$status_code >= 500 && local_var_response$status_code <= 599) {
        local_var_response
      }
    },
    #' 
    #'
    #' @description
    #' 
    #'
    #' @param org_sagebionetworks_repo_model_download_remove_batch_of_files_from_download_list_request 
    #' @param data_file (optional) name of the data file to save the result
    #' @param ... Other optional arguments
    #' @return API response (OrgSagebionetworksRepoModelDownloadRemoveBatchOfFilesFromDownloadListResponse) with additional information such as HTTP status code, headers
    #' @export
    PostRepoV1DownloadListRemoveWithHttpInfo = function(org_sagebionetworks_repo_model_download_remove_batch_of_files_from_download_list_request, data_file = NULL, ...) {
      args <- list(...)
      query_params <- list()
      header_params <- c()
      form_params <- list()
      file_params <- list()
      local_var_body <- NULL
      oauth_scopes <- NULL
      is_oauth <- FALSE

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


      if (!is.null(`org_sagebionetworks_repo_model_download_remove_batch_of_files_from_download_list_request`)) {
        local_var_body <- `org_sagebionetworks_repo_model_download_remove_batch_of_files_from_download_list_request`$toJSONString()
      } else {
        body <- NULL
      }

      local_var_url_path <- "/repo/v1/download/list/remove"
      # Bearer token
      if (!is.null(self$api_client$bearer_token)) {
        header_params["Authorization"] <- paste("Bearer", self$api_client$bearer_token, sep = " ")
      }

      # The Accept request HTTP header
      local_var_accepts <- list("application/json")

      # The Content-Type representation header
      local_var_content_types <- list("application/json")

      local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
                                 method = "POST",
                                 query_params = query_params,
                                 header_params = header_params,
                                 form_params = form_params,
                                 file_params = file_params,
                                 accepts = local_var_accepts,
                                 content_types = local_var_content_types,
                                 body = local_var_body,
                                 is_oauth = is_oauth,
                                 oauth_scopes = oauth_scopes,
                                 ...)

      if (local_var_resp$status_code >= 200 && local_var_resp$status_code <= 299) {
        # save response in a file
        if (!is.null(data_file)) {
          write(local_var_resp$response, data_file)
        }

        deserialized_resp_obj <- tryCatch(
          self$api_client$deserialize(local_var_resp$response_as_text(), "OrgSagebionetworksRepoModelDownloadRemoveBatchOfFilesFromDownloadListResponse", loadNamespace("synclient")),
          error = function(e) {
            stop("Failed to deserialize response")
          }
        )
        local_var_resp$content <- deserialized_resp_obj
        local_var_resp
      } else if (local_var_resp$status_code >= 300 && local_var_resp$status_code <= 399) {
        ApiResponse$new(paste("Server returned ", local_var_resp$status_code, " response status code."), local_var_resp)
      } else if (local_var_resp$status_code >= 400 && local_var_resp$status_code <= 499) {
        ApiResponse$new("API client error", local_var_resp)
      } else if (local_var_resp$status_code >= 500 && local_var_resp$status_code <= 599) {
        if (is.null(local_var_resp$response) || local_var_resp$response == "") {
          local_var_resp$response <- "API server error"
        }
        local_var_resp
      }
    }
  )
)
thomasyu888/synr-sdk-client documentation built on Dec. 31, 2024, 11:29 a.m.