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

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