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

      InlineResponse200121Object
    },
    fromJSON = function(InlineResponse200121Json) {
      InlineResponse200121Object <- jsonlite::fromJSON(InlineResponse200121Json)
      if (!is.null(InlineResponse200121Object$`poolId`)) {
        self$`poolId` <- InlineResponse200121Object$`poolId`
      }
      if (!is.null(InlineResponse200121Object$`poolName`)) {
        self$`poolName` <- InlineResponse200121Object$`poolName`
      }
      if (!is.null(InlineResponse200121Object$`assets`)) {
        self$`assets` <- ApiClient$new()$deserializeObj(InlineResponse200121Object$`assets`, "array[character]", loadNamespace("binanceRapi"))
      }
      self
    },
    toJSONString = function() {
      jsoncontent <- c(
        if (!is.null(self$`poolId`)) {
        sprintf(
        '"poolId":
          %d
                ',
        self$`poolId`
        )},
        if (!is.null(self$`poolName`)) {
        sprintf(
        '"poolName":
          "%s"
                ',
        self$`poolName`
        )},
        if (!is.null(self$`assets`)) {
        sprintf(
        '"assets":
           [%s]
        ',
        paste(unlist(lapply(self$`assets`, function(x) paste0('"', x, '"'))), collapse=",")
        )}
      )
      jsoncontent <- paste(jsoncontent, collapse = ",")
      paste('{', jsoncontent, '}', sep = "")
    },
    fromJSONString = function(InlineResponse200121Json) {
      InlineResponse200121Object <- jsonlite::fromJSON(InlineResponse200121Json)
      self$`poolId` <- InlineResponse200121Object$`poolId`
      self$`poolName` <- InlineResponse200121Object$`poolName`
      self$`assets` <- ApiClient$new()$deserializeObj(InlineResponse200121Object$`assets`, "array[character]", loadNamespace("binanceRapi"))
      self
    }
  )
)
grahamjwhite/binanceRapi documentation built on Nov. 22, 2022, 9:37 p.m.