R/inline_response20083.R

# Binance Public Spot API
#
# OpenAPI Specifications for the Binance Public Spot API  API documents:   - [https://github.com/binance/binance-spot-api-docs](https://github.com/binance/binance-spot-api-docs)   - [https://binance-docs.github.io/apidocs/spot/en](https://binance-docs.github.io/apidocs/spot/en)
#
# The version of the OpenAPI document: 1.0
# 
# Generated by: https://openapi-generator.tech

#' @docType class
#' @title InlineResponse20083
#'
#' @description InlineResponse20083 Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field code  character 
#'
#' @field message  character 
#'
#' @field data  list( \link{InlineResponse20083Data} ) 
#'
#' @field total  integer 
#'
#' @field success  character 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
InlineResponse20083 <- R6::R6Class(
  'InlineResponse20083',
  public = list(
    `code` = NULL,
    `message` = NULL,
    `data` = NULL,
    `total` = NULL,
    `success` = NULL,
    initialize = function(
        `code`, `message`, `data`, `total`, `success`, ...
    ) {
      local.optional.var <- list(...)
      if (!missing(`code`)) {
        stopifnot(is.character(`code`), length(`code`) == 1)
        self$`code` <- `code`
      }
      if (!missing(`message`)) {
        stopifnot(is.character(`message`), length(`message`) == 1)
        self$`message` <- `message`
      }
      if (!missing(`data`)) {
        stopifnot(is.vector(`data`), length(`data`) != 0)
        sapply(`data`, function(x) stopifnot(R6::is.R6(x)))
        self$`data` <- `data`
      }
      if (!missing(`total`)) {
        stopifnot(is.numeric(`total`), length(`total`) == 1)
        self$`total` <- `total`
      }
      if (!missing(`success`)) {
        stopifnot(is.logical(`success`), length(`success`) == 1)
        self$`success` <- `success`
      }
    },
    toJSON = function() {
      InlineResponse20083Object <- list()
      if (!is.null(self$`code`)) {
        InlineResponse20083Object[['code']] <-
          self$`code`
      }
      if (!is.null(self$`message`)) {
        InlineResponse20083Object[['message']] <-
          self$`message`
      }
      if (!is.null(self$`data`)) {
        InlineResponse20083Object[['data']] <-
          lapply(self$`data`, function(x) x$toJSON())
      }
      if (!is.null(self$`total`)) {
        InlineResponse20083Object[['total']] <-
          self$`total`
      }
      if (!is.null(self$`success`)) {
        InlineResponse20083Object[['success']] <-
          self$`success`
      }

      InlineResponse20083Object
    },
    fromJSON = function(InlineResponse20083Json) {
      InlineResponse20083Object <- jsonlite::fromJSON(InlineResponse20083Json)
      if (!is.null(InlineResponse20083Object$`code`)) {
        self$`code` <- InlineResponse20083Object$`code`
      }
      if (!is.null(InlineResponse20083Object$`message`)) {
        self$`message` <- InlineResponse20083Object$`message`
      }
      if (!is.null(InlineResponse20083Object$`data`)) {
        self$`data` <- ApiClient$new()$deserializeObj(InlineResponse20083Object$`data`, "array[InlineResponse20083Data]", loadNamespace("binanceRapi"))
      }
      if (!is.null(InlineResponse20083Object$`total`)) {
        self$`total` <- InlineResponse20083Object$`total`
      }
      if (!is.null(InlineResponse20083Object$`success`)) {
        self$`success` <- InlineResponse20083Object$`success`
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`code`)) {
        sprintf(
        '"code":
          "%s"
                ',
        self$`code`
        )},
        if (!is.null(self$`message`)) {
        sprintf(
        '"message":
          "%s"
                ',
        self$`message`
        )},
        if (!is.null(self$`data`)) {
        sprintf(
        '"data":
        [%s]
',
        paste(sapply(self$`data`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
        )},
        if (!is.null(self$`total`)) {
        sprintf(
        '"total":
          %d
                ',
        self$`total`
        )},
        if (!is.null(self$`success`)) {
        sprintf(
        '"success":
          %s
                ',
        tolower(self$`success`)
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(InlineResponse20083Json) {
      InlineResponse20083Object <- jsonlite::fromJSON(InlineResponse20083Json)
      self$`code` <- InlineResponse20083Object$`code`
      self$`message` <- InlineResponse20083Object$`message`
      self$`data` <- ApiClient$new()$deserializeObj(InlineResponse20083Object$`data`, "array[InlineResponse20083Data]", loadNamespace("binanceRapi"))
      self$`total` <- InlineResponse20083Object$`total`
      self$`success` <- InlineResponse20083Object$`success`
      self
    }
  )
)
grahamjwhite/binanceRapi documentation built on Nov. 22, 2022, 9:37 p.m.