R/inline_response20040_user_asset_dribblets.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 InlineResponse20040UserAssetDribblets
#'
#' @description InlineResponse20040UserAssetDribblets Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field operateTime  integer 
#'
#' @field totalTransferedAmount  character 
#'
#' @field totalServiceChargeAmount  character 
#'
#' @field transId  integer 
#'
#' @field userAssetDribbletDetails  list( \link{InlineResponse20040UserAssetDribbletDetails} ) 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
InlineResponse20040UserAssetDribblets <- R6::R6Class(
  'InlineResponse20040UserAssetDribblets',
  public = list(
    `operateTime` = NULL,
    `totalTransferedAmount` = NULL,
    `totalServiceChargeAmount` = NULL,
    `transId` = NULL,
    `userAssetDribbletDetails` = NULL,
    initialize = function(
        `operateTime`, `totalTransferedAmount`, `totalServiceChargeAmount`, `transId`, `userAssetDribbletDetails`, ...
    ) {
      local.optional.var <- list(...)
      if (!missing(`operateTime`)) {
        stopifnot(is.numeric(`operateTime`), length(`operateTime`) == 1)
        self$`operateTime` <- `operateTime`
      }
      if (!missing(`totalTransferedAmount`)) {
        stopifnot(is.character(`totalTransferedAmount`), length(`totalTransferedAmount`) == 1)
        self$`totalTransferedAmount` <- `totalTransferedAmount`
      }
      if (!missing(`totalServiceChargeAmount`)) {
        stopifnot(is.character(`totalServiceChargeAmount`), length(`totalServiceChargeAmount`) == 1)
        self$`totalServiceChargeAmount` <- `totalServiceChargeAmount`
      }
      if (!missing(`transId`)) {
        stopifnot(is.numeric(`transId`), length(`transId`) == 1)
        self$`transId` <- `transId`
      }
      if (!missing(`userAssetDribbletDetails`)) {
        stopifnot(is.vector(`userAssetDribbletDetails`), length(`userAssetDribbletDetails`) != 0)
        sapply(`userAssetDribbletDetails`, function(x) stopifnot(R6::is.R6(x)))
        self$`userAssetDribbletDetails` <- `userAssetDribbletDetails`
      }
    },
    toJSON = function() {
      InlineResponse20040UserAssetDribbletsObject <- list()
      if (!is.null(self$`operateTime`)) {
        InlineResponse20040UserAssetDribbletsObject[['operateTime']] <-
          self$`operateTime`
      }
      if (!is.null(self$`totalTransferedAmount`)) {
        InlineResponse20040UserAssetDribbletsObject[['totalTransferedAmount']] <-
          self$`totalTransferedAmount`
      }
      if (!is.null(self$`totalServiceChargeAmount`)) {
        InlineResponse20040UserAssetDribbletsObject[['totalServiceChargeAmount']] <-
          self$`totalServiceChargeAmount`
      }
      if (!is.null(self$`transId`)) {
        InlineResponse20040UserAssetDribbletsObject[['transId']] <-
          self$`transId`
      }
      if (!is.null(self$`userAssetDribbletDetails`)) {
        InlineResponse20040UserAssetDribbletsObject[['userAssetDribbletDetails']] <-
          lapply(self$`userAssetDribbletDetails`, function(x) x$toJSON())
      }

      InlineResponse20040UserAssetDribbletsObject
    },
    fromJSON = function(InlineResponse20040UserAssetDribbletsJson) {
      InlineResponse20040UserAssetDribbletsObject <- jsonlite::fromJSON(InlineResponse20040UserAssetDribbletsJson)
      if (!is.null(InlineResponse20040UserAssetDribbletsObject$`operateTime`)) {
        self$`operateTime` <- InlineResponse20040UserAssetDribbletsObject$`operateTime`
      }
      if (!is.null(InlineResponse20040UserAssetDribbletsObject$`totalTransferedAmount`)) {
        self$`totalTransferedAmount` <- InlineResponse20040UserAssetDribbletsObject$`totalTransferedAmount`
      }
      if (!is.null(InlineResponse20040UserAssetDribbletsObject$`totalServiceChargeAmount`)) {
        self$`totalServiceChargeAmount` <- InlineResponse20040UserAssetDribbletsObject$`totalServiceChargeAmount`
      }
      if (!is.null(InlineResponse20040UserAssetDribbletsObject$`transId`)) {
        self$`transId` <- InlineResponse20040UserAssetDribbletsObject$`transId`
      }
      if (!is.null(InlineResponse20040UserAssetDribbletsObject$`userAssetDribbletDetails`)) {
        self$`userAssetDribbletDetails` <- ApiClient$new()$deserializeObj(InlineResponse20040UserAssetDribbletsObject$`userAssetDribbletDetails`, "array[InlineResponse20040UserAssetDribbletDetails]", loadNamespace("binanceRapi"))
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`operateTime`)) {
        sprintf(
        '"operateTime":
          %d
                ',
        self$`operateTime`
        )},
        if (!is.null(self$`totalTransferedAmount`)) {
        sprintf(
        '"totalTransferedAmount":
          "%s"
                ',
        self$`totalTransferedAmount`
        )},
        if (!is.null(self$`totalServiceChargeAmount`)) {
        sprintf(
        '"totalServiceChargeAmount":
          "%s"
                ',
        self$`totalServiceChargeAmount`
        )},
        if (!is.null(self$`transId`)) {
        sprintf(
        '"transId":
          %d
                ',
        self$`transId`
        )},
        if (!is.null(self$`userAssetDribbletDetails`)) {
        sprintf(
        '"userAssetDribbletDetails":
        [%s]
',
        paste(sapply(self$`userAssetDribbletDetails`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(InlineResponse20040UserAssetDribbletsJson) {
      InlineResponse20040UserAssetDribbletsObject <- jsonlite::fromJSON(InlineResponse20040UserAssetDribbletsJson)
      self$`operateTime` <- InlineResponse20040UserAssetDribbletsObject$`operateTime`
      self$`totalTransferedAmount` <- InlineResponse20040UserAssetDribbletsObject$`totalTransferedAmount`
      self$`totalServiceChargeAmount` <- InlineResponse20040UserAssetDribbletsObject$`totalServiceChargeAmount`
      self$`transId` <- InlineResponse20040UserAssetDribbletsObject$`transId`
      self$`userAssetDribbletDetails` <- ApiClient$new()$deserializeObj(InlineResponse20040UserAssetDribbletsObject$`userAssetDribbletDetails`, "array[InlineResponse20040UserAssetDribbletDetails]", loadNamespace("binanceRapi"))
      self
    }
  )
)
grahamjwhite/binanceRapi documentation built on Nov. 22, 2022, 9:37 p.m.