R/bswap_rmv_liquidity_preview_single.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 BswapRmvLiquidityPreviewSingle
#'
#' @description BswapRmvLiquidityPreviewSingle Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field quoteAsset  character 
#'
#' @field quoteAmt  integer 
#'
#' @field price  numeric 
#'
#' @field slippage  numeric 
#'
#' @field fee  numeric 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
BswapRmvLiquidityPreviewSingle <- R6::R6Class(
  'BswapRmvLiquidityPreviewSingle',
  public = list(
    `quoteAsset` = NULL,
    `quoteAmt` = NULL,
    `price` = NULL,
    `slippage` = NULL,
    `fee` = NULL,
    initialize = function(
        `quoteAsset`, `quoteAmt`, `price`, `slippage`, `fee`, ...
    ) {
      local.optional.var <- list(...)
      if (!missing(`quoteAsset`)) {
        stopifnot(is.character(`quoteAsset`), length(`quoteAsset`) == 1)
        self$`quoteAsset` <- `quoteAsset`
      }
      if (!missing(`quoteAmt`)) {
        stopifnot(is.numeric(`quoteAmt`), length(`quoteAmt`) == 1)
        self$`quoteAmt` <- `quoteAmt`
      }
      if (!missing(`price`)) {
        stopifnot(is.numeric(`price`), length(`price`) == 1)
        self$`price` <- `price`
      }
      if (!missing(`slippage`)) {
        stopifnot(is.numeric(`slippage`), length(`slippage`) == 1)
        self$`slippage` <- `slippage`
      }
      if (!missing(`fee`)) {
        stopifnot(is.numeric(`fee`), length(`fee`) == 1)
        self$`fee` <- `fee`
      }
    },
    toJSON = function() {
      BswapRmvLiquidityPreviewSingleObject <- list()
      if (!is.null(self$`quoteAsset`)) {
        BswapRmvLiquidityPreviewSingleObject[['quoteAsset']] <-
          self$`quoteAsset`
      }
      if (!is.null(self$`quoteAmt`)) {
        BswapRmvLiquidityPreviewSingleObject[['quoteAmt']] <-
          self$`quoteAmt`
      }
      if (!is.null(self$`price`)) {
        BswapRmvLiquidityPreviewSingleObject[['price']] <-
          self$`price`
      }
      if (!is.null(self$`slippage`)) {
        BswapRmvLiquidityPreviewSingleObject[['slippage']] <-
          self$`slippage`
      }
      if (!is.null(self$`fee`)) {
        BswapRmvLiquidityPreviewSingleObject[['fee']] <-
          self$`fee`
      }

      BswapRmvLiquidityPreviewSingleObject
    },
    fromJSON = function(BswapRmvLiquidityPreviewSingleJson) {
      BswapRmvLiquidityPreviewSingleObject <- jsonlite::fromJSON(BswapRmvLiquidityPreviewSingleJson)
      if (!is.null(BswapRmvLiquidityPreviewSingleObject$`quoteAsset`)) {
        self$`quoteAsset` <- BswapRmvLiquidityPreviewSingleObject$`quoteAsset`
      }
      if (!is.null(BswapRmvLiquidityPreviewSingleObject$`quoteAmt`)) {
        self$`quoteAmt` <- BswapRmvLiquidityPreviewSingleObject$`quoteAmt`
      }
      if (!is.null(BswapRmvLiquidityPreviewSingleObject$`price`)) {
        self$`price` <- BswapRmvLiquidityPreviewSingleObject$`price`
      }
      if (!is.null(BswapRmvLiquidityPreviewSingleObject$`slippage`)) {
        self$`slippage` <- BswapRmvLiquidityPreviewSingleObject$`slippage`
      }
      if (!is.null(BswapRmvLiquidityPreviewSingleObject$`fee`)) {
        self$`fee` <- BswapRmvLiquidityPreviewSingleObject$`fee`
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`quoteAsset`)) {
        sprintf(
        '"quoteAsset":
          "%s"
                ',
        self$`quoteAsset`
        )},
        if (!is.null(self$`quoteAmt`)) {
        sprintf(
        '"quoteAmt":
          %d
                ',
        self$`quoteAmt`
        )},
        if (!is.null(self$`price`)) {
        sprintf(
        '"price":
          %d
                ',
        self$`price`
        )},
        if (!is.null(self$`slippage`)) {
        sprintf(
        '"slippage":
          %d
                ',
        self$`slippage`
        )},
        if (!is.null(self$`fee`)) {
        sprintf(
        '"fee":
          %d
                ',
        self$`fee`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(BswapRmvLiquidityPreviewSingleJson) {
      BswapRmvLiquidityPreviewSingleObject <- jsonlite::fromJSON(BswapRmvLiquidityPreviewSingleJson)
      self$`quoteAsset` <- BswapRmvLiquidityPreviewSingleObject$`quoteAsset`
      self$`quoteAmt` <- BswapRmvLiquidityPreviewSingleObject$`quoteAmt`
      self$`price` <- BswapRmvLiquidityPreviewSingleObject$`price`
      self$`slippage` <- BswapRmvLiquidityPreviewSingleObject$`slippage`
      self$`fee` <- BswapRmvLiquidityPreviewSingleObject$`fee`
      self
    }
  )
)
grahamjwhite/binanceRapi documentation built on Nov. 22, 2022, 9:37 p.m.