R/inline_response200115.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 InlineResponse200115
#'
#' @description InlineResponse200115 Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field tokenName  character 
#'
#' @field description  character 
#'
#' @field underlying  character 
#'
#' @field tokenIssued  character 
#'
#' @field basket  character 
#'
#' @field currentBaskets  list( \link{SapiV1BlvtTokenInfoCurrentBaskets} ) 
#'
#' @field nav  character 
#'
#' @field realLeverage  character 
#'
#' @field fundingRate  character 
#'
#' @field dailyManagementFee  character 
#'
#' @field purchaseFeePct  character 
#'
#' @field dailyPurchaseLimit  character 
#'
#' @field redeemFeePct  character 
#'
#' @field dailyRedeemLimit  character 
#'
#' @field timestamp  integer 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
InlineResponse200115 <- R6::R6Class(
  'InlineResponse200115',
  public = list(
    `tokenName` = NULL,
    `description` = NULL,
    `underlying` = NULL,
    `tokenIssued` = NULL,
    `basket` = NULL,
    `currentBaskets` = NULL,
    `nav` = NULL,
    `realLeverage` = NULL,
    `fundingRate` = NULL,
    `dailyManagementFee` = NULL,
    `purchaseFeePct` = NULL,
    `dailyPurchaseLimit` = NULL,
    `redeemFeePct` = NULL,
    `dailyRedeemLimit` = NULL,
    `timestamp` = NULL,
    initialize = function(
        `tokenName`, `description`, `underlying`, `tokenIssued`, `basket`, `currentBaskets`, `nav`, `realLeverage`, `fundingRate`, `dailyManagementFee`, `purchaseFeePct`, `dailyPurchaseLimit`, `redeemFeePct`, `dailyRedeemLimit`, `timestamp`, ...
    ) {
      local.optional.var <- list(...)
      if (!missing(`tokenName`)) {
        stopifnot(is.character(`tokenName`), length(`tokenName`) == 1)
        self$`tokenName` <- `tokenName`
      }
      if (!missing(`description`)) {
        stopifnot(is.character(`description`), length(`description`) == 1)
        self$`description` <- `description`
      }
      if (!missing(`underlying`)) {
        stopifnot(is.character(`underlying`), length(`underlying`) == 1)
        self$`underlying` <- `underlying`
      }
      if (!missing(`tokenIssued`)) {
        stopifnot(is.character(`tokenIssued`), length(`tokenIssued`) == 1)
        self$`tokenIssued` <- `tokenIssued`
      }
      if (!missing(`basket`)) {
        stopifnot(is.character(`basket`), length(`basket`) == 1)
        self$`basket` <- `basket`
      }
      if (!missing(`currentBaskets`)) {
        stopifnot(is.vector(`currentBaskets`), length(`currentBaskets`) != 0)
        sapply(`currentBaskets`, function(x) stopifnot(R6::is.R6(x)))
        self$`currentBaskets` <- `currentBaskets`
      }
      if (!missing(`nav`)) {
        stopifnot(is.character(`nav`), length(`nav`) == 1)
        self$`nav` <- `nav`
      }
      if (!missing(`realLeverage`)) {
        stopifnot(is.character(`realLeverage`), length(`realLeverage`) == 1)
        self$`realLeverage` <- `realLeverage`
      }
      if (!missing(`fundingRate`)) {
        stopifnot(is.character(`fundingRate`), length(`fundingRate`) == 1)
        self$`fundingRate` <- `fundingRate`
      }
      if (!missing(`dailyManagementFee`)) {
        stopifnot(is.character(`dailyManagementFee`), length(`dailyManagementFee`) == 1)
        self$`dailyManagementFee` <- `dailyManagementFee`
      }
      if (!missing(`purchaseFeePct`)) {
        stopifnot(is.character(`purchaseFeePct`), length(`purchaseFeePct`) == 1)
        self$`purchaseFeePct` <- `purchaseFeePct`
      }
      if (!missing(`dailyPurchaseLimit`)) {
        stopifnot(is.character(`dailyPurchaseLimit`), length(`dailyPurchaseLimit`) == 1)
        self$`dailyPurchaseLimit` <- `dailyPurchaseLimit`
      }
      if (!missing(`redeemFeePct`)) {
        stopifnot(is.character(`redeemFeePct`), length(`redeemFeePct`) == 1)
        self$`redeemFeePct` <- `redeemFeePct`
      }
      if (!missing(`dailyRedeemLimit`)) {
        stopifnot(is.character(`dailyRedeemLimit`), length(`dailyRedeemLimit`) == 1)
        self$`dailyRedeemLimit` <- `dailyRedeemLimit`
      }
      if (!missing(`timestamp`)) {
        stopifnot(is.numeric(`timestamp`), length(`timestamp`) == 1)
        self$`timestamp` <- `timestamp`
      }
    },
    toJSON = function() {
      InlineResponse200115Object <- list()
      if (!is.null(self$`tokenName`)) {
        InlineResponse200115Object[['tokenName']] <-
          self$`tokenName`
      }
      if (!is.null(self$`description`)) {
        InlineResponse200115Object[['description']] <-
          self$`description`
      }
      if (!is.null(self$`underlying`)) {
        InlineResponse200115Object[['underlying']] <-
          self$`underlying`
      }
      if (!is.null(self$`tokenIssued`)) {
        InlineResponse200115Object[['tokenIssued']] <-
          self$`tokenIssued`
      }
      if (!is.null(self$`basket`)) {
        InlineResponse200115Object[['basket']] <-
          self$`basket`
      }
      if (!is.null(self$`currentBaskets`)) {
        InlineResponse200115Object[['currentBaskets']] <-
          lapply(self$`currentBaskets`, function(x) x$toJSON())
      }
      if (!is.null(self$`nav`)) {
        InlineResponse200115Object[['nav']] <-
          self$`nav`
      }
      if (!is.null(self$`realLeverage`)) {
        InlineResponse200115Object[['realLeverage']] <-
          self$`realLeverage`
      }
      if (!is.null(self$`fundingRate`)) {
        InlineResponse200115Object[['fundingRate']] <-
          self$`fundingRate`
      }
      if (!is.null(self$`dailyManagementFee`)) {
        InlineResponse200115Object[['dailyManagementFee']] <-
          self$`dailyManagementFee`
      }
      if (!is.null(self$`purchaseFeePct`)) {
        InlineResponse200115Object[['purchaseFeePct']] <-
          self$`purchaseFeePct`
      }
      if (!is.null(self$`dailyPurchaseLimit`)) {
        InlineResponse200115Object[['dailyPurchaseLimit']] <-
          self$`dailyPurchaseLimit`
      }
      if (!is.null(self$`redeemFeePct`)) {
        InlineResponse200115Object[['redeemFeePct']] <-
          self$`redeemFeePct`
      }
      if (!is.null(self$`dailyRedeemLimit`)) {
        InlineResponse200115Object[['dailyRedeemLimit']] <-
          self$`dailyRedeemLimit`
      }
      if (!is.null(self$`timestamp`)) {
        InlineResponse200115Object[['timestamp']] <-
          self$`timestamp`
      }

      InlineResponse200115Object
    },
    fromJSON = function(InlineResponse200115Json) {
      InlineResponse200115Object <- jsonlite::fromJSON(InlineResponse200115Json)
      if (!is.null(InlineResponse200115Object$`tokenName`)) {
        self$`tokenName` <- InlineResponse200115Object$`tokenName`
      }
      if (!is.null(InlineResponse200115Object$`description`)) {
        self$`description` <- InlineResponse200115Object$`description`
      }
      if (!is.null(InlineResponse200115Object$`underlying`)) {
        self$`underlying` <- InlineResponse200115Object$`underlying`
      }
      if (!is.null(InlineResponse200115Object$`tokenIssued`)) {
        self$`tokenIssued` <- InlineResponse200115Object$`tokenIssued`
      }
      if (!is.null(InlineResponse200115Object$`basket`)) {
        self$`basket` <- InlineResponse200115Object$`basket`
      }
      if (!is.null(InlineResponse200115Object$`currentBaskets`)) {
        self$`currentBaskets` <- ApiClient$new()$deserializeObj(InlineResponse200115Object$`currentBaskets`, "array[SapiV1BlvtTokenInfoCurrentBaskets]", loadNamespace("binanceRapi"))
      }
      if (!is.null(InlineResponse200115Object$`nav`)) {
        self$`nav` <- InlineResponse200115Object$`nav`
      }
      if (!is.null(InlineResponse200115Object$`realLeverage`)) {
        self$`realLeverage` <- InlineResponse200115Object$`realLeverage`
      }
      if (!is.null(InlineResponse200115Object$`fundingRate`)) {
        self$`fundingRate` <- InlineResponse200115Object$`fundingRate`
      }
      if (!is.null(InlineResponse200115Object$`dailyManagementFee`)) {
        self$`dailyManagementFee` <- InlineResponse200115Object$`dailyManagementFee`
      }
      if (!is.null(InlineResponse200115Object$`purchaseFeePct`)) {
        self$`purchaseFeePct` <- InlineResponse200115Object$`purchaseFeePct`
      }
      if (!is.null(InlineResponse200115Object$`dailyPurchaseLimit`)) {
        self$`dailyPurchaseLimit` <- InlineResponse200115Object$`dailyPurchaseLimit`
      }
      if (!is.null(InlineResponse200115Object$`redeemFeePct`)) {
        self$`redeemFeePct` <- InlineResponse200115Object$`redeemFeePct`
      }
      if (!is.null(InlineResponse200115Object$`dailyRedeemLimit`)) {
        self$`dailyRedeemLimit` <- InlineResponse200115Object$`dailyRedeemLimit`
      }
      if (!is.null(InlineResponse200115Object$`timestamp`)) {
        self$`timestamp` <- InlineResponse200115Object$`timestamp`
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`tokenName`)) {
        sprintf(
        '"tokenName":
          "%s"
                ',
        self$`tokenName`
        )},
        if (!is.null(self$`description`)) {
        sprintf(
        '"description":
          "%s"
                ',
        self$`description`
        )},
        if (!is.null(self$`underlying`)) {
        sprintf(
        '"underlying":
          "%s"
                ',
        self$`underlying`
        )},
        if (!is.null(self$`tokenIssued`)) {
        sprintf(
        '"tokenIssued":
          "%s"
                ',
        self$`tokenIssued`
        )},
        if (!is.null(self$`basket`)) {
        sprintf(
        '"basket":
          "%s"
                ',
        self$`basket`
        )},
        if (!is.null(self$`currentBaskets`)) {
        sprintf(
        '"currentBaskets":
        [%s]
',
        paste(sapply(self$`currentBaskets`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
        )},
        if (!is.null(self$`nav`)) {
        sprintf(
        '"nav":
          "%s"
                ',
        self$`nav`
        )},
        if (!is.null(self$`realLeverage`)) {
        sprintf(
        '"realLeverage":
          "%s"
                ',
        self$`realLeverage`
        )},
        if (!is.null(self$`fundingRate`)) {
        sprintf(
        '"fundingRate":
          "%s"
                ',
        self$`fundingRate`
        )},
        if (!is.null(self$`dailyManagementFee`)) {
        sprintf(
        '"dailyManagementFee":
          "%s"
                ',
        self$`dailyManagementFee`
        )},
        if (!is.null(self$`purchaseFeePct`)) {
        sprintf(
        '"purchaseFeePct":
          "%s"
                ',
        self$`purchaseFeePct`
        )},
        if (!is.null(self$`dailyPurchaseLimit`)) {
        sprintf(
        '"dailyPurchaseLimit":
          "%s"
                ',
        self$`dailyPurchaseLimit`
        )},
        if (!is.null(self$`redeemFeePct`)) {
        sprintf(
        '"redeemFeePct":
          "%s"
                ',
        self$`redeemFeePct`
        )},
        if (!is.null(self$`dailyRedeemLimit`)) {
        sprintf(
        '"dailyRedeemLimit":
          "%s"
                ',
        self$`dailyRedeemLimit`
        )},
        if (!is.null(self$`timestamp`)) {
        sprintf(
        '"timestamp":
          %d
                ',
        self$`timestamp`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(InlineResponse200115Json) {
      InlineResponse200115Object <- jsonlite::fromJSON(InlineResponse200115Json)
      self$`tokenName` <- InlineResponse200115Object$`tokenName`
      self$`description` <- InlineResponse200115Object$`description`
      self$`underlying` <- InlineResponse200115Object$`underlying`
      self$`tokenIssued` <- InlineResponse200115Object$`tokenIssued`
      self$`basket` <- InlineResponse200115Object$`basket`
      self$`currentBaskets` <- ApiClient$new()$deserializeObj(InlineResponse200115Object$`currentBaskets`, "array[SapiV1BlvtTokenInfoCurrentBaskets]", loadNamespace("binanceRapi"))
      self$`nav` <- InlineResponse200115Object$`nav`
      self$`realLeverage` <- InlineResponse200115Object$`realLeverage`
      self$`fundingRate` <- InlineResponse200115Object$`fundingRate`
      self$`dailyManagementFee` <- InlineResponse200115Object$`dailyManagementFee`
      self$`purchaseFeePct` <- InlineResponse200115Object$`purchaseFeePct`
      self$`dailyPurchaseLimit` <- InlineResponse200115Object$`dailyPurchaseLimit`
      self$`redeemFeePct` <- InlineResponse200115Object$`redeemFeePct`
      self$`dailyRedeemLimit` <- InlineResponse200115Object$`dailyRedeemLimit`
      self$`timestamp` <- InlineResponse200115Object$`timestamp`
      self
    }
  )
)
grahamjwhite/binanceRapi documentation built on Nov. 22, 2022, 9:37 p.m.