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

      InlineResponse200139Object
    },
    fromJSON = function(InlineResponse200139Json) {
      InlineResponse200139Object <- jsonlite::fromJSON(InlineResponse200139Json)
      if (!is.null(InlineResponse200139Object$`total`)) {
        self$`total` <- InlineResponse200139Object$`total`
      }
      if (!is.null(InlineResponse200139Object$`list`)) {
        self$`list` <- ApiClient$new()$deserializeObj(InlineResponse200139Object$`list`, "array[InlineResponse200139List]", loadNamespace("binanceRapi"))
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`total`)) {
        sprintf(
        '"total":
          %d
                ',
        self$`total`
        )},
        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(InlineResponse200139Json) {
      InlineResponse200139Object <- jsonlite::fromJSON(InlineResponse200139Json)
      self$`total` <- InlineResponse200139Object$`total`
      self$`list` <- ApiClient$new()$deserializeObj(InlineResponse200139Object$`list`, "array[InlineResponse200139List]", loadNamespace("binanceRapi"))
      self
    }
  )
)
grahamjwhite/binanceRapi documentation built on Nov. 22, 2022, 9:37 p.m.