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

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