forked from loafle/openapi-generator-original
prefix local variables in api functions in r client (#13018)
This commit is contained in:
parent
adf7062e63
commit
e811d6bbe2
@ -201,14 +201,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
{{/vendorExtensions.x-streaming}}
|
{{/vendorExtensions.x-streaming}}
|
||||||
resp <- api_response$response
|
local_var_response <- api_response$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(local_var_response) >= 200 && httr::status_code(local_var_response) <= 299) {
|
||||||
api_response$content
|
api_response$content
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(local_var_response) >= 300 && httr::status_code(local_var_response) <= 399) {
|
||||||
api_response
|
api_response
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(local_var_response) >= 400 && httr::status_code(local_var_response) <= 499) {
|
||||||
api_response
|
api_response
|
||||||
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
} else if (httr::status_code(local_var_response) >= 500 && httr::status_code(local_var_response) <= 599) {
|
||||||
api_response
|
api_response
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -260,7 +260,7 @@
|
|||||||
|
|
||||||
{{/query_params}}
|
{{/query_params}}
|
||||||
{{#hasFormParams}}
|
{{#hasFormParams}}
|
||||||
body <- list(
|
local_var_body <- list(
|
||||||
{{#formParams}}
|
{{#formParams}}
|
||||||
{{^isFile}}
|
{{^isFile}}
|
||||||
"{{baseName}}" = {{paramName}}{{^-last}},{{/-last}}
|
"{{baseName}}" = {{paramName}}{{^-last}},{{/-last}}
|
||||||
@ -279,10 +279,10 @@
|
|||||||
body.items <- paste(unlist(lapply({{paramName}}, function(param) {
|
body.items <- paste(unlist(lapply({{paramName}}, function(param) {
|
||||||
param$toJSONString()
|
param$toJSONString()
|
||||||
})), collapse = ",")
|
})), collapse = ",")
|
||||||
body <- paste0("[", body.items, "]")
|
local_var_body <- paste0("[", body.items, "]")
|
||||||
{{/isArray}}
|
{{/isArray}}
|
||||||
{{^isArray}}
|
{{^isArray}}
|
||||||
body <- `{{paramName}}`$toJSONString()
|
local_var_body <- `{{paramName}}`$toJSONString()
|
||||||
{{/isArray}}
|
{{/isArray}}
|
||||||
} else {
|
} else {
|
||||||
body <- NULL
|
body <- NULL
|
||||||
@ -292,14 +292,14 @@
|
|||||||
{{/hasBodyParam}}
|
{{/hasBodyParam}}
|
||||||
{{^hasBodyParam}}
|
{{^hasBodyParam}}
|
||||||
{{^hasFormParams}}
|
{{^hasFormParams}}
|
||||||
body <- NULL
|
local_var_body <- NULL
|
||||||
{{/hasFormParams}}
|
{{/hasFormParams}}
|
||||||
{{/hasBodyParam}}
|
{{/hasBodyParam}}
|
||||||
url_path <- "{{path}}"
|
local_var_url_path <- "{{path}}"
|
||||||
{{#hasPathParams}}
|
{{#hasPathParams}}
|
||||||
{{#pathParams}}
|
{{#pathParams}}
|
||||||
if (!missing(`{{paramName}}`)) {
|
if (!missing(`{{paramName}}`)) {
|
||||||
url_path <- gsub(paste0("\\{", "{{baseName}}", "\\}"), URLencode(as.character(`{{paramName}}`), reserved = TRUE), url_path)
|
local_var_url_path <- gsub(paste0("\\{", "{{baseName}}", "\\}"), URLencode(as.character(`{{paramName}}`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
{{/pathParams}}
|
{{/pathParams}}
|
||||||
@ -334,18 +334,18 @@
|
|||||||
{{/authMethods}}
|
{{/authMethods}}
|
||||||
|
|
||||||
# The Accept request HTTP header
|
# The Accept request HTTP header
|
||||||
accepts = list({{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}})
|
local_var_accepts = list({{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}})
|
||||||
|
|
||||||
# The Content-Type representation header
|
# The Content-Type representation header
|
||||||
content_types = list({{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}})
|
local_var_content_types = list({{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}})
|
||||||
|
|
||||||
resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, url_path),
|
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||||
method = "{{httpMethod}}",
|
method = "{{httpMethod}}",
|
||||||
query_params = query_params,
|
query_params = query_params,
|
||||||
header_params = header_params,
|
header_params = header_params,
|
||||||
accepts = accepts,
|
accepts = local_var_accepts,
|
||||||
content_types = content_types,
|
content_types = local_var_content_types,
|
||||||
body = body,
|
body = local_var_body,
|
||||||
{{#vendorExtensions.x-streaming}}
|
{{#vendorExtensions.x-streaming}}
|
||||||
stream_callback = stream_callback,
|
stream_callback = stream_callback,
|
||||||
{{/vendorExtensions.x-streaming}}
|
{{/vendorExtensions.x-streaming}}
|
||||||
@ -357,15 +357,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
{{/vendorExtensions.x-streaming}}
|
{{/vendorExtensions.x-streaming}}
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(local_var_resp) >= 200 && httr::status_code(local_var_resp) <= 299) {
|
||||||
{{#returnType}}
|
{{#returnType}}
|
||||||
{{#isPrimitiveType}}
|
{{#isPrimitiveType}}
|
||||||
content <- httr::content(
|
local_var_content <- httr::content(
|
||||||
resp, "text", encoding = "UTF-8", simplifyVector = FALSE
|
local_var_resp, "text", encoding = "UTF-8", simplifyVector = FALSE
|
||||||
)
|
)
|
||||||
# save response in a file
|
# save response in a file
|
||||||
if (!is.null(data_file)) {
|
if (!is.null(data_file)) {
|
||||||
write(content, data_file)
|
write(local_var_content, data_file)
|
||||||
}
|
}
|
||||||
|
|
||||||
ApiResponse$new(content,resp)
|
ApiResponse$new(content,resp)
|
||||||
@ -373,11 +373,11 @@
|
|||||||
{{^isPrimitiveType}}
|
{{^isPrimitiveType}}
|
||||||
# save response in a file
|
# save response in a file
|
||||||
if (!is.null(data_file)) {
|
if (!is.null(data_file)) {
|
||||||
write(httr::content(resp, "text", encoding = "UTF-8", simplifyVector = FALSE), data_file)
|
write(httr::content(local_var_resp, "text", encoding = "UTF-8", simplifyVector = FALSE), data_file)
|
||||||
}
|
}
|
||||||
|
|
||||||
deserialized_resp_obj <- tryCatch(
|
deserialized_resp_obj <- tryCatch(
|
||||||
self$api_client$deserialize(resp, "{{returnType}}", loadNamespace("{{packageName}}")),
|
self$api_client$deserialize(local_var_resp, "{{returnType}}", loadNamespace("{{packageName}}")),
|
||||||
error = function(e) {
|
error = function(e) {
|
||||||
{{#useDefaultExceptionHandling}}
|
{{#useDefaultExceptionHandling}}
|
||||||
stop("Failed to deserialize response")
|
stop("Failed to deserialize response")
|
||||||
@ -385,70 +385,70 @@
|
|||||||
{{#useRlangExceptionHandling}}
|
{{#useRlangExceptionHandling}}
|
||||||
rlang::abort(message = "Failed to deserialize response",
|
rlang::abort(message = "Failed to deserialize response",
|
||||||
.subclass = "ApiException",
|
.subclass = "ApiException",
|
||||||
ApiException = ApiException$new(http_response = resp))
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
{{/useRlangExceptionHandling}}
|
{{/useRlangExceptionHandling}}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
ApiResponse$new(deserialized_resp_obj, resp)
|
ApiResponse$new(deserialized_resp_obj, local_var_resp)
|
||||||
{{/isPrimitiveType}}
|
{{/isPrimitiveType}}
|
||||||
{{/returnType}}
|
{{/returnType}}
|
||||||
{{^returnType}}
|
{{^returnType}}
|
||||||
{{! Returning the ApiResponse object with NULL object when the endpoint doesn't return anything}}
|
{{! Returning the ApiResponse object with NULL object when the endpoint doesn't return anything}}
|
||||||
ApiResponse$new(NULL, resp)
|
ApiResponse$new(NULL, local_var_resp)
|
||||||
{{/returnType}}
|
{{/returnType}}
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(local_var_resp) >= 300 && httr::status_code(local_var_resp) <= 399) {
|
||||||
{{#returnExceptionOnFailure}}
|
{{#returnExceptionOnFailure}}
|
||||||
error_msg <- toString(content(resp))
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
if (error_msg == "") {
|
if (local_var_error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
local_var_error_msg <- paste("Server returned ", httr::status_code(local_var_resp), " response status code.")
|
||||||
}
|
}
|
||||||
{{#useDefaultExceptionHandling}}
|
{{#useDefaultExceptionHandling}}
|
||||||
stop(error_msg)
|
stop(local_var_error_msg)
|
||||||
|
{{/useDefaultExceptionHandling}}
|
||||||
|
{{#useRlangExceptionHandling}}
|
||||||
|
rlang::abort(message = local_var_error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
{{/useRlangExceptionHandling}}
|
||||||
|
{{/returnExceptionOnFailure}}
|
||||||
|
{{^returnExceptionOnFailure}}
|
||||||
|
ApiResponse$new(paste("Server returned ", httr::status_code(local_var_resp), " response status code."), local_var_resp)
|
||||||
|
{{/returnExceptionOnFailure}}
|
||||||
|
} else if (httr::status_code(local_var_resp) >= 400 && httr::status_code(local_var_resp) <= 499) {
|
||||||
|
{{#returnExceptionOnFailure}}
|
||||||
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- "Api client exception encountered."
|
||||||
|
}
|
||||||
|
{{#useDefaultExceptionHandling}}
|
||||||
|
stop(local_var_error_msg)
|
||||||
|
{{/useDefaultExceptionHandling}}
|
||||||
|
{{#useRlangExceptionHandling}}
|
||||||
|
rlang::abort(message = local_var_error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
{{/useRlangExceptionHandling}}
|
||||||
|
{{/returnExceptionOnFailure}}
|
||||||
|
{{^returnExceptionOnFailure}}
|
||||||
|
ApiResponse$new("API client error", local_var_resp)
|
||||||
|
{{/returnExceptionOnFailure}}
|
||||||
|
} else if (httr::status_code(local_var_resp) >= 500 && httr::status_code(local_var_resp) <= 599) {
|
||||||
|
{{#returnExceptionOnFailure}}
|
||||||
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- "Api server exception encountered."
|
||||||
|
}
|
||||||
|
{{#useDefaultExceptionHandling}}
|
||||||
|
stop(local_var_error_msg)
|
||||||
{{/useDefaultExceptionHandling}}
|
{{/useDefaultExceptionHandling}}
|
||||||
{{#useRlangExceptionHandling}}
|
{{#useRlangExceptionHandling}}
|
||||||
rlang::abort(message = error_msg,
|
rlang::abort(message = error_msg,
|
||||||
.subclass = "ApiException",
|
.subclass = "ApiException",
|
||||||
ApiException = ApiException$new(http_response = resp))
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
{{/useRlangExceptionHandling}}
|
{{/useRlangExceptionHandling}}
|
||||||
{{/returnExceptionOnFailure}}
|
{{/returnExceptionOnFailure}}
|
||||||
{{^returnExceptionOnFailure}}
|
{{^returnExceptionOnFailure}}
|
||||||
ApiResponse$new(paste("Server returned ", httr::status_code(resp), " response status code."), resp)
|
ApiResponse$new("API server error", local_var_resp)
|
||||||
{{/returnExceptionOnFailure}}
|
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
|
||||||
{{#returnExceptionOnFailure}}
|
|
||||||
error_msg <- toString(content(resp))
|
|
||||||
if (error_msg == "") {
|
|
||||||
error_msg <- "Api client exception encountered."
|
|
||||||
}
|
|
||||||
{{#useDefaultExceptionHandling}}
|
|
||||||
stop(error_msg)
|
|
||||||
{{/useDefaultExceptionHandling}}
|
|
||||||
{{#useRlangExceptionHandling}}
|
|
||||||
rlang::abort(message = error_msg,
|
|
||||||
.subclass = "ApiException",
|
|
||||||
ApiException = ApiException$new(http_response = resp))
|
|
||||||
{{/useRlangExceptionHandling}}
|
|
||||||
{{/returnExceptionOnFailure}}
|
|
||||||
{{^returnExceptionOnFailure}}
|
|
||||||
ApiResponse$new("API client error", resp)
|
|
||||||
{{/returnExceptionOnFailure}}
|
|
||||||
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
|
||||||
{{#returnExceptionOnFailure}}
|
|
||||||
error_msg <- toString(content(resp))
|
|
||||||
if (error_msg == "") {
|
|
||||||
error_msg <- "Api server exception encountered."
|
|
||||||
}
|
|
||||||
{{#useDefaultExceptionHandling}}
|
|
||||||
stop(error_msg)
|
|
||||||
{{/useDefaultExceptionHandling}}
|
|
||||||
{{#useRlangExceptionHandling}}
|
|
||||||
rlang::abort(message = error_msg,
|
|
||||||
.subclass = "ApiException",
|
|
||||||
ApiException = ApiException$new(http_response = resp))
|
|
||||||
{{/useRlangExceptionHandling}}
|
|
||||||
{{/returnExceptionOnFailure}}
|
|
||||||
{{^returnExceptionOnFailure}}
|
|
||||||
ApiResponse$new("API server error", resp)
|
|
||||||
{{/returnExceptionOnFailure}}
|
{{/returnExceptionOnFailure}}
|
||||||
}
|
}
|
||||||
}{{^-last}},{{/-last}}
|
}{{^-last}},{{/-last}}
|
||||||
|
@ -100,14 +100,14 @@ FakeApi <- R6::R6Class(
|
|||||||
#' @export
|
#' @export
|
||||||
FakeDataFile = function(dummy, var_data_file = NULL, data_file = NULL, ...) {
|
FakeDataFile = function(dummy, var_data_file = NULL, data_file = NULL, ...) {
|
||||||
api_response <- self$FakeDataFileWithHttpInfo(dummy, var_data_file, data_file = data_file, ...)
|
api_response <- self$FakeDataFileWithHttpInfo(dummy, var_data_file, data_file = data_file, ...)
|
||||||
resp <- api_response$response
|
local_var_response <- api_response$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(local_var_response) >= 200 && httr::status_code(local_var_response) <= 299) {
|
||||||
api_response$content
|
api_response$content
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(local_var_response) >= 300 && httr::status_code(local_var_response) <= 399) {
|
||||||
api_response
|
api_response
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(local_var_response) >= 400 && httr::status_code(local_var_response) <= 499) {
|
||||||
api_response
|
api_response
|
||||||
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
} else if (httr::status_code(local_var_response) >= 500 && httr::status_code(local_var_response) <= 599) {
|
||||||
api_response
|
api_response
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -134,63 +134,63 @@ FakeApi <- R6::R6Class(
|
|||||||
reason = "Missing required parameter `dummy`."))
|
reason = "Missing required parameter `dummy`."))
|
||||||
}
|
}
|
||||||
|
|
||||||
body <- NULL
|
local_var_body <- NULL
|
||||||
url_path <- "/fake/data_file"
|
local_var_url_path <- "/fake/data_file"
|
||||||
|
|
||||||
# The Accept request HTTP header
|
# The Accept request HTTP header
|
||||||
accepts = list("application/xml", "application/json")
|
local_var_accepts = list("application/xml", "application/json")
|
||||||
|
|
||||||
# The Content-Type representation header
|
# The Content-Type representation header
|
||||||
content_types = list()
|
local_var_content_types = list()
|
||||||
|
|
||||||
resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, url_path),
|
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||||
method = "GET",
|
method = "GET",
|
||||||
query_params = query_params,
|
query_params = query_params,
|
||||||
header_params = header_params,
|
header_params = header_params,
|
||||||
accepts = accepts,
|
accepts = local_var_accepts,
|
||||||
content_types = content_types,
|
content_types = local_var_content_types,
|
||||||
body = body,
|
body = local_var_body,
|
||||||
...)
|
...)
|
||||||
|
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(local_var_resp) >= 200 && httr::status_code(local_var_resp) <= 299) {
|
||||||
# save response in a file
|
# save response in a file
|
||||||
if (!is.null(data_file)) {
|
if (!is.null(data_file)) {
|
||||||
write(httr::content(resp, "text", encoding = "UTF-8", simplifyVector = FALSE), data_file)
|
write(httr::content(local_var_resp, "text", encoding = "UTF-8", simplifyVector = FALSE), data_file)
|
||||||
}
|
}
|
||||||
|
|
||||||
deserialized_resp_obj <- tryCatch(
|
deserialized_resp_obj <- tryCatch(
|
||||||
self$api_client$deserialize(resp, "User", loadNamespace("petstore")),
|
self$api_client$deserialize(local_var_resp, "User", loadNamespace("petstore")),
|
||||||
error = function(e) {
|
error = function(e) {
|
||||||
rlang::abort(message = "Failed to deserialize response",
|
rlang::abort(message = "Failed to deserialize response",
|
||||||
.subclass = "ApiException",
|
.subclass = "ApiException",
|
||||||
ApiException = ApiException$new(http_response = resp))
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
ApiResponse$new(deserialized_resp_obj, resp)
|
ApiResponse$new(deserialized_resp_obj, local_var_resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(local_var_resp) >= 300 && httr::status_code(local_var_resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
if (error_msg == "") {
|
if (local_var_error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
local_var_error_msg <- paste("Server returned ", httr::status_code(local_var_resp), " response status code.")
|
||||||
|
}
|
||||||
|
rlang::abort(message = local_var_error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
} else if (httr::status_code(local_var_resp) >= 400 && httr::status_code(local_var_resp) <= 499) {
|
||||||
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- "Api client exception encountered."
|
||||||
|
}
|
||||||
|
rlang::abort(message = local_var_error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
} else if (httr::status_code(local_var_resp) >= 500 && httr::status_code(local_var_resp) <= 599) {
|
||||||
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg,
|
rlang::abort(message = error_msg,
|
||||||
.subclass = "ApiException",
|
.subclass = "ApiException",
|
||||||
ApiException = ApiException$new(http_response = resp))
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
|
||||||
error_msg <- toString(content(resp))
|
|
||||||
if (error_msg == "") {
|
|
||||||
error_msg <- "Api client exception encountered."
|
|
||||||
}
|
|
||||||
rlang::abort(message = error_msg,
|
|
||||||
.subclass = "ApiException",
|
|
||||||
ApiException = ApiException$new(http_response = resp))
|
|
||||||
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
|
||||||
error_msg <- toString(content(resp))
|
|
||||||
if (error_msg == "") {
|
|
||||||
error_msg <- "Api server exception encountered."
|
|
||||||
}
|
|
||||||
rlang::abort(message = error_msg,
|
|
||||||
.subclass = "ApiException",
|
|
||||||
ApiException = ApiException$new(http_response = resp))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -250,14 +250,14 @@ StoreApi <- R6::R6Class(
|
|||||||
#' @export
|
#' @export
|
||||||
DeleteOrder = function(order_id, ...) {
|
DeleteOrder = function(order_id, ...) {
|
||||||
api_response <- self$DeleteOrderWithHttpInfo(order_id, ...)
|
api_response <- self$DeleteOrderWithHttpInfo(order_id, ...)
|
||||||
resp <- api_response$response
|
local_var_response <- api_response$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(local_var_response) >= 200 && httr::status_code(local_var_response) <= 299) {
|
||||||
api_response$content
|
api_response$content
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(local_var_response) >= 300 && httr::status_code(local_var_response) <= 399) {
|
||||||
api_response
|
api_response
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(local_var_response) >= 400 && httr::status_code(local_var_response) <= 499) {
|
||||||
api_response
|
api_response
|
||||||
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
} else if (httr::status_code(local_var_response) >= 500 && httr::status_code(local_var_response) <= 599) {
|
||||||
api_response
|
api_response
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -282,54 +282,54 @@ StoreApi <- R6::R6Class(
|
|||||||
reason = "Missing required parameter `order_id`."))
|
reason = "Missing required parameter `order_id`."))
|
||||||
}
|
}
|
||||||
|
|
||||||
body <- NULL
|
local_var_body <- NULL
|
||||||
url_path <- "/store/order/{orderId}"
|
local_var_url_path <- "/store/order/{orderId}"
|
||||||
if (!missing(`order_id`)) {
|
if (!missing(`order_id`)) {
|
||||||
url_path <- gsub(paste0("\\{", "orderId", "\\}"), URLencode(as.character(`order_id`), reserved = TRUE), url_path)
|
local_var_url_path <- gsub(paste0("\\{", "orderId", "\\}"), URLencode(as.character(`order_id`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# The Accept request HTTP header
|
# The Accept request HTTP header
|
||||||
accepts = list()
|
local_var_accepts = list()
|
||||||
|
|
||||||
# The Content-Type representation header
|
# The Content-Type representation header
|
||||||
content_types = list()
|
local_var_content_types = list()
|
||||||
|
|
||||||
resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, url_path),
|
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||||
method = "DELETE",
|
method = "DELETE",
|
||||||
query_params = query_params,
|
query_params = query_params,
|
||||||
header_params = header_params,
|
header_params = header_params,
|
||||||
accepts = accepts,
|
accepts = local_var_accepts,
|
||||||
content_types = content_types,
|
content_types = local_var_content_types,
|
||||||
body = body,
|
body = local_var_body,
|
||||||
...)
|
...)
|
||||||
|
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(local_var_resp) >= 200 && httr::status_code(local_var_resp) <= 299) {
|
||||||
ApiResponse$new(NULL, resp)
|
ApiResponse$new(NULL, local_var_resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(local_var_resp) >= 300 && httr::status_code(local_var_resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
if (error_msg == "") {
|
if (local_var_error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
local_var_error_msg <- paste("Server returned ", httr::status_code(local_var_resp), " response status code.")
|
||||||
|
}
|
||||||
|
rlang::abort(message = local_var_error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
} else if (httr::status_code(local_var_resp) >= 400 && httr::status_code(local_var_resp) <= 499) {
|
||||||
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- "Api client exception encountered."
|
||||||
|
}
|
||||||
|
rlang::abort(message = local_var_error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
} else if (httr::status_code(local_var_resp) >= 500 && httr::status_code(local_var_resp) <= 599) {
|
||||||
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg,
|
rlang::abort(message = error_msg,
|
||||||
.subclass = "ApiException",
|
.subclass = "ApiException",
|
||||||
ApiException = ApiException$new(http_response = resp))
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
|
||||||
error_msg <- toString(content(resp))
|
|
||||||
if (error_msg == "") {
|
|
||||||
error_msg <- "Api client exception encountered."
|
|
||||||
}
|
|
||||||
rlang::abort(message = error_msg,
|
|
||||||
.subclass = "ApiException",
|
|
||||||
ApiException = ApiException$new(http_response = resp))
|
|
||||||
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
|
||||||
error_msg <- toString(content(resp))
|
|
||||||
if (error_msg == "") {
|
|
||||||
error_msg <- "Api server exception encountered."
|
|
||||||
}
|
|
||||||
rlang::abort(message = error_msg,
|
|
||||||
.subclass = "ApiException",
|
|
||||||
ApiException = ApiException$new(http_response = resp))
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
#' Returns pet inventories by status
|
#' Returns pet inventories by status
|
||||||
@ -343,14 +343,14 @@ StoreApi <- R6::R6Class(
|
|||||||
#' @export
|
#' @export
|
||||||
GetInventory = function(data_file = NULL, ...) {
|
GetInventory = function(data_file = NULL, ...) {
|
||||||
api_response <- self$GetInventoryWithHttpInfo(data_file = data_file, ...)
|
api_response <- self$GetInventoryWithHttpInfo(data_file = data_file, ...)
|
||||||
resp <- api_response$response
|
local_var_response <- api_response$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(local_var_response) >= 200 && httr::status_code(local_var_response) <= 299) {
|
||||||
api_response$content
|
api_response$content
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(local_var_response) >= 300 && httr::status_code(local_var_response) <= 399) {
|
||||||
api_response
|
api_response
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(local_var_response) >= 400 && httr::status_code(local_var_response) <= 499) {
|
||||||
api_response
|
api_response
|
||||||
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
} else if (httr::status_code(local_var_response) >= 500 && httr::status_code(local_var_response) <= 599) {
|
||||||
api_response
|
api_response
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -368,67 +368,67 @@ StoreApi <- R6::R6Class(
|
|||||||
query_params <- list()
|
query_params <- list()
|
||||||
header_params <- c()
|
header_params <- c()
|
||||||
|
|
||||||
body <- NULL
|
local_var_body <- NULL
|
||||||
url_path <- "/store/inventory"
|
local_var_url_path <- "/store/inventory"
|
||||||
# API key authentication
|
# API key authentication
|
||||||
if ("api_key" %in% names(self$api_client$api_keys) && nchar(self$api_client$api_keys["api_key"]) > 0) {
|
if ("api_key" %in% names(self$api_client$api_keys) && nchar(self$api_client$api_keys["api_key"]) > 0) {
|
||||||
header_params["api_key"] <- paste(unlist(self$api_client$api_keys["api_key"]), collapse = "")
|
header_params["api_key"] <- paste(unlist(self$api_client$api_keys["api_key"]), collapse = "")
|
||||||
}
|
}
|
||||||
|
|
||||||
# The Accept request HTTP header
|
# The Accept request HTTP header
|
||||||
accepts = list("application/json")
|
local_var_accepts = list("application/json")
|
||||||
|
|
||||||
# The Content-Type representation header
|
# The Content-Type representation header
|
||||||
content_types = list()
|
local_var_content_types = list()
|
||||||
|
|
||||||
resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, url_path),
|
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||||
method = "GET",
|
method = "GET",
|
||||||
query_params = query_params,
|
query_params = query_params,
|
||||||
header_params = header_params,
|
header_params = header_params,
|
||||||
accepts = accepts,
|
accepts = local_var_accepts,
|
||||||
content_types = content_types,
|
content_types = local_var_content_types,
|
||||||
body = body,
|
body = local_var_body,
|
||||||
...)
|
...)
|
||||||
|
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(local_var_resp) >= 200 && httr::status_code(local_var_resp) <= 299) {
|
||||||
# save response in a file
|
# save response in a file
|
||||||
if (!is.null(data_file)) {
|
if (!is.null(data_file)) {
|
||||||
write(httr::content(resp, "text", encoding = "UTF-8", simplifyVector = FALSE), data_file)
|
write(httr::content(local_var_resp, "text", encoding = "UTF-8", simplifyVector = FALSE), data_file)
|
||||||
}
|
}
|
||||||
|
|
||||||
deserialized_resp_obj <- tryCatch(
|
deserialized_resp_obj <- tryCatch(
|
||||||
self$api_client$deserialize(resp, "map(integer)", loadNamespace("petstore")),
|
self$api_client$deserialize(local_var_resp, "map(integer)", loadNamespace("petstore")),
|
||||||
error = function(e) {
|
error = function(e) {
|
||||||
rlang::abort(message = "Failed to deserialize response",
|
rlang::abort(message = "Failed to deserialize response",
|
||||||
.subclass = "ApiException",
|
.subclass = "ApiException",
|
||||||
ApiException = ApiException$new(http_response = resp))
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
ApiResponse$new(deserialized_resp_obj, resp)
|
ApiResponse$new(deserialized_resp_obj, local_var_resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(local_var_resp) >= 300 && httr::status_code(local_var_resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
if (error_msg == "") {
|
if (local_var_error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
local_var_error_msg <- paste("Server returned ", httr::status_code(local_var_resp), " response status code.")
|
||||||
|
}
|
||||||
|
rlang::abort(message = local_var_error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
} else if (httr::status_code(local_var_resp) >= 400 && httr::status_code(local_var_resp) <= 499) {
|
||||||
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- "Api client exception encountered."
|
||||||
|
}
|
||||||
|
rlang::abort(message = local_var_error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
} else if (httr::status_code(local_var_resp) >= 500 && httr::status_code(local_var_resp) <= 599) {
|
||||||
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg,
|
rlang::abort(message = error_msg,
|
||||||
.subclass = "ApiException",
|
.subclass = "ApiException",
|
||||||
ApiException = ApiException$new(http_response = resp))
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
|
||||||
error_msg <- toString(content(resp))
|
|
||||||
if (error_msg == "") {
|
|
||||||
error_msg <- "Api client exception encountered."
|
|
||||||
}
|
|
||||||
rlang::abort(message = error_msg,
|
|
||||||
.subclass = "ApiException",
|
|
||||||
ApiException = ApiException$new(http_response = resp))
|
|
||||||
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
|
||||||
error_msg <- toString(content(resp))
|
|
||||||
if (error_msg == "") {
|
|
||||||
error_msg <- "Api server exception encountered."
|
|
||||||
}
|
|
||||||
rlang::abort(message = error_msg,
|
|
||||||
.subclass = "ApiException",
|
|
||||||
ApiException = ApiException$new(http_response = resp))
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
#' Find purchase order by ID
|
#' Find purchase order by ID
|
||||||
@ -443,14 +443,14 @@ StoreApi <- R6::R6Class(
|
|||||||
#' @export
|
#' @export
|
||||||
GetOrderById = function(order_id, data_file = NULL, ...) {
|
GetOrderById = function(order_id, data_file = NULL, ...) {
|
||||||
api_response <- self$GetOrderByIdWithHttpInfo(order_id, data_file = data_file, ...)
|
api_response <- self$GetOrderByIdWithHttpInfo(order_id, data_file = data_file, ...)
|
||||||
resp <- api_response$response
|
local_var_response <- api_response$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(local_var_response) >= 200 && httr::status_code(local_var_response) <= 299) {
|
||||||
api_response$content
|
api_response$content
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(local_var_response) >= 300 && httr::status_code(local_var_response) <= 399) {
|
||||||
api_response
|
api_response
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(local_var_response) >= 400 && httr::status_code(local_var_response) <= 499) {
|
||||||
api_response
|
api_response
|
||||||
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
} else if (httr::status_code(local_var_response) >= 500 && httr::status_code(local_var_response) <= 599) {
|
||||||
api_response
|
api_response
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -476,67 +476,67 @@ StoreApi <- R6::R6Class(
|
|||||||
reason = "Missing required parameter `order_id`."))
|
reason = "Missing required parameter `order_id`."))
|
||||||
}
|
}
|
||||||
|
|
||||||
body <- NULL
|
local_var_body <- NULL
|
||||||
url_path <- "/store/order/{orderId}"
|
local_var_url_path <- "/store/order/{orderId}"
|
||||||
if (!missing(`order_id`)) {
|
if (!missing(`order_id`)) {
|
||||||
url_path <- gsub(paste0("\\{", "orderId", "\\}"), URLencode(as.character(`order_id`), reserved = TRUE), url_path)
|
local_var_url_path <- gsub(paste0("\\{", "orderId", "\\}"), URLencode(as.character(`order_id`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# The Accept request HTTP header
|
# The Accept request HTTP header
|
||||||
accepts = list("application/xml", "application/json")
|
local_var_accepts = list("application/xml", "application/json")
|
||||||
|
|
||||||
# The Content-Type representation header
|
# The Content-Type representation header
|
||||||
content_types = list()
|
local_var_content_types = list()
|
||||||
|
|
||||||
resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, url_path),
|
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||||
method = "GET",
|
method = "GET",
|
||||||
query_params = query_params,
|
query_params = query_params,
|
||||||
header_params = header_params,
|
header_params = header_params,
|
||||||
accepts = accepts,
|
accepts = local_var_accepts,
|
||||||
content_types = content_types,
|
content_types = local_var_content_types,
|
||||||
body = body,
|
body = local_var_body,
|
||||||
...)
|
...)
|
||||||
|
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(local_var_resp) >= 200 && httr::status_code(local_var_resp) <= 299) {
|
||||||
# save response in a file
|
# save response in a file
|
||||||
if (!is.null(data_file)) {
|
if (!is.null(data_file)) {
|
||||||
write(httr::content(resp, "text", encoding = "UTF-8", simplifyVector = FALSE), data_file)
|
write(httr::content(local_var_resp, "text", encoding = "UTF-8", simplifyVector = FALSE), data_file)
|
||||||
}
|
}
|
||||||
|
|
||||||
deserialized_resp_obj <- tryCatch(
|
deserialized_resp_obj <- tryCatch(
|
||||||
self$api_client$deserialize(resp, "Order", loadNamespace("petstore")),
|
self$api_client$deserialize(local_var_resp, "Order", loadNamespace("petstore")),
|
||||||
error = function(e) {
|
error = function(e) {
|
||||||
rlang::abort(message = "Failed to deserialize response",
|
rlang::abort(message = "Failed to deserialize response",
|
||||||
.subclass = "ApiException",
|
.subclass = "ApiException",
|
||||||
ApiException = ApiException$new(http_response = resp))
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
ApiResponse$new(deserialized_resp_obj, resp)
|
ApiResponse$new(deserialized_resp_obj, local_var_resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(local_var_resp) >= 300 && httr::status_code(local_var_resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
if (error_msg == "") {
|
if (local_var_error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
local_var_error_msg <- paste("Server returned ", httr::status_code(local_var_resp), " response status code.")
|
||||||
|
}
|
||||||
|
rlang::abort(message = local_var_error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
} else if (httr::status_code(local_var_resp) >= 400 && httr::status_code(local_var_resp) <= 499) {
|
||||||
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- "Api client exception encountered."
|
||||||
|
}
|
||||||
|
rlang::abort(message = local_var_error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
} else if (httr::status_code(local_var_resp) >= 500 && httr::status_code(local_var_resp) <= 599) {
|
||||||
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg,
|
rlang::abort(message = error_msg,
|
||||||
.subclass = "ApiException",
|
.subclass = "ApiException",
|
||||||
ApiException = ApiException$new(http_response = resp))
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
|
||||||
error_msg <- toString(content(resp))
|
|
||||||
if (error_msg == "") {
|
|
||||||
error_msg <- "Api client exception encountered."
|
|
||||||
}
|
|
||||||
rlang::abort(message = error_msg,
|
|
||||||
.subclass = "ApiException",
|
|
||||||
ApiException = ApiException$new(http_response = resp))
|
|
||||||
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
|
||||||
error_msg <- toString(content(resp))
|
|
||||||
if (error_msg == "") {
|
|
||||||
error_msg <- "Api server exception encountered."
|
|
||||||
}
|
|
||||||
rlang::abort(message = error_msg,
|
|
||||||
.subclass = "ApiException",
|
|
||||||
ApiException = ApiException$new(http_response = resp))
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
#' Place an order for a pet
|
#' Place an order for a pet
|
||||||
@ -551,14 +551,14 @@ StoreApi <- R6::R6Class(
|
|||||||
#' @export
|
#' @export
|
||||||
PlaceOrder = function(order, data_file = NULL, ...) {
|
PlaceOrder = function(order, data_file = NULL, ...) {
|
||||||
api_response <- self$PlaceOrderWithHttpInfo(order, data_file = data_file, ...)
|
api_response <- self$PlaceOrderWithHttpInfo(order, data_file = data_file, ...)
|
||||||
resp <- api_response$response
|
local_var_response <- api_response$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(local_var_response) >= 200 && httr::status_code(local_var_response) <= 299) {
|
||||||
api_response$content
|
api_response$content
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(local_var_response) >= 300 && httr::status_code(local_var_response) <= 399) {
|
||||||
api_response
|
api_response
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(local_var_response) >= 400 && httr::status_code(local_var_response) <= 499) {
|
||||||
api_response
|
api_response
|
||||||
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
} else if (httr::status_code(local_var_response) >= 500 && httr::status_code(local_var_response) <= 599) {
|
||||||
api_response
|
api_response
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -585,67 +585,67 @@ StoreApi <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!missing(`order`)) {
|
if (!missing(`order`)) {
|
||||||
body <- `order`$toJSONString()
|
local_var_body <- `order`$toJSONString()
|
||||||
} else {
|
} else {
|
||||||
body <- NULL
|
body <- NULL
|
||||||
}
|
}
|
||||||
|
|
||||||
url_path <- "/store/order"
|
local_var_url_path <- "/store/order"
|
||||||
|
|
||||||
# The Accept request HTTP header
|
# The Accept request HTTP header
|
||||||
accepts = list("application/xml", "application/json")
|
local_var_accepts = list("application/xml", "application/json")
|
||||||
|
|
||||||
# The Content-Type representation header
|
# The Content-Type representation header
|
||||||
content_types = list("application/json")
|
local_var_content_types = list("application/json")
|
||||||
|
|
||||||
resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, url_path),
|
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||||
method = "POST",
|
method = "POST",
|
||||||
query_params = query_params,
|
query_params = query_params,
|
||||||
header_params = header_params,
|
header_params = header_params,
|
||||||
accepts = accepts,
|
accepts = local_var_accepts,
|
||||||
content_types = content_types,
|
content_types = local_var_content_types,
|
||||||
body = body,
|
body = local_var_body,
|
||||||
...)
|
...)
|
||||||
|
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(local_var_resp) >= 200 && httr::status_code(local_var_resp) <= 299) {
|
||||||
# save response in a file
|
# save response in a file
|
||||||
if (!is.null(data_file)) {
|
if (!is.null(data_file)) {
|
||||||
write(httr::content(resp, "text", encoding = "UTF-8", simplifyVector = FALSE), data_file)
|
write(httr::content(local_var_resp, "text", encoding = "UTF-8", simplifyVector = FALSE), data_file)
|
||||||
}
|
}
|
||||||
|
|
||||||
deserialized_resp_obj <- tryCatch(
|
deserialized_resp_obj <- tryCatch(
|
||||||
self$api_client$deserialize(resp, "Order", loadNamespace("petstore")),
|
self$api_client$deserialize(local_var_resp, "Order", loadNamespace("petstore")),
|
||||||
error = function(e) {
|
error = function(e) {
|
||||||
rlang::abort(message = "Failed to deserialize response",
|
rlang::abort(message = "Failed to deserialize response",
|
||||||
.subclass = "ApiException",
|
.subclass = "ApiException",
|
||||||
ApiException = ApiException$new(http_response = resp))
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
ApiResponse$new(deserialized_resp_obj, resp)
|
ApiResponse$new(deserialized_resp_obj, local_var_resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(local_var_resp) >= 300 && httr::status_code(local_var_resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
if (error_msg == "") {
|
if (local_var_error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
local_var_error_msg <- paste("Server returned ", httr::status_code(local_var_resp), " response status code.")
|
||||||
|
}
|
||||||
|
rlang::abort(message = local_var_error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
} else if (httr::status_code(local_var_resp) >= 400 && httr::status_code(local_var_resp) <= 499) {
|
||||||
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- "Api client exception encountered."
|
||||||
|
}
|
||||||
|
rlang::abort(message = local_var_error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
} else if (httr::status_code(local_var_resp) >= 500 && httr::status_code(local_var_resp) <= 599) {
|
||||||
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg,
|
rlang::abort(message = error_msg,
|
||||||
.subclass = "ApiException",
|
.subclass = "ApiException",
|
||||||
ApiException = ApiException$new(http_response = resp))
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
|
||||||
error_msg <- toString(content(resp))
|
|
||||||
if (error_msg == "") {
|
|
||||||
error_msg <- "Api client exception encountered."
|
|
||||||
}
|
|
||||||
rlang::abort(message = error_msg,
|
|
||||||
.subclass = "ApiException",
|
|
||||||
ApiException = ApiException$new(http_response = resp))
|
|
||||||
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
|
||||||
error_msg <- toString(content(resp))
|
|
||||||
if (error_msg == "") {
|
|
||||||
error_msg <- "Api server exception encountered."
|
|
||||||
}
|
|
||||||
rlang::abort(message = error_msg,
|
|
||||||
.subclass = "ApiException",
|
|
||||||
ApiException = ApiException$new(http_response = resp))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -436,14 +436,14 @@ UserApi <- R6::R6Class(
|
|||||||
#' @export
|
#' @export
|
||||||
CreateUser = function(user, ...) {
|
CreateUser = function(user, ...) {
|
||||||
api_response <- self$CreateUserWithHttpInfo(user, ...)
|
api_response <- self$CreateUserWithHttpInfo(user, ...)
|
||||||
resp <- api_response$response
|
local_var_response <- api_response$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(local_var_response) >= 200 && httr::status_code(local_var_response) <= 299) {
|
||||||
api_response$content
|
api_response$content
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(local_var_response) >= 300 && httr::status_code(local_var_response) <= 399) {
|
||||||
api_response
|
api_response
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(local_var_response) >= 400 && httr::status_code(local_var_response) <= 499) {
|
||||||
api_response
|
api_response
|
||||||
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
} else if (httr::status_code(local_var_response) >= 500 && httr::status_code(local_var_response) <= 599) {
|
||||||
api_response
|
api_response
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -469,58 +469,58 @@ UserApi <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!missing(`user`)) {
|
if (!missing(`user`)) {
|
||||||
body <- `user`$toJSONString()
|
local_var_body <- `user`$toJSONString()
|
||||||
} else {
|
} else {
|
||||||
body <- NULL
|
body <- NULL
|
||||||
}
|
}
|
||||||
|
|
||||||
url_path <- "/user"
|
local_var_url_path <- "/user"
|
||||||
# API key authentication
|
# API key authentication
|
||||||
if ("api_key" %in% names(self$api_client$api_keys) && nchar(self$api_client$api_keys["api_key"]) > 0) {
|
if ("api_key" %in% names(self$api_client$api_keys) && nchar(self$api_client$api_keys["api_key"]) > 0) {
|
||||||
header_params["api_key"] <- paste(unlist(self$api_client$api_keys["api_key"]), collapse = "")
|
header_params["api_key"] <- paste(unlist(self$api_client$api_keys["api_key"]), collapse = "")
|
||||||
}
|
}
|
||||||
|
|
||||||
# The Accept request HTTP header
|
# The Accept request HTTP header
|
||||||
accepts = list()
|
local_var_accepts = list()
|
||||||
|
|
||||||
# The Content-Type representation header
|
# The Content-Type representation header
|
||||||
content_types = list("application/json")
|
local_var_content_types = list("application/json")
|
||||||
|
|
||||||
resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, url_path),
|
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||||
method = "POST",
|
method = "POST",
|
||||||
query_params = query_params,
|
query_params = query_params,
|
||||||
header_params = header_params,
|
header_params = header_params,
|
||||||
accepts = accepts,
|
accepts = local_var_accepts,
|
||||||
content_types = content_types,
|
content_types = local_var_content_types,
|
||||||
body = body,
|
body = local_var_body,
|
||||||
...)
|
...)
|
||||||
|
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(local_var_resp) >= 200 && httr::status_code(local_var_resp) <= 299) {
|
||||||
ApiResponse$new(NULL, resp)
|
ApiResponse$new(NULL, local_var_resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(local_var_resp) >= 300 && httr::status_code(local_var_resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
if (error_msg == "") {
|
if (local_var_error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
local_var_error_msg <- paste("Server returned ", httr::status_code(local_var_resp), " response status code.")
|
||||||
|
}
|
||||||
|
rlang::abort(message = local_var_error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
} else if (httr::status_code(local_var_resp) >= 400 && httr::status_code(local_var_resp) <= 499) {
|
||||||
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- "Api client exception encountered."
|
||||||
|
}
|
||||||
|
rlang::abort(message = local_var_error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
} else if (httr::status_code(local_var_resp) >= 500 && httr::status_code(local_var_resp) <= 599) {
|
||||||
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg,
|
rlang::abort(message = error_msg,
|
||||||
.subclass = "ApiException",
|
.subclass = "ApiException",
|
||||||
ApiException = ApiException$new(http_response = resp))
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
|
||||||
error_msg <- toString(content(resp))
|
|
||||||
if (error_msg == "") {
|
|
||||||
error_msg <- "Api client exception encountered."
|
|
||||||
}
|
|
||||||
rlang::abort(message = error_msg,
|
|
||||||
.subclass = "ApiException",
|
|
||||||
ApiException = ApiException$new(http_response = resp))
|
|
||||||
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
|
||||||
error_msg <- toString(content(resp))
|
|
||||||
if (error_msg == "") {
|
|
||||||
error_msg <- "Api server exception encountered."
|
|
||||||
}
|
|
||||||
rlang::abort(message = error_msg,
|
|
||||||
.subclass = "ApiException",
|
|
||||||
ApiException = ApiException$new(http_response = resp))
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
#' Creates list of users with given input array
|
#' Creates list of users with given input array
|
||||||
@ -534,14 +534,14 @@ UserApi <- R6::R6Class(
|
|||||||
#' @export
|
#' @export
|
||||||
CreateUsersWithArrayInput = function(user, ...) {
|
CreateUsersWithArrayInput = function(user, ...) {
|
||||||
api_response <- self$CreateUsersWithArrayInputWithHttpInfo(user, ...)
|
api_response <- self$CreateUsersWithArrayInputWithHttpInfo(user, ...)
|
||||||
resp <- api_response$response
|
local_var_response <- api_response$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(local_var_response) >= 200 && httr::status_code(local_var_response) <= 299) {
|
||||||
api_response$content
|
api_response$content
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(local_var_response) >= 300 && httr::status_code(local_var_response) <= 399) {
|
||||||
api_response
|
api_response
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(local_var_response) >= 400 && httr::status_code(local_var_response) <= 499) {
|
||||||
api_response
|
api_response
|
||||||
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
} else if (httr::status_code(local_var_response) >= 500 && httr::status_code(local_var_response) <= 599) {
|
||||||
api_response
|
api_response
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -570,58 +570,58 @@ UserApi <- R6::R6Class(
|
|||||||
body.items <- paste(unlist(lapply(user, function(param) {
|
body.items <- paste(unlist(lapply(user, function(param) {
|
||||||
param$toJSONString()
|
param$toJSONString()
|
||||||
})), collapse = ",")
|
})), collapse = ",")
|
||||||
body <- paste0("[", body.items, "]")
|
local_var_body <- paste0("[", body.items, "]")
|
||||||
} else {
|
} else {
|
||||||
body <- NULL
|
body <- NULL
|
||||||
}
|
}
|
||||||
|
|
||||||
url_path <- "/user/createWithArray"
|
local_var_url_path <- "/user/createWithArray"
|
||||||
# API key authentication
|
# API key authentication
|
||||||
if ("api_key" %in% names(self$api_client$api_keys) && nchar(self$api_client$api_keys["api_key"]) > 0) {
|
if ("api_key" %in% names(self$api_client$api_keys) && nchar(self$api_client$api_keys["api_key"]) > 0) {
|
||||||
header_params["api_key"] <- paste(unlist(self$api_client$api_keys["api_key"]), collapse = "")
|
header_params["api_key"] <- paste(unlist(self$api_client$api_keys["api_key"]), collapse = "")
|
||||||
}
|
}
|
||||||
|
|
||||||
# The Accept request HTTP header
|
# The Accept request HTTP header
|
||||||
accepts = list()
|
local_var_accepts = list()
|
||||||
|
|
||||||
# The Content-Type representation header
|
# The Content-Type representation header
|
||||||
content_types = list("application/json")
|
local_var_content_types = list("application/json")
|
||||||
|
|
||||||
resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, url_path),
|
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||||
method = "POST",
|
method = "POST",
|
||||||
query_params = query_params,
|
query_params = query_params,
|
||||||
header_params = header_params,
|
header_params = header_params,
|
||||||
accepts = accepts,
|
accepts = local_var_accepts,
|
||||||
content_types = content_types,
|
content_types = local_var_content_types,
|
||||||
body = body,
|
body = local_var_body,
|
||||||
...)
|
...)
|
||||||
|
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(local_var_resp) >= 200 && httr::status_code(local_var_resp) <= 299) {
|
||||||
ApiResponse$new(NULL, resp)
|
ApiResponse$new(NULL, local_var_resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(local_var_resp) >= 300 && httr::status_code(local_var_resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
if (error_msg == "") {
|
if (local_var_error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
local_var_error_msg <- paste("Server returned ", httr::status_code(local_var_resp), " response status code.")
|
||||||
|
}
|
||||||
|
rlang::abort(message = local_var_error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
} else if (httr::status_code(local_var_resp) >= 400 && httr::status_code(local_var_resp) <= 499) {
|
||||||
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- "Api client exception encountered."
|
||||||
|
}
|
||||||
|
rlang::abort(message = local_var_error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
} else if (httr::status_code(local_var_resp) >= 500 && httr::status_code(local_var_resp) <= 599) {
|
||||||
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg,
|
rlang::abort(message = error_msg,
|
||||||
.subclass = "ApiException",
|
.subclass = "ApiException",
|
||||||
ApiException = ApiException$new(http_response = resp))
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
|
||||||
error_msg <- toString(content(resp))
|
|
||||||
if (error_msg == "") {
|
|
||||||
error_msg <- "Api client exception encountered."
|
|
||||||
}
|
|
||||||
rlang::abort(message = error_msg,
|
|
||||||
.subclass = "ApiException",
|
|
||||||
ApiException = ApiException$new(http_response = resp))
|
|
||||||
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
|
||||||
error_msg <- toString(content(resp))
|
|
||||||
if (error_msg == "") {
|
|
||||||
error_msg <- "Api server exception encountered."
|
|
||||||
}
|
|
||||||
rlang::abort(message = error_msg,
|
|
||||||
.subclass = "ApiException",
|
|
||||||
ApiException = ApiException$new(http_response = resp))
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
#' Creates list of users with given input array
|
#' Creates list of users with given input array
|
||||||
@ -635,14 +635,14 @@ UserApi <- R6::R6Class(
|
|||||||
#' @export
|
#' @export
|
||||||
CreateUsersWithListInput = function(user, ...) {
|
CreateUsersWithListInput = function(user, ...) {
|
||||||
api_response <- self$CreateUsersWithListInputWithHttpInfo(user, ...)
|
api_response <- self$CreateUsersWithListInputWithHttpInfo(user, ...)
|
||||||
resp <- api_response$response
|
local_var_response <- api_response$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(local_var_response) >= 200 && httr::status_code(local_var_response) <= 299) {
|
||||||
api_response$content
|
api_response$content
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(local_var_response) >= 300 && httr::status_code(local_var_response) <= 399) {
|
||||||
api_response
|
api_response
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(local_var_response) >= 400 && httr::status_code(local_var_response) <= 499) {
|
||||||
api_response
|
api_response
|
||||||
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
} else if (httr::status_code(local_var_response) >= 500 && httr::status_code(local_var_response) <= 599) {
|
||||||
api_response
|
api_response
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -671,58 +671,58 @@ UserApi <- R6::R6Class(
|
|||||||
body.items <- paste(unlist(lapply(user, function(param) {
|
body.items <- paste(unlist(lapply(user, function(param) {
|
||||||
param$toJSONString()
|
param$toJSONString()
|
||||||
})), collapse = ",")
|
})), collapse = ",")
|
||||||
body <- paste0("[", body.items, "]")
|
local_var_body <- paste0("[", body.items, "]")
|
||||||
} else {
|
} else {
|
||||||
body <- NULL
|
body <- NULL
|
||||||
}
|
}
|
||||||
|
|
||||||
url_path <- "/user/createWithList"
|
local_var_url_path <- "/user/createWithList"
|
||||||
# API key authentication
|
# API key authentication
|
||||||
if ("api_key" %in% names(self$api_client$api_keys) && nchar(self$api_client$api_keys["api_key"]) > 0) {
|
if ("api_key" %in% names(self$api_client$api_keys) && nchar(self$api_client$api_keys["api_key"]) > 0) {
|
||||||
header_params["api_key"] <- paste(unlist(self$api_client$api_keys["api_key"]), collapse = "")
|
header_params["api_key"] <- paste(unlist(self$api_client$api_keys["api_key"]), collapse = "")
|
||||||
}
|
}
|
||||||
|
|
||||||
# The Accept request HTTP header
|
# The Accept request HTTP header
|
||||||
accepts = list()
|
local_var_accepts = list()
|
||||||
|
|
||||||
# The Content-Type representation header
|
# The Content-Type representation header
|
||||||
content_types = list("application/json")
|
local_var_content_types = list("application/json")
|
||||||
|
|
||||||
resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, url_path),
|
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||||
method = "POST",
|
method = "POST",
|
||||||
query_params = query_params,
|
query_params = query_params,
|
||||||
header_params = header_params,
|
header_params = header_params,
|
||||||
accepts = accepts,
|
accepts = local_var_accepts,
|
||||||
content_types = content_types,
|
content_types = local_var_content_types,
|
||||||
body = body,
|
body = local_var_body,
|
||||||
...)
|
...)
|
||||||
|
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(local_var_resp) >= 200 && httr::status_code(local_var_resp) <= 299) {
|
||||||
ApiResponse$new(NULL, resp)
|
ApiResponse$new(NULL, local_var_resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(local_var_resp) >= 300 && httr::status_code(local_var_resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
if (error_msg == "") {
|
if (local_var_error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
local_var_error_msg <- paste("Server returned ", httr::status_code(local_var_resp), " response status code.")
|
||||||
|
}
|
||||||
|
rlang::abort(message = local_var_error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
} else if (httr::status_code(local_var_resp) >= 400 && httr::status_code(local_var_resp) <= 499) {
|
||||||
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- "Api client exception encountered."
|
||||||
|
}
|
||||||
|
rlang::abort(message = local_var_error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
} else if (httr::status_code(local_var_resp) >= 500 && httr::status_code(local_var_resp) <= 599) {
|
||||||
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg,
|
rlang::abort(message = error_msg,
|
||||||
.subclass = "ApiException",
|
.subclass = "ApiException",
|
||||||
ApiException = ApiException$new(http_response = resp))
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
|
||||||
error_msg <- toString(content(resp))
|
|
||||||
if (error_msg == "") {
|
|
||||||
error_msg <- "Api client exception encountered."
|
|
||||||
}
|
|
||||||
rlang::abort(message = error_msg,
|
|
||||||
.subclass = "ApiException",
|
|
||||||
ApiException = ApiException$new(http_response = resp))
|
|
||||||
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
|
||||||
error_msg <- toString(content(resp))
|
|
||||||
if (error_msg == "") {
|
|
||||||
error_msg <- "Api server exception encountered."
|
|
||||||
}
|
|
||||||
rlang::abort(message = error_msg,
|
|
||||||
.subclass = "ApiException",
|
|
||||||
ApiException = ApiException$new(http_response = resp))
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
#' Delete user
|
#' Delete user
|
||||||
@ -736,14 +736,14 @@ UserApi <- R6::R6Class(
|
|||||||
#' @export
|
#' @export
|
||||||
DeleteUser = function(username, ...) {
|
DeleteUser = function(username, ...) {
|
||||||
api_response <- self$DeleteUserWithHttpInfo(username, ...)
|
api_response <- self$DeleteUserWithHttpInfo(username, ...)
|
||||||
resp <- api_response$response
|
local_var_response <- api_response$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(local_var_response) >= 200 && httr::status_code(local_var_response) <= 299) {
|
||||||
api_response$content
|
api_response$content
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(local_var_response) >= 300 && httr::status_code(local_var_response) <= 399) {
|
||||||
api_response
|
api_response
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(local_var_response) >= 400 && httr::status_code(local_var_response) <= 499) {
|
||||||
api_response
|
api_response
|
||||||
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
} else if (httr::status_code(local_var_response) >= 500 && httr::status_code(local_var_response) <= 599) {
|
||||||
api_response
|
api_response
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -768,10 +768,10 @@ UserApi <- R6::R6Class(
|
|||||||
reason = "Missing required parameter `username`."))
|
reason = "Missing required parameter `username`."))
|
||||||
}
|
}
|
||||||
|
|
||||||
body <- NULL
|
local_var_body <- NULL
|
||||||
url_path <- "/user/{username}"
|
local_var_url_path <- "/user/{username}"
|
||||||
if (!missing(`username`)) {
|
if (!missing(`username`)) {
|
||||||
url_path <- gsub(paste0("\\{", "username", "\\}"), URLencode(as.character(`username`), reserved = TRUE), url_path)
|
local_var_url_path <- gsub(paste0("\\{", "username", "\\}"), URLencode(as.character(`username`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
# API key authentication
|
# API key authentication
|
||||||
@ -780,46 +780,46 @@ UserApi <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
|
|
||||||
# The Accept request HTTP header
|
# The Accept request HTTP header
|
||||||
accepts = list()
|
local_var_accepts = list()
|
||||||
|
|
||||||
# The Content-Type representation header
|
# The Content-Type representation header
|
||||||
content_types = list()
|
local_var_content_types = list()
|
||||||
|
|
||||||
resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, url_path),
|
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||||
method = "DELETE",
|
method = "DELETE",
|
||||||
query_params = query_params,
|
query_params = query_params,
|
||||||
header_params = header_params,
|
header_params = header_params,
|
||||||
accepts = accepts,
|
accepts = local_var_accepts,
|
||||||
content_types = content_types,
|
content_types = local_var_content_types,
|
||||||
body = body,
|
body = local_var_body,
|
||||||
...)
|
...)
|
||||||
|
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(local_var_resp) >= 200 && httr::status_code(local_var_resp) <= 299) {
|
||||||
ApiResponse$new(NULL, resp)
|
ApiResponse$new(NULL, local_var_resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(local_var_resp) >= 300 && httr::status_code(local_var_resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
if (error_msg == "") {
|
if (local_var_error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
local_var_error_msg <- paste("Server returned ", httr::status_code(local_var_resp), " response status code.")
|
||||||
|
}
|
||||||
|
rlang::abort(message = local_var_error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
} else if (httr::status_code(local_var_resp) >= 400 && httr::status_code(local_var_resp) <= 499) {
|
||||||
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- "Api client exception encountered."
|
||||||
|
}
|
||||||
|
rlang::abort(message = local_var_error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
} else if (httr::status_code(local_var_resp) >= 500 && httr::status_code(local_var_resp) <= 599) {
|
||||||
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg,
|
rlang::abort(message = error_msg,
|
||||||
.subclass = "ApiException",
|
.subclass = "ApiException",
|
||||||
ApiException = ApiException$new(http_response = resp))
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
|
||||||
error_msg <- toString(content(resp))
|
|
||||||
if (error_msg == "") {
|
|
||||||
error_msg <- "Api client exception encountered."
|
|
||||||
}
|
|
||||||
rlang::abort(message = error_msg,
|
|
||||||
.subclass = "ApiException",
|
|
||||||
ApiException = ApiException$new(http_response = resp))
|
|
||||||
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
|
||||||
error_msg <- toString(content(resp))
|
|
||||||
if (error_msg == "") {
|
|
||||||
error_msg <- "Api server exception encountered."
|
|
||||||
}
|
|
||||||
rlang::abort(message = error_msg,
|
|
||||||
.subclass = "ApiException",
|
|
||||||
ApiException = ApiException$new(http_response = resp))
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
#' Get user by user name
|
#' Get user by user name
|
||||||
@ -834,14 +834,14 @@ UserApi <- R6::R6Class(
|
|||||||
#' @export
|
#' @export
|
||||||
GetUserByName = function(username, data_file = NULL, ...) {
|
GetUserByName = function(username, data_file = NULL, ...) {
|
||||||
api_response <- self$GetUserByNameWithHttpInfo(username, data_file = data_file, ...)
|
api_response <- self$GetUserByNameWithHttpInfo(username, data_file = data_file, ...)
|
||||||
resp <- api_response$response
|
local_var_response <- api_response$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(local_var_response) >= 200 && httr::status_code(local_var_response) <= 299) {
|
||||||
api_response$content
|
api_response$content
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(local_var_response) >= 300 && httr::status_code(local_var_response) <= 399) {
|
||||||
api_response
|
api_response
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(local_var_response) >= 400 && httr::status_code(local_var_response) <= 499) {
|
||||||
api_response
|
api_response
|
||||||
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
} else if (httr::status_code(local_var_response) >= 500 && httr::status_code(local_var_response) <= 599) {
|
||||||
api_response
|
api_response
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -867,67 +867,67 @@ UserApi <- R6::R6Class(
|
|||||||
reason = "Missing required parameter `username`."))
|
reason = "Missing required parameter `username`."))
|
||||||
}
|
}
|
||||||
|
|
||||||
body <- NULL
|
local_var_body <- NULL
|
||||||
url_path <- "/user/{username}"
|
local_var_url_path <- "/user/{username}"
|
||||||
if (!missing(`username`)) {
|
if (!missing(`username`)) {
|
||||||
url_path <- gsub(paste0("\\{", "username", "\\}"), URLencode(as.character(`username`), reserved = TRUE), url_path)
|
local_var_url_path <- gsub(paste0("\\{", "username", "\\}"), URLencode(as.character(`username`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# The Accept request HTTP header
|
# The Accept request HTTP header
|
||||||
accepts = list("application/xml", "application/json")
|
local_var_accepts = list("application/xml", "application/json")
|
||||||
|
|
||||||
# The Content-Type representation header
|
# The Content-Type representation header
|
||||||
content_types = list()
|
local_var_content_types = list()
|
||||||
|
|
||||||
resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, url_path),
|
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||||
method = "GET",
|
method = "GET",
|
||||||
query_params = query_params,
|
query_params = query_params,
|
||||||
header_params = header_params,
|
header_params = header_params,
|
||||||
accepts = accepts,
|
accepts = local_var_accepts,
|
||||||
content_types = content_types,
|
content_types = local_var_content_types,
|
||||||
body = body,
|
body = local_var_body,
|
||||||
...)
|
...)
|
||||||
|
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(local_var_resp) >= 200 && httr::status_code(local_var_resp) <= 299) {
|
||||||
# save response in a file
|
# save response in a file
|
||||||
if (!is.null(data_file)) {
|
if (!is.null(data_file)) {
|
||||||
write(httr::content(resp, "text", encoding = "UTF-8", simplifyVector = FALSE), data_file)
|
write(httr::content(local_var_resp, "text", encoding = "UTF-8", simplifyVector = FALSE), data_file)
|
||||||
}
|
}
|
||||||
|
|
||||||
deserialized_resp_obj <- tryCatch(
|
deserialized_resp_obj <- tryCatch(
|
||||||
self$api_client$deserialize(resp, "User", loadNamespace("petstore")),
|
self$api_client$deserialize(local_var_resp, "User", loadNamespace("petstore")),
|
||||||
error = function(e) {
|
error = function(e) {
|
||||||
rlang::abort(message = "Failed to deserialize response",
|
rlang::abort(message = "Failed to deserialize response",
|
||||||
.subclass = "ApiException",
|
.subclass = "ApiException",
|
||||||
ApiException = ApiException$new(http_response = resp))
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
ApiResponse$new(deserialized_resp_obj, resp)
|
ApiResponse$new(deserialized_resp_obj, local_var_resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(local_var_resp) >= 300 && httr::status_code(local_var_resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
if (error_msg == "") {
|
if (local_var_error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
local_var_error_msg <- paste("Server returned ", httr::status_code(local_var_resp), " response status code.")
|
||||||
|
}
|
||||||
|
rlang::abort(message = local_var_error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
} else if (httr::status_code(local_var_resp) >= 400 && httr::status_code(local_var_resp) <= 499) {
|
||||||
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- "Api client exception encountered."
|
||||||
|
}
|
||||||
|
rlang::abort(message = local_var_error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
} else if (httr::status_code(local_var_resp) >= 500 && httr::status_code(local_var_resp) <= 599) {
|
||||||
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg,
|
rlang::abort(message = error_msg,
|
||||||
.subclass = "ApiException",
|
.subclass = "ApiException",
|
||||||
ApiException = ApiException$new(http_response = resp))
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
|
||||||
error_msg <- toString(content(resp))
|
|
||||||
if (error_msg == "") {
|
|
||||||
error_msg <- "Api client exception encountered."
|
|
||||||
}
|
|
||||||
rlang::abort(message = error_msg,
|
|
||||||
.subclass = "ApiException",
|
|
||||||
ApiException = ApiException$new(http_response = resp))
|
|
||||||
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
|
||||||
error_msg <- toString(content(resp))
|
|
||||||
if (error_msg == "") {
|
|
||||||
error_msg <- "Api server exception encountered."
|
|
||||||
}
|
|
||||||
rlang::abort(message = error_msg,
|
|
||||||
.subclass = "ApiException",
|
|
||||||
ApiException = ApiException$new(http_response = resp))
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
#' Logs user into the system
|
#' Logs user into the system
|
||||||
@ -943,14 +943,14 @@ UserApi <- R6::R6Class(
|
|||||||
#' @export
|
#' @export
|
||||||
LoginUser = function(username, password, data_file = NULL, ...) {
|
LoginUser = function(username, password, data_file = NULL, ...) {
|
||||||
api_response <- self$LoginUserWithHttpInfo(username, password, data_file = data_file, ...)
|
api_response <- self$LoginUserWithHttpInfo(username, password, data_file = data_file, ...)
|
||||||
resp <- api_response$response
|
local_var_response <- api_response$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(local_var_response) >= 200 && httr::status_code(local_var_response) <= 299) {
|
||||||
api_response$content
|
api_response$content
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(local_var_response) >= 300 && httr::status_code(local_var_response) <= 399) {
|
||||||
api_response
|
api_response
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(local_var_response) >= 400 && httr::status_code(local_var_response) <= 499) {
|
||||||
api_response
|
api_response
|
||||||
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
} else if (httr::status_code(local_var_response) >= 500 && httr::status_code(local_var_response) <= 599) {
|
||||||
api_response
|
api_response
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -984,63 +984,63 @@ UserApi <- R6::R6Class(
|
|||||||
reason = "Missing required parameter `password`."))
|
reason = "Missing required parameter `password`."))
|
||||||
}
|
}
|
||||||
|
|
||||||
body <- NULL
|
local_var_body <- NULL
|
||||||
url_path <- "/user/login"
|
local_var_url_path <- "/user/login"
|
||||||
|
|
||||||
# The Accept request HTTP header
|
# The Accept request HTTP header
|
||||||
accepts = list("application/xml", "application/json")
|
local_var_accepts = list("application/xml", "application/json")
|
||||||
|
|
||||||
# The Content-Type representation header
|
# The Content-Type representation header
|
||||||
content_types = list()
|
local_var_content_types = list()
|
||||||
|
|
||||||
resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, url_path),
|
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||||
method = "GET",
|
method = "GET",
|
||||||
query_params = query_params,
|
query_params = query_params,
|
||||||
header_params = header_params,
|
header_params = header_params,
|
||||||
accepts = accepts,
|
accepts = local_var_accepts,
|
||||||
content_types = content_types,
|
content_types = local_var_content_types,
|
||||||
body = body,
|
body = local_var_body,
|
||||||
...)
|
...)
|
||||||
|
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(local_var_resp) >= 200 && httr::status_code(local_var_resp) <= 299) {
|
||||||
# save response in a file
|
# save response in a file
|
||||||
if (!is.null(data_file)) {
|
if (!is.null(data_file)) {
|
||||||
write(httr::content(resp, "text", encoding = "UTF-8", simplifyVector = FALSE), data_file)
|
write(httr::content(local_var_resp, "text", encoding = "UTF-8", simplifyVector = FALSE), data_file)
|
||||||
}
|
}
|
||||||
|
|
||||||
deserialized_resp_obj <- tryCatch(
|
deserialized_resp_obj <- tryCatch(
|
||||||
self$api_client$deserialize(resp, "character", loadNamespace("petstore")),
|
self$api_client$deserialize(local_var_resp, "character", loadNamespace("petstore")),
|
||||||
error = function(e) {
|
error = function(e) {
|
||||||
rlang::abort(message = "Failed to deserialize response",
|
rlang::abort(message = "Failed to deserialize response",
|
||||||
.subclass = "ApiException",
|
.subclass = "ApiException",
|
||||||
ApiException = ApiException$new(http_response = resp))
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
ApiResponse$new(deserialized_resp_obj, resp)
|
ApiResponse$new(deserialized_resp_obj, local_var_resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(local_var_resp) >= 300 && httr::status_code(local_var_resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
if (error_msg == "") {
|
if (local_var_error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
local_var_error_msg <- paste("Server returned ", httr::status_code(local_var_resp), " response status code.")
|
||||||
|
}
|
||||||
|
rlang::abort(message = local_var_error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
} else if (httr::status_code(local_var_resp) >= 400 && httr::status_code(local_var_resp) <= 499) {
|
||||||
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- "Api client exception encountered."
|
||||||
|
}
|
||||||
|
rlang::abort(message = local_var_error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
} else if (httr::status_code(local_var_resp) >= 500 && httr::status_code(local_var_resp) <= 599) {
|
||||||
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg,
|
rlang::abort(message = error_msg,
|
||||||
.subclass = "ApiException",
|
.subclass = "ApiException",
|
||||||
ApiException = ApiException$new(http_response = resp))
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
|
||||||
error_msg <- toString(content(resp))
|
|
||||||
if (error_msg == "") {
|
|
||||||
error_msg <- "Api client exception encountered."
|
|
||||||
}
|
|
||||||
rlang::abort(message = error_msg,
|
|
||||||
.subclass = "ApiException",
|
|
||||||
ApiException = ApiException$new(http_response = resp))
|
|
||||||
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
|
||||||
error_msg <- toString(content(resp))
|
|
||||||
if (error_msg == "") {
|
|
||||||
error_msg <- "Api server exception encountered."
|
|
||||||
}
|
|
||||||
rlang::abort(message = error_msg,
|
|
||||||
.subclass = "ApiException",
|
|
||||||
ApiException = ApiException$new(http_response = resp))
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
#' Logs out current logged in user session
|
#' Logs out current logged in user session
|
||||||
@ -1053,14 +1053,14 @@ UserApi <- R6::R6Class(
|
|||||||
#' @export
|
#' @export
|
||||||
LogoutUser = function(...) {
|
LogoutUser = function(...) {
|
||||||
api_response <- self$LogoutUserWithHttpInfo(...)
|
api_response <- self$LogoutUserWithHttpInfo(...)
|
||||||
resp <- api_response$response
|
local_var_response <- api_response$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(local_var_response) >= 200 && httr::status_code(local_var_response) <= 299) {
|
||||||
api_response$content
|
api_response$content
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(local_var_response) >= 300 && httr::status_code(local_var_response) <= 399) {
|
||||||
api_response
|
api_response
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(local_var_response) >= 400 && httr::status_code(local_var_response) <= 499) {
|
||||||
api_response
|
api_response
|
||||||
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
} else if (httr::status_code(local_var_response) >= 500 && httr::status_code(local_var_response) <= 599) {
|
||||||
api_response
|
api_response
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1077,54 +1077,54 @@ UserApi <- R6::R6Class(
|
|||||||
query_params <- list()
|
query_params <- list()
|
||||||
header_params <- c()
|
header_params <- c()
|
||||||
|
|
||||||
body <- NULL
|
local_var_body <- NULL
|
||||||
url_path <- "/user/logout"
|
local_var_url_path <- "/user/logout"
|
||||||
# API key authentication
|
# API key authentication
|
||||||
if ("api_key" %in% names(self$api_client$api_keys) && nchar(self$api_client$api_keys["api_key"]) > 0) {
|
if ("api_key" %in% names(self$api_client$api_keys) && nchar(self$api_client$api_keys["api_key"]) > 0) {
|
||||||
header_params["api_key"] <- paste(unlist(self$api_client$api_keys["api_key"]), collapse = "")
|
header_params["api_key"] <- paste(unlist(self$api_client$api_keys["api_key"]), collapse = "")
|
||||||
}
|
}
|
||||||
|
|
||||||
# The Accept request HTTP header
|
# The Accept request HTTP header
|
||||||
accepts = list()
|
local_var_accepts = list()
|
||||||
|
|
||||||
# The Content-Type representation header
|
# The Content-Type representation header
|
||||||
content_types = list()
|
local_var_content_types = list()
|
||||||
|
|
||||||
resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, url_path),
|
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||||
method = "GET",
|
method = "GET",
|
||||||
query_params = query_params,
|
query_params = query_params,
|
||||||
header_params = header_params,
|
header_params = header_params,
|
||||||
accepts = accepts,
|
accepts = local_var_accepts,
|
||||||
content_types = content_types,
|
content_types = local_var_content_types,
|
||||||
body = body,
|
body = local_var_body,
|
||||||
...)
|
...)
|
||||||
|
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(local_var_resp) >= 200 && httr::status_code(local_var_resp) <= 299) {
|
||||||
ApiResponse$new(NULL, resp)
|
ApiResponse$new(NULL, local_var_resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(local_var_resp) >= 300 && httr::status_code(local_var_resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
if (error_msg == "") {
|
if (local_var_error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
local_var_error_msg <- paste("Server returned ", httr::status_code(local_var_resp), " response status code.")
|
||||||
|
}
|
||||||
|
rlang::abort(message = local_var_error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
} else if (httr::status_code(local_var_resp) >= 400 && httr::status_code(local_var_resp) <= 499) {
|
||||||
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- "Api client exception encountered."
|
||||||
|
}
|
||||||
|
rlang::abort(message = local_var_error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
} else if (httr::status_code(local_var_resp) >= 500 && httr::status_code(local_var_resp) <= 599) {
|
||||||
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg,
|
rlang::abort(message = error_msg,
|
||||||
.subclass = "ApiException",
|
.subclass = "ApiException",
|
||||||
ApiException = ApiException$new(http_response = resp))
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
|
||||||
error_msg <- toString(content(resp))
|
|
||||||
if (error_msg == "") {
|
|
||||||
error_msg <- "Api client exception encountered."
|
|
||||||
}
|
|
||||||
rlang::abort(message = error_msg,
|
|
||||||
.subclass = "ApiException",
|
|
||||||
ApiException = ApiException$new(http_response = resp))
|
|
||||||
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
|
||||||
error_msg <- toString(content(resp))
|
|
||||||
if (error_msg == "") {
|
|
||||||
error_msg <- "Api server exception encountered."
|
|
||||||
}
|
|
||||||
rlang::abort(message = error_msg,
|
|
||||||
.subclass = "ApiException",
|
|
||||||
ApiException = ApiException$new(http_response = resp))
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
#' Updated user
|
#' Updated user
|
||||||
@ -1139,14 +1139,14 @@ UserApi <- R6::R6Class(
|
|||||||
#' @export
|
#' @export
|
||||||
UpdateUser = function(username, user, ...) {
|
UpdateUser = function(username, user, ...) {
|
||||||
api_response <- self$UpdateUserWithHttpInfo(username, user, ...)
|
api_response <- self$UpdateUserWithHttpInfo(username, user, ...)
|
||||||
resp <- api_response$response
|
local_var_response <- api_response$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(local_var_response) >= 200 && httr::status_code(local_var_response) <= 299) {
|
||||||
api_response$content
|
api_response$content
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(local_var_response) >= 300 && httr::status_code(local_var_response) <= 399) {
|
||||||
api_response
|
api_response
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(local_var_response) >= 400 && httr::status_code(local_var_response) <= 499) {
|
||||||
api_response
|
api_response
|
||||||
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
} else if (httr::status_code(local_var_response) >= 500 && httr::status_code(local_var_response) <= 599) {
|
||||||
api_response
|
api_response
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1180,14 +1180,14 @@ UserApi <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!missing(`user`)) {
|
if (!missing(`user`)) {
|
||||||
body <- `user`$toJSONString()
|
local_var_body <- `user`$toJSONString()
|
||||||
} else {
|
} else {
|
||||||
body <- NULL
|
body <- NULL
|
||||||
}
|
}
|
||||||
|
|
||||||
url_path <- "/user/{username}"
|
local_var_url_path <- "/user/{username}"
|
||||||
if (!missing(`username`)) {
|
if (!missing(`username`)) {
|
||||||
url_path <- gsub(paste0("\\{", "username", "\\}"), URLencode(as.character(`username`), reserved = TRUE), url_path)
|
local_var_url_path <- gsub(paste0("\\{", "username", "\\}"), URLencode(as.character(`username`), reserved = TRUE), local_var_url_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
# API key authentication
|
# API key authentication
|
||||||
@ -1196,46 +1196,46 @@ UserApi <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
|
|
||||||
# The Accept request HTTP header
|
# The Accept request HTTP header
|
||||||
accepts = list()
|
local_var_accepts = list()
|
||||||
|
|
||||||
# The Content-Type representation header
|
# The Content-Type representation header
|
||||||
content_types = list("application/json")
|
local_var_content_types = list("application/json")
|
||||||
|
|
||||||
resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, url_path),
|
local_var_resp <- self$api_client$CallApi(url = paste0(self$api_client$base_path, local_var_url_path),
|
||||||
method = "PUT",
|
method = "PUT",
|
||||||
query_params = query_params,
|
query_params = query_params,
|
||||||
header_params = header_params,
|
header_params = header_params,
|
||||||
accepts = accepts,
|
accepts = local_var_accepts,
|
||||||
content_types = content_types,
|
content_types = local_var_content_types,
|
||||||
body = body,
|
body = local_var_body,
|
||||||
...)
|
...)
|
||||||
|
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(local_var_resp) >= 200 && httr::status_code(local_var_resp) <= 299) {
|
||||||
ApiResponse$new(NULL, resp)
|
ApiResponse$new(NULL, local_var_resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(local_var_resp) >= 300 && httr::status_code(local_var_resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
if (error_msg == "") {
|
if (local_var_error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
local_var_error_msg <- paste("Server returned ", httr::status_code(local_var_resp), " response status code.")
|
||||||
|
}
|
||||||
|
rlang::abort(message = local_var_error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
} else if (httr::status_code(local_var_resp) >= 400 && httr::status_code(local_var_resp) <= 499) {
|
||||||
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- "Api client exception encountered."
|
||||||
|
}
|
||||||
|
rlang::abort(message = local_var_error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
|
} else if (httr::status_code(local_var_resp) >= 500 && httr::status_code(local_var_resp) <= 599) {
|
||||||
|
local_var_error_msg <- toString(content(local_var_resp))
|
||||||
|
if (local_var_error_msg == "") {
|
||||||
|
local_var_error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg,
|
rlang::abort(message = error_msg,
|
||||||
.subclass = "ApiException",
|
.subclass = "ApiException",
|
||||||
ApiException = ApiException$new(http_response = resp))
|
ApiException = ApiException$new(http_response = local_var_resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
|
||||||
error_msg <- toString(content(resp))
|
|
||||||
if (error_msg == "") {
|
|
||||||
error_msg <- "Api client exception encountered."
|
|
||||||
}
|
|
||||||
rlang::abort(message = error_msg,
|
|
||||||
.subclass = "ApiException",
|
|
||||||
ApiException = ApiException$new(http_response = resp))
|
|
||||||
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
|
||||||
error_msg <- toString(content(resp))
|
|
||||||
if (error_msg == "") {
|
|
||||||
error_msg <- "Api server exception encountered."
|
|
||||||
}
|
|
||||||
rlang::abort(message = error_msg,
|
|
||||||
.subclass = "ApiException",
|
|
||||||
ApiException = ApiException$new(http_response = resp))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user