R/inline_response20065.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 InlineResponse20065
#'
#' @description InlineResponse20065 Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field email  character 
#'
#' @field asset  character 
#'
#' @field assets  list( \link{InlineResponse20065Assets} ) 
#'
#' @field canDeposit  character 
#'
#' @field canTrade  character 
#'
#' @field canWithdraw  character 
#'
#' @field feeTier  integer 
#'
#' @field maxWithdrawAmount  character 
#'
#' @field totalInitialMargin  character 
#'
#' @field totalMaintenanceMargin  character 
#'
#' @field totalMarginBalance  character 
#'
#' @field totalOpenOrderInitialMargin  character 
#'
#' @field totalPositionInitialMargin  character 
#'
#' @field totalUnrealizedProfit  character 
#'
#' @field totalWalletBalance  character 
#'
#' @field updateTime  integer 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
InlineResponse20065 <- R6::R6Class(
  'InlineResponse20065',
  public = list(
    `email` = NULL,
    `asset` = NULL,
    `assets` = NULL,
    `canDeposit` = NULL,
    `canTrade` = NULL,
    `canWithdraw` = NULL,
    `feeTier` = NULL,
    `maxWithdrawAmount` = NULL,
    `totalInitialMargin` = NULL,
    `totalMaintenanceMargin` = NULL,
    `totalMarginBalance` = NULL,
    `totalOpenOrderInitialMargin` = NULL,
    `totalPositionInitialMargin` = NULL,
    `totalUnrealizedProfit` = NULL,
    `totalWalletBalance` = NULL,
    `updateTime` = NULL,
    initialize = function(
        `email`, `asset`, `assets`, `canDeposit`, `canTrade`, `canWithdraw`, `feeTier`, `maxWithdrawAmount`, `totalInitialMargin`, `totalMaintenanceMargin`, `totalMarginBalance`, `totalOpenOrderInitialMargin`, `totalPositionInitialMargin`, `totalUnrealizedProfit`, `totalWalletBalance`, `updateTime`, ...
    ) {
      local.optional.var <- list(...)
      if (!missing(`email`)) {
        stopifnot(is.character(`email`), length(`email`) == 1)
        self$`email` <- `email`
      }
      if (!missing(`asset`)) {
        stopifnot(is.character(`asset`), length(`asset`) == 1)
        self$`asset` <- `asset`
      }
      if (!missing(`assets`)) {
        stopifnot(is.vector(`assets`), length(`assets`) != 0)
        sapply(`assets`, function(x) stopifnot(R6::is.R6(x)))
        self$`assets` <- `assets`
      }
      if (!missing(`canDeposit`)) {
        stopifnot(is.logical(`canDeposit`), length(`canDeposit`) == 1)
        self$`canDeposit` <- `canDeposit`
      }
      if (!missing(`canTrade`)) {
        stopifnot(is.logical(`canTrade`), length(`canTrade`) == 1)
        self$`canTrade` <- `canTrade`
      }
      if (!missing(`canWithdraw`)) {
        stopifnot(is.logical(`canWithdraw`), length(`canWithdraw`) == 1)
        self$`canWithdraw` <- `canWithdraw`
      }
      if (!missing(`feeTier`)) {
        stopifnot(is.numeric(`feeTier`), length(`feeTier`) == 1)
        self$`feeTier` <- `feeTier`
      }
      if (!missing(`maxWithdrawAmount`)) {
        stopifnot(is.character(`maxWithdrawAmount`), length(`maxWithdrawAmount`) == 1)
        self$`maxWithdrawAmount` <- `maxWithdrawAmount`
      }
      if (!missing(`totalInitialMargin`)) {
        stopifnot(is.character(`totalInitialMargin`), length(`totalInitialMargin`) == 1)
        self$`totalInitialMargin` <- `totalInitialMargin`
      }
      if (!missing(`totalMaintenanceMargin`)) {
        stopifnot(is.character(`totalMaintenanceMargin`), length(`totalMaintenanceMargin`) == 1)
        self$`totalMaintenanceMargin` <- `totalMaintenanceMargin`
      }
      if (!missing(`totalMarginBalance`)) {
        stopifnot(is.character(`totalMarginBalance`), length(`totalMarginBalance`) == 1)
        self$`totalMarginBalance` <- `totalMarginBalance`
      }
      if (!missing(`totalOpenOrderInitialMargin`)) {
        stopifnot(is.character(`totalOpenOrderInitialMargin`), length(`totalOpenOrderInitialMargin`) == 1)
        self$`totalOpenOrderInitialMargin` <- `totalOpenOrderInitialMargin`
      }
      if (!missing(`totalPositionInitialMargin`)) {
        stopifnot(is.character(`totalPositionInitialMargin`), length(`totalPositionInitialMargin`) == 1)
        self$`totalPositionInitialMargin` <- `totalPositionInitialMargin`
      }
      if (!missing(`totalUnrealizedProfit`)) {
        stopifnot(is.character(`totalUnrealizedProfit`), length(`totalUnrealizedProfit`) == 1)
        self$`totalUnrealizedProfit` <- `totalUnrealizedProfit`
      }
      if (!missing(`totalWalletBalance`)) {
        stopifnot(is.character(`totalWalletBalance`), length(`totalWalletBalance`) == 1)
        self$`totalWalletBalance` <- `totalWalletBalance`
      }
      if (!missing(`updateTime`)) {
        stopifnot(is.numeric(`updateTime`), length(`updateTime`) == 1)
        self$`updateTime` <- `updateTime`
      }
    },
    toJSON = function() {
      InlineResponse20065Object <- list()
      if (!is.null(self$`email`)) {
        InlineResponse20065Object[['email']] <-
          self$`email`
      }
      if (!is.null(self$`asset`)) {
        InlineResponse20065Object[['asset']] <-
          self$`asset`
      }
      if (!is.null(self$`assets`)) {
        InlineResponse20065Object[['assets']] <-
          lapply(self$`assets`, function(x) x$toJSON())
      }
      if (!is.null(self$`canDeposit`)) {
        InlineResponse20065Object[['canDeposit']] <-
          self$`canDeposit`
      }
      if (!is.null(self$`canTrade`)) {
        InlineResponse20065Object[['canTrade']] <-
          self$`canTrade`
      }
      if (!is.null(self$`canWithdraw`)) {
        InlineResponse20065Object[['canWithdraw']] <-
          self$`canWithdraw`
      }
      if (!is.null(self$`feeTier`)) {
        InlineResponse20065Object[['feeTier']] <-
          self$`feeTier`
      }
      if (!is.null(self$`maxWithdrawAmount`)) {
        InlineResponse20065Object[['maxWithdrawAmount']] <-
          self$`maxWithdrawAmount`
      }
      if (!is.null(self$`totalInitialMargin`)) {
        InlineResponse20065Object[['totalInitialMargin']] <-
          self$`totalInitialMargin`
      }
      if (!is.null(self$`totalMaintenanceMargin`)) {
        InlineResponse20065Object[['totalMaintenanceMargin']] <-
          self$`totalMaintenanceMargin`
      }
      if (!is.null(self$`totalMarginBalance`)) {
        InlineResponse20065Object[['totalMarginBalance']] <-
          self$`totalMarginBalance`
      }
      if (!is.null(self$`totalOpenOrderInitialMargin`)) {
        InlineResponse20065Object[['totalOpenOrderInitialMargin']] <-
          self$`totalOpenOrderInitialMargin`
      }
      if (!is.null(self$`totalPositionInitialMargin`)) {
        InlineResponse20065Object[['totalPositionInitialMargin']] <-
          self$`totalPositionInitialMargin`
      }
      if (!is.null(self$`totalUnrealizedProfit`)) {
        InlineResponse20065Object[['totalUnrealizedProfit']] <-
          self$`totalUnrealizedProfit`
      }
      if (!is.null(self$`totalWalletBalance`)) {
        InlineResponse20065Object[['totalWalletBalance']] <-
          self$`totalWalletBalance`
      }
      if (!is.null(self$`updateTime`)) {
        InlineResponse20065Object[['updateTime']] <-
          self$`updateTime`
      }

      InlineResponse20065Object
    },
    fromJSON = function(InlineResponse20065Json) {
      InlineResponse20065Object <- jsonlite::fromJSON(InlineResponse20065Json)
      if (!is.null(InlineResponse20065Object$`email`)) {
        self$`email` <- InlineResponse20065Object$`email`
      }
      if (!is.null(InlineResponse20065Object$`asset`)) {
        self$`asset` <- InlineResponse20065Object$`asset`
      }
      if (!is.null(InlineResponse20065Object$`assets`)) {
        self$`assets` <- ApiClient$new()$deserializeObj(InlineResponse20065Object$`assets`, "array[InlineResponse20065Assets]", loadNamespace("binanceRapi"))
      }
      if (!is.null(InlineResponse20065Object$`canDeposit`)) {
        self$`canDeposit` <- InlineResponse20065Object$`canDeposit`
      }
      if (!is.null(InlineResponse20065Object$`canTrade`)) {
        self$`canTrade` <- InlineResponse20065Object$`canTrade`
      }
      if (!is.null(InlineResponse20065Object$`canWithdraw`)) {
        self$`canWithdraw` <- InlineResponse20065Object$`canWithdraw`
      }
      if (!is.null(InlineResponse20065Object$`feeTier`)) {
        self$`feeTier` <- InlineResponse20065Object$`feeTier`
      }
      if (!is.null(InlineResponse20065Object$`maxWithdrawAmount`)) {
        self$`maxWithdrawAmount` <- InlineResponse20065Object$`maxWithdrawAmount`
      }
      if (!is.null(InlineResponse20065Object$`totalInitialMargin`)) {
        self$`totalInitialMargin` <- InlineResponse20065Object$`totalInitialMargin`
      }
      if (!is.null(InlineResponse20065Object$`totalMaintenanceMargin`)) {
        self$`totalMaintenanceMargin` <- InlineResponse20065Object$`totalMaintenanceMargin`
      }
      if (!is.null(InlineResponse20065Object$`totalMarginBalance`)) {
        self$`totalMarginBalance` <- InlineResponse20065Object$`totalMarginBalance`
      }
      if (!is.null(InlineResponse20065Object$`totalOpenOrderInitialMargin`)) {
        self$`totalOpenOrderInitialMargin` <- InlineResponse20065Object$`totalOpenOrderInitialMargin`
      }
      if (!is.null(InlineResponse20065Object$`totalPositionInitialMargin`)) {
        self$`totalPositionInitialMargin` <- InlineResponse20065Object$`totalPositionInitialMargin`
      }
      if (!is.null(InlineResponse20065Object$`totalUnrealizedProfit`)) {
        self$`totalUnrealizedProfit` <- InlineResponse20065Object$`totalUnrealizedProfit`
      }
      if (!is.null(InlineResponse20065Object$`totalWalletBalance`)) {
        self$`totalWalletBalance` <- InlineResponse20065Object$`totalWalletBalance`
      }
      if (!is.null(InlineResponse20065Object$`updateTime`)) {
        self$`updateTime` <- InlineResponse20065Object$`updateTime`
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`email`)) {
        sprintf(
        '"email":
          "%s"
                ',
        self$`email`
        )},
        if (!is.null(self$`asset`)) {
        sprintf(
        '"asset":
          "%s"
                ',
        self$`asset`
        )},
        if (!is.null(self$`assets`)) {
        sprintf(
        '"assets":
        [%s]
',
        paste(sapply(self$`assets`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
        )},
        if (!is.null(self$`canDeposit`)) {
        sprintf(
        '"canDeposit":
          %s
                ',
        tolower(self$`canDeposit`)
        )},
        if (!is.null(self$`canTrade`)) {
        sprintf(
        '"canTrade":
          %s
                ',
        tolower(self$`canTrade`)
        )},
        if (!is.null(self$`canWithdraw`)) {
        sprintf(
        '"canWithdraw":
          %s
                ',
        tolower(self$`canWithdraw`)
        )},
        if (!is.null(self$`feeTier`)) {
        sprintf(
        '"feeTier":
          %d
                ',
        self$`feeTier`
        )},
        if (!is.null(self$`maxWithdrawAmount`)) {
        sprintf(
        '"maxWithdrawAmount":
          "%s"
                ',
        self$`maxWithdrawAmount`
        )},
        if (!is.null(self$`totalInitialMargin`)) {
        sprintf(
        '"totalInitialMargin":
          "%s"
                ',
        self$`totalInitialMargin`
        )},
        if (!is.null(self$`totalMaintenanceMargin`)) {
        sprintf(
        '"totalMaintenanceMargin":
          "%s"
                ',
        self$`totalMaintenanceMargin`
        )},
        if (!is.null(self$`totalMarginBalance`)) {
        sprintf(
        '"totalMarginBalance":
          "%s"
                ',
        self$`totalMarginBalance`
        )},
        if (!is.null(self$`totalOpenOrderInitialMargin`)) {
        sprintf(
        '"totalOpenOrderInitialMargin":
          "%s"
                ',
        self$`totalOpenOrderInitialMargin`
        )},
        if (!is.null(self$`totalPositionInitialMargin`)) {
        sprintf(
        '"totalPositionInitialMargin":
          "%s"
                ',
        self$`totalPositionInitialMargin`
        )},
        if (!is.null(self$`totalUnrealizedProfit`)) {
        sprintf(
        '"totalUnrealizedProfit":
          "%s"
                ',
        self$`totalUnrealizedProfit`
        )},
        if (!is.null(self$`totalWalletBalance`)) {
        sprintf(
        '"totalWalletBalance":
          "%s"
                ',
        self$`totalWalletBalance`
        )},
        if (!is.null(self$`updateTime`)) {
        sprintf(
        '"updateTime":
          %d
                ',
        self$`updateTime`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(InlineResponse20065Json) {
      InlineResponse20065Object <- jsonlite::fromJSON(InlineResponse20065Json)
      self$`email` <- InlineResponse20065Object$`email`
      self$`asset` <- InlineResponse20065Object$`asset`
      self$`assets` <- ApiClient$new()$deserializeObj(InlineResponse20065Object$`assets`, "array[InlineResponse20065Assets]", loadNamespace("binanceRapi"))
      self$`canDeposit` <- InlineResponse20065Object$`canDeposit`
      self$`canTrade` <- InlineResponse20065Object$`canTrade`
      self$`canWithdraw` <- InlineResponse20065Object$`canWithdraw`
      self$`feeTier` <- InlineResponse20065Object$`feeTier`
      self$`maxWithdrawAmount` <- InlineResponse20065Object$`maxWithdrawAmount`
      self$`totalInitialMargin` <- InlineResponse20065Object$`totalInitialMargin`
      self$`totalMaintenanceMargin` <- InlineResponse20065Object$`totalMaintenanceMargin`
      self$`totalMarginBalance` <- InlineResponse20065Object$`totalMarginBalance`
      self$`totalOpenOrderInitialMargin` <- InlineResponse20065Object$`totalOpenOrderInitialMargin`
      self$`totalPositionInitialMargin` <- InlineResponse20065Object$`totalPositionInitialMargin`
      self$`totalUnrealizedProfit` <- InlineResponse20065Object$`totalUnrealizedProfit`
      self$`totalWalletBalance` <- InlineResponse20065Object$`totalWalletBalance`
      self$`updateTime` <- InlineResponse20065Object$`updateTime`
      self
    }
  )
)
grahamjwhite/binanceRapi documentation built on Nov. 22, 2022, 9:37 p.m.