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

      InlineResponse200113DataObject
    },
    fromJSON = function(InlineResponse200113DataJson) {
      InlineResponse200113DataObject <- jsonlite::fromJSON(InlineResponse200113DataJson)
      if (!is.null(InlineResponse200113DataObject$`accountProfits`)) {
        self$`accountProfits` <- ApiClient$new()$deserializeObj(InlineResponse200113DataObject$`accountProfits`, "array[InlineResponse200113DataAccountProfits]", loadNamespace("binanceRapi"))
      }
      if (!is.null(InlineResponse200113DataObject$`totalNum`)) {
        self$`totalNum` <- InlineResponse200113DataObject$`totalNum`
      }
      if (!is.null(InlineResponse200113DataObject$`pageSize`)) {
        self$`pageSize` <- InlineResponse200113DataObject$`pageSize`
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`accountProfits`)) {
        sprintf(
        '"accountProfits":
        [%s]
',
        paste(sapply(self$`accountProfits`, 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(InlineResponse200113DataJson) {
      InlineResponse200113DataObject <- jsonlite::fromJSON(InlineResponse200113DataJson)
      self$`accountProfits` <- ApiClient$new()$deserializeObj(InlineResponse200113DataObject$`accountProfits`, "array[InlineResponse200113DataAccountProfits]", loadNamespace("binanceRapi"))
      self$`totalNum` <- InlineResponse200113DataObject$`totalNum`
      self$`pageSize` <- InlineResponse200113DataObject$`pageSize`
      self
    }
  )
)
grahamjwhite/binanceRapi documentation built on Nov. 22, 2022, 9:37 p.m.