forked from loafle/openapi-generator-original
* deserialize enum json response (python) * adapt python samples: adding enum deserialization * add echo test for enum json response deserialization (python) * update samples
1282 lines
49 KiB
R
1282 lines
49 KiB
R
#' Echo Server API
|
|
#'
|
|
#' Echo Server API
|
|
#'
|
|
#' The version of the OpenAPI document: 0.1.0
|
|
#' Contact: team@openapitools.org
|
|
#' Generated by: https://openapi-generator.tech
|
|
#'
|
|
#' @docType class
|
|
#' @title Body operations
|
|
#' @description BodyApi
|
|
#' @format An \code{R6Class} generator object
|
|
#' @field api_client Handles the client-server communication.
|
|
#'
|
|
#' @section Methods:
|
|
#' \describe{
|
|
#' \strong{ TestBinaryGif } \emph{ Test binary (gif) response body }
|
|
#' Test binary (gif) response body
|
|
#'
|
|
#' \itemize{
|
|
#'
|
|
#'
|
|
#' \item status code : 200 | Successful operation
|
|
#'
|
|
#' \item return type : data.frame
|
|
#' \item response headers :
|
|
#'
|
|
#' \tabular{ll}{
|
|
#' }
|
|
#' }
|
|
#'
|
|
#' \strong{ TestBodyApplicationOctetstreamBinary } \emph{ Test body parameter(s) }
|
|
#' Test body parameter(s)
|
|
#'
|
|
#' \itemize{
|
|
#' \item \emph{ @param } body data.frame
|
|
#'
|
|
#'
|
|
#' \item status code : 200 | Successful operation
|
|
#'
|
|
#' \item return type : character
|
|
#' \item response headers :
|
|
#'
|
|
#' \tabular{ll}{
|
|
#' }
|
|
#' }
|
|
#'
|
|
#' \strong{ TestBodyMultipartFormdataArrayOfBinary } \emph{ Test array of binary in multipart mime }
|
|
#' Test array of binary in multipart mime
|
|
#'
|
|
#' \itemize{
|
|
#' \item \emph{ @param } files list( data.frame )
|
|
#'
|
|
#'
|
|
#' \item status code : 200 | Successful operation
|
|
#'
|
|
#' \item return type : character
|
|
#' \item response headers :
|
|
#'
|
|
#' \tabular{ll}{
|
|
#' }
|
|
#' }
|
|
#'
|
|
#' \strong{ TestBodyMultipartFormdataSingleBinary } \emph{ Test single binary in multipart mime }
|
|
#' Test single binary in multipart mime
|
|
#'
|
|
#' \itemize{
|
|
#' \item \emph{ @param } my_file data.frame
|
|
#'
|
|
#'
|
|
#' \item status code : 200 | Successful operation
|
|
#'
|
|
#' \item return type : character
|
|
#' \item response headers :
|
|
#'
|
|
#' \tabular{ll}{
|
|
#' }
|
|
#' }
|
|
#'
|
|
#' \strong{ TestEchoBodyAllOfPet } \emph{ Test body parameter(s) }
|
|
#' Test body parameter(s)
|
|
#'
|
|
#' \itemize{
|
|
#' \item \emph{ @param } pet \link{Pet}
|
|
#' \item \emph{ @returnType } \link{Pet} \cr
|
|
#'
|
|
#'
|
|
#' \item status code : 200 | Successful operation
|
|
#'
|
|
#' \item return type : Pet
|
|
#' \item response headers :
|
|
#'
|
|
#' \tabular{ll}{
|
|
#' }
|
|
#' }
|
|
#'
|
|
#' \strong{ TestEchoBodyFreeFormObjectResponseString } \emph{ Test free form object }
|
|
#' Test free form object
|
|
#'
|
|
#' \itemize{
|
|
#' \item \emph{ @param } body object
|
|
#'
|
|
#'
|
|
#' \item status code : 200 | Successful operation
|
|
#'
|
|
#' \item return type : character
|
|
#' \item response headers :
|
|
#'
|
|
#' \tabular{ll}{
|
|
#' }
|
|
#' }
|
|
#'
|
|
#' \strong{ TestEchoBodyPet } \emph{ Test body parameter(s) }
|
|
#' Test body parameter(s)
|
|
#'
|
|
#' \itemize{
|
|
#' \item \emph{ @param } pet \link{Pet}
|
|
#' \item \emph{ @returnType } \link{Pet} \cr
|
|
#'
|
|
#'
|
|
#' \item status code : 200 | Successful operation
|
|
#'
|
|
#' \item return type : Pet
|
|
#' \item response headers :
|
|
#'
|
|
#' \tabular{ll}{
|
|
#' }
|
|
#' }
|
|
#'
|
|
#' \strong{ TestEchoBodyPetResponseString } \emph{ Test empty response body }
|
|
#' Test empty response body
|
|
#'
|
|
#' \itemize{
|
|
#' \item \emph{ @param } pet \link{Pet}
|
|
#'
|
|
#'
|
|
#' \item status code : 200 | Successful operation
|
|
#'
|
|
#' \item return type : character
|
|
#' \item response headers :
|
|
#'
|
|
#' \tabular{ll}{
|
|
#' }
|
|
#' }
|
|
#'
|
|
#' \strong{ TestEchoBodyStringEnum } \emph{ Test string enum response body }
|
|
#' Test string enum response body
|
|
#'
|
|
#' \itemize{
|
|
#' \item \emph{ @param } body character
|
|
#' \item \emph{ @returnType } \link{StringEnumRef} \cr
|
|
#'
|
|
#'
|
|
#' \item status code : 200 | Successful operation
|
|
#'
|
|
#' \item return type : StringEnumRef
|
|
#' \item response headers :
|
|
#'
|
|
#' \tabular{ll}{
|
|
#' }
|
|
#' }
|
|
#'
|
|
#' \strong{ TestEchoBodyTagResponseString } \emph{ Test empty json (request body) }
|
|
#' Test empty json (request body)
|
|
#'
|
|
#' \itemize{
|
|
#' \item \emph{ @param } tag \link{Tag}
|
|
#'
|
|
#'
|
|
#' \item status code : 200 | Successful operation
|
|
#'
|
|
#' \item return type : character
|
|
#' \item response headers :
|
|
#'
|
|
#' \tabular{ll}{
|
|
#' }
|
|
#' }
|
|
#'
|
|
#' }
|
|
#'
|
|
#'
|
|
#' @examples
|
|
#' \dontrun{
|
|
#' #################### TestBinaryGif ####################
|
|
#'
|
|
#' library(openapi)
|
|
#'
|
|
#' #Test binary (gif) response body
|
|
#' api_instance <- BodyApi$new()
|
|
#'
|
|
#' # to save the result into a file, simply add the optional `data_file` parameter, e.g.
|
|
#' # result <- api_instance$TestBinaryGif(data_file = "result.txt")
|
|
#' result <- api_instance$TestBinaryGif()
|
|
#' dput(result)
|
|
#'
|
|
#'
|
|
#' #################### TestBodyApplicationOctetstreamBinary ####################
|
|
#'
|
|
#' library(openapi)
|
|
#' var_body <- File.new('/path/to/file') # data.frame | (Optional)
|
|
#'
|
|
#' #Test body parameter(s)
|
|
#' api_instance <- BodyApi$new()
|
|
#'
|
|
#' # to save the result into a file, simply add the optional `data_file` parameter, e.g.
|
|
#' # result <- api_instance$TestBodyApplicationOctetstreamBinary(body = var_bodydata_file = "result.txt")
|
|
#' result <- api_instance$TestBodyApplicationOctetstreamBinary(body = var_body)
|
|
#' dput(result)
|
|
#'
|
|
#'
|
|
#' #################### TestBodyMultipartFormdataArrayOfBinary ####################
|
|
#'
|
|
#' library(openapi)
|
|
#' var_files <- c(123) # array[data.frame] |
|
|
#'
|
|
#' #Test array of binary in multipart mime
|
|
#' api_instance <- BodyApi$new()
|
|
#'
|
|
#' # to save the result into a file, simply add the optional `data_file` parameter, e.g.
|
|
#' # result <- api_instance$TestBodyMultipartFormdataArrayOfBinary(var_filesdata_file = "result.txt")
|
|
#' result <- api_instance$TestBodyMultipartFormdataArrayOfBinary(var_files)
|
|
#' dput(result)
|
|
#'
|
|
#'
|
|
#' #################### TestBodyMultipartFormdataSingleBinary ####################
|
|
#'
|
|
#' library(openapi)
|
|
#' var_my_file <- File.new('/path/to/file') # data.frame | (Optional)
|
|
#'
|
|
#' #Test single binary in multipart mime
|
|
#' api_instance <- BodyApi$new()
|
|
#'
|
|
#' # to save the result into a file, simply add the optional `data_file` parameter, e.g.
|
|
#' # result <- api_instance$TestBodyMultipartFormdataSingleBinary(my_file = var_my_filedata_file = "result.txt")
|
|
#' result <- api_instance$TestBodyMultipartFormdataSingleBinary(my_file = var_my_file)
|
|
#' dput(result)
|
|
#'
|
|
#'
|
|
#' #################### TestEchoBodyAllOfPet ####################
|
|
#'
|
|
#' library(openapi)
|
|
#' var_pet <- Pet$new("name_example", c("photoUrls_example"), 123, Category$new(123, "name_example"), c(Tag$new(123, "name_example")), "available") # Pet | Pet object that needs to be added to the store (Optional)
|
|
#'
|
|
#' #Test body parameter(s)
|
|
#' api_instance <- BodyApi$new()
|
|
#'
|
|
#' # to save the result into a file, simply add the optional `data_file` parameter, e.g.
|
|
#' # result <- api_instance$TestEchoBodyAllOfPet(pet = var_petdata_file = "result.txt")
|
|
#' result <- api_instance$TestEchoBodyAllOfPet(pet = var_pet)
|
|
#' dput(result)
|
|
#'
|
|
#'
|
|
#' #################### TestEchoBodyFreeFormObjectResponseString ####################
|
|
#'
|
|
#' library(openapi)
|
|
#' var_body <- c(key = TODO) # object | Free form object (Optional)
|
|
#'
|
|
#' #Test free form object
|
|
#' api_instance <- BodyApi$new()
|
|
#'
|
|
#' # to save the result into a file, simply add the optional `data_file` parameter, e.g.
|
|
#' # result <- api_instance$TestEchoBodyFreeFormObjectResponseString(body = var_bodydata_file = "result.txt")
|
|
#' result <- api_instance$TestEchoBodyFreeFormObjectResponseString(body = var_body)
|
|
#' dput(result)
|
|
#'
|
|
#'
|
|
#' #################### TestEchoBodyPet ####################
|
|
#'
|
|
#' library(openapi)
|
|
#' var_pet <- Pet$new("name_example", c("photoUrls_example"), 123, Category$new(123, "name_example"), c(Tag$new(123, "name_example")), "available") # Pet | Pet object that needs to be added to the store (Optional)
|
|
#'
|
|
#' #Test body parameter(s)
|
|
#' api_instance <- BodyApi$new()
|
|
#'
|
|
#' # to save the result into a file, simply add the optional `data_file` parameter, e.g.
|
|
#' # result <- api_instance$TestEchoBodyPet(pet = var_petdata_file = "result.txt")
|
|
#' result <- api_instance$TestEchoBodyPet(pet = var_pet)
|
|
#' dput(result)
|
|
#'
|
|
#'
|
|
#' #################### TestEchoBodyPetResponseString ####################
|
|
#'
|
|
#' library(openapi)
|
|
#' var_pet <- Pet$new("name_example", c("photoUrls_example"), 123, Category$new(123, "name_example"), c(Tag$new(123, "name_example")), "available") # Pet | Pet object that needs to be added to the store (Optional)
|
|
#'
|
|
#' #Test empty response body
|
|
#' api_instance <- BodyApi$new()
|
|
#'
|
|
#' # to save the result into a file, simply add the optional `data_file` parameter, e.g.
|
|
#' # result <- api_instance$TestEchoBodyPetResponseString(pet = var_petdata_file = "result.txt")
|
|
#' result <- api_instance$TestEchoBodyPetResponseString(pet = var_pet)
|
|
#' dput(result)
|
|
#'
|
|
#'
|
|
#' #################### TestEchoBodyStringEnum ####################
|
|
#'
|
|
#' library(openapi)
|
|
#' var_body <- "body_example" # character | String enum (Optional)
|
|
#'
|
|
#' #Test string enum response body
|
|
#' api_instance <- BodyApi$new()
|
|
#'
|
|
#' # to save the result into a file, simply add the optional `data_file` parameter, e.g.
|
|
#' # result <- api_instance$TestEchoBodyStringEnum(body = var_bodydata_file = "result.txt")
|
|
#' result <- api_instance$TestEchoBodyStringEnum(body = var_body)
|
|
#' dput(result)
|
|
#'
|
|
#'
|
|
#' #################### TestEchoBodyTagResponseString ####################
|
|
#'
|
|
#' library(openapi)
|
|
#' var_tag <- Tag$new(123, "name_example") # Tag | Tag object (Optional)
|
|
#'
|
|
#' #Test empty json (request body)
|
|
#' api_instance <- BodyApi$new()
|
|
#'
|
|
#' # to save the result into a file, simply add the optional `data_file` parameter, e.g.
|
|
#' # result <- api_instance$TestEchoBodyTagResponseString(tag = var_tagdata_file = "result.txt")
|
|
#' result <- api_instance$TestEchoBodyTagResponseString(tag = var_tag)
|
|
#' dput(result)
|
|
#'
|
|
#'
|
|
#' }
|
|
#' @importFrom R6 R6Class
|
|
#' @importFrom base64enc base64encode
|
|
#' @export
|
|
BodyApi <- R6::R6Class(
|
|
"BodyApi",
|
|
public = list(
|
|
api_client = NULL,
|
|
#' Initialize a new BodyApi.
|
|
#'
|
|
#' @description
|
|
#' Initialize a new BodyApi.
|
|
#'
|
|
#' @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()
|
|
}
|
|
},
|
|
#' Test binary (gif) response body
|
|
#'
|
|
#' @description
|
|
#' Test binary (gif) response body
|
|
#'
|
|
#' @param data_file (optional) name of the data file to save the result
|
|
#' @param ... Other optional arguments
|
|
#' @return data.frame
|
|
#' @export
|
|
TestBinaryGif = function(data_file = NULL, ...) {
|
|
local_var_response <- self$TestBinaryGifWithHttpInfo(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
|
|
}
|
|
},
|
|
#' Test binary (gif) response body
|
|
#'
|
|
#' @description
|
|
#' Test binary (gif) response body
|
|
#'
|
|
#' @param data_file (optional) name of the data file to save the result
|
|
#' @param ... Other optional arguments
|
|
#' @return API response (data.frame) with additional information such as HTTP status code, headers
|
|
#' @export
|
|
TestBinaryGifWithHttpInfo = 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 <- "/binary/gif"
|
|
|
|
# The Accept request HTTP header
|
|
local_var_accepts <- list("image/gif")
|
|
|
|
# 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 = "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(), "data.frame", loadNamespace("openapi")),
|
|
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
|
|
}
|
|
},
|
|
#' Test body parameter(s)
|
|
#'
|
|
#' @description
|
|
#' Test body parameter(s)
|
|
#'
|
|
#' @param body (optional) No description
|
|
#' @param data_file (optional) name of the data file to save the result
|
|
#' @param ... Other optional arguments
|
|
#' @return character
|
|
#' @export
|
|
TestBodyApplicationOctetstreamBinary = function(body = NULL, data_file = NULL, ...) {
|
|
local_var_response <- self$TestBodyApplicationOctetstreamBinaryWithHttpInfo(body, 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
|
|
}
|
|
},
|
|
#' Test body parameter(s)
|
|
#'
|
|
#' @description
|
|
#' Test body parameter(s)
|
|
#'
|
|
#' @param body (optional) No description
|
|
#' @param data_file (optional) name of the data file to save the result
|
|
#' @param ... Other optional arguments
|
|
#' @return API response (character) with additional information such as HTTP status code, headers
|
|
#' @export
|
|
TestBodyApplicationOctetstreamBinaryWithHttpInfo = function(body = 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 (!is.null(`body`)) {
|
|
local_var_body <- `body`$toJSONString()
|
|
} else {
|
|
body <- NULL
|
|
}
|
|
|
|
local_var_url_path <- "/body/application/octetstream/binary"
|
|
|
|
# The Accept request HTTP header
|
|
local_var_accepts <- list("text/plain")
|
|
|
|
# The Content-Type representation header
|
|
local_var_content_types <- list("application/octet-stream")
|
|
|
|
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(), "character", loadNamespace("openapi")),
|
|
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
|
|
}
|
|
},
|
|
#' Test array of binary in multipart mime
|
|
#'
|
|
#' @description
|
|
#' Test array of binary in multipart mime
|
|
#'
|
|
#' @param files
|
|
#' @param data_file (optional) name of the data file to save the result
|
|
#' @param ... Other optional arguments
|
|
#' @return character
|
|
#' @export
|
|
TestBodyMultipartFormdataArrayOfBinary = function(files, data_file = NULL, ...) {
|
|
local_var_response <- self$TestBodyMultipartFormdataArrayOfBinaryWithHttpInfo(files, 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
|
|
}
|
|
},
|
|
#' Test array of binary in multipart mime
|
|
#'
|
|
#' @description
|
|
#' Test array of binary in multipart mime
|
|
#'
|
|
#' @param files
|
|
#' @param data_file (optional) name of the data file to save the result
|
|
#' @param ... Other optional arguments
|
|
#' @return API response (character) with additional information such as HTTP status code, headers
|
|
#' @export
|
|
TestBodyMultipartFormdataArrayOfBinaryWithHttpInfo = function(files, 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(`files`)) {
|
|
stop("Missing required parameter `files`.")
|
|
}
|
|
|
|
|
|
file_params["files"] <- httr::upload_file(`files`)
|
|
local_var_url_path <- "/body/application/octetstream/array_of_binary"
|
|
|
|
# The Accept request HTTP header
|
|
local_var_accepts <- list("text/plain")
|
|
|
|
# The Content-Type representation header
|
|
local_var_content_types <- list("multipart/form-data")
|
|
|
|
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(), "character", loadNamespace("openapi")),
|
|
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
|
|
}
|
|
},
|
|
#' Test single binary in multipart mime
|
|
#'
|
|
#' @description
|
|
#' Test single binary in multipart mime
|
|
#'
|
|
#' @param my_file (optional) No description
|
|
#' @param data_file (optional) name of the data file to save the result
|
|
#' @param ... Other optional arguments
|
|
#' @return character
|
|
#' @export
|
|
TestBodyMultipartFormdataSingleBinary = function(my_file = NULL, data_file = NULL, ...) {
|
|
local_var_response <- self$TestBodyMultipartFormdataSingleBinaryWithHttpInfo(my_file, 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
|
|
}
|
|
},
|
|
#' Test single binary in multipart mime
|
|
#'
|
|
#' @description
|
|
#' Test single binary in multipart mime
|
|
#'
|
|
#' @param my_file (optional) No description
|
|
#' @param data_file (optional) name of the data file to save the result
|
|
#' @param ... Other optional arguments
|
|
#' @return API response (character) with additional information such as HTTP status code, headers
|
|
#' @export
|
|
TestBodyMultipartFormdataSingleBinaryWithHttpInfo = function(my_file = 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
|
|
|
|
|
|
file_params["my-file"] <- httr::upload_file(`my_file`)
|
|
local_var_url_path <- "/body/application/octetstream/single_binary"
|
|
|
|
# The Accept request HTTP header
|
|
local_var_accepts <- list("text/plain")
|
|
|
|
# The Content-Type representation header
|
|
local_var_content_types <- list("multipart/form-data")
|
|
|
|
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(), "character", loadNamespace("openapi")),
|
|
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
|
|
}
|
|
},
|
|
#' Test body parameter(s)
|
|
#'
|
|
#' @description
|
|
#' Test body parameter(s)
|
|
#'
|
|
#' @param pet (optional) Pet object that needs to be added to the store
|
|
#' @param data_file (optional) name of the data file to save the result
|
|
#' @param ... Other optional arguments
|
|
#' @return Pet
|
|
#' @export
|
|
TestEchoBodyAllOfPet = function(pet = NULL, data_file = NULL, ...) {
|
|
local_var_response <- self$TestEchoBodyAllOfPetWithHttpInfo(pet, 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
|
|
}
|
|
},
|
|
#' Test body parameter(s)
|
|
#'
|
|
#' @description
|
|
#' Test body parameter(s)
|
|
#'
|
|
#' @param pet (optional) Pet object that needs to be added to the store
|
|
#' @param data_file (optional) name of the data file to save the result
|
|
#' @param ... Other optional arguments
|
|
#' @return API response (Pet) with additional information such as HTTP status code, headers
|
|
#' @export
|
|
TestEchoBodyAllOfPetWithHttpInfo = function(pet = 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 (!is.null(`pet`)) {
|
|
local_var_body <- `pet`$toJSONString()
|
|
} else {
|
|
body <- NULL
|
|
}
|
|
|
|
local_var_url_path <- "/echo/body/allOf/Pet"
|
|
|
|
# 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(), "Pet", loadNamespace("openapi")),
|
|
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
|
|
}
|
|
},
|
|
#' Test free form object
|
|
#'
|
|
#' @description
|
|
#' Test free form object
|
|
#'
|
|
#' @param body (optional) Free form object
|
|
#' @param data_file (optional) name of the data file to save the result
|
|
#' @param ... Other optional arguments
|
|
#' @return character
|
|
#' @export
|
|
TestEchoBodyFreeFormObjectResponseString = function(body = NULL, data_file = NULL, ...) {
|
|
local_var_response <- self$TestEchoBodyFreeFormObjectResponseStringWithHttpInfo(body, 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
|
|
}
|
|
},
|
|
#' Test free form object
|
|
#'
|
|
#' @description
|
|
#' Test free form object
|
|
#'
|
|
#' @param body (optional) Free form object
|
|
#' @param data_file (optional) name of the data file to save the result
|
|
#' @param ... Other optional arguments
|
|
#' @return API response (character) with additional information such as HTTP status code, headers
|
|
#' @export
|
|
TestEchoBodyFreeFormObjectResponseStringWithHttpInfo = function(body = 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 (!is.null(`body`)) {
|
|
local_var_body <- `body`$toJSONString()
|
|
} else {
|
|
body <- NULL
|
|
}
|
|
|
|
local_var_url_path <- "/echo/body/FreeFormObject/response_string"
|
|
|
|
# The Accept request HTTP header
|
|
local_var_accepts <- list("text/plain")
|
|
|
|
# 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(), "character", loadNamespace("openapi")),
|
|
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
|
|
}
|
|
},
|
|
#' Test body parameter(s)
|
|
#'
|
|
#' @description
|
|
#' Test body parameter(s)
|
|
#'
|
|
#' @param pet (optional) Pet object that needs to be added to the store
|
|
#' @param data_file (optional) name of the data file to save the result
|
|
#' @param ... Other optional arguments
|
|
#' @return Pet
|
|
#' @export
|
|
TestEchoBodyPet = function(pet = NULL, data_file = NULL, ...) {
|
|
local_var_response <- self$TestEchoBodyPetWithHttpInfo(pet, 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
|
|
}
|
|
},
|
|
#' Test body parameter(s)
|
|
#'
|
|
#' @description
|
|
#' Test body parameter(s)
|
|
#'
|
|
#' @param pet (optional) Pet object that needs to be added to the store
|
|
#' @param data_file (optional) name of the data file to save the result
|
|
#' @param ... Other optional arguments
|
|
#' @return API response (Pet) with additional information such as HTTP status code, headers
|
|
#' @export
|
|
TestEchoBodyPetWithHttpInfo = function(pet = 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 (!is.null(`pet`)) {
|
|
local_var_body <- `pet`$toJSONString()
|
|
} else {
|
|
body <- NULL
|
|
}
|
|
|
|
local_var_url_path <- "/echo/body/Pet"
|
|
|
|
# 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(), "Pet", loadNamespace("openapi")),
|
|
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
|
|
}
|
|
},
|
|
#' Test empty response body
|
|
#'
|
|
#' @description
|
|
#' Test empty response body
|
|
#'
|
|
#' @param pet (optional) Pet object that needs to be added to the store
|
|
#' @param data_file (optional) name of the data file to save the result
|
|
#' @param ... Other optional arguments
|
|
#' @return character
|
|
#' @export
|
|
TestEchoBodyPetResponseString = function(pet = NULL, data_file = NULL, ...) {
|
|
local_var_response <- self$TestEchoBodyPetResponseStringWithHttpInfo(pet, 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
|
|
}
|
|
},
|
|
#' Test empty response body
|
|
#'
|
|
#' @description
|
|
#' Test empty response body
|
|
#'
|
|
#' @param pet (optional) Pet object that needs to be added to the store
|
|
#' @param data_file (optional) name of the data file to save the result
|
|
#' @param ... Other optional arguments
|
|
#' @return API response (character) with additional information such as HTTP status code, headers
|
|
#' @export
|
|
TestEchoBodyPetResponseStringWithHttpInfo = function(pet = 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 (!is.null(`pet`)) {
|
|
local_var_body <- `pet`$toJSONString()
|
|
} else {
|
|
body <- NULL
|
|
}
|
|
|
|
local_var_url_path <- "/echo/body/Pet/response_string"
|
|
|
|
# The Accept request HTTP header
|
|
local_var_accepts <- list("text/plain")
|
|
|
|
# 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(), "character", loadNamespace("openapi")),
|
|
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
|
|
}
|
|
},
|
|
#' Test string enum response body
|
|
#'
|
|
#' @description
|
|
#' Test string enum response body
|
|
#'
|
|
#' @param body (optional) String enum
|
|
#' @param data_file (optional) name of the data file to save the result
|
|
#' @param ... Other optional arguments
|
|
#' @return StringEnumRef
|
|
#' @export
|
|
TestEchoBodyStringEnum = function(body = NULL, data_file = NULL, ...) {
|
|
local_var_response <- self$TestEchoBodyStringEnumWithHttpInfo(body, 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
|
|
}
|
|
},
|
|
#' Test string enum response body
|
|
#'
|
|
#' @description
|
|
#' Test string enum response body
|
|
#'
|
|
#' @param body (optional) String enum
|
|
#' @param data_file (optional) name of the data file to save the result
|
|
#' @param ... Other optional arguments
|
|
#' @return API response (StringEnumRef) with additional information such as HTTP status code, headers
|
|
#' @export
|
|
TestEchoBodyStringEnumWithHttpInfo = function(body = 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 (!is.null(`body`)) {
|
|
local_var_body <- `body`$toJSONString()
|
|
} else {
|
|
body <- NULL
|
|
}
|
|
|
|
local_var_url_path <- "/echo/body/string_enum"
|
|
|
|
# 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(), "StringEnumRef", loadNamespace("openapi")),
|
|
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
|
|
}
|
|
},
|
|
#' Test empty json (request body)
|
|
#'
|
|
#' @description
|
|
#' Test empty json (request body)
|
|
#'
|
|
#' @param tag (optional) Tag object
|
|
#' @param data_file (optional) name of the data file to save the result
|
|
#' @param ... Other optional arguments
|
|
#' @return character
|
|
#' @export
|
|
TestEchoBodyTagResponseString = function(tag = NULL, data_file = NULL, ...) {
|
|
local_var_response <- self$TestEchoBodyTagResponseStringWithHttpInfo(tag, 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
|
|
}
|
|
},
|
|
#' Test empty json (request body)
|
|
#'
|
|
#' @description
|
|
#' Test empty json (request body)
|
|
#'
|
|
#' @param tag (optional) Tag object
|
|
#' @param data_file (optional) name of the data file to save the result
|
|
#' @param ... Other optional arguments
|
|
#' @return API response (character) with additional information such as HTTP status code, headers
|
|
#' @export
|
|
TestEchoBodyTagResponseStringWithHttpInfo = function(tag = 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 (!is.null(`tag`)) {
|
|
local_var_body <- `tag`$toJSONString()
|
|
} else {
|
|
body <- NULL
|
|
}
|
|
|
|
local_var_url_path <- "/echo/body/Tag/response_string"
|
|
|
|
# The Accept request HTTP header
|
|
local_var_accepts <- list("text/plain")
|
|
|
|
# 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(), "character", loadNamespace("openapi")),
|
|
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
|
|
}
|
|
}
|
|
)
|
|
)
|