R/inline_response200103.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 InlineResponse200103
#'
#' @description InlineResponse200103 Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field code  integer 
#'
#' @field msg  character 
#'
#' @field data  list( \link{InlineResponse200103Data} ) 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
InlineResponse200103 <- R6::R6Class(
  'InlineResponse200103',
  public = list(
    `code` = NULL,
    `msg` = NULL,
    `data` = NULL,
    initialize = function(
        `code`, `msg`, `data`, ...
    ) {
      local.optional.var <- list(...)
      if (!missing(`code`)) {
        stopifnot(is.numeric(`code`), length(`code`) == 1)
        self$`code` <- `code`
      }
      if (!missing(`msg`)) {
        stopifnot(is.character(`msg`), length(`msg`) == 1)
        self$`msg` <- `msg`
      }
      if (!missing(`data`)) {
        stopifnot(is.vector(`data`), length(`data`) != 0)
        sapply(`data`, function(x) stopifnot(R6::is.R6(x)))
        self$`data` <- `data`
      }
    },
    toJSON = function() {
      InlineResponse200103Object <- list()
      if (!is.null(self$`code`)) {
        InlineResponse200103Object[['code']] <-
          self$`code`
      }
      if (!is.null(self$`msg`)) {
        InlineResponse200103Object[['msg']] <-
          self$`msg`
      }
      if (!is.null(self$`data`)) {
        InlineResponse200103Object[['data']] <-
          lapply(self$`data`, function(x) x$toJSON())
      }

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