R/certified_user_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 CertifiedUserServices operations
#' @description CertifiedUserServicesApi
#' @format An \code{R6Class} generator object
#' @field api_client Handles the client-server communication.
#'
#' @section Methods:
#' \describe{
#' \strong{ DeleteRepoV1AdminCertifiedUserTestResponseId } \emph{  }
#'
#' \itemize{
#' \item \emph{ @param } id numeric
#'
#'
#' \item status code : 200 | Void
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ GetRepoV1AdminCertifiedUserTestResponse } \emph{  }
#'
#' \itemize{
#' \item \emph{ @param } principal_id numeric
#' \item \emph{ @param } limit integer
#' \item \emph{ @param } offset integer
#' \item \emph{ @returnType } \link{PaginatedResultsOfQuizResponse} \cr
#'
#'
#' \item status code : 200 | Auto-generated description
#'
#' \item return type : PaginatedResultsOfQuizResponse
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ GetRepoV1AdminUserIdCertifiedUserPassingRecords } \emph{  }
#'
#' \itemize{
#' \item \emph{ @param } id numeric
#' \item \emph{ @param } limit integer
#' \item \emph{ @param } offset integer
#' \item \emph{ @returnType } \link{PaginatedResultsOfPassingRecord} \cr
#'
#'
#' \item status code : 200 | Auto-generated description
#'
#' \item return type : PaginatedResultsOfPassingRecord
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ GetRepoV1CertifiedUserTest } \emph{  }
#'
#' \itemize{
#' \item \emph{ @returnType } \link{OrgSagebionetworksRepoModelQuizQuiz} \cr
#'
#'
#' \item status code : 200 | Auto-generated description
#'
#' \item return type : OrgSagebionetworksRepoModelQuizQuiz
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ GetRepoV1UserIdCertifiedUserPassingRecord } \emph{  }
#'
#' \itemize{
#' \item \emph{ @param } id numeric
#' \item \emph{ @returnType } \link{OrgSagebionetworksRepoModelQuizPassingRecord} \cr
#'
#'
#' \item status code : 200 | Auto-generated description
#'
#' \item return type : OrgSagebionetworksRepoModelQuizPassingRecord
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ PostRepoV1CertifiedUserTestResponse } \emph{  }
#'
#' \itemize{
#' \item \emph{ @param } org_sagebionetworks_repo_model_quiz_quiz_response \link{OrgSagebionetworksRepoModelQuizQuizResponse}
#' \item \emph{ @returnType } \link{OrgSagebionetworksRepoModelQuizPassingRecord} \cr
#'
#'
#' \item status code : 201 | Auto-generated description
#'
#' \item return type : OrgSagebionetworksRepoModelQuizPassingRecord
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ PutRepoV1AdminUserIdCertificationStatus } \emph{  }
#'
#' \itemize{
#' \item \emph{ @param } id numeric
#' \item \emph{ @param } is_certified character
#'
#'
#' \item status code : 204 | Void
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' }
#'
#'
#' @examples
#' \dontrun{
#' ####################  DeleteRepoV1AdminCertifiedUserTestResponseId  ####################
#'
#' library(synclient)
#' var_id <- 3.4 # numeric | 
#'
#' api_instance <- CertifiedUserServicesApi$new()
#'
#' # Configure HTTP bearer authorization: bearerAuth
#' api_instance$api_client$bearer_token <- Sys.getenv("BEARER_TOKEN")
#'
#' api_instance$DeleteRepoV1AdminCertifiedUserTestResponseId(var_id)
#'
#'
#' ####################  GetRepoV1AdminCertifiedUserTestResponse  ####################
#'
#' library(synclient)
#' var_principal_id <- 3.4 # numeric | If specified, only retrieve the quiz for this user, if it exists. (Optional)
#' var_limit <- 56 # integer | Limits the size of the page returned. For example, a page size of 10 requires limit = 10. (Optional)
#' var_offset <- 56 # integer | The index of the pagination offset. For a page size of 10, the first page would be at offset = 0, and the second page would be at offset = 10. (Optional)
#'
#' api_instance <- CertifiedUserServicesApi$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$GetRepoV1AdminCertifiedUserTestResponse(principal_id = var_principal_id, limit = var_limit, offset = var_offsetdata_file = "result.txt")
#' result <- api_instance$GetRepoV1AdminCertifiedUserTestResponse(principal_id = var_principal_id, limit = var_limit, offset = var_offset)
#' dput(result)
#'
#'
#' ####################  GetRepoV1AdminUserIdCertifiedUserPassingRecords  ####################
#'
#' library(synclient)
#' var_id <- 3.4 # numeric | 
#' var_limit <- 56 # integer |  (Optional)
#' var_offset <- 56 # integer |  (Optional)
#'
#' api_instance <- CertifiedUserServicesApi$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$GetRepoV1AdminUserIdCertifiedUserPassingRecords(var_id, limit = var_limit, offset = var_offsetdata_file = "result.txt")
#' result <- api_instance$GetRepoV1AdminUserIdCertifiedUserPassingRecords(var_id, limit = var_limit, offset = var_offset)
#' dput(result)
#'
#'
#' ####################  GetRepoV1CertifiedUserTest  ####################
#'
#' library(synclient)
#'
#' api_instance <- CertifiedUserServicesApi$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$GetRepoV1CertifiedUserTest(data_file = "result.txt")
#' result <- api_instance$GetRepoV1CertifiedUserTest()
#' dput(result)
#'
#'
#' ####################  GetRepoV1UserIdCertifiedUserPassingRecord  ####################
#'
#' library(synclient)
#' var_id <- 3.4 # numeric | 
#'
#' api_instance <- CertifiedUserServicesApi$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$GetRepoV1UserIdCertifiedUserPassingRecord(var_iddata_file = "result.txt")
#' result <- api_instance$GetRepoV1UserIdCertifiedUserPassingRecord(var_id)
#' dput(result)
#'
#'
#' ####################  PostRepoV1CertifiedUserTestResponse  ####################
#'
#' library(synclient)
#' var_org_sagebionetworks_repo_model_quiz_quiz_response <- org.sagebionetworks.repo.model.quiz.QuizResponse$new(123, 123, "createdBy_example", "createdOn_example", c(org.sagebionetworks.repo.model.quiz.QuestionResponse$new(123, "concreteType_example", c(123), "response_example"))) # OrgSagebionetworksRepoModelQuizQuizResponse | 
#'
#' api_instance <- CertifiedUserServicesApi$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$PostRepoV1CertifiedUserTestResponse(var_org_sagebionetworks_repo_model_quiz_quiz_responsedata_file = "result.txt")
#' result <- api_instance$PostRepoV1CertifiedUserTestResponse(var_org_sagebionetworks_repo_model_quiz_quiz_response)
#' dput(result)
#'
#'
#' ####################  PutRepoV1AdminUserIdCertificationStatus  ####################
#'
#' library(synclient)
#' var_id <- 3.4 # numeric | 
#' var_is_certified <- "is_certified_example" # character | true to set as certified or false to 'de-certify'
#'
#' api_instance <- CertifiedUserServicesApi$new()
#'
#' # Configure HTTP bearer authorization: bearerAuth
#' api_instance$api_client$bearer_token <- Sys.getenv("BEARER_TOKEN")
#'
#' api_instance$PutRepoV1AdminUserIdCertificationStatus(var_id, var_is_certified)
#'
#'
#' }
#' @importFrom R6 R6Class
#' @importFrom base64enc base64encode
#' @export
CertifiedUserServicesApi <- R6::R6Class(
  "CertifiedUserServicesApi",
  public = list(
    api_client = NULL,
    #' Initialize a new CertifiedUserServicesApi.
    #'
    #' @description
    #' Initialize a new CertifiedUserServicesApi.
    #'
    #' @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 id 
    #' @param ... Other optional arguments
    #' @return void
    #' @export
    DeleteRepoV1AdminCertifiedUserTestResponseId = function(id, ...) {
      local_var_response <- self$DeleteRepoV1AdminCertifiedUserTestResponseIdWithHttpInfo(id, ...)
      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 id 
    #' @param ... Other optional arguments
    #' @return API response (void) with additional information such as HTTP status code, headers
    #' @export
    DeleteRepoV1AdminCertifiedUserTestResponseIdWithHttpInfo = function(id, ...) {
      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(`id`)) {
        stop("Missing required parameter `id`.")
      }


      local_var_url_path <- "/repo/v1/admin/certifiedUserTestResponse/{id}"
      if (!missing(`id`)) {
        local_var_url_path <- gsub("\\{id\\}", URLencode(as.character(`id`), 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()

      # 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 principal_id (optional) If specified, only retrieve the quiz for this user, if it exists.
    #' @param limit (optional) Limits the size of the page returned. For example, a page size of 10 requires limit = 10.
    #' @param offset (optional) The index of the pagination offset. For a page size of 10, the first page would be at offset = 0, and the second page would be at offset = 10.
    #' @param data_file (optional) name of the data file to save the result
    #' @param ... Other optional arguments
    #' @return PaginatedResultsOfQuizResponse
    #' @export
    GetRepoV1AdminCertifiedUserTestResponse = function(principal_id = NULL, limit = NULL, offset = NULL, data_file = NULL, ...) {
      local_var_response <- self$GetRepoV1AdminCertifiedUserTestResponseWithHttpInfo(principal_id, limit, offset, 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 principal_id (optional) If specified, only retrieve the quiz for this user, if it exists.
    #' @param limit (optional) Limits the size of the page returned. For example, a page size of 10 requires limit = 10.
    #' @param offset (optional) The index of the pagination offset. For a page size of 10, the first page would be at offset = 0, and the second page would be at offset = 10.
    #' @param data_file (optional) name of the data file to save the result
    #' @param ... Other optional arguments
    #' @return API response (PaginatedResultsOfQuizResponse) with additional information such as HTTP status code, headers
    #' @export
    GetRepoV1AdminCertifiedUserTestResponseWithHttpInfo = function(principal_id = NULL, limit = NULL, offset = NULL, 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




      query_params[["principalId"]] <- `principal_id`

      query_params[["limit"]] <- `limit`

      query_params[["offset"]] <- `offset`

      local_var_url_path <- "/repo/v1/admin/certifiedUserTestResponse"
      # 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(), "PaginatedResultsOfQuizResponse", 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 id 
    #' @param limit (optional) No description
    #' @param offset (optional) No description
    #' @param data_file (optional) name of the data file to save the result
    #' @param ... Other optional arguments
    #' @return PaginatedResultsOfPassingRecord
    #' @export
    GetRepoV1AdminUserIdCertifiedUserPassingRecords = function(id, limit = NULL, offset = NULL, data_file = NULL, ...) {
      local_var_response <- self$GetRepoV1AdminUserIdCertifiedUserPassingRecordsWithHttpInfo(id, limit, offset, 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 id 
    #' @param limit (optional) No description
    #' @param offset (optional) No description
    #' @param data_file (optional) name of the data file to save the result
    #' @param ... Other optional arguments
    #' @return API response (PaginatedResultsOfPassingRecord) with additional information such as HTTP status code, headers
    #' @export
    GetRepoV1AdminUserIdCertifiedUserPassingRecordsWithHttpInfo = function(id, limit = NULL, offset = NULL, 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(`id`)) {
        stop("Missing required parameter `id`.")
      }




      query_params[["limit"]] <- `limit`

      query_params[["offset"]] <- `offset`

      local_var_url_path <- "/repo/v1/admin/user/{id}/certifiedUserPassingRecords"
      if (!missing(`id`)) {
        local_var_url_path <- gsub("\\{id\\}", URLencode(as.character(`id`), 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(), "PaginatedResultsOfPassingRecord", 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 data_file (optional) name of the data file to save the result
    #' @param ... Other optional arguments
    #' @return OrgSagebionetworksRepoModelQuizQuiz
    #' @export
    GetRepoV1CertifiedUserTest = function(data_file = NULL, ...) {
      local_var_response <- self$GetRepoV1CertifiedUserTestWithHttpInfo(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 data_file (optional) name of the data file to save the result
    #' @param ... Other optional arguments
    #' @return API response (OrgSagebionetworksRepoModelQuizQuiz) with additional information such as HTTP status code, headers
    #' @export
    GetRepoV1CertifiedUserTestWithHttpInfo = function(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

      local_var_url_path <- "/repo/v1/certifiedUserTest"
      # 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(), "OrgSagebionetworksRepoModelQuizQuiz", 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 id 
    #' @param data_file (optional) name of the data file to save the result
    #' @param ... Other optional arguments
    #' @return OrgSagebionetworksRepoModelQuizPassingRecord
    #' @export
    GetRepoV1UserIdCertifiedUserPassingRecord = function(id, data_file = NULL, ...) {
      local_var_response <- self$GetRepoV1UserIdCertifiedUserPassingRecordWithHttpInfo(id, 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 id 
    #' @param data_file (optional) name of the data file to save the result
    #' @param ... Other optional arguments
    #' @return API response (OrgSagebionetworksRepoModelQuizPassingRecord) with additional information such as HTTP status code, headers
    #' @export
    GetRepoV1UserIdCertifiedUserPassingRecordWithHttpInfo = function(id, 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(`id`)) {
        stop("Missing required parameter `id`.")
      }


      local_var_url_path <- "/repo/v1/user/{id}/certifiedUserPassingRecord"
      if (!missing(`id`)) {
        local_var_url_path <- gsub("\\{id\\}", URLencode(as.character(`id`), 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(), "OrgSagebionetworksRepoModelQuizPassingRecord", 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_quiz_quiz_response 
    #' @param data_file (optional) name of the data file to save the result
    #' @param ... Other optional arguments
    #' @return OrgSagebionetworksRepoModelQuizPassingRecord
    #' @export
    PostRepoV1CertifiedUserTestResponse = function(org_sagebionetworks_repo_model_quiz_quiz_response, data_file = NULL, ...) {
      local_var_response <- self$PostRepoV1CertifiedUserTestResponseWithHttpInfo(org_sagebionetworks_repo_model_quiz_quiz_response, 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_quiz_quiz_response 
    #' @param data_file (optional) name of the data file to save the result
    #' @param ... Other optional arguments
    #' @return API response (OrgSagebionetworksRepoModelQuizPassingRecord) with additional information such as HTTP status code, headers
    #' @export
    PostRepoV1CertifiedUserTestResponseWithHttpInfo = function(org_sagebionetworks_repo_model_quiz_quiz_response, 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_quiz_quiz_response`)) {
        stop("Missing required parameter `org_sagebionetworks_repo_model_quiz_quiz_response`.")
      }


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

      local_var_url_path <- "/repo/v1/certifiedUserTestResponse"
      # 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(), "OrgSagebionetworksRepoModelQuizPassingRecord", 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 id 
    #' @param is_certified true to set as certified or false to 'de-certify'
    #' @param ... Other optional arguments
    #' @return void
    #' @export
    PutRepoV1AdminUserIdCertificationStatus = function(id, is_certified, ...) {
      local_var_response <- self$PutRepoV1AdminUserIdCertificationStatusWithHttpInfo(id, is_certified, ...)
      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 id 
    #' @param is_certified true to set as certified or false to 'de-certify'
    #' @param ... Other optional arguments
    #' @return API response (void) with additional information such as HTTP status code, headers
    #' @export
    PutRepoV1AdminUserIdCertificationStatusWithHttpInfo = function(id, is_certified, ...) {
      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(`id`)) {
        stop("Missing required parameter `id`.")
      }

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



      query_params[["isCertified"]] <- `is_certified`

      local_var_url_path <- "/repo/v1/admin/user/{id}/certificationStatus"
      if (!missing(`id`)) {
        local_var_url_path <- gsub("\\{id\\}", URLencode(as.character(`id`), 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()

      # 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 = "PUT",
                                 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
      }
    }
  )
)
thomasyu888/synr-sdk-client documentation built on Dec. 31, 2024, 11:29 a.m.