mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-06-29 04:00:51 +00:00
[R] fix a couple warnings reported by lintr (#12903)
* better code format in r client * update code based on lintr * update samples
This commit is contained in:
parent
da28e12017
commit
eb471db7c9
@ -625,7 +625,7 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
if (example == null) {
|
if (example == null) {
|
||||||
example = p.paramName + "_example";
|
example = p.paramName + "_example";
|
||||||
}
|
}
|
||||||
example = "'" + escapeText(example) + "'";
|
example = "\"" + escapeText(example) + "\"";
|
||||||
} else if ("integer".equals(type)) {
|
} else if ("integer".equals(type)) {
|
||||||
if (example == null) {
|
if (example == null) {
|
||||||
example = "56";
|
example = "56";
|
||||||
@ -715,7 +715,7 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
if (Pattern.compile("\r\n|\r|\n").matcher((String) p.getDefault()).find())
|
if (Pattern.compile("\r\n|\r|\n").matcher((String) p.getDefault()).find())
|
||||||
return "'''" + p.getDefault() + "'''";
|
return "'''" + p.getDefault() + "'''";
|
||||||
else
|
else
|
||||||
return "'" + ((String) p.getDefault()).replaceAll("'", "\'") + "'";
|
return "\"" + ((String) p.getDefault()).replaceAll("\"", "\\\"") + "\"";
|
||||||
}
|
}
|
||||||
} else if (ModelUtils.isArraySchema(p)) {
|
} else if (ModelUtils.isArraySchema(p)) {
|
||||||
if (p.getDefault() != null) {
|
if (p.getDefault() != null) {
|
||||||
|
@ -11,7 +11,9 @@
|
|||||||
#' \describe{
|
#' \describe{
|
||||||
{{#operation}}
|
{{#operation}}
|
||||||
#' \strong{ {{operationId}} } \emph{ {{summary}} }
|
#' \strong{ {{operationId}} } \emph{ {{summary}} }
|
||||||
|
{{#notes}}
|
||||||
#' {{notes}}
|
#' {{notes}}
|
||||||
|
{{/notes}}
|
||||||
#'
|
#'
|
||||||
#' \itemize{
|
#' \itemize{
|
||||||
{{#allParams}}
|
{{#allParams}}
|
||||||
@ -160,8 +162,7 @@
|
|||||||
initialize = function(api_client) {
|
initialize = function(api_client) {
|
||||||
if (!missing(api_client)) {
|
if (!missing(api_client)) {
|
||||||
self$api_client <- api_client
|
self$api_client <- api_client
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
self$api_client <- ApiClient$new()
|
self$api_client <- ApiClient$new()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -175,7 +176,7 @@
|
|||||||
#' @param {{{paramName}}} {{{description}}}
|
#' @param {{{paramName}}} {{{description}}}
|
||||||
{{/requiredParams}}
|
{{/requiredParams}}
|
||||||
{{#optionalParams}}
|
{{#optionalParams}}
|
||||||
#' @param {{{paramName}}} (optional) {{{description}}}{{#defaultValue}} (default value: {{{.}}}){{/defaultValue}}
|
#' @param {{{paramName}}} (optional){{{description}}} {{#defaultValue}} (default value: {{{.}}}){{/defaultValue}}
|
||||||
{{/optionalParams}}
|
{{/optionalParams}}
|
||||||
{{#vendorExtensions.x-streaming}}
|
{{#vendorExtensions.x-streaming}}
|
||||||
#' @param stream_callback (optional) callback function to process the data stream
|
#' @param stream_callback (optional) callback function to process the data stream
|
||||||
@ -186,7 +187,7 @@
|
|||||||
#' @param ... Other optional arguments
|
#' @param ... Other optional arguments
|
||||||
#' @return {{{returnType}}}{{^returnType}}void{{/returnType}}
|
#' @return {{{returnType}}}{{^returnType}}void{{/returnType}}
|
||||||
#' @export
|
#' @export
|
||||||
{{{operationId}}} = function({{#requiredParams}}{{paramName}}, {{/requiredParams}}{{#optionalParams}}{{paramName}}={{^defaultValue}}NULL{{/defaultValue}}{{{defaultValue}}}, {{/optionalParams}}{{#vendorExtensions.x-streaming}}stream_callback=NULL, {{/vendorExtensions.x-streaming}}{{#returnType}}data_file=NULL, {{/returnType}}...) {
|
{{{operationId}}} = function({{#requiredParams}}{{paramName}}, {{/requiredParams}}{{#optionalParams}}{{paramName}}={{^defaultValue}}NULL{{/defaultValue}}{{{defaultValue}}}, {{/optionalParams}}{{#vendorExtensions.x-streaming}}stream_callback=NULL, {{/vendorExtensions.x-streaming}}{{#returnType}}data_file = NULL, {{/returnType}}...) {
|
||||||
api_response <- self${{{operationId}}}WithHttpInfo({{#allParams}}{{paramName}}, {{/allParams}}{{#vendorExtensions.x-streaming}}stream_callback = stream_callback, {{/vendorExtensions.x-streaming}}{{#returnType}}data_file = data_file, {{/returnType}}...)
|
api_response <- self${{{operationId}}}WithHttpInfo({{#allParams}}{{paramName}}, {{/allParams}}{{#vendorExtensions.x-streaming}}stream_callback = stream_callback, {{/vendorExtensions.x-streaming}}{{#returnType}}data_file = data_file, {{/returnType}}...)
|
||||||
{{#vendorExtensions.x-streaming}}
|
{{#vendorExtensions.x-streaming}}
|
||||||
if (typeof(stream_callback) == "closure") { # return void if streaming is enabled
|
if (typeof(stream_callback) == "closure") { # return void if streaming is enabled
|
||||||
@ -236,7 +237,10 @@
|
|||||||
stop("Missing required parameter `{{{paramName}}}`.")
|
stop("Missing required parameter `{{{paramName}}}`.")
|
||||||
{{/useDefaultExceptionHandling}}
|
{{/useDefaultExceptionHandling}}
|
||||||
{{#useRlangExceptionHandling}}
|
{{#useRlangExceptionHandling}}
|
||||||
rlang::abort(message = "Missing required parameter `{{{paramName}}}`.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, reason = "Missing required parameter `{{{paramName}}}`."))
|
rlang::abort(message = "Missing required parameter `{{{paramName}}}`.",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(status = 0,
|
||||||
|
reason = "Missing required parameter `{{{paramName}}}`."))
|
||||||
{{/useRlangExceptionHandling}}
|
{{/useRlangExceptionHandling}}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -360,7 +364,9 @@
|
|||||||
stop("Failed to deserialize response")
|
stop("Failed to deserialize response")
|
||||||
{{/useDefaultExceptionHandling}}
|
{{/useDefaultExceptionHandling}}
|
||||||
{{#useRlangExceptionHandling}}
|
{{#useRlangExceptionHandling}}
|
||||||
rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = "Failed to deserialize response",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
{{/useRlangExceptionHandling}}
|
{{/useRlangExceptionHandling}}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -374,14 +380,16 @@
|
|||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
||||||
{{#returnExceptionOnFailure}}
|
{{#returnExceptionOnFailure}}
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if (error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
||||||
}
|
}
|
||||||
{{#useDefaultExceptionHandling}}
|
{{#useDefaultExceptionHandling}}
|
||||||
stop(error_msg)
|
stop(error_msg)
|
||||||
{{/useDefaultExceptionHandling}}
|
{{/useDefaultExceptionHandling}}
|
||||||
{{#useRlangExceptionHandling}}
|
{{#useRlangExceptionHandling}}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
{{/useRlangExceptionHandling}}
|
{{/useRlangExceptionHandling}}
|
||||||
{{/returnExceptionOnFailure}}
|
{{/returnExceptionOnFailure}}
|
||||||
{{^returnExceptionOnFailure}}
|
{{^returnExceptionOnFailure}}
|
||||||
@ -397,7 +405,9 @@
|
|||||||
stop(error_msg)
|
stop(error_msg)
|
||||||
{{/useDefaultExceptionHandling}}
|
{{/useDefaultExceptionHandling}}
|
||||||
{{#useRlangExceptionHandling}}
|
{{#useRlangExceptionHandling}}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
{{/useRlangExceptionHandling}}
|
{{/useRlangExceptionHandling}}
|
||||||
{{/returnExceptionOnFailure}}
|
{{/returnExceptionOnFailure}}
|
||||||
{{^returnExceptionOnFailure}}
|
{{^returnExceptionOnFailure}}
|
||||||
@ -413,7 +423,9 @@
|
|||||||
stop(error_msg)
|
stop(error_msg)
|
||||||
{{/useDefaultExceptionHandling}}
|
{{/useDefaultExceptionHandling}}
|
||||||
{{#useRlangExceptionHandling}}
|
{{#useRlangExceptionHandling}}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
{{/useRlangExceptionHandling}}
|
{{/useRlangExceptionHandling}}
|
||||||
{{/returnExceptionOnFailure}}
|
{{/returnExceptionOnFailure}}
|
||||||
{{^returnExceptionOnFailure}}
|
{{^returnExceptionOnFailure}}
|
||||||
|
@ -69,10 +69,11 @@ ApiClient <- R6::R6Class(
|
|||||||
#' @param retry_status_codes Status codes for retry.
|
#' @param retry_status_codes Status codes for retry.
|
||||||
#' @param max_retry_attempts Maxmium number of retry.
|
#' @param max_retry_attempts Maxmium number of retry.
|
||||||
#' @export
|
#' @export
|
||||||
initialize = function(base_path=NULL, user_agent=NULL, default_headers=NULL,
|
initialize = function(base_path = NULL, user_agent = NULL,
|
||||||
username=NULL, password=NULL, api_keys=NULL,
|
default_headers = NULL,
|
||||||
access_token=NULL, timeout=NULL,
|
username = NULL, password = NULL, api_keys = NULL,
|
||||||
retry_status_codes=NULL, max_retry_attempts=NULL) {
|
access_token = NULL, timeout = NULL,
|
||||||
|
retry_status_codes = NULL, max_retry_attempts = NULL) {
|
||||||
if (!is.null(base_path)) {
|
if (!is.null(base_path)) {
|
||||||
self$base_path <- base_path
|
self$base_path <- base_path
|
||||||
}
|
}
|
||||||
@ -146,7 +147,7 @@ ApiClient <- R6::R6Class(
|
|||||||
resp <- self$Execute(url, method, query_params, header_params, body, stream_callback = stream_callback, ...)
|
resp <- self$Execute(url, method, query_params, header_params, body, stream_callback = stream_callback, ...)
|
||||||
status_code <- httr::status_code(resp)
|
status_code <- httr::status_code(resp)
|
||||||
} else {
|
} else {
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -178,39 +179,57 @@ ApiClient <- R6::R6Class(
|
|||||||
|
|
||||||
if (method == "GET") {
|
if (method == "GET") {
|
||||||
if (typeof(stream_callback) == "closure") {
|
if (typeof(stream_callback) == "closure") {
|
||||||
httr::GET(url, query = query_params, headers, http_timeout, httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...)
|
httr::GET(url, query = query_params, headers, http_timeout,
|
||||||
|
httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...)
|
||||||
} else {
|
} else {
|
||||||
httr::GET(url, query = query_params, headers, http_timeout, httr::user_agent(self$`user_agent`), ...)
|
httr::GET(url, query = query_params, headers, http_timeout,
|
||||||
|
httr::user_agent(self$`user_agent`), ...)
|
||||||
}
|
}
|
||||||
} else if (method == "POST") {
|
} else if (method == "POST") {
|
||||||
if (typeof(stream_callback) == "closure") {
|
if (typeof(stream_callback) == "closure") {
|
||||||
httr::POST(url, query = query_params, headers, body = body, httr::content_type("application/json"), http_timeout, httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...)
|
httr::POST(url, query = query_params, headers, body = body,
|
||||||
|
httr::content_type("application/json"), http_timeout,
|
||||||
|
httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...)
|
||||||
} else {
|
} else {
|
||||||
httr::POST(url, query = query_params, headers, body = body, httr::content_type("application/json"), http_timeout, httr::user_agent(self$`user_agent`), ...)
|
httr::POST(url, query = query_params, headers, body = body,
|
||||||
|
httr::content_type("application/json"), http_timeout,
|
||||||
|
httr::user_agent(self$`user_agent`), ...)
|
||||||
}
|
}
|
||||||
} else if (method == "PUT") {
|
} else if (method == "PUT") {
|
||||||
if (typeof(stream_callback) == "closure") {
|
if (typeof(stream_callback) == "closure") {
|
||||||
httr::PUT(url, query = query_params, headers, body = body, httr::content_type("application/json"), http_timeout, http_timeout, httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...)
|
httr::PUT(url, query = query_params, headers, body = body,
|
||||||
|
httr::content_type("application/json"), http_timeout,
|
||||||
|
http_timeout, httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...)
|
||||||
} else {
|
} else {
|
||||||
httr::PUT(url, query = query_params, headers, body = body, httr::content_type("application/json"), http_timeout, http_timeout, httr::user_agent(self$`user_agent`), ...)
|
httr::PUT(url, query = query_params, headers, body = body,
|
||||||
|
httr::content_type("application/json"), http_timeout,
|
||||||
|
http_timeout, httr::user_agent(self$`user_agent`), ...)
|
||||||
}
|
}
|
||||||
} else if (method == "PATCH") {
|
} else if (method == "PATCH") {
|
||||||
if (typeof(stream_callback) == "closure") {
|
if (typeof(stream_callback) == "closure") {
|
||||||
httr::PATCH(url, query = query_params, headers, body = body, httr::content_type("application/json"), http_timeout, http_timeout, httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...)
|
httr::PATCH(url, query = query_params, headers, body = body,
|
||||||
|
httr::content_type("application/json"), http_timeout,
|
||||||
|
http_timeout, httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...)
|
||||||
} else {
|
} else {
|
||||||
httr::PATCH(url, query = query_params, headers, body = body, httr::content_type("application/json"), http_timeout, http_timeout, httr::user_agent(self$`user_agent`), ...)
|
httr::PATCH(url, query = query_params, headers, body = body,
|
||||||
|
httr::content_type("application/json"), http_timeout,
|
||||||
|
http_timeout, httr::user_agent(self$`user_agent`), ...)
|
||||||
}
|
}
|
||||||
} else if (method == "HEAD") {
|
} else if (method == "HEAD") {
|
||||||
if (typeof(stream_callback) == "closure") {
|
if (typeof(stream_callback) == "closure") {
|
||||||
httr::HEAD(url, query = query_params, headers, http_timeout, http_timeout, httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...)
|
httr::HEAD(url, query = query_params, headers, http_timeout,
|
||||||
|
http_timeout, httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...)
|
||||||
} else {
|
} else {
|
||||||
httr::HEAD(url, query = query_params, headers, http_timeout, http_timeout, httr::user_agent(self$`user_agent`), ...)
|
httr::HEAD(url, query = query_params, headers, http_timeout,
|
||||||
|
http_timeout, httr::user_agent(self$`user_agent`), ...)
|
||||||
}
|
}
|
||||||
} else if (method == "DELETE") {
|
} else if (method == "DELETE") {
|
||||||
if (typeof(stream_callback) == "closure") {
|
if (typeof(stream_callback) == "closure") {
|
||||||
httr::DELETE(url, query = query_params, headers, http_timeout, http_timeout, httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...)
|
httr::DELETE(url, query = query_params, headers, http_timeout,
|
||||||
|
http_timeout, httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...)
|
||||||
} else {
|
} else {
|
||||||
httr::DELETE(url, query = query_params, headers, http_timeout, http_timeout, httr::user_agent(self$`user_agent`), ...)
|
httr::DELETE(url, query = query_params, headers, http_timeout,
|
||||||
|
http_timeout, httr::user_agent(self$`user_agent`), ...)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
err_msg <- "Http method must be `GET`, `HEAD`, `OPTIONS`, `POST`, `PATCH`, `PUT` or `DELETE`."
|
err_msg <- "Http method must be `GET`, `HEAD`, `OPTIONS`, `POST`, `PATCH`, `PUT` or `DELETE`."
|
||||||
@ -218,7 +237,9 @@ ApiClient <- R6::R6Class(
|
|||||||
stop(err_msg)
|
stop(err_msg)
|
||||||
{{/useDefaultExceptionHandling}}
|
{{/useDefaultExceptionHandling}}
|
||||||
{{#useRlangExceptionHandling}}
|
{{#useRlangExceptionHandling}}
|
||||||
rlang::abort(message = err_msg, .subclass = "ApiException", ApiException = ApiException$new(status = 0, reason = err_msg))
|
rlang::abort(message = err_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(status = 0, reason = err_msg))
|
||||||
{{/useRlangExceptionHandling}}
|
{{/useRlangExceptionHandling}}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -255,16 +276,16 @@ ApiClient <- R6::R6Class(
|
|||||||
|
|
||||||
# To handle the "map" type
|
# To handle the "map" type
|
||||||
if (startsWith(return_type, "map(")) {
|
if (startsWith(return_type, "map(")) {
|
||||||
inner_return_type <- regmatches(return_type, regexec(pattern = "map\\((.*)\\)", return_type))[[1]][2]
|
inner_return_type <- regmatches(return_type,
|
||||||
|
regexec(pattern = "map\\((.*)\\)", return_type))[[1]][2]
|
||||||
return_obj <- lapply(names(obj), function(name) {
|
return_obj <- lapply(names(obj), function(name) {
|
||||||
self$deserializeObj(obj[[name]], inner_return_type, pkg_env)
|
self$deserializeObj(obj[[name]], inner_return_type, pkg_env)
|
||||||
})
|
})
|
||||||
names(return_obj) <- names(obj)
|
names(return_obj) <- names(obj)
|
||||||
}
|
} else if (startsWith(return_type, "array[")) {
|
||||||
|
# To handle the "array" type
|
||||||
# To handle the "array" type
|
inner_return_type <- regmatches(return_type,
|
||||||
else if (startsWith(return_type, "array[")) {
|
regexec(pattern = "array\\[(.*)\\]", return_type))[[1]][2]
|
||||||
inner_return_type <- regmatches(return_type, regexec(pattern = "array\\[(.*)\\]", return_type))[[1]][2]
|
|
||||||
if (c(inner_return_type) %in% primitive_types) {
|
if (c(inner_return_type) %in% primitive_types) {
|
||||||
return_obj <- vector("list", length = length(obj))
|
return_obj <- vector("list", length = length(obj))
|
||||||
if (length(obj) > 0) {
|
if (length(obj) > 0) {
|
||||||
@ -277,24 +298,21 @@ ApiClient <- R6::R6Class(
|
|||||||
return_obj <- vector("list", length = nrow(obj))
|
return_obj <- vector("list", length = nrow(obj))
|
||||||
if (nrow(obj) > 0) {
|
if (nrow(obj) > 0) {
|
||||||
for (row in 1:nrow(obj)) {
|
for (row in 1:nrow(obj)) {
|
||||||
return_obj[[row]] <- self$deserializeObj(obj[row, , drop = FALSE], inner_return_type, pkg_env)
|
return_obj[[row]] <- self$deserializeObj(obj[row, , drop = FALSE],
|
||||||
|
inner_return_type, pkg_env)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (exists(return_type, pkg_env) && !(c(return_type) %in% primitive_types)) {
|
||||||
|
# To handle model objects which are not array or map containers. Ex:"Pet"
|
||||||
# To handle model objects which are not array or map containers. Ex:"Pet"
|
|
||||||
else if (exists(return_type, pkg_env) && !(c(return_type) %in% primitive_types)) {
|
|
||||||
return_type <- get(return_type, envir = as.environment(pkg_env))
|
return_type <- get(return_type, envir = as.environment(pkg_env))
|
||||||
return_obj <- return_type$new()
|
return_obj <- return_type$new()
|
||||||
return_obj$fromJSON(
|
return_obj$fromJSON(
|
||||||
jsonlite::toJSON(obj, digits = NA, auto_unbox = TRUE)
|
jsonlite::toJSON(obj, digits = NA, auto_unbox = TRUE)
|
||||||
)
|
)
|
||||||
}
|
} else {
|
||||||
|
# To handle primitive type
|
||||||
# To handle primitive type
|
|
||||||
else {
|
|
||||||
return_obj <- obj
|
return_obj <- obj
|
||||||
}
|
}
|
||||||
return_obj
|
return_obj
|
||||||
|
@ -35,7 +35,7 @@ ApiException <- R6::R6Class(
|
|||||||
if (!is.null(http_response)) {
|
if (!is.null(http_response)) {
|
||||||
self$status <- http_response$status_code
|
self$status <- http_response$status_code
|
||||||
errorMsg <- toString(content(http_response))
|
errorMsg <- toString(content(http_response))
|
||||||
if(errorMsg == ""){
|
if (errorMsg == "") {
|
||||||
errorMsg <- "Api exception encountered. No details given."
|
errorMsg <- "Api exception encountered. No details given."
|
||||||
}
|
}
|
||||||
self$body <- errorMsg
|
self$body <- errorMsg
|
||||||
@ -73,12 +73,12 @@ ApiException <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
if (!is.null(self$body)) {
|
if (!is.null(self$body)) {
|
||||||
errorMsg <- paste(errorMsg, "Body : ", "\n", sep = "")
|
errorMsg <- paste(errorMsg, "Body : ", "\n", sep = "")
|
||||||
errorMsg <- paste(errorMsg, self$body,"\n")
|
errorMsg <- paste(errorMsg, self$body, "\n")
|
||||||
}
|
}
|
||||||
{{#errorObjectType}}
|
{{#errorObjectType}}
|
||||||
if (!is.null(self$errorObject)) {
|
if (!is.null(self$errorObject)) {
|
||||||
errorMsg <- paste(errorMsg, "Error object : ", "\n", sep = "")
|
errorMsg <- paste(errorMsg, "Error object : ", "\n", sep = "")
|
||||||
errorMsg <- paste(errorMsg, self$errorObject$toJSONString(),"\n")
|
errorMsg <- paste(errorMsg, self$errorObject$toJSONString(), "\n")
|
||||||
}
|
}
|
||||||
{{/errorObjectType}}
|
{{/errorObjectType}}
|
||||||
errorMsg
|
errorMsg
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
linters: linters_with_defaults(
|
linters: linters_with_defaults(
|
||||||
line_length_linter(160),
|
line_length_linter(160),
|
||||||
object_name_linter = NULL
|
object_name_linter = NULL,
|
||||||
|
cyclocomp_linter = NULL
|
||||||
)
|
)
|
||||||
exclusions: list(
|
exclusions: list(
|
||||||
)
|
)
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#' @importFrom jsonlite fromJSON toJSON
|
#' @importFrom jsonlite fromJSON toJSON
|
||||||
#' @export
|
#' @export
|
||||||
{{classname}} <- R6::R6Class(
|
{{classname}} <- R6::R6Class(
|
||||||
'{{classname}}',
|
"{{classname}}",
|
||||||
public = list(
|
public = list(
|
||||||
#' @field actual_instance the object stored in this instance.
|
#' @field actual_instance the object stored in this instance.
|
||||||
actual_instance = NULL,
|
actual_instance = NULL,
|
||||||
@ -28,10 +28,11 @@
|
|||||||
if (is.null(instance)) {
|
if (is.null(instance)) {
|
||||||
# do nothing
|
# do nothing
|
||||||
} {{#anyOf}}else if (get(class(instance)[[1]], pos = -1)$classname == "{{{.}}}") {
|
} {{#anyOf}}else if (get(class(instance)[[1]], pos = -1)$classname == "{{{.}}}") {
|
||||||
self$actual_instance = instance
|
self$actual_instance <- instance
|
||||||
self$actual_type = "{{{.}}}"
|
self$actual_type <- "{{{.}}}"
|
||||||
} {{/anyOf}}else {
|
} {{/anyOf}}else {
|
||||||
stop(paste("Failed to initialize {{{classname}}} with anyOf schemas {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}}. Provided class name: ", get(class(instance)[[1]], pos = -1)$classname))
|
stop(paste("Failed to initialize {{{classname}}} with anyOf schemas {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}}. Provided class name: ",
|
||||||
|
get(class(instance)[[1]], pos = -1)$classname))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
#' Deserialize JSON string into an instance of {{{classname}}}.
|
#' Deserialize JSON string into an instance of {{{classname}}}.
|
||||||
@ -56,13 +57,14 @@
|
|||||||
error = function(err) err
|
error = function(err) err
|
||||||
)
|
)
|
||||||
|
|
||||||
if (!is.null({{{.}}}_result['error'])) {
|
if (!is.null({{{.}}}_result["error"])) {
|
||||||
error_messages <- append(error_messages, {{{.}}}_result['message'])
|
error_messages <- append(error_messages, {{{.}}}_result["message"])
|
||||||
}
|
}
|
||||||
|
|
||||||
{{/anyOf}}
|
{{/anyOf}}
|
||||||
# no match
|
# no match
|
||||||
stop(paste("No match found when deserializing the payload into {{{classname}}} with anyOf schemas {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}}. Details: ", paste(error_messages, collapse = ', ')))
|
stop(paste("No match found when deserializing the payload into {{{classname}}} with anyOf schemas {{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}}. Details: ",
|
||||||
|
paste(error_messages, collapse = ", ")))
|
||||||
},
|
},
|
||||||
#' Serialize {{{classname}}} to JSON string.
|
#' Serialize {{{classname}}} to JSON string.
|
||||||
#'
|
#'
|
||||||
@ -121,12 +123,12 @@
|
|||||||
#' @export
|
#' @export
|
||||||
toString = function() {
|
toString = function() {
|
||||||
jsoncontent <- c(
|
jsoncontent <- c(
|
||||||
sprintf('"actual_instance": %s', if (is.null(self$actual_instance)) {NULL} else {self$actual_instance$toJSONString()}),
|
sprintf('"actual_instance": %s', if (is.null(self$actual_instance)) NULL else self$actual_instance$toJSONString()),
|
||||||
sprintf('"actual_type": "%s"', self$actual_type),
|
sprintf('"actual_type": "%s"', self$actual_type),
|
||||||
sprintf('"any_of": "%s"', paste( unlist(self$any_of), collapse=', '))
|
sprintf('"any_of": "%s"', paste(unlist(self$any_of), collapse = ", "))
|
||||||
)
|
)
|
||||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||||
as.character(jsonlite::prettify(paste('{', jsoncontent, '}', sep = "")))
|
as.character(jsonlite::prettify(paste("{", jsoncontent, "}", sep = "")))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#' @description {{classname}} Class
|
#' @description {{classname}} Class
|
||||||
#' @format An \code{R6Class} generator object
|
#' @format An \code{R6Class} generator object
|
||||||
{{#vars}}
|
{{#vars}}
|
||||||
#' @field {{name}} {{title}} {{#isContainer}}{{#isArray}}list( {{/isArray}}{{#isMap}}named list( {{/isMap}}{{/isContainer}}{{^isPrimitiveType}}\link{{=<% %>=}}{<%/isPrimitiveType%><%={{ }}=%>{{#isContainer}}{{#items}}{{dataType}}{{/items}}{{/isContainer}}{{^isContainer}}{{dataType}}{{/isContainer}}{{=<% %>=}}<%^isPrimitiveType%>}<%={{ }}=%>{{/isPrimitiveType}}{{#isContainer}}{{#isArray}} ){{/isArray}}{{#isMap}} ){{/isMap}}{{/isContainer}} {{^required}}[optional]{{/required}}
|
#' @field {{name}} {{title}} {{#isContainer}}{{#isArray}}list( {{/isArray}}{{#isMap}}named list( {{/isMap}}{{/isContainer}}{{^isPrimitiveType}}\link{{=<% %>=}}{<%/isPrimitiveType%><%={{ }}=%>{{#isContainer}}{{#items}}{{dataType}}{{/items}}{{/isContainer}}{{^isContainer}}{{dataType}}{{/isContainer}}{{=<% %>=}}<%^isPrimitiveType%>}<%={{ }}=%>{{/isPrimitiveType}}{{#isContainer}}{{#isArray}} ){{/isArray}}{{#isMap}} ){{/isMap}}{{/isContainer}}{{^required}} [optional]{{/required}}
|
||||||
{{/vars}}
|
{{/vars}}
|
||||||
#' @importFrom R6 R6Class
|
#' @importFrom R6 R6Class
|
||||||
#' @importFrom jsonlite fromJSON toJSON
|
#' @importFrom jsonlite fromJSON toJSON
|
||||||
@ -15,7 +15,7 @@
|
|||||||
{{^isEnum}}
|
{{^isEnum}}
|
||||||
#' @export
|
#' @export
|
||||||
{{classname}} <- R6::R6Class(
|
{{classname}} <- R6::R6Class(
|
||||||
'{{classname}}',
|
"{{classname}}",
|
||||||
{{#parent}}
|
{{#parent}}
|
||||||
inherit = {{{.}}},
|
inherit = {{{.}}},
|
||||||
{{/parent}}
|
{{/parent}}
|
||||||
@ -37,7 +37,7 @@
|
|||||||
#' @param ... Other optional arguments.
|
#' @param ... Other optional arguments.
|
||||||
#' @export
|
#' @export
|
||||||
initialize = function(
|
initialize = function(
|
||||||
{{#requiredVars}}`{{name}}`, {{/requiredVars}}{{#optionalVars}}`{{name}}`={{{defaultValue}}}{{^defaultValue}}NULL{{/defaultValue}}, {{/optionalVars}}...
|
{{#requiredVars}}`{{name}}`, {{/requiredVars}}{{#optionalVars}}`{{name}}` = {{{defaultValue}}}{{^defaultValue}}NULL{{/defaultValue}}, {{/optionalVars}}...
|
||||||
) {
|
) {
|
||||||
{{#requiredVars}}
|
{{#requiredVars}}
|
||||||
if (!missing(`{{name}}`)) {
|
if (!missing(`{{name}}`)) {
|
||||||
@ -139,7 +139,7 @@
|
|||||||
{{classname}}Object <- list()
|
{{classname}}Object <- list()
|
||||||
{{#vars}}
|
{{#vars}}
|
||||||
if (!is.null(self$`{{name}}`)) {
|
if (!is.null(self$`{{name}}`)) {
|
||||||
{{classname}}Object[['{{baseName}}']] <-
|
{{classname}}Object[["{{baseName}}"]] <-
|
||||||
{{#isContainer}}
|
{{#isContainer}}
|
||||||
{{#isArray}}
|
{{#isArray}}
|
||||||
{{#isPrimitiveType}}
|
{{#isPrimitiveType}}
|
||||||
@ -211,62 +211,63 @@
|
|||||||
jsoncontent <- c(
|
jsoncontent <- c(
|
||||||
{{#vars}}
|
{{#vars}}
|
||||||
if (!is.null(self$`{{name}}`)) {
|
if (!is.null(self$`{{name}}`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"{{baseName}}":
|
'"{{baseName}}":
|
||||||
{{#isContainer}}
|
{{#isContainer}}
|
||||||
{{#isArray}}
|
{{#isArray}}
|
||||||
{{#isPrimitiveType}}
|
{{#isPrimitiveType}}
|
||||||
{{#isNumeric}}[%d]{{/isNumeric}}{{^isNumeric}}[%s]{{/isNumeric}}
|
{{#isNumeric}}[%d]{{/isNumeric}}{{^isNumeric}}[%s]{{/isNumeric}}
|
||||||
{{/isPrimitiveType}}
|
{{/isPrimitiveType}}
|
||||||
{{^isPrimitiveType}}[%s]
|
{{^isPrimitiveType}}[%s]
|
||||||
{{/isPrimitiveType}}
|
{{/isPrimitiveType}}
|
||||||
{{/isArray}}
|
{{/isArray}}
|
||||||
{{#isMap}}
|
{{#isMap}}
|
||||||
{{#isPrimitiveType}}
|
{{#isPrimitiveType}}
|
||||||
{{#isNumeric}}%d{{/isNumeric}}{{^isNumeric}}{{^isBoolean}}"{{/isBoolean}}%s{{^isBoolean}}"{{/isBoolean}}{{/isNumeric}}
|
{{#isNumeric}}%d{{/isNumeric}}{{^isNumeric}}{{^isBoolean}}"{{/isBoolean}}%s{{^isBoolean}}"{{/isBoolean}}{{/isNumeric}}
|
||||||
{{/isPrimitiveType}}
|
{{/isPrimitiveType}}
|
||||||
{{^isPrimitiveType}}%s
|
{{^isPrimitiveType}}%s
|
||||||
{{/isPrimitiveType}}
|
{{/isPrimitiveType}}
|
||||||
{{/isMap}}
|
{{/isMap}}
|
||||||
{{/isContainer}}
|
{{/isContainer}}
|
||||||
{{^isContainer}}
|
{{^isContainer}}
|
||||||
{{#isPrimitiveType}}
|
{{#isPrimitiveType}}
|
||||||
{{#isNumeric}}%d{{/isNumeric}}{{^isNumeric}}{{^isBoolean}}"{{/isBoolean}}%s{{^isBoolean}}"{{/isBoolean}}{{/isNumeric}}
|
{{#isNumeric}}%d{{/isNumeric}}{{^isNumeric}}{{^isBoolean}}"{{/isBoolean}}%s{{^isBoolean}}"{{/isBoolean}}{{/isNumeric}}
|
||||||
{{/isPrimitiveType}}
|
{{/isPrimitiveType}}
|
||||||
{{^isPrimitiveType}}%s
|
{{^isPrimitiveType}}%s
|
||||||
{{/isPrimitiveType}}
|
{{/isPrimitiveType}}
|
||||||
{{/isContainer}}',
|
{{/isContainer}}',
|
||||||
{{#isContainer}}
|
{{#isContainer}}
|
||||||
{{#isArray}}
|
{{#isArray}}
|
||||||
{{#isPrimitiveType}}
|
{{#isPrimitiveType}}
|
||||||
paste(unlist(lapply(self$`{{{name}}}`, function(x) paste0('"', x, '"'))), collapse=",")
|
paste(unlist(lapply(self$`{{{name}}}`, function(x) paste0('"', x, '"'))), collapse=",")
|
||||||
{{/isPrimitiveType}}
|
{{/isPrimitiveType}}
|
||||||
{{^isPrimitiveType}}
|
{{^isPrimitiveType}}
|
||||||
paste(sapply(self$`{{{name}}}`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
|
paste(sapply(self$`{{{name}}}`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
|
||||||
{{/isPrimitiveType}}
|
{{/isPrimitiveType}}
|
||||||
{{/isArray}}
|
{{/isArray}}
|
||||||
{{#isMap}}
|
{{#isMap}}
|
||||||
{{#isPrimitiveType}}
|
{{#isPrimitiveType}}
|
||||||
jsonlite::toJSON(lapply(self$`{{{name}}}`, function(x){ x }), auto_unbox = TRUE, digits=NA)
|
jsonlite::toJSON(lapply(self$`{{{name}}}`, function(x){ x }), auto_unbox = TRUE, digits=NA)
|
||||||
{{/isPrimitiveType}}
|
{{/isPrimitiveType}}
|
||||||
{{^isPrimitiveType}}
|
{{^isPrimitiveType}}
|
||||||
jsonlite::toJSON(lapply(self$`{{{name}}}`, function(x){ x$toJSON() }), auto_unbox = TRUE, digits=NA)
|
jsonlite::toJSON(lapply(self$`{{{name}}}`, function(x){ x$toJSON() }), auto_unbox = TRUE, digits=NA)
|
||||||
{{/isPrimitiveType}}
|
{{/isPrimitiveType}}
|
||||||
{{/isMap}}
|
{{/isMap}}
|
||||||
{{/isContainer}}
|
{{/isContainer}}
|
||||||
{{^isContainer}}
|
{{^isContainer}}
|
||||||
{{#isPrimitiveType}}
|
{{#isPrimitiveType}}
|
||||||
{{#isBoolean}}tolower({{/isBoolean}}self$`{{name}}`{{#isBoolean}}){{/isBoolean}}
|
{{#isBoolean}}tolower({{/isBoolean}}self$`{{name}}`{{#isBoolean}}){{/isBoolean}}
|
||||||
{{/isPrimitiveType}}
|
{{/isPrimitiveType}}
|
||||||
{{^isPrimitiveType}}
|
{{^isPrimitiveType}}
|
||||||
jsonlite::toJSON(self$`{{name}}`$toJSON(), auto_unbox=TRUE, digits = NA)
|
jsonlite::toJSON(self$`{{name}}`$toJSON(), auto_unbox=TRUE, digits = NA)
|
||||||
{{/isPrimitiveType}}
|
{{/isPrimitiveType}}
|
||||||
{{/isContainer}}
|
{{/isContainer}}
|
||||||
)}{{^-last}},{{/-last}}
|
)
|
||||||
|
}{{^-last}},{{/-last}}
|
||||||
{{/vars}}
|
{{/vars}}
|
||||||
)
|
)
|
||||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||||
as.character(jsonlite::minify(paste('{', jsoncontent, '}', sep = "")))
|
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||||
},
|
},
|
||||||
#' Deserialize JSON string into an instance of {{{classname}}}
|
#' Deserialize JSON string into an instance of {{{classname}}}
|
||||||
#'
|
#'
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#' @importFrom jsonlite fromJSON toJSON
|
#' @importFrom jsonlite fromJSON toJSON
|
||||||
#' @export
|
#' @export
|
||||||
{{classname}} <- R6::R6Class(
|
{{classname}} <- R6::R6Class(
|
||||||
'{{classname}}',
|
"{{classname}}",
|
||||||
public = list(
|
public = list(
|
||||||
#' @field actual_instance the object stored in this instance.
|
#' @field actual_instance the object stored in this instance.
|
||||||
actual_instance = NULL,
|
actual_instance = NULL,
|
||||||
@ -28,10 +28,11 @@
|
|||||||
if (is.null(instance)) {
|
if (is.null(instance)) {
|
||||||
# do nothing
|
# do nothing
|
||||||
} {{#oneOf}}else if (get(class(instance)[[1]], pos = -1)$classname == "{{{.}}}") {
|
} {{#oneOf}}else if (get(class(instance)[[1]], pos = -1)$classname == "{{{.}}}") {
|
||||||
self$actual_instance = instance
|
self$actual_instance <- instance
|
||||||
self$actual_type = "{{{.}}}"
|
self$actual_type <- "{{{.}}}"
|
||||||
} {{/oneOf}}else {
|
} {{/oneOf}}else {
|
||||||
stop(paste("Failed to initialize {{{classname}}} with oneOf schemas {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}. Provided class name: ", get(class(instance)[[1]], pos = -1)$classname))
|
stop(paste("Failed to initialize {{{classname}}} with oneOf schemas {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}. Provided class name: ",
|
||||||
|
get(class(instance)[[1]], pos = -1)$classname))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
#' Deserialize JSON string into an instance of {{{classname}}}.
|
#' Deserialize JSON string into an instance of {{{classname}}}.
|
||||||
@ -60,8 +61,8 @@
|
|||||||
error = function(err) err
|
error = function(err) err
|
||||||
)
|
)
|
||||||
|
|
||||||
if (!is.null({{{.}}}_result['error'])) {
|
if (!is.null({{{.}}}_result["error"])) {
|
||||||
error_messages <- append(error_messages, {{{.}}}_result['message'])
|
error_messages <- append(error_messages, {{{.}}}_result["message"])
|
||||||
}
|
}
|
||||||
|
|
||||||
{{/oneOf}}
|
{{/oneOf}}
|
||||||
@ -71,10 +72,11 @@
|
|||||||
self$actual_type <- instance_type
|
self$actual_type <- instance_type
|
||||||
} else if (matched > 1) {
|
} else if (matched > 1) {
|
||||||
# more than 1 match
|
# more than 1 match
|
||||||
stop("Multiple matches found when deserializing the payload into {{{classname}}} with oneOf schemas {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}. ")
|
stop("Multiple matches found when deserializing the payload into {{{classname}}} with oneOf schemas {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}.")
|
||||||
} else {
|
} else {
|
||||||
# no match
|
# no match
|
||||||
stop(paste("No match found when deserializing the payload into {{{classname}}} with oneOf schemas {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}. Details: ", paste(error_messages, collapse = ', ')))
|
stop(paste("No match found when deserializing the payload into {{{classname}}} with oneOf schemas {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}. Details: ",
|
||||||
|
paste(error_messages, collapse = ", ")))
|
||||||
}
|
}
|
||||||
|
|
||||||
self
|
self
|
||||||
@ -136,12 +138,12 @@
|
|||||||
#' @export
|
#' @export
|
||||||
toString = function() {
|
toString = function() {
|
||||||
jsoncontent <- c(
|
jsoncontent <- c(
|
||||||
sprintf('"actual_instance": %s', if (is.null(self$actual_instance)) {NULL} else {self$actual_instance$toJSONString()}),
|
sprintf('"actual_instance": %s', if (is.null(self$actual_instance)) NULL else self$actual_instance$toJSONString()),
|
||||||
sprintf('"actual_type": "%s"', self$actual_type),
|
sprintf('"actual_type": "%s"', self$actual_type),
|
||||||
sprintf('"one_of": "%s"', paste( unlist(self$one_of), collapse=', '))
|
sprintf('"one_of": "%s"', paste(unlist(self$one_of), collapse = ", "))
|
||||||
)
|
)
|
||||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||||
as.character(jsonlite::prettify(paste('{', jsoncontent, '}', sep = "")))
|
as.character(jsonlite::prettify(paste("{", jsoncontent, "}", sep = "")))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
linters: linters_with_defaults(
|
linters: linters_with_defaults(
|
||||||
line_length_linter(160),
|
line_length_linter(160),
|
||||||
object_name_linter = NULL
|
object_name_linter = NULL,
|
||||||
|
cyclocomp_linter = NULL
|
||||||
)
|
)
|
||||||
exclusions: list(
|
exclusions: list(
|
||||||
)
|
)
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#' @importFrom jsonlite fromJSON toJSON
|
#' @importFrom jsonlite fromJSON toJSON
|
||||||
#' @export
|
#' @export
|
||||||
AllofTagApiResponse <- R6::R6Class(
|
AllofTagApiResponse <- R6::R6Class(
|
||||||
'AllofTagApiResponse',
|
"AllofTagApiResponse",
|
||||||
public = list(
|
public = list(
|
||||||
`id` = NULL,
|
`id` = NULL,
|
||||||
`name` = NULL,
|
`name` = NULL,
|
||||||
@ -39,7 +39,7 @@ AllofTagApiResponse <- R6::R6Class(
|
|||||||
#' @param ... Other optional arguments.
|
#' @param ... Other optional arguments.
|
||||||
#' @export
|
#' @export
|
||||||
initialize = function(
|
initialize = function(
|
||||||
`id`=NULL, `name`=NULL, `code`=NULL, `type`=NULL, `message`=NULL, ...
|
`id` = NULL, `name` = NULL, `code` = NULL, `type` = NULL, `message` = NULL, ...
|
||||||
) {
|
) {
|
||||||
if (!is.null(`id`)) {
|
if (!is.null(`id`)) {
|
||||||
stopifnot(is.numeric(`id`), length(`id`) == 1)
|
stopifnot(is.numeric(`id`), length(`id`) == 1)
|
||||||
@ -72,23 +72,23 @@ AllofTagApiResponse <- R6::R6Class(
|
|||||||
toJSON = function() {
|
toJSON = function() {
|
||||||
AllofTagApiResponseObject <- list()
|
AllofTagApiResponseObject <- list()
|
||||||
if (!is.null(self$`id`)) {
|
if (!is.null(self$`id`)) {
|
||||||
AllofTagApiResponseObject[['id']] <-
|
AllofTagApiResponseObject[["id"]] <-
|
||||||
self$`id`
|
self$`id`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`name`)) {
|
if (!is.null(self$`name`)) {
|
||||||
AllofTagApiResponseObject[['name']] <-
|
AllofTagApiResponseObject[["name"]] <-
|
||||||
self$`name`
|
self$`name`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`code`)) {
|
if (!is.null(self$`code`)) {
|
||||||
AllofTagApiResponseObject[['code']] <-
|
AllofTagApiResponseObject[["code"]] <-
|
||||||
self$`code`
|
self$`code`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`type`)) {
|
if (!is.null(self$`type`)) {
|
||||||
AllofTagApiResponseObject[['type']] <-
|
AllofTagApiResponseObject[["type"]] <-
|
||||||
self$`type`
|
self$`type`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`message`)) {
|
if (!is.null(self$`message`)) {
|
||||||
AllofTagApiResponseObject[['message']] <-
|
AllofTagApiResponseObject[["message"]] <-
|
||||||
self$`message`
|
self$`message`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,43 +131,48 @@ AllofTagApiResponse <- R6::R6Class(
|
|||||||
toJSONString = function() {
|
toJSONString = function() {
|
||||||
jsoncontent <- c(
|
jsoncontent <- c(
|
||||||
if (!is.null(self$`id`)) {
|
if (!is.null(self$`id`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"id":
|
'"id":
|
||||||
%d
|
%d
|
||||||
',
|
',
|
||||||
self$`id`
|
self$`id`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`name`)) {
|
if (!is.null(self$`name`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"name":
|
'"name":
|
||||||
"%s"
|
"%s"
|
||||||
',
|
',
|
||||||
self$`name`
|
self$`name`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`code`)) {
|
if (!is.null(self$`code`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"code":
|
'"code":
|
||||||
%d
|
%d
|
||||||
',
|
',
|
||||||
self$`code`
|
self$`code`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`type`)) {
|
if (!is.null(self$`type`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"type":
|
'"type":
|
||||||
"%s"
|
"%s"
|
||||||
',
|
',
|
||||||
self$`type`
|
self$`type`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`message`)) {
|
if (!is.null(self$`message`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"message":
|
'"message":
|
||||||
"%s"
|
"%s"
|
||||||
',
|
',
|
||||||
self$`message`
|
self$`message`
|
||||||
)}
|
)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||||
as.character(jsonlite::minify(paste('{', jsoncontent, '}', sep = "")))
|
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||||
},
|
},
|
||||||
#' Deserialize JSON string into an instance of AllofTagApiResponse
|
#' Deserialize JSON string into an instance of AllofTagApiResponse
|
||||||
#'
|
#'
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#' @importFrom jsonlite fromJSON toJSON
|
#' @importFrom jsonlite fromJSON toJSON
|
||||||
#' @export
|
#' @export
|
||||||
Animal <- R6::R6Class(
|
Animal <- R6::R6Class(
|
||||||
'Animal',
|
"Animal",
|
||||||
public = list(
|
public = list(
|
||||||
`className` = NULL,
|
`className` = NULL,
|
||||||
`color` = NULL,
|
`color` = NULL,
|
||||||
@ -26,11 +26,11 @@ Animal <- R6::R6Class(
|
|||||||
#' Initialize a new Animal class.
|
#' Initialize a new Animal class.
|
||||||
#'
|
#'
|
||||||
#' @param className className
|
#' @param className className
|
||||||
#' @param color color. Default to 'red'.
|
#' @param color color. Default to "red".
|
||||||
#' @param ... Other optional arguments.
|
#' @param ... Other optional arguments.
|
||||||
#' @export
|
#' @export
|
||||||
initialize = function(
|
initialize = function(
|
||||||
`className`, `color`='red', ...
|
`className`, `color` = "red", ...
|
||||||
) {
|
) {
|
||||||
if (!missing(`className`)) {
|
if (!missing(`className`)) {
|
||||||
stopifnot(is.character(`className`), length(`className`) == 1)
|
stopifnot(is.character(`className`), length(`className`) == 1)
|
||||||
@ -51,11 +51,11 @@ Animal <- R6::R6Class(
|
|||||||
toJSON = function() {
|
toJSON = function() {
|
||||||
AnimalObject <- list()
|
AnimalObject <- list()
|
||||||
if (!is.null(self$`className`)) {
|
if (!is.null(self$`className`)) {
|
||||||
AnimalObject[['className']] <-
|
AnimalObject[["className"]] <-
|
||||||
self$`className`
|
self$`className`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`color`)) {
|
if (!is.null(self$`color`)) {
|
||||||
AnimalObject[['color']] <-
|
AnimalObject[["color"]] <-
|
||||||
self$`color`
|
self$`color`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,22 +89,24 @@ Animal <- R6::R6Class(
|
|||||||
toJSONString = function() {
|
toJSONString = function() {
|
||||||
jsoncontent <- c(
|
jsoncontent <- c(
|
||||||
if (!is.null(self$`className`)) {
|
if (!is.null(self$`className`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"className":
|
'"className":
|
||||||
"%s"
|
"%s"
|
||||||
',
|
',
|
||||||
self$`className`
|
self$`className`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`color`)) {
|
if (!is.null(self$`color`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"color":
|
'"color":
|
||||||
"%s"
|
"%s"
|
||||||
',
|
',
|
||||||
self$`color`
|
self$`color`
|
||||||
)}
|
)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||||
as.character(jsonlite::minify(paste('{', jsoncontent, '}', sep = "")))
|
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||||
},
|
},
|
||||||
#' Deserialize JSON string into an instance of Animal
|
#' Deserialize JSON string into an instance of Animal
|
||||||
#'
|
#'
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#' @importFrom jsonlite fromJSON toJSON
|
#' @importFrom jsonlite fromJSON toJSON
|
||||||
#' @export
|
#' @export
|
||||||
AnyOfPig <- R6::R6Class(
|
AnyOfPig <- R6::R6Class(
|
||||||
'AnyOfPig',
|
"AnyOfPig",
|
||||||
public = list(
|
public = list(
|
||||||
#' @field actual_instance the object stored in this instance.
|
#' @field actual_instance the object stored in this instance.
|
||||||
actual_instance = NULL,
|
actual_instance = NULL,
|
||||||
@ -36,13 +36,14 @@ AnyOfPig <- R6::R6Class(
|
|||||||
if (is.null(instance)) {
|
if (is.null(instance)) {
|
||||||
# do nothing
|
# do nothing
|
||||||
} else if (get(class(instance)[[1]], pos = -1)$classname == "BasquePig") {
|
} else if (get(class(instance)[[1]], pos = -1)$classname == "BasquePig") {
|
||||||
self$actual_instance = instance
|
self$actual_instance <- instance
|
||||||
self$actual_type = "BasquePig"
|
self$actual_type <- "BasquePig"
|
||||||
} else if (get(class(instance)[[1]], pos = -1)$classname == "DanishPig") {
|
} else if (get(class(instance)[[1]], pos = -1)$classname == "DanishPig") {
|
||||||
self$actual_instance = instance
|
self$actual_instance <- instance
|
||||||
self$actual_type = "DanishPig"
|
self$actual_type <- "DanishPig"
|
||||||
} else {
|
} else {
|
||||||
stop(paste("Failed to initialize AnyOfPig with anyOf schemas BasquePig, DanishPig. Provided class name: ", get(class(instance)[[1]], pos = -1)$classname))
|
stop(paste("Failed to initialize AnyOfPig with anyOf schemas BasquePig, DanishPig. Provided class name: ",
|
||||||
|
get(class(instance)[[1]], pos = -1)$classname))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
#' Deserialize JSON string into an instance of AnyOfPig.
|
#' Deserialize JSON string into an instance of AnyOfPig.
|
||||||
@ -66,8 +67,8 @@ AnyOfPig <- R6::R6Class(
|
|||||||
error = function(err) err
|
error = function(err) err
|
||||||
)
|
)
|
||||||
|
|
||||||
if (!is.null(BasquePig_result['error'])) {
|
if (!is.null(BasquePig_result["error"])) {
|
||||||
error_messages <- append(error_messages, BasquePig_result['message'])
|
error_messages <- append(error_messages, BasquePig_result["message"])
|
||||||
}
|
}
|
||||||
|
|
||||||
DanishPig_result <- tryCatch({
|
DanishPig_result <- tryCatch({
|
||||||
@ -80,12 +81,13 @@ AnyOfPig <- R6::R6Class(
|
|||||||
error = function(err) err
|
error = function(err) err
|
||||||
)
|
)
|
||||||
|
|
||||||
if (!is.null(DanishPig_result['error'])) {
|
if (!is.null(DanishPig_result["error"])) {
|
||||||
error_messages <- append(error_messages, DanishPig_result['message'])
|
error_messages <- append(error_messages, DanishPig_result["message"])
|
||||||
}
|
}
|
||||||
|
|
||||||
# no match
|
# no match
|
||||||
stop(paste("No match found when deserializing the payload into AnyOfPig with anyOf schemas BasquePig, DanishPig. Details: ", paste(error_messages, collapse = ', ')))
|
stop(paste("No match found when deserializing the payload into AnyOfPig with anyOf schemas BasquePig, DanishPig. Details: ",
|
||||||
|
paste(error_messages, collapse = ", ")))
|
||||||
},
|
},
|
||||||
#' Serialize AnyOfPig to JSON string.
|
#' Serialize AnyOfPig to JSON string.
|
||||||
#'
|
#'
|
||||||
@ -144,13 +146,13 @@ AnyOfPig <- R6::R6Class(
|
|||||||
#' @export
|
#' @export
|
||||||
toString = function() {
|
toString = function() {
|
||||||
jsoncontent <- c(
|
jsoncontent <- c(
|
||||||
sprintf('"actual_instance": %s', if (is.null(self$actual_instance)) {NULL} else {self$actual_instance$toJSONString()}),
|
sprintf('"actual_instance": %s', if (is.null(self$actual_instance)) NULL else self$actual_instance$toJSONString()),
|
||||||
sprintf('"actual_type": "%s"', self$actual_type),
|
sprintf('"actual_type": "%s"', self$actual_type),
|
||||||
sprintf('"any_of": "%s"', paste( unlist(self$any_of), collapse=', '))
|
sprintf('"any_of": "%s"', paste(unlist(self$any_of), collapse = ", "))
|
||||||
)
|
)
|
||||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||||
as.character(jsonlite::prettify(paste('{', jsoncontent, '}', sep = "")))
|
as.character(jsonlite::prettify(paste("{", jsoncontent, "}", sep = "")))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -74,10 +74,11 @@ ApiClient <- R6::R6Class(
|
|||||||
#' @param retry_status_codes Status codes for retry.
|
#' @param retry_status_codes Status codes for retry.
|
||||||
#' @param max_retry_attempts Maxmium number of retry.
|
#' @param max_retry_attempts Maxmium number of retry.
|
||||||
#' @export
|
#' @export
|
||||||
initialize = function(base_path=NULL, user_agent=NULL, default_headers=NULL,
|
initialize = function(base_path = NULL, user_agent = NULL,
|
||||||
username=NULL, password=NULL, api_keys=NULL,
|
default_headers = NULL,
|
||||||
access_token=NULL, timeout=NULL,
|
username = NULL, password = NULL, api_keys = NULL,
|
||||||
retry_status_codes=NULL, max_retry_attempts=NULL) {
|
access_token = NULL, timeout = NULL,
|
||||||
|
retry_status_codes = NULL, max_retry_attempts = NULL) {
|
||||||
if (!is.null(base_path)) {
|
if (!is.null(base_path)) {
|
||||||
self$base_path <- base_path
|
self$base_path <- base_path
|
||||||
}
|
}
|
||||||
@ -151,7 +152,7 @@ ApiClient <- R6::R6Class(
|
|||||||
resp <- self$Execute(url, method, query_params, header_params, body, stream_callback = stream_callback, ...)
|
resp <- self$Execute(url, method, query_params, header_params, body, stream_callback = stream_callback, ...)
|
||||||
status_code <- httr::status_code(resp)
|
status_code <- httr::status_code(resp)
|
||||||
} else {
|
} else {
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -182,43 +183,63 @@ ApiClient <- R6::R6Class(
|
|||||||
|
|
||||||
if (method == "GET") {
|
if (method == "GET") {
|
||||||
if (typeof(stream_callback) == "closure") {
|
if (typeof(stream_callback) == "closure") {
|
||||||
httr::GET(url, query = query_params, headers, http_timeout, httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...)
|
httr::GET(url, query = query_params, headers, http_timeout,
|
||||||
|
httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...)
|
||||||
} else {
|
} else {
|
||||||
httr::GET(url, query = query_params, headers, http_timeout, httr::user_agent(self$`user_agent`), ...)
|
httr::GET(url, query = query_params, headers, http_timeout,
|
||||||
|
httr::user_agent(self$`user_agent`), ...)
|
||||||
}
|
}
|
||||||
} else if (method == "POST") {
|
} else if (method == "POST") {
|
||||||
if (typeof(stream_callback) == "closure") {
|
if (typeof(stream_callback) == "closure") {
|
||||||
httr::POST(url, query = query_params, headers, body = body, httr::content_type("application/json"), http_timeout, httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...)
|
httr::POST(url, query = query_params, headers, body = body,
|
||||||
|
httr::content_type("application/json"), http_timeout,
|
||||||
|
httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...)
|
||||||
} else {
|
} else {
|
||||||
httr::POST(url, query = query_params, headers, body = body, httr::content_type("application/json"), http_timeout, httr::user_agent(self$`user_agent`), ...)
|
httr::POST(url, query = query_params, headers, body = body,
|
||||||
|
httr::content_type("application/json"), http_timeout,
|
||||||
|
httr::user_agent(self$`user_agent`), ...)
|
||||||
}
|
}
|
||||||
} else if (method == "PUT") {
|
} else if (method == "PUT") {
|
||||||
if (typeof(stream_callback) == "closure") {
|
if (typeof(stream_callback) == "closure") {
|
||||||
httr::PUT(url, query = query_params, headers, body = body, httr::content_type("application/json"), http_timeout, http_timeout, httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...)
|
httr::PUT(url, query = query_params, headers, body = body,
|
||||||
|
httr::content_type("application/json"), http_timeout,
|
||||||
|
http_timeout, httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...)
|
||||||
} else {
|
} else {
|
||||||
httr::PUT(url, query = query_params, headers, body = body, httr::content_type("application/json"), http_timeout, http_timeout, httr::user_agent(self$`user_agent`), ...)
|
httr::PUT(url, query = query_params, headers, body = body,
|
||||||
|
httr::content_type("application/json"), http_timeout,
|
||||||
|
http_timeout, httr::user_agent(self$`user_agent`), ...)
|
||||||
}
|
}
|
||||||
} else if (method == "PATCH") {
|
} else if (method == "PATCH") {
|
||||||
if (typeof(stream_callback) == "closure") {
|
if (typeof(stream_callback) == "closure") {
|
||||||
httr::PATCH(url, query = query_params, headers, body = body, httr::content_type("application/json"), http_timeout, http_timeout, httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...)
|
httr::PATCH(url, query = query_params, headers, body = body,
|
||||||
|
httr::content_type("application/json"), http_timeout,
|
||||||
|
http_timeout, httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...)
|
||||||
} else {
|
} else {
|
||||||
httr::PATCH(url, query = query_params, headers, body = body, httr::content_type("application/json"), http_timeout, http_timeout, httr::user_agent(self$`user_agent`), ...)
|
httr::PATCH(url, query = query_params, headers, body = body,
|
||||||
|
httr::content_type("application/json"), http_timeout,
|
||||||
|
http_timeout, httr::user_agent(self$`user_agent`), ...)
|
||||||
}
|
}
|
||||||
} else if (method == "HEAD") {
|
} else if (method == "HEAD") {
|
||||||
if (typeof(stream_callback) == "closure") {
|
if (typeof(stream_callback) == "closure") {
|
||||||
httr::HEAD(url, query = query_params, headers, http_timeout, http_timeout, httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...)
|
httr::HEAD(url, query = query_params, headers, http_timeout,
|
||||||
|
http_timeout, httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...)
|
||||||
} else {
|
} else {
|
||||||
httr::HEAD(url, query = query_params, headers, http_timeout, http_timeout, httr::user_agent(self$`user_agent`), ...)
|
httr::HEAD(url, query = query_params, headers, http_timeout,
|
||||||
|
http_timeout, httr::user_agent(self$`user_agent`), ...)
|
||||||
}
|
}
|
||||||
} else if (method == "DELETE") {
|
} else if (method == "DELETE") {
|
||||||
if (typeof(stream_callback) == "closure") {
|
if (typeof(stream_callback) == "closure") {
|
||||||
httr::DELETE(url, query = query_params, headers, http_timeout, http_timeout, httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...)
|
httr::DELETE(url, query = query_params, headers, http_timeout,
|
||||||
|
http_timeout, httr::user_agent(self$`user_agent`), write_stream(stream_callback), ...)
|
||||||
} else {
|
} else {
|
||||||
httr::DELETE(url, query = query_params, headers, http_timeout, http_timeout, httr::user_agent(self$`user_agent`), ...)
|
httr::DELETE(url, query = query_params, headers, http_timeout,
|
||||||
|
http_timeout, httr::user_agent(self$`user_agent`), ...)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
err_msg <- "Http method must be `GET`, `HEAD`, `OPTIONS`, `POST`, `PATCH`, `PUT` or `DELETE`."
|
err_msg <- "Http method must be `GET`, `HEAD`, `OPTIONS`, `POST`, `PATCH`, `PUT` or `DELETE`."
|
||||||
rlang::abort(message = err_msg, .subclass = "ApiException", ApiException = ApiException$new(status = 0, reason = err_msg))
|
rlang::abort(message = err_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(status = 0, reason = err_msg))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
#' Deserialize the content of api response to the given type.
|
#' Deserialize the content of api response to the given type.
|
||||||
@ -254,16 +275,16 @@ ApiClient <- R6::R6Class(
|
|||||||
|
|
||||||
# To handle the "map" type
|
# To handle the "map" type
|
||||||
if (startsWith(return_type, "map(")) {
|
if (startsWith(return_type, "map(")) {
|
||||||
inner_return_type <- regmatches(return_type, regexec(pattern = "map\\((.*)\\)", return_type))[[1]][2]
|
inner_return_type <- regmatches(return_type,
|
||||||
|
regexec(pattern = "map\\((.*)\\)", return_type))[[1]][2]
|
||||||
return_obj <- lapply(names(obj), function(name) {
|
return_obj <- lapply(names(obj), function(name) {
|
||||||
self$deserializeObj(obj[[name]], inner_return_type, pkg_env)
|
self$deserializeObj(obj[[name]], inner_return_type, pkg_env)
|
||||||
})
|
})
|
||||||
names(return_obj) <- names(obj)
|
names(return_obj) <- names(obj)
|
||||||
}
|
} else if (startsWith(return_type, "array[")) {
|
||||||
|
# To handle the "array" type
|
||||||
# To handle the "array" type
|
inner_return_type <- regmatches(return_type,
|
||||||
else if (startsWith(return_type, "array[")) {
|
regexec(pattern = "array\\[(.*)\\]", return_type))[[1]][2]
|
||||||
inner_return_type <- regmatches(return_type, regexec(pattern = "array\\[(.*)\\]", return_type))[[1]][2]
|
|
||||||
if (c(inner_return_type) %in% primitive_types) {
|
if (c(inner_return_type) %in% primitive_types) {
|
||||||
return_obj <- vector("list", length = length(obj))
|
return_obj <- vector("list", length = length(obj))
|
||||||
if (length(obj) > 0) {
|
if (length(obj) > 0) {
|
||||||
@ -276,24 +297,21 @@ ApiClient <- R6::R6Class(
|
|||||||
return_obj <- vector("list", length = nrow(obj))
|
return_obj <- vector("list", length = nrow(obj))
|
||||||
if (nrow(obj) > 0) {
|
if (nrow(obj) > 0) {
|
||||||
for (row in 1:nrow(obj)) {
|
for (row in 1:nrow(obj)) {
|
||||||
return_obj[[row]] <- self$deserializeObj(obj[row, , drop = FALSE], inner_return_type, pkg_env)
|
return_obj[[row]] <- self$deserializeObj(obj[row, , drop = FALSE],
|
||||||
|
inner_return_type, pkg_env)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (exists(return_type, pkg_env) && !(c(return_type) %in% primitive_types)) {
|
||||||
|
# To handle model objects which are not array or map containers. Ex:"Pet"
|
||||||
# To handle model objects which are not array or map containers. Ex:"Pet"
|
|
||||||
else if (exists(return_type, pkg_env) && !(c(return_type) %in% primitive_types)) {
|
|
||||||
return_type <- get(return_type, envir = as.environment(pkg_env))
|
return_type <- get(return_type, envir = as.environment(pkg_env))
|
||||||
return_obj <- return_type$new()
|
return_obj <- return_type$new()
|
||||||
return_obj$fromJSON(
|
return_obj$fromJSON(
|
||||||
jsonlite::toJSON(obj, digits = NA, auto_unbox = TRUE)
|
jsonlite::toJSON(obj, digits = NA, auto_unbox = TRUE)
|
||||||
)
|
)
|
||||||
}
|
} else {
|
||||||
|
# To handle primitive type
|
||||||
# To handle primitive type
|
|
||||||
else {
|
|
||||||
return_obj <- obj
|
return_obj <- obj
|
||||||
}
|
}
|
||||||
return_obj
|
return_obj
|
||||||
|
@ -37,7 +37,7 @@ ApiException <- R6::R6Class(
|
|||||||
if (!is.null(http_response)) {
|
if (!is.null(http_response)) {
|
||||||
self$status <- http_response$status_code
|
self$status <- http_response$status_code
|
||||||
errorMsg <- toString(content(http_response))
|
errorMsg <- toString(content(http_response))
|
||||||
if(errorMsg == ""){
|
if (errorMsg == "") {
|
||||||
errorMsg <- "Api exception encountered. No details given."
|
errorMsg <- "Api exception encountered. No details given."
|
||||||
}
|
}
|
||||||
self$body <- errorMsg
|
self$body <- errorMsg
|
||||||
@ -71,11 +71,11 @@ ApiException <- R6::R6Class(
|
|||||||
}
|
}
|
||||||
if (!is.null(self$body)) {
|
if (!is.null(self$body)) {
|
||||||
errorMsg <- paste(errorMsg, "Body : ", "\n", sep = "")
|
errorMsg <- paste(errorMsg, "Body : ", "\n", sep = "")
|
||||||
errorMsg <- paste(errorMsg, self$body,"\n")
|
errorMsg <- paste(errorMsg, self$body, "\n")
|
||||||
}
|
}
|
||||||
if (!is.null(self$errorObject)) {
|
if (!is.null(self$errorObject)) {
|
||||||
errorMsg <- paste(errorMsg, "Error object : ", "\n", sep = "")
|
errorMsg <- paste(errorMsg, "Error object : ", "\n", sep = "")
|
||||||
errorMsg <- paste(errorMsg, self$errorObject$toJSONString(),"\n")
|
errorMsg <- paste(errorMsg, self$errorObject$toJSONString(), "\n")
|
||||||
}
|
}
|
||||||
errorMsg
|
errorMsg
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#' @importFrom jsonlite fromJSON toJSON
|
#' @importFrom jsonlite fromJSON toJSON
|
||||||
#' @export
|
#' @export
|
||||||
BasquePig <- R6::R6Class(
|
BasquePig <- R6::R6Class(
|
||||||
'BasquePig',
|
"BasquePig",
|
||||||
public = list(
|
public = list(
|
||||||
`className` = NULL,
|
`className` = NULL,
|
||||||
`color` = NULL,
|
`color` = NULL,
|
||||||
@ -51,11 +51,11 @@ BasquePig <- R6::R6Class(
|
|||||||
toJSON = function() {
|
toJSON = function() {
|
||||||
BasquePigObject <- list()
|
BasquePigObject <- list()
|
||||||
if (!is.null(self$`className`)) {
|
if (!is.null(self$`className`)) {
|
||||||
BasquePigObject[['className']] <-
|
BasquePigObject[["className"]] <-
|
||||||
self$`className`
|
self$`className`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`color`)) {
|
if (!is.null(self$`color`)) {
|
||||||
BasquePigObject[['color']] <-
|
BasquePigObject[["color"]] <-
|
||||||
self$`color`
|
self$`color`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,22 +89,24 @@ BasquePig <- R6::R6Class(
|
|||||||
toJSONString = function() {
|
toJSONString = function() {
|
||||||
jsoncontent <- c(
|
jsoncontent <- c(
|
||||||
if (!is.null(self$`className`)) {
|
if (!is.null(self$`className`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"className":
|
'"className":
|
||||||
"%s"
|
"%s"
|
||||||
',
|
',
|
||||||
self$`className`
|
self$`className`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`color`)) {
|
if (!is.null(self$`color`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"color":
|
'"color":
|
||||||
"%s"
|
"%s"
|
||||||
',
|
',
|
||||||
self$`color`
|
self$`color`
|
||||||
)}
|
)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||||
as.character(jsonlite::minify(paste('{', jsoncontent, '}', sep = "")))
|
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||||
},
|
},
|
||||||
#' Deserialize JSON string into an instance of BasquePig
|
#' Deserialize JSON string into an instance of BasquePig
|
||||||
#'
|
#'
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#' @importFrom jsonlite fromJSON toJSON
|
#' @importFrom jsonlite fromJSON toJSON
|
||||||
#' @export
|
#' @export
|
||||||
Cat <- R6::R6Class(
|
Cat <- R6::R6Class(
|
||||||
'Cat',
|
"Cat",
|
||||||
inherit = Animal,
|
inherit = Animal,
|
||||||
public = list(
|
public = list(
|
||||||
`className` = NULL,
|
`className` = NULL,
|
||||||
@ -29,12 +29,12 @@ Cat <- R6::R6Class(
|
|||||||
#' Initialize a new Cat class.
|
#' Initialize a new Cat class.
|
||||||
#'
|
#'
|
||||||
#' @param className className
|
#' @param className className
|
||||||
#' @param color color. Default to 'red'.
|
#' @param color color. Default to "red".
|
||||||
#' @param declawed declawed
|
#' @param declawed declawed
|
||||||
#' @param ... Other optional arguments.
|
#' @param ... Other optional arguments.
|
||||||
#' @export
|
#' @export
|
||||||
initialize = function(
|
initialize = function(
|
||||||
`className`, `color`='red', `declawed`=NULL, ...
|
`className`, `color` = "red", `declawed` = NULL, ...
|
||||||
) {
|
) {
|
||||||
if (!missing(`className`)) {
|
if (!missing(`className`)) {
|
||||||
stopifnot(is.character(`className`), length(`className`) == 1)
|
stopifnot(is.character(`className`), length(`className`) == 1)
|
||||||
@ -59,15 +59,15 @@ Cat <- R6::R6Class(
|
|||||||
toJSON = function() {
|
toJSON = function() {
|
||||||
CatObject <- list()
|
CatObject <- list()
|
||||||
if (!is.null(self$`className`)) {
|
if (!is.null(self$`className`)) {
|
||||||
CatObject[['className']] <-
|
CatObject[["className"]] <-
|
||||||
self$`className`
|
self$`className`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`color`)) {
|
if (!is.null(self$`color`)) {
|
||||||
CatObject[['color']] <-
|
CatObject[["color"]] <-
|
||||||
self$`color`
|
self$`color`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`declawed`)) {
|
if (!is.null(self$`declawed`)) {
|
||||||
CatObject[['declawed']] <-
|
CatObject[["declawed"]] <-
|
||||||
self$`declawed`
|
self$`declawed`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,29 +104,32 @@ Cat <- R6::R6Class(
|
|||||||
toJSONString = function() {
|
toJSONString = function() {
|
||||||
jsoncontent <- c(
|
jsoncontent <- c(
|
||||||
if (!is.null(self$`className`)) {
|
if (!is.null(self$`className`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"className":
|
'"className":
|
||||||
"%s"
|
"%s"
|
||||||
',
|
',
|
||||||
self$`className`
|
self$`className`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`color`)) {
|
if (!is.null(self$`color`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"color":
|
'"color":
|
||||||
"%s"
|
"%s"
|
||||||
',
|
',
|
||||||
self$`color`
|
self$`color`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`declawed`)) {
|
if (!is.null(self$`declawed`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"declawed":
|
'"declawed":
|
||||||
%s
|
%s
|
||||||
',
|
',
|
||||||
tolower(self$`declawed`)
|
tolower(self$`declawed`)
|
||||||
)}
|
)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||||
as.character(jsonlite::minify(paste('{', jsoncontent, '}', sep = "")))
|
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||||
},
|
},
|
||||||
#' Deserialize JSON string into an instance of Cat
|
#' Deserialize JSON string into an instance of Cat
|
||||||
#'
|
#'
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#' @importFrom jsonlite fromJSON toJSON
|
#' @importFrom jsonlite fromJSON toJSON
|
||||||
#' @export
|
#' @export
|
||||||
CatAllOf <- R6::R6Class(
|
CatAllOf <- R6::R6Class(
|
||||||
'CatAllOf',
|
"CatAllOf",
|
||||||
public = list(
|
public = list(
|
||||||
`declawed` = NULL,
|
`declawed` = NULL,
|
||||||
#' Initialize a new CatAllOf class.
|
#' Initialize a new CatAllOf class.
|
||||||
@ -27,7 +27,7 @@ CatAllOf <- R6::R6Class(
|
|||||||
#' @param ... Other optional arguments.
|
#' @param ... Other optional arguments.
|
||||||
#' @export
|
#' @export
|
||||||
initialize = function(
|
initialize = function(
|
||||||
`declawed`=NULL, ...
|
`declawed` = NULL, ...
|
||||||
) {
|
) {
|
||||||
if (!is.null(`declawed`)) {
|
if (!is.null(`declawed`)) {
|
||||||
stopifnot(is.logical(`declawed`), length(`declawed`) == 1)
|
stopifnot(is.logical(`declawed`), length(`declawed`) == 1)
|
||||||
@ -44,7 +44,7 @@ CatAllOf <- R6::R6Class(
|
|||||||
toJSON = function() {
|
toJSON = function() {
|
||||||
CatAllOfObject <- list()
|
CatAllOfObject <- list()
|
||||||
if (!is.null(self$`declawed`)) {
|
if (!is.null(self$`declawed`)) {
|
||||||
CatAllOfObject[['declawed']] <-
|
CatAllOfObject[["declawed"]] <-
|
||||||
self$`declawed`
|
self$`declawed`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,15 +75,16 @@ CatAllOf <- R6::R6Class(
|
|||||||
toJSONString = function() {
|
toJSONString = function() {
|
||||||
jsoncontent <- c(
|
jsoncontent <- c(
|
||||||
if (!is.null(self$`declawed`)) {
|
if (!is.null(self$`declawed`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"declawed":
|
'"declawed":
|
||||||
%s
|
%s
|
||||||
',
|
',
|
||||||
tolower(self$`declawed`)
|
tolower(self$`declawed`)
|
||||||
)}
|
)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||||
as.character(jsonlite::minify(paste('{', jsoncontent, '}', sep = "")))
|
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||||
},
|
},
|
||||||
#' Deserialize JSON string into an instance of CatAllOf
|
#' Deserialize JSON string into an instance of CatAllOf
|
||||||
#'
|
#'
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#' @importFrom jsonlite fromJSON toJSON
|
#' @importFrom jsonlite fromJSON toJSON
|
||||||
#' @export
|
#' @export
|
||||||
Category <- R6::R6Class(
|
Category <- R6::R6Class(
|
||||||
'Category',
|
"Category",
|
||||||
public = list(
|
public = list(
|
||||||
`id` = NULL,
|
`id` = NULL,
|
||||||
`name` = NULL,
|
`name` = NULL,
|
||||||
@ -30,7 +30,7 @@ Category <- R6::R6Class(
|
|||||||
#' @param ... Other optional arguments.
|
#' @param ... Other optional arguments.
|
||||||
#' @export
|
#' @export
|
||||||
initialize = function(
|
initialize = function(
|
||||||
`id`=NULL, `name`=NULL, ...
|
`id` = NULL, `name` = NULL, ...
|
||||||
) {
|
) {
|
||||||
if (!is.null(`id`)) {
|
if (!is.null(`id`)) {
|
||||||
stopifnot(is.numeric(`id`), length(`id`) == 1)
|
stopifnot(is.numeric(`id`), length(`id`) == 1)
|
||||||
@ -51,11 +51,11 @@ Category <- R6::R6Class(
|
|||||||
toJSON = function() {
|
toJSON = function() {
|
||||||
CategoryObject <- list()
|
CategoryObject <- list()
|
||||||
if (!is.null(self$`id`)) {
|
if (!is.null(self$`id`)) {
|
||||||
CategoryObject[['id']] <-
|
CategoryObject[["id"]] <-
|
||||||
self$`id`
|
self$`id`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`name`)) {
|
if (!is.null(self$`name`)) {
|
||||||
CategoryObject[['name']] <-
|
CategoryObject[["name"]] <-
|
||||||
self$`name`
|
self$`name`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,22 +89,24 @@ Category <- R6::R6Class(
|
|||||||
toJSONString = function() {
|
toJSONString = function() {
|
||||||
jsoncontent <- c(
|
jsoncontent <- c(
|
||||||
if (!is.null(self$`id`)) {
|
if (!is.null(self$`id`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"id":
|
'"id":
|
||||||
%d
|
%d
|
||||||
',
|
',
|
||||||
self$`id`
|
self$`id`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`name`)) {
|
if (!is.null(self$`name`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"name":
|
'"name":
|
||||||
"%s"
|
"%s"
|
||||||
',
|
',
|
||||||
self$`name`
|
self$`name`
|
||||||
)}
|
)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||||
as.character(jsonlite::minify(paste('{', jsoncontent, '}', sep = "")))
|
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||||
},
|
},
|
||||||
#' Deserialize JSON string into an instance of Category
|
#' Deserialize JSON string into an instance of Category
|
||||||
#'
|
#'
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#' @importFrom jsonlite fromJSON toJSON
|
#' @importFrom jsonlite fromJSON toJSON
|
||||||
#' @export
|
#' @export
|
||||||
DanishPig <- R6::R6Class(
|
DanishPig <- R6::R6Class(
|
||||||
'DanishPig',
|
"DanishPig",
|
||||||
public = list(
|
public = list(
|
||||||
`className` = NULL,
|
`className` = NULL,
|
||||||
`size` = NULL,
|
`size` = NULL,
|
||||||
@ -51,11 +51,11 @@ DanishPig <- R6::R6Class(
|
|||||||
toJSON = function() {
|
toJSON = function() {
|
||||||
DanishPigObject <- list()
|
DanishPigObject <- list()
|
||||||
if (!is.null(self$`className`)) {
|
if (!is.null(self$`className`)) {
|
||||||
DanishPigObject[['className']] <-
|
DanishPigObject[["className"]] <-
|
||||||
self$`className`
|
self$`className`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`size`)) {
|
if (!is.null(self$`size`)) {
|
||||||
DanishPigObject[['size']] <-
|
DanishPigObject[["size"]] <-
|
||||||
self$`size`
|
self$`size`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,22 +89,24 @@ DanishPig <- R6::R6Class(
|
|||||||
toJSONString = function() {
|
toJSONString = function() {
|
||||||
jsoncontent <- c(
|
jsoncontent <- c(
|
||||||
if (!is.null(self$`className`)) {
|
if (!is.null(self$`className`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"className":
|
'"className":
|
||||||
"%s"
|
"%s"
|
||||||
',
|
',
|
||||||
self$`className`
|
self$`className`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`size`)) {
|
if (!is.null(self$`size`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"size":
|
'"size":
|
||||||
%d
|
%d
|
||||||
',
|
',
|
||||||
self$`size`
|
self$`size`
|
||||||
)}
|
)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||||
as.character(jsonlite::minify(paste('{', jsoncontent, '}', sep = "")))
|
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||||
},
|
},
|
||||||
#' Deserialize JSON string into an instance of DanishPig
|
#' Deserialize JSON string into an instance of DanishPig
|
||||||
#'
|
#'
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#' @importFrom jsonlite fromJSON toJSON
|
#' @importFrom jsonlite fromJSON toJSON
|
||||||
#' @export
|
#' @export
|
||||||
Dog <- R6::R6Class(
|
Dog <- R6::R6Class(
|
||||||
'Dog',
|
"Dog",
|
||||||
inherit = Animal,
|
inherit = Animal,
|
||||||
public = list(
|
public = list(
|
||||||
`className` = NULL,
|
`className` = NULL,
|
||||||
@ -29,12 +29,12 @@ Dog <- R6::R6Class(
|
|||||||
#' Initialize a new Dog class.
|
#' Initialize a new Dog class.
|
||||||
#'
|
#'
|
||||||
#' @param className className
|
#' @param className className
|
||||||
#' @param color color. Default to 'red'.
|
#' @param color color. Default to "red".
|
||||||
#' @param breed breed
|
#' @param breed breed
|
||||||
#' @param ... Other optional arguments.
|
#' @param ... Other optional arguments.
|
||||||
#' @export
|
#' @export
|
||||||
initialize = function(
|
initialize = function(
|
||||||
`className`, `color`='red', `breed`=NULL, ...
|
`className`, `color` = "red", `breed` = NULL, ...
|
||||||
) {
|
) {
|
||||||
if (!missing(`className`)) {
|
if (!missing(`className`)) {
|
||||||
stopifnot(is.character(`className`), length(`className`) == 1)
|
stopifnot(is.character(`className`), length(`className`) == 1)
|
||||||
@ -59,15 +59,15 @@ Dog <- R6::R6Class(
|
|||||||
toJSON = function() {
|
toJSON = function() {
|
||||||
DogObject <- list()
|
DogObject <- list()
|
||||||
if (!is.null(self$`className`)) {
|
if (!is.null(self$`className`)) {
|
||||||
DogObject[['className']] <-
|
DogObject[["className"]] <-
|
||||||
self$`className`
|
self$`className`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`color`)) {
|
if (!is.null(self$`color`)) {
|
||||||
DogObject[['color']] <-
|
DogObject[["color"]] <-
|
||||||
self$`color`
|
self$`color`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`breed`)) {
|
if (!is.null(self$`breed`)) {
|
||||||
DogObject[['breed']] <-
|
DogObject[["breed"]] <-
|
||||||
self$`breed`
|
self$`breed`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,29 +104,32 @@ Dog <- R6::R6Class(
|
|||||||
toJSONString = function() {
|
toJSONString = function() {
|
||||||
jsoncontent <- c(
|
jsoncontent <- c(
|
||||||
if (!is.null(self$`className`)) {
|
if (!is.null(self$`className`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"className":
|
'"className":
|
||||||
"%s"
|
"%s"
|
||||||
',
|
',
|
||||||
self$`className`
|
self$`className`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`color`)) {
|
if (!is.null(self$`color`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"color":
|
'"color":
|
||||||
"%s"
|
"%s"
|
||||||
',
|
',
|
||||||
self$`color`
|
self$`color`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`breed`)) {
|
if (!is.null(self$`breed`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"breed":
|
'"breed":
|
||||||
"%s"
|
"%s"
|
||||||
',
|
',
|
||||||
self$`breed`
|
self$`breed`
|
||||||
)}
|
)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||||
as.character(jsonlite::minify(paste('{', jsoncontent, '}', sep = "")))
|
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||||
},
|
},
|
||||||
#' Deserialize JSON string into an instance of Dog
|
#' Deserialize JSON string into an instance of Dog
|
||||||
#'
|
#'
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#' @importFrom jsonlite fromJSON toJSON
|
#' @importFrom jsonlite fromJSON toJSON
|
||||||
#' @export
|
#' @export
|
||||||
DogAllOf <- R6::R6Class(
|
DogAllOf <- R6::R6Class(
|
||||||
'DogAllOf',
|
"DogAllOf",
|
||||||
public = list(
|
public = list(
|
||||||
`breed` = NULL,
|
`breed` = NULL,
|
||||||
#' Initialize a new DogAllOf class.
|
#' Initialize a new DogAllOf class.
|
||||||
@ -27,7 +27,7 @@ DogAllOf <- R6::R6Class(
|
|||||||
#' @param ... Other optional arguments.
|
#' @param ... Other optional arguments.
|
||||||
#' @export
|
#' @export
|
||||||
initialize = function(
|
initialize = function(
|
||||||
`breed`=NULL, ...
|
`breed` = NULL, ...
|
||||||
) {
|
) {
|
||||||
if (!is.null(`breed`)) {
|
if (!is.null(`breed`)) {
|
||||||
stopifnot(is.character(`breed`), length(`breed`) == 1)
|
stopifnot(is.character(`breed`), length(`breed`) == 1)
|
||||||
@ -44,7 +44,7 @@ DogAllOf <- R6::R6Class(
|
|||||||
toJSON = function() {
|
toJSON = function() {
|
||||||
DogAllOfObject <- list()
|
DogAllOfObject <- list()
|
||||||
if (!is.null(self$`breed`)) {
|
if (!is.null(self$`breed`)) {
|
||||||
DogAllOfObject[['breed']] <-
|
DogAllOfObject[["breed"]] <-
|
||||||
self$`breed`
|
self$`breed`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,15 +75,16 @@ DogAllOf <- R6::R6Class(
|
|||||||
toJSONString = function() {
|
toJSONString = function() {
|
||||||
jsoncontent <- c(
|
jsoncontent <- c(
|
||||||
if (!is.null(self$`breed`)) {
|
if (!is.null(self$`breed`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"breed":
|
'"breed":
|
||||||
"%s"
|
"%s"
|
||||||
',
|
',
|
||||||
self$`breed`
|
self$`breed`
|
||||||
)}
|
)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||||
as.character(jsonlite::minify(paste('{', jsoncontent, '}', sep = "")))
|
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||||
},
|
},
|
||||||
#' Deserialize JSON string into an instance of DogAllOf
|
#' Deserialize JSON string into an instance of DogAllOf
|
||||||
#'
|
#'
|
||||||
|
@ -41,8 +41,8 @@
|
|||||||
#' #################### FakeDataFile ####################
|
#' #################### FakeDataFile ####################
|
||||||
#'
|
#'
|
||||||
#' library(petstore)
|
#' library(petstore)
|
||||||
#' var.dummy <- 'dummy_example' # character | dummy required parameter
|
#' var.dummy <- "dummy_example" # character | dummy required parameter
|
||||||
#' var.var_data_file <- 'var_data_file_example' # character | header data file
|
#' var.var_data_file <- "var_data_file_example" # character | header data file
|
||||||
#'
|
#'
|
||||||
#' #test data_file to ensure it's escaped correctly
|
#' #test data_file to ensure it's escaped correctly
|
||||||
#' api.instance <- FakeApi$new()
|
#' api.instance <- FakeApi$new()
|
||||||
@ -83,8 +83,7 @@ FakeApi <- R6::R6Class(
|
|||||||
initialize = function(api_client) {
|
initialize = function(api_client) {
|
||||||
if (!missing(api_client)) {
|
if (!missing(api_client)) {
|
||||||
self$api_client <- api_client
|
self$api_client <- api_client
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
self$api_client <- ApiClient$new()
|
self$api_client <- ApiClient$new()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -94,12 +93,12 @@ FakeApi <- R6::R6Class(
|
|||||||
#' test data_file to ensure it's escaped correctly
|
#' test data_file to ensure it's escaped correctly
|
||||||
#'
|
#'
|
||||||
#' @param dummy dummy required parameter
|
#' @param dummy dummy required parameter
|
||||||
#' @param var_data_file (optional) header data file
|
#' @param var_data_file (optional)header data file
|
||||||
#' @param data_file (optional) name of the data file to save the result
|
#' @param data_file (optional) name of the data file to save the result
|
||||||
#' @param ... Other optional arguments
|
#' @param ... Other optional arguments
|
||||||
#' @return User
|
#' @return User
|
||||||
#' @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
|
resp <- api_response$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
||||||
@ -129,7 +128,10 @@ FakeApi <- R6::R6Class(
|
|||||||
header_params <- c()
|
header_params <- c()
|
||||||
|
|
||||||
if (missing(`dummy`)) {
|
if (missing(`dummy`)) {
|
||||||
rlang::abort(message = "Missing required parameter `dummy`.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, reason = "Missing required parameter `dummy`."))
|
rlang::abort(message = "Missing required parameter `dummy`.",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(status = 0,
|
||||||
|
reason = "Missing required parameter `dummy`."))
|
||||||
}
|
}
|
||||||
|
|
||||||
body <- NULL
|
body <- NULL
|
||||||
@ -151,28 +153,36 @@ FakeApi <- R6::R6Class(
|
|||||||
deserialized_resp_obj <- tryCatch(
|
deserialized_resp_obj <- tryCatch(
|
||||||
self$api_client$deserialize(resp, "User", loadNamespace("petstore")),
|
self$api_client$deserialize(resp, "User", loadNamespace("petstore")),
|
||||||
error = function(e) {
|
error = function(e) {
|
||||||
rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = "Failed to deserialize response",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
ApiResponse$new(deserialized_resp_obj, resp)
|
ApiResponse$new(deserialized_resp_obj, resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if (error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api client exception encountered."
|
error_msg <- "Api client exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
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) {
|
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api server exception encountered."
|
error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#' @importFrom jsonlite fromJSON toJSON
|
#' @importFrom jsonlite fromJSON toJSON
|
||||||
#' @export
|
#' @export
|
||||||
ModelApiResponse <- R6::R6Class(
|
ModelApiResponse <- R6::R6Class(
|
||||||
'ModelApiResponse',
|
"ModelApiResponse",
|
||||||
public = list(
|
public = list(
|
||||||
`code` = NULL,
|
`code` = NULL,
|
||||||
`type` = NULL,
|
`type` = NULL,
|
||||||
@ -33,7 +33,7 @@ ModelApiResponse <- R6::R6Class(
|
|||||||
#' @param ... Other optional arguments.
|
#' @param ... Other optional arguments.
|
||||||
#' @export
|
#' @export
|
||||||
initialize = function(
|
initialize = function(
|
||||||
`code`=NULL, `type`=NULL, `message`=NULL, ...
|
`code` = NULL, `type` = NULL, `message` = NULL, ...
|
||||||
) {
|
) {
|
||||||
if (!is.null(`code`)) {
|
if (!is.null(`code`)) {
|
||||||
stopifnot(is.numeric(`code`), length(`code`) == 1)
|
stopifnot(is.numeric(`code`), length(`code`) == 1)
|
||||||
@ -58,15 +58,15 @@ ModelApiResponse <- R6::R6Class(
|
|||||||
toJSON = function() {
|
toJSON = function() {
|
||||||
ModelApiResponseObject <- list()
|
ModelApiResponseObject <- list()
|
||||||
if (!is.null(self$`code`)) {
|
if (!is.null(self$`code`)) {
|
||||||
ModelApiResponseObject[['code']] <-
|
ModelApiResponseObject[["code"]] <-
|
||||||
self$`code`
|
self$`code`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`type`)) {
|
if (!is.null(self$`type`)) {
|
||||||
ModelApiResponseObject[['type']] <-
|
ModelApiResponseObject[["type"]] <-
|
||||||
self$`type`
|
self$`type`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`message`)) {
|
if (!is.null(self$`message`)) {
|
||||||
ModelApiResponseObject[['message']] <-
|
ModelApiResponseObject[["message"]] <-
|
||||||
self$`message`
|
self$`message`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,29 +103,32 @@ ModelApiResponse <- R6::R6Class(
|
|||||||
toJSONString = function() {
|
toJSONString = function() {
|
||||||
jsoncontent <- c(
|
jsoncontent <- c(
|
||||||
if (!is.null(self$`code`)) {
|
if (!is.null(self$`code`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"code":
|
'"code":
|
||||||
%d
|
%d
|
||||||
',
|
',
|
||||||
self$`code`
|
self$`code`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`type`)) {
|
if (!is.null(self$`type`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"type":
|
'"type":
|
||||||
"%s"
|
"%s"
|
||||||
',
|
',
|
||||||
self$`type`
|
self$`type`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`message`)) {
|
if (!is.null(self$`message`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"message":
|
'"message":
|
||||||
"%s"
|
"%s"
|
||||||
',
|
',
|
||||||
self$`message`
|
self$`message`
|
||||||
)}
|
)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||||
as.character(jsonlite::minify(paste('{', jsoncontent, '}', sep = "")))
|
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||||
},
|
},
|
||||||
#' Deserialize JSON string into an instance of ModelApiResponse
|
#' Deserialize JSON string into an instance of ModelApiResponse
|
||||||
#'
|
#'
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#' @importFrom jsonlite fromJSON toJSON
|
#' @importFrom jsonlite fromJSON toJSON
|
||||||
#' @export
|
#' @export
|
||||||
NestedOneOf <- R6::R6Class(
|
NestedOneOf <- R6::R6Class(
|
||||||
'NestedOneOf',
|
"NestedOneOf",
|
||||||
public = list(
|
public = list(
|
||||||
`size` = NULL,
|
`size` = NULL,
|
||||||
`nested_pig` = NULL,
|
`nested_pig` = NULL,
|
||||||
@ -30,7 +30,7 @@ NestedOneOf <- R6::R6Class(
|
|||||||
#' @param ... Other optional arguments.
|
#' @param ... Other optional arguments.
|
||||||
#' @export
|
#' @export
|
||||||
initialize = function(
|
initialize = function(
|
||||||
`size`=NULL, `nested_pig`=NULL, ...
|
`size` = NULL, `nested_pig` = NULL, ...
|
||||||
) {
|
) {
|
||||||
if (!is.null(`size`)) {
|
if (!is.null(`size`)) {
|
||||||
stopifnot(is.numeric(`size`), length(`size`) == 1)
|
stopifnot(is.numeric(`size`), length(`size`) == 1)
|
||||||
@ -51,11 +51,11 @@ NestedOneOf <- R6::R6Class(
|
|||||||
toJSON = function() {
|
toJSON = function() {
|
||||||
NestedOneOfObject <- list()
|
NestedOneOfObject <- list()
|
||||||
if (!is.null(self$`size`)) {
|
if (!is.null(self$`size`)) {
|
||||||
NestedOneOfObject[['size']] <-
|
NestedOneOfObject[["size"]] <-
|
||||||
self$`size`
|
self$`size`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`nested_pig`)) {
|
if (!is.null(self$`nested_pig`)) {
|
||||||
NestedOneOfObject[['nested_pig']] <-
|
NestedOneOfObject[["nested_pig"]] <-
|
||||||
self$`nested_pig`$toJSON()
|
self$`nested_pig`$toJSON()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,22 +91,24 @@ NestedOneOf <- R6::R6Class(
|
|||||||
toJSONString = function() {
|
toJSONString = function() {
|
||||||
jsoncontent <- c(
|
jsoncontent <- c(
|
||||||
if (!is.null(self$`size`)) {
|
if (!is.null(self$`size`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"size":
|
'"size":
|
||||||
%d
|
%d
|
||||||
',
|
',
|
||||||
self$`size`
|
self$`size`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`nested_pig`)) {
|
if (!is.null(self$`nested_pig`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"nested_pig":
|
'"nested_pig":
|
||||||
%s
|
%s
|
||||||
',
|
',
|
||||||
jsonlite::toJSON(self$`nested_pig`$toJSON(), auto_unbox=TRUE, digits = NA)
|
jsonlite::toJSON(self$`nested_pig`$toJSON(), auto_unbox=TRUE, digits = NA)
|
||||||
)}
|
)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||||
as.character(jsonlite::minify(paste('{', jsoncontent, '}', sep = "")))
|
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||||
},
|
},
|
||||||
#' Deserialize JSON string into an instance of NestedOneOf
|
#' Deserialize JSON string into an instance of NestedOneOf
|
||||||
#'
|
#'
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#' @importFrom jsonlite fromJSON toJSON
|
#' @importFrom jsonlite fromJSON toJSON
|
||||||
#' @export
|
#' @export
|
||||||
Order <- R6::R6Class(
|
Order <- R6::R6Class(
|
||||||
'Order',
|
"Order",
|
||||||
public = list(
|
public = list(
|
||||||
`id` = NULL,
|
`id` = NULL,
|
||||||
`petId` = NULL,
|
`petId` = NULL,
|
||||||
@ -42,7 +42,7 @@ Order <- R6::R6Class(
|
|||||||
#' @param ... Other optional arguments.
|
#' @param ... Other optional arguments.
|
||||||
#' @export
|
#' @export
|
||||||
initialize = function(
|
initialize = function(
|
||||||
`id`=NULL, `petId`=NULL, `quantity`=NULL, `shipDate`=NULL, `status`=NULL, `complete`=FALSE, ...
|
`id` = NULL, `petId` = NULL, `quantity` = NULL, `shipDate` = NULL, `status` = NULL, `complete` = FALSE, ...
|
||||||
) {
|
) {
|
||||||
if (!is.null(`id`)) {
|
if (!is.null(`id`)) {
|
||||||
stopifnot(is.numeric(`id`), length(`id`) == 1)
|
stopifnot(is.numeric(`id`), length(`id`) == 1)
|
||||||
@ -79,27 +79,27 @@ Order <- R6::R6Class(
|
|||||||
toJSON = function() {
|
toJSON = function() {
|
||||||
OrderObject <- list()
|
OrderObject <- list()
|
||||||
if (!is.null(self$`id`)) {
|
if (!is.null(self$`id`)) {
|
||||||
OrderObject[['id']] <-
|
OrderObject[["id"]] <-
|
||||||
self$`id`
|
self$`id`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`petId`)) {
|
if (!is.null(self$`petId`)) {
|
||||||
OrderObject[['petId']] <-
|
OrderObject[["petId"]] <-
|
||||||
self$`petId`
|
self$`petId`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`quantity`)) {
|
if (!is.null(self$`quantity`)) {
|
||||||
OrderObject[['quantity']] <-
|
OrderObject[["quantity"]] <-
|
||||||
self$`quantity`
|
self$`quantity`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`shipDate`)) {
|
if (!is.null(self$`shipDate`)) {
|
||||||
OrderObject[['shipDate']] <-
|
OrderObject[["shipDate"]] <-
|
||||||
self$`shipDate`
|
self$`shipDate`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`status`)) {
|
if (!is.null(self$`status`)) {
|
||||||
OrderObject[['status']] <-
|
OrderObject[["status"]] <-
|
||||||
self$`status`
|
self$`status`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`complete`)) {
|
if (!is.null(self$`complete`)) {
|
||||||
OrderObject[['complete']] <-
|
OrderObject[["complete"]] <-
|
||||||
self$`complete`
|
self$`complete`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,50 +145,56 @@ Order <- R6::R6Class(
|
|||||||
toJSONString = function() {
|
toJSONString = function() {
|
||||||
jsoncontent <- c(
|
jsoncontent <- c(
|
||||||
if (!is.null(self$`id`)) {
|
if (!is.null(self$`id`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"id":
|
'"id":
|
||||||
%d
|
%d
|
||||||
',
|
',
|
||||||
self$`id`
|
self$`id`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`petId`)) {
|
if (!is.null(self$`petId`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"petId":
|
'"petId":
|
||||||
%d
|
%d
|
||||||
',
|
',
|
||||||
self$`petId`
|
self$`petId`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`quantity`)) {
|
if (!is.null(self$`quantity`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"quantity":
|
'"quantity":
|
||||||
%d
|
%d
|
||||||
',
|
',
|
||||||
self$`quantity`
|
self$`quantity`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`shipDate`)) {
|
if (!is.null(self$`shipDate`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"shipDate":
|
'"shipDate":
|
||||||
"%s"
|
"%s"
|
||||||
',
|
',
|
||||||
self$`shipDate`
|
self$`shipDate`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`status`)) {
|
if (!is.null(self$`status`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"status":
|
'"status":
|
||||||
"%s"
|
"%s"
|
||||||
',
|
',
|
||||||
self$`status`
|
self$`status`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`complete`)) {
|
if (!is.null(self$`complete`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"complete":
|
'"complete":
|
||||||
%s
|
%s
|
||||||
',
|
',
|
||||||
tolower(self$`complete`)
|
tolower(self$`complete`)
|
||||||
)}
|
)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||||
as.character(jsonlite::minify(paste('{', jsoncontent, '}', sep = "")))
|
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||||
},
|
},
|
||||||
#' Deserialize JSON string into an instance of Order
|
#' Deserialize JSON string into an instance of Order
|
||||||
#'
|
#'
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#' @importFrom jsonlite fromJSON toJSON
|
#' @importFrom jsonlite fromJSON toJSON
|
||||||
#' @export
|
#' @export
|
||||||
Pet <- R6::R6Class(
|
Pet <- R6::R6Class(
|
||||||
'Pet',
|
"Pet",
|
||||||
public = list(
|
public = list(
|
||||||
`id` = NULL,
|
`id` = NULL,
|
||||||
`category` = NULL,
|
`category` = NULL,
|
||||||
@ -42,7 +42,7 @@ Pet <- R6::R6Class(
|
|||||||
#' @param ... Other optional arguments.
|
#' @param ... Other optional arguments.
|
||||||
#' @export
|
#' @export
|
||||||
initialize = function(
|
initialize = function(
|
||||||
`name`, `photoUrls`, `id`=NULL, `category`=NULL, `tags`=NULL, `status`=NULL, ...
|
`name`, `photoUrls`, `id` = NULL, `category` = NULL, `tags` = NULL, `status` = NULL, ...
|
||||||
) {
|
) {
|
||||||
if (!missing(`name`)) {
|
if (!missing(`name`)) {
|
||||||
stopifnot(is.character(`name`), length(`name`) == 1)
|
stopifnot(is.character(`name`), length(`name`) == 1)
|
||||||
@ -81,27 +81,27 @@ Pet <- R6::R6Class(
|
|||||||
toJSON = function() {
|
toJSON = function() {
|
||||||
PetObject <- list()
|
PetObject <- list()
|
||||||
if (!is.null(self$`id`)) {
|
if (!is.null(self$`id`)) {
|
||||||
PetObject[['id']] <-
|
PetObject[["id"]] <-
|
||||||
self$`id`
|
self$`id`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`category`)) {
|
if (!is.null(self$`category`)) {
|
||||||
PetObject[['category']] <-
|
PetObject[["category"]] <-
|
||||||
self$`category`$toJSON()
|
self$`category`$toJSON()
|
||||||
}
|
}
|
||||||
if (!is.null(self$`name`)) {
|
if (!is.null(self$`name`)) {
|
||||||
PetObject[['name']] <-
|
PetObject[["name"]] <-
|
||||||
self$`name`
|
self$`name`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`photoUrls`)) {
|
if (!is.null(self$`photoUrls`)) {
|
||||||
PetObject[['photoUrls']] <-
|
PetObject[["photoUrls"]] <-
|
||||||
self$`photoUrls`
|
self$`photoUrls`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`tags`)) {
|
if (!is.null(self$`tags`)) {
|
||||||
PetObject[['tags']] <-
|
PetObject[["tags"]] <-
|
||||||
lapply(self$`tags`, function(x) x$toJSON())
|
lapply(self$`tags`, function(x) x$toJSON())
|
||||||
}
|
}
|
||||||
if (!is.null(self$`status`)) {
|
if (!is.null(self$`status`)) {
|
||||||
PetObject[['status']] <-
|
PetObject[["status"]] <-
|
||||||
self$`status`
|
self$`status`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,50 +149,56 @@ Pet <- R6::R6Class(
|
|||||||
toJSONString = function() {
|
toJSONString = function() {
|
||||||
jsoncontent <- c(
|
jsoncontent <- c(
|
||||||
if (!is.null(self$`id`)) {
|
if (!is.null(self$`id`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"id":
|
'"id":
|
||||||
%d
|
%d
|
||||||
',
|
',
|
||||||
self$`id`
|
self$`id`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`category`)) {
|
if (!is.null(self$`category`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"category":
|
'"category":
|
||||||
%s
|
%s
|
||||||
',
|
',
|
||||||
jsonlite::toJSON(self$`category`$toJSON(), auto_unbox=TRUE, digits = NA)
|
jsonlite::toJSON(self$`category`$toJSON(), auto_unbox=TRUE, digits = NA)
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`name`)) {
|
if (!is.null(self$`name`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"name":
|
'"name":
|
||||||
"%s"
|
"%s"
|
||||||
',
|
',
|
||||||
self$`name`
|
self$`name`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`photoUrls`)) {
|
if (!is.null(self$`photoUrls`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"photoUrls":
|
'"photoUrls":
|
||||||
[%s]
|
[%s]
|
||||||
',
|
',
|
||||||
paste(unlist(lapply(self$`photoUrls`, function(x) paste0('"', x, '"'))), collapse=",")
|
paste(unlist(lapply(self$`photoUrls`, function(x) paste0('"', x, '"'))), collapse=",")
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`tags`)) {
|
if (!is.null(self$`tags`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"tags":
|
'"tags":
|
||||||
[%s]
|
[%s]
|
||||||
',
|
',
|
||||||
paste(sapply(self$`tags`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
|
paste(sapply(self$`tags`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`status`)) {
|
if (!is.null(self$`status`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"status":
|
'"status":
|
||||||
"%s"
|
"%s"
|
||||||
',
|
',
|
||||||
self$`status`
|
self$`status`
|
||||||
)}
|
)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||||
as.character(jsonlite::minify(paste('{', jsoncontent, '}', sep = "")))
|
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||||
},
|
},
|
||||||
#' Deserialize JSON string into an instance of Pet
|
#' Deserialize JSON string into an instance of Pet
|
||||||
#'
|
#'
|
||||||
|
@ -286,7 +286,7 @@
|
|||||||
#'
|
#'
|
||||||
#' library(petstore)
|
#' library(petstore)
|
||||||
#' var.pet_id <- 56 # integer | Pet id to delete
|
#' var.pet_id <- 56 # integer | Pet id to delete
|
||||||
#' var.api_key <- 'api_key_example' # character |
|
#' var.api_key <- "api_key_example" # character |
|
||||||
#'
|
#'
|
||||||
#' #Deletes a pet
|
#' #Deletes a pet
|
||||||
#' api.instance <- PetApi$new()
|
#' api.instance <- PetApi$new()
|
||||||
@ -312,7 +312,7 @@
|
|||||||
#' #################### FindPetsByStatus ####################
|
#' #################### FindPetsByStatus ####################
|
||||||
#'
|
#'
|
||||||
#' library(petstore)
|
#' library(petstore)
|
||||||
#' var.status <- ['status_example'] # array[character] | Status values that need to be considered for filter
|
#' var.status <- ["status_example"] # array[character] | Status values that need to be considered for filter
|
||||||
#'
|
#'
|
||||||
#' #Finds Pets by status
|
#' #Finds Pets by status
|
||||||
#' api.instance <- PetApi$new()
|
#' api.instance <- PetApi$new()
|
||||||
@ -340,7 +340,7 @@
|
|||||||
#' #################### FindPetsByTags ####################
|
#' #################### FindPetsByTags ####################
|
||||||
#'
|
#'
|
||||||
#' library(petstore)
|
#' library(petstore)
|
||||||
#' var.tags <- ['tags_example'] # array[character] | Tags to filter by
|
#' var.tags <- ["tags_example"] # array[character] | Tags to filter by
|
||||||
#'
|
#'
|
||||||
#' #Finds Pets by tags
|
#' #Finds Pets by tags
|
||||||
#' api.instance <- PetApi$new()
|
#' api.instance <- PetApi$new()
|
||||||
@ -453,8 +453,8 @@
|
|||||||
#'
|
#'
|
||||||
#' library(petstore)
|
#' library(petstore)
|
||||||
#' var.pet_id <- 56 # integer | ID of pet that needs to be updated
|
#' var.pet_id <- 56 # integer | ID of pet that needs to be updated
|
||||||
#' var.name <- 'name_example' # character | Updated name of the pet
|
#' var.name <- "name_example" # character | Updated name of the pet
|
||||||
#' var.status <- 'status_example' # character | Updated status of the pet
|
#' var.status <- "status_example" # character | Updated status of the pet
|
||||||
#'
|
#'
|
||||||
#' #Updates a pet in the store with form data
|
#' #Updates a pet in the store with form data
|
||||||
#' api.instance <- PetApi$new()
|
#' api.instance <- PetApi$new()
|
||||||
@ -481,7 +481,7 @@
|
|||||||
#'
|
#'
|
||||||
#' library(petstore)
|
#' library(petstore)
|
||||||
#' var.pet_id <- 56 # integer | ID of pet to update
|
#' var.pet_id <- 56 # integer | ID of pet to update
|
||||||
#' var.additional_metadata <- 'additional_metadata_example' # character | Additional data to pass to server
|
#' var.additional_metadata <- "additional_metadata_example" # character | Additional data to pass to server
|
||||||
#' var.file <- File.new('/path/to/file') # data.frame | file to upload
|
#' var.file <- File.new('/path/to/file') # data.frame | file to upload
|
||||||
#'
|
#'
|
||||||
#' #uploads an image
|
#' #uploads an image
|
||||||
@ -526,8 +526,7 @@ PetApi <- R6::R6Class(
|
|||||||
initialize = function(api_client) {
|
initialize = function(api_client) {
|
||||||
if (!missing(api_client)) {
|
if (!missing(api_client)) {
|
||||||
self$api_client <- api_client
|
self$api_client <- api_client
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
self$api_client <- ApiClient$new()
|
self$api_client <- ApiClient$new()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -541,7 +540,7 @@ PetApi <- R6::R6Class(
|
|||||||
#' @param ... Other optional arguments
|
#' @param ... Other optional arguments
|
||||||
#' @return Pet
|
#' @return Pet
|
||||||
#' @export
|
#' @export
|
||||||
AddPet = function(pet, data_file=NULL, ...) {
|
AddPet = function(pet, data_file = NULL, ...) {
|
||||||
api_response <- self$AddPetWithHttpInfo(pet, data_file = data_file, ...)
|
api_response <- self$AddPetWithHttpInfo(pet, data_file = data_file, ...)
|
||||||
resp <- api_response$response
|
resp <- api_response$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
||||||
@ -570,7 +569,10 @@ PetApi <- R6::R6Class(
|
|||||||
header_params <- c()
|
header_params <- c()
|
||||||
|
|
||||||
if (missing(`pet`)) {
|
if (missing(`pet`)) {
|
||||||
rlang::abort(message = "Missing required parameter `pet`.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, reason = "Missing required parameter `pet`."))
|
rlang::abort(message = "Missing required parameter `pet`.",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(status = 0,
|
||||||
|
reason = "Missing required parameter `pet`."))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!missing(`pet`)) {
|
if (!missing(`pet`)) {
|
||||||
@ -599,28 +601,36 @@ PetApi <- R6::R6Class(
|
|||||||
deserialized_resp_obj <- tryCatch(
|
deserialized_resp_obj <- tryCatch(
|
||||||
self$api_client$deserialize(resp, "Pet", loadNamespace("petstore")),
|
self$api_client$deserialize(resp, "Pet", loadNamespace("petstore")),
|
||||||
error = function(e) {
|
error = function(e) {
|
||||||
rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = "Failed to deserialize response",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
ApiResponse$new(deserialized_resp_obj, resp)
|
ApiResponse$new(deserialized_resp_obj, resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if (error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api client exception encountered."
|
error_msg <- "Api client exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
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) {
|
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api server exception encountered."
|
error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
#' Deletes a pet
|
#' Deletes a pet
|
||||||
@ -662,7 +672,10 @@ PetApi <- R6::R6Class(
|
|||||||
header_params <- c()
|
header_params <- c()
|
||||||
|
|
||||||
if (missing(`pet_id`)) {
|
if (missing(`pet_id`)) {
|
||||||
rlang::abort(message = "Missing required parameter `pet_id`.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, reason = "Missing required parameter `pet_id`."))
|
rlang::abort(message = "Missing required parameter `pet_id`.",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(status = 0,
|
||||||
|
reason = "Missing required parameter `pet_id`."))
|
||||||
}
|
}
|
||||||
|
|
||||||
body <- NULL
|
body <- NULL
|
||||||
@ -685,22 +698,28 @@ PetApi <- R6::R6Class(
|
|||||||
ApiResponse$new(NULL, resp)
|
ApiResponse$new(NULL, resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if (error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api client exception encountered."
|
error_msg <- "Api client exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
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) {
|
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api server exception encountered."
|
error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
#' Finds Pets by status
|
#' Finds Pets by status
|
||||||
@ -713,7 +732,7 @@ PetApi <- R6::R6Class(
|
|||||||
#' @param ... Other optional arguments
|
#' @param ... Other optional arguments
|
||||||
#' @return array[Pet]
|
#' @return array[Pet]
|
||||||
#' @export
|
#' @export
|
||||||
FindPetsByStatus = function(status, data_file=NULL, ...) {
|
FindPetsByStatus = function(status, data_file = NULL, ...) {
|
||||||
api_response <- self$FindPetsByStatusWithHttpInfo(status, data_file = data_file, ...)
|
api_response <- self$FindPetsByStatusWithHttpInfo(status, data_file = data_file, ...)
|
||||||
resp <- api_response$response
|
resp <- api_response$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
||||||
@ -742,7 +761,10 @@ PetApi <- R6::R6Class(
|
|||||||
header_params <- c()
|
header_params <- c()
|
||||||
|
|
||||||
if (missing(`status`)) {
|
if (missing(`status`)) {
|
||||||
rlang::abort(message = "Missing required parameter `status`.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, reason = "Missing required parameter `status`."))
|
rlang::abort(message = "Missing required parameter `status`.",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(status = 0,
|
||||||
|
reason = "Missing required parameter `status`."))
|
||||||
}
|
}
|
||||||
|
|
||||||
body <- NULL
|
body <- NULL
|
||||||
@ -766,28 +788,36 @@ PetApi <- R6::R6Class(
|
|||||||
deserialized_resp_obj <- tryCatch(
|
deserialized_resp_obj <- tryCatch(
|
||||||
self$api_client$deserialize(resp, "array[Pet]", loadNamespace("petstore")),
|
self$api_client$deserialize(resp, "array[Pet]", loadNamespace("petstore")),
|
||||||
error = function(e) {
|
error = function(e) {
|
||||||
rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = "Failed to deserialize response",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
ApiResponse$new(deserialized_resp_obj, resp)
|
ApiResponse$new(deserialized_resp_obj, resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if (error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api client exception encountered."
|
error_msg <- "Api client exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
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) {
|
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api server exception encountered."
|
error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
#' Finds Pets by tags
|
#' Finds Pets by tags
|
||||||
@ -800,7 +830,7 @@ PetApi <- R6::R6Class(
|
|||||||
#' @param ... Other optional arguments
|
#' @param ... Other optional arguments
|
||||||
#' @return array[Pet]
|
#' @return array[Pet]
|
||||||
#' @export
|
#' @export
|
||||||
FindPetsByTags = function(tags, data_file=NULL, ...) {
|
FindPetsByTags = function(tags, data_file = NULL, ...) {
|
||||||
api_response <- self$FindPetsByTagsWithHttpInfo(tags, data_file = data_file, ...)
|
api_response <- self$FindPetsByTagsWithHttpInfo(tags, data_file = data_file, ...)
|
||||||
resp <- api_response$response
|
resp <- api_response$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
||||||
@ -829,7 +859,10 @@ PetApi <- R6::R6Class(
|
|||||||
header_params <- c()
|
header_params <- c()
|
||||||
|
|
||||||
if (missing(`tags`)) {
|
if (missing(`tags`)) {
|
||||||
rlang::abort(message = "Missing required parameter `tags`.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, reason = "Missing required parameter `tags`."))
|
rlang::abort(message = "Missing required parameter `tags`.",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(status = 0,
|
||||||
|
reason = "Missing required parameter `tags`."))
|
||||||
}
|
}
|
||||||
|
|
||||||
body <- NULL
|
body <- NULL
|
||||||
@ -853,28 +886,36 @@ PetApi <- R6::R6Class(
|
|||||||
deserialized_resp_obj <- tryCatch(
|
deserialized_resp_obj <- tryCatch(
|
||||||
self$api_client$deserialize(resp, "array[Pet]", loadNamespace("petstore")),
|
self$api_client$deserialize(resp, "array[Pet]", loadNamespace("petstore")),
|
||||||
error = function(e) {
|
error = function(e) {
|
||||||
rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = "Failed to deserialize response",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
ApiResponse$new(deserialized_resp_obj, resp)
|
ApiResponse$new(deserialized_resp_obj, resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if (error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api client exception encountered."
|
error_msg <- "Api client exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
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) {
|
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api server exception encountered."
|
error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
#' Find pet by ID
|
#' Find pet by ID
|
||||||
@ -887,7 +928,7 @@ PetApi <- R6::R6Class(
|
|||||||
#' @param ... Other optional arguments
|
#' @param ... Other optional arguments
|
||||||
#' @return Pet
|
#' @return Pet
|
||||||
#' @export
|
#' @export
|
||||||
GetPetById = function(pet_id, data_file=NULL, ...) {
|
GetPetById = function(pet_id, data_file = NULL, ...) {
|
||||||
api_response <- self$GetPetByIdWithHttpInfo(pet_id, data_file = data_file, ...)
|
api_response <- self$GetPetByIdWithHttpInfo(pet_id, data_file = data_file, ...)
|
||||||
resp <- api_response$response
|
resp <- api_response$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
||||||
@ -916,7 +957,10 @@ PetApi <- R6::R6Class(
|
|||||||
header_params <- c()
|
header_params <- c()
|
||||||
|
|
||||||
if (missing(`pet_id`)) {
|
if (missing(`pet_id`)) {
|
||||||
rlang::abort(message = "Missing required parameter `pet_id`.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, reason = "Missing required parameter `pet_id`."))
|
rlang::abort(message = "Missing required parameter `pet_id`.",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(status = 0,
|
||||||
|
reason = "Missing required parameter `pet_id`."))
|
||||||
}
|
}
|
||||||
|
|
||||||
body <- NULL
|
body <- NULL
|
||||||
@ -946,28 +990,36 @@ PetApi <- R6::R6Class(
|
|||||||
deserialized_resp_obj <- tryCatch(
|
deserialized_resp_obj <- tryCatch(
|
||||||
self$api_client$deserialize(resp, "Pet", loadNamespace("petstore")),
|
self$api_client$deserialize(resp, "Pet", loadNamespace("petstore")),
|
||||||
error = function(e) {
|
error = function(e) {
|
||||||
rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = "Failed to deserialize response",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
ApiResponse$new(deserialized_resp_obj, resp)
|
ApiResponse$new(deserialized_resp_obj, resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if (error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api client exception encountered."
|
error_msg <- "Api client exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
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) {
|
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api server exception encountered."
|
error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
#' Find pet by ID (streaming)
|
#' Find pet by ID (streaming)
|
||||||
@ -981,7 +1033,7 @@ PetApi <- R6::R6Class(
|
|||||||
#' @param ... Other optional arguments
|
#' @param ... Other optional arguments
|
||||||
#' @return Pet
|
#' @return Pet
|
||||||
#' @export
|
#' @export
|
||||||
GetPetByIdStreaming = function(pet_id, stream_callback=NULL, data_file=NULL, ...) {
|
GetPetByIdStreaming = function(pet_id, stream_callback=NULL, data_file = NULL, ...) {
|
||||||
api_response <- self$GetPetByIdStreamingWithHttpInfo(pet_id, stream_callback = stream_callback, data_file = data_file, ...)
|
api_response <- self$GetPetByIdStreamingWithHttpInfo(pet_id, stream_callback = stream_callback, data_file = data_file, ...)
|
||||||
if (typeof(stream_callback) == "closure") { # return void if streaming is enabled
|
if (typeof(stream_callback) == "closure") { # return void if streaming is enabled
|
||||||
return(invisible(NULL))
|
return(invisible(NULL))
|
||||||
@ -1015,7 +1067,10 @@ PetApi <- R6::R6Class(
|
|||||||
header_params <- c()
|
header_params <- c()
|
||||||
|
|
||||||
if (missing(`pet_id`)) {
|
if (missing(`pet_id`)) {
|
||||||
rlang::abort(message = "Missing required parameter `pet_id`.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, reason = "Missing required parameter `pet_id`."))
|
rlang::abort(message = "Missing required parameter `pet_id`.",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(status = 0,
|
||||||
|
reason = "Missing required parameter `pet_id`."))
|
||||||
}
|
}
|
||||||
|
|
||||||
body <- NULL
|
body <- NULL
|
||||||
@ -1050,28 +1105,36 @@ PetApi <- R6::R6Class(
|
|||||||
deserialized_resp_obj <- tryCatch(
|
deserialized_resp_obj <- tryCatch(
|
||||||
self$api_client$deserialize(resp, "Pet", loadNamespace("petstore")),
|
self$api_client$deserialize(resp, "Pet", loadNamespace("petstore")),
|
||||||
error = function(e) {
|
error = function(e) {
|
||||||
rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = "Failed to deserialize response",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
ApiResponse$new(deserialized_resp_obj, resp)
|
ApiResponse$new(deserialized_resp_obj, resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if (error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api client exception encountered."
|
error_msg <- "Api client exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
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) {
|
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api server exception encountered."
|
error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
#' Update an existing pet
|
#' Update an existing pet
|
||||||
@ -1084,7 +1147,7 @@ PetApi <- R6::R6Class(
|
|||||||
#' @param ... Other optional arguments
|
#' @param ... Other optional arguments
|
||||||
#' @return Pet
|
#' @return Pet
|
||||||
#' @export
|
#' @export
|
||||||
UpdatePet = function(pet, data_file=NULL, ...) {
|
UpdatePet = function(pet, data_file = NULL, ...) {
|
||||||
api_response <- self$UpdatePetWithHttpInfo(pet, data_file = data_file, ...)
|
api_response <- self$UpdatePetWithHttpInfo(pet, data_file = data_file, ...)
|
||||||
resp <- api_response$response
|
resp <- api_response$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
||||||
@ -1113,7 +1176,10 @@ PetApi <- R6::R6Class(
|
|||||||
header_params <- c()
|
header_params <- c()
|
||||||
|
|
||||||
if (missing(`pet`)) {
|
if (missing(`pet`)) {
|
||||||
rlang::abort(message = "Missing required parameter `pet`.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, reason = "Missing required parameter `pet`."))
|
rlang::abort(message = "Missing required parameter `pet`.",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(status = 0,
|
||||||
|
reason = "Missing required parameter `pet`."))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!missing(`pet`)) {
|
if (!missing(`pet`)) {
|
||||||
@ -1142,28 +1208,36 @@ PetApi <- R6::R6Class(
|
|||||||
deserialized_resp_obj <- tryCatch(
|
deserialized_resp_obj <- tryCatch(
|
||||||
self$api_client$deserialize(resp, "Pet", loadNamespace("petstore")),
|
self$api_client$deserialize(resp, "Pet", loadNamespace("petstore")),
|
||||||
error = function(e) {
|
error = function(e) {
|
||||||
rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = "Failed to deserialize response",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
ApiResponse$new(deserialized_resp_obj, resp)
|
ApiResponse$new(deserialized_resp_obj, resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if (error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api client exception encountered."
|
error_msg <- "Api client exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
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) {
|
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api server exception encountered."
|
error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
#' Updates a pet in the store with form data
|
#' Updates a pet in the store with form data
|
||||||
@ -1172,8 +1246,8 @@ PetApi <- R6::R6Class(
|
|||||||
#' Updates a pet in the store with form data
|
#' Updates a pet in the store with form data
|
||||||
#'
|
#'
|
||||||
#' @param pet_id ID of pet that needs to be updated
|
#' @param pet_id ID of pet that needs to be updated
|
||||||
#' @param name (optional) Updated name of the pet
|
#' @param name (optional)Updated name of the pet
|
||||||
#' @param status (optional) Updated status of the pet
|
#' @param status (optional)Updated status of the pet
|
||||||
#' @param ... Other optional arguments
|
#' @param ... Other optional arguments
|
||||||
#' @return void
|
#' @return void
|
||||||
#' @export
|
#' @export
|
||||||
@ -1207,7 +1281,10 @@ PetApi <- R6::R6Class(
|
|||||||
header_params <- c()
|
header_params <- c()
|
||||||
|
|
||||||
if (missing(`pet_id`)) {
|
if (missing(`pet_id`)) {
|
||||||
rlang::abort(message = "Missing required parameter `pet_id`.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, reason = "Missing required parameter `pet_id`."))
|
rlang::abort(message = "Missing required parameter `pet_id`.",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(status = 0,
|
||||||
|
reason = "Missing required parameter `pet_id`."))
|
||||||
}
|
}
|
||||||
|
|
||||||
body <- list(
|
body <- list(
|
||||||
@ -1234,22 +1311,28 @@ PetApi <- R6::R6Class(
|
|||||||
ApiResponse$new(NULL, resp)
|
ApiResponse$new(NULL, resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if (error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api client exception encountered."
|
error_msg <- "Api client exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
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) {
|
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api server exception encountered."
|
error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
#' uploads an image
|
#' uploads an image
|
||||||
@ -1258,13 +1341,13 @@ PetApi <- R6::R6Class(
|
|||||||
#' uploads an image
|
#' uploads an image
|
||||||
#'
|
#'
|
||||||
#' @param pet_id ID of pet to update
|
#' @param pet_id ID of pet to update
|
||||||
#' @param additional_metadata (optional) Additional data to pass to server
|
#' @param additional_metadata (optional)Additional data to pass to server
|
||||||
#' @param file (optional) file to upload
|
#' @param file (optional)file to upload
|
||||||
#' @param data_file (optional) name of the data file to save the result
|
#' @param data_file (optional) name of the data file to save the result
|
||||||
#' @param ... Other optional arguments
|
#' @param ... Other optional arguments
|
||||||
#' @return ModelApiResponse
|
#' @return ModelApiResponse
|
||||||
#' @export
|
#' @export
|
||||||
UploadFile = function(pet_id, additional_metadata=NULL, file=NULL, data_file=NULL, ...) {
|
UploadFile = function(pet_id, additional_metadata=NULL, file=NULL, data_file = NULL, ...) {
|
||||||
api_response <- self$UploadFileWithHttpInfo(pet_id, additional_metadata, file, data_file = data_file, ...)
|
api_response <- self$UploadFileWithHttpInfo(pet_id, additional_metadata, file, data_file = data_file, ...)
|
||||||
resp <- api_response$response
|
resp <- api_response$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
||||||
@ -1295,7 +1378,10 @@ PetApi <- R6::R6Class(
|
|||||||
header_params <- c()
|
header_params <- c()
|
||||||
|
|
||||||
if (missing(`pet_id`)) {
|
if (missing(`pet_id`)) {
|
||||||
rlang::abort(message = "Missing required parameter `pet_id`.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, reason = "Missing required parameter `pet_id`."))
|
rlang::abort(message = "Missing required parameter `pet_id`.",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(status = 0,
|
||||||
|
reason = "Missing required parameter `pet_id`."))
|
||||||
}
|
}
|
||||||
|
|
||||||
body <- list(
|
body <- list(
|
||||||
@ -1327,28 +1413,36 @@ PetApi <- R6::R6Class(
|
|||||||
deserialized_resp_obj <- tryCatch(
|
deserialized_resp_obj <- tryCatch(
|
||||||
self$api_client$deserialize(resp, "ModelApiResponse", loadNamespace("petstore")),
|
self$api_client$deserialize(resp, "ModelApiResponse", loadNamespace("petstore")),
|
||||||
error = function(e) {
|
error = function(e) {
|
||||||
rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = "Failed to deserialize response",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
ApiResponse$new(deserialized_resp_obj, resp)
|
ApiResponse$new(deserialized_resp_obj, resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if (error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api client exception encountered."
|
error_msg <- "Api client exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
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) {
|
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api server exception encountered."
|
error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#' @importFrom jsonlite fromJSON toJSON
|
#' @importFrom jsonlite fromJSON toJSON
|
||||||
#' @export
|
#' @export
|
||||||
Pig <- R6::R6Class(
|
Pig <- R6::R6Class(
|
||||||
'Pig',
|
"Pig",
|
||||||
public = list(
|
public = list(
|
||||||
#' @field actual_instance the object stored in this instance.
|
#' @field actual_instance the object stored in this instance.
|
||||||
actual_instance = NULL,
|
actual_instance = NULL,
|
||||||
@ -36,13 +36,14 @@ Pig <- R6::R6Class(
|
|||||||
if (is.null(instance)) {
|
if (is.null(instance)) {
|
||||||
# do nothing
|
# do nothing
|
||||||
} else if (get(class(instance)[[1]], pos = -1)$classname == "BasquePig") {
|
} else if (get(class(instance)[[1]], pos = -1)$classname == "BasquePig") {
|
||||||
self$actual_instance = instance
|
self$actual_instance <- instance
|
||||||
self$actual_type = "BasquePig"
|
self$actual_type <- "BasquePig"
|
||||||
} else if (get(class(instance)[[1]], pos = -1)$classname == "DanishPig") {
|
} else if (get(class(instance)[[1]], pos = -1)$classname == "DanishPig") {
|
||||||
self$actual_instance = instance
|
self$actual_instance <- instance
|
||||||
self$actual_type = "DanishPig"
|
self$actual_type <- "DanishPig"
|
||||||
} else {
|
} else {
|
||||||
stop(paste("Failed to initialize Pig with oneOf schemas BasquePig, DanishPig. Provided class name: ", get(class(instance)[[1]], pos = -1)$classname))
|
stop(paste("Failed to initialize Pig with oneOf schemas BasquePig, DanishPig. Provided class name: ",
|
||||||
|
get(class(instance)[[1]], pos = -1)$classname))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
#' Deserialize JSON string into an instance of Pig.
|
#' Deserialize JSON string into an instance of Pig.
|
||||||
@ -70,8 +71,8 @@ Pig <- R6::R6Class(
|
|||||||
error = function(err) err
|
error = function(err) err
|
||||||
)
|
)
|
||||||
|
|
||||||
if (!is.null(BasquePig_result['error'])) {
|
if (!is.null(BasquePig_result["error"])) {
|
||||||
error_messages <- append(error_messages, BasquePig_result['message'])
|
error_messages <- append(error_messages, BasquePig_result["message"])
|
||||||
}
|
}
|
||||||
|
|
||||||
DanishPig_result <- tryCatch({
|
DanishPig_result <- tryCatch({
|
||||||
@ -85,8 +86,8 @@ Pig <- R6::R6Class(
|
|||||||
error = function(err) err
|
error = function(err) err
|
||||||
)
|
)
|
||||||
|
|
||||||
if (!is.null(DanishPig_result['error'])) {
|
if (!is.null(DanishPig_result["error"])) {
|
||||||
error_messages <- append(error_messages, DanishPig_result['message'])
|
error_messages <- append(error_messages, DanishPig_result["message"])
|
||||||
}
|
}
|
||||||
|
|
||||||
if (matched == 1) {
|
if (matched == 1) {
|
||||||
@ -95,10 +96,11 @@ Pig <- R6::R6Class(
|
|||||||
self$actual_type <- instance_type
|
self$actual_type <- instance_type
|
||||||
} else if (matched > 1) {
|
} else if (matched > 1) {
|
||||||
# more than 1 match
|
# more than 1 match
|
||||||
stop("Multiple matches found when deserializing the payload into Pig with oneOf schemas BasquePig, DanishPig. ")
|
stop("Multiple matches found when deserializing the payload into Pig with oneOf schemas BasquePig, DanishPig.")
|
||||||
} else {
|
} else {
|
||||||
# no match
|
# no match
|
||||||
stop(paste("No match found when deserializing the payload into Pig with oneOf schemas BasquePig, DanishPig. Details: ", paste(error_messages, collapse = ', ')))
|
stop(paste("No match found when deserializing the payload into Pig with oneOf schemas BasquePig, DanishPig. Details: ",
|
||||||
|
paste(error_messages, collapse = ", ")))
|
||||||
}
|
}
|
||||||
|
|
||||||
self
|
self
|
||||||
@ -160,12 +162,12 @@ Pig <- R6::R6Class(
|
|||||||
#' @export
|
#' @export
|
||||||
toString = function() {
|
toString = function() {
|
||||||
jsoncontent <- c(
|
jsoncontent <- c(
|
||||||
sprintf('"actual_instance": %s', if (is.null(self$actual_instance)) {NULL} else {self$actual_instance$toJSONString()}),
|
sprintf('"actual_instance": %s', if (is.null(self$actual_instance)) NULL else self$actual_instance$toJSONString()),
|
||||||
sprintf('"actual_type": "%s"', self$actual_type),
|
sprintf('"actual_type": "%s"', self$actual_type),
|
||||||
sprintf('"one_of": "%s"', paste( unlist(self$one_of), collapse=', '))
|
sprintf('"one_of": "%s"', paste(unlist(self$one_of), collapse = ", "))
|
||||||
)
|
)
|
||||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||||
as.character(jsonlite::prettify(paste('{', jsoncontent, '}', sep = "")))
|
as.character(jsonlite::prettify(paste("{", jsoncontent, "}", sep = "")))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#' @importFrom jsonlite fromJSON toJSON
|
#' @importFrom jsonlite fromJSON toJSON
|
||||||
#' @export
|
#' @export
|
||||||
Special <- R6::R6Class(
|
Special <- R6::R6Class(
|
||||||
'Special',
|
"Special",
|
||||||
public = list(
|
public = list(
|
||||||
`item_self` = NULL,
|
`item_self` = NULL,
|
||||||
`item_private` = NULL,
|
`item_private` = NULL,
|
||||||
@ -42,7 +42,7 @@ Special <- R6::R6Class(
|
|||||||
#' @param ... Other optional arguments.
|
#' @param ... Other optional arguments.
|
||||||
#' @export
|
#' @export
|
||||||
initialize = function(
|
initialize = function(
|
||||||
`item_self`=NULL, `item_private`=NULL, `item_super`=NULL, `123_number`=NULL, `array[test]`=NULL, `empty_string`=NULL, ...
|
`item_self` = NULL, `item_private` = NULL, `item_super` = NULL, `123_number` = NULL, `array[test]` = NULL, `empty_string` = NULL, ...
|
||||||
) {
|
) {
|
||||||
if (!is.null(`item_self`)) {
|
if (!is.null(`item_self`)) {
|
||||||
stopifnot(is.numeric(`item_self`), length(`item_self`) == 1)
|
stopifnot(is.numeric(`item_self`), length(`item_self`) == 1)
|
||||||
@ -79,27 +79,27 @@ Special <- R6::R6Class(
|
|||||||
toJSON = function() {
|
toJSON = function() {
|
||||||
SpecialObject <- list()
|
SpecialObject <- list()
|
||||||
if (!is.null(self$`item_self`)) {
|
if (!is.null(self$`item_self`)) {
|
||||||
SpecialObject[['self']] <-
|
SpecialObject[["self"]] <-
|
||||||
self$`item_self`
|
self$`item_self`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`item_private`)) {
|
if (!is.null(self$`item_private`)) {
|
||||||
SpecialObject[['private']] <-
|
SpecialObject[["private"]] <-
|
||||||
self$`item_private`
|
self$`item_private`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`item_super`)) {
|
if (!is.null(self$`item_super`)) {
|
||||||
SpecialObject[['super']] <-
|
SpecialObject[["super"]] <-
|
||||||
self$`item_super`
|
self$`item_super`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`123_number`)) {
|
if (!is.null(self$`123_number`)) {
|
||||||
SpecialObject[['123_number']] <-
|
SpecialObject[["123_number"]] <-
|
||||||
self$`123_number`
|
self$`123_number`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`array[test]`)) {
|
if (!is.null(self$`array[test]`)) {
|
||||||
SpecialObject[['array[test]']] <-
|
SpecialObject[["array[test]"]] <-
|
||||||
self$`array[test]`
|
self$`array[test]`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`empty_string`)) {
|
if (!is.null(self$`empty_string`)) {
|
||||||
SpecialObject[['empty_string']] <-
|
SpecialObject[["empty_string"]] <-
|
||||||
self$`empty_string`
|
self$`empty_string`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,50 +145,56 @@ Special <- R6::R6Class(
|
|||||||
toJSONString = function() {
|
toJSONString = function() {
|
||||||
jsoncontent <- c(
|
jsoncontent <- c(
|
||||||
if (!is.null(self$`item_self`)) {
|
if (!is.null(self$`item_self`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"self":
|
'"self":
|
||||||
%d
|
%d
|
||||||
',
|
',
|
||||||
self$`item_self`
|
self$`item_self`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`item_private`)) {
|
if (!is.null(self$`item_private`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"private":
|
'"private":
|
||||||
"%s"
|
"%s"
|
||||||
',
|
',
|
||||||
self$`item_private`
|
self$`item_private`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`item_super`)) {
|
if (!is.null(self$`item_super`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"super":
|
'"super":
|
||||||
"%s"
|
"%s"
|
||||||
',
|
',
|
||||||
self$`item_super`
|
self$`item_super`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`123_number`)) {
|
if (!is.null(self$`123_number`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"123_number":
|
'"123_number":
|
||||||
"%s"
|
"%s"
|
||||||
',
|
',
|
||||||
self$`123_number`
|
self$`123_number`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`array[test]`)) {
|
if (!is.null(self$`array[test]`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"array[test]":
|
'"array[test]":
|
||||||
"%s"
|
"%s"
|
||||||
',
|
',
|
||||||
self$`array[test]`
|
self$`array[test]`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`empty_string`)) {
|
if (!is.null(self$`empty_string`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"empty_string":
|
'"empty_string":
|
||||||
"%s"
|
"%s"
|
||||||
',
|
',
|
||||||
self$`empty_string`
|
self$`empty_string`
|
||||||
)}
|
)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||||
as.character(jsonlite::minify(paste('{', jsoncontent, '}', sep = "")))
|
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||||
},
|
},
|
||||||
#' Deserialize JSON string into an instance of Special
|
#' Deserialize JSON string into an instance of Special
|
||||||
#'
|
#'
|
||||||
|
@ -119,7 +119,7 @@
|
|||||||
#' #################### DeleteOrder ####################
|
#' #################### DeleteOrder ####################
|
||||||
#'
|
#'
|
||||||
#' library(petstore)
|
#' library(petstore)
|
||||||
#' var.order_id <- 'order_id_example' # character | ID of the order that needs to be deleted
|
#' var.order_id <- "order_id_example" # character | ID of the order that needs to be deleted
|
||||||
#'
|
#'
|
||||||
#' #Delete purchase order by ID
|
#' #Delete purchase order by ID
|
||||||
#' api.instance <- StoreApi$new()
|
#' api.instance <- StoreApi$new()
|
||||||
@ -235,8 +235,7 @@ StoreApi <- R6::R6Class(
|
|||||||
initialize = function(api_client) {
|
initialize = function(api_client) {
|
||||||
if (!missing(api_client)) {
|
if (!missing(api_client)) {
|
||||||
self$api_client <- api_client
|
self$api_client <- api_client
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
self$api_client <- ApiClient$new()
|
self$api_client <- ApiClient$new()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -277,7 +276,10 @@ StoreApi <- R6::R6Class(
|
|||||||
header_params <- c()
|
header_params <- c()
|
||||||
|
|
||||||
if (missing(`order_id`)) {
|
if (missing(`order_id`)) {
|
||||||
rlang::abort(message = "Missing required parameter `order_id`.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, reason = "Missing required parameter `order_id`."))
|
rlang::abort(message = "Missing required parameter `order_id`.",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(status = 0,
|
||||||
|
reason = "Missing required parameter `order_id`."))
|
||||||
}
|
}
|
||||||
|
|
||||||
body <- NULL
|
body <- NULL
|
||||||
@ -298,22 +300,28 @@ StoreApi <- R6::R6Class(
|
|||||||
ApiResponse$new(NULL, resp)
|
ApiResponse$new(NULL, resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if (error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api client exception encountered."
|
error_msg <- "Api client exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
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) {
|
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api server exception encountered."
|
error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
#' Returns pet inventories by status
|
#' Returns pet inventories by status
|
||||||
@ -325,7 +333,7 @@ StoreApi <- R6::R6Class(
|
|||||||
#' @param ... Other optional arguments
|
#' @param ... Other optional arguments
|
||||||
#' @return map(integer)
|
#' @return map(integer)
|
||||||
#' @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
|
resp <- api_response$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
||||||
@ -375,28 +383,36 @@ StoreApi <- R6::R6Class(
|
|||||||
deserialized_resp_obj <- tryCatch(
|
deserialized_resp_obj <- tryCatch(
|
||||||
self$api_client$deserialize(resp, "map(integer)", loadNamespace("petstore")),
|
self$api_client$deserialize(resp, "map(integer)", loadNamespace("petstore")),
|
||||||
error = function(e) {
|
error = function(e) {
|
||||||
rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = "Failed to deserialize response",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
ApiResponse$new(deserialized_resp_obj, resp)
|
ApiResponse$new(deserialized_resp_obj, resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if (error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api client exception encountered."
|
error_msg <- "Api client exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
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) {
|
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api server exception encountered."
|
error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
#' Find purchase order by ID
|
#' Find purchase order by ID
|
||||||
@ -409,7 +425,7 @@ StoreApi <- R6::R6Class(
|
|||||||
#' @param ... Other optional arguments
|
#' @param ... Other optional arguments
|
||||||
#' @return Order
|
#' @return Order
|
||||||
#' @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
|
resp <- api_response$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
||||||
@ -438,7 +454,10 @@ StoreApi <- R6::R6Class(
|
|||||||
header_params <- c()
|
header_params <- c()
|
||||||
|
|
||||||
if (missing(`order_id`)) {
|
if (missing(`order_id`)) {
|
||||||
rlang::abort(message = "Missing required parameter `order_id`.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, reason = "Missing required parameter `order_id`."))
|
rlang::abort(message = "Missing required parameter `order_id`.",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(status = 0,
|
||||||
|
reason = "Missing required parameter `order_id`."))
|
||||||
}
|
}
|
||||||
|
|
||||||
body <- NULL
|
body <- NULL
|
||||||
@ -464,28 +483,36 @@ StoreApi <- R6::R6Class(
|
|||||||
deserialized_resp_obj <- tryCatch(
|
deserialized_resp_obj <- tryCatch(
|
||||||
self$api_client$deserialize(resp, "Order", loadNamespace("petstore")),
|
self$api_client$deserialize(resp, "Order", loadNamespace("petstore")),
|
||||||
error = function(e) {
|
error = function(e) {
|
||||||
rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = "Failed to deserialize response",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
ApiResponse$new(deserialized_resp_obj, resp)
|
ApiResponse$new(deserialized_resp_obj, resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if (error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api client exception encountered."
|
error_msg <- "Api client exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
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) {
|
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api server exception encountered."
|
error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
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
|
||||||
@ -498,7 +525,7 @@ StoreApi <- R6::R6Class(
|
|||||||
#' @param ... Other optional arguments
|
#' @param ... Other optional arguments
|
||||||
#' @return Order
|
#' @return Order
|
||||||
#' @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
|
resp <- api_response$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
||||||
@ -527,7 +554,10 @@ StoreApi <- R6::R6Class(
|
|||||||
header_params <- c()
|
header_params <- c()
|
||||||
|
|
||||||
if (missing(`order`)) {
|
if (missing(`order`)) {
|
||||||
rlang::abort(message = "Missing required parameter `order`.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, reason = "Missing required parameter `order`."))
|
rlang::abort(message = "Missing required parameter `order`.",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(status = 0,
|
||||||
|
reason = "Missing required parameter `order`."))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!missing(`order`)) {
|
if (!missing(`order`)) {
|
||||||
@ -554,28 +584,36 @@ StoreApi <- R6::R6Class(
|
|||||||
deserialized_resp_obj <- tryCatch(
|
deserialized_resp_obj <- tryCatch(
|
||||||
self$api_client$deserialize(resp, "Order", loadNamespace("petstore")),
|
self$api_client$deserialize(resp, "Order", loadNamespace("petstore")),
|
||||||
error = function(e) {
|
error = function(e) {
|
||||||
rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = "Failed to deserialize response",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
ApiResponse$new(deserialized_resp_obj, resp)
|
ApiResponse$new(deserialized_resp_obj, resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if (error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api client exception encountered."
|
error_msg <- "Api client exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
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) {
|
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api server exception encountered."
|
error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#' @importFrom jsonlite fromJSON toJSON
|
#' @importFrom jsonlite fromJSON toJSON
|
||||||
#' @export
|
#' @export
|
||||||
Tag <- R6::R6Class(
|
Tag <- R6::R6Class(
|
||||||
'Tag',
|
"Tag",
|
||||||
public = list(
|
public = list(
|
||||||
`id` = NULL,
|
`id` = NULL,
|
||||||
`name` = NULL,
|
`name` = NULL,
|
||||||
@ -30,7 +30,7 @@ Tag <- R6::R6Class(
|
|||||||
#' @param ... Other optional arguments.
|
#' @param ... Other optional arguments.
|
||||||
#' @export
|
#' @export
|
||||||
initialize = function(
|
initialize = function(
|
||||||
`id`=NULL, `name`=NULL, ...
|
`id` = NULL, `name` = NULL, ...
|
||||||
) {
|
) {
|
||||||
if (!is.null(`id`)) {
|
if (!is.null(`id`)) {
|
||||||
stopifnot(is.numeric(`id`), length(`id`) == 1)
|
stopifnot(is.numeric(`id`), length(`id`) == 1)
|
||||||
@ -51,11 +51,11 @@ Tag <- R6::R6Class(
|
|||||||
toJSON = function() {
|
toJSON = function() {
|
||||||
TagObject <- list()
|
TagObject <- list()
|
||||||
if (!is.null(self$`id`)) {
|
if (!is.null(self$`id`)) {
|
||||||
TagObject[['id']] <-
|
TagObject[["id"]] <-
|
||||||
self$`id`
|
self$`id`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`name`)) {
|
if (!is.null(self$`name`)) {
|
||||||
TagObject[['name']] <-
|
TagObject[["name"]] <-
|
||||||
self$`name`
|
self$`name`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,22 +89,24 @@ Tag <- R6::R6Class(
|
|||||||
toJSONString = function() {
|
toJSONString = function() {
|
||||||
jsoncontent <- c(
|
jsoncontent <- c(
|
||||||
if (!is.null(self$`id`)) {
|
if (!is.null(self$`id`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"id":
|
'"id":
|
||||||
%d
|
%d
|
||||||
',
|
',
|
||||||
self$`id`
|
self$`id`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`name`)) {
|
if (!is.null(self$`name`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"name":
|
'"name":
|
||||||
"%s"
|
"%s"
|
||||||
',
|
',
|
||||||
self$`name`
|
self$`name`
|
||||||
)}
|
)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||||
as.character(jsonlite::minify(paste('{', jsoncontent, '}', sep = "")))
|
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||||
},
|
},
|
||||||
#' Deserialize JSON string into an instance of Tag
|
#' Deserialize JSON string into an instance of Tag
|
||||||
#'
|
#'
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#' @importFrom jsonlite fromJSON toJSON
|
#' @importFrom jsonlite fromJSON toJSON
|
||||||
#' @export
|
#' @export
|
||||||
UpdatePetRequest <- R6::R6Class(
|
UpdatePetRequest <- R6::R6Class(
|
||||||
'UpdatePetRequest',
|
"UpdatePetRequest",
|
||||||
public = list(
|
public = list(
|
||||||
`jsonData` = NULL,
|
`jsonData` = NULL,
|
||||||
`binaryDataN2Information` = NULL,
|
`binaryDataN2Information` = NULL,
|
||||||
@ -30,7 +30,7 @@ UpdatePetRequest <- R6::R6Class(
|
|||||||
#' @param ... Other optional arguments.
|
#' @param ... Other optional arguments.
|
||||||
#' @export
|
#' @export
|
||||||
initialize = function(
|
initialize = function(
|
||||||
`jsonData`=NULL, `binaryDataN2Information`=NULL, ...
|
`jsonData` = NULL, `binaryDataN2Information` = NULL, ...
|
||||||
) {
|
) {
|
||||||
if (!is.null(`jsonData`)) {
|
if (!is.null(`jsonData`)) {
|
||||||
stopifnot(R6::is.R6(`jsonData`))
|
stopifnot(R6::is.R6(`jsonData`))
|
||||||
@ -50,11 +50,11 @@ UpdatePetRequest <- R6::R6Class(
|
|||||||
toJSON = function() {
|
toJSON = function() {
|
||||||
UpdatePetRequestObject <- list()
|
UpdatePetRequestObject <- list()
|
||||||
if (!is.null(self$`jsonData`)) {
|
if (!is.null(self$`jsonData`)) {
|
||||||
UpdatePetRequestObject[['jsonData']] <-
|
UpdatePetRequestObject[["jsonData"]] <-
|
||||||
self$`jsonData`$toJSON()
|
self$`jsonData`$toJSON()
|
||||||
}
|
}
|
||||||
if (!is.null(self$`binaryDataN2Information`)) {
|
if (!is.null(self$`binaryDataN2Information`)) {
|
||||||
UpdatePetRequestObject[['binaryDataN2Information']] <-
|
UpdatePetRequestObject[["binaryDataN2Information"]] <-
|
||||||
self$`binaryDataN2Information`
|
self$`binaryDataN2Information`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,22 +90,24 @@ UpdatePetRequest <- R6::R6Class(
|
|||||||
toJSONString = function() {
|
toJSONString = function() {
|
||||||
jsoncontent <- c(
|
jsoncontent <- c(
|
||||||
if (!is.null(self$`jsonData`)) {
|
if (!is.null(self$`jsonData`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"jsonData":
|
'"jsonData":
|
||||||
%s
|
%s
|
||||||
',
|
',
|
||||||
jsonlite::toJSON(self$`jsonData`$toJSON(), auto_unbox=TRUE, digits = NA)
|
jsonlite::toJSON(self$`jsonData`$toJSON(), auto_unbox=TRUE, digits = NA)
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`binaryDataN2Information`)) {
|
if (!is.null(self$`binaryDataN2Information`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"binaryDataN2Information":
|
'"binaryDataN2Information":
|
||||||
"%s"
|
"%s"
|
||||||
',
|
',
|
||||||
self$`binaryDataN2Information`
|
self$`binaryDataN2Information`
|
||||||
)}
|
)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||||
as.character(jsonlite::minify(paste('{', jsoncontent, '}', sep = "")))
|
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||||
},
|
},
|
||||||
#' Deserialize JSON string into an instance of UpdatePetRequest
|
#' Deserialize JSON string into an instance of UpdatePetRequest
|
||||||
#'
|
#'
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#' @importFrom jsonlite fromJSON toJSON
|
#' @importFrom jsonlite fromJSON toJSON
|
||||||
#' @export
|
#' @export
|
||||||
User <- R6::R6Class(
|
User <- R6::R6Class(
|
||||||
'User',
|
"User",
|
||||||
public = list(
|
public = list(
|
||||||
`id` = NULL,
|
`id` = NULL,
|
||||||
`username` = NULL,
|
`username` = NULL,
|
||||||
@ -48,7 +48,7 @@ User <- R6::R6Class(
|
|||||||
#' @param ... Other optional arguments.
|
#' @param ... Other optional arguments.
|
||||||
#' @export
|
#' @export
|
||||||
initialize = function(
|
initialize = function(
|
||||||
`id`=NULL, `username`=NULL, `firstName`=NULL, `lastName`=NULL, `email`=NULL, `password`=NULL, `phone`=NULL, `userStatus`=NULL, ...
|
`id` = NULL, `username` = NULL, `firstName` = NULL, `lastName` = NULL, `email` = NULL, `password` = NULL, `phone` = NULL, `userStatus` = NULL, ...
|
||||||
) {
|
) {
|
||||||
if (!is.null(`id`)) {
|
if (!is.null(`id`)) {
|
||||||
stopifnot(is.numeric(`id`), length(`id`) == 1)
|
stopifnot(is.numeric(`id`), length(`id`) == 1)
|
||||||
@ -93,35 +93,35 @@ User <- R6::R6Class(
|
|||||||
toJSON = function() {
|
toJSON = function() {
|
||||||
UserObject <- list()
|
UserObject <- list()
|
||||||
if (!is.null(self$`id`)) {
|
if (!is.null(self$`id`)) {
|
||||||
UserObject[['id']] <-
|
UserObject[["id"]] <-
|
||||||
self$`id`
|
self$`id`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`username`)) {
|
if (!is.null(self$`username`)) {
|
||||||
UserObject[['username']] <-
|
UserObject[["username"]] <-
|
||||||
self$`username`
|
self$`username`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`firstName`)) {
|
if (!is.null(self$`firstName`)) {
|
||||||
UserObject[['firstName']] <-
|
UserObject[["firstName"]] <-
|
||||||
self$`firstName`
|
self$`firstName`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`lastName`)) {
|
if (!is.null(self$`lastName`)) {
|
||||||
UserObject[['lastName']] <-
|
UserObject[["lastName"]] <-
|
||||||
self$`lastName`
|
self$`lastName`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`email`)) {
|
if (!is.null(self$`email`)) {
|
||||||
UserObject[['email']] <-
|
UserObject[["email"]] <-
|
||||||
self$`email`
|
self$`email`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`password`)) {
|
if (!is.null(self$`password`)) {
|
||||||
UserObject[['password']] <-
|
UserObject[["password"]] <-
|
||||||
self$`password`
|
self$`password`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`phone`)) {
|
if (!is.null(self$`phone`)) {
|
||||||
UserObject[['phone']] <-
|
UserObject[["phone"]] <-
|
||||||
self$`phone`
|
self$`phone`
|
||||||
}
|
}
|
||||||
if (!is.null(self$`userStatus`)) {
|
if (!is.null(self$`userStatus`)) {
|
||||||
UserObject[['userStatus']] <-
|
UserObject[["userStatus"]] <-
|
||||||
self$`userStatus`
|
self$`userStatus`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,64 +173,72 @@ User <- R6::R6Class(
|
|||||||
toJSONString = function() {
|
toJSONString = function() {
|
||||||
jsoncontent <- c(
|
jsoncontent <- c(
|
||||||
if (!is.null(self$`id`)) {
|
if (!is.null(self$`id`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"id":
|
'"id":
|
||||||
%d
|
%d
|
||||||
',
|
',
|
||||||
self$`id`
|
self$`id`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`username`)) {
|
if (!is.null(self$`username`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"username":
|
'"username":
|
||||||
"%s"
|
"%s"
|
||||||
',
|
',
|
||||||
self$`username`
|
self$`username`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`firstName`)) {
|
if (!is.null(self$`firstName`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"firstName":
|
'"firstName":
|
||||||
"%s"
|
"%s"
|
||||||
',
|
',
|
||||||
self$`firstName`
|
self$`firstName`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`lastName`)) {
|
if (!is.null(self$`lastName`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"lastName":
|
'"lastName":
|
||||||
"%s"
|
"%s"
|
||||||
',
|
',
|
||||||
self$`lastName`
|
self$`lastName`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`email`)) {
|
if (!is.null(self$`email`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"email":
|
'"email":
|
||||||
"%s"
|
"%s"
|
||||||
',
|
',
|
||||||
self$`email`
|
self$`email`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`password`)) {
|
if (!is.null(self$`password`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"password":
|
'"password":
|
||||||
"%s"
|
"%s"
|
||||||
',
|
',
|
||||||
self$`password`
|
self$`password`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`phone`)) {
|
if (!is.null(self$`phone`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"phone":
|
'"phone":
|
||||||
"%s"
|
"%s"
|
||||||
',
|
',
|
||||||
self$`phone`
|
self$`phone`
|
||||||
)},
|
)
|
||||||
|
},
|
||||||
if (!is.null(self$`userStatus`)) {
|
if (!is.null(self$`userStatus`)) {
|
||||||
sprintf(
|
sprintf(
|
||||||
'"userStatus":
|
'"userStatus":
|
||||||
%d
|
%d
|
||||||
',
|
',
|
||||||
self$`userStatus`
|
self$`userStatus`
|
||||||
)}
|
)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||||
as.character(jsonlite::minify(paste('{', jsoncontent, '}', sep = "")))
|
as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||||
},
|
},
|
||||||
#' Deserialize JSON string into an instance of User
|
#' Deserialize JSON string into an instance of User
|
||||||
#'
|
#'
|
||||||
|
@ -276,7 +276,7 @@
|
|||||||
#' #################### DeleteUser ####################
|
#' #################### DeleteUser ####################
|
||||||
#'
|
#'
|
||||||
#' library(petstore)
|
#' library(petstore)
|
||||||
#' var.username <- 'username_example' # character | The name that needs to be deleted
|
#' var.username <- "username_example" # character | The name that needs to be deleted
|
||||||
#'
|
#'
|
||||||
#' #Delete user
|
#' #Delete user
|
||||||
#' api.instance <- UserApi$new()
|
#' api.instance <- UserApi$new()
|
||||||
@ -302,7 +302,7 @@
|
|||||||
#' #################### GetUserByName ####################
|
#' #################### GetUserByName ####################
|
||||||
#'
|
#'
|
||||||
#' library(petstore)
|
#' library(petstore)
|
||||||
#' var.username <- 'username_example' # character | The name that needs to be fetched. Use user1 for testing.
|
#' var.username <- "username_example" # character | The name that needs to be fetched. Use user1 for testing.
|
||||||
#'
|
#'
|
||||||
#' #Get user by user name
|
#' #Get user by user name
|
||||||
#' api.instance <- UserApi$new()
|
#' api.instance <- UserApi$new()
|
||||||
@ -327,8 +327,8 @@
|
|||||||
#' #################### LoginUser ####################
|
#' #################### LoginUser ####################
|
||||||
#'
|
#'
|
||||||
#' library(petstore)
|
#' library(petstore)
|
||||||
#' var.username <- 'username_example' # character | The user name for login
|
#' var.username <- "username_example" # character | The user name for login
|
||||||
#' var.password <- 'password_example' # character | The password for login in clear text
|
#' var.password <- "password_example" # character | The password for login in clear text
|
||||||
#'
|
#'
|
||||||
#' #Logs user into the system
|
#' #Logs user into the system
|
||||||
#' api.instance <- UserApi$new()
|
#' api.instance <- UserApi$new()
|
||||||
@ -378,7 +378,7 @@
|
|||||||
#' #################### UpdateUser ####################
|
#' #################### UpdateUser ####################
|
||||||
#'
|
#'
|
||||||
#' library(petstore)
|
#' library(petstore)
|
||||||
#' var.username <- 'username_example' # character | name that need to be deleted
|
#' var.username <- "username_example" # character | name that need to be deleted
|
||||||
#' var.user <- User$new() # User | Updated user object
|
#' var.user <- User$new() # User | Updated user object
|
||||||
#'
|
#'
|
||||||
#' #Updated user
|
#' #Updated user
|
||||||
@ -421,8 +421,7 @@ UserApi <- R6::R6Class(
|
|||||||
initialize = function(api_client) {
|
initialize = function(api_client) {
|
||||||
if (!missing(api_client)) {
|
if (!missing(api_client)) {
|
||||||
self$api_client <- api_client
|
self$api_client <- api_client
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
self$api_client <- ApiClient$new()
|
self$api_client <- ApiClient$new()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -463,7 +462,10 @@ UserApi <- R6::R6Class(
|
|||||||
header_params <- c()
|
header_params <- c()
|
||||||
|
|
||||||
if (missing(`user`)) {
|
if (missing(`user`)) {
|
||||||
rlang::abort(message = "Missing required parameter `user`.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, reason = "Missing required parameter `user`."))
|
rlang::abort(message = "Missing required parameter `user`.",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(status = 0,
|
||||||
|
reason = "Missing required parameter `user`."))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!missing(`user`)) {
|
if (!missing(`user`)) {
|
||||||
@ -489,22 +491,28 @@ UserApi <- R6::R6Class(
|
|||||||
ApiResponse$new(NULL, resp)
|
ApiResponse$new(NULL, resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if (error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api client exception encountered."
|
error_msg <- "Api client exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
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) {
|
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api server exception encountered."
|
error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
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
|
||||||
@ -544,7 +552,10 @@ UserApi <- R6::R6Class(
|
|||||||
header_params <- c()
|
header_params <- c()
|
||||||
|
|
||||||
if (missing(`user`)) {
|
if (missing(`user`)) {
|
||||||
rlang::abort(message = "Missing required parameter `user`.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, reason = "Missing required parameter `user`."))
|
rlang::abort(message = "Missing required parameter `user`.",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(status = 0,
|
||||||
|
reason = "Missing required parameter `user`."))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!missing(`user`)) {
|
if (!missing(`user`)) {
|
||||||
@ -571,22 +582,28 @@ UserApi <- R6::R6Class(
|
|||||||
ApiResponse$new(NULL, resp)
|
ApiResponse$new(NULL, resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if (error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api client exception encountered."
|
error_msg <- "Api client exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
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) {
|
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api server exception encountered."
|
error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
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
|
||||||
@ -626,7 +643,10 @@ UserApi <- R6::R6Class(
|
|||||||
header_params <- c()
|
header_params <- c()
|
||||||
|
|
||||||
if (missing(`user`)) {
|
if (missing(`user`)) {
|
||||||
rlang::abort(message = "Missing required parameter `user`.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, reason = "Missing required parameter `user`."))
|
rlang::abort(message = "Missing required parameter `user`.",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(status = 0,
|
||||||
|
reason = "Missing required parameter `user`."))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!missing(`user`)) {
|
if (!missing(`user`)) {
|
||||||
@ -653,22 +673,28 @@ UserApi <- R6::R6Class(
|
|||||||
ApiResponse$new(NULL, resp)
|
ApiResponse$new(NULL, resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if (error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api client exception encountered."
|
error_msg <- "Api client exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
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) {
|
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api server exception encountered."
|
error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
#' Delete user
|
#' Delete user
|
||||||
@ -708,7 +734,10 @@ UserApi <- R6::R6Class(
|
|||||||
header_params <- c()
|
header_params <- c()
|
||||||
|
|
||||||
if (missing(`username`)) {
|
if (missing(`username`)) {
|
||||||
rlang::abort(message = "Missing required parameter `username`.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, reason = "Missing required parameter `username`."))
|
rlang::abort(message = "Missing required parameter `username`.",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(status = 0,
|
||||||
|
reason = "Missing required parameter `username`."))
|
||||||
}
|
}
|
||||||
|
|
||||||
body <- NULL
|
body <- NULL
|
||||||
@ -733,22 +762,28 @@ UserApi <- R6::R6Class(
|
|||||||
ApiResponse$new(NULL, resp)
|
ApiResponse$new(NULL, resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if (error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api client exception encountered."
|
error_msg <- "Api client exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
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) {
|
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api server exception encountered."
|
error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
#' Get user by user name
|
#' Get user by user name
|
||||||
@ -761,7 +796,7 @@ UserApi <- R6::R6Class(
|
|||||||
#' @param ... Other optional arguments
|
#' @param ... Other optional arguments
|
||||||
#' @return User
|
#' @return User
|
||||||
#' @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
|
resp <- api_response$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
||||||
@ -790,7 +825,10 @@ UserApi <- R6::R6Class(
|
|||||||
header_params <- c()
|
header_params <- c()
|
||||||
|
|
||||||
if (missing(`username`)) {
|
if (missing(`username`)) {
|
||||||
rlang::abort(message = "Missing required parameter `username`.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, reason = "Missing required parameter `username`."))
|
rlang::abort(message = "Missing required parameter `username`.",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(status = 0,
|
||||||
|
reason = "Missing required parameter `username`."))
|
||||||
}
|
}
|
||||||
|
|
||||||
body <- NULL
|
body <- NULL
|
||||||
@ -816,28 +854,36 @@ UserApi <- R6::R6Class(
|
|||||||
deserialized_resp_obj <- tryCatch(
|
deserialized_resp_obj <- tryCatch(
|
||||||
self$api_client$deserialize(resp, "User", loadNamespace("petstore")),
|
self$api_client$deserialize(resp, "User", loadNamespace("petstore")),
|
||||||
error = function(e) {
|
error = function(e) {
|
||||||
rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = "Failed to deserialize response",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
ApiResponse$new(deserialized_resp_obj, resp)
|
ApiResponse$new(deserialized_resp_obj, resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if (error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api client exception encountered."
|
error_msg <- "Api client exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
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) {
|
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api server exception encountered."
|
error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
#' Logs user into the system
|
#' Logs user into the system
|
||||||
@ -851,7 +897,7 @@ UserApi <- R6::R6Class(
|
|||||||
#' @param ... Other optional arguments
|
#' @param ... Other optional arguments
|
||||||
#' @return character
|
#' @return character
|
||||||
#' @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
|
resp <- api_response$response
|
||||||
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
|
||||||
@ -881,11 +927,17 @@ UserApi <- R6::R6Class(
|
|||||||
header_params <- c()
|
header_params <- c()
|
||||||
|
|
||||||
if (missing(`username`)) {
|
if (missing(`username`)) {
|
||||||
rlang::abort(message = "Missing required parameter `username`.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, reason = "Missing required parameter `username`."))
|
rlang::abort(message = "Missing required parameter `username`.",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(status = 0,
|
||||||
|
reason = "Missing required parameter `username`."))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (missing(`password`)) {
|
if (missing(`password`)) {
|
||||||
rlang::abort(message = "Missing required parameter `password`.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, reason = "Missing required parameter `password`."))
|
rlang::abort(message = "Missing required parameter `password`.",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(status = 0,
|
||||||
|
reason = "Missing required parameter `password`."))
|
||||||
}
|
}
|
||||||
|
|
||||||
body <- NULL
|
body <- NULL
|
||||||
@ -907,28 +959,36 @@ UserApi <- R6::R6Class(
|
|||||||
deserialized_resp_obj <- tryCatch(
|
deserialized_resp_obj <- tryCatch(
|
||||||
self$api_client$deserialize(resp, "character", loadNamespace("petstore")),
|
self$api_client$deserialize(resp, "character", loadNamespace("petstore")),
|
||||||
error = function(e) {
|
error = function(e) {
|
||||||
rlang::abort(message = "Failed to deserialize response", .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = "Failed to deserialize response",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
ApiResponse$new(deserialized_resp_obj, resp)
|
ApiResponse$new(deserialized_resp_obj, resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if (error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api client exception encountered."
|
error_msg <- "Api client exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
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) {
|
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api server exception encountered."
|
error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
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
|
||||||
@ -983,22 +1043,28 @@ UserApi <- R6::R6Class(
|
|||||||
ApiResponse$new(NULL, resp)
|
ApiResponse$new(NULL, resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if (error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api client exception encountered."
|
error_msg <- "Api client exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
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) {
|
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api server exception encountered."
|
error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
#' Updated user
|
#' Updated user
|
||||||
@ -1040,11 +1106,17 @@ UserApi <- R6::R6Class(
|
|||||||
header_params <- c()
|
header_params <- c()
|
||||||
|
|
||||||
if (missing(`username`)) {
|
if (missing(`username`)) {
|
||||||
rlang::abort(message = "Missing required parameter `username`.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, reason = "Missing required parameter `username`."))
|
rlang::abort(message = "Missing required parameter `username`.",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(status = 0,
|
||||||
|
reason = "Missing required parameter `username`."))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (missing(`user`)) {
|
if (missing(`user`)) {
|
||||||
rlang::abort(message = "Missing required parameter `user`.", .subclass = "ApiException", ApiException = ApiException$new(status = 0, reason = "Missing required parameter `user`."))
|
rlang::abort(message = "Missing required parameter `user`.",
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(status = 0,
|
||||||
|
reason = "Missing required parameter `user`."))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!missing(`user`)) {
|
if (!missing(`user`)) {
|
||||||
@ -1074,22 +1146,28 @@ UserApi <- R6::R6Class(
|
|||||||
ApiResponse$new(NULL, resp)
|
ApiResponse$new(NULL, resp)
|
||||||
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
} else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if (error_msg == "") {
|
||||||
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
error_msg <- paste("Server returned ", httr::status_code(resp), " response status code.")
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api client exception encountered."
|
error_msg <- "Api client exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
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) {
|
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
|
||||||
error_msg <- toString(content(resp))
|
error_msg <- toString(content(resp))
|
||||||
if(error_msg == "") {
|
if(error_msg == "") {
|
||||||
error_msg <- "Api server exception encountered."
|
error_msg <- "Api server exception encountered."
|
||||||
}
|
}
|
||||||
rlang::abort(message = error_msg, .subclass = "ApiException", ApiException = ApiException$new(http_response = resp))
|
rlang::abort(message = error_msg,
|
||||||
|
.subclass = "ApiException",
|
||||||
|
ApiException = ApiException$new(http_response = resp))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -5,6 +5,6 @@
|
|||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
**className** | **character** | |
|
**className** | **character** | |
|
||||||
**color** | **character** | | [optional] [default to 'red']
|
**color** | **character** | | [optional] [default to "red"]
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
**className** | **character** | |
|
**className** | **character** | |
|
||||||
**color** | **character** | | [optional] [default to 'red']
|
**color** | **character** | | [optional] [default to "red"]
|
||||||
**declawed** | **character** | | [optional]
|
**declawed** | **character** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
**className** | **character** | |
|
**className** | **character** | |
|
||||||
**color** | **character** | | [optional] [default to 'red']
|
**color** | **character** | | [optional] [default to "red"]
|
||||||
**breed** | **character** | | [optional]
|
**breed** | **character** | | [optional]
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,8 +18,8 @@ test data_file to ensure it's escaped correctly
|
|||||||
```R
|
```R
|
||||||
library(petstore)
|
library(petstore)
|
||||||
|
|
||||||
var_dummy <- 'dummy_example' # character | dummy required parameter
|
var_dummy <- "dummy_example" # character | dummy required parameter
|
||||||
var_var_data_file <- 'var_data_file_example' # character | header data file
|
var_var_data_file <- "var_data_file_example" # character | header data file
|
||||||
|
|
||||||
#test data_file to ensure it's escaped correctly
|
#test data_file to ensure it's escaped correctly
|
||||||
api_instance <- FakeApi$new()
|
api_instance <- FakeApi$new()
|
||||||
|
@ -88,7 +88,7 @@ Deletes a pet
|
|||||||
library(petstore)
|
library(petstore)
|
||||||
|
|
||||||
var_pet_id <- 56 # integer | Pet id to delete
|
var_pet_id <- 56 # integer | Pet id to delete
|
||||||
var_api_key <- 'api_key_example' # character |
|
var_api_key <- "api_key_example" # character |
|
||||||
|
|
||||||
#Deletes a pet
|
#Deletes a pet
|
||||||
api_instance <- PetApi$new()
|
api_instance <- PetApi$new()
|
||||||
@ -457,8 +457,8 @@ Updates a pet in the store with form data
|
|||||||
library(petstore)
|
library(petstore)
|
||||||
|
|
||||||
var_pet_id <- 56 # integer | ID of pet that needs to be updated
|
var_pet_id <- 56 # integer | ID of pet that needs to be updated
|
||||||
var_name <- 'name_example' # character | Updated name of the pet
|
var_name <- "name_example" # character | Updated name of the pet
|
||||||
var_status <- 'status_example' # character | Updated status of the pet
|
var_status <- "status_example" # character | Updated status of the pet
|
||||||
|
|
||||||
#Updates a pet in the store with form data
|
#Updates a pet in the store with form data
|
||||||
api_instance <- PetApi$new()
|
api_instance <- PetApi$new()
|
||||||
@ -517,7 +517,7 @@ uploads an image
|
|||||||
library(petstore)
|
library(petstore)
|
||||||
|
|
||||||
var_pet_id <- 56 # integer | ID of pet to update
|
var_pet_id <- 56 # integer | ID of pet to update
|
||||||
var_additional_metadata <- 'additional_metadata_example' # character | Additional data to pass to server
|
var_additional_metadata <- "additional_metadata_example" # character | Additional data to pass to server
|
||||||
var_file <- File.new('/path/to/file') # data.frame | file to upload
|
var_file <- File.new('/path/to/file') # data.frame | file to upload
|
||||||
|
|
||||||
#uploads an image
|
#uploads an image
|
||||||
|
@ -21,7 +21,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non
|
|||||||
```R
|
```R
|
||||||
library(petstore)
|
library(petstore)
|
||||||
|
|
||||||
var_order_id <- 'order_id_example' # character | ID of the order that needs to be deleted
|
var_order_id <- "order_id_example" # character | ID of the order that needs to be deleted
|
||||||
|
|
||||||
#Delete purchase order by ID
|
#Delete purchase order by ID
|
||||||
api_instance <- StoreApi$new()
|
api_instance <- StoreApi$new()
|
||||||
|
@ -193,7 +193,7 @@ This can only be done by the logged in user.
|
|||||||
```R
|
```R
|
||||||
library(petstore)
|
library(petstore)
|
||||||
|
|
||||||
var_username <- 'username_example' # character | The name that needs to be deleted
|
var_username <- "username_example" # character | The name that needs to be deleted
|
||||||
|
|
||||||
#Delete user
|
#Delete user
|
||||||
api_instance <- UserApi$new()
|
api_instance <- UserApi$new()
|
||||||
@ -250,7 +250,7 @@ Get user by user name
|
|||||||
```R
|
```R
|
||||||
library(petstore)
|
library(petstore)
|
||||||
|
|
||||||
var_username <- 'username_example' # character | The name that needs to be fetched. Use user1 for testing.
|
var_username <- "username_example" # character | The name that needs to be fetched. Use user1 for testing.
|
||||||
|
|
||||||
#Get user by user name
|
#Get user by user name
|
||||||
api_instance <- UserApi$new()
|
api_instance <- UserApi$new()
|
||||||
@ -310,8 +310,8 @@ Logs user into the system
|
|||||||
```R
|
```R
|
||||||
library(petstore)
|
library(petstore)
|
||||||
|
|
||||||
var_username <- 'username_example' # character | The user name for login
|
var_username <- "username_example" # character | The user name for login
|
||||||
var_password <- 'password_example' # character | The password for login in clear text
|
var_password <- "password_example" # character | The password for login in clear text
|
||||||
|
|
||||||
#Logs user into the system
|
#Logs user into the system
|
||||||
api_instance <- UserApi$new()
|
api_instance <- UserApi$new()
|
||||||
@ -423,7 +423,7 @@ This can only be done by the logged in user.
|
|||||||
```R
|
```R
|
||||||
library(petstore)
|
library(petstore)
|
||||||
|
|
||||||
var_username <- 'username_example' # character | name that need to be deleted
|
var_username <- "username_example" # character | name that need to be deleted
|
||||||
var_user <- User$new(123, "username_example", "firstName_example", "lastName_example", "email_example", "password_example", "phone_example", 123) # User | Updated user object
|
var_user <- User$new(123, "username_example", "firstName_example", "lastName_example", "email_example", "password_example", "phone_example", 123) # User | Updated user object
|
||||||
|
|
||||||
#Updated user
|
#Updated user
|
||||||
|
Loading…
x
Reference in New Issue
Block a user