R/snapshot_margin_snapshot_vos.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 SnapshotMarginSnapshotVos
#'
#' @description SnapshotMarginSnapshotVos Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field data  \link{SnapshotMarginData} 
#'
#' @field type  character 
#'
#' @field updateTime  integer 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
SnapshotMarginSnapshotVos <- R6::R6Class(
  'SnapshotMarginSnapshotVos',
  public = list(
    `data` = NULL,
    `type` = NULL,
    `updateTime` = NULL,
    initialize = function(
        `data`, `type`, `updateTime`, ...
    ) {
      local.optional.var <- list(...)
      if (!missing(`data`)) {
        stopifnot(R6::is.R6(`data`))
        self$`data` <- `data`
      }
      if (!missing(`type`)) {
        stopifnot(is.character(`type`), length(`type`) == 1)
        self$`type` <- `type`
      }
      if (!missing(`updateTime`)) {
        stopifnot(is.numeric(`updateTime`), length(`updateTime`) == 1)
        self$`updateTime` <- `updateTime`
      }
    },
    toJSON = function() {
      SnapshotMarginSnapshotVosObject <- list()
      if (!is.null(self$`data`)) {
        SnapshotMarginSnapshotVosObject[['data']] <-
          self$`data`$toJSON()
      }
      if (!is.null(self$`type`)) {
        SnapshotMarginSnapshotVosObject[['type']] <-
          self$`type`
      }
      if (!is.null(self$`updateTime`)) {
        SnapshotMarginSnapshotVosObject[['updateTime']] <-
          self$`updateTime`
      }

      SnapshotMarginSnapshotVosObject
    },
    fromJSON = function(SnapshotMarginSnapshotVosJson) {
      SnapshotMarginSnapshotVosObject <- jsonlite::fromJSON(SnapshotMarginSnapshotVosJson)
      if (!is.null(SnapshotMarginSnapshotVosObject$`data`)) {
        dataObject <- SnapshotMarginData$new()
        dataObject$fromJSON(jsonlite::toJSON(SnapshotMarginSnapshotVosObject$data, auto_unbox = TRUE, digits = NA))
        self$`data` <- dataObject
      }
      if (!is.null(SnapshotMarginSnapshotVosObject$`type`)) {
        self$`type` <- SnapshotMarginSnapshotVosObject$`type`
      }
      if (!is.null(SnapshotMarginSnapshotVosObject$`updateTime`)) {
        self$`updateTime` <- SnapshotMarginSnapshotVosObject$`updateTime`
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`data`)) {
        sprintf(
        '"data":
        %s
        ',
        jsonlite::toJSON(self$`data`$toJSON(), auto_unbox=TRUE, digits = NA)
        )},
        if (!is.null(self$`type`)) {
        sprintf(
        '"type":
          "%s"
                ',
        self$`type`
        )},
        if (!is.null(self$`updateTime`)) {
        sprintf(
        '"updateTime":
          %d
                ',
        self$`updateTime`
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(SnapshotMarginSnapshotVosJson) {
      SnapshotMarginSnapshotVosObject <- jsonlite::fromJSON(SnapshotMarginSnapshotVosJson)
      self$`data` <- SnapshotMarginData$new()$fromJSON(jsonlite::toJSON(SnapshotMarginSnapshotVosObject$data, auto_unbox = TRUE, digits = NA))
      self$`type` <- SnapshotMarginSnapshotVosObject$`type`
      self$`updateTime` <- SnapshotMarginSnapshotVosObject$`updateTime`
      self
    }
  )
)
grahamjwhite/binanceRapi documentation built on Nov. 22, 2022, 9:37 p.m.