R/inline_response200120_data.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 InlineResponse200120Data
#'
#' @description InlineResponse200120Data Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field orderType  character 
#'
#' @field transactionId  character 
#'
#' @field transactionTime  integer 
#'
#' @field amount  character 
#'
#' @field currency  character 
#'
#' @field fundsDetail  list( \link{InlineResponse200120FundsDetail} ) 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
InlineResponse200120Data <- R6::R6Class(
  'InlineResponse200120Data',
  public = list(
    `orderType` = NULL,
    `transactionId` = NULL,
    `transactionTime` = NULL,
    `amount` = NULL,
    `currency` = NULL,
    `fundsDetail` = NULL,
    initialize = function(
        `orderType`, `transactionId`, `transactionTime`, `amount`, `currency`, `fundsDetail`, ...
    ) {
      local.optional.var <- list(...)
      if (!missing(`orderType`)) {
        stopifnot(is.character(`orderType`), length(`orderType`) == 1)
        self$`orderType` <- `orderType`
      }
      if (!missing(`transactionId`)) {
        stopifnot(is.character(`transactionId`), length(`transactionId`) == 1)
        self$`transactionId` <- `transactionId`
      }
      if (!missing(`transactionTime`)) {
        stopifnot(is.numeric(`transactionTime`), length(`transactionTime`) == 1)
        self$`transactionTime` <- `transactionTime`
      }
      if (!missing(`amount`)) {
        stopifnot(is.character(`amount`), length(`amount`) == 1)
        self$`amount` <- `amount`
      }
      if (!missing(`currency`)) {
        stopifnot(is.character(`currency`), length(`currency`) == 1)
        self$`currency` <- `currency`
      }
      if (!missing(`fundsDetail`)) {
        stopifnot(is.vector(`fundsDetail`), length(`fundsDetail`) != 0)
        sapply(`fundsDetail`, function(x) stopifnot(R6::is.R6(x)))
        self$`fundsDetail` <- `fundsDetail`
      }
    },
    toJSON = function() {
      InlineResponse200120DataObject <- list()
      if (!is.null(self$`orderType`)) {
        InlineResponse200120DataObject[['orderType']] <-
          self$`orderType`
      }
      if (!is.null(self$`transactionId`)) {
        InlineResponse200120DataObject[['transactionId']] <-
          self$`transactionId`
      }
      if (!is.null(self$`transactionTime`)) {
        InlineResponse200120DataObject[['transactionTime']] <-
          self$`transactionTime`
      }
      if (!is.null(self$`amount`)) {
        InlineResponse200120DataObject[['amount']] <-
          self$`amount`
      }
      if (!is.null(self$`currency`)) {
        InlineResponse200120DataObject[['currency']] <-
          self$`currency`
      }
      if (!is.null(self$`fundsDetail`)) {
        InlineResponse200120DataObject[['fundsDetail']] <-
          lapply(self$`fundsDetail`, function(x) x$toJSON())
      }

      InlineResponse200120DataObject
    },
    fromJSON = function(InlineResponse200120DataJson) {
      InlineResponse200120DataObject <- jsonlite::fromJSON(InlineResponse200120DataJson)
      if (!is.null(InlineResponse200120DataObject$`orderType`)) {
        self$`orderType` <- InlineResponse200120DataObject$`orderType`
      }
      if (!is.null(InlineResponse200120DataObject$`transactionId`)) {
        self$`transactionId` <- InlineResponse200120DataObject$`transactionId`
      }
      if (!is.null(InlineResponse200120DataObject$`transactionTime`)) {
        self$`transactionTime` <- InlineResponse200120DataObject$`transactionTime`
      }
      if (!is.null(InlineResponse200120DataObject$`amount`)) {
        self$`amount` <- InlineResponse200120DataObject$`amount`
      }
      if (!is.null(InlineResponse200120DataObject$`currency`)) {
        self$`currency` <- InlineResponse200120DataObject$`currency`
      }
      if (!is.null(InlineResponse200120DataObject$`fundsDetail`)) {
        self$`fundsDetail` <- ApiClient$new()$deserializeObj(InlineResponse200120DataObject$`fundsDetail`, "array[InlineResponse200120FundsDetail]", loadNamespace("binanceRapi"))
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`orderType`)) {
        sprintf(
        '"orderType":
          "%s"
                ',
        self$`orderType`
        )},
        if (!is.null(self$`transactionId`)) {
        sprintf(
        '"transactionId":
          "%s"
                ',
        self$`transactionId`
        )},
        if (!is.null(self$`transactionTime`)) {
        sprintf(
        '"transactionTime":
          %d
                ',
        self$`transactionTime`
        )},
        if (!is.null(self$`amount`)) {
        sprintf(
        '"amount":
          "%s"
                ',
        self$`amount`
        )},
        if (!is.null(self$`currency`)) {
        sprintf(
        '"currency":
          "%s"
                ',
        self$`currency`
        )},
        if (!is.null(self$`fundsDetail`)) {
        sprintf(
        '"fundsDetail":
        [%s]
',
        paste(sapply(self$`fundsDetail`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(InlineResponse200120DataJson) {
      InlineResponse200120DataObject <- jsonlite::fromJSON(InlineResponse200120DataJson)
      self$`orderType` <- InlineResponse200120DataObject$`orderType`
      self$`transactionId` <- InlineResponse200120DataObject$`transactionId`
      self$`transactionTime` <- InlineResponse200120DataObject$`transactionTime`
      self$`amount` <- InlineResponse200120DataObject$`amount`
      self$`currency` <- InlineResponse200120DataObject$`currency`
      self$`fundsDetail` <- ApiClient$new()$deserializeObj(InlineResponse200120DataObject$`fundsDetail`, "array[InlineResponse200120FundsDetail]", loadNamespace("binanceRapi"))
      self
    }
  )
)
grahamjwhite/binanceRapi documentation built on Nov. 22, 2022, 9:37 p.m.