forked from loafle/openapi-generator-original
[R] fix to-list and to-json functionality (#20132)
* [r client] fix to-list and to-json functionality * fix type of json string * wip * refactor pr * regenerate samples * update to-dataframe example to use non-superceded tidyverse functions * fix typo
This commit is contained in:
parent
037cb12f34
commit
e3e06af5f4
@ -456,7 +456,7 @@
|
||||
local_var_body <- `{{paramName}}`$toJSONString()
|
||||
{{/isArray}}
|
||||
} else {
|
||||
body <- NULL
|
||||
local_var_body <- NULL
|
||||
}
|
||||
|
||||
{{/bodyParams}}
|
||||
|
@ -86,27 +86,32 @@
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Serialize {{{classname}}} to JSON string.
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert {{{classname}}} to a base R type
|
||||
#'
|
||||
#' @return JSON string representation of the {{{classname}}}.
|
||||
toJSONString = function() {
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
if (!is.null(self$actual_instance)) {
|
||||
as.character(jsonlite::minify((self$actual_instance$toJSONString())))
|
||||
return(self$actual_instance$toSimpleType())
|
||||
} else {
|
||||
NULL
|
||||
}
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Serialize {{{classname}}} to JSON.
|
||||
#' Serialize {{{classname}}} to JSON string.
|
||||
#'
|
||||
#' @return JSON representation of the {{{classname}}}.
|
||||
toJSON = function() {
|
||||
if (!is.null(self$actual_instance)) {
|
||||
self$actual_instance$toJSON()
|
||||
} else {
|
||||
NULL
|
||||
}
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return JSON string representation of the {{{classname}}}.
|
||||
toJSONString = function(...) {
|
||||
json <- jsonlite::toJSON(self$toSimpleType(), auto_unbox = TRUE, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -38,11 +38,18 @@
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return {{{classname}}} in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
jsonlite::toJSON(private$value, auto_unbox = TRUE)
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert {{{classname}}} to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
return(private$value)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -60,10 +67,11 @@
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return {{{classname}}} in JSON format
|
||||
toJSONString = function() {
|
||||
as.character(jsonlite::toJSON(private$value,
|
||||
auto_unbox = TRUE))
|
||||
toJSONString = function(...) {
|
||||
json <- jsonlite::toJSON(self$toSimpleType(), auto_unbox = TRUE, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -203,10 +203,35 @@
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return {{{classname}}} in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return {{{classname}}} as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of {{{classname}}} (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert {{{classname}}} to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
{{classname}}Object <- list()
|
||||
{{#vars}}
|
||||
if (!is.null(self$`{{name}}`)) {
|
||||
@ -217,7 +242,7 @@
|
||||
self$`{{name}}`
|
||||
{{/isPrimitiveType}}
|
||||
{{^isPrimitiveType}}
|
||||
lapply(self$`{{name}}`, function(x) x$toJSON())
|
||||
lapply(self$`{{name}}`, function(x) x$toSimpleType())
|
||||
{{/isPrimitiveType}}
|
||||
{{/isArray}}
|
||||
{{#isMap}}
|
||||
@ -225,7 +250,7 @@
|
||||
self$`{{name}}`
|
||||
{{/isPrimitiveType}}
|
||||
{{^isPrimitiveType}}
|
||||
lapply(self$`{{name}}`, function(x) x$toJSON())
|
||||
lapply(self$`{{name}}`, function(x) x$toSimpleType())
|
||||
{{/isPrimitiveType}}
|
||||
{{/isMap}}
|
||||
{{/isContainer}}
|
||||
@ -234,7 +259,7 @@
|
||||
self$`{{name}}`
|
||||
{{/isPrimitiveType}}
|
||||
{{^isPrimitiveType}}
|
||||
self$`{{name}}`$toJSON()
|
||||
self$`{{name}}`$toSimpleType()
|
||||
{{/isPrimitiveType}}
|
||||
{{/isContainer}}
|
||||
}
|
||||
@ -245,7 +270,7 @@
|
||||
}
|
||||
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
{{classname}}Object
|
||||
return({{classname}}Object)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -304,76 +329,18 @@
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return {{{classname}}} in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
{{#vars}}
|
||||
if (!is.null(self$`{{name}}`)) {
|
||||
sprintf(
|
||||
'"{{baseName}}":
|
||||
{{#isContainer}}
|
||||
{{#isArray}}
|
||||
{{#isPrimitiveType}}
|
||||
{{#isNumeric}}[%d]{{/isNumeric}}{{^isNumeric}}[%s]{{/isNumeric}}
|
||||
{{/isPrimitiveType}}
|
||||
{{^isPrimitiveType}}[%s]
|
||||
{{/isPrimitiveType}}
|
||||
{{/isArray}}
|
||||
{{#isMap}}
|
||||
{{#isPrimitiveType}}
|
||||
{{#isNumeric}}%d{{/isNumeric}}{{^isNumeric}}{{^isBoolean}}{{/isBoolean}}%s{{^isBoolean}}{{/isBoolean}}{{/isNumeric}}
|
||||
{{/isPrimitiveType}}
|
||||
{{^isPrimitiveType}}%s
|
||||
{{/isPrimitiveType}}
|
||||
{{/isMap}}
|
||||
{{/isContainer}}
|
||||
{{^isContainer}}
|
||||
{{#isPrimitiveType}}
|
||||
{{#isNumeric}}%d{{/isNumeric}}{{^isNumeric}}{{^isBoolean}}"{{/isBoolean}}%s{{^isBoolean}}"{{/isBoolean}}{{/isNumeric}}
|
||||
{{/isPrimitiveType}}
|
||||
{{^isPrimitiveType}}%s
|
||||
{{/isPrimitiveType}}
|
||||
{{/isContainer}}',
|
||||
{{#isContainer}}
|
||||
{{#isArray}}
|
||||
{{#isPrimitiveType}}
|
||||
paste(unlist(lapply(self$`{{{name}}}`, function(x) paste0('"', x, '"'))), collapse = ",")
|
||||
{{/isPrimitiveType}}
|
||||
{{^isPrimitiveType}}
|
||||
paste(sapply(self$`{{{name}}}`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox = TRUE, digits = NA)), collapse = ",")
|
||||
{{/isPrimitiveType}}
|
||||
{{/isArray}}
|
||||
{{#isMap}}
|
||||
{{#isPrimitiveType}}
|
||||
jsonlite::toJSON(lapply(self$`{{{name}}}`, function(x){ x }), auto_unbox = TRUE, digits = NA)
|
||||
{{/isPrimitiveType}}
|
||||
{{^isPrimitiveType}}
|
||||
jsonlite::toJSON(lapply(self$`{{{name}}}`, function(x){ x$toJSON() }), auto_unbox = TRUE, digits = NA)
|
||||
{{/isPrimitiveType}}
|
||||
{{/isMap}}
|
||||
{{/isContainer}}
|
||||
{{^isContainer}}
|
||||
{{#isPrimitiveType}}
|
||||
{{#isBoolean}}tolower({{/isBoolean}}self$`{{name}}`{{#isBoolean}}){{/isBoolean}}
|
||||
{{/isPrimitiveType}}
|
||||
{{^isPrimitiveType}}
|
||||
jsonlite::toJSON(self$`{{name}}`$toJSON(), auto_unbox = TRUE, digits = NA)
|
||||
{{/isPrimitiveType}}
|
||||
{{/isContainer}}
|
||||
)
|
||||
}{{^-last}},{{/-last}}
|
||||
{{/vars}}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
{{#isAdditionalPropertiesTrue}}
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
{{/isAdditionalPropertiesTrue}}
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -139,25 +139,35 @@
|
||||
|
||||
#' @description
|
||||
#' Serialize {{{classname}}} to JSON string.
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return JSON string representation of the {{{classname}}}.
|
||||
toJSONString = function() {
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
if (!is.null(self$actual_instance)) {
|
||||
as.character(jsonlite::minify(self$actual_instance$toJSONString()))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
} else {
|
||||
NULL
|
||||
return(NULL)
|
||||
}
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Serialize {{{classname}}} to JSON.
|
||||
#'
|
||||
#' @return JSON representation of the {{{classname}}}.
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert {{{classname}}} to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
if (!is.null(self$actual_instance)) {
|
||||
self$actual_instance$toJSON()
|
||||
return(self$actual_instance$toSimpleType())
|
||||
} else {
|
||||
NULL
|
||||
return(NULL)
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -40,10 +40,35 @@ Bird <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return Bird in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return Bird as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of Bird (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Bird to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
BirdObject <- list()
|
||||
if (!is.null(self$`size`)) {
|
||||
BirdObject[["size"]] <-
|
||||
@ -53,7 +78,7 @@ Bird <- R6::R6Class(
|
||||
BirdObject[["color"]] <-
|
||||
self$`color`
|
||||
}
|
||||
BirdObject
|
||||
return(BirdObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -74,29 +99,13 @@ Bird <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return Bird in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`size`)) {
|
||||
sprintf(
|
||||
'"size":
|
||||
"%s"
|
||||
',
|
||||
self$`size`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`color`)) {
|
||||
sprintf(
|
||||
'"color":
|
||||
"%s"
|
||||
',
|
||||
self$`color`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -304,7 +304,7 @@ BodyApi <- R6::R6Class(
|
||||
if (!is.null(`body`)) {
|
||||
local_var_body <- `body`$toJSONString()
|
||||
} else {
|
||||
body <- NULL
|
||||
local_var_body <- NULL
|
||||
}
|
||||
|
||||
local_var_url_path <- "/body/application/octetstream/binary"
|
||||
@ -586,7 +586,7 @@ BodyApi <- R6::R6Class(
|
||||
if (!is.null(`pet`)) {
|
||||
local_var_body <- `pet`$toJSONString()
|
||||
} else {
|
||||
body <- NULL
|
||||
local_var_body <- NULL
|
||||
}
|
||||
|
||||
local_var_url_path <- "/echo/body/allOf/Pet"
|
||||
@ -682,7 +682,7 @@ BodyApi <- R6::R6Class(
|
||||
if (!is.null(`body`)) {
|
||||
local_var_body <- `body`$toJSONString()
|
||||
} else {
|
||||
body <- NULL
|
||||
local_var_body <- NULL
|
||||
}
|
||||
|
||||
local_var_url_path <- "/echo/body/FreeFormObject/response_string"
|
||||
@ -778,7 +778,7 @@ BodyApi <- R6::R6Class(
|
||||
if (!is.null(`pet`)) {
|
||||
local_var_body <- `pet`$toJSONString()
|
||||
} else {
|
||||
body <- NULL
|
||||
local_var_body <- NULL
|
||||
}
|
||||
|
||||
local_var_url_path <- "/echo/body/Pet"
|
||||
@ -874,7 +874,7 @@ BodyApi <- R6::R6Class(
|
||||
if (!is.null(`pet`)) {
|
||||
local_var_body <- `pet`$toJSONString()
|
||||
} else {
|
||||
body <- NULL
|
||||
local_var_body <- NULL
|
||||
}
|
||||
|
||||
local_var_url_path <- "/echo/body/Pet/response_string"
|
||||
@ -970,7 +970,7 @@ BodyApi <- R6::R6Class(
|
||||
if (!is.null(`body`)) {
|
||||
local_var_body <- `body`$toJSONString()
|
||||
} else {
|
||||
body <- NULL
|
||||
local_var_body <- NULL
|
||||
}
|
||||
|
||||
local_var_url_path <- "/echo/body/string_enum"
|
||||
@ -1066,7 +1066,7 @@ BodyApi <- R6::R6Class(
|
||||
if (!is.null(`tag`)) {
|
||||
local_var_body <- `tag`$toJSONString()
|
||||
} else {
|
||||
body <- NULL
|
||||
local_var_body <- NULL
|
||||
}
|
||||
|
||||
local_var_url_path <- "/echo/body/Tag/response_string"
|
||||
|
@ -40,10 +40,35 @@ Category <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return Category in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return Category as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of Category (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Category to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
CategoryObject <- list()
|
||||
if (!is.null(self$`id`)) {
|
||||
CategoryObject[["id"]] <-
|
||||
@ -53,7 +78,7 @@ Category <- R6::R6Class(
|
||||
CategoryObject[["name"]] <-
|
||||
self$`name`
|
||||
}
|
||||
CategoryObject
|
||||
return(CategoryObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -74,29 +99,13 @@ Category <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return Category in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`id`)) {
|
||||
sprintf(
|
||||
'"id":
|
||||
%d
|
||||
',
|
||||
self$`id`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`name`)) {
|
||||
sprintf(
|
||||
'"name":
|
||||
"%s"
|
||||
',
|
||||
self$`name`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -67,10 +67,35 @@ DataQuery <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return DataQuery in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return DataQuery as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of DataQuery (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert DataQuery to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
DataQueryObject <- list()
|
||||
if (!is.null(self$`id`)) {
|
||||
DataQueryObject[["id"]] <-
|
||||
@ -92,7 +117,7 @@ DataQuery <- R6::R6Class(
|
||||
DataQueryObject[["date"]] <-
|
||||
self$`date`
|
||||
}
|
||||
DataQueryObject
|
||||
return(DataQueryObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -122,53 +147,13 @@ DataQuery <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return DataQuery in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`id`)) {
|
||||
sprintf(
|
||||
'"id":
|
||||
%d
|
||||
',
|
||||
self$`id`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`outcomes`)) {
|
||||
sprintf(
|
||||
'"outcomes":
|
||||
[%s]
|
||||
',
|
||||
paste(unlist(lapply(self$`outcomes`, function(x) paste0('"', x, '"'))), collapse = ",")
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`suffix`)) {
|
||||
sprintf(
|
||||
'"suffix":
|
||||
"%s"
|
||||
',
|
||||
self$`suffix`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`text`)) {
|
||||
sprintf(
|
||||
'"text":
|
||||
"%s"
|
||||
',
|
||||
self$`text`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`date`)) {
|
||||
sprintf(
|
||||
'"date":
|
||||
"%s"
|
||||
',
|
||||
self$`date`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -87,14 +87,39 @@ DefaultValue <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return DefaultValue in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return DefaultValue as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of DefaultValue (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert DefaultValue to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
DefaultValueObject <- list()
|
||||
if (!is.null(self$`array_string_enum_ref_default`)) {
|
||||
DefaultValueObject[["array_string_enum_ref_default"]] <-
|
||||
lapply(self$`array_string_enum_ref_default`, function(x) x$toJSON())
|
||||
lapply(self$`array_string_enum_ref_default`, function(x) x$toSimpleType())
|
||||
}
|
||||
if (!is.null(self$`array_string_enum_default`)) {
|
||||
DefaultValueObject[["array_string_enum_default"]] <-
|
||||
@ -124,7 +149,7 @@ DefaultValue <- R6::R6Class(
|
||||
DefaultValueObject[["string_nullable"]] <-
|
||||
self$`string_nullable`
|
||||
}
|
||||
DefaultValueObject
|
||||
return(DefaultValueObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -163,77 +188,13 @@ DefaultValue <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return DefaultValue in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`array_string_enum_ref_default`)) {
|
||||
sprintf(
|
||||
'"array_string_enum_ref_default":
|
||||
[%s]
|
||||
',
|
||||
paste(sapply(self$`array_string_enum_ref_default`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox = TRUE, digits = NA)), collapse = ",")
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`array_string_enum_default`)) {
|
||||
sprintf(
|
||||
'"array_string_enum_default":
|
||||
[%s]
|
||||
',
|
||||
paste(unlist(lapply(self$`array_string_enum_default`, function(x) paste0('"', x, '"'))), collapse = ",")
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`array_string_default`)) {
|
||||
sprintf(
|
||||
'"array_string_default":
|
||||
[%s]
|
||||
',
|
||||
paste(unlist(lapply(self$`array_string_default`, function(x) paste0('"', x, '"'))), collapse = ",")
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`array_integer_default`)) {
|
||||
sprintf(
|
||||
'"array_integer_default":
|
||||
[%s]
|
||||
',
|
||||
paste(unlist(lapply(self$`array_integer_default`, function(x) paste0('"', x, '"'))), collapse = ",")
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`array_string`)) {
|
||||
sprintf(
|
||||
'"array_string":
|
||||
[%s]
|
||||
',
|
||||
paste(unlist(lapply(self$`array_string`, function(x) paste0('"', x, '"'))), collapse = ",")
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`array_string_nullable`)) {
|
||||
sprintf(
|
||||
'"array_string_nullable":
|
||||
[%s]
|
||||
',
|
||||
paste(unlist(lapply(self$`array_string_nullable`, function(x) paste0('"', x, '"'))), collapse = ",")
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`array_string_extension_nullable`)) {
|
||||
sprintf(
|
||||
'"array_string_extension_nullable":
|
||||
[%s]
|
||||
',
|
||||
paste(unlist(lapply(self$`array_string_extension_nullable`, function(x) paste0('"', x, '"'))), collapse = ",")
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`string_nullable`)) {
|
||||
sprintf(
|
||||
'"string_nullable":
|
||||
"%s"
|
||||
',
|
||||
self$`string_nullable`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -46,10 +46,35 @@ NumberPropertiesOnly <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return NumberPropertiesOnly in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return NumberPropertiesOnly as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of NumberPropertiesOnly (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert NumberPropertiesOnly to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
NumberPropertiesOnlyObject <- list()
|
||||
if (!is.null(self$`number`)) {
|
||||
NumberPropertiesOnlyObject[["number"]] <-
|
||||
@ -63,7 +88,7 @@ NumberPropertiesOnly <- R6::R6Class(
|
||||
NumberPropertiesOnlyObject[["double"]] <-
|
||||
self$`double`
|
||||
}
|
||||
NumberPropertiesOnlyObject
|
||||
return(NumberPropertiesOnlyObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -87,37 +112,13 @@ NumberPropertiesOnly <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return NumberPropertiesOnly in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`number`)) {
|
||||
sprintf(
|
||||
'"number":
|
||||
%d
|
||||
',
|
||||
self$`number`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`float`)) {
|
||||
sprintf(
|
||||
'"float":
|
||||
%d
|
||||
',
|
||||
self$`float`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`double`)) {
|
||||
sprintf(
|
||||
'"double":
|
||||
%d
|
||||
',
|
||||
self$`double`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -75,10 +75,35 @@ Pet <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return Pet in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return Pet as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of Pet (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Pet to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
PetObject <- list()
|
||||
if (!is.null(self$`id`)) {
|
||||
PetObject[["id"]] <-
|
||||
@ -90,7 +115,7 @@ Pet <- R6::R6Class(
|
||||
}
|
||||
if (!is.null(self$`category`)) {
|
||||
PetObject[["category"]] <-
|
||||
self$`category`$toJSON()
|
||||
self$`category`$toSimpleType()
|
||||
}
|
||||
if (!is.null(self$`photoUrls`)) {
|
||||
PetObject[["photoUrls"]] <-
|
||||
@ -98,13 +123,13 @@ Pet <- R6::R6Class(
|
||||
}
|
||||
if (!is.null(self$`tags`)) {
|
||||
PetObject[["tags"]] <-
|
||||
lapply(self$`tags`, function(x) x$toJSON())
|
||||
lapply(self$`tags`, function(x) x$toSimpleType())
|
||||
}
|
||||
if (!is.null(self$`status`)) {
|
||||
PetObject[["status"]] <-
|
||||
self$`status`
|
||||
}
|
||||
PetObject
|
||||
return(PetObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -142,61 +167,13 @@ Pet <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return Pet in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`id`)) {
|
||||
sprintf(
|
||||
'"id":
|
||||
%d
|
||||
',
|
||||
self$`id`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`name`)) {
|
||||
sprintf(
|
||||
'"name":
|
||||
"%s"
|
||||
',
|
||||
self$`name`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`category`)) {
|
||||
sprintf(
|
||||
'"category":
|
||||
%s
|
||||
',
|
||||
jsonlite::toJSON(self$`category`$toJSON(), auto_unbox = TRUE, digits = NA)
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`photoUrls`)) {
|
||||
sprintf(
|
||||
'"photoUrls":
|
||||
[%s]
|
||||
',
|
||||
paste(unlist(lapply(self$`photoUrls`, function(x) paste0('"', x, '"'))), collapse = ",")
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`tags`)) {
|
||||
sprintf(
|
||||
'"tags":
|
||||
[%s]
|
||||
',
|
||||
paste(sapply(self$`tags`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox = TRUE, digits = NA)), collapse = ",")
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`status`)) {
|
||||
sprintf(
|
||||
'"status":
|
||||
"%s"
|
||||
',
|
||||
self$`status`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -39,10 +39,35 @@ Query <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return Query in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return Query as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of Query (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Query to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
QueryObject <- list()
|
||||
if (!is.null(self$`id`)) {
|
||||
QueryObject[["id"]] <-
|
||||
@ -52,7 +77,7 @@ Query <- R6::R6Class(
|
||||
QueryObject[["outcomes"]] <-
|
||||
self$`outcomes`
|
||||
}
|
||||
QueryObject
|
||||
return(QueryObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -73,29 +98,13 @@ Query <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return Query in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`id`)) {
|
||||
sprintf(
|
||||
'"id":
|
||||
%d
|
||||
',
|
||||
self$`id`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`outcomes`)) {
|
||||
sprintf(
|
||||
'"outcomes":
|
||||
[%s]
|
||||
',
|
||||
paste(unlist(lapply(self$`outcomes`, function(x) paste0('"', x, '"'))), collapse = ",")
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -37,11 +37,18 @@ StringEnumRef <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return StringEnumRef in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
jsonlite::toJSON(private$value, auto_unbox = TRUE)
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert StringEnumRef to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
return(private$value)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -59,10 +66,11 @@ StringEnumRef <- R6::R6Class(
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return StringEnumRef in JSON format
|
||||
toJSONString = function() {
|
||||
as.character(jsonlite::toJSON(private$value,
|
||||
auto_unbox = TRUE))
|
||||
toJSONString = function(...) {
|
||||
json <- jsonlite::toJSON(self$toSimpleType(), auto_unbox = TRUE, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -40,10 +40,35 @@ Tag <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return Tag in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return Tag as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of Tag (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Tag to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
TagObject <- list()
|
||||
if (!is.null(self$`id`)) {
|
||||
TagObject[["id"]] <-
|
||||
@ -53,7 +78,7 @@ Tag <- R6::R6Class(
|
||||
TagObject[["name"]] <-
|
||||
self$`name`
|
||||
}
|
||||
TagObject
|
||||
return(TagObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -74,29 +99,13 @@ Tag <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return Tag in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`id`)) {
|
||||
sprintf(
|
||||
'"id":
|
||||
%d
|
||||
',
|
||||
self$`id`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`name`)) {
|
||||
sprintf(
|
||||
'"name":
|
||||
"%s"
|
||||
',
|
||||
self$`name`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -31,16 +31,41 @@ TestFormObjectMultipartRequestMarker <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return TestFormObjectMultipartRequestMarker in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return TestFormObjectMultipartRequestMarker as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of TestFormObjectMultipartRequestMarker (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert TestFormObjectMultipartRequestMarker to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
TestFormObjectMultipartRequestMarkerObject <- list()
|
||||
if (!is.null(self$`name`)) {
|
||||
TestFormObjectMultipartRequestMarkerObject[["name"]] <-
|
||||
self$`name`
|
||||
}
|
||||
TestFormObjectMultipartRequestMarkerObject
|
||||
return(TestFormObjectMultipartRequestMarkerObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -58,21 +83,13 @@ TestFormObjectMultipartRequestMarker <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return TestFormObjectMultipartRequestMarker in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`name`)) {
|
||||
sprintf(
|
||||
'"name":
|
||||
"%s"
|
||||
',
|
||||
self$`name`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -58,10 +58,35 @@ TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter <- R6::R6Clas
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterObject <- list()
|
||||
if (!is.null(self$`size`)) {
|
||||
TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterObject[["size"]] <-
|
||||
@ -79,7 +104,7 @@ TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter <- R6::R6Clas
|
||||
TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterObject[["name"]] <-
|
||||
self$`name`
|
||||
}
|
||||
TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterObject
|
||||
return(TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameterObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -106,45 +131,13 @@ TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter <- R6::R6Clas
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`size`)) {
|
||||
sprintf(
|
||||
'"size":
|
||||
"%s"
|
||||
',
|
||||
self$`size`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`color`)) {
|
||||
sprintf(
|
||||
'"color":
|
||||
"%s"
|
||||
',
|
||||
self$`color`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`id`)) {
|
||||
sprintf(
|
||||
'"id":
|
||||
%d
|
||||
',
|
||||
self$`id`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`name`)) {
|
||||
sprintf(
|
||||
'"name":
|
||||
"%s"
|
||||
',
|
||||
self$`name`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -30,16 +30,41 @@ TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterObject <- list()
|
||||
if (!is.null(self$`values`)) {
|
||||
TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterObject[["values"]] <-
|
||||
self$`values`
|
||||
}
|
||||
TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterObject
|
||||
return(TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameterObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -57,21 +82,13 @@ TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`values`)) {
|
||||
sprintf(
|
||||
'"values":
|
||||
[%s]
|
||||
',
|
||||
paste(unlist(lapply(self$`values`, function(x) paste0('"', x, '"'))), collapse = ",")
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -77,10 +77,35 @@ AllofTagApiResponse <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return AllofTagApiResponse in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return AllofTagApiResponse as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of AllofTagApiResponse (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert AllofTagApiResponse to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
AllofTagApiResponseObject <- list()
|
||||
if (!is.null(self$`id`)) {
|
||||
AllofTagApiResponseObject[["id"]] <-
|
||||
@ -106,7 +131,7 @@ AllofTagApiResponse <- R6::R6Class(
|
||||
AllofTagApiResponseObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
AllofTagApiResponseObject
|
||||
return(AllofTagApiResponseObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -143,58 +168,16 @@ AllofTagApiResponse <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return AllofTagApiResponse in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`id`)) {
|
||||
sprintf(
|
||||
'"id":
|
||||
%d
|
||||
',
|
||||
self$`id`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`name`)) {
|
||||
sprintf(
|
||||
'"name":
|
||||
"%s"
|
||||
',
|
||||
self$`name`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`code`)) {
|
||||
sprintf(
|
||||
'"code":
|
||||
%d
|
||||
',
|
||||
self$`code`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`type`)) {
|
||||
sprintf(
|
||||
'"type":
|
||||
"%s"
|
||||
',
|
||||
self$`type`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`message`)) {
|
||||
sprintf(
|
||||
'"message":
|
||||
"%s"
|
||||
',
|
||||
self$`message`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -52,10 +52,35 @@ Animal <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return Animal in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return Animal as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of Animal (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Animal to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
AnimalObject <- list()
|
||||
if (!is.null(self$`className`)) {
|
||||
AnimalObject[["className"]] <-
|
||||
@ -69,7 +94,7 @@ Animal <- R6::R6Class(
|
||||
AnimalObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
AnimalObject
|
||||
return(AnimalObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -97,34 +122,16 @@ Animal <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return Animal in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`className`)) {
|
||||
sprintf(
|
||||
'"className":
|
||||
"%s"
|
||||
',
|
||||
self$`className`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`color`)) {
|
||||
sprintf(
|
||||
'"color":
|
||||
"%s"
|
||||
',
|
||||
self$`color`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -91,27 +91,32 @@ AnyOfPig <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Serialize AnyOfPig to JSON string.
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert AnyOfPig to a base R type
|
||||
#'
|
||||
#' @return JSON string representation of the AnyOfPig.
|
||||
toJSONString = function() {
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
if (!is.null(self$actual_instance)) {
|
||||
as.character(jsonlite::minify((self$actual_instance$toJSONString())))
|
||||
return(self$actual_instance$toSimpleType())
|
||||
} else {
|
||||
NULL
|
||||
}
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Serialize AnyOfPig to JSON.
|
||||
#' Serialize AnyOfPig to JSON string.
|
||||
#'
|
||||
#' @return JSON representation of the AnyOfPig.
|
||||
toJSON = function() {
|
||||
if (!is.null(self$actual_instance)) {
|
||||
self$actual_instance$toJSON()
|
||||
} else {
|
||||
NULL
|
||||
}
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return JSON string representation of the AnyOfPig.
|
||||
toJSONString = function(...) {
|
||||
json <- jsonlite::toJSON(self$toSimpleType(), auto_unbox = TRUE, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -111,25 +111,35 @@ AnyOfPrimitiveTypeTest <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' Serialize AnyOfPrimitiveTypeTest to JSON string.
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return JSON string representation of the AnyOfPrimitiveTypeTest.
|
||||
toJSONString = function() {
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
if (!is.null(self$actual_instance)) {
|
||||
as.character(jsonlite::minify(self$actual_instance$toJSONString()))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
} else {
|
||||
NULL
|
||||
return(NULL)
|
||||
}
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Serialize AnyOfPrimitiveTypeTest to JSON.
|
||||
#'
|
||||
#' @return JSON representation of the AnyOfPrimitiveTypeTest.
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert AnyOfPrimitiveTypeTest to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
if (!is.null(self$actual_instance)) {
|
||||
self$actual_instance$toJSON()
|
||||
return(self$actual_instance$toSimpleType())
|
||||
} else {
|
||||
NULL
|
||||
return(NULL)
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -50,10 +50,35 @@ BasquePig <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return BasquePig in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return BasquePig as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of BasquePig (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert BasquePig to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
BasquePigObject <- list()
|
||||
if (!is.null(self$`className`)) {
|
||||
BasquePigObject[["className"]] <-
|
||||
@ -67,7 +92,7 @@ BasquePig <- R6::R6Class(
|
||||
BasquePigObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
BasquePigObject
|
||||
return(BasquePigObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -95,34 +120,16 @@ BasquePig <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return BasquePig in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`className`)) {
|
||||
sprintf(
|
||||
'"className":
|
||||
"%s"
|
||||
',
|
||||
self$`className`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`color`)) {
|
||||
sprintf(
|
||||
'"color":
|
||||
"%s"
|
||||
',
|
||||
self$`color`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -60,10 +60,35 @@ Cat <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return Cat in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return Cat as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of Cat (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Cat to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
CatObject <- list()
|
||||
if (!is.null(self$`className`)) {
|
||||
CatObject[["className"]] <-
|
||||
@ -81,7 +106,7 @@ Cat <- R6::R6Class(
|
||||
CatObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
CatObject
|
||||
return(CatObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -112,42 +137,16 @@ Cat <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return Cat in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`className`)) {
|
||||
sprintf(
|
||||
'"className":
|
||||
"%s"
|
||||
',
|
||||
self$`className`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`color`)) {
|
||||
sprintf(
|
||||
'"color":
|
||||
"%s"
|
||||
',
|
||||
self$`color`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`declawed`)) {
|
||||
sprintf(
|
||||
'"declawed":
|
||||
%s
|
||||
',
|
||||
tolower(self$`declawed`)
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -50,10 +50,35 @@ Category <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return Category in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return Category as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of Category (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Category to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
CategoryObject <- list()
|
||||
if (!is.null(self$`id`)) {
|
||||
CategoryObject[["id"]] <-
|
||||
@ -67,7 +92,7 @@ Category <- R6::R6Class(
|
||||
CategoryObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
CategoryObject
|
||||
return(CategoryObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -95,34 +120,16 @@ Category <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return Category in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`id`)) {
|
||||
sprintf(
|
||||
'"id":
|
||||
%d
|
||||
',
|
||||
self$`id`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`name`)) {
|
||||
sprintf(
|
||||
'"name":
|
||||
"%s"
|
||||
',
|
||||
self$`name`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -50,10 +50,35 @@ DanishPig <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return DanishPig in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return DanishPig as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of DanishPig (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert DanishPig to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
DanishPigObject <- list()
|
||||
if (!is.null(self$`className`)) {
|
||||
DanishPigObject[["className"]] <-
|
||||
@ -67,7 +92,7 @@ DanishPig <- R6::R6Class(
|
||||
DanishPigObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
DanishPigObject
|
||||
return(DanishPigObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -95,34 +120,16 @@ DanishPig <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return DanishPig in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`className`)) {
|
||||
sprintf(
|
||||
'"className":
|
||||
"%s"
|
||||
',
|
||||
self$`className`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`size`)) {
|
||||
sprintf(
|
||||
'"size":
|
||||
%d
|
||||
',
|
||||
self$`size`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -63,10 +63,35 @@ Date <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return Date in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return Date as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of Date (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Date to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
DateObject <- list()
|
||||
if (!is.null(self$`className`)) {
|
||||
DateObject[["className"]] <-
|
||||
@ -84,7 +109,7 @@ Date <- R6::R6Class(
|
||||
DateObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
DateObject
|
||||
return(DateObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -119,42 +144,16 @@ Date <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return Date in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`className`)) {
|
||||
sprintf(
|
||||
'"className":
|
||||
"%s"
|
||||
',
|
||||
self$`className`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`percent_description`)) {
|
||||
sprintf(
|
||||
'"percent_description":
|
||||
"%s"
|
||||
',
|
||||
self$`percent_description`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`url_property`)) {
|
||||
sprintf(
|
||||
'"url_property":
|
||||
"%s"
|
||||
',
|
||||
self$`url_property`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -60,10 +60,35 @@ Dog <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return Dog in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return Dog as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of Dog (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Dog to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
DogObject <- list()
|
||||
if (!is.null(self$`className`)) {
|
||||
DogObject[["className"]] <-
|
||||
@ -81,7 +106,7 @@ Dog <- R6::R6Class(
|
||||
DogObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
DogObject
|
||||
return(DogObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -112,42 +137,16 @@ Dog <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return Dog in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`className`)) {
|
||||
sprintf(
|
||||
'"className":
|
||||
"%s"
|
||||
',
|
||||
self$`className`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`color`)) {
|
||||
sprintf(
|
||||
'"color":
|
||||
"%s"
|
||||
',
|
||||
self$`color`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`breed`)) {
|
||||
sprintf(
|
||||
'"breed":
|
||||
"%s"
|
||||
',
|
||||
self$`breed`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -41,10 +41,35 @@ DummyModel <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return DummyModel in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return DummyModel as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of DummyModel (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert DummyModel to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
DummyModelObject <- list()
|
||||
if (!is.null(self$`property`)) {
|
||||
DummyModelObject[["property"]] <-
|
||||
@ -54,7 +79,7 @@ DummyModel <- R6::R6Class(
|
||||
DummyModelObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
DummyModelObject
|
||||
return(DummyModelObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -79,26 +104,16 @@ DummyModel <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return DummyModel in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`property`)) {
|
||||
sprintf(
|
||||
'"property":
|
||||
"%s"
|
||||
',
|
||||
self$`property`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -225,7 +225,7 @@ FakeApi <- R6::R6Class(
|
||||
if (!is.null(`pet`)) {
|
||||
local_var_body <- `pet`$toJSONString()
|
||||
} else {
|
||||
body <- NULL
|
||||
local_var_body <- NULL
|
||||
}
|
||||
|
||||
local_var_url_path <- "/fake/test_optional_body_parameter"
|
||||
|
@ -158,10 +158,35 @@ FormatTest <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return FormatTest in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return FormatTest as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of FormatTest (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert FormatTest to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
FormatTestObject <- list()
|
||||
if (!is.null(self$`integer`)) {
|
||||
FormatTestObject[["integer"]] <-
|
||||
@ -227,7 +252,7 @@ FormatTest <- R6::R6Class(
|
||||
FormatTestObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
FormatTestObject
|
||||
return(FormatTestObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -294,138 +319,16 @@ FormatTest <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return FormatTest in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`integer`)) {
|
||||
sprintf(
|
||||
'"integer":
|
||||
%d
|
||||
',
|
||||
self$`integer`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`int32`)) {
|
||||
sprintf(
|
||||
'"int32":
|
||||
%d
|
||||
',
|
||||
self$`int32`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`int64`)) {
|
||||
sprintf(
|
||||
'"int64":
|
||||
%d
|
||||
',
|
||||
self$`int64`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`number`)) {
|
||||
sprintf(
|
||||
'"number":
|
||||
%d
|
||||
',
|
||||
self$`number`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`float`)) {
|
||||
sprintf(
|
||||
'"float":
|
||||
%d
|
||||
',
|
||||
self$`float`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`double`)) {
|
||||
sprintf(
|
||||
'"double":
|
||||
%d
|
||||
',
|
||||
self$`double`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`string`)) {
|
||||
sprintf(
|
||||
'"string":
|
||||
"%s"
|
||||
',
|
||||
self$`string`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`byte`)) {
|
||||
sprintf(
|
||||
'"byte":
|
||||
"%s"
|
||||
',
|
||||
self$`byte`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`binary`)) {
|
||||
sprintf(
|
||||
'"binary":
|
||||
"%s"
|
||||
',
|
||||
self$`binary`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`date`)) {
|
||||
sprintf(
|
||||
'"date":
|
||||
"%s"
|
||||
',
|
||||
self$`date`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`dateTime`)) {
|
||||
sprintf(
|
||||
'"dateTime":
|
||||
"%s"
|
||||
',
|
||||
self$`dateTime`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`uuid`)) {
|
||||
sprintf(
|
||||
'"uuid":
|
||||
"%s"
|
||||
',
|
||||
self$`uuid`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`password`)) {
|
||||
sprintf(
|
||||
'"password":
|
||||
"%s"
|
||||
',
|
||||
self$`password`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`pattern_with_digits`)) {
|
||||
sprintf(
|
||||
'"pattern_with_digits":
|
||||
"%s"
|
||||
',
|
||||
self$`pattern_with_digits`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`pattern_with_digits_and_delimiter`)) {
|
||||
sprintf(
|
||||
'"pattern_with_digits_and_delimiter":
|
||||
"%s"
|
||||
',
|
||||
self$`pattern_with_digits_and_delimiter`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -135,25 +135,35 @@ Mammal <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' Serialize Mammal to JSON string.
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return JSON string representation of the Mammal.
|
||||
toJSONString = function() {
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
if (!is.null(self$actual_instance)) {
|
||||
as.character(jsonlite::minify(self$actual_instance$toJSONString()))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
} else {
|
||||
NULL
|
||||
return(NULL)
|
||||
}
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Serialize Mammal to JSON.
|
||||
#'
|
||||
#' @return JSON representation of the Mammal.
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Mammal to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
if (!is.null(self$actual_instance)) {
|
||||
self$actual_instance$toJSON()
|
||||
return(self$actual_instance$toSimpleType())
|
||||
} else {
|
||||
NULL
|
||||
return(NULL)
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -59,10 +59,35 @@ ModelApiResponse <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return ModelApiResponse in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return ModelApiResponse as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of ModelApiResponse (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert ModelApiResponse to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
ModelApiResponseObject <- list()
|
||||
if (!is.null(self$`code`)) {
|
||||
ModelApiResponseObject[["code"]] <-
|
||||
@ -80,7 +105,7 @@ ModelApiResponse <- R6::R6Class(
|
||||
ModelApiResponseObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
ModelApiResponseObject
|
||||
return(ModelApiResponseObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -111,42 +136,16 @@ ModelApiResponse <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return ModelApiResponse in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`code`)) {
|
||||
sprintf(
|
||||
'"code":
|
||||
%d
|
||||
',
|
||||
self$`code`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`type`)) {
|
||||
sprintf(
|
||||
'"type":
|
||||
"%s"
|
||||
',
|
||||
self$`type`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`message`)) {
|
||||
sprintf(
|
||||
'"message":
|
||||
"%s"
|
||||
',
|
||||
self$`message`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -48,10 +48,35 @@ NestedOneOf <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return NestedOneOf in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return NestedOneOf as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of NestedOneOf (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert NestedOneOf to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
NestedOneOfObject <- list()
|
||||
if (!is.null(self$`size`)) {
|
||||
NestedOneOfObject[["size"]] <-
|
||||
@ -59,13 +84,13 @@ NestedOneOf <- R6::R6Class(
|
||||
}
|
||||
if (!is.null(self$`nested_pig`)) {
|
||||
NestedOneOfObject[["nested_pig"]] <-
|
||||
self$`nested_pig`$toJSON()
|
||||
self$`nested_pig`$toSimpleType()
|
||||
}
|
||||
for (key in names(self$additional_properties)) {
|
||||
NestedOneOfObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
NestedOneOfObject
|
||||
return(NestedOneOfObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -95,34 +120,16 @@ NestedOneOf <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return NestedOneOf in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`size`)) {
|
||||
sprintf(
|
||||
'"size":
|
||||
%d
|
||||
',
|
||||
self$`size`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`nested_pig`)) {
|
||||
sprintf(
|
||||
'"nested_pig":
|
||||
%s
|
||||
',
|
||||
jsonlite::toJSON(self$`nested_pig`$toJSON(), auto_unbox = TRUE, digits = NA)
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -111,25 +111,35 @@ OneOfPrimitiveTypeTest <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' Serialize OneOfPrimitiveTypeTest to JSON string.
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return JSON string representation of the OneOfPrimitiveTypeTest.
|
||||
toJSONString = function() {
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
if (!is.null(self$actual_instance)) {
|
||||
as.character(jsonlite::minify(self$actual_instance$toJSONString()))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
} else {
|
||||
NULL
|
||||
return(NULL)
|
||||
}
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Serialize OneOfPrimitiveTypeTest to JSON.
|
||||
#'
|
||||
#' @return JSON representation of the OneOfPrimitiveTypeTest.
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert OneOfPrimitiveTypeTest to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
if (!is.null(self$actual_instance)) {
|
||||
self$actual_instance$toJSON()
|
||||
return(self$actual_instance$toSimpleType())
|
||||
} else {
|
||||
NULL
|
||||
return(NULL)
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -89,10 +89,35 @@ Order <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return Order in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return Order as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of Order (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Order to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
OrderObject <- list()
|
||||
if (!is.null(self$`id`)) {
|
||||
OrderObject[["id"]] <-
|
||||
@ -122,7 +147,7 @@ Order <- R6::R6Class(
|
||||
OrderObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
OrderObject
|
||||
return(OrderObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -165,66 +190,16 @@ Order <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return Order in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`id`)) {
|
||||
sprintf(
|
||||
'"id":
|
||||
%d
|
||||
',
|
||||
self$`id`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`petId`)) {
|
||||
sprintf(
|
||||
'"petId":
|
||||
%d
|
||||
',
|
||||
self$`petId`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`quantity`)) {
|
||||
sprintf(
|
||||
'"quantity":
|
||||
%d
|
||||
',
|
||||
self$`quantity`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`shipDate`)) {
|
||||
sprintf(
|
||||
'"shipDate":
|
||||
"%s"
|
||||
',
|
||||
self$`shipDate`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`status`)) {
|
||||
sprintf(
|
||||
'"status":
|
||||
"%s"
|
||||
',
|
||||
self$`status`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`complete`)) {
|
||||
sprintf(
|
||||
'"complete":
|
||||
%s
|
||||
',
|
||||
tolower(self$`complete`)
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -85,10 +85,35 @@ Pet <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return Pet in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return Pet as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of Pet (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Pet to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
PetObject <- list()
|
||||
if (!is.null(self$`id`)) {
|
||||
PetObject[["id"]] <-
|
||||
@ -96,7 +121,7 @@ Pet <- R6::R6Class(
|
||||
}
|
||||
if (!is.null(self$`category`)) {
|
||||
PetObject[["category"]] <-
|
||||
self$`category`$toJSON()
|
||||
self$`category`$toSimpleType()
|
||||
}
|
||||
if (!is.null(self$`name`)) {
|
||||
PetObject[["name"]] <-
|
||||
@ -108,7 +133,7 @@ Pet <- R6::R6Class(
|
||||
}
|
||||
if (!is.null(self$`tags`)) {
|
||||
PetObject[["tags"]] <-
|
||||
lapply(self$`tags`, function(x) x$toJSON())
|
||||
lapply(self$`tags`, function(x) x$toSimpleType())
|
||||
}
|
||||
if (!is.null(self$`status`)) {
|
||||
PetObject[["status"]] <-
|
||||
@ -118,7 +143,7 @@ Pet <- R6::R6Class(
|
||||
PetObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
PetObject
|
||||
return(PetObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -163,66 +188,16 @@ Pet <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return Pet in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`id`)) {
|
||||
sprintf(
|
||||
'"id":
|
||||
%d
|
||||
',
|
||||
self$`id`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`category`)) {
|
||||
sprintf(
|
||||
'"category":
|
||||
%s
|
||||
',
|
||||
jsonlite::toJSON(self$`category`$toJSON(), auto_unbox = TRUE, digits = NA)
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`name`)) {
|
||||
sprintf(
|
||||
'"name":
|
||||
"%s"
|
||||
',
|
||||
self$`name`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`photoUrls`)) {
|
||||
sprintf(
|
||||
'"photoUrls":
|
||||
[%s]
|
||||
',
|
||||
paste(unlist(lapply(self$`photoUrls`, function(x) paste0('"', x, '"'))), collapse = ",")
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`tags`)) {
|
||||
sprintf(
|
||||
'"tags":
|
||||
[%s]
|
||||
',
|
||||
paste(sapply(self$`tags`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox = TRUE, digits = NA)), collapse = ",")
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`status`)) {
|
||||
sprintf(
|
||||
'"status":
|
||||
"%s"
|
||||
',
|
||||
self$`status`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -435,7 +435,7 @@ PetApi <- R6::R6Class(
|
||||
if (!is.null(`pet`)) {
|
||||
local_var_body <- `pet`$toJSONString()
|
||||
} else {
|
||||
body <- NULL
|
||||
local_var_body <- NULL
|
||||
}
|
||||
|
||||
local_var_url_path <- "/pet"
|
||||
@ -1288,7 +1288,7 @@ PetApi <- R6::R6Class(
|
||||
if (!is.null(`pet`)) {
|
||||
local_var_body <- `pet`$toJSONString()
|
||||
} else {
|
||||
body <- NULL
|
||||
local_var_body <- NULL
|
||||
}
|
||||
|
||||
local_var_url_path <- "/pet"
|
||||
|
@ -40,10 +40,35 @@ PetMap <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return PetMap in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return PetMap as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of PetMap (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert PetMap to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
PetMapObject <- list()
|
||||
if (!is.null(self$`pet`)) {
|
||||
PetMapObject[["pet"]] <-
|
||||
@ -53,7 +78,7 @@ PetMap <- R6::R6Class(
|
||||
PetMapObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
PetMapObject
|
||||
return(PetMapObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -78,26 +103,16 @@ PetMap <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return PetMap in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`pet`)) {
|
||||
sprintf(
|
||||
'"pet":
|
||||
%s
|
||||
',
|
||||
jsonlite::toJSON(lapply(self$`pet`, function(x){ x }), auto_unbox = TRUE, digits = NA)
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -135,25 +135,35 @@ Pig <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' Serialize Pig to JSON string.
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return JSON string representation of the Pig.
|
||||
toJSONString = function() {
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
if (!is.null(self$actual_instance)) {
|
||||
as.character(jsonlite::minify(self$actual_instance$toJSONString()))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
} else {
|
||||
NULL
|
||||
return(NULL)
|
||||
}
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Serialize Pig to JSON.
|
||||
#'
|
||||
#' @return JSON representation of the Pig.
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Pig to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
if (!is.null(self$actual_instance)) {
|
||||
self$actual_instance$toJSON()
|
||||
return(self$actual_instance$toSimpleType())
|
||||
} else {
|
||||
NULL
|
||||
return(NULL)
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -97,10 +97,35 @@ Special <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return Special in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return Special as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of Special (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Special to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
SpecialObject <- list()
|
||||
if (!is.null(self$`set_test`)) {
|
||||
SpecialObject[["set_test"]] <-
|
||||
@ -134,7 +159,7 @@ Special <- R6::R6Class(
|
||||
SpecialObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
SpecialObject
|
||||
return(SpecialObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -180,74 +205,16 @@ Special <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return Special in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`set_test`)) {
|
||||
sprintf(
|
||||
'"set_test":
|
||||
[%s]
|
||||
',
|
||||
paste(unlist(lapply(self$`set_test`, function(x) paste0('"', x, '"'))), collapse = ",")
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`item_self`)) {
|
||||
sprintf(
|
||||
'"self":
|
||||
%d
|
||||
',
|
||||
self$`item_self`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`item_private`)) {
|
||||
sprintf(
|
||||
'"private":
|
||||
"%s"
|
||||
',
|
||||
self$`item_private`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`item_super`)) {
|
||||
sprintf(
|
||||
'"super":
|
||||
"%s"
|
||||
',
|
||||
self$`item_super`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`123_number`)) {
|
||||
sprintf(
|
||||
'"123_number":
|
||||
"%s"
|
||||
',
|
||||
self$`123_number`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`array[test]`)) {
|
||||
sprintf(
|
||||
'"array[test]":
|
||||
"%s"
|
||||
',
|
||||
self$`array[test]`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`empty_string`)) {
|
||||
sprintf(
|
||||
'"empty_string":
|
||||
"%s"
|
||||
',
|
||||
self$`empty_string`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -546,7 +546,7 @@ StoreApi <- R6::R6Class(
|
||||
if (!is.null(`order`)) {
|
||||
local_var_body <- `order`$toJSONString()
|
||||
} else {
|
||||
body <- NULL
|
||||
local_var_body <- NULL
|
||||
}
|
||||
|
||||
local_var_url_path <- "/store/order"
|
||||
|
@ -50,10 +50,35 @@ Tag <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return Tag in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return Tag as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of Tag (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Tag to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
TagObject <- list()
|
||||
if (!is.null(self$`id`)) {
|
||||
TagObject[["id"]] <-
|
||||
@ -67,7 +92,7 @@ Tag <- R6::R6Class(
|
||||
TagObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
TagObject
|
||||
return(TagObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -95,34 +120,16 @@ Tag <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return Tag in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`id`)) {
|
||||
sprintf(
|
||||
'"id":
|
||||
%d
|
||||
',
|
||||
self$`id`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`name`)) {
|
||||
sprintf(
|
||||
'"name":
|
||||
"%s"
|
||||
',
|
||||
self$`name`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -45,14 +45,39 @@ UpdatePetRequest <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return UpdatePetRequest in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return UpdatePetRequest as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of UpdatePetRequest (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert UpdatePetRequest to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
UpdatePetRequestObject <- list()
|
||||
if (!is.null(self$`jsonData`)) {
|
||||
UpdatePetRequestObject[["jsonData"]] <-
|
||||
self$`jsonData`$toJSON()
|
||||
self$`jsonData`$toSimpleType()
|
||||
}
|
||||
if (!is.null(self$`binaryDataN2Information`)) {
|
||||
UpdatePetRequestObject[["binaryDataN2Information"]] <-
|
||||
@ -62,7 +87,7 @@ UpdatePetRequest <- R6::R6Class(
|
||||
UpdatePetRequestObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
UpdatePetRequestObject
|
||||
return(UpdatePetRequestObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -92,34 +117,16 @@ UpdatePetRequest <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return UpdatePetRequest in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`jsonData`)) {
|
||||
sprintf(
|
||||
'"jsonData":
|
||||
%s
|
||||
',
|
||||
jsonlite::toJSON(self$`jsonData`$toJSON(), auto_unbox = TRUE, digits = NA)
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`binaryDataN2Information`)) {
|
||||
sprintf(
|
||||
'"binaryDataN2Information":
|
||||
"%s"
|
||||
',
|
||||
self$`binaryDataN2Information`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -104,10 +104,35 @@ User <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return User in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return User as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of User (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert User to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
UserObject <- list()
|
||||
if (!is.null(self$`id`)) {
|
||||
UserObject[["id"]] <-
|
||||
@ -145,7 +170,7 @@ User <- R6::R6Class(
|
||||
UserObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
UserObject
|
||||
return(UserObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -191,82 +216,16 @@ User <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return User in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`id`)) {
|
||||
sprintf(
|
||||
'"id":
|
||||
%d
|
||||
',
|
||||
self$`id`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`username`)) {
|
||||
sprintf(
|
||||
'"username":
|
||||
"%s"
|
||||
',
|
||||
self$`username`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`firstName`)) {
|
||||
sprintf(
|
||||
'"firstName":
|
||||
"%s"
|
||||
',
|
||||
self$`firstName`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`lastName`)) {
|
||||
sprintf(
|
||||
'"lastName":
|
||||
"%s"
|
||||
',
|
||||
self$`lastName`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`email`)) {
|
||||
sprintf(
|
||||
'"email":
|
||||
"%s"
|
||||
',
|
||||
self$`email`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`password`)) {
|
||||
sprintf(
|
||||
'"password":
|
||||
"%s"
|
||||
',
|
||||
self$`password`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`phone`)) {
|
||||
sprintf(
|
||||
'"phone":
|
||||
"%s"
|
||||
',
|
||||
self$`phone`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`userStatus`)) {
|
||||
sprintf(
|
||||
'"userStatus":
|
||||
%d
|
||||
',
|
||||
self$`userStatus`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -318,7 +318,7 @@ UserApi <- R6::R6Class(
|
||||
if (!is.null(`user`)) {
|
||||
local_var_body <- `user`$toJSONString()
|
||||
} else {
|
||||
body <- NULL
|
||||
local_var_body <- NULL
|
||||
}
|
||||
|
||||
local_var_url_path <- "/user"
|
||||
@ -428,7 +428,7 @@ UserApi <- R6::R6Class(
|
||||
})), collapse = ",")
|
||||
local_var_body <- paste0("[", body.items, "]")
|
||||
} else {
|
||||
body <- NULL
|
||||
local_var_body <- NULL
|
||||
}
|
||||
|
||||
local_var_url_path <- "/user/createWithArray"
|
||||
@ -538,7 +538,7 @@ UserApi <- R6::R6Class(
|
||||
})), collapse = ",")
|
||||
local_var_body <- paste0("[", body.items, "]")
|
||||
} else {
|
||||
body <- NULL
|
||||
local_var_body <- NULL
|
||||
}
|
||||
|
||||
local_var_url_path <- "/user/createWithList"
|
||||
@ -1099,7 +1099,7 @@ UserApi <- R6::R6Class(
|
||||
if (!is.null(`user`)) {
|
||||
local_var_body <- `user`$toJSONString()
|
||||
} else {
|
||||
body <- NULL
|
||||
local_var_body <- NULL
|
||||
}
|
||||
|
||||
local_var_url_path <- "/user/{username}"
|
||||
|
@ -59,10 +59,35 @@ Whale <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return Whale in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return Whale as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of Whale (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Whale to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
WhaleObject <- list()
|
||||
if (!is.null(self$`hasBaleen`)) {
|
||||
WhaleObject[["hasBaleen"]] <-
|
||||
@ -80,7 +105,7 @@ Whale <- R6::R6Class(
|
||||
WhaleObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
WhaleObject
|
||||
return(WhaleObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -111,42 +136,16 @@ Whale <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return Whale in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`hasBaleen`)) {
|
||||
sprintf(
|
||||
'"hasBaleen":
|
||||
%s
|
||||
',
|
||||
tolower(self$`hasBaleen`)
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`hasTeeth`)) {
|
||||
sprintf(
|
||||
'"hasTeeth":
|
||||
%s
|
||||
',
|
||||
tolower(self$`hasTeeth`)
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`className`)) {
|
||||
sprintf(
|
||||
'"className":
|
||||
"%s"
|
||||
',
|
||||
self$`className`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -53,10 +53,35 @@ Zebra <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return Zebra in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return Zebra as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of Zebra (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Zebra to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
ZebraObject <- list()
|
||||
if (!is.null(self$`type`)) {
|
||||
ZebraObject[["type"]] <-
|
||||
@ -70,7 +95,7 @@ Zebra <- R6::R6Class(
|
||||
ZebraObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
ZebraObject
|
||||
return(ZebraObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -101,34 +126,16 @@ Zebra <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return Zebra in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`type`)) {
|
||||
sprintf(
|
||||
'"type":
|
||||
"%s"
|
||||
',
|
||||
self$`type`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`className`)) {
|
||||
sprintf(
|
||||
'"className":
|
||||
"%s"
|
||||
',
|
||||
self$`className`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -70,7 +70,7 @@ test_that("Test toJSON toJSONString fromJSON fromJSONString print", {
|
||||
|
||||
# tests for other pet objects
|
||||
pet0 <- Pet$new()
|
||||
jsonpet <- pet0$toJSON()
|
||||
jsonpet <- pet0$toSimpleType()
|
||||
pet2 <- pet0$fromJSON(
|
||||
jsonlite::toJSON(jsonpet, auto_unbox = TRUE)
|
||||
)
|
||||
@ -96,7 +96,7 @@ test_that("Test toJSON toJSONString fromJSON fromJSONString print", {
|
||||
),
|
||||
status = "available"
|
||||
)
|
||||
jsonpet <- pet1$toJSON()
|
||||
jsonpet <- pet1$toSimpleType()
|
||||
pet2 <- pet1$fromJSON(
|
||||
jsonlite::toJSON(jsonpet, auto_unbox = TRUE)
|
||||
)
|
||||
@ -118,7 +118,7 @@ test_that("Test toJSON toJSONString fromJSON fromJSONString print", {
|
||||
test_that("Test Category", {
|
||||
c1 <- Category$new(id = 450, name = "test_cat")
|
||||
c2 <- Category$new()
|
||||
c2$fromJSON(jsonlite::toJSON(c1$toJSON(), auto_unbox = TRUE))
|
||||
c2$fromJSON(jsonlite::toJSON(c1$toSimpleType(), auto_unbox = TRUE))
|
||||
expect_equal(c1, c2)
|
||||
c2$fromJSONString(c1$toJSONString())
|
||||
expect_equal(c1, c2)
|
||||
|
@ -67,10 +67,35 @@ AllofTagApiResponse <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return AllofTagApiResponse in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return AllofTagApiResponse as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of AllofTagApiResponse (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert AllofTagApiResponse to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
AllofTagApiResponseObject <- list()
|
||||
if (!is.null(self$`id`)) {
|
||||
AllofTagApiResponseObject[["id"]] <-
|
||||
@ -92,7 +117,7 @@ AllofTagApiResponse <- R6::R6Class(
|
||||
AllofTagApiResponseObject[["message"]] <-
|
||||
self$`message`
|
||||
}
|
||||
AllofTagApiResponseObject
|
||||
return(AllofTagApiResponseObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -122,53 +147,13 @@ AllofTagApiResponse <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return AllofTagApiResponse in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`id`)) {
|
||||
sprintf(
|
||||
'"id":
|
||||
%d
|
||||
',
|
||||
self$`id`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`name`)) {
|
||||
sprintf(
|
||||
'"name":
|
||||
"%s"
|
||||
',
|
||||
self$`name`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`code`)) {
|
||||
sprintf(
|
||||
'"code":
|
||||
%d
|
||||
',
|
||||
self$`code`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`type`)) {
|
||||
sprintf(
|
||||
'"type":
|
||||
"%s"
|
||||
',
|
||||
self$`type`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`message`)) {
|
||||
sprintf(
|
||||
'"message":
|
||||
"%s"
|
||||
',
|
||||
self$`message`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -42,10 +42,35 @@ Animal <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return Animal in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return Animal as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of Animal (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Animal to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
AnimalObject <- list()
|
||||
if (!is.null(self$`className`)) {
|
||||
AnimalObject[["className"]] <-
|
||||
@ -55,7 +80,7 @@ Animal <- R6::R6Class(
|
||||
AnimalObject[["color"]] <-
|
||||
self$`color`
|
||||
}
|
||||
AnimalObject
|
||||
return(AnimalObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -76,29 +101,13 @@ Animal <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return Animal in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`className`)) {
|
||||
sprintf(
|
||||
'"className":
|
||||
"%s"
|
||||
',
|
||||
self$`className`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`color`)) {
|
||||
sprintf(
|
||||
'"color":
|
||||
"%s"
|
||||
',
|
||||
self$`color`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -91,27 +91,32 @@ AnyOfPig <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Serialize AnyOfPig to JSON string.
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert AnyOfPig to a base R type
|
||||
#'
|
||||
#' @return JSON string representation of the AnyOfPig.
|
||||
toJSONString = function() {
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
if (!is.null(self$actual_instance)) {
|
||||
as.character(jsonlite::minify((self$actual_instance$toJSONString())))
|
||||
return(self$actual_instance$toSimpleType())
|
||||
} else {
|
||||
NULL
|
||||
}
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Serialize AnyOfPig to JSON.
|
||||
#' Serialize AnyOfPig to JSON string.
|
||||
#'
|
||||
#' @return JSON representation of the AnyOfPig.
|
||||
toJSON = function() {
|
||||
if (!is.null(self$actual_instance)) {
|
||||
self$actual_instance$toJSON()
|
||||
} else {
|
||||
NULL
|
||||
}
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return JSON string representation of the AnyOfPig.
|
||||
toJSONString = function(...) {
|
||||
json <- jsonlite::toJSON(self$toSimpleType(), auto_unbox = TRUE, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -111,25 +111,35 @@ AnyOfPrimitiveTypeTest <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' Serialize AnyOfPrimitiveTypeTest to JSON string.
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return JSON string representation of the AnyOfPrimitiveTypeTest.
|
||||
toJSONString = function() {
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
if (!is.null(self$actual_instance)) {
|
||||
as.character(jsonlite::minify(self$actual_instance$toJSONString()))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
} else {
|
||||
NULL
|
||||
return(NULL)
|
||||
}
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Serialize AnyOfPrimitiveTypeTest to JSON.
|
||||
#'
|
||||
#' @return JSON representation of the AnyOfPrimitiveTypeTest.
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert AnyOfPrimitiveTypeTest to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
if (!is.null(self$actual_instance)) {
|
||||
self$actual_instance$toJSON()
|
||||
return(self$actual_instance$toSimpleType())
|
||||
} else {
|
||||
NULL
|
||||
return(NULL)
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -40,10 +40,35 @@ BasquePig <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return BasquePig in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return BasquePig as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of BasquePig (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert BasquePig to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
BasquePigObject <- list()
|
||||
if (!is.null(self$`className`)) {
|
||||
BasquePigObject[["className"]] <-
|
||||
@ -53,7 +78,7 @@ BasquePig <- R6::R6Class(
|
||||
BasquePigObject[["color"]] <-
|
||||
self$`color`
|
||||
}
|
||||
BasquePigObject
|
||||
return(BasquePigObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -74,29 +99,13 @@ BasquePig <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return BasquePig in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`className`)) {
|
||||
sprintf(
|
||||
'"className":
|
||||
"%s"
|
||||
',
|
||||
self$`className`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`color`)) {
|
||||
sprintf(
|
||||
'"color":
|
||||
"%s"
|
||||
',
|
||||
self$`color`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -50,10 +50,35 @@ Cat <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return Cat in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return Cat as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of Cat (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Cat to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
CatObject <- list()
|
||||
if (!is.null(self$`className`)) {
|
||||
CatObject[["className"]] <-
|
||||
@ -67,7 +92,7 @@ Cat <- R6::R6Class(
|
||||
CatObject[["declawed"]] <-
|
||||
self$`declawed`
|
||||
}
|
||||
CatObject
|
||||
return(CatObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -91,37 +116,13 @@ Cat <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return Cat in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`className`)) {
|
||||
sprintf(
|
||||
'"className":
|
||||
"%s"
|
||||
',
|
||||
self$`className`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`color`)) {
|
||||
sprintf(
|
||||
'"color":
|
||||
"%s"
|
||||
',
|
||||
self$`color`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`declawed`)) {
|
||||
sprintf(
|
||||
'"declawed":
|
||||
%s
|
||||
',
|
||||
tolower(self$`declawed`)
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -40,10 +40,35 @@ Category <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return Category in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return Category as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of Category (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Category to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
CategoryObject <- list()
|
||||
if (!is.null(self$`id`)) {
|
||||
CategoryObject[["id"]] <-
|
||||
@ -53,7 +78,7 @@ Category <- R6::R6Class(
|
||||
CategoryObject[["name"]] <-
|
||||
self$`name`
|
||||
}
|
||||
CategoryObject
|
||||
return(CategoryObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -74,29 +99,13 @@ Category <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return Category in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`id`)) {
|
||||
sprintf(
|
||||
'"id":
|
||||
%d
|
||||
',
|
||||
self$`id`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`name`)) {
|
||||
sprintf(
|
||||
'"name":
|
||||
"%s"
|
||||
',
|
||||
self$`name`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -40,10 +40,35 @@ DanishPig <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return DanishPig in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return DanishPig as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of DanishPig (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert DanishPig to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
DanishPigObject <- list()
|
||||
if (!is.null(self$`className`)) {
|
||||
DanishPigObject[["className"]] <-
|
||||
@ -53,7 +78,7 @@ DanishPig <- R6::R6Class(
|
||||
DanishPigObject[["size"]] <-
|
||||
self$`size`
|
||||
}
|
||||
DanishPigObject
|
||||
return(DanishPigObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -74,29 +99,13 @@ DanishPig <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return DanishPig in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`className`)) {
|
||||
sprintf(
|
||||
'"className":
|
||||
"%s"
|
||||
',
|
||||
self$`className`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`size`)) {
|
||||
sprintf(
|
||||
'"size":
|
||||
%d
|
||||
',
|
||||
self$`size`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -53,10 +53,35 @@ Date <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return Date in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return Date as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of Date (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Date to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
DateObject <- list()
|
||||
if (!is.null(self$`className`)) {
|
||||
DateObject[["className"]] <-
|
||||
@ -70,7 +95,7 @@ Date <- R6::R6Class(
|
||||
DateObject[["url_property"]] <-
|
||||
self$`url_property`
|
||||
}
|
||||
DateObject
|
||||
return(DateObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -98,37 +123,13 @@ Date <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return Date in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`className`)) {
|
||||
sprintf(
|
||||
'"className":
|
||||
"%s"
|
||||
',
|
||||
self$`className`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`percent`)) {
|
||||
sprintf(
|
||||
'"percent_description":
|
||||
"%s"
|
||||
',
|
||||
self$`percent`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`url_property`)) {
|
||||
sprintf(
|
||||
'"url_property":
|
||||
"%s"
|
||||
',
|
||||
self$`url_property`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -50,10 +50,35 @@ Dog <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return Dog in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return Dog as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of Dog (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Dog to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
DogObject <- list()
|
||||
if (!is.null(self$`className`)) {
|
||||
DogObject[["className"]] <-
|
||||
@ -67,7 +92,7 @@ Dog <- R6::R6Class(
|
||||
DogObject[["breed"]] <-
|
||||
self$`breed`
|
||||
}
|
||||
DogObject
|
||||
return(DogObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -91,37 +116,13 @@ Dog <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return Dog in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`className`)) {
|
||||
sprintf(
|
||||
'"className":
|
||||
"%s"
|
||||
',
|
||||
self$`className`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`color`)) {
|
||||
sprintf(
|
||||
'"color":
|
||||
"%s"
|
||||
',
|
||||
self$`color`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`breed`)) {
|
||||
sprintf(
|
||||
'"breed":
|
||||
"%s"
|
||||
',
|
||||
self$`breed`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -225,7 +225,7 @@ FakeApi <- R6::R6Class(
|
||||
if (!is.null(`pet`)) {
|
||||
local_var_body <- `pet`$toJSONString()
|
||||
} else {
|
||||
body <- NULL
|
||||
local_var_body <- NULL
|
||||
}
|
||||
|
||||
local_var_url_path <- "/fake/test_optional_body_parameter"
|
||||
|
@ -148,10 +148,35 @@ FormatTest <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return FormatTest in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return FormatTest as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of FormatTest (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert FormatTest to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
FormatTestObject <- list()
|
||||
if (!is.null(self$`integer`)) {
|
||||
FormatTestObject[["integer"]] <-
|
||||
@ -213,7 +238,7 @@ FormatTest <- R6::R6Class(
|
||||
FormatTestObject[["pattern_with_digits_and_delimiter"]] <-
|
||||
self$`pattern_with_digits_and_delimiter`
|
||||
}
|
||||
FormatTestObject
|
||||
return(FormatTestObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -273,133 +298,13 @@ FormatTest <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return FormatTest in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`integer`)) {
|
||||
sprintf(
|
||||
'"integer":
|
||||
%d
|
||||
',
|
||||
self$`integer`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`int32`)) {
|
||||
sprintf(
|
||||
'"int32":
|
||||
%d
|
||||
',
|
||||
self$`int32`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`int64`)) {
|
||||
sprintf(
|
||||
'"int64":
|
||||
%d
|
||||
',
|
||||
self$`int64`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`number`)) {
|
||||
sprintf(
|
||||
'"number":
|
||||
%d
|
||||
',
|
||||
self$`number`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`float`)) {
|
||||
sprintf(
|
||||
'"float":
|
||||
%d
|
||||
',
|
||||
self$`float`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`double`)) {
|
||||
sprintf(
|
||||
'"double":
|
||||
%d
|
||||
',
|
||||
self$`double`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`string`)) {
|
||||
sprintf(
|
||||
'"string":
|
||||
"%s"
|
||||
',
|
||||
self$`string`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`byte`)) {
|
||||
sprintf(
|
||||
'"byte":
|
||||
"%s"
|
||||
',
|
||||
self$`byte`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`binary`)) {
|
||||
sprintf(
|
||||
'"binary":
|
||||
"%s"
|
||||
',
|
||||
self$`binary`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`date`)) {
|
||||
sprintf(
|
||||
'"date":
|
||||
"%s"
|
||||
',
|
||||
self$`date`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`dateTime`)) {
|
||||
sprintf(
|
||||
'"dateTime":
|
||||
"%s"
|
||||
',
|
||||
self$`dateTime`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`uuid`)) {
|
||||
sprintf(
|
||||
'"uuid":
|
||||
"%s"
|
||||
',
|
||||
self$`uuid`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`password`)) {
|
||||
sprintf(
|
||||
'"password":
|
||||
"%s"
|
||||
',
|
||||
self$`password`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`pattern_with_digits`)) {
|
||||
sprintf(
|
||||
'"pattern_with_digits":
|
||||
"%s"
|
||||
',
|
||||
self$`pattern_with_digits`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`pattern_with_digits_and_delimiter`)) {
|
||||
sprintf(
|
||||
'"pattern_with_digits_and_delimiter":
|
||||
"%s"
|
||||
',
|
||||
self$`pattern_with_digits_and_delimiter`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -31,16 +31,41 @@ JustModel <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return JustModel in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return JustModel as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of JustModel (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert JustModel to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
JustModelObject <- list()
|
||||
if (!is.null(self$`property`)) {
|
||||
JustModelObject[["property"]] <-
|
||||
self$`property`
|
||||
}
|
||||
JustModelObject
|
||||
return(JustModelObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -58,21 +83,13 @@ JustModel <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return JustModel in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`property`)) {
|
||||
sprintf(
|
||||
'"property":
|
||||
"%s"
|
||||
',
|
||||
self$`property`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -109,25 +109,35 @@ Mammal <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' Serialize Mammal to JSON string.
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return JSON string representation of the Mammal.
|
||||
toJSONString = function() {
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
if (!is.null(self$actual_instance)) {
|
||||
as.character(jsonlite::minify(self$actual_instance$toJSONString()))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
} else {
|
||||
NULL
|
||||
return(NULL)
|
||||
}
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Serialize Mammal to JSON.
|
||||
#'
|
||||
#' @return JSON representation of the Mammal.
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Mammal to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
if (!is.null(self$actual_instance)) {
|
||||
self$actual_instance$toJSON()
|
||||
return(self$actual_instance$toSimpleType())
|
||||
} else {
|
||||
NULL
|
||||
return(NULL)
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -49,10 +49,35 @@ ModelApiResponse <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return ModelApiResponse in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return ModelApiResponse as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of ModelApiResponse (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert ModelApiResponse to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
ModelApiResponseObject <- list()
|
||||
if (!is.null(self$`code`)) {
|
||||
ModelApiResponseObject[["code"]] <-
|
||||
@ -66,7 +91,7 @@ ModelApiResponse <- R6::R6Class(
|
||||
ModelApiResponseObject[["message"]] <-
|
||||
self$`message`
|
||||
}
|
||||
ModelApiResponseObject
|
||||
return(ModelApiResponseObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -90,37 +115,13 @@ ModelApiResponse <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return ModelApiResponse in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`code`)) {
|
||||
sprintf(
|
||||
'"code":
|
||||
%d
|
||||
',
|
||||
self$`code`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`type`)) {
|
||||
sprintf(
|
||||
'"type":
|
||||
"%s"
|
||||
',
|
||||
self$`type`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`message`)) {
|
||||
sprintf(
|
||||
'"message":
|
||||
"%s"
|
||||
',
|
||||
self$`message`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -38,10 +38,35 @@ NestedOneOf <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return NestedOneOf in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return NestedOneOf as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of NestedOneOf (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert NestedOneOf to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
NestedOneOfObject <- list()
|
||||
if (!is.null(self$`size`)) {
|
||||
NestedOneOfObject[["size"]] <-
|
||||
@ -49,9 +74,9 @@ NestedOneOf <- R6::R6Class(
|
||||
}
|
||||
if (!is.null(self$`nested_pig`)) {
|
||||
NestedOneOfObject[["nested_pig"]] <-
|
||||
self$`nested_pig`$toJSON()
|
||||
self$`nested_pig`$toSimpleType()
|
||||
}
|
||||
NestedOneOfObject
|
||||
return(NestedOneOfObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -74,29 +99,13 @@ NestedOneOf <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return NestedOneOf in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`size`)) {
|
||||
sprintf(
|
||||
'"size":
|
||||
%d
|
||||
',
|
||||
self$`size`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`nested_pig`)) {
|
||||
sprintf(
|
||||
'"nested_pig":
|
||||
%s
|
||||
',
|
||||
jsonlite::toJSON(self$`nested_pig`$toJSON(), auto_unbox = TRUE, digits = NA)
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -111,25 +111,35 @@ OneOfPrimitiveTypeTest <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' Serialize OneOfPrimitiveTypeTest to JSON string.
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return JSON string representation of the OneOfPrimitiveTypeTest.
|
||||
toJSONString = function() {
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
if (!is.null(self$actual_instance)) {
|
||||
as.character(jsonlite::minify(self$actual_instance$toJSONString()))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
} else {
|
||||
NULL
|
||||
return(NULL)
|
||||
}
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Serialize OneOfPrimitiveTypeTest to JSON.
|
||||
#'
|
||||
#' @return JSON representation of the OneOfPrimitiveTypeTest.
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert OneOfPrimitiveTypeTest to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
if (!is.null(self$actual_instance)) {
|
||||
self$actual_instance$toJSON()
|
||||
return(self$actual_instance$toSimpleType())
|
||||
} else {
|
||||
NULL
|
||||
return(NULL)
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -79,10 +79,35 @@ Order <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return Order in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return Order as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of Order (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Order to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
OrderObject <- list()
|
||||
if (!is.null(self$`id`)) {
|
||||
OrderObject[["id"]] <-
|
||||
@ -108,7 +133,7 @@ Order <- R6::R6Class(
|
||||
OrderObject[["complete"]] <-
|
||||
self$`complete`
|
||||
}
|
||||
OrderObject
|
||||
return(OrderObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -144,61 +169,13 @@ Order <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return Order in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`id`)) {
|
||||
sprintf(
|
||||
'"id":
|
||||
%d
|
||||
',
|
||||
self$`id`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`petId`)) {
|
||||
sprintf(
|
||||
'"petId":
|
||||
%d
|
||||
',
|
||||
self$`petId`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`quantity`)) {
|
||||
sprintf(
|
||||
'"quantity":
|
||||
%d
|
||||
',
|
||||
self$`quantity`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`shipDate`)) {
|
||||
sprintf(
|
||||
'"shipDate":
|
||||
"%s"
|
||||
',
|
||||
self$`shipDate`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`status`)) {
|
||||
sprintf(
|
||||
'"status":
|
||||
"%s"
|
||||
',
|
||||
self$`status`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`complete`)) {
|
||||
sprintf(
|
||||
'"complete":
|
||||
%s
|
||||
',
|
||||
tolower(self$`complete`)
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -75,10 +75,35 @@ Pet <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return Pet in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return Pet as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of Pet (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Pet to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
PetObject <- list()
|
||||
if (!is.null(self$`id`)) {
|
||||
PetObject[["id"]] <-
|
||||
@ -86,7 +111,7 @@ Pet <- R6::R6Class(
|
||||
}
|
||||
if (!is.null(self$`category`)) {
|
||||
PetObject[["category"]] <-
|
||||
self$`category`$toJSON()
|
||||
self$`category`$toSimpleType()
|
||||
}
|
||||
if (!is.null(self$`name`)) {
|
||||
PetObject[["name"]] <-
|
||||
@ -98,13 +123,13 @@ Pet <- R6::R6Class(
|
||||
}
|
||||
if (!is.null(self$`tags`)) {
|
||||
PetObject[["tags"]] <-
|
||||
lapply(self$`tags`, function(x) x$toJSON())
|
||||
lapply(self$`tags`, function(x) x$toSimpleType())
|
||||
}
|
||||
if (!is.null(self$`status`)) {
|
||||
PetObject[["status"]] <-
|
||||
self$`status`
|
||||
}
|
||||
PetObject
|
||||
return(PetObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -142,61 +167,13 @@ Pet <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return Pet in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`id`)) {
|
||||
sprintf(
|
||||
'"id":
|
||||
%d
|
||||
',
|
||||
self$`id`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`category`)) {
|
||||
sprintf(
|
||||
'"category":
|
||||
%s
|
||||
',
|
||||
jsonlite::toJSON(self$`category`$toJSON(), auto_unbox = TRUE, digits = NA)
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`name`)) {
|
||||
sprintf(
|
||||
'"name":
|
||||
"%s"
|
||||
',
|
||||
self$`name`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`photoUrls`)) {
|
||||
sprintf(
|
||||
'"photoUrls":
|
||||
[%s]
|
||||
',
|
||||
paste(unlist(lapply(self$`photoUrls`, function(x) paste0('"', x, '"'))), collapse = ",")
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`tags`)) {
|
||||
sprintf(
|
||||
'"tags":
|
||||
[%s]
|
||||
',
|
||||
paste(sapply(self$`tags`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox = TRUE, digits = NA)), collapse = ",")
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`status`)) {
|
||||
sprintf(
|
||||
'"status":
|
||||
"%s"
|
||||
',
|
||||
self$`status`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -435,7 +435,7 @@ PetApi <- R6::R6Class(
|
||||
if (!is.null(`pet`)) {
|
||||
local_var_body <- `pet`$toJSONString()
|
||||
} else {
|
||||
body <- NULL
|
||||
local_var_body <- NULL
|
||||
}
|
||||
|
||||
local_var_url_path <- "/pet"
|
||||
@ -1288,7 +1288,7 @@ PetApi <- R6::R6Class(
|
||||
if (!is.null(`pet`)) {
|
||||
local_var_body <- `pet`$toJSONString()
|
||||
} else {
|
||||
body <- NULL
|
||||
local_var_body <- NULL
|
||||
}
|
||||
|
||||
local_var_url_path <- "/pet"
|
||||
|
@ -30,16 +30,41 @@ PetMap <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return PetMap in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return PetMap as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of PetMap (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert PetMap to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
PetMapObject <- list()
|
||||
if (!is.null(self$`pet`)) {
|
||||
PetMapObject[["pet"]] <-
|
||||
self$`pet`
|
||||
}
|
||||
PetMapObject
|
||||
return(PetMapObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -57,21 +82,13 @@ PetMap <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return PetMap in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`pet`)) {
|
||||
sprintf(
|
||||
'"pet":
|
||||
%s
|
||||
',
|
||||
jsonlite::toJSON(lapply(self$`pet`, function(x){ x }), auto_unbox = TRUE, digits = NA)
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -109,25 +109,35 @@ Pig <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' Serialize Pig to JSON string.
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return JSON string representation of the Pig.
|
||||
toJSONString = function() {
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
if (!is.null(self$actual_instance)) {
|
||||
as.character(jsonlite::minify(self$actual_instance$toJSONString()))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
} else {
|
||||
NULL
|
||||
return(NULL)
|
||||
}
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Serialize Pig to JSON.
|
||||
#'
|
||||
#' @return JSON representation of the Pig.
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Pig to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
if (!is.null(self$actual_instance)) {
|
||||
self$actual_instance$toJSON()
|
||||
return(self$actual_instance$toSimpleType())
|
||||
} else {
|
||||
NULL
|
||||
return(NULL)
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -87,10 +87,35 @@ Special <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return Special in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return Special as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of Special (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Special to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
SpecialObject <- list()
|
||||
if (!is.null(self$`set_test`)) {
|
||||
SpecialObject[["set_test"]] <-
|
||||
@ -120,7 +145,7 @@ Special <- R6::R6Class(
|
||||
SpecialObject[["empty_string"]] <-
|
||||
self$`empty_string`
|
||||
}
|
||||
SpecialObject
|
||||
return(SpecialObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -159,69 +184,13 @@ Special <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return Special in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`set_test`)) {
|
||||
sprintf(
|
||||
'"set_test":
|
||||
[%s]
|
||||
',
|
||||
paste(unlist(lapply(self$`set_test`, function(x) paste0('"', x, '"'))), collapse = ",")
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`item_self`)) {
|
||||
sprintf(
|
||||
'"self":
|
||||
%d
|
||||
',
|
||||
self$`item_self`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`item_private`)) {
|
||||
sprintf(
|
||||
'"private":
|
||||
"%s"
|
||||
',
|
||||
self$`item_private`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`item_super`)) {
|
||||
sprintf(
|
||||
'"super":
|
||||
"%s"
|
||||
',
|
||||
self$`item_super`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`123_number`)) {
|
||||
sprintf(
|
||||
'"123_number":
|
||||
"%s"
|
||||
',
|
||||
self$`123_number`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`array[test]`)) {
|
||||
sprintf(
|
||||
'"array[test]":
|
||||
"%s"
|
||||
',
|
||||
self$`array[test]`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`empty_string`)) {
|
||||
sprintf(
|
||||
'"empty_string":
|
||||
"%s"
|
||||
',
|
||||
self$`empty_string`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -546,7 +546,7 @@ StoreApi <- R6::R6Class(
|
||||
if (!is.null(`order`)) {
|
||||
local_var_body <- `order`$toJSONString()
|
||||
} else {
|
||||
body <- NULL
|
||||
local_var_body <- NULL
|
||||
}
|
||||
|
||||
local_var_url_path <- "/store/order"
|
||||
|
@ -40,10 +40,35 @@ Tag <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return Tag in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return Tag as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of Tag (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Tag to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
TagObject <- list()
|
||||
if (!is.null(self$`id`)) {
|
||||
TagObject[["id"]] <-
|
||||
@ -53,7 +78,7 @@ Tag <- R6::R6Class(
|
||||
TagObject[["name"]] <-
|
||||
self$`name`
|
||||
}
|
||||
TagObject
|
||||
return(TagObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -74,29 +99,13 @@ Tag <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return Tag in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`id`)) {
|
||||
sprintf(
|
||||
'"id":
|
||||
%d
|
||||
',
|
||||
self$`id`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`name`)) {
|
||||
sprintf(
|
||||
'"name":
|
||||
"%s"
|
||||
',
|
||||
self$`name`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -35,20 +35,45 @@ UpdatePetRequest <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return UpdatePetRequest in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return UpdatePetRequest as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of UpdatePetRequest (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert UpdatePetRequest to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
UpdatePetRequestObject <- list()
|
||||
if (!is.null(self$`jsonData`)) {
|
||||
UpdatePetRequestObject[["jsonData"]] <-
|
||||
self$`jsonData`$toJSON()
|
||||
self$`jsonData`$toSimpleType()
|
||||
}
|
||||
if (!is.null(self$`binaryDataN2Information`)) {
|
||||
UpdatePetRequestObject[["binaryDataN2Information"]] <-
|
||||
self$`binaryDataN2Information`
|
||||
}
|
||||
UpdatePetRequestObject
|
||||
return(UpdatePetRequestObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -71,29 +96,13 @@ UpdatePetRequest <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return UpdatePetRequest in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`jsonData`)) {
|
||||
sprintf(
|
||||
'"jsonData":
|
||||
%s
|
||||
',
|
||||
jsonlite::toJSON(self$`jsonData`$toJSON(), auto_unbox = TRUE, digits = NA)
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`binaryDataN2Information`)) {
|
||||
sprintf(
|
||||
'"binaryDataN2Information":
|
||||
"%s"
|
||||
',
|
||||
self$`binaryDataN2Information`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -94,10 +94,35 @@ User <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return User in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return User as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of User (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert User to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
UserObject <- list()
|
||||
if (!is.null(self$`id`)) {
|
||||
UserObject[["id"]] <-
|
||||
@ -131,7 +156,7 @@ User <- R6::R6Class(
|
||||
UserObject[["userStatus"]] <-
|
||||
self$`userStatus`
|
||||
}
|
||||
UserObject
|
||||
return(UserObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -170,77 +195,13 @@ User <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return User in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`id`)) {
|
||||
sprintf(
|
||||
'"id":
|
||||
%d
|
||||
',
|
||||
self$`id`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`username`)) {
|
||||
sprintf(
|
||||
'"username":
|
||||
"%s"
|
||||
',
|
||||
self$`username`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`firstName`)) {
|
||||
sprintf(
|
||||
'"firstName":
|
||||
"%s"
|
||||
',
|
||||
self$`firstName`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`lastName`)) {
|
||||
sprintf(
|
||||
'"lastName":
|
||||
"%s"
|
||||
',
|
||||
self$`lastName`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`email`)) {
|
||||
sprintf(
|
||||
'"email":
|
||||
"%s"
|
||||
',
|
||||
self$`email`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`password`)) {
|
||||
sprintf(
|
||||
'"password":
|
||||
"%s"
|
||||
',
|
||||
self$`password`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`phone`)) {
|
||||
sprintf(
|
||||
'"phone":
|
||||
"%s"
|
||||
',
|
||||
self$`phone`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`userStatus`)) {
|
||||
sprintf(
|
||||
'"userStatus":
|
||||
%d
|
||||
',
|
||||
self$`userStatus`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -318,7 +318,7 @@ UserApi <- R6::R6Class(
|
||||
if (!is.null(`user`)) {
|
||||
local_var_body <- `user`$toJSONString()
|
||||
} else {
|
||||
body <- NULL
|
||||
local_var_body <- NULL
|
||||
}
|
||||
|
||||
local_var_url_path <- "/user"
|
||||
@ -428,7 +428,7 @@ UserApi <- R6::R6Class(
|
||||
})), collapse = ",")
|
||||
local_var_body <- paste0("[", body.items, "]")
|
||||
} else {
|
||||
body <- NULL
|
||||
local_var_body <- NULL
|
||||
}
|
||||
|
||||
local_var_url_path <- "/user/createWithArray"
|
||||
@ -538,7 +538,7 @@ UserApi <- R6::R6Class(
|
||||
})), collapse = ",")
|
||||
local_var_body <- paste0("[", body.items, "]")
|
||||
} else {
|
||||
body <- NULL
|
||||
local_var_body <- NULL
|
||||
}
|
||||
|
||||
local_var_url_path <- "/user/createWithList"
|
||||
@ -1099,7 +1099,7 @@ UserApi <- R6::R6Class(
|
||||
if (!is.null(`user`)) {
|
||||
local_var_body <- `user`$toJSONString()
|
||||
} else {
|
||||
body <- NULL
|
||||
local_var_body <- NULL
|
||||
}
|
||||
|
||||
local_var_url_path <- "/user/{username}"
|
||||
|
@ -49,10 +49,35 @@ Whale <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return Whale in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return Whale as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of Whale (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Whale to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
WhaleObject <- list()
|
||||
if (!is.null(self$`hasBaleen`)) {
|
||||
WhaleObject[["hasBaleen"]] <-
|
||||
@ -66,7 +91,7 @@ Whale <- R6::R6Class(
|
||||
WhaleObject[["className"]] <-
|
||||
self$`className`
|
||||
}
|
||||
WhaleObject
|
||||
return(WhaleObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -90,37 +115,13 @@ Whale <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return Whale in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`hasBaleen`)) {
|
||||
sprintf(
|
||||
'"hasBaleen":
|
||||
%s
|
||||
',
|
||||
tolower(self$`hasBaleen`)
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`hasTeeth`)) {
|
||||
sprintf(
|
||||
'"hasTeeth":
|
||||
%s
|
||||
',
|
||||
tolower(self$`hasTeeth`)
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`className`)) {
|
||||
sprintf(
|
||||
'"className":
|
||||
"%s"
|
||||
',
|
||||
self$`className`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -43,10 +43,35 @@ Zebra <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return Zebra in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return Zebra as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of Zebra (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Zebra to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
ZebraObject <- list()
|
||||
if (!is.null(self$`type`)) {
|
||||
ZebraObject[["type"]] <-
|
||||
@ -56,7 +81,7 @@ Zebra <- R6::R6Class(
|
||||
ZebraObject[["className"]] <-
|
||||
self$`className`
|
||||
}
|
||||
ZebraObject
|
||||
return(ZebraObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -80,29 +105,13 @@ Zebra <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return Zebra in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`type`)) {
|
||||
sprintf(
|
||||
'"type":
|
||||
"%s"
|
||||
',
|
||||
self$`type`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`className`)) {
|
||||
sprintf(
|
||||
'"className":
|
||||
"%s"
|
||||
',
|
||||
self$`className`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -23,7 +23,7 @@ test_that("Test toJSON toJSONString fromJSON fromJSONString", {
|
||||
|
||||
# tests for other pet objects
|
||||
pet0 <- Pet$new()
|
||||
jsonpet <- pet0$toJSON()
|
||||
jsonpet <- pet0$toSimpleType()
|
||||
pet2 <- pet0$fromJSON(
|
||||
jsonlite::toJSON(jsonpet, auto_unbox = TRUE)
|
||||
)
|
||||
@ -49,7 +49,7 @@ test_that("Test toJSON toJSONString fromJSON fromJSONString", {
|
||||
),
|
||||
status = "available"
|
||||
)
|
||||
jsonpet <- pet1$toJSON()
|
||||
jsonpet <- pet1$toSimpleType()
|
||||
pet2 <- pet1$fromJSON(
|
||||
jsonlite::toJSON(jsonpet, auto_unbox = TRUE)
|
||||
)
|
||||
@ -71,7 +71,7 @@ test_that("Test toJSON toJSONString fromJSON fromJSONString", {
|
||||
test_that("Test Category", {
|
||||
c1 <- Category$new(id = 450, name = "test_cat")
|
||||
c2 <- Category$new()
|
||||
c2$fromJSON(jsonlite::toJSON(c1$toJSON(), auto_unbox = TRUE))
|
||||
c2$fromJSON(jsonlite::toJSON(c1$toSimpleType(), auto_unbox = TRUE))
|
||||
expect_equal(c1, c2)
|
||||
c2$fromJSONString(c1$toJSONString())
|
||||
expect_equal(c1, c2)
|
||||
|
@ -77,10 +77,35 @@ AllofTagApiResponse <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return AllofTagApiResponse in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return AllofTagApiResponse as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of AllofTagApiResponse (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert AllofTagApiResponse to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
AllofTagApiResponseObject <- list()
|
||||
if (!is.null(self$`id`)) {
|
||||
AllofTagApiResponseObject[["id"]] <-
|
||||
@ -106,7 +131,7 @@ AllofTagApiResponse <- R6::R6Class(
|
||||
AllofTagApiResponseObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
AllofTagApiResponseObject
|
||||
return(AllofTagApiResponseObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -143,58 +168,16 @@ AllofTagApiResponse <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return AllofTagApiResponse in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`id`)) {
|
||||
sprintf(
|
||||
'"id":
|
||||
%d
|
||||
',
|
||||
self$`id`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`name`)) {
|
||||
sprintf(
|
||||
'"name":
|
||||
"%s"
|
||||
',
|
||||
self$`name`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`code`)) {
|
||||
sprintf(
|
||||
'"code":
|
||||
%d
|
||||
',
|
||||
self$`code`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`type`)) {
|
||||
sprintf(
|
||||
'"type":
|
||||
"%s"
|
||||
',
|
||||
self$`type`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`message`)) {
|
||||
sprintf(
|
||||
'"message":
|
||||
"%s"
|
||||
',
|
||||
self$`message`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -52,10 +52,35 @@ Animal <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return Animal in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return Animal as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of Animal (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Animal to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
AnimalObject <- list()
|
||||
if (!is.null(self$`className`)) {
|
||||
AnimalObject[["className"]] <-
|
||||
@ -69,7 +94,7 @@ Animal <- R6::R6Class(
|
||||
AnimalObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
AnimalObject
|
||||
return(AnimalObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -97,34 +122,16 @@ Animal <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return Animal in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`className`)) {
|
||||
sprintf(
|
||||
'"className":
|
||||
"%s"
|
||||
',
|
||||
self$`className`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`color`)) {
|
||||
sprintf(
|
||||
'"color":
|
||||
"%s"
|
||||
',
|
||||
self$`color`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -91,27 +91,32 @@ AnyOfPig <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Serialize AnyOfPig to JSON string.
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert AnyOfPig to a base R type
|
||||
#'
|
||||
#' @return JSON string representation of the AnyOfPig.
|
||||
toJSONString = function() {
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
if (!is.null(self$actual_instance)) {
|
||||
as.character(jsonlite::minify((self$actual_instance$toJSONString())))
|
||||
return(self$actual_instance$toSimpleType())
|
||||
} else {
|
||||
NULL
|
||||
}
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Serialize AnyOfPig to JSON.
|
||||
#' Serialize AnyOfPig to JSON string.
|
||||
#'
|
||||
#' @return JSON representation of the AnyOfPig.
|
||||
toJSON = function() {
|
||||
if (!is.null(self$actual_instance)) {
|
||||
self$actual_instance$toJSON()
|
||||
} else {
|
||||
NULL
|
||||
}
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return JSON string representation of the AnyOfPig.
|
||||
toJSONString = function(...) {
|
||||
json <- jsonlite::toJSON(self$toSimpleType(), auto_unbox = TRUE, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -111,25 +111,35 @@ AnyOfPrimitiveTypeTest <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' Serialize AnyOfPrimitiveTypeTest to JSON string.
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return JSON string representation of the AnyOfPrimitiveTypeTest.
|
||||
toJSONString = function() {
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
if (!is.null(self$actual_instance)) {
|
||||
as.character(jsonlite::minify(self$actual_instance$toJSONString()))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
} else {
|
||||
NULL
|
||||
return(NULL)
|
||||
}
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Serialize AnyOfPrimitiveTypeTest to JSON.
|
||||
#'
|
||||
#' @return JSON representation of the AnyOfPrimitiveTypeTest.
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert AnyOfPrimitiveTypeTest to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
if (!is.null(self$actual_instance)) {
|
||||
self$actual_instance$toJSON()
|
||||
return(self$actual_instance$toSimpleType())
|
||||
} else {
|
||||
NULL
|
||||
return(NULL)
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -50,10 +50,35 @@ BasquePig <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return BasquePig in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return BasquePig as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of BasquePig (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert BasquePig to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
BasquePigObject <- list()
|
||||
if (!is.null(self$`className`)) {
|
||||
BasquePigObject[["className"]] <-
|
||||
@ -67,7 +92,7 @@ BasquePig <- R6::R6Class(
|
||||
BasquePigObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
BasquePigObject
|
||||
return(BasquePigObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -95,34 +120,16 @@ BasquePig <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return BasquePig in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`className`)) {
|
||||
sprintf(
|
||||
'"className":
|
||||
"%s"
|
||||
',
|
||||
self$`className`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`color`)) {
|
||||
sprintf(
|
||||
'"color":
|
||||
"%s"
|
||||
',
|
||||
self$`color`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -60,10 +60,35 @@ Cat <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return Cat in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return Cat as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of Cat (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Cat to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
CatObject <- list()
|
||||
if (!is.null(self$`className`)) {
|
||||
CatObject[["className"]] <-
|
||||
@ -81,7 +106,7 @@ Cat <- R6::R6Class(
|
||||
CatObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
CatObject
|
||||
return(CatObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -112,42 +137,16 @@ Cat <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return Cat in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`className`)) {
|
||||
sprintf(
|
||||
'"className":
|
||||
"%s"
|
||||
',
|
||||
self$`className`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`color`)) {
|
||||
sprintf(
|
||||
'"color":
|
||||
"%s"
|
||||
',
|
||||
self$`color`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`declawed`)) {
|
||||
sprintf(
|
||||
'"declawed":
|
||||
%s
|
||||
',
|
||||
tolower(self$`declawed`)
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -50,10 +50,35 @@ Category <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return Category in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return Category as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of Category (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Category to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
CategoryObject <- list()
|
||||
if (!is.null(self$`id`)) {
|
||||
CategoryObject[["id"]] <-
|
||||
@ -67,7 +92,7 @@ Category <- R6::R6Class(
|
||||
CategoryObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
CategoryObject
|
||||
return(CategoryObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -95,34 +120,16 @@ Category <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return Category in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`id`)) {
|
||||
sprintf(
|
||||
'"id":
|
||||
%d
|
||||
',
|
||||
self$`id`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`name`)) {
|
||||
sprintf(
|
||||
'"name":
|
||||
"%s"
|
||||
',
|
||||
self$`name`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -50,10 +50,35 @@ DanishPig <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return DanishPig in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return DanishPig as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of DanishPig (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert DanishPig to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
DanishPigObject <- list()
|
||||
if (!is.null(self$`className`)) {
|
||||
DanishPigObject[["className"]] <-
|
||||
@ -67,7 +92,7 @@ DanishPig <- R6::R6Class(
|
||||
DanishPigObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
DanishPigObject
|
||||
return(DanishPigObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -95,34 +120,16 @@ DanishPig <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return DanishPig in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`className`)) {
|
||||
sprintf(
|
||||
'"className":
|
||||
"%s"
|
||||
',
|
||||
self$`className`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`size`)) {
|
||||
sprintf(
|
||||
'"size":
|
||||
%d
|
||||
',
|
||||
self$`size`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -63,10 +63,35 @@ Date <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return Date in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return Date as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of Date (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Date to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
DateObject <- list()
|
||||
if (!is.null(self$`className`)) {
|
||||
DateObject[["className"]] <-
|
||||
@ -84,7 +109,7 @@ Date <- R6::R6Class(
|
||||
DateObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
DateObject
|
||||
return(DateObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -119,42 +144,16 @@ Date <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return Date in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`className`)) {
|
||||
sprintf(
|
||||
'"className":
|
||||
"%s"
|
||||
',
|
||||
self$`className`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`percent_description`)) {
|
||||
sprintf(
|
||||
'"percent_description":
|
||||
"%s"
|
||||
',
|
||||
self$`percent_description`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`url_property`)) {
|
||||
sprintf(
|
||||
'"url_property":
|
||||
"%s"
|
||||
',
|
||||
self$`url_property`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -60,10 +60,35 @@ Dog <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return Dog in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return Dog as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of Dog (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Dog to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
DogObject <- list()
|
||||
if (!is.null(self$`className`)) {
|
||||
DogObject[["className"]] <-
|
||||
@ -81,7 +106,7 @@ Dog <- R6::R6Class(
|
||||
DogObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
DogObject
|
||||
return(DogObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -112,42 +137,16 @@ Dog <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return Dog in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`className`)) {
|
||||
sprintf(
|
||||
'"className":
|
||||
"%s"
|
||||
',
|
||||
self$`className`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`color`)) {
|
||||
sprintf(
|
||||
'"color":
|
||||
"%s"
|
||||
',
|
||||
self$`color`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`breed`)) {
|
||||
sprintf(
|
||||
'"breed":
|
||||
"%s"
|
||||
',
|
||||
self$`breed`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -41,10 +41,35 @@ DummyModel <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return DummyModel in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return DummyModel as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of DummyModel (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert DummyModel to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
DummyModelObject <- list()
|
||||
if (!is.null(self$`property`)) {
|
||||
DummyModelObject[["property"]] <-
|
||||
@ -54,7 +79,7 @@ DummyModel <- R6::R6Class(
|
||||
DummyModelObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
DummyModelObject
|
||||
return(DummyModelObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -79,26 +104,16 @@ DummyModel <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return DummyModel in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`property`)) {
|
||||
sprintf(
|
||||
'"property":
|
||||
"%s"
|
||||
',
|
||||
self$`property`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -225,7 +225,7 @@ FakeApi <- R6::R6Class(
|
||||
if (!is.null(`pet`)) {
|
||||
local_var_body <- `pet`$toJSONString()
|
||||
} else {
|
||||
body <- NULL
|
||||
local_var_body <- NULL
|
||||
}
|
||||
|
||||
local_var_url_path <- "/fake/test_optional_body_parameter"
|
||||
|
@ -158,10 +158,35 @@ FormatTest <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return FormatTest in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return FormatTest as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of FormatTest (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert FormatTest to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
FormatTestObject <- list()
|
||||
if (!is.null(self$`integer`)) {
|
||||
FormatTestObject[["integer"]] <-
|
||||
@ -227,7 +252,7 @@ FormatTest <- R6::R6Class(
|
||||
FormatTestObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
FormatTestObject
|
||||
return(FormatTestObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -294,138 +319,16 @@ FormatTest <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return FormatTest in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`integer`)) {
|
||||
sprintf(
|
||||
'"integer":
|
||||
%d
|
||||
',
|
||||
self$`integer`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`int32`)) {
|
||||
sprintf(
|
||||
'"int32":
|
||||
%d
|
||||
',
|
||||
self$`int32`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`int64`)) {
|
||||
sprintf(
|
||||
'"int64":
|
||||
%d
|
||||
',
|
||||
self$`int64`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`number`)) {
|
||||
sprintf(
|
||||
'"number":
|
||||
%d
|
||||
',
|
||||
self$`number`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`float`)) {
|
||||
sprintf(
|
||||
'"float":
|
||||
%d
|
||||
',
|
||||
self$`float`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`double`)) {
|
||||
sprintf(
|
||||
'"double":
|
||||
%d
|
||||
',
|
||||
self$`double`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`string`)) {
|
||||
sprintf(
|
||||
'"string":
|
||||
"%s"
|
||||
',
|
||||
self$`string`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`byte`)) {
|
||||
sprintf(
|
||||
'"byte":
|
||||
"%s"
|
||||
',
|
||||
self$`byte`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`binary`)) {
|
||||
sprintf(
|
||||
'"binary":
|
||||
"%s"
|
||||
',
|
||||
self$`binary`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`date`)) {
|
||||
sprintf(
|
||||
'"date":
|
||||
"%s"
|
||||
',
|
||||
self$`date`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`dateTime`)) {
|
||||
sprintf(
|
||||
'"dateTime":
|
||||
"%s"
|
||||
',
|
||||
self$`dateTime`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`uuid`)) {
|
||||
sprintf(
|
||||
'"uuid":
|
||||
"%s"
|
||||
',
|
||||
self$`uuid`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`password`)) {
|
||||
sprintf(
|
||||
'"password":
|
||||
"%s"
|
||||
',
|
||||
self$`password`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`pattern_with_digits`)) {
|
||||
sprintf(
|
||||
'"pattern_with_digits":
|
||||
"%s"
|
||||
',
|
||||
self$`pattern_with_digits`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`pattern_with_digits_and_delimiter`)) {
|
||||
sprintf(
|
||||
'"pattern_with_digits_and_delimiter":
|
||||
"%s"
|
||||
',
|
||||
self$`pattern_with_digits_and_delimiter`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -109,25 +109,35 @@ Mammal <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' Serialize Mammal to JSON string.
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return JSON string representation of the Mammal.
|
||||
toJSONString = function() {
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
if (!is.null(self$actual_instance)) {
|
||||
as.character(jsonlite::minify(self$actual_instance$toJSONString()))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
} else {
|
||||
NULL
|
||||
return(NULL)
|
||||
}
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Serialize Mammal to JSON.
|
||||
#'
|
||||
#' @return JSON representation of the Mammal.
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Mammal to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
if (!is.null(self$actual_instance)) {
|
||||
self$actual_instance$toJSON()
|
||||
return(self$actual_instance$toSimpleType())
|
||||
} else {
|
||||
NULL
|
||||
return(NULL)
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -59,10 +59,35 @@ ModelApiResponse <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return ModelApiResponse in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return ModelApiResponse as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of ModelApiResponse (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert ModelApiResponse to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
ModelApiResponseObject <- list()
|
||||
if (!is.null(self$`code`)) {
|
||||
ModelApiResponseObject[["code"]] <-
|
||||
@ -80,7 +105,7 @@ ModelApiResponse <- R6::R6Class(
|
||||
ModelApiResponseObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
ModelApiResponseObject
|
||||
return(ModelApiResponseObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -111,42 +136,16 @@ ModelApiResponse <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return ModelApiResponse in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`code`)) {
|
||||
sprintf(
|
||||
'"code":
|
||||
%d
|
||||
',
|
||||
self$`code`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`type`)) {
|
||||
sprintf(
|
||||
'"type":
|
||||
"%s"
|
||||
',
|
||||
self$`type`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`message`)) {
|
||||
sprintf(
|
||||
'"message":
|
||||
"%s"
|
||||
',
|
||||
self$`message`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -48,10 +48,35 @@ NestedOneOf <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return NestedOneOf in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return NestedOneOf as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of NestedOneOf (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert NestedOneOf to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
NestedOneOfObject <- list()
|
||||
if (!is.null(self$`size`)) {
|
||||
NestedOneOfObject[["size"]] <-
|
||||
@ -59,13 +84,13 @@ NestedOneOf <- R6::R6Class(
|
||||
}
|
||||
if (!is.null(self$`nested_pig`)) {
|
||||
NestedOneOfObject[["nested_pig"]] <-
|
||||
self$`nested_pig`$toJSON()
|
||||
self$`nested_pig`$toSimpleType()
|
||||
}
|
||||
for (key in names(self$additional_properties)) {
|
||||
NestedOneOfObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
NestedOneOfObject
|
||||
return(NestedOneOfObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -95,34 +120,16 @@ NestedOneOf <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return NestedOneOf in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`size`)) {
|
||||
sprintf(
|
||||
'"size":
|
||||
%d
|
||||
',
|
||||
self$`size`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`nested_pig`)) {
|
||||
sprintf(
|
||||
'"nested_pig":
|
||||
%s
|
||||
',
|
||||
jsonlite::toJSON(self$`nested_pig`$toJSON(), auto_unbox = TRUE, digits = NA)
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -111,25 +111,35 @@ OneOfPrimitiveTypeTest <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' Serialize OneOfPrimitiveTypeTest to JSON string.
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return JSON string representation of the OneOfPrimitiveTypeTest.
|
||||
toJSONString = function() {
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
if (!is.null(self$actual_instance)) {
|
||||
as.character(jsonlite::minify(self$actual_instance$toJSONString()))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
} else {
|
||||
NULL
|
||||
return(NULL)
|
||||
}
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Serialize OneOfPrimitiveTypeTest to JSON.
|
||||
#'
|
||||
#' @return JSON representation of the OneOfPrimitiveTypeTest.
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert OneOfPrimitiveTypeTest to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
if (!is.null(self$actual_instance)) {
|
||||
self$actual_instance$toJSON()
|
||||
return(self$actual_instance$toSimpleType())
|
||||
} else {
|
||||
NULL
|
||||
return(NULL)
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -89,10 +89,35 @@ Order <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return Order in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return Order as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of Order (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Order to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
OrderObject <- list()
|
||||
if (!is.null(self$`id`)) {
|
||||
OrderObject[["id"]] <-
|
||||
@ -122,7 +147,7 @@ Order <- R6::R6Class(
|
||||
OrderObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
OrderObject
|
||||
return(OrderObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -165,66 +190,16 @@ Order <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return Order in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`id`)) {
|
||||
sprintf(
|
||||
'"id":
|
||||
%d
|
||||
',
|
||||
self$`id`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`petId`)) {
|
||||
sprintf(
|
||||
'"petId":
|
||||
%d
|
||||
',
|
||||
self$`petId`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`quantity`)) {
|
||||
sprintf(
|
||||
'"quantity":
|
||||
%d
|
||||
',
|
||||
self$`quantity`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`shipDate`)) {
|
||||
sprintf(
|
||||
'"shipDate":
|
||||
"%s"
|
||||
',
|
||||
self$`shipDate`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`status`)) {
|
||||
sprintf(
|
||||
'"status":
|
||||
"%s"
|
||||
',
|
||||
self$`status`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`complete`)) {
|
||||
sprintf(
|
||||
'"complete":
|
||||
%s
|
||||
',
|
||||
tolower(self$`complete`)
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -85,10 +85,35 @@ Pet <- R6::R6Class(
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#' @return Pet in JSON format
|
||||
#' Convert to an R object. This method is deprecated. Use `toSimpleType()` instead.
|
||||
toJSON = function() {
|
||||
.Deprecated(new = "toSimpleType", msg = "Use the '$toSimpleType()' method instead since that is more clearly named. Use '$toJSONString()' to get a JSON string")
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert to a List
|
||||
#'
|
||||
#' Convert the R6 object to a list to work more easily with other tooling.
|
||||
#'
|
||||
#' @return Pet as a base R list.
|
||||
#' @examples
|
||||
#' # convert array of Pet (x) to a data frame
|
||||
#' \dontrun{
|
||||
#' library(purrr)
|
||||
#' library(tibble)
|
||||
#' df <- x |> map(\(y)y$toList()) |> map(as_tibble) |> list_rbind()
|
||||
#' df
|
||||
#' }
|
||||
toList = function() {
|
||||
return(self$toSimpleType())
|
||||
},
|
||||
|
||||
#' @description
|
||||
#' Convert Pet to a base R type
|
||||
#'
|
||||
#' @return A base R type, e.g. a list or numeric/character array.
|
||||
toSimpleType = function() {
|
||||
PetObject <- list()
|
||||
if (!is.null(self$`id`)) {
|
||||
PetObject[["id"]] <-
|
||||
@ -96,7 +121,7 @@ Pet <- R6::R6Class(
|
||||
}
|
||||
if (!is.null(self$`category`)) {
|
||||
PetObject[["category"]] <-
|
||||
self$`category`$toJSON()
|
||||
self$`category`$toSimpleType()
|
||||
}
|
||||
if (!is.null(self$`name`)) {
|
||||
PetObject[["name"]] <-
|
||||
@ -108,7 +133,7 @@ Pet <- R6::R6Class(
|
||||
}
|
||||
if (!is.null(self$`tags`)) {
|
||||
PetObject[["tags"]] <-
|
||||
lapply(self$`tags`, function(x) x$toJSON())
|
||||
lapply(self$`tags`, function(x) x$toSimpleType())
|
||||
}
|
||||
if (!is.null(self$`status`)) {
|
||||
PetObject[["status"]] <-
|
||||
@ -118,7 +143,7 @@ Pet <- R6::R6Class(
|
||||
PetObject[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
|
||||
PetObject
|
||||
return(PetObject)
|
||||
},
|
||||
|
||||
#' @description
|
||||
@ -163,66 +188,16 @@ Pet <- R6::R6Class(
|
||||
|
||||
#' @description
|
||||
#' To JSON String
|
||||
#'
|
||||
#'
|
||||
#' @param ... Parameters passed to `jsonlite::toJSON`
|
||||
#' @return Pet in JSON format
|
||||
toJSONString = function() {
|
||||
jsoncontent <- c(
|
||||
if (!is.null(self$`id`)) {
|
||||
sprintf(
|
||||
'"id":
|
||||
%d
|
||||
',
|
||||
self$`id`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`category`)) {
|
||||
sprintf(
|
||||
'"category":
|
||||
%s
|
||||
',
|
||||
jsonlite::toJSON(self$`category`$toJSON(), auto_unbox = TRUE, digits = NA)
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`name`)) {
|
||||
sprintf(
|
||||
'"name":
|
||||
"%s"
|
||||
',
|
||||
self$`name`
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`photoUrls`)) {
|
||||
sprintf(
|
||||
'"photoUrls":
|
||||
[%s]
|
||||
',
|
||||
paste(unlist(lapply(self$`photoUrls`, function(x) paste0('"', x, '"'))), collapse = ",")
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`tags`)) {
|
||||
sprintf(
|
||||
'"tags":
|
||||
[%s]
|
||||
',
|
||||
paste(sapply(self$`tags`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox = TRUE, digits = NA)), collapse = ",")
|
||||
)
|
||||
},
|
||||
if (!is.null(self$`status`)) {
|
||||
sprintf(
|
||||
'"status":
|
||||
"%s"
|
||||
',
|
||||
self$`status`
|
||||
)
|
||||
}
|
||||
)
|
||||
jsoncontent <- paste(jsoncontent, collapse = ",")
|
||||
json_string <- as.character(jsonlite::minify(paste("{", jsoncontent, "}", sep = "")))
|
||||
json_obj <- jsonlite::fromJSON(json_string)
|
||||
toJSONString = function(...) {
|
||||
simple <- self$toSimpleType()
|
||||
for (key in names(self$additional_properties)) {
|
||||
json_obj[[key]] <- self$additional_properties[[key]]
|
||||
simple[[key]] <- self$additional_properties[[key]]
|
||||
}
|
||||
json_string <- as.character(jsonlite::minify(jsonlite::toJSON(json_obj, auto_unbox = TRUE, digits = NA)))
|
||||
json <- jsonlite::toJSON(simple, auto_unbox = TRUE, digits = NA, ...)
|
||||
return(as.character(jsonlite::minify(json)))
|
||||
},
|
||||
|
||||
#' @description
|
||||
|
@ -435,7 +435,7 @@ PetApi <- R6::R6Class(
|
||||
if (!is.null(`pet`)) {
|
||||
local_var_body <- `pet`$toJSONString()
|
||||
} else {
|
||||
body <- NULL
|
||||
local_var_body <- NULL
|
||||
}
|
||||
|
||||
local_var_url_path <- "/pet"
|
||||
@ -1288,7 +1288,7 @@ PetApi <- R6::R6Class(
|
||||
if (!is.null(`pet`)) {
|
||||
local_var_body <- `pet`$toJSONString()
|
||||
} else {
|
||||
body <- NULL
|
||||
local_var_body <- NULL
|
||||
}
|
||||
|
||||
local_var_url_path <- "/pet"
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user