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

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