R/inline_response20092.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 InlineResponse20092
#'
#' @description InlineResponse20092 Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field positionAmountVos  list( \link{InlineResponse20092PositionAmountVos} ) 
#'
#' @field totalAmountInBTC  character 
#'
#' @field totalAmountInUSDT  character 
#'
#' @field totalFixedAmountInBTC  character 
#'
#' @field totalFixedAmountInUSDT  character 
#'
#' @field totalFlexibleInBTC  character 
#'
#' @field totalFlexibleInUSDT  character 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
InlineResponse20092 <- R6::R6Class(
  'InlineResponse20092',
  public = list(
    `positionAmountVos` = NULL,
    `totalAmountInBTC` = NULL,
    `totalAmountInUSDT` = NULL,
    `totalFixedAmountInBTC` = NULL,
    `totalFixedAmountInUSDT` = NULL,
    `totalFlexibleInBTC` = NULL,
    `totalFlexibleInUSDT` = NULL,
    initialize = function(
        `positionAmountVos`, `totalAmountInBTC`, `totalAmountInUSDT`, `totalFixedAmountInBTC`, `totalFixedAmountInUSDT`, `totalFlexibleInBTC`, `totalFlexibleInUSDT`, ...
    ) {
      local.optional.var <- list(...)
      if (!missing(`positionAmountVos`)) {
        stopifnot(is.vector(`positionAmountVos`), length(`positionAmountVos`) != 0)
        sapply(`positionAmountVos`, function(x) stopifnot(R6::is.R6(x)))
        self$`positionAmountVos` <- `positionAmountVos`
      }
      if (!missing(`totalAmountInBTC`)) {
        stopifnot(is.character(`totalAmountInBTC`), length(`totalAmountInBTC`) == 1)
        self$`totalAmountInBTC` <- `totalAmountInBTC`
      }
      if (!missing(`totalAmountInUSDT`)) {
        stopifnot(is.character(`totalAmountInUSDT`), length(`totalAmountInUSDT`) == 1)
        self$`totalAmountInUSDT` <- `totalAmountInUSDT`
      }
      if (!missing(`totalFixedAmountInBTC`)) {
        stopifnot(is.character(`totalFixedAmountInBTC`), length(`totalFixedAmountInBTC`) == 1)
        self$`totalFixedAmountInBTC` <- `totalFixedAmountInBTC`
      }
      if (!missing(`totalFixedAmountInUSDT`)) {
        stopifnot(is.character(`totalFixedAmountInUSDT`), length(`totalFixedAmountInUSDT`) == 1)
        self$`totalFixedAmountInUSDT` <- `totalFixedAmountInUSDT`
      }
      if (!missing(`totalFlexibleInBTC`)) {
        stopifnot(is.character(`totalFlexibleInBTC`), length(`totalFlexibleInBTC`) == 1)
        self$`totalFlexibleInBTC` <- `totalFlexibleInBTC`
      }
      if (!missing(`totalFlexibleInUSDT`)) {
        stopifnot(is.character(`totalFlexibleInUSDT`), length(`totalFlexibleInUSDT`) == 1)
        self$`totalFlexibleInUSDT` <- `totalFlexibleInUSDT`
      }
    },
    toJSON = function() {
      InlineResponse20092Object <- list()
      if (!is.null(self$`positionAmountVos`)) {
        InlineResponse20092Object[['positionAmountVos']] <-
          lapply(self$`positionAmountVos`, function(x) x$toJSON())
      }
      if (!is.null(self$`totalAmountInBTC`)) {
        InlineResponse20092Object[['totalAmountInBTC']] <-
          self$`totalAmountInBTC`
      }
      if (!is.null(self$`totalAmountInUSDT`)) {
        InlineResponse20092Object[['totalAmountInUSDT']] <-
          self$`totalAmountInUSDT`
      }
      if (!is.null(self$`totalFixedAmountInBTC`)) {
        InlineResponse20092Object[['totalFixedAmountInBTC']] <-
          self$`totalFixedAmountInBTC`
      }
      if (!is.null(self$`totalFixedAmountInUSDT`)) {
        InlineResponse20092Object[['totalFixedAmountInUSDT']] <-
          self$`totalFixedAmountInUSDT`
      }
      if (!is.null(self$`totalFlexibleInBTC`)) {
        InlineResponse20092Object[['totalFlexibleInBTC']] <-
          self$`totalFlexibleInBTC`
      }
      if (!is.null(self$`totalFlexibleInUSDT`)) {
        InlineResponse20092Object[['totalFlexibleInUSDT']] <-
          self$`totalFlexibleInUSDT`
      }

      InlineResponse20092Object
    },
    fromJSON = function(InlineResponse20092Json) {
      InlineResponse20092Object <- jsonlite::fromJSON(InlineResponse20092Json)
      if (!is.null(InlineResponse20092Object$`positionAmountVos`)) {
        self$`positionAmountVos` <- ApiClient$new()$deserializeObj(InlineResponse20092Object$`positionAmountVos`, "array[InlineResponse20092PositionAmountVos]", loadNamespace("binanceRapi"))
      }
      if (!is.null(InlineResponse20092Object$`totalAmountInBTC`)) {
        self$`totalAmountInBTC` <- InlineResponse20092Object$`totalAmountInBTC`
      }
      if (!is.null(InlineResponse20092Object$`totalAmountInUSDT`)) {
        self$`totalAmountInUSDT` <- InlineResponse20092Object$`totalAmountInUSDT`
      }
      if (!is.null(InlineResponse20092Object$`totalFixedAmountInBTC`)) {
        self$`totalFixedAmountInBTC` <- InlineResponse20092Object$`totalFixedAmountInBTC`
      }
      if (!is.null(InlineResponse20092Object$`totalFixedAmountInUSDT`)) {
        self$`totalFixedAmountInUSDT` <- InlineResponse20092Object$`totalFixedAmountInUSDT`
      }
      if (!is.null(InlineResponse20092Object$`totalFlexibleInBTC`)) {
        self$`totalFlexibleInBTC` <- InlineResponse20092Object$`totalFlexibleInBTC`
      }
      if (!is.null(InlineResponse20092Object$`totalFlexibleInUSDT`)) {
        self$`totalFlexibleInUSDT` <- InlineResponse20092Object$`totalFlexibleInUSDT`
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`positionAmountVos`)) {
        sprintf(
        '"positionAmountVos":
        [%s]
',
        paste(sapply(self$`positionAmountVos`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
        )},
        if (!is.null(self$`totalAmountInBTC`)) {
        sprintf(
        '"totalAmountInBTC":
          "%s"
                ',
        self$`totalAmountInBTC`
        )},
        if (!is.null(self$`totalAmountInUSDT`)) {
        sprintf(
        '"totalAmountInUSDT":
          "%s"
                ',
        self$`totalAmountInUSDT`
        )},
        if (!is.null(self$`totalFixedAmountInBTC`)) {
        sprintf(
        '"totalFixedAmountInBTC":
          "%s"
                ',
        self$`totalFixedAmountInBTC`
        )},
        if (!is.null(self$`totalFixedAmountInUSDT`)) {
        sprintf(
        '"totalFixedAmountInUSDT":
          "%s"
                ',
        self$`totalFixedAmountInUSDT`
        )},
        if (!is.null(self$`totalFlexibleInBTC`)) {
        sprintf(
        '"totalFlexibleInBTC":
          "%s"
                ',
        self$`totalFlexibleInBTC`
        )},
        if (!is.null(self$`totalFlexibleInUSDT`)) {
        sprintf(
        '"totalFlexibleInUSDT":
          "%s"
                ',
        self$`totalFlexibleInUSDT`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(InlineResponse20092Json) {
      InlineResponse20092Object <- jsonlite::fromJSON(InlineResponse20092Json)
      self$`positionAmountVos` <- ApiClient$new()$deserializeObj(InlineResponse20092Object$`positionAmountVos`, "array[InlineResponse20092PositionAmountVos]", loadNamespace("binanceRapi"))
      self$`totalAmountInBTC` <- InlineResponse20092Object$`totalAmountInBTC`
      self$`totalAmountInUSDT` <- InlineResponse20092Object$`totalAmountInUSDT`
      self$`totalFixedAmountInBTC` <- InlineResponse20092Object$`totalFixedAmountInBTC`
      self$`totalFixedAmountInUSDT` <- InlineResponse20092Object$`totalFixedAmountInUSDT`
      self$`totalFlexibleInBTC` <- InlineResponse20092Object$`totalFlexibleInBTC`
      self$`totalFlexibleInUSDT` <- InlineResponse20092Object$`totalFlexibleInUSDT`
      self
    }
  )
)
grahamjwhite/binanceRapi documentation built on Nov. 22, 2022, 9:37 p.m.