R/sub_account_coin_futures_details.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 SubAccountCOINFuturesDetails
#'
#' @description SubAccountCOINFuturesDetails Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field email  character 
#'
#' @field assets  list( \link{SubAccountCOINFuturesDetailsAssets} ) 
#'
#' @field canDeposit  character 
#'
#' @field canTrade  character 
#'
#' @field canWithdraw  character 
#'
#' @field feeTier  integer 
#'
#' @field updateTime  integer 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
SubAccountCOINFuturesDetails <- R6::R6Class(
  'SubAccountCOINFuturesDetails',
  public = list(
    `email` = NULL,
    `assets` = NULL,
    `canDeposit` = NULL,
    `canTrade` = NULL,
    `canWithdraw` = NULL,
    `feeTier` = NULL,
    `updateTime` = NULL,
    initialize = function(
        `email`, `assets`, `canDeposit`, `canTrade`, `canWithdraw`, `feeTier`, `updateTime`, ...
    ) {
      local.optional.var <- list(...)
      if (!missing(`email`)) {
        stopifnot(is.character(`email`), length(`email`) == 1)
        self$`email` <- `email`
      }
      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(`updateTime`)) {
        stopifnot(is.numeric(`updateTime`), length(`updateTime`) == 1)
        self$`updateTime` <- `updateTime`
      }
    },
    toJSON = function() {
      SubAccountCOINFuturesDetailsObject <- list()
      if (!is.null(self$`email`)) {
        SubAccountCOINFuturesDetailsObject[['email']] <-
          self$`email`
      }
      if (!is.null(self$`assets`)) {
        SubAccountCOINFuturesDetailsObject[['assets']] <-
          lapply(self$`assets`, function(x) x$toJSON())
      }
      if (!is.null(self$`canDeposit`)) {
        SubAccountCOINFuturesDetailsObject[['canDeposit']] <-
          self$`canDeposit`
      }
      if (!is.null(self$`canTrade`)) {
        SubAccountCOINFuturesDetailsObject[['canTrade']] <-
          self$`canTrade`
      }
      if (!is.null(self$`canWithdraw`)) {
        SubAccountCOINFuturesDetailsObject[['canWithdraw']] <-
          self$`canWithdraw`
      }
      if (!is.null(self$`feeTier`)) {
        SubAccountCOINFuturesDetailsObject[['feeTier']] <-
          self$`feeTier`
      }
      if (!is.null(self$`updateTime`)) {
        SubAccountCOINFuturesDetailsObject[['updateTime']] <-
          self$`updateTime`
      }

      SubAccountCOINFuturesDetailsObject
    },
    fromJSON = function(SubAccountCOINFuturesDetailsJson) {
      SubAccountCOINFuturesDetailsObject <- jsonlite::fromJSON(SubAccountCOINFuturesDetailsJson)
      if (!is.null(SubAccountCOINFuturesDetailsObject$`email`)) {
        self$`email` <- SubAccountCOINFuturesDetailsObject$`email`
      }
      if (!is.null(SubAccountCOINFuturesDetailsObject$`assets`)) {
        self$`assets` <- ApiClient$new()$deserializeObj(SubAccountCOINFuturesDetailsObject$`assets`, "array[SubAccountCOINFuturesDetailsAssets]", loadNamespace("binanceRapi"))
      }
      if (!is.null(SubAccountCOINFuturesDetailsObject$`canDeposit`)) {
        self$`canDeposit` <- SubAccountCOINFuturesDetailsObject$`canDeposit`
      }
      if (!is.null(SubAccountCOINFuturesDetailsObject$`canTrade`)) {
        self$`canTrade` <- SubAccountCOINFuturesDetailsObject$`canTrade`
      }
      if (!is.null(SubAccountCOINFuturesDetailsObject$`canWithdraw`)) {
        self$`canWithdraw` <- SubAccountCOINFuturesDetailsObject$`canWithdraw`
      }
      if (!is.null(SubAccountCOINFuturesDetailsObject$`feeTier`)) {
        self$`feeTier` <- SubAccountCOINFuturesDetailsObject$`feeTier`
      }
      if (!is.null(SubAccountCOINFuturesDetailsObject$`updateTime`)) {
        self$`updateTime` <- SubAccountCOINFuturesDetailsObject$`updateTime`
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`email`)) {
        sprintf(
        '"email":
          "%s"
                ',
        self$`email`
        )},
        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$`updateTime`)) {
        sprintf(
        '"updateTime":
          %d
                ',
        self$`updateTime`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(SubAccountCOINFuturesDetailsJson) {
      SubAccountCOINFuturesDetailsObject <- jsonlite::fromJSON(SubAccountCOINFuturesDetailsJson)
      self$`email` <- SubAccountCOINFuturesDetailsObject$`email`
      self$`assets` <- ApiClient$new()$deserializeObj(SubAccountCOINFuturesDetailsObject$`assets`, "array[SubAccountCOINFuturesDetailsAssets]", loadNamespace("binanceRapi"))
      self$`canDeposit` <- SubAccountCOINFuturesDetailsObject$`canDeposit`
      self$`canTrade` <- SubAccountCOINFuturesDetailsObject$`canTrade`
      self$`canWithdraw` <- SubAccountCOINFuturesDetailsObject$`canWithdraw`
      self$`feeTier` <- SubAccountCOINFuturesDetailsObject$`feeTier`
      self$`updateTime` <- SubAccountCOINFuturesDetailsObject$`updateTime`
      self
    }
  )
)
grahamjwhite/binanceRapi documentation built on Nov. 22, 2022, 9:37 p.m.