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

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