R/blvt_api.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 BLVT operations
#' @description binanceRapi.BLVT
#' @format An \code{R6Class} generator object
#' @field apiClient Handles the client-server communication.
#'
#' @section Methods:
#' \describe{
#' \strong{ SapiV1BlvtRedeemPost } \emph{ Redeem BLVT (USER_DATA) }
#' Weight(IP): 1
#'
#' \itemize{
#' \item \emph{ @param } token.name character
#' \item \emph{ @param } amount numeric
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse200118} \cr
#'
#'
#' \item status code : 200 | Redemption record
#'
#' \item return type : InlineResponse200118 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1BlvtRedeemRecordGet } \emph{ Redemption Record (USER_DATA) }
#' - Only the data of the latest 90 days is available  Weight(IP): 1
#'
#' \itemize{
#' \item \emph{ @param } token.name character
#' \item \emph{ @param } id integer
#' \item \emph{ @param } start.time integer
#' \item \emph{ @param } end.time integer
#' \item \emph{ @param } limit integer
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } list( \link{inline_response_200_119} ) \cr
#'
#'
#' \item status code : 200 | List of redemption record
#'
#' \item return type : array[InlineResponse200119] 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1BlvtSubscribePost } \emph{ Subscribe BLVT (USER_DATA) }
#' Weight(IP): 1
#'
#' \itemize{
#' \item \emph{ @param } token.name character
#' \item \emph{ @param } cost numeric
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse200116} \cr
#'
#'
#' \item status code : 200 | Subscription Info
#'
#' \item return type : InlineResponse200116 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1BlvtSubscribeRecordGet } \emph{ Query Subscription Record (USER_DATA) }
#' - Only the data of the latest 90 days is available  Weight(IP): 1
#'
#' \itemize{
#' \item \emph{ @param } token.name character
#' \item \emph{ @param } id integer
#' \item \emph{ @param } start.time integer
#' \item \emph{ @param } end.time integer
#' \item \emph{ @param } limit integer
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } \link{InlineResponse200117} \cr
#'
#'
#' \item status code : 200 | List of subscription record
#'
#' \item return type : InlineResponse200117 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1BlvtTokenInfoGet } \emph{ BLVT Info (MARKET_DATA) }
#' Weight(IP): 1
#'
#' \itemize{
#' \item \emph{ @param } token.name character
#' \item \emph{ @returnType } list( \link{inline_response_200_115} ) \cr
#'
#'
#' \item status code : 200 | List of token information
#'
#' \item return type : array[InlineResponse200115] 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ SapiV1BlvtUserLimitGet } \emph{ BLVT User Limit Info (USER_DATA) }
#' Weight(IP): 1
#'
#' \itemize{
#' \item \emph{ @param } token.name character
#' \item \emph{ @param } recv.window integer
#' \item \emph{ @returnType } list( \link{inline_response_200_120} ) \cr
#'
#'
#' \item status code : 200 | List of token limits
#'
#' \item return type : array[InlineResponse200120] 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized Request
#'
#' \item return type : Error 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' }
#'
#'
#' @examples
#' \dontrun{
#' ####################  SapiV1BlvtRedeemPost  ####################
#'
#' library(binanceRapi)
#' var.token.name <- 'token.name_example' # character | BTCDOWN, BTCUP
#' var.amount <- 1.01 # numeric | 
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Redeem BLVT (USER_DATA)
#' api.instance <- BLVTApi$new()
#'
#' result <- api.instance$SapiV1BlvtRedeemPost(var.token.name, var.amount, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1BlvtRedeemRecordGet  ####################
#'
#' library(binanceRapi)
#' var.token.name <- 'token.name_example' # character | BTCDOWN, BTCUP
#' var.id <- 56 # integer | 
#' var.start.time <- 56 # integer | UTC timestamp in ms
#' var.end.time <- 56 # integer | UTC timestamp in ms
#' var.limit <- 56 # integer | default 1000, max 1000
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Redemption Record (USER_DATA)
#' api.instance <- BLVTApi$new()
#'
#' result <- api.instance$SapiV1BlvtRedeemRecordGet(token.name=var.token.name, id=var.id, start.time=var.start.time, end.time=var.end.time, limit=var.limit, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1BlvtSubscribePost  ####################
#'
#' library(binanceRapi)
#' var.token.name <- 'token.name_example' # character | BTCDOWN, BTCUP
#' var.cost <- 3.4 # numeric | Spot balance
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Subscribe BLVT (USER_DATA)
#' api.instance <- BLVTApi$new()
#'
#' result <- api.instance$SapiV1BlvtSubscribePost(var.token.name, var.cost, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1BlvtSubscribeRecordGet  ####################
#'
#' library(binanceRapi)
#' var.token.name <- 'token.name_example' # character | BTCDOWN, BTCUP
#' var.id <- 56 # integer | 
#' var.start.time <- 56 # integer | UTC timestamp in ms
#' var.end.time <- 56 # integer | UTC timestamp in ms
#' var.limit <- 500 # integer | Default 500; max 1000.
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #Query Subscription Record (USER_DATA)
#' api.instance <- BLVTApi$new()
#'
#' result <- api.instance$SapiV1BlvtSubscribeRecordGet(token.name=var.token.name, id=var.id, start.time=var.start.time, end.time=var.end.time, limit=var.limit, recv.window=var.recv.window)
#'
#'
#' ####################  SapiV1BlvtTokenInfoGet  ####################
#'
#' library(binanceRapi)
#' var.token.name <- 'token.name_example' # character | BTCDOWN, BTCUP
#'
#' #BLVT Info (MARKET_DATA)
#' api.instance <- BLVTApi$new()
#'
#' result <- api.instance$SapiV1BlvtTokenInfoGet(token.name=var.token.name)
#'
#'
#' ####################  SapiV1BlvtUserLimitGet  ####################
#'
#' library(binanceRapi)
#' var.token.name <- 'token.name_example' # character | BTCDOWN, BTCUP
#' var.recv.window <- 5000 # integer | The value cannot be greater than 60000
#'
#' #BLVT User Limit Info (USER_DATA)
#' api.instance <- BLVTApi$new()
#'
#' result <- api.instance$SapiV1BlvtUserLimitGet(token.name=var.token.name, recv.window=var.recv.window)
#'
#'
#' }
#' @importFrom R6 R6Class
#' @importFrom base64enc base64encode
#' @export
BLVTApi <- R6::R6Class(
  'BLVTApi',
  public = list(
    apiClient = NULL,
    initialize = function(apiClient){
      if (!missing(apiClient)) {
        self$apiClient <- apiClient
      }
      else {
        self$apiClient <- ApiClient$new()
      }
    },
    SapiV1BlvtRedeemPost = function(token.name, amount, recv.window=NULL, ...){
      apiResponse <- self$SapiV1BlvtRedeemPostWithHttpInfo(token.name, amount, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1BlvtRedeemPostWithHttpInfo = function(token.name, amount, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`token.name`)) {
        stop("Missing required parameter `token.name`.")
      }

      if (missing(`amount`)) {
        stop("Missing required parameter `amount`.")
      }

      queryParams['tokenName'] <- token.name

      queryParams['amount'] <- amount

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/blvt/redeem"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "POST",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "InlineResponse200118", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1BlvtRedeemRecordGet = function(token.name=NULL, id=NULL, start.time=NULL, end.time=NULL, limit=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1BlvtRedeemRecordGetWithHttpInfo(token.name, id, start.time, end.time, limit, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1BlvtRedeemRecordGetWithHttpInfo = function(token.name=NULL, id=NULL, start.time=NULL, end.time=NULL, limit=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      queryParams['tokenName'] <- token.name

      queryParams['id'] <- id

      queryParams['startTime'] <- start.time

      queryParams['endTime'] <- end.time

      queryParams['limit'] <- limit

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/blvt/redeem/record"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "array[InlineResponse200119]", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1BlvtSubscribePost = function(token.name, cost, recv.window=NULL, ...){
      apiResponse <- self$SapiV1BlvtSubscribePostWithHttpInfo(token.name, cost, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1BlvtSubscribePostWithHttpInfo = function(token.name, cost, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`token.name`)) {
        stop("Missing required parameter `token.name`.")
      }

      if (missing(`cost`)) {
        stop("Missing required parameter `cost`.")
      }

      queryParams['tokenName'] <- token.name

      queryParams['cost'] <- cost

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/blvt/subscribe"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "POST",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "InlineResponse200116", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1BlvtSubscribeRecordGet = function(token.name=NULL, id=NULL, start.time=NULL, end.time=NULL, limit=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1BlvtSubscribeRecordGetWithHttpInfo(token.name, id, start.time, end.time, limit, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1BlvtSubscribeRecordGetWithHttpInfo = function(token.name=NULL, id=NULL, start.time=NULL, end.time=NULL, limit=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      queryParams['tokenName'] <- token.name

      queryParams['id'] <- id

      queryParams['startTime'] <- start.time

      queryParams['endTime'] <- end.time

      queryParams['limit'] <- limit

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/blvt/subscribe/record"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "InlineResponse200117", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1BlvtTokenInfoGet = function(token.name=NULL, ...){
      apiResponse <- self$SapiV1BlvtTokenInfoGetWithHttpInfo(token.name, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1BlvtTokenInfoGetWithHttpInfo = function(token.name=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      queryParams['tokenName'] <- token.name

      body <- NULL
      urlPath <- "/sapi/v1/blvt/tokenInfo"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "array[InlineResponse200115]", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    SapiV1BlvtUserLimitGet = function(token.name=NULL, recv.window=NULL, ...){
      apiResponse <- self$SapiV1BlvtUserLimitGetWithHttpInfo(token.name, recv.window, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    SapiV1BlvtUserLimitGetWithHttpInfo = function(token.name=NULL, recv.window=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      queryParams['tokenName'] <- token.name

      queryParams['recvWindow'] <- recv.window

      queryParams['timestamp'] <- self$apiClient$Timestamp
      
      queryParams['signature'] <- self$apiClient$credentials$sign(queryParams)

      body <- NULL
      urlPath <- "/sapi/v1/blvt/userLimit"
      # API key authentication
      if (nchar(self$apiClient$credentials$key) > 0) {
        headerParams['X-MBX-APIKEY'] <- self$apiClient$credentials$key
      }

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "array[InlineResponse200120]", loadNamespace("binanceRapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    }
  )
)
grahamjwhite/binanceRapi documentation built on Nov. 22, 2022, 9:37 p.m.