R/inline_response20094_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 InlineResponse20094Data
#'
#' @description InlineResponse20094Data Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field workerName  character 
#'
#' @field type  character 
#'
#' @field hashrateDatas  list( \link{InlineResponse20094HashrateDatas} ) 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
InlineResponse20094Data <- R6::R6Class(
  'InlineResponse20094Data',
  public = list(
    `workerName` = NULL,
    `type` = NULL,
    `hashrateDatas` = NULL,
    initialize = function(
        `workerName`, `type`, `hashrateDatas`, ...
    ) {
      local.optional.var <- list(...)
      if (!missing(`workerName`)) {
        stopifnot(is.character(`workerName`), length(`workerName`) == 1)
        self$`workerName` <- `workerName`
      }
      if (!missing(`type`)) {
        stopifnot(is.character(`type`), length(`type`) == 1)
        self$`type` <- `type`
      }
      if (!missing(`hashrateDatas`)) {
        stopifnot(is.vector(`hashrateDatas`), length(`hashrateDatas`) != 0)
        sapply(`hashrateDatas`, function(x) stopifnot(R6::is.R6(x)))
        self$`hashrateDatas` <- `hashrateDatas`
      }
    },
    toJSON = function() {
      InlineResponse20094DataObject <- list()
      if (!is.null(self$`workerName`)) {
        InlineResponse20094DataObject[['workerName']] <-
          self$`workerName`
      }
      if (!is.null(self$`type`)) {
        InlineResponse20094DataObject[['type']] <-
          self$`type`
      }
      if (!is.null(self$`hashrateDatas`)) {
        InlineResponse20094DataObject[['hashrateDatas']] <-
          lapply(self$`hashrateDatas`, function(x) x$toJSON())
      }

      InlineResponse20094DataObject
    },
    fromJSON = function(InlineResponse20094DataJson) {
      InlineResponse20094DataObject <- jsonlite::fromJSON(InlineResponse20094DataJson)
      if (!is.null(InlineResponse20094DataObject$`workerName`)) {
        self$`workerName` <- InlineResponse20094DataObject$`workerName`
      }
      if (!is.null(InlineResponse20094DataObject$`type`)) {
        self$`type` <- InlineResponse20094DataObject$`type`
      }
      if (!is.null(InlineResponse20094DataObject$`hashrateDatas`)) {
        self$`hashrateDatas` <- ApiClient$new()$deserializeObj(InlineResponse20094DataObject$`hashrateDatas`, "array[InlineResponse20094HashrateDatas]", loadNamespace("binanceRapi"))
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`workerName`)) {
        sprintf(
        '"workerName":
          "%s"
                ',
        self$`workerName`
        )},
        if (!is.null(self$`type`)) {
        sprintf(
        '"type":
          "%s"
                ',
        self$`type`
        )},
        if (!is.null(self$`hashrateDatas`)) {
        sprintf(
        '"hashrateDatas":
        [%s]
',
        paste(sapply(self$`hashrateDatas`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA)), collapse=",")
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(InlineResponse20094DataJson) {
      InlineResponse20094DataObject <- jsonlite::fromJSON(InlineResponse20094DataJson)
      self$`workerName` <- InlineResponse20094DataObject$`workerName`
      self$`type` <- InlineResponse20094DataObject$`type`
      self$`hashrateDatas` <- ApiClient$new()$deserializeObj(InlineResponse20094DataObject$`hashrateDatas`, "array[InlineResponse20094HashrateDatas]", loadNamespace("binanceRapi"))
      self
    }
  )
)
grahamjwhite/binanceRapi documentation built on Nov. 22, 2022, 9:37 p.m.