R/inline_response20097_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 InlineResponse20097Data
#'
#' @description InlineResponse20097Data Class
#'
#' @format An \code{R6Class} generator object
#'
#' @field otherProfits  list( \link{InlineResponse20097DataOtherProfits} ) 
#'
#' @field totalNum  integer 
#'
#' @field pageSize  integer 
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
InlineResponse20097Data <- R6::R6Class(
  'InlineResponse20097Data',
  public = list(
    `otherProfits` = NULL,
    `totalNum` = NULL,
    `pageSize` = NULL,
    initialize = function(
        `otherProfits`, `totalNum`, `pageSize`, ...
    ) {
      local.optional.var <- list(...)
      if (!missing(`otherProfits`)) {
        stopifnot(is.vector(`otherProfits`), length(`otherProfits`) != 0)
        sapply(`otherProfits`, function(x) stopifnot(R6::is.R6(x)))
        self$`otherProfits` <- `otherProfits`
      }
      if (!missing(`totalNum`)) {
        stopifnot(is.numeric(`totalNum`), length(`totalNum`) == 1)
        self$`totalNum` <- `totalNum`
      }
      if (!missing(`pageSize`)) {
        stopifnot(is.numeric(`pageSize`), length(`pageSize`) == 1)
        self$`pageSize` <- `pageSize`
      }
    },
    toJSON = function() {
      InlineResponse20097DataObject <- list()
      if (!is.null(self$`otherProfits`)) {
        InlineResponse20097DataObject[['otherProfits']] <-
          lapply(self$`otherProfits`, function(x) x$toJSON())
      }
      if (!is.null(self$`totalNum`)) {
        InlineResponse20097DataObject[['totalNum']] <-
          self$`totalNum`
      }
      if (!is.null(self$`pageSize`)) {
        InlineResponse20097DataObject[['pageSize']] <-
          self$`pageSize`
      }

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